// File: /workspace/github_c_makefile_star2_O2/mabdi[P]bunney/bunny-flow.c
// Function: commit_connect
static void commit_connect(_u32 daddr,_u16 dport,_u8 udp) {
  _s32 csock;
  struct sockaddr_in sin;
  
  if (lport) { close(lsock); lport = 0; }
  
  csock = socket(AF_INET, udp ? SOCK_DGRAM : SOCK_STREAM, 0); 
  if (csock < 0) pfatal("socket() failed");
  
  sin.sin_family      = AF_INET;
  sin.sin_port        = dport;
  sin.sin_addr.s_addr = daddr;
  
try_connect_again:
  
  if (connect(csock, (struct sockaddr*)&sin, sizeof(sin))) {
  
    if (errno == ECONNREFUSED) {
      fd_set fds;
      FD_ZERO(&fds);
      FD_SET(0,&fds);

      if (select(1, &fds, 0, &fds, 0) < 0) 
        pfatal("select failed");

      if (FD_ISSET(0,&fds)) {
        debug("NOTE: connect() loop aborted by control command (something went wrong!)\n");
	close(csock);
        return;
      } else {
        sched_yield();
        goto try_connect_again;
      }

    }

    close(csock);
    debug("WARNING: Unable to initialize network connection to target.\n");
    return;
    
  }
  
  commit_data_fd(csock);
  
  close(csock);

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x90, %rsp
movl %edx, %ebx
movl %esi, %r15d
movl %edi, %ebp
cmpw $0x0, 0x53ed(%rip)      # 0x81a8
je 0x2dd0
movl 0x53e9(%rip), %edi      # 0x81ac
callq 0x12a0
andw $0x0, 0x53d8(%rip)      # 0x81a8
cmpb $0x1, %bl
pushq $0x2
popq %rdi
movl %edi, %esi
sbbl $0x0, %esi
xorl %edx, %edx
callq 0x1050
testl %eax, %eax
js 0x2f17
movl %eax, %ebx
movq %rsp, %r14
movw $0x2, (%r14)
movw %r15w, 0x2(%r14)
movl %ebp, 0x4(%r14)
pushq $0x10
popq %rbp
pushq $0x1
popq %r15
leaq 0x10(%rsp), %r12
movl %ebx, %edi
movq %r14, %rsi
movl %ebp, %edx
callq 0x10f0
testl %eax, %eax
je 0x2e61
callq 0x1030
cmpl $0x6f, (%rax)
jne 0x2e7f
xorl %eax, %eax
cmpq $0x10, %rax
je 0x2e37
andq $0x0, 0x10(%rsp,%rax,8)
incq %rax
jmp 0x2e26
orb $0x1, 0x10(%rsp)
movl %r15d, %edi
movq %r12, %rsi
xorl %edx, %edx
movq %r12, %rcx
xorl %r8d, %r8d
callq 0x1120
testl %eax, %eax
js 0x2ec2
testb $0x1, 0x10(%rsp)
jne 0x2ea4
callq 0x11d0
jmp 0x2e0a
movl %ebx, %edi
callq 0x3475
movl %ebx, %edi
callq 0x12a0
addq $0x90, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl %ebx, %edi
callq 0x12a0
movq 0x4153(%rip), %rax      # 0x6fe0
movq (%rax), %rcx
leaq 0x1939(%rip), %rdi      # 0x47d0
pushq $0x3c
popq %rsi
pushq $0x1
popq %rdx
callq 0x1290
jmp 0x2e6f
movq 0x4135(%rip), %rax      # 0x6fe0
movq (%rax), %rcx
leaq 0x18d2(%rip), %rdi      # 0x4787
pushq $0x48
popq %rsi
pushq $0x1
popq %rdx
callq 0x1290
jmp 0x2e68
movq 0x4117(%rip), %rbx      # 0x6fe0
movq (%rbx), %rcx
leaq 0x1890(%rip), %rdi      # 0x4763
pushq $0x23
popq %rsi
pushq $0x1
popq %rdx
callq 0x1290
movq (%rbx), %rdi
leaq 0x1184(%rip), %rsi      # 0x406c
leaq 0x1865(%rip), %rdx      # 0x4754
leaq 0x118b(%rip), %rcx      # 0x4081
movl $0x254, %r8d            # imm = 0x254
xorl %eax, %eax
callq 0x11b0
leaq 0x1242(%rip), %rdi      # 0x414c
callq 0x1100
pushq $0x1
popq %rdi
callq 0x1180
movq 0x40c2(%rip), %rbx      # 0x6fe0
movq (%rbx), %rcx
leaq 0x1806(%rip), %rdi      # 0x472e
pushq $0x25
popq %rsi
pushq $0x1
popq %rdx
callq 0x1290
movq (%rbx), %rdi
leaq 0x112f(%rip), %rsi      # 0x406c
leaq 0x1810(%rip), %rdx      # 0x4754
leaq 0x1136(%rip), %rcx      # 0x4081
movl $0x244, %r8d            # imm = 0x244
jmp 0x2efc