.intel_syntax noprefix

.data

.bss

.text

.globl _syscall, _mmap

	# rax - return value 64bit
	# eax - return value 32bit

	# params
	# 1 - RDI
	# 2 - RSI
	# 3 - RDX
	# 4 - RCX 
	# 5 - R8
	# 6 - R9
	# 7 - [rsp+8]
	# 8 - [rsp+16]
	# etc

_start:
	xor rbp, rbp
	pop rdi
	mov rsi, rsp
	and rsp, -16
	call main

	mov rdi, rax
	mov rax, 60 # SYS_exit
	syscall

	ret

_syscall:
	mov	rax, rdi
	mov	rdi, rsi
	mov rsi, rdx
	mov rdx, rcx
	mov r10, r8
	mov r8, r9
	syscall
	ret

_mmap:
	mov rax, 9
	syscall
	ret
