LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/mikecat[P]x86_interpreter/dmem_libc_stdio.c
// Function: dmem_libc_stdio_initialize
int dmem_libc_stdio_initialize(uint32_t iob_addr_in) {
	int i;
	iob_addr = iob_addr_in;
	for (i = 0; i < IOB_SIZE; i++) {
		file_info[i].fp = NULL;
		file_info[i].is_standard = 0;
		file_info[i].can_read = 0;
		file_info[i].can_write = 0;
		file_info[i].previous_operation = POP_NONE;
	}
	file_info[0].fp = stdin;
	file_info[0].is_standard = 1;
	file_info[0].can_read = 1;
	file_info[1].fp = stdout;
	file_info[1].is_standard = 1;
	file_info[1].can_write = 1;
	file_info[2].fp = stderr;
	file_info[2].is_standard = 1;
	file_info[2].can_write = 1;
	return 1;
}

// Assembly:
pushq %rax
movl %edi, 0xdef9(%rip)      # 0x15170
leaq 0xdf12(%rip), %rdi      # 0x15190
movl $0xbf0, %edx            # imm = 0xBF0
xorl %esi, %esi
callq 0x10a0
movq 0xbd47(%rip), %rax      # 0x12fd8
movq (%rax), %rax
movq %rax, 0xdee5(%rip)      # 0x15180
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0xdedc(%rip)      # 0x15188
movq 0xbd1d(%rip), %rax      # 0x12fd0
movq (%rax), %rax
movq %rax, 0xdedb(%rip)      # 0x15198
movl $0x1, %eax
movl %eax, 0xded8(%rip)      # 0x151a0
movl %eax, 0xdeda(%rip)      # 0x151a8
movq 0xbd23(%rip), %rcx      # 0x12ff8
movq (%rcx), %rcx
movq %rcx, 0xded1(%rip)      # 0x151b0
movl %eax, 0xded3(%rip)      # 0x151b8
movl %eax, 0xded5(%rip)      # 0x151c0
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/mikecat[P]x86_interpreter/dmem_libc_stdio.c
// Function: integer_to_string
static uint32_t integer_to_string(char* dest, uint32_t value,
uint32_t least_digits, uint32_t radix, const char* digits) {
	char buffer[64];
	char *p = buffer + (sizeof(buffer) / sizeof(*buffer));
	uint32_t digit_cnt = 0;
	uint32_t i;
	/* 変換する */
	while (value > 0 || least_digits > 0) {
		*(--p) = digits[value % radix];
		value /= radix;
		if (least_digits > 0) least_digits--;
		digit_cnt++;
	}
	/* 結果を書き込む */
	for (i = 0; i < digit_cnt; i++) dest[i] = p[i];
	return digit_cnt;
}

// Assembly:
movl %edx, %r9d
movl %esi, %edx
orl %r9d, %edx
je 0x89ec
pushq %rbx
xorl %r11d, %r11d
xorl %r10d, %r10d
movl %esi, %eax
xorl %edx, %edx
divl %ecx
movl %r9d, %ebx
movb (%r8,%rdx), %dl
subl $0x1, %r9d
cmovbl %r11d, %r9d
movb %dl, -0x1(%rsp,%r10)
decq %r10
cmpl %ecx, %esi
movl %eax, %esi
jae 0x899a
cmpl $0x1, %ebx
ja 0x899a
testl %r10d, %r10d
je 0x89ef
movq %r10, %rax
negq %rax
movl %eax, %ecx
xorl %edx, %edx
leaq (%rsp,%rdx), %rsi
addq $-0x40, %rsi
movb 0x40(%r10,%rsi), %sil
movb %sil, (%rdi,%rdx)
incq %rdx
cmpq %rdx, %rcx
jne 0x89d1
jmp 0x89f1
xorl %eax, %eax
retq
xorl %eax, %eax
popq %rbx
retq
nop
// File: /workspace/github_c_makefile_star2_O3/mikecat[P]x86_interpreter/dmem_libc_stdlib.c
// Function: dmem_libc_stdlib_initialize
int dmem_libc_stdlib_initialize(uint32_t heap_start_addr) {
	if (heap_start_addr % HEAP_ALIGN != 0) {
		uint32_t delta = HEAP_ALIGN - heap_start_addr % HEAP_ALIGN;
		if (UINT32_MAX - delta < heap_start_addr) return 0;
		heap_start = heap_start_addr + delta;
	} else {
		heap_start = heap_start_addr;
	}
	if (heap_start == 0) heap_start = HEAP_ALIGN;
	heap_info_head = NULL;
	return 1;
}

