summaryrefslogtreecommitdiff
path: root/10/possible_seq.asm
diff options
context:
space:
mode:
authorBond_009 <bond.009@outlook.com>2022-12-01 22:30:22 +0100
committerBond_009 <bond.009@outlook.com>2022-12-01 22:30:22 +0100
commitbaf4910870a6e8999802b9a4a22eabd4142a34e3 (patch)
tree2d11443dc21e53bd0d99d015cf789937d6d95862 /10/possible_seq.asm
parent49d0c908f24b2c193c9deed1716fe36061ba26a1 (diff)
Move all Advent of Codes into one repo
Diffstat (limited to '10/possible_seq.asm')
-rw-r--r--10/possible_seq.asm30
1 files changed, 0 insertions, 30 deletions
diff --git a/10/possible_seq.asm b/10/possible_seq.asm
deleted file mode 100644
index b737d13..0000000
--- a/10/possible_seq.asm
+++ /dev/null
@@ -1,30 +0,0 @@
-global possible_seq
-
-section .rodata
- TRIB: dq 1, 1, 2, 4, 7 ; tribonacci sequence (without first 2 zeroes)
-
-section .text
-
-possible_seq:
- mov eax, 1 ; set up return value
- xor ecx, ecx ; # of connected elements counter
- lea rdx, [rdi + 4 * rsi - 4] ; pointer to the last element
- lea r8, [rel TRIB]
- jmp .loop
-.ncon:
- imul rax, qword [r8 + 8 * rcx]
- xor ecx, ecx
- add rdi, 4
- cmp rdi, rdx
- jae .return
-.loop:
- mov esi, dword [rdi + 4]
- sub esi, dword [rdi]
- cmp esi, 1
- jne .ncon
- inc ecx
- add rdi, 4
- cmp rdi, rdx
- jb .loop
-.return:
- ret