#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 */
typedef int /*<<< orphan*/ uint16_t;
struct sockaddr_in {
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_addr;
};
struct sockaddr {
  int dummy;
};
typedef int socklen_t;
typedef int pid_t;
typedef int /*<<< orphan*/ child_addr;

/* Variables and functions */
int /*<<< orphan*/ STDERR_FILENO;
int /*<<< orphan*/ STDIN_FILENO;
int /*<<< orphan*/ STDOUT_FILENO;
int /*<<< orphan*/ WNOHANG;
int accept(int, struct sockaddr *, int *);
int /*<<< orphan*/ close(int);
int create_listener(int /*<<< orphan*/);
int /*<<< orphan*/ dup2(int, int /*<<< orphan*/);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ execvp(char *, char **);
int fork();
char *inet_ntoa(int /*<<< orphan*/);
int /*<<< orphan*/ ntohs(int /*<<< orphan*/);
int /*<<< orphan*/ parse_port(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ perror(char *);
int print_usage(char *);
int /*<<< orphan*/ setenv(char *, char *, int);
int /*<<< orphan*/ setenv_number(char *, int /*<<< orphan*/);
int /*<<< orphan*/ should_retry_accept(int /*<<< orphan*/);
scalar_t__ waitpid(int, int /*<<< orphan*/ *, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  if (argv[0] == NULL)
    argv[0] = "server";
  if (argc < 3)
    return print_usage(argv[0]);
  uint16_t port;
  if (!parse_port(&port, argv[1], argv[0]))
    return 1;
  setenv("PROTO", "TCP", 1);
  setenv("TCPLOCALIP", "0.0.0.0", 1);
  setenv_number("TCPLOCALPORT", port);
  int listener = create_listener(port);
  if (listener == -1) {
    perror("error creating listener");
    return 1;
  }
  for (;;) {
    struct sockaddr_in child_addr;
    socklen_t child_addr_len = sizeof(child_addr);
    int child_sock =
        accept(listener, (struct sockaddr *)&child_addr, &child_addr_len);
    if (child_sock != -1) {
      pid_t child_pid = fork();
      if (child_pid == -1) {
        perror("error forking child process");
        return 1;
      }
      if (child_pid == 0) {
        dup2(child_sock, STDIN_FILENO);
        dup2(child_sock, STDOUT_FILENO);
        dup2(child_sock, STDERR_FILENO);
        close(child_sock);
        close(listener);
        setenv("TCPREMOTEIP", inet_ntoa(child_addr.sin_addr), 1);
        setenv_number("TCPREMOTEPORT", ntohs(child_addr.sin_port));
        execvp(argv[2], &argv[2]);
        perror("error executing child process");
        return 1;
      }
      close(child_sock);
      while (waitpid(-1, NULL, WNOHANG) > 0)
        ;
    } else {
      if (!should_retry_accept(errno)) {
        perror("error accepting connections");
        return 1;
      }
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
jne    1222 <main+0x32>
mov    -0x10(%rbp),%rax
lea    0xde1(%rip),%rcx
mov    %rcx,(%rax)
cmpl   $0x3,-0x8(%rbp)
jge    1240 <main+0x50>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1100 <print_usage@plt>
mov    %eax,-0x4(%rbp)
jmp    1446 <main+0x256>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    -0x14(%rbp),%rdi
call   1070 <parse_port@plt>
cmp    $0x0,%eax
jne    126d <main+0x7d>
movl   $0x1,-0x4(%rbp)
jmp    1446 <main+0x256>
lea    0xd93(%rip),%rdi
lea    0xd92(%rip),%rsi
mov    $0x1,%edx
call   1030 <setenv@plt>
lea    0xd85(%rip),%rdi
lea    0xd89(%rip),%rsi
mov    $0x1,%edx
call   1030 <setenv@plt>
mov    -0x14(%rbp),%esi
lea    0xd7d(%rip),%rdi
call   10b0 <setenv_number@plt>
mov    -0x14(%rbp),%edi
call   1080 <create_listener@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xffffffff,-0x18(%rbp)
jne    12d9 <main+0xe9>
lea    0xd69(%rip),%rdi
call   10d0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1446 <main+0x256>
jmp    12de <main+0xee>
movl   $0x8,-0x24(%rbp)
mov    -0x18(%rbp),%edi
lea    -0x20(%rbp),%rsi
lea    -0x24(%rbp),%rdx
call   10e0 <accept@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0xffffffff,-0x28(%rbp)
je     140d <main+0x21d>
mov    $0x0,%al
call   1110 <fork@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0xffffffff,-0x2c(%rbp)
jne    132e <main+0x13e>
lea    0xd2c(%rip),%rdi
call   10d0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1446 <main+0x256>
cmpl   $0x0,-0x2c(%rbp)
jne    13da <main+0x1ea>
mov    -0x28(%rbp),%edi
mov    0x2c7e(%rip),%rax
mov    (%rax),%esi
call   1050 <dup2@plt>
mov    -0x28(%rbp),%edi
mov    0x2c9d(%rip),%rax
mov    (%rax),%esi
call   1050 <dup2@plt>
mov    -0x28(%rbp),%edi
mov    0x2c64(%rip),%rax
mov    (%rax),%esi
call   1050 <dup2@plt>
mov    -0x28(%rbp),%edi
call   1060 <close@plt>
mov    -0x18(%rbp),%edi
call   1060 <close@plt>
mov    -0x1c(%rbp),%edi
call   1040 <inet_ntoa@plt>
mov    %rax,%rsi
lea    0xcd8(%rip),%rdi
mov    $0x1,%edx
call   1030 <setenv@plt>
mov    -0x20(%rbp),%edi
call   10a0 <ntohs@plt>
mov    %eax,%esi
lea    0xcc9(%rip),%rdi
call   10b0 <setenv_number@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x10(%rbp),%rsi
add    $0x10,%rsi
call   10f0 <execvp@plt>
lea    0xcb6(%rip),%rdi
call   10d0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1446 <main+0x256>
mov    -0x28(%rbp),%edi
call   1060 <close@plt>
mov    0x2bf7(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%edi
xor    %eax,%eax
mov    %eax,%esi
call   10c0 <waitpid@plt>
cmp    $0x0,%rax
jle    1408 <main+0x218>
jmp    13e2 <main+0x1f2>
jmp    1441 <main+0x251>
mov    0x2bbc(%rip),%rax
mov    (%rax),%edi
call   1090 <should_retry_accept@plt>
cmp    $0x0,%eax
jne    143c <main+0x24c>
lea    0xc72(%rip),%rdi
call   10d0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1446 <main+0x256>
jmp    1441 <main+0x251>
jmp    12de <main+0xee>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r15
mov    (%rsi),%rdx
test   %rdx,%rdx
je     1224 <main+0x34>
cmp    $0x2,%edi
jg     1233 <main+0x43>
mov    %rdx,%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1100 <print_usage@plt>
lea    0xdd5(%rip),%rdx
mov    %rdx,(%r15)
cmp    $0x2,%edi
jle    120e <main+0x1e>
mov    0x8(%r15),%rsi
lea    0x8(%rsp),%rdi
call   1070 <parse_port@plt>
test   %eax,%eax
jne    1259 <main+0x69>
mov    $0x1,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xda7(%rip),%rdi
lea    0xda6(%rip),%rsi
mov    $0x1,%edx
call   1030 <setenv@plt>
lea    0xd99(%rip),%rdi
lea    0xd9d(%rip),%rsi
mov    $0x1,%edx
call   1030 <setenv@plt>
mov    0x8(%rsp),%esi
lea    0xd90(%rip),%rdi
call   10b0 <setenv_number@plt>
mov    0x8(%rsp),%edi
call   1080 <create_listener@plt>
cmp    $0xffffffff,%eax
jne    12b3 <main+0xc3>
lea    0xd83(%rip),%rdi
jmp    13d4 <main+0x1e4>
mov    %eax,%ebp
lea    0x10(%rsp),%r12
lea    0xc(%rsp),%r13
mov    0x2d1a(%rip),%r14
jmp    12e6 <main+0xf6>
nopl   0x0(%rax,%rax,1)
mov    0x2cf9(%rip),%rax
mov    (%rax),%edi
call   1090 <should_retry_accept@plt>
test   %eax,%eax
je     13cd <main+0x1dd>
movl   $0x8,0xc(%rsp)
mov    %ebp,%edi
mov    %r12,%rsi
mov    %r13,%rdx
call   10e0 <accept@plt>
cmp    $0xffffffff,%eax
je     12d0 <main+0xe0>
mov    %eax,%ebx
xor    %eax,%eax
call   1110 <fork@plt>
cmp    $0xffffffff,%eax
je     1336 <main+0x146>
test   %eax,%eax
je     1342 <main+0x152>
mov    %ebx,%edi
call   1060 <close@plt>
nopl   0x0(%rax)
mov    (%r14),%edx
mov    $0xffffffff,%edi
xor    %esi,%esi
call   10c0 <waitpid@plt>
test   %rax,%rax
jg     1320 <main+0x130>
jmp    12e6 <main+0xf6>
lea    0xd0c(%rip),%rdi
jmp    13d4 <main+0x1e4>
mov    0x2c77(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
call   1050 <dup2@plt>
mov    0x2c97(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
call   1050 <dup2@plt>
mov    0x2c5f(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
call   1050 <dup2@plt>
mov    %ebx,%edi
call   1060 <close@plt>
mov    %ebp,%edi
call   1060 <close@plt>
mov    0x14(%rsp),%edi
call   1040 <inet_ntoa@plt>
lea    0xcd5(%rip),%rdi
mov    %rax,%rsi
mov    $0x1,%edx
call   1030 <setenv@plt>
mov    0x10(%rsp),%edi
call   10a0 <ntohs@plt>
lea    0xcc4(%rip),%rdi
mov    %eax,%esi
call   10b0 <setenv_number@plt>
mov    0x10(%r15),%rdi
add    $0x10,%r15
mov    %r15,%rsi
call   10f0 <execvp@plt>
lea    0xcb4(%rip),%rdi
jmp    13d4 <main+0x1e4>
lea    0xcc9(%rip),%rdi
call   10d0 <perror@plt>
jmp    1245 <main+0x55>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, i32 }
%struct.sockaddr = type { i32 }
@.str = [7 x i8] c"server\00"
@.str.1 = [6 x i8] c"PROTO\00"
@.str.2 = [4 x i8] c"TCP\00"
@.str.3 = [11 x i8] c"TCPLOCALIP\00"
@.str.4 = [8 x i8] c"0.0.0.0\00"
@.str.5 = [13 x i8] c"TCPLOCALPORT\00"
@.str.6 = [24 x i8] c"error creating listener\00"
@.str.7 = [28 x i8] c"error forking child process\00"
@STDIN_FILENO = global i32 0
@STDOUT_FILENO = global i32 0
@STDERR_FILENO = global i32 0
@.str.8 = [12 x i8] c"TCPREMOTEIP\00"
@.str.9 = [14 x i8] c"TCPREMOTEPORT\00"
@.str.10 = [30 x i8] c"error executing child process\00"
@WNOHANG = global i32 0
@errno = global i32 0
@.str.11 = [28 x i8] c"error accepting connections\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.sockaddr_in
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 0
%14 = load i8*, i8** %13
%15 = icmp eq i8* %14, null
br i1 %15, label %16, label %19
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 0
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %18
br label %19
19: ; preds = %16, %2
%20 = load i32, i32* %4
%21 = icmp slt i32 %20, 3
br i1 %21, label %22, label %27
22: ; preds = %19
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 0
%25 = load i8*, i8** %24
%26 = call i32 @print_usage(i8* %25)
store i32 %26, i32* %3
br label %110
27: ; preds = %19
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 0
%33 = load i8*, i8** %32
%34 = call i32 @parse_port(i32* %6, i8* %30, i8* %33)
%35 = icmp ne i32 %34, 0
br i1 %35, label %37, label %36
36: ; preds = %27
store i32 1, i32* %3
br label %110
37: ; preds = %27
%38 = call i32 @setenv(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 1)
%39 = call i32 @setenv(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32 1)
%40 = load i32, i32* %6
%41 = call i32 @setenv_number(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 %40)
%42 = load i32, i32* %6
%43 = call i32 @create_listener(i32 %42)
store i32 %43, i32* %7
%44 = load i32, i32* %7
%45 = icmp eq i32 %44, -1
br i1 %45, label %46, label %48
46: ; preds = %37
%47 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
store i32 1, i32* %3
br label %110
48: ; preds = %37
br label %49
49: ; preds = %109, %48
store i32 8, i32* %9
%50 = load i32, i32* %7
%51 = bitcast %struct.sockaddr_in* %8 to %struct.sockaddr*
%52 = call i32 @accept(i32 %50, %struct.sockaddr* %51, i32* %9)
store i32 %52, i32* %10
%53 = load i32, i32* %10
%54 = icmp ne i32 %53, -1
br i1 %54, label %55, label %102
55: ; preds = %49
%56 = call i32 (...) @fork()
store i32 %56, i32* %11
%57 = load i32, i32* %11
%58 = icmp eq i32 %57, -1
br i1 %58, label %59, label %61
59: ; preds = %55
%60 = call i32 @perror(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0))
store i32 1, i32* %3
br label %110
61: ; preds = %55
%62 = load i32, i32* %11
%63 = icmp eq i32 %62, 0
br i1 %63, label %64, label %93
64: ; preds = %61
%65 = load i32, i32* %10
%66 = load i32, i32* @STDIN_FILENO
%67 = call i32 @dup2(i32 %65, i32 %66)
%68 = load i32, i32* %10
%69 = load i32, i32* @STDOUT_FILENO
%70 = call i32 @dup2(i32 %68, i32 %69)
%71 = load i32, i32* %10
%72 = load i32, i32* @STDERR_FILENO
%73 = call i32 @dup2(i32 %71, i32 %72)
%74 = load i32, i32* %10
%75 = call i32 @close(i32 %74)
%76 = load i32, i32* %7
%77 = call i32 @close(i32 %76)
%78 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 1
%79 = load i32, i32* %78
%80 = call i8* @inet_ntoa(i32 %79)
%81 = call i32 @setenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %80, i32 1)
%82 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 0
%83 = load i32, i32* %82
%84 = call i32 @ntohs(i32 %83)
%85 = call i32 @setenv_number(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0), i32 %84)
%86 = load i8**, i8*** %5
%87 = getelementptr inbounds i8*, i8** %86, i64 2
%88 = load i8*, i8** %87
%89 = load i8**, i8*** %5
%90 = getelementptr inbounds i8*, i8** %89, i64 2
%91 = call i32 @execvp(i8* %88, i8** %90)
%92 = call i32 @perror(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.10, i64 0, i64 0))
store i32 1, i32* %3
br label %110
93: ; preds = %61
%94 = load i32, i32* %10
%95 = call i32 @close(i32 %94)
br label %96
96: ; preds = %100, %93
%97 = load i32, i32* @WNOHANG
%98 = call i64 @waitpid(i32 -1, i32* null, i32 %97)
%99 = icmp sgt i64 %98, 0
br i1 %99, label %100, label %101
100: ; preds = %96
br label %96
101: ; preds = %96
br label %109
102: ; preds = %49
%103 = load i32, i32* @errno
%104 = call i32 @should_retry_accept(i32 %103)
%105 = icmp ne i32 %104, 0
br i1 %105, label %108, label %106
106: ; preds = %102
%107 = call i32 @perror(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.11, i64 0, i64 0))
store i32 1, i32* %3
br label %110
108: ; preds = %102
br label %109
109: ; preds = %108, %101
br label %49
110: ; preds = %106, %64, %59, %46, %36, %22
%111 = load i32, i32* %3
ret i32 %111
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, i32 }
%struct.sockaddr = type { i32 }
@.str = [7 x i8] c"server\00"
@.str.1 = [6 x i8] c"PROTO\00"
@.str.2 = [4 x i8] c"TCP\00"
@.str.3 = [11 x i8] c"TCPLOCALIP\00"
@.str.4 = [8 x i8] c"0.0.0.0\00"
@.str.5 = [13 x i8] c"TCPLOCALPORT\00"
@.str.6 = [24 x i8] c"error creating listener\00"
@.str.7 = [28 x i8] c"error forking child process\00"
@STDIN_FILENO = global i32 0
@STDOUT_FILENO = global i32 0
@STDERR_FILENO = global i32 0
@.str.8 = [12 x i8] c"TCPREMOTEIP\00"
@.str.9 = [14 x i8] c"TCPREMOTEPORT\00"
@.str.10 = [30 x i8] c"error executing child process\00"
@WNOHANG = global i32 0
@errno = global i32 0
@.str.11 = [28 x i8] c"error accepting connections\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca %struct.sockaddr_in
%5 = alloca i32
%6 = load i8*, i8** %1
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %9
8: ; preds = %2
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %1
br label %9
9: ; preds = %8, %2
%10 = phi i8* [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %8 ], [ %6, %2 ]
%11 = icmp slt i32 %0, 3
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = tail call i32 @print_usage(i8* %10)
br label %74
14: ; preds = %9
%15 = bitcast i32* %3 to i8*
%16 = getelementptr inbounds i8*, i8** %1, i64 1
%17 = load i8*, i8** %16
%18 = call i32 @parse_port(i32* %3, i8* %17, i8* %10)
%19 = icmp eq i32 %18, 0
br i1 %19, label %73, label %20
20: ; preds = %14
%21 = call i32 @setenv(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 1)
%22 = call i32 @setenv(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32 1)
%23 = load i32, i32* %3
%24 = call i32 @setenv_number(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 %23)
%25 = load i32, i32* %3
%26 = call i32 @create_listener(i32 %25)
%27 = icmp eq i32 %26, -1
br i1 %27, label %32, label %28
28: ; preds = %20
%29 = bitcast %struct.sockaddr_in* %4 to i8*
%30 = bitcast i32* %5 to i8*
%31 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
br label %34
32: ; preds = %20
%33 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
br label %73
34: ; preds = %28, %72
store i32 8, i32* %5
%35 = call i32 @accept(i32 %26, %struct.sockaddr* %31, i32* %5)
%36 = icmp eq i32 %35, -1
br i1 %36, label %65, label %37
37: ; preds = %34
%38 = call i32 (...) @fork()
switch i32 %38, label %59 [
i32 -1, label %69
i32 0, label %39
]
39: ; preds = %37
%40 = load i32, i32* @STDIN_FILENO
%41 = call i32 @dup2(i32 %35, i32 %40)
%42 = load i32, i32* @STDOUT_FILENO
%43 = call i32 @dup2(i32 %35, i32 %42)
%44 = load i32, i32* @STDERR_FILENO
%45 = call i32 @dup2(i32 %35, i32 %44)
%46 = call i32 @close(i32 %35)
%47 = call i32 @close(i32 %26)
%48 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 1
%49 = load i32, i32* %48
%50 = call i8* @inet_ntoa(i32 %49)
%51 = call i32 @setenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %50, i32 1)
%52 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 0
%53 = load i32, i32* %52
%54 = call i32 @ntohs(i32 %53)
%55 = call i32 @setenv_number(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0), i32 %54)
%56 = getelementptr inbounds i8*, i8** %1, i64 2
%57 = load i8*, i8** %56
%58 = call i32 @execvp(i8* %57, i8** %56)
br label %69
59: ; preds = %37
%60 = call i32 @close(i32 %35)
br label %61
61: ; preds = %61, %59
%62 = load i32, i32* @WNOHANG
%63 = call i64 @waitpid(i32 -1, i32* null, i32 %62)
%64 = icmp sgt i64 %63, 0
br i1 %64, label %61, label %72
65: ; preds = %34
%66 = load i32, i32* @errno
%67 = call i32 @should_retry_accept(i32 %66)
%68 = icmp eq i32 %67, 0
br i1 %68, label %69, label %72
69: ; preds = %65, %37, %39
%70 = phi i8* [ getelementptr inbounds ([30 x i8], [30 x i8]* @.str.10, i64 0, i64 0), %39 ], [ getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), %37 ], [ getelementptr inbounds ([28 x i8], [28 x i8]* @.str.11, i64 0, i64 0), %65 ]
%71 = call i32 @perror(i8* %70)
br label %73
72: ; preds = %61, %65
br label %34
73: ; preds = %69, %32, %14
br label %74
74: ; preds = %73, %12
%75 = phi i32 [ %13, %12 ], [ 1, %73 ]
ret i32 %75
}