#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
scalar_t__ create_and_connect(char *, int, int);
int /*<<< orphan*/ deleteSock(int, int);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ sleep(int);
void push_next_target(int evSockDesc, int fd, int i, char *ip, int port) {
  deleteSock((int)evSockDesc, fd);
  if (create_and_connect(ip, port, evSockDesc) != 0) {
    sleep(1);
  }
  if (ip != NULL) {
    free(ip);
  }
}


x86 assembly (clang, -O0):
<push_next_target>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <deleteSock@plt>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x4(%rbp),%edx
call   1050 <create_and_connect@plt>
cmp    $0x0,%rax
je     1187 <push_next_target+0x47>
mov    $0x1,%edi
call   1060 <sleep@plt>
cmpq   $0x0,-0x18(%rbp)
je     119b <push_next_target+0x5b>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<push_next_target>:
push   %rbp
push   %r14
push   %rbx
mov    %r8d,%r14d
mov    %rcx,%rbx
mov    %edi,%ebp
call   1040 <deleteSock@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
mov    %ebp,%edx
call   1050 <create_and_connect@plt>
test   %rax,%rax
je     116d <push_next_target+0x2d>
mov    $0x1,%edi
call   1060 <sleep@plt>
test   %rbx,%rbx
je     117e <push_next_target+0x3e>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <free@plt>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @push_next_target(i32 %0, i32 %1, i32 %2, i8* %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i8* %3, i8** %9
store i32 %4, i32* %10
%11 = load i32, i32* %6
%12 = load i32, i32* %7
%13 = call i32 @deleteSock(i32 %11, i32 %12)
%14 = load i8*, i8** %9
%15 = load i32, i32* %10
%16 = load i32, i32* %6
%17 = call i64 @create_and_connect(i8* %14, i32 %15, i32 %16)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %5
%20 = call i32 @sleep(i32 1)
br label %21
21: ; preds = %19, %5
%22 = load i8*, i8** %9
%23 = icmp ne i8* %22, null
br i1 %23, label %24, label %27
24: ; preds = %21
%25 = load i8*, i8** %9
%26 = call i32 @free(i8* %25)
br label %27
27: ; preds = %24, %21
ret void
}

LLVM IR (-O2):
define void @push_next_target(i32 %0, i32 %1, i32 %2, i8* %3, i32 %4) {
%6 = tail call i32 @deleteSock(i32 %0, i32 %1)
%7 = tail call i64 @create_and_connect(i8* %3, i32 %4, i32 %0)
%8 = icmp eq i64 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %5
%10 = tail call i32 @sleep(i32 1)
br label %11
11: ; preds = %9, %5
%12 = icmp eq i8* %3, null
br i1 %12, label %15, label %13
13: ; preds = %11
%14 = tail call i32 @free(i8* %3)
br label %15
15: ; preds = %13, %11
ret void
}