// File: /workspace/github_c_makefile_star2_O0/icebert[P]pblat/htslib/knetfile.c
// Function: socket_connect
static int socket_connect(const char *host, const char *port)
{
#define __err_connect(func) do { perror(func); freeaddrinfo(res); return -1; } while (0)

	int ai_err, on = 1, fd;
	struct linger lng = { 0, 0 };
	struct addrinfo hints, *res = 0;
	memset(&hints, 0, sizeof(struct addrinfo));
	hints.ai_family = AF_UNSPEC;
	hints.ai_socktype = SOCK_STREAM;
	/* In Unix/Mac, getaddrinfo() is the most convenient way to get
	 * server information. */
	if ((ai_err = getaddrinfo(host, port, &hints, &res)) != 0) { fprintf(stderr, "can't resolve %s:%s: %s\n", host, port, gai_strerror(ai_err)); return -1; }
	if ((fd = socket(res->ai_family, res->ai_socktype, res->ai_protocol)) == -1) __err_connect("socket");
	/* The following two setsockopt() are used by ftplib
	 * (http://nbpfaus.net/~pfau/ftplib/). I am not sure if they
	 * necessary. */
	if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) == -1) __err_connect("setsockopt");
	if (setsockopt(fd, SOL_SOCKET, SO_LINGER, &lng, sizeof(lng)) == -1) __err_connect("setsockopt");
	if (connect(fd, res->ai_addr, res->ai_addrlen) != 0) __err_connect("connect");
	freeaddrinfo(res);
	return fd;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x1, -0x20(%rbp)
leaq -0x2c(%rbp), %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0x63a0
movq $0x0, -0x68(%rbp)
leaq -0x60(%rbp), %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x63a0
movl $0x0, -0x5c(%rbp)
movl $0x1, -0x58(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq -0x60(%rbp), %rdx
leaq -0x68(%rbp), %rcx
callq 0x6940
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
je 0xcb98c
movq 0x3968c(%rip), %rax     # 0x104fd0
movq (%rax), %rax
movq %rax, -0x80(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x70(%rbp)
movl -0x1c(%rbp), %edi
callq 0x6a20
movq -0x80(%rbp), %rdi
movq -0x78(%rbp), %rdx
movq -0x70(%rbp), %rcx
movq %rax, %r8
leaq 0x19ff0(%rip), %rsi     # 0xe5969
movb $0x0, %al
callq 0x6a80
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xcbaa1
movq -0x68(%rbp), %rax
movl 0x4(%rax), %edi
movq -0x68(%rbp), %rax
movl 0x8(%rax), %esi
movq -0x68(%rbp), %rax
movl 0xc(%rax), %edx
callq 0x6180
movl %eax, -0x24(%rbp)
cmpl $-0x1, %eax
jne 0xcb9d1
jmp 0xcb9b0
leaq 0x12fca(%rip), %rdi     # 0xde981
callq 0x6590
movq -0x68(%rbp), %rdi
callq 0x6990
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xcbaa1
movl -0x24(%rbp), %edi
movl $0x1, %esi
movl $0x2, %edx
leaq -0x20(%rbp), %rcx
movl $0x4, %r8d
callq 0x6d80
cmpl $-0x1, %eax
jne 0xcba15
jmp 0xcb9f4
leaq 0x19f87(%rip), %rdi     # 0xe5982
callq 0x6590
movq -0x68(%rbp), %rdi
callq 0x6990
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xcbaa1
movl -0x24(%rbp), %edi
movl $0x1, %esi
movl $0xd, %edx
leaq -0x2c(%rbp), %rcx
movl $0x8, %r8d
callq 0x6d80
cmpl $-0x1, %eax
jne 0xcba56
jmp 0xcba38
leaq 0x19f43(%rip), %rdi     # 0xe5982
callq 0x6590
movq -0x68(%rbp), %rdi
callq 0x6990
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xcbaa1
movl -0x24(%rbp), %edi
movq -0x68(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x68(%rbp), %rax
movl 0x10(%rax), %edx
callq 0x6580
cmpl $0x0, %eax
je 0xcba92
jmp 0xcba74
leaq 0x19f12(%rip), %rdi     # 0xe598d
callq 0x6590
movq -0x68(%rbp), %rdi
callq 0x6990
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xcbaa1
movq -0x68(%rbp), %rdi
callq 0x6990
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax)