Skip to content

Commit

Permalink
Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert-M-Lucas committed Jun 21, 2024
1 parent 0017d72 commit d896fef
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 52 deletions.
21 changes: 13 additions & 8 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

69 changes: 32 additions & 37 deletions build/out.asm
Original file line number Diff line number Diff line change
Expand Up @@ -5,49 +5,44 @@ section .text
main:
push rbp
mov rbp, rsp
mov qword [rbp-8], 1
mov qword [rbp-8], 0
main_0:
mov rax, qword [rbp-8]
mov qword [rbp-16], rax
sub rsp, 16
call _2
add rsp, 16
mov qword [rbp-16], 1
mov rax, qword [rbp-16]
leave
ret


_2:
push rbp
mov rbp, rsp
mov rax, qword [rbp+16]
mov qword [rbp-8], rax
mov qword [rbp-17], rax
mov qword [rbp-25], 1000000000
mov rax, qword [rbp-25]
cmp rax, qword [rbp-17]
jg __18_2
mov byte [rbp-9], 0
jmp __18_3
__18_2:
mov byte [rbp-9], 1
__18_3:
cmp byte [rbp-9], 0
jz main_1
mov rax, rbp
add rax, -8
mov qword [rbp-33], rax
mov qword [rbp-41], 1
mov rax, qword [rbp-33]
mov rdx, qword [rbp-41]
add qword [rax], rdx
jmp main_0
main_1:
mov rax, qword [rbp-8]
mov qword [rbp-33], rax
mov rdi, __8_fstr
mov rsi, [rbp-8]
mov rsi, [rbp-33]
mov al, 0
sub rsp, 8
sub rsp, 33
extern printf
call printf
add rsp, 8
mov qword [rbp-16], 12
mov qword [rbp-24], 12
mov rax, rbp
add rax, 16
mov qword [rbp-32], rax
mov qword [rbp-40], 1
mov rax, qword [rbp-32]
mov rdx, qword [rbp-40]
add qword [rax], rdx
mov rax, qword [rbp+16]
mov qword [rbp-48], rax
mov rax, qword [rbp-48]
mov qword [rbp-56], rax
sub rsp, 56
call _2
add rsp, 56
add rsp, 33
mov qword [rbp-41], 1
mov rax, qword [rbp-41]
leave
ret

leave
ret

section .data_readonly
__8_fstr db `Integer: %ld\n`,0
Binary file modified build/out.o
Binary file not shown.
Binary file modified build/out.out
Binary file not shown.
12 changes: 5 additions & 7 deletions main.why
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
fn rec(a: int) {
printi(a);
&a += 1;
rec(a);
}

fn main() -> int {
rec(1);
let a: int = 0;
while (a < 1000000000) {
&a += 1;
}
printi(a);
return 1;
}

Expand Down

0 comments on commit d896fef

Please sign in to comment.