aboutsummaryrefslogtreecommitdiff
path: root/Semestr 4/ask/lista6/puzzle.s
diff options
context:
space:
mode:
authorFranciszek Malinka <franciszek.malinka@gmail.com>2021-10-05 21:49:54 +0200
committerFranciszek Malinka <franciszek.malinka@gmail.com>2021-10-05 21:49:54 +0200
commitc5fcf7179a83ef65c86c6a4a390029149e518649 (patch)
treed29ffc5b86a0d257453cedcf87d91a13d8bf3b0d /Semestr 4/ask/lista6/puzzle.s
parentf8a88b6a4aba1f66d04711a9330eaba49a50c463 (diff)
Duzy commit ze smieciami
Diffstat (limited to 'Semestr 4/ask/lista6/puzzle.s')
-rw-r--r--Semestr 4/ask/lista6/puzzle.s22
1 files changed, 0 insertions, 22 deletions
diff --git a/Semestr 4/ask/lista6/puzzle.s b/Semestr 4/ask/lista6/puzzle.s
deleted file mode 100644
index 3a39398..0000000
--- a/Semestr 4/ask/lista6/puzzle.s
+++ /dev/null
@@ -1,22 +0,0 @@
- .globl puzzle
-
- .text
-puzzle:
- push %rbp # adres koncu ramki, callee-saved
- xorl %eax, %eax # zeruje %rax
- mov %rsi, %rbp # rbp := rsi, czyli rbp := p
- push %rbx # rbx na stos, callee-saved
- mov %rdi, %rbx # rbx := rdi, czyli rbx := n
- sub $24, %rsp # rsp -= 24, czyli przesun rsp o 3 bajty w dół
- test %rdi, %rdi # rdi == 0?, czyli n == 0?
- jle .L1 # jesli tak, skocz do L1
- lea 8(%rsp), %rsi # w p.w. rsi := rsp + 8
- lea (%rdi,%rdi), %rdi # rdi := 2*rdi
- call puzzle # wywolanie rekurencyjne puzzle
- add 8(%rsp), %rax # rax := rax + *(rsp + 8)
- add %rax, %rbx # rbx := rbx + rax
-.L1: mov %rbx, (%rbp) # *rbp := rbx, czyli *p := rbx
- add $24, %rsp # rsp := rsp + 24 (przesun adres stacka o 3 bajty)
- pop %rbx # przywracamy rbx
- pop %rbp # przywracamy rbp
- ret