LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/mikecat[P]x86_interpreter/dmem_libc_string.c
// Function: dmem_libc_strcpy
int dmem_libc_strcpy(uint32_t* ret, uint32_t esp) {
	uint32_t dest, src;
	char* str;
	size_t str_len;
	if (!dmem_get_args(esp, 2, &dest, &src)) return 0;

	str = dmem_read_string(src);
	if (str == NULL) return 0;
	str_len = strlen(str);
	if (UINT32_MAX - 1 < str_len) return 0;
	if (!dmemory_is_allocated(dest, (uint32_t)str_len + 1)) return 0;
	dmemory_write(str, dest, (uint32_t)str_len + 1);
	*ret = dest;
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl -0x14(%rbp), %edi
movl $0x2, %esi
leaq -0x18(%rbp), %rdx
leaq -0x1c(%rbp), %rcx
movb $0x0, %al
callq 0x8280
cmpl $0x0, %eax
jne 0xb427
movl $0x0, -0x4(%rbp)
jmp 0xb4a8
movl -0x1c(%rbp), %edi
callq 0x81d0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0xb443
movl $0x0, -0x4(%rbp)
jmp 0xb4a8
movq -0x28(%rbp), %rdi
callq 0x1080
movq %rax, -0x30(%rbp)
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
cmpq -0x30(%rbp), %rax
jae 0xb464
movl $0x0, -0x4(%rbp)
jmp 0xb4a8
movl -0x18(%rbp), %edi
movq -0x30(%rbp), %rax
movl %eax, %esi
addl $0x1, %esi
callq 0x7f60
cmpl $0x0, %eax
jne 0xb483
movl $0x0, -0x4(%rbp)
jmp 0xb4a8
movq -0x28(%rbp), %rdi
movl -0x18(%rbp), %esi
movq -0x30(%rbp), %rax
movl %eax, %edx
addl $0x1, %edx
callq 0x7ad0
movl -0x18(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/mikecat[P]x86_interpreter/dmem_libc_string.c
// Function: dmem_libc_strncpy
int dmem_libc_strncpy(uint32_t* ret, uint32_t esp) {
	uint32_t dest, src, limit;
	uint32_t i;
	int use_src = 1;
	int printf(const char*, ...);
	if (!dmem_get_args(esp, 3, &dest, &src, &limit)) return 0;
	if (!dmemory_is_allocated(dest, limit)) return 0;
	for (i = 0; i < limit; i++) {
		uint8_t c;
		int ok = 0;
		if (use_src) {
			if (UINT32_MAX - i < src) return 0;
			c = (uint8_t)dmem_read_uint(&ok, src + i, 1);
			if (!ok) return 0;
			if (c == 0) use_src = 0;
		} else {
			c = 0;
		}
		dmemory_write(&c, dest + i, 1);
	}
	*ret = dest;
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl $0x1, -0x28(%rbp)
movl -0x14(%rbp), %edi
movl $0x3, %esi
leaq -0x18(%rbp), %rdx
leaq -0x1c(%rbp), %rcx
leaq -0x20(%rbp), %r8
movb $0x0, %al
callq 0x8280
cmpl $0x0, %eax
jne 0xb502
movl $0x0, -0x4(%rbp)
jmp 0xb5c2
movl -0x18(%rbp), %edi
movl -0x20(%rbp), %esi
callq 0x7f60
cmpl $0x0, %eax
jne 0xb51e
movl $0x0, -0x4(%rbp)
jmp 0xb5c2
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x20(%rbp), %eax
jae 0xb5b2
movl $0x0, -0x30(%rbp)
cmpl $0x0, -0x28(%rbp)
je 0xb58c
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
subl -0x24(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jae 0xb554
movl $0x0, -0x4(%rbp)
jmp 0xb5c2
movl -0x1c(%rbp), %esi
addl -0x24(%rbp), %esi
leaq -0x30(%rbp), %rdi
movl $0x1, %edx
callq 0x8110
movb %al, -0x29(%rbp)
cmpl $0x0, -0x30(%rbp)
jne 0xb57a
movl $0x0, -0x4(%rbp)
jmp 0xb5c2
movzbl -0x29(%rbp), %eax
cmpl $0x0, %eax
jne 0xb58a
movl $0x0, -0x28(%rbp)
jmp 0xb590
movb $0x0, -0x29(%rbp)
movl -0x18(%rbp), %esi
addl -0x24(%rbp), %esi
leaq -0x29(%rbp), %rdi
movl $0x1, %edx
callq 0x7ad0
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xb525
movl -0x18(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/mikecat[P]x86_interpreter/dmem_libc_string.c
// Function: dmem_libc_strcmp
int dmem_libc_strcmp(uint32_t* ret, uint32_t esp) {
	uint32_t sptr1, sptr2;
	uint32_t i;
	if (!dmem_get_args(esp, 2, &sptr1, &sptr2)) return 0;

	for (i = 0; ; i++) {
		uint32_t c1, c2;
		int ok1, ok2;
		if (UINT32_MAX - sptr1 < i || UINT32_MAX - sptr2 < i) return 0;
		c1 = dmem_read_uint(&ok1, sptr1 + i, 1);
		c2 = dmem_read_uint(&ok2, sptr2 + i, 1);
		if (!(ok1 && ok2)) return 0;
		if (c1 > c2) {
			*ret = 1;
			return 1;
		} else if (c1 < c2) {
			*ret = -1;
			return 1;
		} else if (c1 == 0) { /* c1 == c2 */
			*ret = 0;
			return 1;
		}
		if (i == UINT32_MAX) return 0;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl -0x14(%rbp), %edi
movl $0x2, %esi
leaq -0x18(%rbp), %rdx
leaq -0x1c(%rbp), %rcx
movb $0x0, %al
callq 0x8280
cmpl $0x0, %eax
jne 0xb607
movl $0x0, -0x4(%rbp)
jmp 0xb6e9
movl $0x0, -0x20(%rbp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
subl -0x18(%rbp), %eax
cmpl -0x20(%rbp), %eax
jb 0xb628
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
subl -0x1c(%rbp), %eax
cmpl -0x20(%rbp), %eax
jae 0xb634
movl $0x0, -0x4(%rbp)
jmp 0xb6e9
movl -0x18(%rbp), %esi
addl -0x20(%rbp), %esi
leaq -0x2c(%rbp), %rdi
movl $0x1, %edx
callq 0x8110
movl %eax, -0x24(%rbp)
movl -0x1c(%rbp), %esi
addl -0x20(%rbp), %esi
leaq -0x30(%rbp), %rdi
movl $0x1, %edx
callq 0x8110
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x2c(%rbp)
je 0xb66e
cmpl $0x0, -0x30(%rbp)
jne 0xb677
movl $0x0, -0x4(%rbp)
jmp 0xb6e9
movl -0x24(%rbp), %eax
cmpl -0x28(%rbp), %eax
jbe 0xb692
movq -0x10(%rbp), %rax
movl $0x1, (%rax)
movl $0x1, -0x4(%rbp)
jmp 0xb6e9
movl -0x24(%rbp), %eax
cmpl -0x28(%rbp), %eax
jae 0xb6ad
movq -0x10(%rbp), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movl $0x1, -0x4(%rbp)
jmp 0xb6e9
cmpl $0x0, -0x24(%rbp)
jne 0xb6c6
movq -0x10(%rbp), %rax
movl $0x0, (%rax)
movl $0x1, -0x4(%rbp)
jmp 0xb6e9
jmp 0xb6c8
jmp 0xb6ca
cmpl $-0x1, -0x20(%rbp)
jne 0xb6d9
movl $0x0, -0x4(%rbp)
jmp 0xb6e9
jmp 0xb6db
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xb60e
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/mikecat[P]x86_interpreter/dmem_libc_string.c
// Function: dmem_libc_strncmp
int dmem_libc_strncmp(uint32_t* ret, uint32_t esp) {
	uint32_t sptr1, sptr2, n;
	uint32_t i;
	if (!dmem_get_args(esp, 3, &sptr1, &sptr2, &n)) return 0;

	for (i = 0; i < n; i++) {
		uint32_t c1, c2;
		int ok1, ok2;
		if (UINT32_MAX - sptr1 < i || UINT32_MAX - sptr2 < i) return 0;
		c1 = dmem_read_uint(&ok1, sptr1 + i, 1);
		c2 = dmem_read_uint(&ok2, sptr2 + i, 1);
		if (!(ok1 && ok2)) return 0;
		if (c1 > c2) {
			*ret = 1;
			return 1;
		} else if (c1 < c2) {
			*ret = -1;
			return 1;
		} else if (c1 == 0) { /* c1 == c2 */
			break;
		}
		if (i == UINT32_MAX) return 0;
	}
	*ret = 0;
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl -0x14(%rbp), %edi
movl $0x3, %esi
leaq -0x18(%rbp), %rdx
leaq -0x1c(%rbp), %rcx
leaq -0x20(%rbp), %r8
movb $0x0, %al
callq 0x8280
cmpl $0x0, %eax
jne 0xb73b
movl $0x0, -0x4(%rbp)
jmp 0xb829
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x20(%rbp), %eax
jae 0xb818
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
subl -0x18(%rbp), %eax
cmpl -0x24(%rbp), %eax
jb 0xb768
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
subl -0x1c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jae 0xb774
movl $0x0, -0x4(%rbp)
jmp 0xb829
movl -0x18(%rbp), %esi
addl -0x24(%rbp), %esi
leaq -0x30(%rbp), %rdi
movl $0x1, %edx
callq 0x8110
movl %eax, -0x28(%rbp)
movl -0x1c(%rbp), %esi
addl -0x24(%rbp), %esi
leaq -0x34(%rbp), %rdi
movl $0x1, %edx
callq 0x8110
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x30(%rbp)
je 0xb7ae
cmpl $0x0, -0x34(%rbp)
jne 0xb7b7
movl $0x0, -0x4(%rbp)
jmp 0xb829
movl -0x28(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jbe 0xb7d2
movq -0x10(%rbp), %rax
movl $0x1, (%rax)
movl $0x1, -0x4(%rbp)
jmp 0xb829
movl -0x28(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jae 0xb7ed
movq -0x10(%rbp), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movl $0x1, -0x4(%rbp)
jmp 0xb829
cmpl $0x0, -0x28(%rbp)
jne 0xb7f5
jmp 0xb818
jmp 0xb7f7
jmp 0xb7f9
cmpl $-0x1, -0x24(%rbp)
jne 0xb808
movl $0x0, -0x4(%rbp)
jmp 0xb829
jmp 0xb80a
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xb742
movq -0x10(%rbp), %rax
movl $0x0, (%rax)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/mikecat[P]x86_interpreter/dmem_libc_string.c
// Function: dmem_libc_strchr
int dmem_libc_strchr(uint32_t* ret, uint32_t esp) {
	uint32_t str_ptr, target;
	char* str;
	char* res;
	if (!dmem_get_args(esp, 2, &str_ptr, &target)) return 0;

	str = dmem_read_string(str_ptr);
	if (str == NULL) return 0;

	res = strchr(str, target);
	if (res == NULL) {
		*ret = 0;
	} else {
		*ret = str_ptr + (res - str);
	}
	free(str);
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl -0x14(%rbp), %edi
movl $0x2, %esi
leaq -0x18(%rbp), %rdx
leaq -0x1c(%rbp), %rcx
movb $0x0, %al
callq 0x8280
cmpl $0x0, %eax
jne 0xb874
movl $0x0, -0x4(%rbp)
jmp 0xb8dc
movl -0x18(%rbp), %edi
callq 0x81d0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0xb890
movl $0x0, -0x4(%rbp)
jmp 0xb8dc
movq -0x28(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x1090
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0xb8b3
movq -0x10(%rbp), %rax
movl $0x0, (%rax)
jmp 0xb8cc
movl -0x18(%rbp), %eax
movq -0x30(%rbp), %rcx
movq -0x28(%rbp), %rdx
subq %rdx, %rcx
addq %rcx, %rax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movq -0x28(%rbp), %rdi
callq 0x1030
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/mikecat[P]x86_interpreter/dmem_libc_string.c
// Function: dmem_libc_memset
int dmem_libc_memset(uint32_t* ret, uint32_t esp) {
	uint32_t target, data, size;
	char* buf;
	if (!dmem_get_args(esp, 3, &target, &data, &size)) return 0;
	if (!dmemory_is_allocated(target, size)) return 0;
	buf = malloc(size);
	if (buf == NULL) return 0;
	memset(buf, (uint8_t)data, size);
	dmemory_write(buf, target, size);
	free(buf);
	*ret = target;
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl -0x14(%rbp), %edi
movl $0x3, %esi
leaq -0x18(%rbp), %rdx
leaq -0x1c(%rbp), %rcx
leaq -0x20(%rbp), %r8
movb $0x0, %al
callq 0x8280
cmpl $0x0, %eax
jne 0xb928
movl $0x0, -0x4(%rbp)
jmp 0xb99e
movl -0x18(%rbp), %edi
movl -0x20(%rbp), %esi
callq 0x7f60
cmpl $0x0, %eax
jne 0xb941
movl $0x0, -0x4(%rbp)
jmp 0xb99e
movl -0x20(%rbp), %eax
movl %eax, %edi
callq 0x1110
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0xb95f
movl $0x0, -0x4(%rbp)
jmp 0xb99e
movq -0x28(%rbp), %rdi
movl -0x1c(%rbp), %eax
movzbl %al, %eax
movl -0x20(%rbp), %ecx
movl %ecx, %edx
movzbl %al, %esi
callq 0x10a0
movq -0x28(%rbp), %rdi
movl -0x18(%rbp), %esi
movl -0x20(%rbp), %edx
callq 0x7ad0
movq -0x28(%rbp), %rdi
callq 0x1030
movl -0x18(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/mikecat[P]x86_interpreter/dmem_libc_string.c
// Function: dmem_libc_strlen
int dmem_libc_strlen(uint32_t* ret, uint32_t esp) {
	uint32_t str_ptr;
	uint32_t i;
	if (!dmem_get_args(esp, 1, &str_ptr)) return 0;

	i = 0;
	for (;;) {
		int ok;
		uint32_t c = dmem_read_uint(&ok, str_ptr + i, 1);
		if (!ok) return 0;
		if (c == 0) {
			*ret = i;
			return 1;
		}
		if (i == UINT32_MAX || UINT32_MAX - i - 1 < str_ptr) return 0;
		i++;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl -0x14(%rbp), %edi
movl $0x1, %esi
leaq -0x18(%rbp), %rdx
movb $0x0, %al
callq 0x8280
cmpl $0x0, %eax
jne 0xb9e0
movl $0x0, -0x4(%rbp)
jmp 0xba4f
movl $0x0, -0x1c(%rbp)
movl -0x18(%rbp), %esi
addl -0x1c(%rbp), %esi
leaq -0x20(%rbp), %rdi
movl $0x1, %edx
callq 0x8110
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x20(%rbp)
jne 0xba0d
movl $0x0, -0x4(%rbp)
jmp 0xba4f
cmpl $0x0, -0x24(%rbp)
jne 0xba25
movl -0x1c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movl $0x1, -0x4(%rbp)
jmp 0xba4f
cmpl $-0x1, -0x1c(%rbp)
je 0xba3b
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
subl -0x1c(%rbp), %eax
subl $0x1, %eax
cmpl -0x18(%rbp), %eax
jae 0xba44
movl $0x0, -0x4(%rbp)
jmp 0xba4f
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xb9e7
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/mikecat[P]x86_interpreter/read_raw.c
// Function: read_raw
int read_raw(const char* filename) {
	size_t file_size = 0;
	void* file_data = read_whole_file(&file_size, filename);
	if (file_data == NULL) return 0;
	dmemory_allocate(0, file_size);
	dmemory_write(file_data, 0, file_size);
	free(file_data);
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq -0x10(%rbp), %rsi
leaq -0x18(%rbp), %rdi
callq 0xc7a0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0xc9b5
movl $0x0, -0x4(%rbp)
jmp 0xc9e3
movq -0x18(%rbp), %rax
movl %eax, %esi
xorl %edi, %edi
callq 0x7c60
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rax
movl %eax, %edx
xorl %esi, %esi
callq 0x7ad0
movq -0x20(%rbp), %rdi
callq 0x1030
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/mikecat[P]x86_interpreter/read_elf.c
// Function: read_num
static uint32_t read_num(const uint8_t* data, int size) {
	uint32_t ret = 0;
	int i;
	for (i = 0; i < size; i++) {
		ret |= data[i] << (i * 8);
	}
	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl $0x0, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0xceb6
movq -0x8(%rbp), %rax
movslq -0x14(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl -0x14(%rbp), %ecx
shll $0x3, %ecx
shll %cl, %eax
orl -0x10(%rbp), %eax
movl %eax, -0x10(%rbp)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xce89
movl -0x10(%rbp), %eax
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/mikecat[P]x86_interpreter/xv6_syscall.c
// Function: initialize_xv6_syscall
int initialize_xv6_syscall(uint32_t work_addr) {
	int i;
	sbrk_origin = work_addr;
	sbrk_addr = work_addr;

	for (i = 0; i < STREAM_MAX; i++) {
		streams[i].stream = NULL;
		streams[i].ref_cnt = 0;
		streams[i].can_read = 0;
		streams[i].can_write = 0;
		streams[i].prev_operation = POP_NONE;
	}
	for (i = 0; i < FD_MAX; i++) {
		fds[i] = NULL;
	}
	/* ref_cnt = 1(from interpreter guest) + 1(from interpreter itself) */
	streams[0].stream = stdin;
	streams[0].ref_cnt = 1 + 1;
	streams[0].can_read = 1;
	streams[0].can_write = 0;
	streams[1].stream = stdout;
	streams[1].ref_cnt = 1 + 1;
	streams[1].can_read = 0;
	streams[1].can_write = 1;
	streams[2].stream = stderr;
	streams[2].ref_cnt = 1 + 1;
	streams[2].can_read = 0;
	streams[2].can_write = 1;
	fds[0] = &streams[0];
	fds[1] = &streams[1];
	fds[2] = &streams[2];
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, -0x4(%rbp)
movl -0x4(%rbp), %eax
movl %eax, 0xa820(%rip)      # 0x17e60
movl -0x4(%rbp), %eax
movl %eax, 0xa81b(%rip)      # 0x17e64
movl $0x0, -0x8(%rbp)
cmpl $0x400, -0x8(%rbp)      # imm = 0x400
jge 0xd6e8
movslq -0x8(%rbp), %rcx
leaq 0xa808(%rip), %rax      # 0x17e70
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq $0x0, (%rax)
movslq -0x8(%rbp), %rcx
leaq 0xa7ef(%rip), %rax      # 0x17e70
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl $0x0, 0x8(%rax)
movslq -0x8(%rbp), %rcx
leaq 0xa7d6(%rip), %rax      # 0x17e70
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl $0x0, 0xc(%rax)
movslq -0x8(%rbp), %rcx
leaq 0xa7bd(%rip), %rax      # 0x17e70
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl $0x0, 0x10(%rax)
movslq -0x8(%rbp), %rcx
leaq 0xa7a4(%rip), %rax      # 0x17e70
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl $0x0, 0x14(%rax)
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0xd650
movl $0x0, -0x8(%rbp)
cmpl $0x400, -0x8(%rbp)      # imm = 0x400
jge 0xd716
movslq -0x8(%rbp), %rcx
leaq 0x1076d(%rip), %rax     # 0x1de70
movq $0x0, (%rax,%rcx,8)
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0xd6ef
movq 0x78b3(%rip), %rax      # 0x14fd0
movq (%rax), %rax
movq %rax, 0xa749(%rip)      # 0x17e70
movl $0x2, 0xa747(%rip)      # 0x17e78
movl $0x1, 0xa741(%rip)      # 0x17e7c
movl $0x0, 0xa73b(%rip)      # 0x17e80
movq 0x787c(%rip), %rax      # 0x14fc8
movq (%rax), %rax
movq %rax, 0xa732(%rip)      # 0x17e88
movl $0x2, 0xa730(%rip)      # 0x17e90
movl $0x0, 0xa72a(%rip)      # 0x17e94
movl $0x1, 0xa724(%rip)      # 0x17e98
movq 0x7875(%rip), %rax      # 0x14ff0
movq (%rax), %rax
movq %rax, 0xa71b(%rip)      # 0x17ea0
movl $0x2, 0xa719(%rip)      # 0x17ea8
movl $0x0, 0xa713(%rip)      # 0x17eac
movl $0x1, 0xa70d(%rip)      # 0x17eb0
leaq 0xa6c6(%rip), %rax      # 0x17e70
movq %rax, 0x106bf(%rip)     # 0x1de70
leaq 0xa6b8(%rip), %rax      # 0x17e70
addq $0x18, %rax
movq %rax, 0x106b5(%rip)     # 0x1de78
leaq 0xa6a6(%rip), %rax      # 0x17e70
addq $0x30, %rax
movq %rax, 0x106ab(%rip)     # 0x1de80
movl $0x1, %eax
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/mikecat[P]x86_interpreter/xv6_syscall.c
// Function: xv6_syscall
int xv6_syscall(uint32_t regs[]) {
	switch (regs[EAX]) {
		case 2: /* exit */
			return 0;
		case 5: /* read */
			return xv6_read(regs);
		case 10: /* dup */
			return xv6_dup(regs);
		case 12: /* sbrk */
			return xv6_sbrk(regs);
		case 15: /* open */
			return xv6_open(regs);
		case 16: /* write */
			return xv6_write(regs);
		case 21:
			return xv6_close(regs);
		default: /* 不正もしくは未実装 */
			regs[EAX] = -1;
			break;
	}
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
addl $-0x2, %eax
movl %eax, %ecx
movq %rcx, -0x18(%rbp)
subl $0x13, %eax
ja 0xd871
movq -0x18(%rbp), %rax
leaq 0x4c0d(%rip), %rcx      # 0x12418
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x0, -0x4(%rbp)
jmp 0xd882
movq -0x10(%rbp), %rdi
callq 0xd890
movl %eax, -0x4(%rbp)
jmp 0xd882
movq -0x10(%rbp), %rdi
callq 0xda30
movl %eax, -0x4(%rbp)
jmp 0xd882
movq -0x10(%rbp), %rdi
callq 0xdb40
movl %eax, -0x4(%rbp)
jmp 0xd882
movq -0x10(%rbp), %rdi
callq 0xdc30
movl %eax, -0x4(%rbp)
jmp 0xd882
movq -0x10(%rbp), %rdi
callq 0xdf50
movl %eax, -0x4(%rbp)
jmp 0xd882
movq -0x10(%rbp), %rdi
callq 0xe100
movl %eax, -0x4(%rbp)
jmp 0xd882
movq -0x10(%rbp), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/mikecat[P]x86_interpreter/xv6_syscall.c
// Function: xv6_read
static int xv6_read(uint32_t regs[]) {
	uint32_t fd, buf, n;
	uint8_t* data;
	size_t read_size;
	if (!dmem_get_args(regs[ESP], 3, &fd, &buf, &n)) {
		regs[EAX] = -1;
		return 1;
	}
	/* 入力元のチェック */
	if (FD_MAX <= fd || fds[fd] == NULL || !fds[fd]->can_read) {
		regs[EAX] = -1;
		return 1;
	}
	/* データを取得 */
	data = malloc(n);
	if (data == NULL) {
		perror("malloc");
		return -1;
	}
	if (fds[fd]->prev_operation == POP_WRITE) fseek(fds[fd]->stream, 0, SEEK_CUR);
	read_size = fread(data, 1, n, fds[fd]->stream);
	fds[fd]->prev_operation = POP_READ;
	if (!dmemory_is_allocated(buf, read_size)) {
		/* 指定された領域が確保されていない */
		regs[EAX] = -1;
		return 1;
	}
	dmemory_write(data, buf, read_size);
	free(data);
	/* 成功 */
	regs[EAX] = read_size;
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl 0x10(%rax), %edi
movl $0x3, %esi
leaq -0x14(%rbp), %rdx
leaq -0x18(%rbp), %rcx
leaq -0x1c(%rbp), %r8
movb $0x0, %al
callq 0x8280
cmpl $0x0, %eax
jne 0xd8d6
movq -0x10(%rbp), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movl $0x1, -0x4(%rbp)
jmp 0xda18
movl $0x400, %eax            # imm = 0x400
cmpl -0x14(%rbp), %eax
jbe 0xd909
movl -0x14(%rbp), %eax
movl %eax, %ecx
leaq 0x10584(%rip), %rax     # 0x1de70
cmpq $0x0, (%rax,%rcx,8)
je 0xd909
movl -0x14(%rbp), %eax
movl %eax, %ecx
leaq 0x10571(%rip), %rax     # 0x1de70
movq (%rax,%rcx,8), %rax
cmpl $0x0, 0xc(%rax)
jne 0xd91f
movq -0x10(%rbp), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movl $0x1, -0x4(%rbp)
jmp 0xda18
movl -0x1c(%rbp), %eax
movl %eax, %edi
callq 0x1110
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0xd94c
leaq 0x4276(%rip), %rdi      # 0x11bb1
callq 0x1170
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xda18
movl -0x14(%rbp), %eax
movl %eax, %ecx
leaq 0x10518(%rip), %rax     # 0x1de70
movq (%rax,%rcx,8), %rax
cmpl $0x2, 0x14(%rax)
jne 0xd983
movl -0x14(%rbp), %eax
movl %eax, %ecx
leaq 0x10502(%rip), %rax     # 0x1de70
movq (%rax,%rcx,8), %rax
movq (%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x1, %edx
callq 0x1130
movq -0x28(%rbp), %rdi
movl -0x1c(%rbp), %eax
movl %eax, %edx
movl -0x14(%rbp), %eax
movl %eax, %ecx
leaq 0x104d8(%rip), %rax     # 0x1de70
movq (%rax,%rcx,8), %rax
movq (%rax), %rcx
movl $0x1, %esi
callq 0x1060
movq %rax, -0x30(%rbp)
movl -0x14(%rbp), %eax
movl %eax, %ecx
leaq 0x104b7(%rip), %rax     # 0x1de70
movq (%rax,%rcx,8), %rax
movl $0x1, 0x14(%rax)
movl -0x18(%rbp), %edi
movq -0x30(%rbp), %rax
movl %eax, %esi
callq 0x7f60
cmpl $0x0, %eax
jne 0xd9ea
movq -0x10(%rbp), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movl $0x1, -0x4(%rbp)
jmp 0xda18
movq -0x28(%rbp), %rdi
movl -0x18(%rbp), %esi
movq -0x30(%rbp), %rax
movl %eax, %edx
callq 0x7ad0
movq -0x28(%rbp), %rdi
callq 0x1030
movq -0x30(%rbp), %rax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/mikecat[P]x86_interpreter/xv6_syscall.c
// Function: xv6_dup
static int xv6_dup(uint32_t regs[]) {
	uint32_t fd;
	uint32_t i;
	if (!dmem_get_args(regs[ESP], 1, &fd)) {
		regs[EAX] = -1;
		return 1;
	}
	if (FD_MAX <= fd || fds[fd] == NULL) {
		regs[EAX] = -1;
		return 1;
	}
	for (i = 0; i < FD_MAX; i++) {
		if (fds[i] == NULL) {
			fds[i] = fds[fd];
			fds[fd]->ref_cnt++;
			regs[EAX] = i;
			return 1;
		}
	}
	regs[EAX] = -1;
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl 0x10(%rax), %edi
movl $0x1, %esi
leaq -0x14(%rbp), %rdx
movb $0x0, %al
callq 0x8280
cmpl $0x0, %eax
jne 0xda6e
movq -0x10(%rbp), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movl $0x1, -0x4(%rbp)
jmp 0xdb2d
movl $0x400, %eax            # imm = 0x400
cmpl -0x14(%rbp), %eax
jbe 0xda8b
movl -0x14(%rbp), %eax
movl %eax, %ecx
leaq 0x103ec(%rip), %rax     # 0x1de70
cmpq $0x0, (%rax,%rcx,8)
jne 0xdaa1
movq -0x10(%rbp), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movl $0x1, -0x4(%rbp)
jmp 0xdb2d
movl $0x0, -0x18(%rbp)
cmpl $0x400, -0x18(%rbp)     # imm = 0x400
jae 0xdb1c
movl -0x18(%rbp), %eax
movl %eax, %ecx
leaq 0x103b3(%rip), %rax     # 0x1de70
cmpq $0x0, (%rax,%rcx,8)
jne 0xdb0f
movl -0x14(%rbp), %eax
movl %eax, %ecx
leaq 0x103a0(%rip), %rax     # 0x1de70
movq (%rax,%rcx,8), %rdx
movl -0x18(%rbp), %eax
movl %eax, %ecx
leaq 0x10390(%rip), %rax     # 0x1de70
movq %rdx, (%rax,%rcx,8)
movl -0x14(%rbp), %eax
movl %eax, %ecx
leaq 0x10380(%rip), %rax     # 0x1de70
movq (%rax,%rcx,8), %rax
movl 0x8(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x8(%rax)
movl -0x18(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movl $0x1, -0x4(%rbp)
jmp 0xdb2d
jmp 0xdb11
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0xdaa8
movq -0x10(%rbp), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/mikecat[P]x86_interpreter/xv6_syscall.c
// Function: xv6_sbrk
static int xv6_sbrk(uint32_t regs[]) {
	uint32_t n;
	uint32_t new_addr;
	if (!dmem_get_args(regs[ESP], 1, &n)) {
		regs[EAX] = -1;
		return 1;
	}
	new_addr = sbrk_addr + n;
	if (n & UINT32_C(0x80000000) ? new_addr > sbrk_addr : new_addr < sbrk_addr) {
		/* オーバーフロー */
		regs[EAX] = -1;
		return 1;
	}
	if (new_addr < sbrk_origin) {
		/* 減らしすぎ(本家ではOK?) */
		regs[EAX] = -1;
		return 1;
	}
	if (sbrk_addr < new_addr) {
		dmemory_allocate(sbrk_addr, new_addr - sbrk_addr);
	}
	/* 成功 */
	regs[EAX] = sbrk_addr;
	sbrk_addr = new_addr;
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl 0x10(%rax), %edi
movl $0x1, %esi
leaq -0x14(%rbp), %rdx
movb $0x0, %al
callq 0x8280
cmpl $0x0, %eax
jne 0xdb7e
movq -0x10(%rbp), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movl $0x1, -0x4(%rbp)
jmp 0xdc1b
movl 0xa2e0(%rip), %eax      # 0x17e64
addl -0x14(%rbp), %eax
movl %eax, -0x18(%rbp)
movl -0x14(%rbp), %eax
andl $0x80000000, %eax       # imm = 0x80000000
cmpl $0x0, %eax
je 0xdba4
movl -0x18(%rbp), %eax
cmpl 0xa2c4(%rip), %eax      # 0x17e64
ja 0xdbaf
jmp 0xdbc2
movl -0x18(%rbp), %eax
cmpl 0xa2b7(%rip), %eax      # 0x17e64
jae 0xdbc2
movq -0x10(%rbp), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movl $0x1, -0x4(%rbp)
jmp 0xdc1b
movl -0x18(%rbp), %eax
cmpl 0xa295(%rip), %eax      # 0x17e60
jae 0xdbe0
movq -0x10(%rbp), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movl $0x1, -0x4(%rbp)
jmp 0xdc1b
movl 0xa27e(%rip), %eax      # 0x17e64
cmpl -0x18(%rbp), %eax
jae 0xdbff
movl 0xa273(%rip), %edi      # 0x17e64
movl -0x18(%rbp), %esi
subl 0xa26a(%rip), %esi      # 0x17e64
callq 0x7c60
movl 0xa25f(%rip), %ecx      # 0x17e64
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movl -0x18(%rbp), %eax
movl %eax, 0xa250(%rip)      # 0x17e64
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/mikecat[P]x86_interpreter/xv6_syscall.c
// Function: xv6_write
static int xv6_write(uint32_t regs[]) {
	uint32_t fd, buf, n;
	uint8_t* data;
	if (!dmem_get_args(regs[ESP], 3, &fd, &buf, &n)) {
		regs[EAX] = -1;
		return 1;
	}
	if (!dmemory_is_allocated(buf, n)) {
		/* 指定された領域が確保されていない */
		regs[EAX] = -1;
		return 1;
	}
	/* 出力先のチェック */
	if (FD_MAX <= fd || fds[fd] == NULL || !fds[fd]->can_write) {
		regs[EAX] = -1;
		return 1;
	}
	/* データを取得して出力 */
	data = malloc(n);
	if (data == NULL) {
		perror("malloc");
		return -1;
	}
	dmemory_read(data, buf, n);
	if (fds[fd]->prev_operation == POP_READ) fseek(fds[fd]->stream, 0, SEEK_CUR);
	regs[EAX] = fwrite(data, 1, n, fds[fd]->stream) == n ? n : (uint32_t)-1;
	fds[fd]->prev_operation = POP_WRITE;
	free(data);
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl 0x10(%rax), %edi
movl $0x3, %esi
leaq -0x14(%rbp), %rdx
leaq -0x18(%rbp), %rcx
leaq -0x1c(%rbp), %r8
movb $0x0, %al
callq 0x8280
cmpl $0x0, %eax
jne 0xdf96
movq -0x10(%rbp), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movl $0x1, -0x4(%rbp)
jmp 0xe0e8
movl -0x18(%rbp), %edi
movl -0x1c(%rbp), %esi
callq 0x7f60
cmpl $0x0, %eax
jne 0xdfbc
movq -0x10(%rbp), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movl $0x1, -0x4(%rbp)
jmp 0xe0e8
movl $0x400, %eax            # imm = 0x400
cmpl -0x14(%rbp), %eax
jbe 0xdfef
movl -0x14(%rbp), %eax
movl %eax, %ecx
leaq 0xfe9e(%rip), %rax      # 0x1de70
cmpq $0x0, (%rax,%rcx,8)
je 0xdfef
movl -0x14(%rbp), %eax
movl %eax, %ecx
leaq 0xfe8b(%rip), %rax      # 0x1de70
movq (%rax,%rcx,8), %rax
cmpl $0x0, 0x10(%rax)
jne 0xe005
movq -0x10(%rbp), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movl $0x1, -0x4(%rbp)
jmp 0xe0e8
movl -0x1c(%rbp), %eax
movl %eax, %edi
callq 0x1110
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0xe032
leaq 0x3b90(%rip), %rdi      # 0x11bb1
callq 0x1170
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xe0e8
movq -0x28(%rbp), %rdi
movl -0x18(%rbp), %esi
movl -0x1c(%rbp), %edx
callq 0x7890
movl -0x14(%rbp), %eax
movl %eax, %ecx
leaq 0xfe23(%rip), %rax      # 0x1de70
movq (%rax,%rcx,8), %rax
cmpl $0x1, 0x14(%rax)
jne 0xe078
movl -0x14(%rbp), %eax
movl %eax, %ecx
leaq 0xfe0d(%rip), %rax      # 0x1de70
movq (%rax,%rcx,8), %rax
movq (%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x1, %edx
callq 0x1130
movq -0x28(%rbp), %rdi
movl -0x1c(%rbp), %eax
movl %eax, %edx
movl -0x14(%rbp), %eax
movl %eax, %ecx
leaq 0xfde3(%rip), %rax      # 0x1de70
movq (%rax,%rcx,8), %rax
movq (%rax), %rcx
movl $0x1, %esi
callq 0x11a0
movl -0x1c(%rbp), %ecx
cmpq %rcx, %rax
jne 0xe0ae
movl -0x1c(%rbp), %eax
movl %eax, -0x2c(%rbp)
jmp 0xe0b8
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x2c(%rbp)
jmp 0xe0b8
movl -0x2c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movl -0x14(%rbp), %eax
movl %eax, %ecx
leaq 0xfda3(%rip), %rax      # 0x1de70
movq (%rax,%rcx,8), %rax
movl $0x2, 0x14(%rax)
movq -0x28(%rbp), %rdi
callq 0x1030
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/mikecat[P]x86_interpreter/xv6_syscall.c
// Function: xv6_close
static int xv6_close(uint32_t regs[]) {
	uint32_t fd;
	if (!dmem_get_args(regs[ESP], 1, &fd)) {
		regs[EAX] = -1;
		return 1;
	}
	if (FD_MAX <= fd || fds[fd] == NULL) {
		regs[EAX] = -1;
		return 1;
	}
	fds[fd]->ref_cnt--;
	if (fds[fd]->ref_cnt <= 0) {
		fclose(fds[fd]->stream);
		fds[fd]->stream = NULL;
	}
	fds[fd] = NULL;
	regs[EAX] = 0;
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl 0x10(%rax), %edi
movl $0x1, %esi
leaq -0x14(%rbp), %rdx
movb $0x0, %al
callq 0x8280
cmpl $0x0, %eax
jne 0xe13e
movq -0x10(%rbp), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movl $0x1, -0x4(%rbp)
jmp 0xe1f4
movl $0x400, %eax            # imm = 0x400
cmpl -0x14(%rbp), %eax
jbe 0xe15b
movl -0x14(%rbp), %eax
movl %eax, %ecx
leaq 0xfd1c(%rip), %rax      # 0x1de70
cmpq $0x0, (%rax,%rcx,8)
jne 0xe171
movq -0x10(%rbp), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movl $0x1, -0x4(%rbp)
jmp 0xe1f4
movl -0x14(%rbp), %eax
movl %eax, %ecx
leaq 0xfcf3(%rip), %rax      # 0x1de70
movq (%rax,%rcx,8), %rax
movl 0x8(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x8(%rax)
movl -0x14(%rbp), %eax
movl %eax, %ecx
leaq 0xfcda(%rip), %rax      # 0x1de70
movq (%rax,%rcx,8), %rax
cmpl $0x0, 0x8(%rax)
jg 0xe1cf
movl -0x14(%rbp), %eax
movl %eax, %ecx
leaq 0xfcc4(%rip), %rax      # 0x1de70
movq (%rax,%rcx,8), %rax
movq (%rax), %rdi
callq 0x1070
movl -0x14(%rbp), %eax
movl %eax, %ecx
leaq 0xfcac(%rip), %rax      # 0x1de70
movq (%rax,%rcx,8), %rax
movq $0x0, (%rax)
movl -0x14(%rbp), %eax
movl %eax, %ecx
leaq 0xfc95(%rip), %rax      # 0x1de70
movq $0x0, (%rax,%rcx,8)
movq -0x10(%rbp), %rax
movl $0x0, (%rax)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/mikecat[P]x86_interpreter/pe_libs.c
// Function: strcmp_ncs
static int strcmp_ncs(const char* a, const char* b) {
	for (;;) {
		int ac = tolower((unsigned char)*a);
		int bc = tolower((unsigned char)*b);
		if (ac != bc) return ac > bc ? 1 : -1;
		if (ac == 0) return 0;
		a++;
		b++;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movzbl (%rax), %edi
callq 0x1100
movl %eax, -0x1c(%rbp)
movq -0x18(%rbp), %rax
movzbl (%rax), %edi
callq 0x1100
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x20(%rbp), %eax
je 0xeea0
movl -0x1c(%rbp), %edx
movl -0x20(%rbp), %esi
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl $0x1, %ecx
cmpl %esi, %edx
cmovgl %ecx, %eax
movl %eax, -0x4(%rbp)
jmp 0xeec9
cmpl $0x0, -0x1c(%rbp)
jne 0xeeaf
movl $0x0, -0x4(%rbp)
jmp 0xeec9
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0xee60
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/mikecat[P]x86_interpreter/pe_libs.c
// Function: get_buffer_address
uint32_t get_buffer_address(int lib_id, const char* identifier, uint32_t default_addr) {
	if (identifier == NULL) return default_addr;
	switch (lib_id) {
	case LIB_ID_MSVCRT:
		if (strcmp(identifier, "_iob") == 0) {
			return WORK_IOB;
		} else if (strcmp(identifier, "_daylight") == 0) {
			return WORK_DAYLIGHT;
		} else if (strcmp(identifier, "_timezone") == 0) {
			return WORK_TIMEZONE;
		} else if (strcmp(identifier, "_tzname") == 0) {
			return WORK_TZNAME;
		}
		break;
	}
	return default_addr;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0xef04
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xefae
movl -0x8(%rbp), %eax
subl $0x1, %eax
jne 0xefa8
jmp 0xef12
movq -0x10(%rbp), %rdi
leaq 0x36a9(%rip), %rsi      # 0x125c6
callq 0x10c0
cmpl $0x0, %eax
jne 0xef37
movl 0x10f4f(%rip), %eax     # 0x1fe7c
addl $0x1000, %eax           # imm = 0x1000
movl %eax, -0x4(%rbp)
jmp 0xefae
movq -0x10(%rbp), %rdi
leaq 0x3689(%rip), %rsi      # 0x125cb
callq 0x10c0
cmpl $0x0, %eax
jne 0xef5a
movl 0x10f2a(%rip), %eax     # 0x1fe7c
addl $0x18, %eax
movl %eax, -0x4(%rbp)
jmp 0xefae
movq -0x10(%rbp), %rdi
leaq 0x3670(%rip), %rsi      # 0x125d5
callq 0x10c0
cmpl $0x0, %eax
jne 0xef7d
movl 0x10f07(%rip), %eax     # 0x1fe7c
addl $0x18, %eax
movl %eax, -0x4(%rbp)
jmp 0xefae
movq -0x10(%rbp), %rdi
leaq 0x3657(%rip), %rsi      # 0x125df
callq 0x10c0
cmpl $0x0, %eax
jne 0xefa0
movl 0x10ee4(%rip), %eax     # 0x1fe7c
addl $0x1c, %eax
movl %eax, -0x4(%rbp)
jmp 0xefae
jmp 0xefa2
jmp 0xefa4
jmp 0xefa6
jmp 0xefa8
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/mikecat[P]x86_interpreter/pe_libs.c
// Function: pe_lib_exec
uint32_t pe_lib_exec(uint32_t regs[], const char* lib_name, const char* func_name, uint16_t func_ord) {
	if (func_name == NULL) {
		fprintf(stderr, "function #%"PRIu16" in library %s called. (ord value unsupported)\n",
			func_ord, lib_name);
		return PE_LIB_EXEC_FAILED;
	}
	if (strcmp_ncs(lib_name, "msvcrt.dll") == 0) {
		return exec_msvcrt(regs, func_name);
	} else if (strcmp_ncs(lib_name, "kernel32.dll") == 0) {
		return exec_kernel32(regs, func_name);
	} else if (strcmp_ncs(lib_name, "libintl3.dll") == 0) {
		return exec_libintl3(regs, func_name);
	} else {
		fprintf(stderr, "function %s() in unknown library %s called.\n", func_name, lib_name);
		return PE_LIB_EXEC_FAILED;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movw %cx, %ax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movw %ax, -0x22(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0xf00e
movq 0x6007(%rip), %rax      # 0x14ff0
movq (%rax), %rdi
movzwl -0x22(%rbp), %edx
movq -0x18(%rbp), %rcx
leaq 0x35ec(%rip), %rsi      # 0x125e7
movb $0x0, %al
callq 0x10d0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xf0aa
movq -0x18(%rbp), %rdi
leaq 0x35a2(%rip), %rsi      # 0x125bb
callq 0xee50
cmpl $0x0, %eax
jne 0xf035
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0xf0c0
movl %eax, -0x4(%rbp)
jmp 0xf0aa
movq -0x18(%rbp), %rdi
leaq 0x35e3(%rip), %rsi      # 0x12623
callq 0xee50
cmpl $0x0, %eax
jne 0xf05c
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0xfe00
movl %eax, -0x4(%rbp)
jmp 0xf0aa
movq -0x18(%rbp), %rdi
leaq 0x35c9(%rip), %rsi      # 0x12630
callq 0xee50
cmpl $0x0, %eax
jne 0xf083
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x101a0
movl %eax, -0x4(%rbp)
jmp 0xf0aa
movq 0x5f66(%rip), %rax      # 0x14ff0
movq (%rax), %rdi
movq -0x20(%rbp), %rdx
movq -0x18(%rbp), %rcx
leaq 0x35a1(%rip), %rsi      # 0x1263d
movb $0x0, %al
callq 0x10d0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/mikecat[P]x86_interpreter/pe_libs.c
// Function: exec_libintl3
static uint32_t exec_libintl3(uint32_t regs[], const char* func_name) {
	if (strcmp(func_name, "libintl_bindtextdomain") == 0) {
		regs[EAX] = 0;
		return 0;
	} else if (strcmp(func_name, "libintl_textdomain") == 0) {
		regs[EAX] = 0;
		return 0;
	} else if (strcmp(func_name, "libintl_gettext") == 0) {
		uint32_t msgid;
		if (!dmem_get_args(regs[ESP], 1, &msgid)) {
			regs[EAX] = 0;
		} else {
			regs[EAX] = msgid;
		}
		return 0;
	} else {
		fprintf(stderr, "unimplemented function %s() in libintl3.dll called.\n", func_name);
		return PE_LIB_EXEC_FAILED;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x18(%rbp), %rdi
leaq 0x2bf5(%rip), %rsi      # 0x12db0
callq 0x10c0
cmpl $0x0, %eax
jne 0x101db
movq -0x10(%rbp), %rax
movl $0x0, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x10275
movq -0x18(%rbp), %rdi
leaq 0x2be1(%rip), %rsi      # 0x12dc7
callq 0x10c0
cmpl $0x0, %eax
jne 0x10203
movq -0x10(%rbp), %rax
movl $0x0, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x10275
movq -0x18(%rbp), %rdi
leaq 0x2bcc(%rip), %rsi      # 0x12dda
callq 0x10c0
cmpl $0x0, %eax
jne 0x10252
movq -0x10(%rbp), %rax
movl 0x10(%rax), %edi
movl $0x1, %esi
leaq -0x1c(%rbp), %rdx
movb $0x0, %al
callq 0x8280
cmpl $0x0, %eax
jne 0x10240
movq -0x10(%rbp), %rax
movl $0x0, (%rax)
jmp 0x10249
movl -0x1c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x10275
movq 0x4d97(%rip), %rax      # 0x14ff0
movq (%rax), %rdi
movq -0x18(%rbp), %rdx
leaq 0x2b83(%rip), %rsi      # 0x12dea
movb $0x0, %al
callq 0x10d0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/ohkimur[P]the-c-programming-language-2nd-edition-solutions/chapter_3/exercise_3_01/binsearch.c
// Function: main
int main(void)
{
  int v[MAXLEN];

  initVector(v, MAXLEN);
  // printVector(v, MAXLEN);

  int x = -1;

  // Test binsearch_kr()
  test_binsearch(binsearch_kr, x, v, MAXLEN);

  // Test binsearch()
  test_binsearch(binsearch, x, v, MAXLEN);

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x9c60, %rsp           # imm = 0x9C60
movl $0x0, -0x4(%rbp)
leaq -0x9c50(%rbp), %rdi
movl $0x2710, %esi           # imm = 0x2710
callq 0x11d0
movl $0xffffffff, -0x9c54(%rbp) # imm = 0xFFFFFFFF
movl -0x9c54(%rbp), %esi
leaq -0x9c50(%rbp), %rdx
leaq 0x11f(%rip), %rdi       # 0x12b0
movl $0x2710, %ecx           # imm = 0x2710
callq 0x1210
movl -0x9c54(%rbp), %esi
leaq -0x9c50(%rbp), %rdx
leaq 0x191(%rip), %rdi       # 0x1340
movl $0x2710, %ecx           # imm = 0x2710
callq 0x1210
xorl %eax, %eax
addq $0x9c60, %rsp           # imm = 0x9C60
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/ohkimur[P]the-c-programming-language-2nd-edition-solutions/chapter_3/exercise_3_01/binsearch.c
// Function: test_binsearch
void test_binsearch(int binsearch(int x, int v[], int n), int x, int v[], int n)
{
  static int test_nr = 0;
  long clocks = clock();

  int i;
  for (i = 0; i < ITERATIONS; ++i)
  {
    binsearch(x, v, n);
  }

  clocks = clock() - clocks;

  printf("test_%d: %lu clocks (%.4f seconds)\n", test_nr, clocks, (double)clocks / CLOCKS_PER_SEC);

  ++test_nr;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
callq 0x1030
movq %rax, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
cmpl $0x186a0, -0x2c(%rbp)   # imm = 0x186A0
jge 0x125a
movq -0x8(%rbp), %rax
movl -0xc(%rbp), %edi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
callq *%rax
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x1236
callq 0x1030
subq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movl 0x2dcf(%rip), %esi      # 0x403c
movq -0x28(%rbp), %rdx
cvtsi2sdq -0x28(%rbp), %xmm0
movsd 0xd89(%rip), %xmm1      # 0x2008
divsd %xmm1, %xmm0
leaq 0xd94(%rip), %rdi       # 0x201e
movb $0x1, %al
callq 0x1040
movl 0x2da5(%rip), %eax      # 0x403c
addl $0x1, %eax
movl %eax, 0x2d9c(%rip)      # 0x403c
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/ohkimur[P]the-c-programming-language-2nd-edition-solutions/chapter_3/exercise_3_01/binsearch.c
// Function: binsearch_kr
int binsearch_kr(int x, int v[], int n)
{
  int low, mid, high;

  low = 0;
  high = n - 1;
  while (low <= high)
  {
    mid = (low + high) / 2;

    if (x < v[mid])
    {
      high = mid - 1;
    }
    else if (x > v[mid])
    {
      low = mid + 1;
    }
    else
    {
      return mid;
    }
  }

  return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movl -0x14(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x20(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x20(%rbp), %eax
jg 0x1329
movl -0x18(%rbp), %eax
addl -0x20(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, -0x1c(%rbp)
movl -0x8(%rbp), %eax
movq -0x10(%rbp), %rcx
movslq -0x1c(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0x1302
movl -0x1c(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x1327
movl -0x8(%rbp), %eax
movq -0x10(%rbp), %rcx
movslq -0x1c(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jle 0x131d
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x1325
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1330
jmp 0x1327
jmp 0x12ce
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/ohkimur[P]the-c-programming-language-2nd-edition-solutions/chapter_3/exercise_3_01/binsearch.c
// Function: binsearch
int binsearch(int x, int v[], int n)
{
  int low, mid, high;

  low = 0;
  high = n - 1;
  while (low <= high)
  {
    mid = (low + high) / 2;

    if (x < v[mid])
    {
      high = mid - 1;
    }
    else
    {
      low = mid + 1;
    }
  }

  if (x == v[low - 1])
  {
    return low - 1;
  }

  return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movl -0x14(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x20(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x20(%rbp), %eax
jg 0x139d
movl -0x18(%rbp), %eax
addl -0x20(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, -0x1c(%rbp)
movl -0x8(%rbp), %eax
movq -0x10(%rbp), %rcx
movslq -0x1c(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0x1392
movl -0x1c(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x139b
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x135e
movl -0x8(%rbp), %eax
movq -0x10(%rbp), %rcx
movl -0x18(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
cmpl (%rcx,%rdx,4), %eax
jne 0x13bd
movl -0x18(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x13c4
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/ohkimur[P]the-c-programming-language-2nd-edition-solutions/chapter_3/exercise_3_01/binsearch.c
// Function: printVector
void printVector(int v[], int n)
{
  int i;

  printf("[ ");
  for (i = 0; i < n; ++i)
  {
    (i != n - 1) ? printf("%d, ", v[i]) : printf("%d ]\n", v[i]);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
leaq 0xc2a(%rip), %rdi       # 0x2010
movb $0x0, %al
callq 0x1040
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x1448
movl -0x10(%rbp), %eax
movl -0xc(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
je 0x1424
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
movl (%rax,%rcx,4), %esi
leaq 0xbf8(%rip), %rdi       # 0x2013
movb $0x0, %al
callq 0x1040
jmp 0x143d
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
movl (%rax,%rcx,4), %esi
leaq 0xbe2(%rip), %rdi       # 0x2018
movb $0x0, %al
callq 0x1040
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x13f4
addq $0x10, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/neovim[P]libtermkey/demo-async.c
// Function: main
int main(int argc, char *argv[])
{
  TERMKEY_CHECK_VERSION;

  TermKey *tk = termkey_new(0, 0);

  if(!tk) {
    fprintf(stderr, "Cannot allocate termkey instance\n");
    exit(1);
  }

  struct pollfd fd;

  fd.fd = 0; /* the file descriptor we passed to termkey_new() */
  fd.events = POLLIN;

  TermKeyResult ret;
  TermKeyKey key;

  int running = 1;
  int nextwait = -1;

  while(running) {
    if(poll(&fd, 1, nextwait) == 0) {
      // Timed out
      if(termkey_getkey_force(tk, &key) == TERMKEY_RES_KEY)
        on_key(tk, &key);
    }

    if(fd.revents & (POLLIN|POLLHUP|POLLERR))
      termkey_advisereadable(tk);

    while((ret = termkey_getkey(tk, &key)) == TERMKEY_RES_KEY) {
      on_key(tk, &key);

      if(key.type == TERMKEY_TYPE_UNICODE &&
         key.modifiers & TERMKEY_KEYMOD_CTRL &&
         (key.code.codepoint == 'C' || key.code.codepoint == 'c'))
        running = 0;
    }

    if(ret == TERMKEY_RES_AGAIN)
      nextwait = termkey_get_waittime(tk);
    else
      nextwait = -1;
  }

  termkey_destroy(tk);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
xorl %edi, %edi
movl $0x17, %esi
callq 0x10c0
xorl %esi, %esi
movl %esi, %edi
callq 0x10b0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x1248
movq 0x2dcb(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
leaq 0xdcd(%rip), %rsi       # 0x2004
movb $0x0, %al
callq 0x1070
movl $0x1, %edi
callq 0x10d0
movl $0x0, -0x20(%rbp)
movw $0x1, -0x1c(%rbp)
movl $0x1, -0x4c(%rbp)
movl $0xffffffff, -0x50(%rbp) # imm = 0xFFFFFFFF
cmpl $0x0, -0x4c(%rbp)
je 0x1325
movl -0x50(%rbp), %edx
leaq -0x20(%rbp), %rdi
movl $0x1, %esi
callq 0x10a0
cmpl $0x0, %eax
jne 0x12a4
movq -0x18(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x1030
cmpl $0x1, %eax
jne 0x12a2
movq -0x18(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x1340
jmp 0x12a4
movswl -0x1a(%rbp), %eax
andl $0x19, %eax
cmpl $0x0, %eax
je 0x12b9
movq -0x18(%rbp), %rdi
callq 0x10e0
jmp 0x12bb
movq -0x18(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x1060
movl %eax, -0x24(%rbp)
cmpl $0x1, %eax
jne 0x1305
movq -0x18(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x1340
cmpl $0x0, -0x48(%rbp)
jne 0x1303
movl -0x38(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x1303
cmpq $0x43, -0x40(%rbp)
je 0x12fc
cmpq $0x63, -0x40(%rbp)
jne 0x1303
movl $0x0, -0x4c(%rbp)
jmp 0x12bb
cmpl $0x3, -0x24(%rbp)
jne 0x1319
movq -0x18(%rbp), %rdi
callq 0x1050
movl %eax, -0x50(%rbp)
jmp 0x1320
movl $0xffffffff, -0x50(%rbp) # imm = 0xFFFFFFFF
jmp 0x1263
movq -0x18(%rbp), %rdi
callq 0x1090
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/erik[P]gamut/invert.c
// Function: main
int main(int argc, char** argv)
{
    uint32_t width, height;
    pixel_t rgba;

    if (argc != 1) {
        fprintf(stderr, "usage: %s\n", argv[0]);
        return 1;
    }

    read_header(&width, &height);
    write_header(width, height);

    for (uint32_t i = 0; i < height; i++) {
        for (uint32_t j = 0; j < width; j++) {
            read_pixel(&rgba);

            /* invert colors */
            rgba.r = 65535 - rgba.r;
            rgba.g = 65535 - rgba.g;
            rgba.b = 65535 - rgba.b;

            write_pixel(&rgba);
        }
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x1, -0x8(%rbp)
je 0x1217
movq 0x2e05(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
leaq 0xe00(%rip), %rsi       # 0x2004
movb $0x0, %al
callq 0x1080
movl $0x1, -0x4(%rbp)
jmp 0x12ab
leaq -0x14(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x12c0
movl -0x14(%rbp), %edi
movl -0x18(%rbp), %esi
callq 0x1390
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x18(%rbp), %eax
jae 0x12a4
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x14(%rbp), %eax
jae 0x1297
leaq -0x20(%rbp), %rdi
callq 0x1430
movzwl -0x20(%rbp), %ecx
movl $0xffff, %eax           # imm = 0xFFFF
subl %ecx, %eax
movw %ax, -0x20(%rbp)
movzwl -0x1e(%rbp), %ecx
movl $0xffff, %eax           # imm = 0xFFFF
subl %ecx, %eax
movw %ax, -0x1e(%rbp)
movzwl -0x1c(%rbp), %ecx
movl $0xffff, %eax           # imm = 0xFFFF
subl %ecx, %eax
movw %ax, -0x1c(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x14a0
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x1245
jmp 0x1299
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x1236
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)