// File: /workspace/github_c_makefile_star2_O0/rouming[P]io/http-server.c
// Function: run_event_loop
static int run_event_loop(void)
{
	int err, sigfd;
	int exit_rc = EXIT_SUCCESS;
	void *poller = NULL;
	int server_sock;

	struct poller_item sock_item;
	struct loop_ctx ctx;
	struct io_queue sig_q;
	struct io_req sig_req;

	server_sock = create_server_socket("0.0.0.0", 8080);
	assert(server_sock >= 0);

	sock_item = (struct poller_item){
		.fd     = server_sock,
		.events = P_IN,
		.data   = &ctx,
		.action = on_sock_connection
	};

	sigfd = create_signalfd();
	assert(sigfd >= 0);

	io_queue_init(&sig_q);

	err = poller_create(&poller);
	assert(err == 0);
	assert(poller != NULL);

	err = io_queue_bind(&sig_q, poller, sigfd);
	assert(err == 0);

	io_req_init(&sig_req, &sig_q, REQ_RD, &ctx, on_signal);
	sig_req.buf = (struct io_buf){
		.iov[0] = {
			.iov_base = NULL,
			.iov_len  = sizeof(struct signalfd_siginfo)
		},
		.iov_num  = 1,
		.is_vari_len = false
	};

	err = io_queue_submit(&sig_req);
	assert(err == 0);

	err = poller_ctl(poller, P_CTL_ADD, &sock_item);
	assert(err == 0);

	ctx.shutdown = false;
	INIT_LIST_HEAD(&ctx.dead_conns);
	while (!ctx.shutdown) {
		struct poller_item *items[16];
		int i;

		err = poller_wait(poller, items, ARRAY_SIZE(items), INT_MAX);
		if (err == 0)
			continue;
		else if (err < 0) {
			printf("poller_wait() failed, errno=%d\n", -err);
			break;
		}
		/* Handle events */
		for (i = 0; i < err; i++) {
			err = poller_do_action(poller, items[i]);
			if (err) {
				/* We are done. */
				exit_rc = (err > 0 ? EXIT_SUCCESS :
					   EXIT_FAILURE);
				goto out;
			}
		}
		/* Handle bottom halves */
		bh_execute(&ctx);
	}
out:
	io_req_deinit(&sig_req);
	io_queue_unbind(&sig_q);
	io_queue_deinit(&sig_q);

	poller_destroy(poller);

	close(sigfd);
	close(server_sock);

	return exit_rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x770, %rsp            # imm = 0x770
movl $0x0, -0xc(%rbp)
movq $0x0, -0x18(%rbp)
leaq 0x5cf6(%rip), %rdi      # 0x7077
movl $0x1f90, %esi           # imm = 0x1F90
callq 0x1700
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jl 0x1396
jmp 0x13b5
leaq 0x5ce2(%rip), %rdi      # 0x707f
leaq 0x5cec(%rip), %rsi      # 0x7090
movl $0x114, %edx            # imm = 0x114
leaq 0x5cee(%rip), %rcx      # 0x709e
callq 0x10d0
leaq -0x590(%rbp), %rdi
xorl %esi, %esi
movl $0x130, %edx            # imm = 0x130
callq 0x10e0
movl -0x1c(%rbp), %eax
movl %eax, -0x590(%rbp)
movl $0x2, -0x58c(%rbp)
leaq -0x168(%rbp), %rax
movq %rax, -0x580(%rbp)
leaq 0x4c0(%rip), %rax       # 0x18b0
movq %rax, -0x468(%rbp)
leaq -0x150(%rbp), %rdi
leaq -0x590(%rbp), %rsi
movl $0x130, %edx            # imm = 0x130
callq 0x1180
callq 0x1ae0
movl %eax, -0x8(%rbp)
cmpl $0x0, -0x8(%rbp)
jl 0x141f
jmp 0x143e
leaq 0x5c91(%rip), %rdi      # 0x70b7
leaq 0x5c63(%rip), %rsi      # 0x7090
movl $0x11e, %edx            # imm = 0x11E
leaq 0x5c65(%rip), %rcx      # 0x709e
callq 0x10d0
leaq -0x2e0(%rbp), %rdi
callq 0x3ff0
leaq -0x18(%rbp), %rdi
callq 0x6360
movl %eax, -0x4(%rbp)
cmpl $0x0, -0x4(%rbp)
jne 0x145e
jmp 0x147d
leaq 0x5c5d(%rip), %rdi      # 0x70c2
leaq 0x5c24(%rip), %rsi      # 0x7090
movl $0x123, %edx            # imm = 0x123
leaq 0x5c26(%rip), %rcx      # 0x709e
callq 0x10d0
cmpq $0x0, -0x18(%rbp)
je 0x1486
jmp 0x14a5
leaq 0x5c3e(%rip), %rdi      # 0x70cb
leaq 0x5bfc(%rip), %rsi      # 0x7090
movl $0x124, %edx            # imm = 0x124
leaq 0x5bfe(%rip), %rcx      # 0x709e
callq 0x10d0
movq -0x18(%rbp), %rsi
movl -0x8(%rbp), %edx
leaq -0x2e0(%rbp), %rdi
callq 0x41b0
movl %eax, -0x4(%rbp)
cmpl $0x0, -0x4(%rbp)
jne 0x14c3
jmp 0x14e2
leaq 0x5bf8(%rip), %rdi      # 0x70c2
leaq 0x5bbf(%rip), %rsi      # 0x7090
movl $0x127, %edx            # imm = 0x127
leaq 0x5bc1(%rip), %rcx      # 0x709e
callq 0x10d0
leaq -0x460(%rbp), %rdi
leaq -0x2e0(%rbp), %rsi
xorl %edx, %edx
leaq -0x168(%rbp), %rcx
leaq 0x670(%rip), %r8        # 0x1b70
callq 0x4830
leaq -0x460(%rbp), %rax
addq $0x28, %rax
movq %rax, -0x770(%rbp)
leaq -0x6d8(%rbp), %rdi
xorl %esi, %esi
movl $0x148, %edx            # imm = 0x148
callq 0x10e0
movq -0x770(%rbp), %rdi
movq $0x80, -0x6d0(%rbp)
movq $0x1, -0x5b8(%rbp)
movb $0x0, -0x5b0(%rbp)
leaq -0x6d8(%rbp), %rsi
movl $0x148, %edx            # imm = 0x148
callq 0x1180
leaq -0x460(%rbp), %rdi
callq 0x4500
movl %eax, -0x4(%rbp)
cmpl $0x0, -0x4(%rbp)
jne 0x1576
jmp 0x1595
leaq 0x5b45(%rip), %rdi      # 0x70c2
leaq 0x5b0c(%rip), %rsi      # 0x7090
movl $0x134, %edx            # imm = 0x134
leaq 0x5b0e(%rip), %rcx      # 0x709e
callq 0x10d0
movq -0x18(%rbp), %rdi
xorl %esi, %esi
leaq -0x150(%rbp), %rdx
callq 0x6500
movl %eax, -0x4(%rbp)
cmpl $0x0, -0x4(%rbp)
jne 0x15b2
jmp 0x15d1
leaq 0x5b09(%rip), %rdi      # 0x70c2
leaq 0x5ad0(%rip), %rsi      # 0x7090
movl $0x137, %edx            # imm = 0x137
leaq 0x5ad2(%rip), %rcx      # 0x709e
callq 0x10d0
movb $0x0, -0x168(%rbp)
leaq -0x168(%rbp), %rdi
addq $0x8, %rdi
callq 0x1c20
movb -0x168(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x15f9
jmp 0x16aa
movq -0x18(%rbp), %rdi
leaq -0x760(%rbp), %rsi
movl $0x10, %edx
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
callq 0x6930
movl %eax, -0x4(%rbp)
cmpl $0x0, -0x4(%rbp)
jne 0x161e
jmp 0x15e8
cmpl $0x0, -0x4(%rbp)
jge 0x1639
xorl %esi, %esi
subl -0x4(%rbp), %esi
leaq 0x5aaa(%rip), %rdi      # 0x70da
movb $0x0, %al
callq 0x10c0
jmp 0x16aa
jmp 0x163b
movl $0x0, -0x764(%rbp)
movl -0x764(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0x1699
movq -0x18(%rbp), %rdi
movslq -0x764(%rbp), %rax
movq -0x760(%rbp,%rax,8), %rsi
callq 0x6c20
movl %eax, -0x4(%rbp)
cmpl $0x0, -0x4(%rbp)
je 0x1686
movl -0x4(%rbp), %edx
movl $0x1, %eax
xorl %ecx, %ecx
cmpl $0x0, %edx
cmovgl %ecx, %eax
movl %eax, -0xc(%rbp)
jmp 0x16ac
jmp 0x1688
movl -0x764(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x764(%rbp)
jmp 0x1645
leaq -0x168(%rbp), %rdi
callq 0x1c50
jmp 0x15e8
jmp 0x16ac
leaq -0x460(%rbp), %rdi
callq 0x48e0
leaq -0x2e0(%rbp), %rdi
callq 0x43b0
leaq -0x2e0(%rbp), %rdi
callq 0x4060
movq -0x18(%rbp), %rdi
callq 0x6420
movl -0x8(%rbp), %edi
callq 0x1100
movl -0x1c(%rbp), %edi
callq 0x1100
movl -0xc(%rbp), %eax
addq $0x770, %rsp            # imm = 0x770
popq %rbp
retq
nopw %cs:(%rax,%rax)