LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/sgsfak[P]c-ocgeo/src/ocgeo.c
// Function: str_to_maybe_int
static
int str_to_maybe_int(sds s)
{
    int k = 0;
    int len = sdslen(s);
    for (int i=0; i<len; ++i) {
        char c = s[i];
        k += 10*k;
        switch(c) {
        case '0': break;
        case '1': k += 1; break;
        case '2': k += 2; break;
        case '3': k += 3; break;
        case '4': k += 4; break;
        case '5': k += 5; break;
        case '6': k += 6; break;
        case '7': k += 7; break;
        case '8': k += 8; break;
        case '9': k += 9; break;
        default:
            return -1;
        }
    }
    return k;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movq -0x10(%rbp), %rdi
callq 0x20d0
movl %eax, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x3854
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movb (%rax,%rcx), %al
movb %al, -0x1d(%rbp)
movl -0x14(%rbp), %ecx
movl %ecx, %eax
leal (%rax,%rax,4), %edx
movl %edx, %ecx
leal (%rax,%rcx,2), %eax
movl %eax, -0x14(%rbp)
movsbl -0x1d(%rbp), %eax
addl $-0x30, %eax
movl %eax, %ecx
movq %rcx, -0x28(%rbp)
subl $0x9, %eax
ja 0x383b
movq -0x28(%rbp), %rax
leaq 0x7cf3(%rip), %rcx      # 0xb4c0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
jmp 0x3844
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x3844
movl -0x14(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x14(%rbp)
jmp 0x3844
movl -0x14(%rbp), %eax
addl $0x3, %eax
movl %eax, -0x14(%rbp)
jmp 0x3844
movl -0x14(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x14(%rbp)
jmp 0x3844
movl -0x14(%rbp), %eax
addl $0x5, %eax
movl %eax, -0x14(%rbp)
jmp 0x3844
movl -0x14(%rbp), %eax
addl $0x6, %eax
movl %eax, -0x14(%rbp)
jmp 0x3844
movl -0x14(%rbp), %eax
addl $0x7, %eax
movl %eax, -0x14(%rbp)
jmp 0x3844
movl -0x14(%rbp), %eax
addl $0x8, %eax
movl %eax, -0x14(%rbp)
jmp 0x3844
movl -0x14(%rbp), %eax
addl $0x9, %eax
movl %eax, -0x14(%rbp)
jmp 0x3844
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x385a
jmp 0x3846
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x3786
movl -0x14(%rbp), %eax
movl %eax, -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/stv0g[P]c11-queues/mpmc_test_fib.c
// Function: producer
int producer(void *ctx)
{
	//printf("producer\n"); //DELETEME
	struct mpmc_queue *q = (struct mpmc_queue *) ctx;
	
	srand((unsigned) time(0) + thread_get_id());
	size_t pause = rand() % 1000;

	/* Wait for global start signal */
	while (g_start == 0)
		thrd_yield();
	
		/* Wait for a random time */
	for (size_t i = 0; i != pause; i += 1)
		nop();
	
	/* Enqueue */
	for (unsigned long count = 0, n1 = 0, n2 = 1; count < N; count++) {
		fibs[count] = n1 + n2;
		
		void *fibptr = (void *) &fibs[count];
		
		if (!mpmc_queue_push(q, fibptr)) {
			printf("Queue push failed at count %lu\n", count);
			return -1;
		}
		
		n1 = n2; n2 = fibs[count];
	}
	
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
xorl %eax, %eax
movl %eax, %edi
callq 0x1080
movl %eax, %eax
movq %rax, -0x50(%rbp)
callq 0x11f0
movq %rax, %rcx
movq -0x50(%rbp), %rax
addq %rcx, %rax
movl %eax, %edi
callq 0x1070
callq 0x10e0
movl $0x3e8, %ecx            # imm = 0x3E8
cltd
idivl %ecx
movslq %edx, %rax
movq %rax, -0x20(%rbp)
movl 0x2e4d(%rip), %eax      # 0x40a0
cmpl $0x0, %eax
jne 0x125f
callq 0x1340
jmp 0x124d
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x20(%rbp), %rax
je 0x1281
pause
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x1267
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x1, -0x40(%rbp)
cmpq $0x1312d00, -0x30(%rbp) # imm = 0x1312D00
jae 0x132e
movq -0x38(%rbp), %rax
addq -0x40(%rbp), %rax
movl %eax, %edx
movq -0x30(%rbp), %rcx
leaq 0x2df4(%rip), %rax      # 0x40b0
movl %edx, (%rax,%rcx,4)
movq -0x30(%rbp), %rcx
leaq 0x2de6(%rip), %rax      # 0x40b0
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x18a0
cmpl $0x0, %eax
jne 0x1302
movq -0x30(%rbp), %rsi
leaq 0xd12(%rip), %rdi       # 0x2004
movb $0x0, %al
callq 0x1050
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1335
movq -0x40(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rcx
leaq 0x2d9b(%rip), %rax      # 0x40b0
movslq (%rax,%rcx,4), %rax
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x1299
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/stv0g[P]c11-queues/mpmc_test_fib.c
// Function: consumer
int consumer(void *ctx)
{
	//printf("consumer\n"); 	//DELETEME
	struct mpmc_queue *q = (struct mpmc_queue *) ctx;
	
	srand((unsigned) time(0) + thread_get_id());
	size_t pause = rand() % 1000;

	/* Wait for global start signal */
	while (g_start == 0)
		thrd_yield();
	
	/* Wait for a random time */
	for (size_t i = 0; i != pause; i += 1)
		nop();
	
	/* Dequeue */
	for (unsigned long count = 0, n1 = 0, n2 = 1; count < N; count++) {
		int fib = n1 + n2;
		int *pulled;
		
		while (!mpmc_queue_pull(q, (void **) &pulled)) {
			//printf("Queue empty: %d\n", temp);
			//return -1;
		}
		
		if (*pulled != fib) {
			printf("Pulled != fib\n");
			return -1;
		}		
		
		n1 = n2; n2 = fib;
	}
	
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
xorl %eax, %eax
movl %eax, %edi
callq 0x1080
movl %eax, %eax
movq %rax, -0x58(%rbp)
callq 0x11f0
movq %rax, %rcx
movq -0x58(%rbp), %rax
addq %rcx, %rax
movl %eax, %edi
callq 0x1070
callq 0x10e0
movl $0x3e8, %ecx            # imm = 0x3E8
cltd
idivl %ecx
movslq %edx, %rax
movq %rax, -0x20(%rbp)
movl 0x2cfd(%rip), %eax      # 0x40a0
cmpl $0x0, %eax
jne 0x13af
callq 0x1340
jmp 0x139d
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x20(%rbp), %rax
je 0x13d1
pause
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x13b7
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x1, -0x40(%rbp)
cmpq $0x1312d00, -0x30(%rbp) # imm = 0x1312D00
jae 0x145b
movq -0x38(%rbp), %rax
addq -0x40(%rbp), %rax
movl %eax, -0x44(%rbp)
movq -0x18(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x19b0
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x1419
jmp 0x141b
jmp 0x13fe
movq -0x50(%rbp), %rax
movl (%rax), %eax
cmpl -0x44(%rbp), %eax
je 0x143d
leaq 0xbf7(%rip), %rdi       # 0x2024
movb $0x0, %al
callq 0x1050
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1462
movq -0x40(%rbp), %rax
movq %rax, -0x38(%rbp)
movslq -0x44(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x13e9
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/stv0g[P]c11-queues/mpmc_test_fib.c
// Function: test_single_threaded
int test_single_threaded(struct mpmc_queue *q)
{
	int resp, resc;
	g_start = 1;
	
	resp = producer(q);
	if (resp)
		printf("Enqueuing failed\n");
	
	resc = consumer(q);
	if (resc)
		printf("Consumer failed\n");
	
	if (resc || resp)
		printf("Single Thread Test Failed\n");
	else
		printf("Single Thread Test Complete\n");
	
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl $0x1, 0x2c1a(%rip)      # 0x40a0
movq -0x8(%rbp), %rdi
callq 0x1200
movl %eax, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
je 0x14a6
leaq 0xb94(%rip), %rdi       # 0x2033
movb $0x0, %al
callq 0x1050
movq -0x8(%rbp), %rdi
callq 0x1350
movl %eax, -0x10(%rbp)
cmpl $0x0, -0x10(%rbp)
je 0x14c6
leaq 0xb86(%rip), %rdi       # 0x2045
movb $0x0, %al
callq 0x1050
cmpl $0x0, -0x10(%rbp)
jne 0x14d2
cmpl $0x0, -0xc(%rbp)
je 0x14e2
leaq 0xb7d(%rip), %rdi       # 0x2056
movb $0x0, %al
callq 0x1050
jmp 0x14f0
leaq 0xb88(%rip), %rdi       # 0x2071
movb $0x0, %al
callq 0x1050
xorl %eax, %eax
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/stv0g[P]c11-queues/mpmc_test_fib.c
// Function: test_multi_threaded
int test_multi_threaded(struct mpmc_queue *q)
{
	thrd_t thrp, thrc;
	int resp, resc;
	
	g_start = 0;
	
	thrd_create(&thrp, consumer, q);	/** @todo Why producer thread runs earlier? */
	thrd_create(&thrc, producer, q);
	
	sleep(1);

	uint64_t start_tsc_time, end_tsc_time;

	start_tsc_time = rdtscp();
	g_start = 1;

	thrd_join(thrp, &resp);
	thrd_join(thrc, &resc);
	
	end_tsc_time = rdtscp();

	if (resc || resp)
		printf("Queue Test failed\n");
	else
		printf("Two-thread Test Complete\n");
	
	printf("cycles/op for rdtsc %lu\n", (end_tsc_time - start_tsc_time)/N);

	size_t used = mpmc_queue_available(q);
	if (used > 0)
		printf("%zu slots in use? There is something wrong with the test\n", used);
	
	int ret = mpmc_queue_destroy(q);
	if (ret)
		printf("Failed to destroy queue: %d\n", ret);
	
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x18(%rbp)
movl $0x0, 0x2b8a(%rip)      # 0x40a0
movq -0x18(%rbp), %rdx
leaq -0x20(%rbp), %rdi
leaq -0x1d5(%rip), %rsi      # 0x1350
callq 0x1640
movq -0x18(%rbp), %rdx
leaq -0x28(%rbp), %rdi
leaq -0x339(%rip), %rsi      # 0x1200
callq 0x1640
movl $0x1, %edi
callq 0x10d0
rdtsc
shlq $0x20, %rdx
orq %rdx, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movl $0x1, 0x2b39(%rip)      # 0x40a0
movq -0x20(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
callq 0x1680
movq -0x28(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x1680
rdtsc
shlq $0x20, %rdx
orq %rdx, %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
cmpl $0x0, -0x30(%rbp)
jne 0x15a2
cmpl $0x0, -0x2c(%rbp)
je 0x15b2
leaq 0xae5(%rip), %rdi       # 0x208e
movb $0x0, %al
callq 0x1050
jmp 0x15c0
leaq 0xae8(%rip), %rdi       # 0x20a1
movb $0x0, %al
callq 0x1050
movq -0x40(%rbp), %rax
subq -0x38(%rbp), %rax
movl $0x1312d00, %ecx        # imm = 0x1312D00
xorl %edx, %edx
divq %rcx
movq %rax, %rsi
leaq 0xadf(%rip), %rdi       # 0x20bb
movb $0x0, %al
callq 0x1050
movq -0x18(%rbp), %rdi
callq 0x1870
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jbe 0x1609
movq -0x48(%rbp), %rsi
leaq 0xad2(%rip), %rdi       # 0x20d4
movb $0x0, %al
callq 0x1050
movq -0x18(%rbp), %rdi
callq 0x1830
movl %eax, -0x4c(%rbp)
cmpl $0x0, -0x4c(%rbp)
je 0x162c
movl -0x4c(%rbp), %esi
leaq 0xae9(%rip), %rdi       # 0x210e
movb $0x0, %al
callq 0x1050
xorl %eax, %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/stv0g[P]c11-queues/mpmc_queue.c
// Function: mpmc_queue_init
int mpmc_queue_init(struct mpmc_queue *q, size_t size, const struct memtype *mem)
{
	/* Queue size must be 2 exponent */
	if ((size < 2) || ((size & (size - 1)) != 0))
		return -1;

	q->mem = mem;
	q->buffer_mask = size - 1;
	q->buffer = memory_alloc(q->mem, sizeof(q->buffer[0]) * size);
	if (!q->buffer)
		return -2;
	
	for (size_t i = 0; i != size; i += 1)
		atomic_store_explicit(&q->buffer[i].sequence, i, memory_order_relaxed);

	atomic_store_explicit(&q->tail, 0, memory_order_relaxed);
	atomic_store_explicit(&q->head, 0, memory_order_relaxed);
	
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
cmpq $0x2, -0x18(%rbp)
jb 0x1750
movq -0x18(%rbp), %rax
movq -0x18(%rbp), %rcx
subq $0x1, %rcx
andq %rcx, %rax
cmpq $0x0, %rax
je 0x175c
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1820
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x18(%rbp), %rcx
subq $0x1, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rdi
movq -0x18(%rbp), %rsi
shlq $0x4, %rsi
callq 0x1ba0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x50(%rax)
jne 0x17ac
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x1820
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x18(%rbp), %rax
je 0x17eb
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq -0x28(%rbp), %rdx
movq %rdx, %rcx
shlq $0x4, %rcx
movq %rdx, -0x30(%rbp)
movq -0x30(%rbp), %rdx
movq %rdx, (%rax,%rcx)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x17b4
movq -0x10(%rbp), %rax
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rcx
movq %rcx, 0x98(%rax)
movq -0x10(%rbp), %rax
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rcx
movq %rcx, 0xe0(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/stv0g[P]c11-queues/mpmc_queue.c
// Function: mpmc_queue_push
int mpmc_queue_push(struct mpmc_queue *q, void *ptr)
{
	struct mpmc_queue_cell *cell;
	size_t pos, seq;
	intptr_t diff;

	pos = atomic_load_explicit(&q->tail, memory_order_relaxed);
	for (;;) {
		cell = &q->buffer[pos & q->buffer_mask];
		seq = atomic_load_explicit(&cell->sequence, memory_order_acquire);
		diff = (intptr_t) seq - (intptr_t) pos;

		if (diff == 0) {
			if (atomic_compare_exchange_weak_explicit(&q->tail, &pos, pos + 1, memory_order_relaxed, memory_order_seq_cst))
				break;
		}
		else if (diff < 0)
			return 0;
		else
			pos = atomic_load_explicit(&q->tail, memory_order_relaxed);
	}

	cell->data = ptr;
	atomic_store_explicit(&cell->sequence, pos + 1, memory_order_release);

	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x98(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdx
movq 0x50(%rax), %rax
movq -0x28(%rbp), %rcx
andq %rdx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
subq -0x28(%rbp), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x1952
movq -0x10(%rbp), %rcx
movq -0x28(%rbp), %rax
incq %rax
movq %rax, -0x50(%rbp)
movq -0x28(%rbp), %rax
movq -0x50(%rbp), %rdx
lock
cmpxchgq %rdx, 0x98(%rcx)
movq %rax, %rcx
sete %al
movb %al, -0x71(%rbp)
movq %rcx, -0x70(%rbp)
testb $0x1, %al
jne 0x1940
movq -0x70(%rbp), %rax
movq %rax, -0x28(%rbp)
movb -0x71(%rbp), %al
andb $0x1, %al
movb %al, -0x51(%rbp)
testb $0x1, -0x51(%rbp)
je 0x1950
jmp 0x1980
jmp 0x197b
cmpq $0x0, -0x38(%rbp)
jge 0x1962
movl $0x0, -0x4(%rbp)
jmp 0x19a9
movq -0x10(%rbp), %rax
movq 0x98(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x197b
jmp 0x18c3
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
movq -0x28(%rbp), %rcx
incq %rcx
movq %rcx, -0x68(%rbp)
movq -0x68(%rbp), %rcx
movq %rcx, (%rax)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/stv0g[P]c11-queues/mpmc_queue.c
// Function: mpmc_queue_pull
int mpmc_queue_pull(struct mpmc_queue *q, void **ptr)
{
	struct mpmc_queue_cell *cell;
	size_t pos, seq;
	intptr_t diff;
	
	pos = atomic_load_explicit(&q->head, memory_order_relaxed);
	for (;;) {
		cell = &q->buffer[pos & q->buffer_mask];
		
		seq = atomic_load_explicit(&cell->sequence, memory_order_acquire);
		diff = (intptr_t) seq - (intptr_t) (pos + 1);

		if (diff == 0) {
			if (atomic_compare_exchange_weak_explicit(&q->head, &pos, pos + 1, memory_order_relaxed, memory_order_seq_cst))
				break;
		}
		else if (diff < 0)
			return 0;
		else
			pos = atomic_load_explicit(&q->head, memory_order_relaxed);
	}

	*ptr = cell->data;
	atomic_store_explicit(&cell->sequence, pos + q->buffer_mask + 1, memory_order_release);

	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0xe0(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdx
movq 0x50(%rax), %rax
movq -0x28(%rbp), %rcx
andq %rdx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x28(%rbp), %rcx
addq $0x1, %rcx
subq %rcx, %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x1a69
movq -0x10(%rbp), %rcx
movq -0x28(%rbp), %rax
incq %rax
movq %rax, -0x50(%rbp)
movq -0x28(%rbp), %rax
movq -0x50(%rbp), %rdx
lock
cmpxchgq %rdx, 0xe0(%rcx)
movq %rax, %rcx
sete %al
movb %al, -0x71(%rbp)
movq %rcx, -0x70(%rbp)
testb $0x1, %al
jne 0x1a57
movq -0x70(%rbp), %rax
movq %rax, -0x28(%rbp)
movb -0x71(%rbp), %al
andb $0x1, %al
movb %al, -0x51(%rbp)
testb $0x1, -0x51(%rbp)
je 0x1a67
jmp 0x1a97
jmp 0x1a92
cmpq $0x0, -0x38(%rbp)
jge 0x1a79
movl $0x0, -0x4(%rbp)
jmp 0x1acd
movq -0x10(%rbp), %rax
movq 0xe0(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x1a92
jmp 0x19d3
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rdx
movq 0x48(%rdx), %rdx
leaq 0x1(%rcx,%rdx), %rcx
movq %rcx, -0x68(%rbp)
movq -0x68(%rbp), %rcx
movq %rcx, (%rax)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/stv0g[P]c11-queues/mpmc_queue.c
// Function: mpmc_queue_push_many
int mpmc_queue_push_many(struct mpmc_queue *q, void *ptr[], size_t cnt)
{
	int ret;
	size_t i;

	for (i = 0; i < cnt; i++) {
		ret = mpmc_queue_push(q, ptr[i]);
		if (!ret)
			break;
	}
	
	return i;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x18(%rbp), %rax
jae 0x1b36
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x18a0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jne 0x1b26
jmp 0x1b36
jmp 0x1b28
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x1afc
movq -0x28(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/stv0g[P]c11-queues/mpmc_queue.c
// Function: mpmc_queue_pull_many
int mpmc_queue_pull_many(struct mpmc_queue *q, void **ptr[], size_t cnt)
{
	int ret;
	size_t i;

	for (i = 0; i < cnt; i++) {
		ret = mpmc_queue_pull(q, ptr[i]);
		if (!ret)
			break;
	}
	
	return i;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x18(%rbp), %rax
jae 0x1b96
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x19b0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jne 0x1b86
jmp 0x1b96
jmp 0x1b88
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x1b5c
movq -0x28(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/ttoobne[P]bohttpd/src/core/config.c
// Function: to_interger
static long to_interger(char* st, char* ed) {
    long result;
    char* p;

    result = 0;

    for (p = st; p <= ed; ++ p) {
        if (!isdigit(*p)) {
            return -1;
        }

        result = result * 10 + (*p - '0');

        if (result < 0) {
            return -1;
        }
    }

    return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x18(%rbp), %rax
ja 0x36de
callq 0x24b0
movq (%rax), %rax
movq -0x28(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
jne 0x36a4
movq $-0x1, -0x8(%rbp)
jmp 0x36e6
imulq $0xa, -0x20(%rbp), %rax
movq -0x28(%rbp), %rcx
movsbl (%rcx), %ecx
subl $0x30, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jge 0x36ce
movq $-0x1, -0x8(%rbp)
jmp 0x36e6
jmp 0x36d0
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x3670
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/ttoobne[P]bohttpd/src/core/epoll.c
// Function: epoll_create_fd
epoll_t* epoll_create_fd(int flags) {
    epoll_t* epoll = NULL;

    do {
        if ((epoll = (epoll_t*)malloc(sizeof(epoll_t))) == NULL) {
            log_error("epoll malloc failed.");
            break;
        }

        /* 创建 epoll 文件描述符 */
        if ((epoll->epollfd = epoll_create1(flags)) < 0) {
            log_error("epoll fd create failed.");
            break;
        }

        if ((epoll->events = (epoll_event*)malloc(sizeof(epoll_event) * MAX_EVENTS)) == NULL) {
            log_error("events malloc failed.");
            break;
        }

        return epoll;

    } while (0);

    if (epoll_free(epoll) != 0) {
        log_error("epoll free failed.");
    }
    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0xc(%rbp)
movq $0x0, -0x18(%rbp)
movl $0x10, %edi
callq 0x22f0
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
jne 0x3742
movl $0x4, %edi
leaq 0x5d71(%rip), %rsi      # 0x9494
leaq 0x5d7b(%rip), %rdx      # 0x94a5
movl $0x17, %ecx
leaq 0x5d7f(%rip), %r8       # 0x94b5
movb $0x0, %al
callq 0x6450
jmp 0x37c7
movl -0xc(%rbp), %edi
callq 0x2470
movq -0x18(%rbp), %rcx
movl %eax, (%rcx)
cmpl $0x0, %eax
jge 0x377d
movl $0x4, %edi
leaq 0x5d33(%rip), %rsi      # 0x9494
leaq 0x5d3d(%rip), %rdx      # 0x94a5
movl $0x1d, %ecx
leaq 0x5d56(%rip), %r8       # 0x94ca
movb $0x0, %al
callq 0x6450
jmp 0x37c7
movl $0x3000, %edi           # imm = 0x3000
callq 0x22f0
movq -0x18(%rbp), %rcx
movq %rax, 0x8(%rcx)
cmpq $0x0, %rax
jne 0x37bd
movl $0x4, %edi
leaq 0x5cf3(%rip), %rsi      # 0x9494
leaq 0x5cfd(%rip), %rdx      # 0x94a5
movl $0x22, %ecx
leaq 0x5d2e(%rip), %r8       # 0x94e2
movb $0x0, %al
callq 0x6450
jmp 0x37c7
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x3803
movq -0x18(%rbp), %rdi
callq 0x3810
cmpl $0x0, %eax
je 0x37fb
movl $0x4, %edi
leaq 0x5cb3(%rip), %rsi      # 0x9494
leaq 0x5cbd(%rip), %rdx      # 0x94a5
movl $0x2b, %ecx
leaq 0x5d04(%rip), %r8       # 0x94f8
movb $0x0, %al
callq 0x6450
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/ttoobne[P]bohttpd/src/core/epoll.c
// Function: epoll_free
int epoll_free(epoll_t* epoll) {
    if (epoll != NULL) {
        free(epoll->events);
        epoll->events = NULL;
        free(epoll);
        epoll = NULL;
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x384d
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x2030
movq -0x8(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x8(%rbp), %rdi
callq 0x2030
movq $0x0, -0x8(%rbp)
xorl %eax, %eax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/ttoobne[P]bohttpd/src/core/epoll.c
// Function: epoll_add_fd
int epoll_add_fd(epoll_t* epoll, int fd, epoll_event* event) {

    if (epoll == NULL) {
        log_error("epoll is null.");
        return -1;
    }

    /* 添加监听事件 */
    if (epoll_ctl(epoll->epollfd, EPOLL_CTL_ADD, fd, event) != 0) {
        log_error("epoll add fd failed.");
        return -1;
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x38a9
movl $0x4, %edi
leaq 0x5c0e(%rip), %rsi      # 0x9494
leaq 0x5c7e(%rip), %rdx      # 0x950b
movl $0x36, %ecx
leaq 0x5c7f(%rip), %r8       # 0x9518
movb $0x0, %al
callq 0x6450
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x38fb
movq -0x10(%rbp), %rax
movl (%rax), %edi
movl -0x14(%rbp), %edx
movq -0x20(%rbp), %rcx
movl $0x1, %esi
callq 0x2210
cmpl $0x0, %eax
je 0x38f4
movl $0x4, %edi
leaq 0x5bc3(%rip), %rsi      # 0x9494
leaq 0x5c33(%rip), %rdx      # 0x950b
movl $0x3c, %ecx
leaq 0x5c43(%rip), %r8       # 0x9527
movb $0x0, %al
callq 0x6450
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x38fb
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/ttoobne[P]bohttpd/src/core/epoll.c
// Function: epoll_modify_fd
int epoll_modify_fd(epoll_t* epoll, int fd, epoll_event* event) {

    if (epoll == NULL) {
        log_error("epoll is null.");
        return -1;
    }

    /* 修改监听事件 */
    if (epoll_ctl(epoll->epollfd, EPOLL_CTL_MOD, fd, event) != 0) {
        log_error("epoll mod failed.");
        return -1;
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x3959
movl $0x4, %edi
leaq 0x5b5e(%rip), %rsi      # 0x9494
leaq 0x5bff(%rip), %rdx      # 0x953c
movl $0x49, %ecx
leaq 0x5bcf(%rip), %r8       # 0x9518
movb $0x0, %al
callq 0x6450
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x39ab
movq -0x10(%rbp), %rax
movl (%rax), %edi
movl -0x14(%rbp), %edx
movq -0x20(%rbp), %rcx
movl $0x3, %esi
callq 0x2210
cmpl $0x0, %eax
je 0x39a4
movl $0x4, %edi
leaq 0x5b13(%rip), %rsi      # 0x9494
leaq 0x5bb4(%rip), %rdx      # 0x953c
movl $0x4f, %ecx
leaq 0x5bb8(%rip), %r8       # 0x954c
movb $0x0, %al
callq 0x6450
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x39ab
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/ttoobne[P]bohttpd/src/core/epoll.c
// Function: epoll_delete_fd
int epoll_delete_fd(epoll_t* epoll, int fd, epoll_event* event) {
    
    if (epoll == NULL) {
        log_error("epoll is null.");
        return -1;
    }

    /* 删除监听事件 */
    if (epoll_ctl(epoll->epollfd, EPOLL_CTL_DEL, fd, event) != 0) {
        log_error("epoll delete failed.");
        return -1;
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x3a09
movl $0x4, %edi
leaq 0x5aae(%rip), %rsi      # 0x9494
leaq 0x5b71(%rip), %rdx      # 0x955e
movl $0x5c, %ecx
leaq 0x5b1f(%rip), %r8       # 0x9518
movb $0x0, %al
callq 0x6450
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3a5b
movq -0x10(%rbp), %rax
movl (%rax), %edi
movl -0x14(%rbp), %edx
movq -0x20(%rbp), %rcx
movl $0x2, %esi
callq 0x2210
cmpl $0x0, %eax
je 0x3a54
movl $0x4, %edi
leaq 0x5a63(%rip), %rsi      # 0x9494
leaq 0x5b26(%rip), %rdx      # 0x955e
movl $0x62, %ecx
leaq 0x5b2a(%rip), %r8       # 0x956e
movb $0x0, %al
callq 0x6450
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3a5b
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/ttoobne[P]bohttpd/src/core/epoll.c
// Function: epoll_wait_event
int epoll_wait_event(epoll_t* epoll, int maxevents, int timeout) {
    int n;
    int events_num;

    if (epoll == NULL) {
        log_error("epoll is null.");
        return -1;
    }

    /* 最大事件数与宏 MAX_EVENTS 取较小值 */
    events_num = maxevents < MAX_EVENTS ? maxevents : MAX_EVENTS;
    /* 等待就绪事件 */
    if ((n = epoll_wait(epoll->epollfd, epoll->events, events_num, timeout)) < 0) {
        log_error("epoll wait failed.");
    }

    return n;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x3ab8
movl $0x4, %edi
leaq 0x59ff(%rip), %rsi      # 0x9494
leaq 0x5ae7(%rip), %rdx      # 0x9583
movl $0x71, %ecx
leaq 0x5a70(%rip), %r8       # 0x9518
movb $0x0, %al
callq 0x6450
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3b26
cmpl $0x400, -0x14(%rbp)     # imm = 0x400
jge 0x3ac9
movl -0x14(%rbp), %eax
movl %eax, -0x24(%rbp)
jmp 0x3ad3
movl $0x400, %eax            # imm = 0x400
movl %eax, -0x24(%rbp)
jmp 0x3ad3
movl -0x24(%rbp), %eax
movl %eax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %edi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
movl -0x20(%rbp), %edx
movl -0x18(%rbp), %ecx
callq 0x2360
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jge 0x3b20
movl $0x4, %edi
leaq 0x598e(%rip), %rsi      # 0x9494
leaq 0x5a76(%rip), %rdx      # 0x9583
movl $0x79, %ecx
leaq 0x563d(%rip), %r8       # 0x9156
movb $0x0, %al
callq 0x6450
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/ttoobne[P]bohttpd/src/http/http.c
// Function: http_init_connection
int http_init_connection(int connfd, epoll_t* epoll, config_t* config) {
    http_request_t* rq;
    struct epoll_event epev;

    /* 非阻塞读写 */
    set_nonblocking(connfd);

    if ((rq = http_request_init(connfd, epoll, config)) == NULL) {
        log_error("http_request_t init failed.");
        return -1;
    }

    /* 设置 epoll 监听 connfd 上的读事件，边缘触发 */
    epev.data.ptr = (void*)rq;
    epev.events = EPOLLIN | EPOLLET | EPOLLONESHOT;

    epoll_add_fd(epoll, connfd, &epev);

    /* 添加事件到定时器，设置超时回调函数 */
    add_timer((void*)rq, rq->timeout, http_close_connection);

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl -0x8(%rbp), %edi
callq 0x8130
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x5900
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
jne 0x3b94
movl $0x4, %edi
leaq 0x5a23(%rip), %rsi      # 0x9594
leaq 0x5a2c(%rip), %rdx      # 0x95a4
movl $0x4b, %ecx
leaq 0x5a35(%rip), %r8       # 0x95b9
movb $0x0, %al
callq 0x6450
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3bd5
movq -0x20(%rbp), %rax
movq %rax, -0x28(%rbp)
movl $0xc0000001, -0x2c(%rbp) # imm = 0xC0000001
movq -0x10(%rbp), %rdi
movl -0x8(%rbp), %esi
leaq -0x2c(%rbp), %rdx
callq 0x3860
movq -0x20(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x20e8(%rax), %rsi
leaq 0x17(%rip), %rdx        # 0x3be0
callq 0x6000
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/ttoobne[P]bohttpd/src/http/http.c
// Function: http_close_connection
int http_close_connection(void* http_request) {
    http_request_t* rq;

    rq = (http_request_t*) http_request;
    
    close(rq->fd);

    http_request_destroy(rq);

    log_info("connection closed.");

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %edi
callq 0x21f0
movq -0x10(%rbp), %rdi
callq 0x5ca0
movl $0x2, %edi
leaq 0x5980(%rip), %rsi      # 0x9594
leaq 0x5a6f(%rip), %rdx      # 0x968a
movl $0x13c, %ecx            # imm = 0x13C
leaq 0x5a79(%rip), %r8       # 0x96a0
movb $0x0, %al
callq 0x6450
xorl %eax, %eax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/ttoobne[P]bohttpd/src/http/http.c
// Function: create_listenfd
int create_listenfd(unsigned short port) {
    int listenfd;
    int optval;
    struct sockaddr_in servaddr;

    /* 创建 socket 描述符 */
    if ((listenfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
        log_error("create socket failed.");
        return -1;
    }

    /* 设置 SO_REUSEADDR 关闭服务端的 TIME_WAIT */
    if (setsockopt(listenfd, SOL_SOCKET, SO_REUSEADDR, (const void *)&optval , sizeof(int)) < 0) {
        log_error("set listenfd reuse adress error.");
	    return -1;
    }

    /* 设置地址与端口号 */
    bzero(&servaddr, sizeof(servaddr));
    servaddr.sin_family = AF_INET;
    servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
    servaddr.sin_port = htons((unsigned short)port);

    /* 绑定地址与端口号 */
    if (bind(listenfd, (struct sockaddr*)&servaddr, sizeof(servaddr)) < 0) {
        log_error("bind error.");
        return -1;
    }

    /* 将描述符设置为监听描述符 */
    if (listen(listenfd, BACKLOG) < 0) {
        log_error("listen error.");
        return -1;
    }

    return listenfd;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movw %di, %ax
movw %ax, -0x6(%rbp)
movl $0x2, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x24c0
movl %eax, -0xc(%rbp)
cmpl $0x0, %eax
jge 0x3c9a
movl $0x4, %edi
leaq 0x5920(%rip), %rsi      # 0x9594
leaq 0x595a(%rip), %rdx      # 0x95d5
movl $0x64, %ecx
leaq 0x595e(%rip), %r8       # 0x95e5
movb $0x0, %al
callq 0x6450
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3da6
movl -0xc(%rbp), %edi
movl $0x1, %esi
movl $0x2, %edx
leaq -0x10(%rbp), %rcx
movl $0x4, %r8d
callq 0x20d0
cmpl $0x0, %eax
jge 0x3ced
movl $0x4, %edi
leaq 0x58cd(%rip), %rsi      # 0x9594
leaq 0x5907(%rip), %rdx      # 0x95d5
movl $0x6a, %ecx
leaq 0x5921(%rip), %r8       # 0x95fb
movb $0x0, %al
callq 0x6450
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3da6
leaq -0x20(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x21d0
movw $0x2, -0x20(%rbp)
xorl %edi, %edi
callq 0x21c0
movl %eax, -0x1c(%rbp)
movzwl -0x6(%rbp), %edi
callq 0x2170
movw %ax, -0x1e(%rbp)
movl -0xc(%rbp), %edi
leaq -0x20(%rbp), %rsi
movl $0x10, %edx
callq 0x2370
cmpl $0x0, %eax
jge 0x3d5f
movl $0x4, %edi
leaq 0x5858(%rip), %rsi      # 0x9594
leaq 0x5892(%rip), %rdx      # 0x95d5
movl $0x76, %ecx
leaq 0x58cd(%rip), %r8       # 0x961c
movb $0x0, %al
callq 0x6450
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3da6
movl -0xc(%rbp), %edi
movl $0x400, %esi            # imm = 0x400
callq 0x2320
cmpl $0x0, %eax
jge 0x3da0
movl $0x4, %edi
leaq 0x5817(%rip), %rsi      # 0x9594
leaq 0x5851(%rip), %rdx      # 0x95d5
movl $0x7c, %ecx
leaq 0x5898(%rip), %r8       # 0x9628
movb $0x0, %al
callq 0x6450
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3da6
movl -0xc(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/ttoobne[P]bohttpd/src/http/http.c
// Function: serve_error
static int serve_error(http_request_t* rq, unsigned status) {
    char body[MAXMSG] = { '\0' };
    int length;

    sprintf(body, "<html><head>");
    sprintf(body, "%s<title>%d %s</title></head>", body, status, get_shortmsg(status));
    sprintf(body, "%s<body bgcolor=\"LightSkyBlue\" align=\"center\">", body);
    sprintf(body, "%s<h1>%d %s</h1><hr>", body, status, get_shortmsg(status));
    sprintf(body, "%s<em>%s</em>", body, SERVER_NAME);
    sprintf(body, "%s</body></html>", body);

    length = strlen(body);

    serve_headers(rq, NULL, "text/html; charset=UTF-8", length, status);

    if (rio_writen(rq->fd, body, length) < 0) {
        log_error("write error.");
        return -1;
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1050, %rsp           # imm = 0x1050
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
leaq -0x1020(%rbp), %rdi
xorl %esi, %esi
movl $0x1000, %edx           # imm = 0x1000
callq 0x21d0
leaq -0x1020(%rbp), %rdi
leaq 0x57a1(%rip), %rsi      # 0x9a44
movb $0x0, %al
callq 0x2410
leaq -0x1020(%rbp), %rax
movq %rax, -0x1050(%rbp)
leaq -0x1020(%rbp), %rax
movq %rax, -0x1048(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x103c(%rbp)
movl -0x14(%rbp), %edi
callq 0x4ba0
movq -0x1050(%rbp), %rdi
movq -0x1048(%rbp), %rdx
movl -0x103c(%rbp), %ecx
movq %rax, %r8
leaq 0x575c(%rip), %rsi      # 0x9a51
movb $0x0, %al
callq 0x2410
leaq -0x1020(%rbp), %rdi
leaq -0x1020(%rbp), %rdx
leaq 0x575e(%rip), %rsi      # 0x9a6f
movb $0x0, %al
callq 0x2410
leaq -0x1020(%rbp), %rax
movq %rax, -0x1038(%rbp)
leaq -0x1020(%rbp), %rax
movq %rax, -0x1030(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x1028(%rbp)
movl -0x14(%rbp), %edi
callq 0x4ba0
movq -0x1038(%rbp), %rdi
movq -0x1030(%rbp), %rdx
movl -0x1028(%rbp), %ecx
movq %rax, %r8
leaq 0x573b(%rip), %rsi      # 0x9a9e
movb $0x0, %al
callq 0x2410
leaq -0x1020(%rbp), %rdi
leaq -0x1020(%rbp), %rdx
leaq 0x5734(%rip), %rsi      # 0x9ab3
leaq 0x5390(%rip), %rcx      # 0x9716
movb $0x0, %al
callq 0x2410
leaq -0x1020(%rbp), %rdi
leaq -0x1020(%rbp), %rdx
leaq 0x571f(%rip), %rsi      # 0x9ac1
movb $0x0, %al
callq 0x2410
leaq -0x1020(%rbp), %rdi
callq 0x2130
movl %eax, -0x1024(%rbp)
movq -0x10(%rbp), %rdi
movslq -0x1024(%rbp), %rcx
movl -0x14(%rbp), %r8d
xorl %eax, %eax
movl %eax, %esi
leaq 0x54e1(%rip), %rdx      # 0x98b6
callq 0x46d0
movq -0x10(%rbp), %rax
movl (%rax), %edi
leaq -0x1020(%rbp), %rsi
movslq -0x1024(%rbp), %rdx
callq 0x7660
cmpq $0x0, %rax
jge 0x4428
movl $0x4, %edi
leaq 0x518f(%rip), %rsi      # 0x9594
leaq 0x56c6(%rip), %rdx      # 0x9ad2
movl $0x1e2, %ecx            # imm = 0x1E2
leaq 0x52ce(%rip), %r8       # 0x96e6
movb $0x0, %al
callq 0x6450
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x442f
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x1050, %rsp           # imm = 0x1050
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/ttoobne[P]bohttpd/src/http/http.c
// Function: parse_uri
static unsigned parse_uri(http_request_t* rq, char* filename) {
    int len;

    if (rq->have_args) {
        /* TODO: CGI */
    } else {
        len = rq->uri_end - rq->uri_start + 1;

        strcpy(filename, rq->root);
        strncat(filename, rq->uri_start, len);

        len = strlen(filename);

        /* 防止非法访问父级目录，所以规定 root 中也不能有此行为 */
        if (strstr(filename, "/../") != NULL || strcmp(&(filename[len - 3]), "/..") == 0) {
            return HTTP_BAD_REQUEST;
        }

        /* 如果是目录，则添加默认文件 */
        if (filename[len - 1] == '/') {
            if (rq->defile) {
                strcat(filename, rq->defile);
            } else {
                strcat(filename, "index.html");
            }
        }

    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x50(%rax)
je 0x445f
jmp 0x453b
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x30(%rcx), %rcx
subq %rcx, %rax
addq $0x1, %rax
movl %eax, -0x1c(%rbp)
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x88(%rax), %rsi
callq 0x2090
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rsi
movslq -0x1c(%rbp), %rdx
callq 0x21e0
movq -0x18(%rbp), %rdi
callq 0x2130
movl %eax, -0x1c(%rbp)
movq -0x18(%rbp), %rdi
leaq 0x51fa(%rip), %rsi      # 0x96b3
callq 0x2490
cmpq $0x0, %rax
jne 0x44e4
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %eax
subl $0x3, %eax
cltq
addq %rax, %rdi
leaq 0x51de(%rip), %rsi      # 0x96b8
callq 0x2250
cmpl $0x0, %eax
jne 0x44ed
movl $0x190, -0x4(%rbp)      # imm = 0x190
jmp 0x4542
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x2f, %eax
jne 0x4539
movq -0x10(%rbp), %rax
cmpq $0x0, 0x90(%rax)
je 0x4527
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x90(%rax), %rsi
callq 0x23f0
jmp 0x4537
movq -0x18(%rbp), %rdi
leaq 0x4e0c(%rip), %rsi      # 0x933e
callq 0x23f0
jmp 0x4539
jmp 0x453b
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/ttoobne[P]bohttpd/src/http/http.c
// Function: serve_static
static int serve_static(http_request_t* rq, http_headers_out_t* out, char* filename, off_t length) {
    int srcfd;
    char* srcaddr;
    size_t size;

    serve_headers(rq, out, get_mime_type(filename), length, 0);

    if ((srcfd = open(filename, O_RDONLY, 0)) <= 2) {
        log_error("open file error.");
        return -1;
    }

    /* 将文件映射到虚拟地址空间，不用将文件先读到用户态，高效读取文件 */
    if ((srcaddr = mmap(NULL, length, PROT_READ, MAP_PRIVATE, srcfd, 0)) == (void*)-1) {
        log_error("mmap error.");
        close(srcfd);
        return -1;
    }
    
    close(srcfd);

    if ((size = rio_writen(rq->fd, srcaddr, length)) < 0) {
        log_error("write error.");
        munmap(srcaddr, length);
        return -1;
    }

    munmap(srcaddr, length);

    return 0;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rdi
callq 0x4b10
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq %rax, %rdx
movq -0x28(%rbp), %rcx
xorl %r8d, %r8d
callq 0x46d0
movq -0x20(%rbp), %rdi
xorl %edx, %edx
movl %edx, %esi
movb $0x0, %al
callq 0x23b0
movl %eax, -0x2c(%rbp)
cmpl $0x2, %eax
jg 0x45e1
movl $0x4, %edi
leaq 0x4fd9(%rip), %rsi      # 0x9594
leaq 0x50fa(%rip), %rdx      # 0x96bc
movl $0x1b6, %ecx            # imm = 0x1B6
leaq 0x50fb(%rip), %r8       # 0x96c9
movb $0x0, %al
callq 0x6450
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x46bc
movq -0x28(%rbp), %rsi
movl -0x2c(%rbp), %r8d
xorl %eax, %eax
movl %eax, %r9d
movl $0x1, %edx
movl $0x2, %ecx
movq %r9, %rdi
callq 0x2150
movq %rax, -0x38(%rbp)
movq $-0x1, %rcx
cmpq %rcx, %rax
jne 0x4647
movl $0x4, %edi
leaq 0x4f78(%rip), %rsi      # 0x9594
leaq 0x5099(%rip), %rdx      # 0x96bc
movl $0x1bc, %ecx            # imm = 0x1BC
leaq 0x50ab(%rip), %r8       # 0x96da
movb $0x0, %al
callq 0x6450
movl -0x2c(%rbp), %edi
callq 0x21f0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x46bc
movl -0x2c(%rbp), %edi
callq 0x21f0
movq -0x10(%rbp), %rax
movl (%rax), %edi
movq -0x38(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x7660
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
jae 0x46a8
movl $0x4, %edi
leaq 0x4f1c(%rip), %rsi      # 0x9594
leaq 0x503d(%rip), %rdx      # 0x96bc
movl $0x1c4, %ecx            # imm = 0x1C4
leaq 0x505b(%rip), %r8       # 0x96e6
movb $0x0, %al
callq 0x6450
movq -0x38(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x2340
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x46bc
movq -0x38(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x2340
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/ttoobne[P]bohttpd/src/http/http.c
// Function: get_mime_type
static char* get_mime_type(char* filename) {
    char* suffix;
    mime_type_t* it;

    suffix = strrchr(filename, '.');

    if (suffix == NULL) {
        return "text/plain; charset=UTF-8";
    }

    for (it = mimes; it->suffix != NULL; ++ it) {
        if (strcmp(it->suffix, suffix) == 0) {
            return it->type;
        }
    }

    return "text/plain; charset=UTF-8";
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movl $0x2e, %esi
callq 0x2190
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x4b42
leaq 0x4d60(%rip), %rax      # 0x989c
movq %rax, -0x8(%rbp)
jmp 0x4b95
leaq 0x7737(%rip), %rax      # 0xc280
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq $0x0, (%rax)
je 0x4b8a
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x2250
cmpl $0x0, %eax
jne 0x4b7a
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x8(%rbp)
jmp 0x4b95
jmp 0x4b7c
movq -0x20(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x20(%rbp)
jmp 0x4b4d
leaq 0x4d0b(%rip), %rax      # 0x989c
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/ttoobne[P]bohttpd/src/http/http.c
// Function: get_shortmsg
static char* get_shortmsg(unsigned status) {
    switch (status) {
    case HTTP_CONTINUE:
        return "Continue";

    case HTTP_OK:
        return "OK";

    case HTTP_MOVED_PERMANENTLY:
        return "Moved Permanently";

    case HTTP_MOVED_TEMPORARILY:
        return "Found";
        
    case HTTP_NOT_MODIFIED:
        return "Not Modified";
        
    case HTTP_BAD_REQUEST:
        return "Bad Request";
        
    case HTTP_FORBIDDEN:
        return "Forbidden";
        
    case HTTP_NOT_FOUND:
        return "Not Found";
    
    case HTTP_PRECONDITION_FAILED:
        return "Precondition Failed";
        
    case HTTP_INTERNAL_SERVER_ERROR:
        return "Internal Server Error";

    case HTTP_NOT_IMPLEMENTED:
        return "Not Implemented";

    case HTTP_VERSION_NOT_SUPPORTED:
        return "HTTP Version not supported";
    
    default:
        break;
    }

    return "";
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, -0xc(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x10(%rbp)
subl $0x64, %eax
je 0x4c6b
jmp 0x4bb8
movl -0x10(%rbp), %eax
subl $0xc8, %eax
je 0x4c7b
jmp 0x4bc8
movl -0x10(%rbp), %eax
subl $0x12d, %eax            # imm = 0x12D
je 0x4c8b
jmp 0x4bd8
movl -0x10(%rbp), %eax
subl $0x12e, %eax            # imm = 0x12E
je 0x4c9b
jmp 0x4be8
movl -0x10(%rbp), %eax
subl $0x130, %eax            # imm = 0x130
je 0x4ca8
jmp 0x4bf8
movl -0x10(%rbp), %eax
subl $0x190, %eax            # imm = 0x190
je 0x4cb5
jmp 0x4c08
movl -0x10(%rbp), %eax
subl $0x193, %eax            # imm = 0x193
je 0x4cc2
jmp 0x4c18
movl -0x10(%rbp), %eax
subl $0x194, %eax            # imm = 0x194
je 0x4ccf
jmp 0x4c28
movl -0x10(%rbp), %eax
subl $0x19c, %eax            # imm = 0x19C
je 0x4cdc
jmp 0x4c38
movl -0x10(%rbp), %eax
subl $0x1f4, %eax            # imm = 0x1F4
je 0x4ce9
jmp 0x4c48
movl -0x10(%rbp), %eax
subl $0x1f5, %eax            # imm = 0x1F5
je 0x4cf6
jmp 0x4c58
movl -0x10(%rbp), %eax
subl $0x1f9, %eax            # imm = 0x1F9
je 0x4d03
jmp 0x4d10
leaq 0x4b8a(%rip), %rax      # 0x97fc
movq %rax, -0x8(%rbp)
jmp 0x4d1d
leaq 0x4b83(%rip), %rax      # 0x9805
movq %rax, -0x8(%rbp)
jmp 0x4d1d
leaq 0x4b76(%rip), %rax      # 0x9808
movq %rax, -0x8(%rbp)
jmp 0x4d1d
leaq 0x4b9f(%rip), %rax      # 0x9841
movq %rax, -0x8(%rbp)
jmp 0x4d1d
leaq 0x4b6b(%rip), %rax      # 0x981a
movq %rax, -0x8(%rbp)
jmp 0x4d1d
leaq 0x4b6b(%rip), %rax      # 0x9827
movq %rax, -0x8(%rbp)
jmp 0x4d1d
leaq 0x4b6a(%rip), %rax      # 0x9833
movq %rax, -0x8(%rbp)
jmp 0x4d1d
leaq 0x4b67(%rip), %rax      # 0x983d
movq %rax, -0x8(%rbp)
jmp 0x4d1d
leaq 0x4b64(%rip), %rax      # 0x9847
movq %rax, -0x8(%rbp)
jmp 0x4d1d
leaq 0x4b6b(%rip), %rax      # 0x985b
movq %rax, -0x8(%rbp)
jmp 0x4d1d
leaq 0x4b74(%rip), %rax      # 0x9871
movq %rax, -0x8(%rbp)
jmp 0x4d1d
leaq 0x4b77(%rip), %rax      # 0x9881
movq %rax, -0x8(%rbp)
jmp 0x4d1d
jmp 0x4d12
leaq 0x4a73(%rip), %rax      # 0x978c
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/ttoobne[P]bohttpd/src/http/http_request.c
// Function: http_process_date
static int http_process_date(http_request_t* rq, http_headers_out_t* out, char* st, char* ed) {
    struct tm time;

    if (!strptime(st, "%a, %d %b %Y %H:%M:%S GMT", &time)) {
        log_error("date error.");
        return REQUEST_ERROR;
    }

    out->rtime = mktime(&time);

    return HTTP_OK;    
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x20(%rbp), %rdi
leaq 0x402f(%rip), %rsi      # 0x9722
leaq -0x60(%rbp), %rdx
callq 0x2450
cmpq $0x0, %rax
jne 0x5731
movl $0x4, %edi
leaq 0x4469(%rip), %rsi      # 0x9b77
leaq 0x44ed(%rip), %rdx      # 0x9c02
movl $0xc2, %ecx
leaq 0x44f3(%rip), %r8       # 0x9c14
movb $0x0, %al
callq 0x6450
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x574c
leaq -0x60(%rbp), %rdi
callq 0x2330
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movl $0xc8, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)