// File: /workspace/github_c_makefile_star2_O0/mkubecek[P]nperf/client/main.c
// Function: ctrl_connect_with_lookup
static int ctrl_connect_with_lookup(struct client_config *config)
{
	struct addrinfo hints = {
		.ai_flags	= 0,
		.ai_family	= AF_UNSPEC,
		.ai_socktype	= SOCK_STREAM,
		.ai_protocol	= IPPROTO_TCP,
	};
	int sd = -1;
	struct addrinfo *results = NULL;
	struct addrinfo *result;
	int ret;

	ret = getaddrinfo(config->server_host, NULL, &hints, &results);
	if (ret) {
		fprintf(stderr, "host '%s' lookup failed: %s\n",
			config->server_host, gai_strerror(ret));
		return -ENOENT;
	}

	ret = -ENOENT;
	for (result = results; result; result = result->ai_next) {
		ret = sockaddr_set_port((union sockaddr_any *)result->ai_addr,
					config->ctrl_port);
		if (ret < 0)
			continue;
		ret = socket(result->ai_family, SOCK_STREAM, IPPROTO_TCP);
		if (ret < 0)
			continue;
		sd = ret;
		ret = connect(sd, result->ai_addr, result->ai_addrlen);
		if (ret == 0)
			break;

		ret = -errno;
		perror("connect");
		close(sd);
	}
	if (ret < 0) {
		freeaddrinfo(results);
		fprintf(stderr, "failed to connect to '%s'\n",
			config->server_host);
		return ret;
	}

	config->ctrl_sd = sd;
	memcpy(&server_addr, result->ai_addr,  result->ai_addrlen);
	freeaddrinfo(results);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
leaq -0x40(%rbp), %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x2180
movl $0x1, -0x38(%rbp)
movl $0x6, -0x34(%rbp)
movl $0xffffffff, -0x44(%rbp) # imm = 0xFFFFFFFF
movq $0x0, -0x50(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq -0x40(%rbp), %rdx
leaq -0x50(%rbp), %rcx
callq 0x2340
movl %eax, -0x5c(%rbp)
cmpl $0x0, -0x5c(%rbp)
je 0x36f0
movq 0x7947(%rip), %rax      # 0xaff8
movq (%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x68(%rbp)
movl -0x5c(%rbp), %edi
callq 0x2150
movq -0x70(%rbp), %rdi
movq -0x68(%rbp), %rdx
movq %rax, %rcx
leaq 0x3ad1(%rip), %rsi      # 0x71ae
movb $0x0, %al
callq 0x21f0
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x3814
movl $0xfffffffe, -0x5c(%rbp) # imm = 0xFFFFFFFE
movq -0x50(%rbp), %rax
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x58(%rbp)
je 0x37a7
movq -0x58(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x10(%rbp), %rax
movzwl 0x8(%rax), %esi
callq 0x39e0
movl %eax, -0x5c(%rbp)
cmpl $0x0, -0x5c(%rbp)
jge 0x372a
jmp 0x3796
movq -0x58(%rbp), %rax
movl 0x4(%rax), %edi
movl $0x1, %esi
movl $0x6, %edx
callq 0x23b0
movl %eax, -0x5c(%rbp)
cmpl $0x0, -0x5c(%rbp)
jge 0x374b
jmp 0x3796
movl -0x5c(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %edi
movq -0x58(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x58(%rbp), %rax
movl 0x10(%rax), %edx
callq 0x2310
movl %eax, -0x5c(%rbp)
cmpl $0x0, -0x5c(%rbp)
jne 0x3773
jmp 0x37a7
callq 0x2070
movq %rax, %rcx
xorl %eax, %eax
subl (%rcx), %eax
movl %eax, -0x5c(%rbp)
leaq 0x3a42(%rip), %rdi      # 0x71cb
callq 0x22b0
movl -0x44(%rbp), %edi
callq 0x21a0
movq -0x58(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x58(%rbp)
jmp 0x36ff
cmpl $0x0, -0x5c(%rbp)
jge 0x37dd
movq -0x50(%rbp), %rdi
callq 0x23a0
movq 0x783b(%rip), %rax      # 0xaff8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
leaq 0x3a05(%rip), %rsi      # 0x71d3
movb $0x0, %al
callq 0x21f0
movl -0x5c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x3814
movl -0x44(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x54(%rax)
movq -0x58(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x58(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, %edx
leaq 0x8181(%rip), %rdi      # 0xb980
callq 0x2200
movq -0x50(%rbp), %rdi
callq 0x23a0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax)