// File: /workspace/github_c_makefile_star2_O0/cirocosta[P]stress/src/epoll-tcp-server.c
// Function: create_and_bind
static int
create_and_bind(char* port)
{
	struct addrinfo hints;
	struct addrinfo* result;
	struct addrinfo* rp;
	int s;
	int sfd;

	memset(&hints, 0, sizeof(struct addrinfo));
	hints.ai_family = AF_UNSPEC;     // IPV4 and IPV6
	hints.ai_socktype = SOCK_STREAM; // TCP
	hints.ai_flags = AI_PASSIVE;     // All Ifaces

	_STRESS_MUST((s = getaddrinfo(NULL, port, &hints, &result)) == 0,
	             "Couldn't get addr info - %s",
	             gai_strerror(s));

	for (rp = result; rp != NULL; rp = rp->ai_next) {
		sfd = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol);
		if (sfd == -1) {
			continue;
		}

		s = bind(sfd, rp->ai_addr, rp->ai_addrlen);
		if (s == 0) {
			break;
		}

		close(sfd);
	}

	_STRESS_MUST(rp, "Couldn't bind to port %s", port);
	freeaddrinfo(result);

	return sfd;
}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x60(%rsp)
leaq 0x30(%rsp), %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x10d0
movl $0x0, 0x34(%rsp)
movl $0x1, 0x38(%rsp)
movl $0x1, 0x30(%rsp)
movq 0x60(%rsp), %rsi
xorl %eax, %eax
movl %eax, %edi
leaq 0x30(%rsp), %rdx
leaq 0x28(%rsp), %rcx
callq 0x11c0
movl %eax, 0x1c(%rsp)
cmpl $0x0, %eax
je 0x2573
movq 0x2b6a(%rip), %rax      # 0x4ff8
movq (%rax), %rdi
leaq 0xd21(%rip), %rsi       # 0x31b9
movb $0x0, %al
callq 0x1130
movq 0x2b52(%rip), %rax      # 0x4ff8
movq (%rax), %rdi
leaq 0xd0f(%rip), %rsi       # 0x31bf
movb $0x0, %al
callq 0x1130
movq 0x2b3a(%rip), %rax      # 0x4ff8
movq (%rax), %rax
movq %rax, 0x8(%rsp)
movl 0x1c(%rsp), %edi
callq 0x10c0
movq 0x8(%rsp), %rdi
movq %rax, %rdx
leaq 0xe08(%rip), %rsi       # 0x32e6
movb $0x0, %al
callq 0x1130
movq 0x2b0c(%rip), %rax      # 0x4ff8
movq (%rax), %rdi
leaq 0xb65(%rip), %rsi       # 0x305b
movb $0x0, %al
callq 0x1130
movq 0x2af4(%rip), %rax      # 0x4ff8
movq (%rax), %rdi
leaq 0xb50(%rip), %rsi       # 0x305e
leaq 0xc86(%rip), %rdx       # 0x319b
movb $0x0, %al
callq 0x1130
movq 0x2ad5(%rip), %rax      # 0x4ff8
movq (%rax), %rdi
leaq 0xb4d(%rip), %rsi       # 0x307a
movl $0x47, %edx
movb $0x0, %al
callq 0x1130
movq 0x2ab8(%rip), %rax      # 0x4ff8
movq (%rax), %rdi
leaq 0xb12(%rip), %rsi       # 0x305c
movb $0x0, %al
callq 0x1130
movq 0x2aa0(%rip), %rax      # 0x4ff8
movq (%rax), %rdi
leaq 0xb25(%rip), %rsi       # 0x3087
movb $0x0, %al
callq 0x1130
movl $0x1, %edi
callq 0x11b0
jmp 0x2575
movq 0x28(%rsp), %rax
movq %rax, 0x20(%rsp)
cmpq $0x0, 0x20(%rsp)
je 0x25fb
movq 0x20(%rsp), %rax
movl 0x4(%rax), %edi
movq 0x20(%rsp), %rax
movl 0x8(%rax), %esi
movq 0x20(%rsp), %rax
movl 0xc(%rax), %edx
callq 0x1210
movl %eax, 0x18(%rsp)
cmpl $-0x1, 0x18(%rsp)
jne 0x25b1
jmp 0x25eb
movl 0x18(%rsp), %edi
movq 0x20(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x10(%rsp)
movq 0x20(%rsp), %rax
movl 0x10(%rax), %edx
movq 0x10(%rsp), %rsi
callq 0x1160
movl %eax, 0x1c(%rsp)
cmpl $0x0, 0x1c(%rsp)
jne 0x25e2
jmp 0x25fb
movl 0x18(%rsp), %edi
callq 0x10e0
movq 0x20(%rsp), %rax
movq 0x28(%rax), %rax
movq %rax, 0x20(%rsp)
jmp 0x257f
jmp 0x25fd
cmpq $0x0, 0x20(%rsp)
jne 0x26e4
movq 0x29e8(%rip), %rax      # 0x4ff8
movq (%rax), %rdi
leaq 0xb9f(%rip), %rsi       # 0x31b9
movb $0x0, %al
callq 0x1130
movq 0x29d0(%rip), %rax      # 0x4ff8
movq (%rax), %rdi
leaq 0xb8d(%rip), %rsi       # 0x31bf
movb $0x0, %al
callq 0x1130
movq 0x29b8(%rip), %rax      # 0x4ff8
movq (%rax), %rdi
movq 0x60(%rsp), %rdx
leaq 0xcb3(%rip), %rsi       # 0x3302
movb $0x0, %al
callq 0x1130
movq 0x299b(%rip), %rax      # 0x4ff8
movq (%rax), %rdi
leaq 0x9f4(%rip), %rsi       # 0x305b
movb $0x0, %al
callq 0x1130
movq 0x2983(%rip), %rax      # 0x4ff8
movq (%rax), %rdi
leaq 0x9df(%rip), %rsi       # 0x305e
leaq 0xb15(%rip), %rdx       # 0x319b
movb $0x0, %al
callq 0x1130
movq 0x2964(%rip), %rax      # 0x4ff8
movq (%rax), %rdi
leaq 0x9dc(%rip), %rsi       # 0x307a
movl $0x57, %edx
movb $0x0, %al
callq 0x1130
movq 0x2947(%rip), %rax      # 0x4ff8
movq (%rax), %rdi
leaq 0x9a1(%rip), %rsi       # 0x305c
movb $0x0, %al
callq 0x1130
movq 0x292f(%rip), %rax      # 0x4ff8
movq (%rax), %rdi
leaq 0x9b4(%rip), %rsi       # 0x3087
movb $0x0, %al
callq 0x1130
movl $0x1, %edi
callq 0x11b0
jmp 0x26e6
movq 0x28(%rsp), %rdi
callq 0x1200
movl 0x18(%rsp), %eax
addq $0x68, %rsp
retq
nopl (%rax)