// Assembly:
movl %edi, %ecx
andl $0x3f, %ecx
je 0x8a0a
addl $-0x41, %ecx
xorl %eax, %eax
cmpl %edi, %ecx
jb 0x8a2a
andl $-0x40, %edi
addl $0x40, %edi
testl %edi, %edi
movl $0x40, %eax
cmovnel %edi, %eax
movl %eax, 0xd366(%rip)      # 0x15d80
movq $0x0, 0xd363(%rip) # 0x15d88
movl $0x1, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/mikecat[P]x86_interpreter/dmem_libc_stdlib.c
// Function: dmem_libc_calloc
int dmem_libc_calloc(uint32_t* ret, uint32_t esp) {
	uint32_t num, elem_size;
	if (!dmem_get_args(esp, 2, &num, &elem_size)) return 0;
	if (num > 0 && UINT32_MAX / num < elem_size) {
		*ret = 0;
	} else {
		size_t size = elem_size * num;
		char* buf = malloc(size);
		*ret = malloc_core(size);
		if (buf != NULL) {
			memset(buf, 0, size);
			dmemory_write(buf, *ret, size);
			free(buf);
		} else {
			size_t i;
			uint8_t cbuf = 0;
			for (i = 0; i < size; i++) {
				dmemory_write(&cbuf, (*ret) + i, 1);
			}
		}
	}
	return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
xorl %ebp, %ebp
leaq 0xc(%rsp), %rdx
leaq 0x8(%rsp), %rcx
movl %esi, %edi
movl $0x2, %esi
xorl %eax, %eax
callq 0x7157
testl %eax, %eax
je 0x8ae3
movl 0xc(%rsp), %ecx
movl 0x8(%rsp), %r14d
testl %ecx, %ecx
je 0x8a78
movl %ecx, %eax
mull %r14d
jno 0x8a78
movl $0x0, (%rbx)
jmp 0x8ade
imull %ecx, %r14d
movl $0x1, %edi
movq %r14, %rsi
callq 0x10b0
movq %rax, %r15
movl %r14d, %edi
callq 0x8af2
movl %eax, (%rbx)
testq %r15, %r15
je 0x8ab2
movq %r15, %rdi
movl %eax, %esi
movl %r14d, %edx
callq 0x6b71
movq %r15, %rdi
callq 0x1030
jmp 0x8ade
movb $0x0, 0x7(%rsp)
testq %r14, %r14
je 0x8ade
xorl %r12d, %r12d
leaq 0x7(%rsp), %r15
movl (%rbx), %esi
addl %r12d, %esi
movq %r15, %rdi
movl $0x1, %edx
callq 0x6b71
incq %r12
cmpq %r12, %r14
jne 0x8ac4
movl $0x1, %ebp
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/mikecat[P]x86_interpreter/dmem_libc_stdlib.c
// Function: malloc_core
static uint32_t malloc_core(uint32_t size) {
	heap_info_t** pptr = &heap_info_head;
	heap_info_t* ptr = heap_info_head;
	heap_info_t* new_node;
	uint32_t addr = heap_start;
	if (UINT32_MAX - (HEAP_ALIGN - 1) < size) {
		return 0;
	}
	size = (size + (HEAP_ALIGN - 1)) / HEAP_ALIGN * HEAP_ALIGN;
	if (size == 0) size = HEAP_ALIGN;
	while(ptr != NULL) {
		if (!ptr->used && ptr->size >= size) {
			/* 十分な空き領域が見つかった */
			if (ptr->size == size) {
				/* ちょうどいい大きさ */
				ptr->used = 1;
			} else {
				/* 余る */
				new_node = malloc(sizeof(heap_info_t));
				if (new_node == NULL) {
					return 0;
				}
				new_node->size = ptr->size - size;
				new_node->used = 0;
				new_node->next = ptr->next;
				ptr->size = size;
				ptr->used = 1;
				ptr->next = new_node;
			}
			return addr;
		} else {
			addr += ptr->size;
			pptr = &ptr->next;
			ptr = ptr->next;
		}
	}
	/* 空き領域が見つからなかったので、作る */
	new_node = malloc(sizeof(heap_info_t));
	if (new_node == NULL) {
		return 0;
	}
	dmemory_allocate(addr, size);
	new_node->size = size;
	new_node->used = 1;
	new_node->next = NULL;
	*pptr = new_node;
	return addr;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
xorl %ebp, %ebp
cmpl $-0x40, %edi
ja 0x8bd4
movl 0xd275(%rip), %ebx      # 0x15d80
addl $0x3f, %edi
andl $-0x40, %edi
movl $0x40, %r14d
cmovnel %edi, %r14d
movq 0xd266(%rip), %rax      # 0x15d88
testq %rax, %rax
je 0x8b52
movq %rax, %r12
cmpl $0x0, 0x4(%rax)
setne %al
movl (%r12), %r15d
cmpl %r14d, %r15d
setb %cl
orb %al, %cl
je 0x8b8e
addl %r15d, %ebx
movq 0x8(%r12), %rax
testq %rax, %rax
jne 0x8b27
addq $0x8, %r12
jmp 0x8b59
leaq 0xd22f(%rip), %r12      # 0x15d88
movl $0x10, %edi
callq 0x1100
testq %rax, %rax
je 0x8bd4
movq %rax, %r15
movl %ebx, %edi
movl %r14d, %esi
callq 0x6caf
movl %r14d, (%r15)
movl $0x1, 0x4(%r15)
movq $0x0, 0x8(%r15)
movq %r15, (%r12)
jmp 0x8bd2
subl %r14d, %r15d
jne 0x8b9e
movl $0x1, 0x4(%r12)
jmp 0x8bd2
movl $0x10, %edi
callq 0x1100
testq %rax, %rax
je 0x8bd4
movl %r15d, (%rax)
movl $0x0, 0x4(%rax)
movq 0x8(%r12), %rcx
movq %rcx, 0x8(%rax)
movl %r14d, (%r12)
movl $0x1, 0x4(%r12)
movq %rax, 0x8(%r12)
movl %ebx, %ebp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/mikecat[P]x86_interpreter/dmem_libc_stdlib.c
// Function: free_core
static int free_core(uint32_t addr_to_free) {
	heap_info_t* prev_ptr = NULL;
	heap_info_t* ptr = heap_info_head;
	uint32_t addr = heap_start;
	if (addr_to_free == 0) return 1;
	while (ptr != NULL) {
		if (ptr->used && addr == addr_to_free) {
			ptr->used = 0;
			if (prev_ptr != NULL && !prev_ptr->used) {
				/* 空き領域を統合する */
				prev_ptr->size += ptr->size;
				prev_ptr->next = ptr->next;
				free(ptr);
			}
			return 1;
		}
		addr += ptr->size;
		prev_ptr = ptr;
		ptr = ptr->next;
	}
	/* 該当の領域が見つからなかった */
	return 0;
}

// Assembly:
pushq %rbx
movl $0x1, %ebx
testl %edi, %edi
je 0x8c83
movl %edi, %eax
movq 0xd165(%rip), %rdi      # 0x15d88
testq %rdi, %rdi
je 0x8c81
movl 0xd152(%rip), %edx      # 0x15d80
cmpl $0x0, 0x4(%rdi)
setne %cl
cmpl %eax, %edx
sete %sil
testb %sil, %cl
je 0x8c44
xorl %ecx, %ecx
jmp 0x8c5c
movq %rdi, %rcx
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0x8c81
addl (%rcx), %edx
cmpl $0x0, 0x4(%rdi)
je 0x8c44
cmpl %eax, %edx
jne 0x8c44
movl $0x0, 0x4(%rdi)
testq %rcx, %rcx
je 0x8c83
cmpl $0x0, 0x4(%rcx)
jne 0x8c83
movl (%rdi), %eax
addl %eax, (%rcx)
movq 0x8(%rdi), %rax
movq %rax, 0x8(%rcx)
callq 0x1030
jmp 0x8c83
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/mikecat[P]x86_interpreter/dmem_libc_string.c
// Function: dmem_libc_memcpy
int dmem_libc_memcpy(uint32_t* ret, uint32_t esp) {
	uint32_t dest, src, size;
	char* buf;
	if (!dmem_get_args(esp, 3, &dest, &src, &size)) return 0;
	if (!dmemory_is_allocated(src, size) || !dmemory_is_allocated(dest, size)) return 0;

	buf = malloc(size);
	if (buf == NULL) return 0;
	dmemory_read(buf, src, size);
	dmemory_write(buf, dest, size);
	*ret = dest;
	free(buf);
	return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
xorl %ebp, %ebp
leaq 0x10(%rsp), %rdx
leaq 0x14(%rsp), %rcx
leaq 0xc(%rsp), %r8
movl %esi, %edi
movl $0x3, %esi
xorl %eax, %eax
callq 0x7157
testl %eax, %eax
je 0x8f17
movl 0x14(%rsp), %edi
movl 0xc(%rsp), %esi
callq 0x6ec9
testl %eax, %eax
je 0x8f17
movl 0x10(%rsp), %edi
movl 0xc(%rsp), %esi
callq 0x6ec9
testl %eax, %eax
je 0x8f17
movl 0xc(%rsp), %r15d
movq %r15, %rdi
callq 0x1100
testq %rax, %rax
je 0x8f17
movq %rax, %r14
movl 0x14(%rsp), %esi
movq %rax, %rdi
movl %r15d, %edx
callq 0x6a34
movl 0x10(%rsp), %esi
movl 0xc(%rsp), %edx
movq %r14, %rdi
callq 0x6b71
movl 0x10(%rsp), %eax
movl %eax, (%rbx)
movq %r14, %rdi
callq 0x1030
movl $0x1, %ebp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
xorl %ebx, %ebx
movq %rsp, %rdx
leaq 0x4(%rsp), %rcx
movl %esi, %edi
movl $0x2, %esi
xorl %eax, %eax
callq 0x7157
testl %eax, %eax
je 0x8f9c
movl 0x4(%rsp), %edi
callq 0x70d9
testq %rax, %rax
je 0x8f9c
movq %rax, %r15
movq %rax, %rdi
callq 0x1080
movq %rax, %r12
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
cmpq %rax, %r12
ja 0x8f9c
movl (%rsp), %edi
incl %r12d
movl %r12d, %esi
callq 0x6ec9
testl %eax, %eax
je 0x8f9c
movl (%rsp), %esi
movq %r15, %rdi
movl %r12d, %edx
callq 0x6b71
movl (%rsp), %eax
movl %eax, (%r14)
movl $0x1, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
xorl %ebp, %ebp
leaq 0xc(%rsp), %rdx
leaq 0x14(%rsp), %rcx
leaq 0x8(%rsp), %r8
movl %esi, %edi
movl $0x3, %esi
xorl %eax, %eax
callq 0x7157
testl %eax, %eax
je 0x9086
movl 0xc(%rsp), %edi
movl 0x8(%rsp), %esi
callq 0x6ec9
testl %eax, %eax
je 0x9086
cmpl $0x0, 0x8(%rsp)
je 0x9077
xorl %ebp, %ebp
movl $0x1, %r13d
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
leaq 0x7(%rsp), %r14
leaq 0x10(%rsp), %r15
movl $0x0, 0x10(%rsp)
testl %r13d, %r13d
je 0x9051
movl 0x14(%rsp), %esi
cmpl %r12d, %esi
ja 0x9084
addl %ebp, %esi
movq %r15, %rdi
movl $0x1, %edx
callq 0x704d
movb %al, 0x7(%rsp)
cmpl $0x0, 0x10(%rsp)
je 0x9084
xorl %r13d, %r13d
testb %al, %al
setne %r13b
jmp 0x9059
movb $0x0, 0x7(%rsp)
xorl %r13d, %r13d
movl 0xc(%rsp), %esi
addl %ebp, %esi
movq %r14, %rdi
movl $0x1, %edx
callq 0x6b71
incl %ebp
decl %r12d
cmpl 0x8(%rsp), %ebp
jb 0x9016
movl 0xc(%rsp), %eax
movl %eax, (%rbx)
movl $0x1, %ebp
jmp 0x9086
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
xorl %ebp, %ebp
leaq 0xc(%rsp), %rdx
leaq 0x8(%rsp), %rcx
movl %esi, %edi
movl $0x2, %esi
xorl %eax, %eax
callq 0x7157
testl %eax, %eax
je 0x915a
movl 0xc(%rsp), %esi
leaq 0x14(%rsp), %r14
leaq 0x10(%rsp), %r15
xorl %r13d, %r13d
movl $0x1, %ebp
movl 0x8(%rsp), %eax
addl %r13d, %eax
jb 0x9144
addl %r13d, %esi
movq %r14, %rdi
movl $0x1, %edx
callq 0x704d
movl %eax, %r12d
movl 0x8(%rsp), %esi
addl %r13d, %esi
movq %r15, %rdi
movl $0x1, %edx
callq 0x704d
cmpl $0x0, 0x14(%rsp)
je 0x9144
cmpl $0x0, 0x10(%rsp)
je 0x9144
cmpl %eax, %r12d
ja 0x9148
jb 0x914f
testl %r12d, %r12d
je 0x9156
cmpl $-0x1, %r13d
je 0x9144
leal 0x1(%r13), %eax
movl 0xc(%rsp), %esi
movl %esi, %ecx
notl %ecx
cmpl %ecx, %r13d
movl %eax, %r13d
jb 0x90e0
xorl %ebp, %ebp
jmp 0x915a
movl $0x1, %eax
jmp 0x9158
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x9158
xorl %eax, %eax
movl %eax, (%rbx)
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
xorl %ebp, %ebp
leaq 0x14(%rsp), %rdx
leaq 0x8(%rsp), %rcx
leaq 0x4(%rsp), %r8
movl %esi, %edi
movl $0x3, %esi
xorl %eax, %eax
callq 0x7157
testl %eax, %eax
je 0x9235
cmpl $0x0, 0x4(%rsp)
je 0x9216
leaq 0x10(%rsp), %r14
leaq 0xc(%rsp), %r15
xorl %r13d, %r13d
movl $0x1, %ebp
movl 0x14(%rsp), %esi
addl %r13d, %esi
jb 0x9223
movl 0x8(%rsp), %eax
addl %r13d, %eax
jb 0x9223
movq %r14, %rdi
movl $0x1, %edx
callq 0x704d
movl %eax, %r12d
movl 0x8(%rsp), %esi
addl %r13d, %esi
movq %r15, %rdi
movl $0x1, %edx
callq 0x704d
cmpl $0x0, 0x10(%rsp)
je 0x9223
cmpl $0x0, 0xc(%rsp)
je 0x9223
cmpl %eax, %r12d
ja 0x9227
jb 0x922e
testl %r12d, %r12d
je 0x9216
incl %r13d
cmpl 0x4(%rsp), %r13d
jb 0x91bc
movl $0x0, (%rbx)
movl $0x1, %ebp
jmp 0x9235
xorl %ebp, %ebp
jmp 0x9235
movl $0x1, %eax
jmp 0x9233
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, (%rbx)
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
xorl %ebp, %ebp
leaq 0x8(%rsp), %rdx
leaq 0xc(%rsp), %rcx
movl %esi, %edi
movl $0x2, %esi
xorl %eax, %eax
callq 0x7157
testl %eax, %eax
je 0x92ac
movl 0x8(%rsp), %edi
callq 0x70d9
testq %rax, %rax
je 0x92ac
movq %rax, %r14
movl 0xc(%rsp), %esi
movq %rax, %rdi
callq 0x1090
movl %eax, %ecx
subl %r14d, %ecx
addl 0x8(%rsp), %ecx
xorl %edx, %edx
testq %rax, %rax
cmovnel %ecx, %edx
movl %edx, (%rbx)
movq %r14, %rdi
callq 0x1030
movl $0x1, %ebp
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
xorl %ebp, %ebp
leaq 0xc(%rsp), %rdx
leaq 0x14(%rsp), %rcx
leaq 0x10(%rsp), %r8
movl %esi, %edi
movl $0x3, %esi
xorl %eax, %eax
callq 0x7157
testl %eax, %eax
je 0x933e
movl 0xc(%rsp), %edi
movl 0x10(%rsp), %esi
callq 0x6ec9
testl %eax, %eax
je 0x933e
movl 0x10(%rsp), %r14d
movq %r14, %rdi
callq 0x1100
testq %rax, %rax
je 0x933e
movq %rax, %r15
movl 0x14(%rsp), %esi
movq %rax, %rdi
movq %r14, %rdx
callq 0x10a0
movl 0xc(%rsp), %esi
movq %r15, %rdi
movl %r14d, %edx
callq 0x6b71
movq %r15, %rdi
callq 0x1030
movl 0xc(%rsp), %eax
movl %eax, (%rbx)
movl $0x1, %ebp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %r14
xorl %ebx, %ebx
leaq 0xc(%rsp), %rdx
movl %esi, %edi
movl $0x1, %esi
xorl %eax, %eax
callq 0x7157
testl %eax, %eax
je 0x93d9
movl 0xc(%rsp), %esi
leaq 0x8(%rsp), %r15
movl $0x1, %ebp
movq %r15, %rdi
movl $0x1, %edx
callq 0x704d
xorl %ebx, %ebx
cmpl $0x0, (%r15)
je 0x93d9
movl $0xfffffffe, %r12d      # imm = 0xFFFFFFFE
leaq 0x8(%rsp), %r15
testl %eax, %eax
je 0x93cf
testl %ebp, %ebp
je 0x93d9
movl 0xc(%rsp), %esi
cmpl %esi, %r12d
jb 0x93d9
addl %ebp, %esi
movq %r15, %rdi
movl $0x1, %edx
callq 0x704d
incl %ebp
decl %r12d
cmpl $0x0, 0x8(%rsp)
jne 0x93a1
jmp 0x93d9
decl %ebp
movl %ebp, (%r14)
movl $0x1, %ebx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/mikecat[P]x86_interpreter/read_file.c
// Function: read_whole_file
void* read_whole_file(size_t* size, const char* filename) {
	FILE* fp;
	size_t read_size = 0;
	char* buffer = NULL;
	fp = fopen(filename, "rb");
	if (fp == NULL) {
		fprintf(stderr, "input file open failed\n");
		return NULL;
	}
	for (;;) {
		char data[BUFFER_SIZE];
		size_t new_read_size = fread(data, sizeof(*data), BUFFER_SIZE, fp);
		if (ferror(fp)) {
			fprintf(stderr, "input file read error\n");
			fclose(fp);
			free(buffer);
			return NULL;
		} else if (new_read_size == 0) {
			break;
		} else {
			char *new_buffer;
			if (SIZE_MAX - read_size < new_read_size) {
				fprintf(stderr, "input file too big\n");
				fclose(fp);
				free(buffer);
				return NULL;
			}
			new_buffer = realloc(buffer, read_size + new_read_size);
			if (new_buffer == NULL) {
				perror("realloc");
				free(buffer);
				fclose(fp);
				return NULL;
			}
			buffer = new_buffer;
			memcpy(buffer + read_size, data, new_read_size);
			read_size += new_read_size;
		}
	}
	fclose(fp);
	if (size != NULL) *size = read_size;
	return buffer;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1018, %rsp           # imm = 0x1018
movq %rsi, %rax
movq %rdi, %r14
leaq 0x41ea(%rip), %rsi      # 0xdf94
movq %rax, %rdi
callq 0x1150
testq %rax, %rax
je 0x9e74
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
movl $0x1, %esi
movl $0x1000, %edx           # imm = 0x1000
movq %rax, %rcx
callq 0x1060
movq %rax, %r15
movq %rbx, %rdi
callq 0x1050
testl %eax, %eax
jne 0x9e7b
movq %r14, 0x8(%rsp)
xorl %r12d, %r12d
xorl %r14d, %r14d
testq %r15, %r15
je 0x9e5d
movq %r12, %rbp
addq %r15, %rbp
jb 0x9e8b
movq %r14, %rdi
movq %rbp, %rsi
callq 0x1130
testq %rax, %rax
je 0x9e98
movq %rax, %r13
addq %rax, %r12
movq %r12, %rdi
leaq 0x10(%rsp), %r14
movq %r14, %rsi
movq %r15, %rdx
callq 0x10e0
movl $0x1, %esi
movl $0x1000, %edx           # imm = 0x1000
movq %r14, %rdi
movq %rbx, %rcx
callq 0x1060
movq %rax, %r15
movq %rbx, %rdi
callq 0x1050
movq %rbp, %r12
movq %r13, %r14
testl %eax, %eax
je 0x9df3
jmp 0x9e7e
movq %rbx, %rdi
callq 0x1070
movq 0x8(%rsp), %rax
testq %rax, %rax
je 0x9eb7
movq %r12, (%rax)
jmp 0x9eb7
callq 0x18ad
jmp 0x9eb4
xorl %r13d, %r13d
movq %rbx, %rdi
movq %r13, %rsi
callq 0x1833
jmp 0x9eb4
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1870
jmp 0x9eb4
leaq 0x413b(%rip), %rdi      # 0xdfda
callq 0x1160
movq %r14, %rdi
callq 0x1030
movq %rbx, %rdi
callq 0x1070
xorl %r14d, %r14d
movq %r14, %rax
addq $0x1018, %rsp           # imm = 0x1018
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 %rbx
subq $0x10, %rsp
movq %rdi, %rsi
leaq 0x8(%rsp), %rdi
movq $0x0, (%rdi)
callq 0x9d8c
testq %rax, %rax
je 0x9f15
movq %rax, %rbx
movl 0x8(%rsp), %esi
xorl %edi, %edi
callq 0x6caf
movl 0x8(%rsp), %edx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x6b71
movq %rbx, %rdi
callq 0x1030
movl $0x1, %eax
jmp 0x9f17
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/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 %rbx
movl %edi, 0xb631(%rip)      # 0x15da0
movl %edi, 0xb62f(%rip)      # 0x15da4
leaq 0xb644(%rip), %rdi      # 0x15dc0
movl $0x5ff0, %edx           # imm = 0x5FF0
xorl %esi, %esi
callq 0x10a0
leaq 0xb621(%rip), %rbx      # 0x15db0
leaq 0x1162a(%rip), %rdi     # 0x1bdc0
movl $0x1ff0, %edx           # imm = 0x1FF0
xorl %esi, %esi
callq 0x10a0
movq 0x882f(%rip), %rax      # 0x12fd8
movq (%rax), %rax
movq %rax, 0xb5fd(%rip)      # 0x15db0
movabsq $0x100000002, %rax      # imm = 0x100000002
movq %rax, 0xb5f4(%rip)      # 0x15db8
movq 0x8805(%rip), %rax      # 0x12fd0
movq (%rax), %rax
movq %rax, 0xb5f3(%rip)      # 0x15dc8
leaq 0xb5ec(%rip), %rax      # 0x15dc8
movl $0x2, %ecx
movl %ecx, 0xb5e9(%rip)      # 0x15dd0
movl $0x1, %edx
movl %edx, 0xb5e6(%rip)      # 0x15dd8
movq 0x87ff(%rip), %rsi      # 0x12ff8
movq (%rsi), %rsi
movq %rsi, 0xb5dd(%rip)      # 0x15de0
leaq 0xb5d6(%rip), %rsi      # 0x15de0
movl %ecx, 0xb5d8(%rip)      # 0x15de8
movl %edx, 0xb5da(%rip)      # 0x15df0
movq %rbx, 0x11593(%rip)     # 0x1bdb0
movq %rax, 0x11594(%rip)     # 0x1bdb8
movq %rsi, 0x11595(%rip)     # 0x1bdc0
movl $0x1, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/mikecat[P]x86_interpreter/pe_import.c
// Function: pe_import
int pe_import(uint32_t* eip, uint32_t regs[]) {
	uint32_t i;
	const imported_lib_info* called_lib = NULL;
	const func_info* called_func = NULL;
	uint32_t stack_remove_size;
	for (i = 0; i < imported_lib_count; i++) {
		if (imported_libs[i].iat_addr <= *eip && *eip - imported_libs[i].iat_addr < imported_libs[i].iat_size) {
			uint32_t offset = *eip - imported_libs[i].iat_addr;
			called_lib = &imported_libs[i];
			if (offset % 4 == 0) {
				called_func = &imported_libs[i].funcs[offset / 4];
			}
			break;
		}
	}
	if (called_lib == NULL) {
		fprintf(stderr, "library not found for EIP %08"PRIx32"\n", *eip);
		return -1;
	}
	stack_remove_size = pe_lib_exec(regs, called_lib->name,
		called_func->is_ord ? NULL : called_func->name,
		called_func->is_ord ? called_func->hint_or_ord : 0);
	if (stack_remove_size == PE_LIB_EXEC_FAILED) return -1;
	if (stack_remove_size == PE_LIB_EXEC_EXIT) return 0;
	/* ret */
	dmemory_read(eip, regs[ESP], 4);
	regs[ESP] += 4 + stack_remove_size;
	return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl 0x12ad3(%rip), %ecx     # 0x1ddb8
movl (%rdi), %edx
testq %rcx, %rcx
je 0xb31a
movq %rsi, %rbx
movq %rdi, %r14
movq 0x12ab7(%rip), %rax     # 0x1ddb0
shlq $0x3, %rcx
leaq (%rcx,%rcx,4), %rsi
xorl %ecx, %ecx
movl %edx, %edi
subl 0x4(%rax,%rcx), %edi
jb 0xb311
cmpl 0x8(%rax,%rcx), %edi
jb 0xb33a
addq $0x28, %rcx
cmpq %rcx, %rsi
jne 0xb303
movq 0x7cd7(%rip), %rax      # 0x12ff8
movq (%rax), %rdi
leaq 0x3183(%rip), %rsi      # 0xe4ae
xorl %eax, %eax
callq 0x10d0
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
jmp 0xb3a2
movq 0x10(%rax,%rcx), %rsi
movq 0x18(%rax,%rcx), %rax
shrl $0x2, %edi
leaq (%rdi,%rdi,2), %rcx
leaq (%rax,%rcx,8), %rax
cmpl $0x0, (%rax)
je 0xb35c
movzwl 0x10(%rax), %eax
xorl %edx, %edx
jmp 0xb362
movq 0x8(%rax), %rdx
xorl %eax, %eax
movzwl %ax, %ecx
movq %rbx, %rdi
callq 0xb65e
movl %eax, %r15d
cmpl $-0x1, %eax
je 0xb3a2
cmpl $-0x2, %r15d
jne 0xb380
xorl %r15d, %r15d
jmp 0xb3a2
movl 0x10(%rbx), %esi
movq %r14, %rdi
movl $0x4, %edx
callq 0x6a34
movl 0x10(%rbx), %eax
addl %r15d, %eax
addl $0x4, %eax
movl %eax, 0x10(%rbx)
movl $0x1, %r15d
movl %r15d, %eax
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_c_makefile_star2_O3/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 %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x11a0
movq (%rax), %rcx
movzbl (%r14), %eax
movl (%rcx,%rax,4), %eax
movzbl (%rbx), %edx
movl (%rcx,%rdx,4), %esi
cmpl %esi, %eax
jne 0xb5b4
movl $0x1, %edx
testl %eax, %eax
je 0xb5c4
movzbl (%r14,%rdx), %eax
movl (%rcx,%rax,4), %eax
movzbl (%rbx,%rdx), %esi
movl (%rcx,%rsi,4), %esi
incq %rdx
cmpl %esi, %eax
je 0xb59a
xorl %ecx, %ecx
cmpl %esi, %eax
setg %cl
leal -0x1(,%rcx,2), %eax
jmp 0xb5c6
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/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 %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
testq %rsi, %rsi
sete %al
cmpl $0x1, %edi
setne %cl
orb %al, %cl
jne 0xb654
movq %rsi, %r14
leaq 0x2f08(%rip), %rsi      # 0xe4f6
movq %r14, %rdi
callq 0x10c0
testl %eax, %eax
je 0xb649
leaq 0x2efa(%rip), %rsi      # 0xe4fb
movq %r14, %rdi
callq 0x10c0
testl %eax, %eax
je 0xb63e
leaq 0x2ef1(%rip), %rsi      # 0xe505
movq %r14, %rdi
callq 0x10c0
testl %eax, %eax
je 0xb63e
leaq 0x2ee8(%rip), %rsi      # 0xe50f
movq %r14, %rdi
callq 0x10c0
testl %eax, %eax
jne 0xb654
movl 0x12783(%rip), %ebx     # 0x1ddbc
addl $0x1c, %ebx
jmp 0xb654
movl 0x12778(%rip), %ebx     # 0x1ddbc
addl $0x18, %ebx
jmp 0xb654
movl $0x1000, %ebx           # imm = 0x1000
addl 0x12768(%rip), %ebx     # 0x1ddbc
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/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 %rbx
subq $0x9c40, %rsp           # imm = 0x9C40
movdqa 0xeb4(%rip), %xmm0      # 0x2010
xorl %eax, %eax
movdqa 0xeba(%rip), %xmm1      # 0x2020
movdqa %xmm0, (%rsp,%rax,4)
addq $0x4, %rax
paddd %xmm1, %xmm0
cmpq $0x2710, %rax           # imm = 0x2710
jne 0x1166
leaq 0x141(%rip), %rdi       # 0x12c3
movq %rsp, %rbx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq %rbx, %rdx
movl $0x2710, %ecx           # imm = 0x2710
callq 0x1250
leaq 0x158(%rip), %rdi       # 0x12f6
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq %rbx, %rdx
movl $0x2710, %ecx           # imm = 0x2710
callq 0x1250
xorl %eax, %eax
addq $0x9c40, %rsp           # imm = 0x9C40
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebx
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %r12
movl $0x186a0, %r13d         # imm = 0x186A0
callq 0x1030
movq %rax, %r15
movl %ebp, %edi
movq %r14, %rsi
movl %ebx, %edx
callq *%r12
decl %r13d
jne 0x1273
callq 0x1030
subq %r15, %rax
movl 0x2dac(%rip), %esi      # 0x403c
cvtsi2sd %rax, %xmm0
divsd 0xdc3(%rip), %xmm0      # 0x2060
leaq 0xdd2(%rip), %rdi       # 0x2076
movq %rax, %rdx
movb $0x1, %al
callq 0x1040
incl 0x2d88(%rip)            # 0x403c
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %r14d
movq %rdi, %rbx
leaq 0xd1d(%rip), %rdi       # 0x2068
xorl %eax, %eax
callq 0x1040
testl %r14d, %r14d
jle 0x138a
leal -0x1(%r14), %r15d
movl %r14d, %r14d
leaq 0xd0b(%rip), %r12       # 0x2070
leaq 0xcff(%rip), %r13       # 0x206b
xorl %ebp, %ebp
cmpq %rbp, %r15
movq %r13, %rdi
cmoveq %r12, %rdi
movl (%rbx,%rbp,4), %esi
xorl %eax, %eax
callq 0x1040
incq %rbp
cmpq %rbp, %r14
jne 0x136e
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
cmpl $0x1, %edi
jne 0x1407
pxor %xmm0, %xmm0
leaq 0x10(%rsp), %rdi
movdqa %xmm0, (%rdi)
movq 0x2d71(%rip), %r15      # 0x3fd8
movq (%r15), %rcx
movl $0x1, %esi
movl $0x10, %edx
callq 0x1030
cmpq $0x10, %rax
jne 0x142a
movabsq $0x646c656662726166, %rax # imm = 0x646C656662726166
cmpq %rax, 0x10(%rsp)
jne 0x142f
leaq 0x10(%rsp), %rbx
movl 0x8(%rbx), %ebp
movl 0xc(%rbx), %r14d
movq 0x2d25(%rip), %r13      # 0x3fd0
movq (%r13), %rsi
leaq 0xd88(%rip), %rdi       # 0x203e
callq 0x1040
movl %ebp, 0xc(%rsp)
movl %ebp, (%rbx)
movq (%r13), %rcx
movl $0x4, %esi
movl $0x1, %edx
movq %rbx, %rdi
callq 0x1070
cmpq $0x1, %rax
jne 0x1420
leaq 0x10(%rsp), %rdi
movl %r14d, (%rdi)
movq (%r13), %rcx
movl $0x4, %esi
movl $0x1, %edx
callq 0x1070
cmpq $0x1, %rax
jne 0x1420
testl %r14d, %r14d
je 0x13f6
movl 0xc(%rsp), %eax
bswapl %eax
cmpl $0x1, %eax
adcl $0x0, %eax
movl %eax, 0x24(%rsp)
bswapl %r14d
cmpl $0x1, %r14d
adcl $0x0, %r14d
movl %r14d, 0x20(%rsp)
xorl %r12d, %r12d
leaq 0x4(%rsp), %rbx
leaq 0x10(%rsp), %r14
movl 0x24(%rsp), %ebp
cmpl $0x0, 0xc(%rsp)
je 0x13e8
movq (%r15), %rcx
movl $0x2, %esi
movl $0x4, %edx
movq %rbx, %rdi
callq 0x1030
cmpq $0x4, %rax
jne 0x141b
movl 0x8(%rsp), %eax
movzwl 0xa(%rsp), %ecx
movl %ecx, %edx
rolw $0x8, %dx
movw %dx, 0xa(%rsp)
notl %eax
movl %eax, %edx
rolw $0x8, %dx
movw %dx, 0x8(%rsp)
movd 0x4(%rsp), %xmm0
pxor 0xc77(%rip), %xmm0      # 0x2010
movd %xmm0, %edx
rolw $0x8, %dx
pextrw $0x1, %xmm0, %esi
movw %dx, 0x4(%rsp)
rolw $0x8, %si
movw %si, 0x6(%rsp)
movd %xmm0, 0x10(%rsp)
movw %ax, 0x14(%rsp)
movw %cx, 0x16(%rsp)
movq (%r13), %rcx
movl $0x2, %esi
movl $0x4, %edx
movq %r14, %rdi
callq 0x1070
cmpq $0x4, %rax
jne 0x1416
decl %ebp
jne 0x134b
incl %r12d
cmpl 0x20(%rsp), %r12d
jne 0x133c
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rsi, %rdi
callq 0x1090
movl $0x1, %eax
jmp 0x13f8
callq 0x111d
callq 0x10f8
movl $0x1, %edi
callq 0x1060
callq 0x10ae
callq 0x10d3
// File: /workspace/github_c_makefile_star2_O3/wtakuo[P]SVM/test1.c
// Function: vmtest
void vmtest (int n, vm_mode_t mode) {
    int codelen = sizeof(code)/sizeof(Bcode);
    Function f = new_function(1, 1, code + 10, codelen - 10);
    gv[0] = (Value)n;
    gv[1] = (Value)f;

    vm(code, codelen, vs_base, VS_SIZE, gv, GV_SIZE, mode);

    delete_function(f);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %esi, %ebx
movl %edi, %ebp
leaq 0x283f(%rip), %rdx      # 0x407a
movl $0x1, %edi
movl $0x1, %esi
movl $0x1d, %ecx
callq 0x15b4
movq %rax, %r14
leaq 0x2817(%rip), %rdi      # 0x4070
movslq %ebp, %rax
movq %rax, 0x284d(%rip)      # 0x40b0
leaq 0x2846(%rip), %r8       # 0x40b0
movq %r14, 0x2847(%rip)      # 0x40b8
movl %ebx, (%rsp)
leaq 0x3075(%rip), %rdx      # 0x48f0
movl $0x27, %esi
movl $0x100, %ecx            # imm = 0x100
movl $0x8, %r9d
callq 0x121c
movq %r14, %rdi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x15f7
// File: /workspace/github_c_makefile_star2_O3/mjosaarinen[P]brutus/src/util.c
// Function: hex_dump
void hex_dump(void *p, int len)
{
    int i, j;
    uint8_t t;

    for (i = 0; i < len; i += 16) {
        printf("[%08X] ", i);
        for (j = 0; j < 16; j++) {
            if (j == 8)
                putchar(' ');
            if (i + j < len)
                printf(" %02X", ((uint8_t *) p)[i + j]);
            else
                printf("   ");
        }
        printf("  |");

        for (j = 0; j < 16; j++) {
            if (i + j >= len)
                break;
            t = ((uint8_t *) p)[i + j];
            if (t >= 0x20 && t < 0x7F)
                putchar(t);
            else
                putchar('.');
        }
        printf("|\n");
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, 0x4(%rsp)
testl %esi, %esi
jle 0x1b02
movq %rdi, %r14
movl 0x4(%rsp), %ebp
leaq 0x2a59(%rip), %r15      # 0x44aa
xorl %r12d, %r12d
leaq 0x2a41(%rip), %rdi      # 0x449c
movl %r12d, %esi
xorl %eax, %eax
callq 0x10b0
movl $0x10, %ebx
movq %r12, %r13
cmpq $0x8, %rbx
jne 0x1a7d
movl $0x20, %edi
callq 0x1050
cmpq %rbp, %r13
jae 0x1a97
movzbl (%r14,%r13), %esi
leaq 0x2a16(%rip), %rdi      # 0x44a4
xorl %eax, %eax
callq 0x10b0
jmp 0x1aa1
movq %r15, %rdi
xorl %eax, %eax
callq 0x10b0
incq %r13
decq %rbx
jne 0x1a6d
leaq 0x29fe(%rip), %rdi      # 0x44ae
xorl %eax, %eax
callq 0x10b0
movl $0x10, %ebx
movq %r12, %r13
cmpq %rbp, %r13
jae 0x1ae7
movzbl (%r14,%r13), %eax
leal -0x20(%rax), %ecx
cmpb $0x5f, %cl
movl $0x2e, %ecx
cmovael %ecx, %eax
movzbl %al, %edi
callq 0x1050
incq %r13
decq %rbx
jne 0x1abf
leaq 0x29c2(%rip), %rdi      # 0x44b0
callq 0x1070
addq $0x10, %r12
cmpl 0x4(%rsp), %r12d
jl 0x1a54
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/mjosaarinen[P]brutus/src/util.c
// Function: test_harness
int test_harness(int (*test_func)(caesar_t *, int), caesar_t *aead, int val)
{
    pid_t p;
    int stat;

    p = fork();
    if (p == 0) {
        exit(test_func(aead, val));
    }
    waitpid(p, &stat, 0);
    fflush(stdout);

    // normal exit ?
    if (WIFEXITED(stat))
        return WEXITSTATUS(stat);

    // something weird happened
    if (WIFSIGNALED(stat))
        printf("\n[SIGNAL %d]\n", WTERMSIG(stat));
    else
        printf("\n[TERMINATED]\n");

    return -1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %edx, %ebx
movq %rsi, %r15
movq %rdi, %r14
callq 0x1210
testl %eax, %eax
je 0x1b99
leaq 0xc(%rsp), %rbx
movl %eax, %edi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x1180
movq 0x5495(%rip), %rax      # 0x6fd8
movq (%rax), %rdi
callq 0x1160
movl (%rbx), %ecx
movl %ecx, %eax
andl $0x7f, %eax
je 0x1b79
movl %eax, %ecx
shll $0x18, %ecx
addl $0x1000000, %ecx        # imm = 0x1000000
cmpl $0x2000000, %ecx        # imm = 0x2000000
jl 0x1b7e
leaq 0x2944(%rip), %rdi      # 0x44b2
movl %eax, %esi
xorl %eax, %eax
callq 0x10b0
jmp 0x1b8a
movzbl %ch, %eax
jmp 0x1b8f
leaq 0x293b(%rip), %rdi      # 0x44c0
callq 0x1070
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %r15, %rdi
movl %ebx, %esi
callq *%r14
movl %eax, %edi
callq 0x11e0
// File: /workspace/github_c_makefile_star2_O3/mjosaarinen[P]brutus/src/speed.c
// Function: test_speed
int test_speed(caesar_t *aead, int limit)
{
    uint64_t len;

    if (brutus_verbose) {
        printf("[%s] Speed Test (limit=%d sec)  "
            "key=%d  nsec=%d  npub=%d  a=%d\n",
            aead->name, limit, aead->keybytes, aead->nsecbytes,
            aead->npubbytes, aead->abytes);
    }

    for (len = 0x10; len <= 0x10000; len <<= 2) {
        run_speed(aead, len, 0, limit);
        run_speed(aead, 0, len, limit);
        run_speed(aead, len, len, limit);
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x5208(%rip), %rax      # 0x7128
cmpl $0x0, (%rax)
je 0x1f4a
movq 0x8(%rbx), %rsi
movl 0x10(%rbx), %ecx
movl 0x14(%rbx), %r8d
movl 0x18(%rbx), %r9d
movl 0x1c(%rbx), %eax
movl %eax, (%rsp)
leaq 0x284e(%rip), %rdi      # 0x478f
movl %ebp, %edx
xorl %eax, %eax
callq 0x10b0
movslq %ebp, %r14
movl $0x10, %r15d
movq %rbx, %rdi
movq %r15, %rsi
xorl %edx, %edx
movq %r14, %rcx
callq 0x1bf0
movq %rbx, %rdi
xorl %esi, %esi
movq %r15, %rdx
movq %r14, %rcx
callq 0x1bf0
movq %rbx, %rdi
movq %r15, %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x1bf0
leaq (,%r15,4), %rax
cmpq $0x4001, %r15           # imm = 0x4001
movq %rax, %r15
jb 0x1f53
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/mjosaarinen[P]brutus/src/speed.c
// Function: test_throughput
int test_throughput(caesar_t *aead, int limit)
{
    if (brutus_verbose) {
        printf("[%s] Throughput (limit=%d sec)  "
            "key=%d  nsec=%d  npub=%d a=%d\n",
            aead->name, limit, aead->keybytes, aead->nsecbytes,
            aead->npubbytes, aead->abytes);
    }

    run_speed(aead, 0x10000, 0, limit);

    return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x5174(%rip), %rax      # 0x7128
cmpl $0x0, (%rax)
je 0x1fde
movq 0x8(%rbx), %rsi
movl 0x10(%rbx), %ecx
movl 0x14(%rbx), %r8d
movl 0x18(%rbx), %r9d
movl 0x1c(%rbx), %eax
movl %eax, (%rsp)
leaq 0x27fa(%rip), %rdi      # 0x47cf
movl %ebp, %edx
xorl %eax, %eax
callq 0x10b0
movslq %ebp, %rcx
movl $0x10000, %esi          # imm = 0x10000
movq %rbx, %rdi
xorl %edx, %edx
callq 0x1bf0
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/mjosaarinen[P]brutus/src/kat.c
// Function: kat_vec
void kat_vec(void *p, int len, char *label)
{
    int i;
    printf("%4s[%5d]=", label, len);
    for (i = 0; i < len; i++)
        printf("%02X", ((uint8_t *) p)[i]);
    printf("\n");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x238e(%rip), %rdi      # 0x49e6
movq %rdx, %rsi
movl %ebp, %edx
xorl %eax, %eax
callq 0x10b0
testl %ebp, %ebp
jle 0x268c
movl %ebp, %r15d
leaq 0x1e33(%rip), %r14      # 0x44a5
xorl %r12d, %r12d
movzbl (%rbx,%r12), %esi
movq %r14, %rdi
xorl %eax, %eax
callq 0x10b0
incq %r12
cmpq %r12, %r15
jne 0x2675
movl $0xa, %edi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x1050
// File: /workspace/github_c_makefile_star2_O3/mjosaarinen[P]brutus/src/kat.c
// Function: test_kat
int test_kat(caesar_t *aead, int limit)
{
    int len, t;

    if (brutus_verbose) {
        printf("[%s] KAT (limit=%d bytes)  "
            "key=%d  nsec=%d  npub=%d  a=%d\n",
            aead->name, limit, aead->keybytes, aead->nsecbytes,
            aead->npubbytes, aead->abytes);
    }
    if (limit > KAT_LIMIT) {
        fprintf(stderr, "Limit too high. Increse KAT_LIMIT macro (%d).\n",
            KAT_LIMIT);
        return -1;
    }

    detseq_seed(-1);
    do_kat(aead, 0, 0);

    for (len = 1; len <= limit; len++) {
        detseq_seed(len);
        do_kat(aead, len, 0);
        do_kat(aead, 0, len);
        if (len > 1) {
            t = detseq32() % (len - 1) + 1;
            do_kat(aead, t, len - t);
        }
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
leaq 0x485f(%rip), %rax      # 0x7128
cmpl $0x0, (%rax)
je 0x28f5
movq 0x8(%r14), %rsi
movl 0x10(%r14), %ecx
movl 0x14(%r14), %r8d
movl 0x18(%r14), %r9d
movl 0x1c(%r14), %eax
movl %eax, (%rsp)
leaq 0x2149(%rip), %rdi      # 0x4a35
movl %ebx, %edx
xorl %eax, %eax
callq 0x10b0
cmpl $0x10001, %ebx          # imm = 0x10001
jge 0x2975
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x19c8
xorl %ebp, %ebp
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x269e
testl %ebx, %ebx
jle 0x2968
xorl %r15d, %r15d
leal 0x1(%r15), %ebp
movl %ebp, %edi
callq 0x19c8
movq %r14, %rdi
movl %ebp, %esi
xorl %edx, %edx
callq 0x269e
movq %r14, %rdi
xorl %esi, %esi
movl %ebp, %edx
callq 0x269e
cmpl $0x2, %ebp
jb 0x295f
xorl %eax, %eax
callq 0x19df
xorl %edx, %edx
divl %r15d
leal 0x1(%rdx), %esi
movl %ebp, %edx
subl %esi, %edx
movq %r14, %rdi
callq 0x269e
movl %ebp, %r15d
cmpl %ebp, %ebx
jne 0x291c
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x129c
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x2968
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/lemire[P]simdprune/benchmark.c
// Function: print_epi8
void print_epi8(__m128i x) {
  uint8_t buffer[16];
  _mm_storeu_si128((__m128i*)buffer,x);
  for(size_t i = 0; i < 16; i++) {
    printf("%u ", buffer[i]);
  }
  printf("\n");
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
vmovaps %xmm0, (%rsp)
leaq 0x105793(%rip), %rbx    # 0x106ba0
xorl %r14d, %r14d
movzbl (%rsp,%r14), %esi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1060
incq %r14
cmpq $0x10, %r14
jne 0x1410
movl $0xa, %edi
addq $0x18, %rsp
popq %rbx
popq %r14
jmp 0x1040
// File: /workspace/github_c_makefile_star2_O3/lemire[P]simdprune/benchmark.c
// Function: check_prune_epi8
void check_prune_epi8(__m128i input, __m128i output, int mask) {
  uint8_t buffer[16];
  _mm_storeu_si128((__m128i*)buffer,input);
  size_t pos = 0;
  uint8_t outbuffer[16];
  _mm_storeu_si128((__m128i*)outbuffer,output);

  for(size_t i = 0; i < 16; i++) {
    if((mask & (1<<i)) == 0) {
      assert(buffer[i] == outbuffer[pos]);
      pos ++;
    }
  }
}

// Assembly:
subq $0x28, %rsp
vmovaps %xmm0, 0x10(%rsp)
vmovaps %xmm1, (%rsp)
xorl %eax, %eax
xorl %ecx, %ecx
btl %eax, %edi
jb 0x145d
movb 0x10(%rsp,%rax), %dl
cmpb (%rsp,%rcx), %dl
jne 0x146b
incq %rcx
incq %rax
cmpq $0x10, %rax
jne 0x144c
addq $0x28, %rsp
retq
leaq 0x105732(%rip), %rdi    # 0x106ba4
leaq 0x105747(%rip), %rsi    # 0x106bc0
leaq 0x10574c(%rip), %rcx    # 0x106bcc
movl $0xe8, %edx
callq 0x1070