[SPCA] Improve Stack section

This commit is contained in:
RobinB27
2026-01-13 14:46:30 +01:00
parent b1ff4cf1dd
commit 4629cb75e1
7 changed files with 65 additions and 12 deletions

View File

@@ -0,0 +1,12 @@
factorial:
pushq %rbx # Preserve frame pointer
movl %edi, %ebx
movl $1, %eax
cmpl $1, %edi
jle .QUIT # Base case reached: quit
leal -1(%rdi), %edi # Prepare args for next function call
call factorial
imull %ebx, %eax # Use result of function call
.QUIT:
popq %rbx # Restore frame pointer
ret