include <std.stas>

fn addup_asm 1 1 {
	asm "rsi" -> "rax" {
		"	xor rax, rax"
		"loop_start:"
		"	test rsi, rsi"
		"	jz loop_leave"
		"	add rax, rsi"
		"	dec rsi"
		"	jmp loop_start"
		"loop_leave:"
	}
}

fn addsome 1 1 {
	asm "rdi" -> "rdi" {
		"add rdi, 1000"
	}
}

fn givesome 0 1 {
	asm -> "rdi" {
		"mov rdi, 22"
	}
}

fn main {
	999 addsome putuln
	10 addup_asm putuln
	givesome putuln
}

; `stas add.stas -o -`