LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/LemonBoy[P]autobahn/main.c
// Function: print_ed_cmd
void print_ed_cmd (char cmd, long s1, long e1, long s2, long e2)
{
        // XXX Coalesce all the writes to stdio ?
        if (s1 == e1) printf("%ld", s1); else printf("%ld,%ld", s1, e1);
        putchar(cmd);
        if (s2 == e2) printf("%ld", s2); else printf("%ld,%ld", s2, e2);
        putchar('\n');
}

// Assembly:
subq $0x28, %rsp
movb %dil, %al
movb %al, 0x27(%rsp)
movq %rsi, 0x18(%rsp)
movq %rdx, 0x10(%rsp)
movq %rcx, 0x8(%rsp)
movq %r8, (%rsp)
movq 0x18(%rsp), %rax
cmpq 0x10(%rsp), %rax
jne 0xb99f
movq 0x18(%rsp), %rsi
leaq 0x7b9(%rip), %rdi       # 0xc14f
movb $0x0, %al
callq 0x1080
jmp 0xb9b7
movq 0x18(%rsp), %rsi
movq 0x10(%rsp), %rdx
leaq 0x79b(%rip), %rdi       # 0xc14b
movb $0x0, %al
callq 0x1080
movsbl 0x27(%rsp), %edi
callq 0x1040
movq 0x8(%rsp), %rax
cmpq (%rsp), %rax
jne 0xb9e1
movq 0x8(%rsp), %rsi
leaq 0x777(%rip), %rdi       # 0xc14f
movb $0x0, %al
callq 0x1080
jmp 0xb9f8
movq 0x8(%rsp), %rsi
movq (%rsp), %rdx
leaq 0x75a(%rip), %rdi       # 0xc14b
movb $0x0, %al
callq 0x1080
movl $0xa, %edi
callq 0x1040
addq $0x28, %rsp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/LemonBoy[P]autobahn/main.c
// Function: print_hunk
int print_hunk (long start_a, long count_a, long start_b, long count_b, void *cb_data)
{
        int s1, e1, s2, e2;

        // Adjust the start-end ranges
        s1 = count_a? start_a + 1: start_a;
        e1 = start_a + count_a;

        s2 = count_b? start_b + 1: start_b;
        e2 = start_b + count_b;

        if (count_b == 0)
                // Delete lines from a
                print_ed_cmd('d', s1, e1, e2, e2);
        else if (count_a == 0)
                // Add lines to a
                print_ed_cmd('a', e1, e1, s2, e2);
        else
                // Change lines
                print_ed_cmd('c', s1, e1, s2, e2);

        seen_hunk = 1;

        return 1;
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x40(%rsp)
movq %rsi, 0x38(%rsp)
movq %rdx, 0x30(%rsp)
movq %rcx, 0x28(%rsp)
movq %r8, 0x20(%rsp)
cmpq $0x0, 0x38(%rsp)
je 0xba45
movq 0x40(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x8(%rsp)
jmp 0xba4f
movq 0x40(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
movl %eax, 0x1c(%rsp)
movq 0x40(%rsp), %rax
addq 0x38(%rsp), %rax
movl %eax, 0x18(%rsp)
cmpq $0x0, 0x28(%rsp)
je 0xba7d
movq 0x30(%rsp), %rax
addq $0x1, %rax
movq %rax, (%rsp)
jmp 0xba86
movq 0x30(%rsp), %rax
movq %rax, (%rsp)
movq (%rsp), %rax
movl %eax, 0x14(%rsp)
movq 0x30(%rsp), %rax
addq 0x28(%rsp), %rax
movl %eax, 0x10(%rsp)
cmpq $0x0, 0x28(%rsp)
jne 0xbac4
movslq 0x1c(%rsp), %rsi
movslq 0x18(%rsp), %rdx
movslq 0x10(%rsp), %rcx
movslq 0x10(%rsp), %r8
movl $0x64, %edi
callq 0xb960
jmp 0xbb0c
cmpq $0x0, 0x38(%rsp)
jne 0xbaec
movslq 0x18(%rsp), %rsi
movslq 0x18(%rsp), %rdx
movslq 0x14(%rsp), %rcx
movslq 0x10(%rsp), %r8
movl $0x61, %edi
callq 0xb960
jmp 0xbb0a
movslq 0x1c(%rsp), %rsi
movslq 0x18(%rsp), %rdx
movslq 0x14(%rsp), %rcx
movslq 0x10(%rsp), %r8
movl $0x63, %edi
callq 0xb960
jmp 0xbb0c
movl $0x1, 0x35aa(%rip)      # 0xf0c0
movl $0x1, %eax
addq $0x48, %rsp
retq
// File: /workspace/github_c_makefile_star2_O0/LemonBoy[P]autobahn/main.c
// Function: read_mmfile
void read_mmfile (mmfile_t *mf, const char *path)
{
        FILE *fp;
        struct stat st;
        size_t size;

        if (stat(path, &st))
                die("Could not stat %s\n", path);

        size = st.st_size;

        fp = fopen(path, "r");
        if (fp == NULL)
                die("Could not open %s\n", path);

        mf->ptr = xmalloc(size);
        mf->size = size;

        fread(mf->ptr, 1, size, fp);
        fclose(fp);
}

// Assembly:
subq $0xb8, %rsp
movq %rdi, 0xb0(%rsp)
movq %rsi, 0xa8(%rsp)
movq 0xa8(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x10d0
cmpl $0x0, %eax
je 0xbb64
movq 0xa8(%rsp), %rsi
leaq 0x5f6(%rip), %rdi       # 0xc153
movb $0x0, %al
callq 0xb860
movq 0x40(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0xa8(%rsp), %rdi
leaq 0x5e9(%rip), %rsi       # 0xc166
callq 0x1110
movq %rax, 0xa0(%rsp)
cmpq $0x0, 0xa0(%rsp)
jne 0xbbab
movq 0xa8(%rsp), %rsi
leaq 0x5c4(%rip), %rdi       # 0xc168
movb $0x0, %al
callq 0xb860
movq 0x8(%rsp), %rdi
callq 0xb920
movq %rax, %rcx
movq 0xb0(%rsp), %rax
movq %rcx, (%rax)
movq 0x8(%rsp), %rcx
movq 0xb0(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0xb0(%rsp), %rax
movq (%rax), %rdi
movq 0x8(%rsp), %rdx
movq 0xa0(%rsp), %rcx
movl $0x1, %esi
callq 0x1050
movq 0xa0(%rsp), %rdi
callq 0x1060
addq $0xb8, %rsp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/antonblanchard[P]will-it-scale/tests/pthread_mutex1.c
// Function: testcase
void testcase(unsigned long long *iterations, unsigned long nr)
{
	while (1) {
		pthread_mutex_lock(&mutex);
		pthread_mutex_unlock(&mutex);

		(*iterations)++;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq 0xb169(%rip), %rdi      # 0xd1a0
callq 0x1280
leaq 0xb15d(%rip), %rdi      # 0xd1a0
callq 0x11a0
movq -0x8(%rbp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
jmp 0x2030
// File: /workspace/github_c_makefile_star2_O0/jalalium[P]graph_algorithms_task/src_scc_para/main_scc_para.c
// Function: generate_graph
t_graph *generate_graph()
{
	t_graph *new = (t_graph*)malloc(sizeof(t_graph));
	new->head = NULL;
	new->tail = NULL;
	new->components = 0;
	if (!get_dimensions(new))
		error(WRONG_INPUT);
	if (!get_edges(new))
		error(WRONG_EDGE);
	new->scc = (int*)malloc(sizeof(int)*new->vertx);
	new->vis = (int*)malloc(sizeof(int)*new->vertx);
	memset(new->scc, -1, sizeof(int) * new->vertx);
	memset(new->vis, 0, sizeof(int) * new->vertx);
	return (new);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x40, %edi
callq 0x1090
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x8(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x30(%rax)
movq -0x8(%rbp), %rdi
callq 0x1e70
cmpl $0x0, %eax
jne 0x124e
xorl %edi, %edi
callq 0x2140
movq -0x8(%rbp), %rdi
callq 0x2020
cmpl $0x0, %eax
jne 0x1266
movl $0x1, %edi
callq 0x2140
movq -0x8(%rbp), %rax
movslq 0x34(%rax), %rdi
shlq $0x2, %rdi
callq 0x1090
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x8(%rbp), %rax
movslq 0x34(%rax), %rdi
shlq $0x2, %rdi
callq 0x1090
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rdi
movq -0x8(%rbp), %rax
movslq 0x34(%rax), %rdx
shlq $0x2, %rdx
movl $0xff, %esi
callq 0x1070
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x8(%rbp), %rax
movslq 0x34(%rax), %rdx
shlq $0x2, %rdx
xorl %esi, %esi
callq 0x1070
movq -0x8(%rbp), %rax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jalalium[P]graph_algorithms_task/src_scc_para/main_scc_para.c
// Function: init_resource
t_resource	*init_resource(pthread_mutex_t *m, t_vect *v)
{
	t_resource *new = (t_resource*)malloc(sizeof(t_resource));
	new->mtx = m;
	new->list = v;
	return new;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x10, %edi
callq 0x1090
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/jalalium[P]graph_algorithms_task/src_scc_para/main_scc_para.c
// Function: find
int		find(t_vect *v, int r)
{
	int low = 0;
	int hi = v->used;
	while (low <= hi)
	{
		int mid = (low+hi)/2;
		if (v->tab[mid] == r)
			return 1;
		else if (v->tab[mid] > r)
			hi = mid-1;
		else
			low = mid+1;
	}
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl %eax, -0x1c(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jg 0x13ad
movl -0x18(%rbp), %eax
addl -0x1c(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movslq -0x20(%rbp), %rcx
movl (%rax,%rcx,4), %eax
cmpl -0x14(%rbp), %eax
jne 0x1382
movl $0x1, -0x4(%rbp)
jmp 0x13b4
movq -0x10(%rbp), %rax
movq (%rax), %rax
movslq -0x20(%rbp), %rcx
movl (%rax,%rcx,4), %eax
cmpl -0x14(%rbp), %eax
jle 0x13a0
movl -0x20(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x13a9
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x13ab
jmp 0x134d
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jalalium[P]graph_algorithms_task/src_scc_para/main_scc_para.c
// Function: main
int main()
{
	pthread_t ol;
	pthread_mutex_t mutex;
	t_vect new;

	G = generate_graph();
	pthread_mutex_init(&mutex, NULL);
	//puts all vertices as the first problem
	initiate_vertices(&new);
	t_resource *res = init_resource(&mutex, &new);
	pthread_create(&ol, NULL, kernel, res);
	pthread_join(ol, NULL);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
callq 0x1200
movq %rax, 0x33a4(%rip)      # 0x5098
leaq -0x30(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x10e0
leaq -0x48(%rbp), %rdi
callq 0x1c90
leaq -0x30(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x12f0
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rcx
leaq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq -0x96e(%rip), %rdx      # 0x13c0
callq 0x10a0
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x10d0
xorl %eax, %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jalalium[P]graph_algorithms_task/src_scc_para/create_graph.c
// Function: init_adj
int	init_adj(t_graph *g)
{
	if(!(g->adj = (t_vect*)malloc(sizeof(t_vect)*g->vertx)))
		return 0;
	if(!(g->rev_adj = (t_vect*)malloc(sizeof(t_vect)*g->vertx)))
		return 0;
	for (int i = 0; i < g->vertx; i++)
		if (!(init_vector(&g->adj[i])))
			return 0;
	for (int i = 0; i < g->vertx; i++)
		if (!(init_vector(&g->rev_adj[i])))
			return 0;
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movslq 0x34(%rax), %rax
imulq $0x18, %rax, %rdi
callq 0x1090
movq -0x10(%rbp), %rcx
movq %rax, (%rcx)
cmpq $0x0, %rax
jne 0x1da6
movl $0x0, -0x4(%rbp)
jmp 0x1e63
movq -0x10(%rbp), %rax
movslq 0x34(%rax), %rax
imulq $0x18, %rax, %rdi
callq 0x1090
movq -0x10(%rbp), %rcx
movq %rax, 0x8(%rcx)
cmpq $0x0, %rax
jne 0x1dd1
movl $0x0, -0x4(%rbp)
jmp 0x1e63
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x34(%rcx), %eax
jge 0x1e16
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movslq -0x14(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
callq 0x22a0
cmpl $0x0, %eax
jne 0x1e09
movl $0x0, -0x4(%rbp)
jmp 0x1e63
jmp 0x1e0b
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x1dd8
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x34(%rcx), %eax
jge 0x1e5c
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movslq -0x18(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
callq 0x22a0
cmpl $0x0, %eax
jne 0x1e4f
movl $0x0, -0x4(%rbp)
jmp 0x1e63
jmp 0x1e51
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x1e1d
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jalalium[P]graph_algorithms_task/src_scc_para/create_graph.c
// Function: get_dimensions
int		get_dimensions(t_graph *new)
{
	int n,m;

	scanf("%d %d", &n, &m);
	if (!valid_dimensions(n,m,new))
	{
		free(new);
		return 0;
	}
	if (!init_adj(new))
		return 0;
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
leaq 0x11a1(%rip), %rdi      # 0x3024
leaq -0x14(%rbp), %rsi
leaq -0x18(%rbp), %rdx
movb $0x0, %al
callq 0x10b0
movl -0x14(%rbp), %edi
movl -0x18(%rbp), %esi
movq -0x10(%rbp), %rdx
callq 0x2440
cmpl $0x0, %eax
jne 0x1eb8
movq -0x10(%rbp), %rdi
callq 0x1030
movl $0x0, -0x4(%rbp)
jmp 0x1ed6
movq -0x10(%rbp), %rdi
callq 0x1d70
cmpl $0x0, %eax
jne 0x1ecf
movl $0x0, -0x4(%rbp)
jmp 0x1ed6
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/jalalium[P]graph_algorithms_task/src_scc_para/stack.c
// Function: pop
void	pop(t_stack *stk)
{
	t_layer		*tmp;

	if (stk->size <= 0)
		return ;
	if (stk->size == 1)
	{
		free(stk->top);
		stk->size--;
		return ;
	}
	tmp = stk->top->prev;
	free(stk->top);
	stk->top = tmp;
	stk->top->next = NULL;
	stk->size--;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x8(%rax)
ja 0x2199
jmp 0x2206
movq -0x8(%rbp), %rax
cmpq $0x1, 0x8(%rax)
jne 0x21c2
movq -0x8(%rbp), %rax
movq (%rax), %rdi
callq 0x1030
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x8(%rax)
jmp 0x2206
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
callq 0x1030
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq $0x0, 0x8(%rax)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x8(%rax)
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jalalium[P]graph_algorithms_task/src_scc_para/stack.c
// Function: push
void	push(t_stack *stk, int val)
{
	t_layer *new = (t_layer*)malloc(sizeof(t_layer));
	
	new->val = val;
	if (stk->size == 0)
		stk->top = new;
	else
	{
		new->next = NULL;
		new->prev = stk->top;
		stk->top->next = new;
		stk->top = new;
	}
	stk->size++;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl $0x18, %edi
callq 0x1090
movq %rax, -0x18(%rbp)
movl -0xc(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x224f
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
jmp 0x2283
movq -0x18(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x8(%rax)
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jalalium[P]graph_algorithms_task/src_scc_para/validation.c
// Function: valid_edge
int		valid_edge(t_pair *got, int i, t_graph *g)
{
	got[i].x--;
	got[i].y--;
	if (got[i].x < 0 || got[i].x >= g->vertx)
	   return 0;
	if (got[i].y < 0 || got[i].y >= g->vertx)
		return 0;
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movl (%rax,%rcx,8), %edx
addl $-0x1, %edx
movl %edx, (%rax,%rcx,8)
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movl 0x4(%rax,%rcx,8), %edx
addl $-0x1, %edx
movl %edx, 0x4(%rax,%rcx,8)
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,8)
jl 0x24e5
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movl (%rax,%rcx,8), %eax
movq -0x20(%rbp), %rcx
cmpl 0x34(%rcx), %eax
jl 0x24ee
movl $0x0, -0x4(%rbp)
jmp 0x2522
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
cmpl $0x0, 0x4(%rax,%rcx,8)
jl 0x2512
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movl 0x4(%rax,%rcx,8), %eax
movq -0x20(%rbp), %rcx
cmpl 0x34(%rcx), %eax
jl 0x251b
movl $0x0, -0x4(%rbp)
jmp 0x2522
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/rouming[P]io/http-server.c
// Function: create_server_socket
static int create_server_socket(const char *ip_address, int port)
{
	struct sockaddr addr;
	struct sockaddr_in *sin = (struct sockaddr_in *)&addr;
	int fd, err, val = 0;

	memset(&addr, 0, sizeof(addr));
	sin->sin_family = AF_INET;
	sin->sin_port = htons(port);

	err = inet_aton(ip_address, &sin->sin_addr);
	assert(err);

	fd = socket(AF_INET, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK,
		    IPPROTO_TCP);
	assert(fd >= 0);

	if ((setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &val, 4) < 0) ||
	    (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &val, 4) < 0))
		assert(0);

	err = bind(fd, &addr, sizeof(*sin));
	assert(err == 0);

	err = listen(fd, SOMAXCONN);
	assert(err == 0);

	return fd;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
leaq -0x1c(%rbp), %rax
movq %rax, -0x28(%rbp)
movl $0x0, -0x34(%rbp)
leaq -0x1c(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x10e0
movq -0x28(%rbp), %rax
movw $0x2, (%rax)
movl -0xc(%rbp), %eax
movzwl %ax, %edi
callq 0x10b0
movw %ax, %cx
movq -0x28(%rbp), %rax
movw %cx, 0x2(%rax)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
addq $0x4, %rsi
callq 0x1190
movl %eax, -0x30(%rbp)
cmpl $0x0, -0x30(%rbp)
je 0x1769
jmp 0x1788
leaq 0x598a(%rip), %rdi      # 0x70fa
leaq 0x5919(%rip), %rsi      # 0x7090
movl $0x6f, %edx
leaq 0x597b(%rip), %rcx      # 0x70fe
callq 0x10d0
movl $0x2, %edi
movl $0x80801, %esi          # imm = 0x80801
movl $0x6, %edx
callq 0x1220
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
jl 0x17a7
jmp 0x17c6
leaq 0x590c(%rip), %rdi      # 0x70ba
leaq 0x58db(%rip), %rsi      # 0x7090
movl $0x73, %edx
leaq 0x593d(%rip), %rcx      # 0x70fe
callq 0x10d0
movl -0x2c(%rbp), %edi
movl $0x1, %esi
movl $0x2, %edx
leaq -0x34(%rbp), %rcx
movl $0x4, %r8d
callq 0x1070
cmpl $0x0, %eax
jl 0x1808
movl -0x2c(%rbp), %edi
movl $0x1, %esi
movl $0x9, %edx
leaq -0x34(%rbp), %rcx
movl $0x4, %r8d
callq 0x1070
cmpl $0x0, %eax
jge 0x1827
leaq 0x5e5b(%rip), %rdi      # 0x766a
leaq 0x587a(%rip), %rsi      # 0x7090
movl $0x77, %edx
leaq 0x58dc(%rip), %rcx      # 0x70fe
callq 0x10d0
movl -0x2c(%rbp), %edi
leaq -0x1c(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rsi
movl $0x10, %edx
callq 0x11f0
movl %eax, -0x30(%rbp)
cmpl $0x0, -0x30(%rbp)
jne 0x184b
jmp 0x186a
leaq 0x5870(%rip), %rdi      # 0x70c2
leaq 0x5837(%rip), %rsi      # 0x7090
movl $0x7a, %edx
leaq 0x5899(%rip), %rcx      # 0x70fe
callq 0x10d0
movl -0x2c(%rbp), %edi
movl $0x1000, %esi           # imm = 0x1000
callq 0x11c0
movl %eax, -0x30(%rbp)
cmpl $0x0, -0x30(%rbp)
jne 0x1882
jmp 0x18a1
leaq 0x5839(%rip), %rdi      # 0x70c2
leaq 0x5800(%rip), %rsi      # 0x7090
movl $0x7d, %edx
leaq 0x5862(%rip), %rcx      # 0x70fe
callq 0x10d0
movl -0x2c(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/rouming[P]io/http-server.c
// Function: create_signalfd
static int create_signalfd(void)
{
	sigset_t set;
	int fd;

	sigfillset(&set);
	sigprocmask(SIG_BLOCK, &set, NULL);

	sigemptyset(&set);
	sigaddset(&set, SIGINT);
	fd = signalfd(-1, &set, 0);
	if (fd < 0)
		return -errno;

	return fd;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
leaq -0x88(%rbp), %rdi
callq 0x1170
xorl %edi, %edi
leaq -0x88(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x1030
leaq -0x88(%rbp), %rdi
callq 0x1160
leaq -0x88(%rbp), %rdi
movl $0x2, %esi
callq 0x1210
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
leaq -0x88(%rbp), %rsi
xorl %edx, %edx
callq 0x10f0
movl %eax, -0x8c(%rbp)
cmpl $0x0, -0x8c(%rbp)
jge 0x1b59
callq 0x1050
movq %rax, %rcx
xorl %eax, %eax
subl (%rcx), %eax
movl %eax, -0x4(%rbp)
jmp 0x1b62
movl -0x8c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x90, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/rouming[P]io/http-server.c
// Function: on_signal
static int on_signal(struct io_req *req, int err)
{
	struct signalfd_siginfo *siginfo;
	struct loop_ctx *ctx = req->data;

	if (err < 0)
		return err;

	assert(err == sizeof(struct signalfd_siginfo));
	siginfo = req->buf.iov[0].iov_base;
	assert(siginfo->ssi_signo == SIGINT);

	/* Graceful exit */
	ctx->shutdown = true;

	return err;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x28(%rbp)
cmpl $0x0, -0x14(%rbp)
jge 0x1b99
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1c09
movslq -0x14(%rbp), %rax
cmpq $0x80, %rax
jne 0x1ba7
jmp 0x1bc6
leaq 0x563c(%rip), %rdi      # 0x71ea
leaq 0x54db(%rip), %rsi      # 0x7090
movl $0x49, %edx
leaq 0x5650(%rip), %rcx      # 0x7211
callq 0x10d0
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x2, (%rax)
jne 0x1bdd
jmp 0x1bfc
leaq 0x5651(%rip), %rdi      # 0x7235
leaq 0x54a5(%rip), %rsi      # 0x7090
movl $0x4b, %edx
leaq 0x561a(%rip), %rcx      # 0x7211
callq 0x10d0
movq -0x28(%rbp), %rax
movb $0x1, (%rax)
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/rouming[P]io/http-server.c
// Function: bh_execute
static void bh_execute(struct loop_ctx *ctx)
{
	struct connection *conn, *tmp;

	/* Free dead connections */
	list_for_each_entry_safe(conn, tmp, &ctx->dead_conns, dead_entry) {
		list_del(&conn->dead_entry);
		close(conn->sock);
		free(conn);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
xorl %eax, %eax
movq %rax, %rcx
addq $0x180, %rcx            # imm = 0x180
subq %rcx, %rax
addq -0x20(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x180(%rax), %rax
movq %rax, -0x30(%rbp)
xorl %eax, %eax
movq %rax, %rcx
addq $0x180, %rcx            # imm = 0x180
subq %rcx, %rax
addq -0x30(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
addq $0x180, %rax            # imm = 0x180
movq -0x8(%rbp), %rcx
addq $0x8, %rcx
cmpq %rcx, %rax
je 0x1d2c
movq -0x10(%rbp), %rdi
addq $0x180, %rdi            # imm = 0x180
callq 0x20e0
movq -0x10(%rbp), %rax
movl 0x190(%rax), %edi
callq 0x1100
movq -0x10(%rbp), %rdi
callq 0x1040
movq -0x18(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rax
movq 0x180(%rax), %rax
movq %rax, -0x40(%rbp)
xorl %eax, %eax
movq %rax, %rcx
addq $0x180, %rcx            # imm = 0x180
subq %rcx, %rax
addq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x18(%rbp)
jmp 0x1cb5
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/rouming[P]io/http-server.c
// Function: on_read__from_client
static int on_read__from_client(struct io_req *req, int len)
{
	struct connection *conn = req->data;
	struct io_req *wr_req;
	int rc;

	if (len < 0) {
		io_req_put(req);
		list_add_tail(&conn->dead_entry, &conn->ctx->dead_conns);
		/* Propagate error up */
		return len;
	}
	if (!strnstr(req->buf.iov[0].iov_base, "\r\n\r\n", len)) {
		/* Not enough, continue */
		return 0;
	}
	io_req_put(req);

	wr_req = io_req_create(&conn->cli_q, REQ_WR, conn,
			       on_write__to_client);
	assert(wr_req);

	wr_req->buf = (struct io_buf){
		.iov[0] = {
			.iov_base = (void *)http_response,
			.iov_len  = strlen(http_response)
		},
		.iov_num  = 1,
	};
	rc = io_queue_submit(wr_req);
	assert(rc == 0);

	/* Request will be put by the queue */
	return len;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x180, %rsp            # imm = 0x180
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x20(%rbp)
cmpl $0x0, -0x14(%rbp)
jge 0x1d93
movq -0x10(%rbp), %rdi
callq 0x4a70
movq -0x20(%rbp), %rdi
addq $0x180, %rdi            # imm = 0x180
movq -0x20(%rbp), %rax
movq (%rax), %rsi
addq $0x8, %rsi
callq 0x1ec0
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1eab
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
movslq -0x14(%rbp), %rdx
leaq 0x52bd(%rip), %rsi      # 0x7063
callq 0x1ef0
cmpq $0x0, %rax
jne 0x1dbd
movl $0x0, -0x4(%rbp)
jmp 0x1eab
movq -0x10(%rbp), %rdi
callq 0x4a70
movq -0x20(%rbp), %rdi
addq $0x8, %rdi
movq -0x20(%rbp), %rdx
movl $0x1, %esi
leaq 0x1a2(%rip), %rcx       # 0x1f80
callq 0x49c0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x1df0
jmp 0x1e0f
leaq 0x538f(%rip), %rdi      # 0x7186
leaq 0x5292(%rip), %rsi      # 0x7090
movl $0xb6, %edx
leaq 0x5383(%rip), %rcx      # 0x718d
callq 0x10d0
movq -0x28(%rbp), %rax
addq $0x28, %rax
movq %rax, -0x180(%rbp)
leaq -0x178(%rbp), %rdi
xorl %esi, %esi
movl $0x148, %edx            # imm = 0x148
callq 0x10e0
movq 0x92f8(%rip), %rax      # 0xb130
movq %rax, -0x178(%rbp)
movq 0x92ea(%rip), %rdi      # 0xb130
callq 0x1090
movq -0x180(%rbp), %rdi
movq %rax, -0x170(%rbp)
movq $0x1, -0x58(%rbp)
leaq -0x178(%rbp), %rsi
movl $0x148, %edx            # imm = 0x148
callq 0x1180
movq -0x28(%rbp), %rdi
callq 0x4500
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
jne 0x1e86
jmp 0x1ea5
leaq 0x52f1(%rip), %rdi      # 0x717e
leaq 0x51fc(%rip), %rsi      # 0x7090
movl $0xc0, %edx
leaq 0x52ed(%rip), %rcx      # 0x718d
callq 0x10d0
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x180, %rsp            # imm = 0x180
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/rouming[P]io/http-server.c
// Function: strnstr
static inline char *strnstr(const char *s1, const char *s2, size_t len)
{
	size_t l2;

	l2 = strlen(s2);
	if (!l2)
		return (char *)s1;
	while (len >= l2) {
		len--;
		if (!memcmp(s1, s2, l2))
			return (char *)s1;
		s1++;
	}
	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x18(%rbp), %rdi
callq 0x1090
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x1f22
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1f70
jmp 0x1f24
movq -0x20(%rbp), %rax
cmpq -0x28(%rbp), %rax
jb 0x1f68
movq -0x20(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x1140
cmpl $0x0, %eax
jne 0x1f5a
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1f70
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x1f24
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/rouming[P]io/http-server.c
// Function: on_write__to_client
static int on_write__to_client(struct io_req *req, int len)
{
	struct connection *conn = req->data;
	int rc;

	io_req_put(req);
	if (len < 0) {
		list_add_tail(&conn->dead_entry, &conn->ctx->dead_conns);
	} else {
		req = io_req_create(&conn->cli_q, REQ_RD, conn,
				    on_read__from_client);
		assert(req);

		req->buf = (struct io_buf){
			.iov_num  = 1,
			.is_vari_len = true
		};
		rc = io_queue_submit(req);
		assert(rc == 0);
	}

	return len;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x170, %rsp            # imm = 0x170
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
callq 0x4a70
cmpl $0x0, -0xc(%rbp)
jge 0x1fcd
movq -0x18(%rbp), %rdi
addq $0x180, %rdi            # imm = 0x180
movq -0x18(%rbp), %rax
movq (%rax), %rsi
addq $0x8, %rsi
callq 0x1ec0
jmp 0x208e
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
movq -0x18(%rbp), %rdx
xorl %esi, %esi
leaq -0x2a2(%rip), %rcx      # 0x1d40
callq 0x49c0
movq %rax, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x1ff4
jmp 0x2013
leaq 0x525a(%rip), %rdi      # 0x7255
leaq 0x508e(%rip), %rsi      # 0x7090
movl $0x8f, %edx
leaq 0x51ae(%rip), %rcx      # 0x71bc
callq 0x10d0
movq -0x8(%rbp), %rax
addq $0x28, %rax
movq %rax, -0x170(%rbp)
leaq -0x168(%rbp), %rdi
xorl %esi, %esi
movl $0x148, %edx            # imm = 0x148
callq 0x10e0
movq -0x170(%rbp), %rdi
movq $0x1, -0x48(%rbp)
movb $0x1, -0x40(%rbp)
leaq -0x168(%rbp), %rsi
movl $0x148, %edx            # imm = 0x148
callq 0x1180
movq -0x8(%rbp), %rdi
callq 0x4500
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jne 0x206d
jmp 0x208c
leaq 0x510a(%rip), %rdi      # 0x717e
leaq 0x5015(%rip), %rsi      # 0x7090
movl $0x96, %edx
leaq 0x5135(%rip), %rcx      # 0x71bc
callq 0x10d0
jmp 0x208e
movl -0xc(%rbp), %eax
addq $0x170, %rsp            # imm = 0x170
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jkbenaim[P]psfrag/psfrag.c
// Function: cmd_scan
char *cmd_scan(int argc, char **argv)
{
	__label__ out_return;
	struct MappedFile_s m;
	char *msg = NULL;
	int rc;

	if (argc < 3) {
		msg = "must specify a pokemon stadium rom";
		goto out_return;
	}

	rc = DB_Init(&db, ":memory:");
	if (rc != SQLITE_OK) {
		msg = "DB_Init oopsed";
		goto out_return;
	}

	m = MappedFile_Open(argv[2], false);
	if (m.data == NULL) {
		msg = "couldn't open rom";
		goto out_dbclose;
	}

	if (m.size < (1048576 + 4096)) {
		msg = "rom too small";
		goto out_unmap;
	}

	rc = DB_FragSearch(db, m.data, m.size);
	if (rc != SQLITE_OK) {
		msg = "DB_FragSearch oopsed";
		goto out_unmap;
	}

	dump_frags();

out_unmap:
	MappedFile_Close(m);
out_dbclose:
	DB_Close(db);
out_return:
	if (msg) {
		return msg;
	} else {
		return NULL;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movl %edi, -0xc(%rbp)
movq %rsi, -0x18(%rbp)
movq $0x0, -0x38(%rbp)
cmpl $0x3, -0xc(%rbp)
jge 0x849d
leaq 0xadf0d(%rip), %rax     # 0xb63a1
movq %rax, -0x38(%rbp)
jmp 0x857c
leaq 0xd4e74(%rip), %rdi     # 0xdd318
leaq 0xadf19(%rip), %rsi     # 0xb63c4
callq 0x9aa0
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
je 0x84c9
leaq 0xadf0d(%rip), %rax     # 0xb63cd
movq %rax, -0x38(%rbp)
jmp 0x857c
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rsi
leaq -0x58(%rbp), %rdi
xorl %edx, %edx
callq 0xa410
movq -0x58(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x8508
leaq 0xadeda(%rip), %rax     # 0xb63dc
movq %rax, -0x38(%rbp)
jmp 0x8570
cmpq $0x101000, -0x28(%rbp)  # imm = 0x101000
jae 0x851f
leaq 0xaded5(%rip), %rax     # 0xb63ee
movq %rax, -0x38(%rbp)
jmp 0x854e
movq 0xd4df2(%rip), %rdi     # 0xdd318
movq -0x30(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0xa020
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
je 0x8549
leaq 0xadeb9(%rip), %rax     # 0xb63fc
movq %rax, -0x38(%rbp)
jmp 0x854e
callq 0x9390
leaq -0x30(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0xa510
movq 0xd4da1(%rip), %rdi     # 0xdd318
callq 0x9b20
cmpq $0x0, -0x38(%rbp)
je 0x858d
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x8595
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/jkbenaim[P]psfrag/psfrag.c
// Function: cmd_mkdb
char *cmd_mkdb(int argc, char **argv)
{
	__label__ out_return, out_dbclose, out_unmap;
	struct MappedFile_s m;
	char *msg = NULL;
	int rc;

	switch (argc) {
	case 0 ... 2:
		msg = "must specify a Pokemon Stadium rom";
		goto out_return;
		break;
	case 3:
		msg = "must specify a database filename";
		goto out_return;
		break;
	default:
		break;
	}

	rc = DB_Init(&db, argv[3]);
	if (rc != SQLITE_OK) {
		msg = "DB_Init oopsed";
		goto out_return;
	}

	m = MappedFile_Open(argv[2], false);
	if (m.data == NULL) {
		msg = "couldn't open rom";
		goto out_dbclose;
	}

	if (m.size < (1048576 + 4096)) {
		msg = "rom too small";
		goto out_unmap;
	}

	rc = DB_FragSearch(db, m.data, m.size);
	if (rc != SQLITE_OK) {
		msg = "DB_FragSearch oopsed";
		goto out_unmap;
	}

	goto out_unmap;

out_unmap:
	MappedFile_Close(m);
out_dbclose:
	DB_Close(db);
out_return:
	if (msg) {
		return msg;
	} else {
		return NULL;
	}

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movl %edi, -0xc(%rbp)
movq %rsi, -0x18(%rbp)
movq $0x0, -0x38(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x5c(%rbp)
subl $0x3, %eax
jb 0x8e71
jmp 0x8e67
movl -0x5c(%rbp), %eax
subl $0x3, %eax
je 0x8e81
jmp 0x8e91
leaq 0xad599(%rip), %rax     # 0xb6411
movq %rax, -0x38(%rbp)
jmp 0x8f70
leaq 0xad5ac(%rip), %rax     # 0xb6434
movq %rax, -0x38(%rbp)
jmp 0x8f70
jmp 0x8e93
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rsi
leaq 0xd4476(%rip), %rdi     # 0xdd318
callq 0x9aa0
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
je 0x8ec0
leaq 0xad516(%rip), %rax     # 0xb63cd
movq %rax, -0x38(%rbp)
jmp 0x8f70
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rsi
leaq -0x58(%rbp), %rdi
xorl %edx, %edx
callq 0xa410
movq -0x58(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x8eff
leaq 0xad4e3(%rip), %rax     # 0xb63dc
movq %rax, -0x38(%rbp)
jmp 0x8f64
cmpq $0x101000, -0x28(%rbp)  # imm = 0x101000
jae 0x8f16
leaq 0xad4de(%rip), %rax     # 0xb63ee
movq %rax, -0x38(%rbp)
jmp 0x8f42
movq 0xd43fb(%rip), %rdi     # 0xdd318
movq -0x30(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0xa020
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
je 0x8f40
leaq 0xad4c2(%rip), %rax     # 0xb63fc
movq %rax, -0x38(%rbp)
jmp 0x8f42
jmp 0x8f42
leaq -0x30(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0xa510
movq 0xd43ad(%rip), %rdi     # 0xdd318
callq 0x9b20
cmpq $0x0, -0x38(%rbp)
je 0x8f81
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x8f89
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jkbenaim[P]psfrag/psfrag.c
// Function: get_cmd_from_name
struct cmd_s *get_cmd_from_name(char *needle)
{
	int cmds_index = 0;
	while (cmds[cmds_index].command) {
		if (!strcmp(cmds[cmds_index].command, needle))
			return &cmds[cmds_index];
		cmds_index++;
	}
	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movslq -0x14(%rbp), %rcx
leaq 0xd1f52(%rip), %rax     # 0xdb1d0
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpq $0x0, (%rax)
je 0x92d1
movslq -0x14(%rbp), %rcx
leaq 0xd1f3a(%rip), %rax     # 0xdb1d0
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0x8190
cmpl $0x0, %eax
jne 0x92c6
movslq -0x14(%rbp), %rcx
leaq 0xd1f17(%rip), %rax     # 0xdb1d0
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x8(%rbp)
jmp 0x92d9
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x9273
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jkbenaim[P]psfrag/psfrag.c
// Function: print_usage
void print_usage()
{
	fprintf(stderr, PROGRAM_NAME " version " VERSION_STRING
			", Copyright (C) 2019 jrra.\n"
			"A utility for code fragments in the Pokemon Stadium games.\n\n"
			"usage: " PROGRAM_NAME " <cmd>\n\n"
			"Commands:\n"
		);
	int cmds_index = 0;
	while (cmds[cmds_index].command) {
		fprintf(stderr, "\t%s\n", cmds[cmds_index].help);
		cmds_index++;
	}
	fprintf(stderr, "\nReport bugs to " URL_STRING "\n");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq 0xd1cf1(%rip), %rax     # 0xdaff0
movq (%rax), %rdi
leaq 0xace84(%rip), %rsi     # 0xb618d
movb $0x0, %al
callq 0x81b0
movl $0x0, -0x4(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0xd1eae(%rip), %rax     # 0xdb1d0
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpq $0x0, (%rax)
je 0x9368
movq 0xd1cba(%rip), %rax     # 0xdaff0
movq (%rax), %rdi
movslq -0x4(%rbp), %rcx
leaq 0xd1e8c(%rip), %rax     # 0xdb1d0
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdx
leaq 0xacec0(%rip), %rsi     # 0xb6216
movb $0x0, %al
callq 0x81b0
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x9317
movq 0xd1c81(%rip), %rax     # 0xdaff0
movq (%rax), %rdi
leaq 0xacea2(%rip), %rsi     # 0xb621b
movb $0x0, %al
callq 0x81b0
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jkbenaim[P]psfrag/psfrag.c
// Function: main
int main(int argc, char **argv)
{
	__label__ out_return;
	char *msg = NULL;
	char *cmd_string = NULL;

	if (argc < 2) {
		print_usage();
		goto out_return;
	}

	cmd_string = argv[1];

	struct cmd_s *cmd = get_cmd_from_name(cmd_string);
	if (cmd != NULL) {
		if (cmd->handler)
			msg = cmd->handler(argc, argv);
		else
			msg = "command has no handler";
	} else {
		msg = "invalid command";
	}

out_return:
	if (msg) {
		fprintf(stderr, "%s: error: %s\n", argv[0], msg);
		return EXIT_FAILURE;
	} else {
		return EXIT_SUCCESS;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
cmpl $0x2, -0x8(%rbp)
jge 0x99f3
callq 0x92f0
jmp 0x9a4f
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x9260
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x9a42
movq -0x28(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x9a35
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
callq *%rax
movq %rax, -0x18(%rbp)
jmp 0x9a40
leaq 0xace11(%rip), %rax     # 0xb684d
movq %rax, -0x18(%rbp)
jmp 0x9a4d
leaq 0xace1b(%rip), %rax     # 0xb6864
movq %rax, -0x18(%rbp)
jmp 0x9a4f
cmpq $0x0, -0x18(%rbp)
je 0x9a82
movq 0xd1593(%rip), %rax     # 0xdaff0
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
movq -0x18(%rbp), %rcx
leaq 0xace02(%rip), %rsi     # 0xb6874
movb $0x0, %al
callq 0x81b0
movl $0x1, -0x4(%rbp)
jmp 0x9a89
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jkbenaim[P]psfrag/db.c
// Function: DB_Init
int DB_Init(sqlite3 **db, char *filename) {
	int rc = SQLITE_OK;
	rc = sqlite3_open(filename, db);
	if (rc != SQLITE_OK) return rc;

	rc = sqlite3_exec(*db,
		"CREATE TABLE IF NOT EXISTS frags(pcode text, addr int, num int, entrypoint int, offset_code int, offset_relocs int, romsize int, ramsize int, vma int);",
		NULL, NULL, NULL
	);
	if (rc != SQLITE_OK) return rc;
	return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x1e0f0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x9ad5
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x9b0b
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0xacda0(%rip), %rsi     # 0xb6883
xorl %eax, %eax
movl %eax, %r8d
movq %r8, %rdx
movq %r8, %rcx
callq 0x18400
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x9b04
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x9b0b
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jkbenaim[P]psfrag/db.c
// Function: DB_GetRomSizeForNum
int DB_GetRomSizeForNum(sqlite3 *db, int num)
{
	__label__ out_finalize;
	char *zErr = NULL;
	int rc = SQLITE_OK;
	int size = -1;

	sqlite3_stmt *stmt;

	rc = sqlite3_prepare_v2(
		db,
		R"STATEMENT(
			select romsize from frags where num==:num limit 1;
		)STATEMENT",
		-1,
		&stmt,
		NULL
	);
	if (rc != SQLITE_OK) {
		zErr = "error in prepare";
		goto out_finalize;
	}

	rc = sqlite3_bind_int(stmt, 1, num);
	if (rc != SQLITE_OK) {
		zErr = "error in bind";
		goto out_finalize;
	}

	rc = sqlite3_step(stmt);
	switch(rc) {
	case SQLITE_DONE:
		size = -1;
		break;
	case SQLITE_ROW:
		size = sqlite3_column_int(stmt, 0);
		break;
	default:
		zErr = "error in step";
		break;
	}

out_finalize:
	if (zErr) fprintf(stderr, "DB_GetRomSizeForNum: %s\n", zErr);
	rc = sqlite3_finalize(stmt);
	if (rc != SQLITE_OK) fprintf(stderr,
		"DB_GetRomSizeForNum: error in finalize\n");
	return size;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0xffffffff, -0x20(%rbp) # imm = 0xFFFFFFFF
movq -0x8(%rbp), %rdi
leaq 0xacc6a(%rip), %rsi     # 0xb6a7a
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
leaq -0x28(%rbp), %rcx
xorl %eax, %eax
movl %eax, %r8d
callq 0x18820
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x9e39
leaq 0xacc26(%rip), %rax     # 0xb6a59
movq %rax, -0x18(%rbp)
jmp 0x9ea9
movq -0x28(%rbp), %rdi
movl -0xc(%rbp), %edx
movl $0x1, %esi
callq 0x15330
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x9e60
leaq 0xac9d5(%rip), %rax     # 0xb682f
movq %rax, -0x18(%rbp)
jmp 0x9ea9
movq -0x28(%rbp), %rdi
callq 0x14020
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x2c(%rbp)
subl $0x64, %eax
je 0x9e8c
jmp 0x9e79
movl -0x2c(%rbp), %eax
subl $0x65, %eax
jne 0x9e9c
jmp 0x9e83
movl $0xffffffff, -0x20(%rbp) # imm = 0xFFFFFFFF
jmp 0x9ea7
movq -0x28(%rbp), %rdi
xorl %esi, %esi
callq 0x14bf0
movl %eax, -0x20(%rbp)
jmp 0x9ea7
leaq 0xacba8(%rip), %rax     # 0xb6a4b
movq %rax, -0x18(%rbp)
jmp 0x9ea9
cmpq $0x0, -0x18(%rbp)
je 0x9ecc
movq 0xd1139(%rip), %rax     # 0xdaff0
movq (%rax), %rdi
movq -0x18(%rbp), %rdx
leaq 0xacbef(%rip), %rsi     # 0xb6ab4
movb $0x0, %al
callq 0x81b0
movq -0x28(%rbp), %rdi
callq 0x12580
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x9ef6
movq 0xd110b(%rip), %rax     # 0xdaff0
movq (%rax), %rdi
leaq 0xacbde(%rip), %rsi     # 0xb6acd
movb $0x0, %al
callq 0x81b0
movl -0x20(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/jkbenaim[P]psfrag/db.c
// Function: DB_GetAddrForNum
int DB_GetAddrForNum(sqlite3 *db, int num)
{
	__label__ out_finalize;
	char *zErr = NULL;
	int rc = SQLITE_OK;
	int addr = -1;

	sqlite3_stmt *stmt;

	rc = sqlite3_prepare_v2(
		db,
		R"STATEMENT(
			select addr from frags where num==:num limit 1;
		)STATEMENT",
		-1,
		&stmt,
		NULL
	);
	if (rc != SQLITE_OK) {
		zErr = "error in prepare";
		goto out_finalize;
	}

	rc = sqlite3_bind_int(stmt, 1, num);
	if (rc != SQLITE_OK) {
		zErr = "error in bind";
		goto out_finalize;
	}

	rc = sqlite3_step(stmt);
	switch(rc) {
	case SQLITE_DONE:
		addr = -1;
		break;
	case SQLITE_ROW:
		addr = sqlite3_column_int(stmt, 0);
		break;
	default:
		zErr = "error in step";
		break;
	}

out_finalize:
	if (zErr) fprintf(stderr, "DB_GetAddrForNum: %s\n", zErr);
	rc = sqlite3_finalize(stmt);
	if (rc != SQLITE_OK) fprintf(stderr,
		"DB_GetAddrForNum: error in finalize\n");
	return addr;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0xffffffff, -0x20(%rbp) # imm = 0xFFFFFFFF
movq -0x8(%rbp), %rdi
leaq 0xacbc5(%rip), %rsi     # 0xb6af5
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
leaq -0x28(%rbp), %rcx
xorl %eax, %eax
movl %eax, %r8d
callq 0x18820
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x9f59
leaq 0xacb06(%rip), %rax     # 0xb6a59
movq %rax, -0x18(%rbp)
jmp 0x9fc9
movq -0x28(%rbp), %rdi
movl -0xc(%rbp), %edx
movl $0x1, %esi
callq 0x15330
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x9f80
leaq 0xac8b5(%rip), %rax     # 0xb682f
movq %rax, -0x18(%rbp)
jmp 0x9fc9
movq -0x28(%rbp), %rdi
callq 0x14020
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x2c(%rbp)
subl $0x64, %eax
je 0x9fac
jmp 0x9f99
movl -0x2c(%rbp), %eax
subl $0x65, %eax
jne 0x9fbc
jmp 0x9fa3
movl $0xffffffff, -0x20(%rbp) # imm = 0xFFFFFFFF
jmp 0x9fc7
movq -0x28(%rbp), %rdi
xorl %esi, %esi
callq 0x14bf0
movl %eax, -0x20(%rbp)
jmp 0x9fc7
leaq 0xaca88(%rip), %rax     # 0xb6a4b
movq %rax, -0x18(%rbp)
jmp 0x9fc9
cmpq $0x0, -0x18(%rbp)
je 0x9fec
movq 0xd1019(%rip), %rax     # 0xdaff0
movq (%rax), %rdi
movq -0x18(%rbp), %rdx
leaq 0xacb47(%rip), %rsi     # 0xb6b2c
movb $0x0, %al
callq 0x81b0
movq -0x28(%rbp), %rdi
callq 0x12580
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0xa016
movq 0xd0feb(%rip), %rax     # 0xdaff0
movq (%rax), %rdi
leaq 0xacb33(%rip), %rsi     # 0xb6b42
movb $0x0, %al
callq 0x81b0
movl -0x20(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/jkbenaim[P]psfrag/db.c
// Function: DB_FragSearch
int DB_FragSearch(sqlite3 *db, uint8_t *data, ssize_t size)
{
	int rc = SQLITE_OK;
	char pcode[6] = {0};
	get_pcode(pcode, data);
	DB_Begin(db);
	for (ssize_t i = 0; i < (size - 15); i += 16) {
		struct fragment_s *frag = (struct fragment_s *)(data + i);
		if (!isfrag(frag)) continue;
		rc = DB_AddFrag(
			db,
			pcode,
			i,
			get_frag_num(frag),
			get_entrypoint(frag),
			ntohl(frag->offset_code),
			ntohl(frag->offset_relocs),
			ntohl(frag->romsize),
			ntohl(frag->ramsize),
			get_vma(frag)
		);
		if (rc != SQLITE_OK) {
			break;
		}
	}
	DB_End(db);
	return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x98, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
leaq -0x2a(%rbp), %rdi
xorl %esi, %esi
movl $0x6, %edx
callq 0x8130
leaq -0x2a(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xa540
movq -0x10(%rbp), %rdi
callq 0x9b50
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq -0x20(%rbp), %rcx
subq $0xf, %rcx
cmpq %rcx, %rax
jge 0xa17d
movq -0x18(%rbp), %rax
addq -0x38(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
callq 0xa2b0
testb $0x1, %al
jne 0xa0a0
jmp 0xa16c
movq -0x10(%rbp), %rax
movq %rax, -0x80(%rbp)
leaq -0x2a(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x40(%rbp), %rdi
callq 0xa1a0
cltq
movq %rax, -0x68(%rbp)
movq -0x40(%rbp), %rdi
callq 0xa250
movl %eax, %eax
movq %rax, -0x60(%rbp)
movq -0x40(%rbp), %rax
movl 0x10(%rax), %edi
callq 0x8300
movl %eax, %eax
movq %rax, -0x58(%rbp)
movq -0x40(%rbp), %rax
movl 0x14(%rax), %edi
callq 0x8300
movl %eax, %eax
movl %eax, %ebx
movq -0x40(%rbp), %rax
movl 0x18(%rax), %edi
callq 0x8300
movl %eax, %eax
movq %rax, -0x50(%rbp)
movq -0x40(%rbp), %rax
movl 0x1c(%rax), %edi
callq 0x8300
movl %eax, %eax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rdi
callq 0xa290
movq -0x80(%rbp), %rdi
movq -0x78(%rbp), %rsi
movq -0x70(%rbp), %rdx
movq -0x68(%rbp), %rcx
movq -0x60(%rbp), %r8
movq -0x58(%rbp), %r9
movq -0x50(%rbp), %r11
movq -0x48(%rbp), %r10
movl %eax, %eax
movq %rbx, (%rsp)
movq %r11, 0x8(%rsp)
movq %r10, 0x10(%rsp)
movq %rax, 0x18(%rsp)
callq 0x9bb0
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0xa16a
jmp 0xa17d
jmp 0xa16c
movq -0x38(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x38(%rbp)
jmp 0xa06d
movq -0x10(%rbp), %rdi
callq 0x9b80
movl -0x24(%rbp), %eax
addq $0x98, %rsp
popq %rbx
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jkbenaim[P]psfrag/fragment.c
// Function: get_frag_num
int32_t get_frag_num(struct fragment_s *frag)
{
	uint32_t ep1 = ntohl(frag->entrypoint1);
	unsigned opcode = (ep1 & 0xfc000000) >> (32-6);
	uint32_t address = (ep1 & 0x03ffffff) << 2;
	if (opcode != 2) return -1;
	int fragnum = ((address >> 20) & 0xff) - 0x10;
	return fragnum;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %edi
callq 0x8300
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
andl $0xfc000000, %eax       # imm = 0xFC000000
shrl $0x1a, %eax
movl %eax, -0x18(%rbp)
movl -0x14(%rbp), %eax
andl $0x3ffffff, %eax        # imm = 0x3FFFFFF
shll $0x2, %eax
movl %eax, -0x1c(%rbp)
cmpl $0x2, -0x18(%rbp)
je 0xa1e5
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa1fc
movl -0x1c(%rbp), %eax
shrl $0x14, %eax
andl $0xff, %eax
subl $0x10, %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jkbenaim[P]psfrag/fragment.c
// Function: get_entrypoint_offset
uint32_t get_entrypoint_offset(struct fragment_s *frag)
{
	uint32_t ep1 = ntohl(frag->entrypoint1);
	uint32_t address = (ep1 & 0x03ffffff) << 2;
	address &= 0x000fffff;
	return address;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %edi
callq 0x8300
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
andl $0x3ffffff, %eax        # imm = 0x3FFFFFF
shll $0x2, %eax
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %eax
andl $0xfffff, %eax          # imm = 0xFFFFF
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jkbenaim[P]psfrag/fragment.c
// Function: get_entrypoint
uint32_t get_entrypoint(struct fragment_s *frag)
{
	uint32_t ep1 = ntohl(frag->entrypoint1);
	uint32_t address = (ep1 & 0x03ffffff) << 2;
	address |= 0x80000000;
	return address;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %edi
callq 0x8300
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
andl $0x3ffffff, %eax        # imm = 0x3FFFFFF
shll $0x2, %eax
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %eax
orl $0x80000000, %eax       # imm = 0x80000000
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)