// File: /workspace/github_c_makefile_star2_O0/rouming[P]io/http-server.c
// Function: on_sock_connection
static int on_sock_connection(void *poller, struct poller_item *item)
{
	struct sockaddr addr;
	socklen_t len = sizeof(addr);
	struct loop_ctx *ctx = item->data;
	struct connection *conn;
	struct io_req *req;

	int rc, peer;

	peer = accept4(item->fd, &addr, &len, SOCK_CLOEXEC | SOCK_NONBLOCK);
	if (peer < 0) {
		switch (errno) {
		case EWOULDBLOCK:
			break;
		case EMFILE:
		case ENFILE:
		case ENOBUFS:
		case ENOMEM:
		default:
			err(EXIT_FAILURE, "accept4 failed: errno=%d\n", errno);

			return rc;
		}

		return 0;
	}

	conn = calloc(1, sizeof(*conn));
	assert(conn);

	conn->ctx = ctx;
	conn->sock = peer;
	io_queue_init(&conn->cli_q);

	rc = io_queue_bind(&conn->cli_q, poller, peer);
	assert(rc == 0);

	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);

	/* Do not propagate an error up to avoid IO loop exit */
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1b0, %rsp            # imm = 0x1B0
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x10, -0x2c(%rbp)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rax
movl (%rax), %edi
leaq -0x28(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
movl $0x80800, %ecx          # imm = 0x80800
callq 0x10a0
movl %eax, -0x50(%rbp)
cmpl $0x0, -0x50(%rbp)
jge 0x1967
callq 0x1050
movl (%rax), %eax
movl %eax, -0x1a4(%rbp)
subl $0xb, %eax
je 0x193d
jmp 0x1913
movl -0x1a4(%rbp), %eax
subl $0xc, %eax
je 0x193f
jmp 0x1920
movl -0x1a4(%rbp), %eax
addl $-0x17, %eax
subl $0x2, %eax
jb 0x193f
jmp 0x1930
movl -0x1a4(%rbp), %eax
subl $0x69, %eax
je 0x193f
jmp 0x1941
jmp 0x195b
jmp 0x1941
callq 0x1050
movl (%rax), %edx
movl $0x1, %edi
leaq 0x57d6(%rip), %rsi      # 0x712a
movb $0x0, %al
callq 0x11a0
movl $0x0, -0x4(%rbp)
jmp 0x1acb
movl $0x1, %edi
movl $0x198, %esi            # imm = 0x198
callq 0x1150
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x1983
jmp 0x19a2
leaq 0x57ba(%rip), %rdi      # 0x7144
leaq 0x56ff(%rip), %rsi      # 0x7090
movl $0xe3, %edx
leaq 0x57ac(%rip), %rcx      # 0x7149
callq 0x10d0
movq -0x38(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, (%rax)
movl -0x50(%rbp), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x190(%rax)
movq -0x40(%rbp), %rdi
addq $0x8, %rdi
callq 0x3ff0
movq -0x40(%rbp), %rdi
addq $0x8, %rdi
movq -0x10(%rbp), %rsi
movl -0x50(%rbp), %edx
callq 0x41b0
movl %eax, -0x4c(%rbp)
cmpl $0x0, -0x4c(%rbp)
jne 0x19e6
jmp 0x1a05
leaq 0x5791(%rip), %rdi      # 0x717e
leaq 0x569c(%rip), %rsi      # 0x7090
movl $0xea, %edx
leaq 0x5749(%rip), %rcx      # 0x7149
callq 0x10d0
movq -0x40(%rbp), %rdi
addq $0x8, %rdi
movq -0x40(%rbp), %rdx
xorl %esi, %esi
leaq 0x326(%rip), %rcx       # 0x1d40
callq 0x49c0
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0x1a2c
jmp 0x1a4b
leaq 0x5822(%rip), %rdi      # 0x7255
leaq 0x5656(%rip), %rsi      # 0x7090
movl $0xee, %edx
leaq 0x5703(%rip), %rcx      # 0x7149
callq 0x10d0
movq -0x48(%rbp), %rax
addq $0x28, %rax
movq %rax, -0x1b0(%rbp)
leaq -0x1a0(%rbp), %rdi
xorl %esi, %esi
movl $0x148, %edx            # imm = 0x148
callq 0x10e0
movq -0x1b0(%rbp), %rdi
movq $0x1, -0x80(%rbp)
movb $0x1, -0x78(%rbp)
leaq -0x1a0(%rbp), %rsi
movl $0x148, %edx            # imm = 0x148
callq 0x1180
movq -0x48(%rbp), %rdi
callq 0x4500
movl %eax, -0x4c(%rbp)
cmpl $0x0, -0x4c(%rbp)
jne 0x1aa5
jmp 0x1ac4
leaq 0x56d2(%rip), %rdi      # 0x717e
leaq 0x55dd(%rip), %rsi      # 0x7090
movl $0xf5, %edx
leaq 0x568a(%rip), %rcx      # 0x7149
callq 0x10d0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbp
retq
nopw (%rax,%rax)