// File: /workspace/github_c_makefile_star2_O0/rouming[P]io/zmtp-test.c
// Function: run_event_loop
static int run_event_loop(void)
{
	int err, sigfd, ssock;
	int exit_rc = EXIT_SUCCESS;
	struct loop_ctx ctx;
	struct sockaddr_in ip4addr = {
		.sin_family = AF_INET,
		.sin_port = htons(5555)
	};

	inet_pton(AF_INET, "127.0.0.1", &ip4addr.sin_addr);
	ssock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
	assert(ssock >= 0);
	err = 1;
	err = setsockopt(ssock, SOL_SOCKET, SO_REUSEADDR, &err, sizeof(err));
	assert(err == 0);
	err = bind(ssock, (struct sockaddr *)&ip4addr, sizeof(ip4addr));
	assert(err == 0);
	err = listen(ssock, SOMAXCONN);
	assert(err == 0);
	sigfd = create_signalfd();
	assert(sigfd >= 0);

	init_loop_ctx(&ctx, sigfd, ssock);
	while (1) {
		int i;
		struct poller_item *items[16];

		err = poller_wait(ctx.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(ctx.poller, items[i]);
			if (err) {
				/* We are done. */
				exit_rc = (err > 0 ? EXIT_SUCCESS :
						     EXIT_FAILURE);
				goto out;
			}
		}
		/* Handle bh */
		bh_execute(&ctx);
	}
out:
	deinit_loop_ctx(&ctx);
	close(sigfd);
	close(ssock);

	return exit_rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x330, %rsp            # imm = 0x330
movl $0x0, -0x10(%rbp)
movw $0x2, -0x2a0(%rbp)
movl $0x15b3, %edi           # imm = 0x15B3
callq 0x10b0
movw %ax, -0x29e(%rbp)
leaq -0x2a0(%rbp), %rdi
addq $0x4, %rdi
xorl %esi, %esi
movl $0x4, %edx
callq 0x10e0
leaq -0x2a0(%rbp), %rdi
addq $0x8, %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0x10e0
leaq -0x2a0(%rbp), %rdx
addq $0x4, %rdx
movl $0x2, %edi
leaq 0x5d23(%rip), %rsi      # 0x70d4
callq 0x1180
movl $0x2, %edi
movl $0x1, %esi
movl $0x6, %edx
callq 0x1200
movl %eax, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
jl 0x13d5
jmp 0x13f4
leaq 0x5d02(%rip), %rdi      # 0x70de
leaq 0x5d06(%rip), %rsi      # 0x70e9
movl $0x13b, %edx            # imm = 0x13B
leaq 0x5d06(%rip), %rcx      # 0x70f5
callq 0x10d0
movl $0x1, -0x4(%rbp)
movl -0xc(%rbp), %edi
movl $0x1, %esi
movl $0x2, %edx
leaq -0x4(%rbp), %rcx
movl $0x4, %r8d
callq 0x1070
movl %eax, -0x4(%rbp)
cmpl $0x0, -0x4(%rbp)
jne 0x1422
jmp 0x1441
leaq 0x5ce5(%rip), %rdi      # 0x710e
leaq 0x5cb9(%rip), %rsi      # 0x70e9
movl $0x13e, %edx            # imm = 0x13E
leaq 0x5cb9(%rip), %rcx      # 0x70f5
callq 0x10d0
movl -0xc(%rbp), %edi
leaq -0x2a0(%rbp), %rax
movq %rax, -0x2a8(%rbp)
movq -0x2a8(%rbp), %rsi
movl $0x10, %edx
callq 0x11d0
movl %eax, -0x4(%rbp)
cmpl $0x0, -0x4(%rbp)
jne 0x146e
jmp 0x148d
leaq 0x5c99(%rip), %rdi      # 0x710e
leaq 0x5c6d(%rip), %rsi      # 0x70e9
movl $0x140, %edx            # imm = 0x140
leaq 0x5c6d(%rip), %rcx      # 0x70f5
callq 0x10d0
movl -0xc(%rbp), %edi
movl $0x1000, %esi           # imm = 0x1000
callq 0x11a0
movl %eax, -0x4(%rbp)
cmpl $0x0, -0x4(%rbp)
jne 0x14a5
jmp 0x14c4
leaq 0x5c62(%rip), %rdi      # 0x710e
leaq 0x5c36(%rip), %rsi      # 0x70e9
movl $0x142, %edx            # imm = 0x142
leaq 0x5c36(%rip), %rcx      # 0x70f5
callq 0x10d0
callq 0x15f0
movl %eax, -0x8(%rbp)
cmpl $0x0, -0x8(%rbp)
jl 0x14d4
jmp 0x14f3
leaq 0x5c3c(%rip), %rdi      # 0x7117
leaq 0x5c07(%rip), %rsi      # 0x70e9
movl $0x144, %edx            # imm = 0x144
leaq 0x5c07(%rip), %rcx      # 0x70f5
callq 0x10d0
movl -0x8(%rbp), %esi
movl -0xc(%rbp), %edx
leaq -0x290(%rbp), %rdi
callq 0x1680
movq -0x288(%rbp), %rdi
leaq -0x330(%rbp), %rsi
movl $0x10, %edx
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
callq 0x6a70
movl %eax, -0x4(%rbp)
cmpl $0x0, -0x4(%rbp)
jne 0x152d
jmp 0x1505
cmpl $0x0, -0x4(%rbp)
jge 0x1548
xorl %esi, %esi
subl -0x4(%rbp), %esi
leaq 0x5be3(%rip), %rdi      # 0x7122
movb $0x0, %al
callq 0x10c0
jmp 0x15bc
jmp 0x154a
movl $0x0, -0x2ac(%rbp)
movl -0x2ac(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0x15ab
movq -0x288(%rbp), %rdi
movslq -0x2ac(%rbp), %rax
movq -0x330(%rbp,%rax,8), %rsi
callq 0x6d60
movl %eax, -0x4(%rbp)
cmpl $0x0, -0x4(%rbp)
je 0x1598
movl -0x4(%rbp), %edx
movl $0x1, %eax
xorl %ecx, %ecx
cmpl $0x0, %edx
cmovgl %ecx, %eax
movl %eax, -0x10(%rbp)
jmp 0x15be
jmp 0x159a
movl -0x2ac(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2ac(%rbp)
jmp 0x1554
leaq -0x290(%rbp), %rdi
callq 0x1840
jmp 0x1505
jmp 0x15be
leaq -0x290(%rbp), %rdi
callq 0x1910
movl -0x8(%rbp), %edi
callq 0x1100
movl -0xc(%rbp), %edi
callq 0x1100
movl -0x10(%rbp), %eax
addq $0x330, %rsp            # imm = 0x330
popq %rbp
retq
nopw %cs:(%rax,%rax)