From 0843094b9d862f015077867263c775f4f0b3af5e Mon Sep 17 00:00:00 2001 From: Franciszek Malinka Date: Mon, 29 Mar 2021 01:45:30 +0200 Subject: update --- Semestr 4/ask/lista5/zad2.asm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Semestr 4/ask/lista5/zad2.asm (limited to 'Semestr 4/ask/lista5/zad2.asm') diff --git a/Semestr 4/ask/lista5/zad2.asm b/Semestr 4/ask/lista5/zad2.asm new file mode 100644 index 0000000..7fe4364 --- /dev/null +++ b/Semestr 4/ask/lista5/zad2.asm @@ -0,0 +1,15 @@ +puzzle2: + movq %rdi, %rax ; rax := rdi +.L3: movb (%rax), %r9b ; r9b := *rax + leaq 1(%rax), %r8 ; r8 := rax + 1 + movq %rsi, %rdx ; rdx := *rsi +.L2: movb (%rdx), %cl ; cl := *rdx + incq %rdx ; rdx++ + testb %cl, %cl ; if (cl == 0) + je .L4 ; then jump to L4 + cmpb %cl, %r9b ; if (cl != r9b) + jne .L2 ; then jump to L2 + movq %r8, %rax ; rax := r8 + jmp .L3 ; jump to L3 +.L4 subq %rdi, %rax ; rax -= rdi + ret \ No newline at end of file -- cgit v1.2.3