// File: /workspace/github_c_makefile_star2_O0/amanelis[P]uici/uici.c
// Function: u_connect
int u_connect(u_port_t port, char *hostn) {
   int error;
   int retval;
   struct sockaddr_in server;
   int sock;
   fd_set sockset;

   if (name2addr(hostn,&(server.sin_addr.s_addr)) == -1) {
      errno = EINVAL;
      return -1;
   }
   server.sin_port = htons((short)port);
   server.sin_family = AF_INET;

   if ((u_ignore_sigpipe() == -1) ||
        ((sock = socket(AF_INET, SOCK_STREAM, 0)) == -1))
      return -1;

   if (((retval =
       connect(sock, (struct sockaddr *)&server, sizeof(server))) == -1) &&
       ((errno == EINTR) || (errno == EALREADY))) {
       FD_ZERO(&sockset);
       FD_SET(sock, &sockset);
       while ( ((retval = select(sock+1, NULL, &sockset, NULL, NULL)) == -1) &&
               (errno == EINTR) ) {
          FD_ZERO(&sockset);
          FD_SET(sock, &sockset);
       } 
   }
   if (retval == -1) {
        error = errno;
        while ((close(sock) == -1) && (errno == EINTR)); 
        errno = error;
        return -1;
   }
   return sock;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movw %di, %ax
movw %ax, -0x6(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x28(%rbp), %rsi
addq $0x4, %rsi
callq 0x1f70
cmpl $-0x1, %eax
jne 0x2243
callq 0x1030
movl $0x16, (%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2485
movzwl -0x6(%rbp), %edi
callq 0x10a0
movw %ax, -0x26(%rbp)
movw $0x2, -0x28(%rbp)
callq 0x24a0
cmpl $-0x1, %eax
je 0x2279
movl $0x2, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x11e0
movl %eax, -0x2c(%rbp)
cmpl $-0x1, %eax
jne 0x2285
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2485
movl -0x2c(%rbp), %edi
leaq -0x28(%rbp), %rsi
movl $0x10, %edx
callq 0x11a0
movl %eax, -0x18(%rbp)
cmpl $-0x1, %eax
jne 0x241a
callq 0x1030
cmpl $0x4, (%rax)
je 0x22ba
callq 0x1030
cmpl $0x72, (%rax)
jne 0x241a
jmp 0x22bc
leaq -0xb0(%rbp), %rax
movq %rax, -0xc0(%rbp)
movl $0x0, -0xb4(%rbp)
movl -0xb4(%rbp), %eax
cmpq $0x10, %rax
jae 0x2306
movq -0xc0(%rbp), %rax
movl -0xb4(%rbp), %ecx
movq $0x0, (%rax,%rcx,8)
movl -0xb4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb4(%rbp)
jmp 0x22d4
jmp 0x2308
movl -0x2c(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movl %edx, %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
movq %rax, %rcx
movl -0x2c(%rbp), %eax
movl $0x40, %esi
cltd
idivl %esi
cltq
orq -0xb0(%rbp,%rax,8), %rcx
movq %rcx, -0xb0(%rbp,%rax,8)
movl -0x2c(%rbp), %edi
addl $0x1, %edi
xorl %eax, %eax
movl %eax, %r8d
leaq -0xb0(%rbp), %rdx
movq %r8, %rsi
movq %r8, %rcx
callq 0x1120
movl %eax, %ecx
movl %ecx, -0x18(%rbp)
xorl %eax, %eax
cmpl $-0x1, %ecx
movb %al, -0xd1(%rbp)
jne 0x237f
callq 0x1030
cmpl $0x4, (%rax)
sete %al
movb %al, -0xd1(%rbp)
movb -0xd1(%rbp), %al
testb $0x1, %al
jne 0x238e
jmp 0x2418
jmp 0x2390
leaq -0xb0(%rbp), %rax
movq %rax, -0xd0(%rbp)
movl $0x0, -0xc4(%rbp)
movl -0xc4(%rbp), %eax
cmpq $0x10, %rax
jae 0x23da
movq -0xd0(%rbp), %rax
movl -0xc4(%rbp), %ecx
movq $0x0, (%rax,%rcx,8)
movl -0xc4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc4(%rbp)
jmp 0x23a8
jmp 0x23dc
movl -0x2c(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movl %edx, %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
movq %rax, %rcx
movl -0x2c(%rbp), %eax
movl $0x40, %esi
cltd
idivl %esi
cltq
orq -0xb0(%rbp,%rax,8), %rcx
movq %rcx, -0xb0(%rbp,%rax,8)
jmp 0x233f
jmp 0x241a
cmpl $-0x1, -0x18(%rbp)
jne 0x247f
callq 0x1030
movl (%rax), %eax
movl %eax, -0x14(%rbp)
movl -0x2c(%rbp), %edi
callq 0x10e0
movl %eax, %ecx
xorl %eax, %eax
cmpl $-0x1, %ecx
movb %al, -0xd2(%rbp)
jne 0x2452
callq 0x1030
cmpl $0x4, (%rax)
sete %al
movb %al, -0xd2(%rbp)
movb -0xd2(%rbp), %al
testb $0x1, %al
jne 0x245e
jmp 0x2460
jmp 0x242a
movl -0x14(%rbp), %eax
movl %eax, -0xd8(%rbp)
callq 0x1030
movl -0xd8(%rbp), %ecx
movl %ecx, (%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2485
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xe0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)