#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 */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
typedef scalar_t__ uint16_t;
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_family;
  int /*<<< orphan*/ member_0;
};
struct sockaddr {
  int dummy;
};
typedef scalar_t__ pid_t;
typedef int /*<<< orphan*/ control_addr;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ SOCK_STREAM;
int accept(int, struct sockaddr *, int /*<<< orphan*/ *);
scalar_t__ atoi(char *);
int bind(int, struct sockaddr const *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ fork();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ ftp_do_control(int);
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
int /*<<< orphan*/ htons(scalar_t__);
scalar_t__ inet_aton(char const *, TYPE_1__ *);
int listen(int, int);
int /*<<< orphan*/ perror(char *);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  uint16_t port;
  if (argc < 2 || (port = atoi(argv[1])) <= 0) {
    fputs("Error: invalid port\n", stderr);
    return 1;
  }
  struct sockaddr_in control_addr = {0};
  control_addr.sin_family = AF_INET;
  control_addr.sin_addr.s_addr = htonl(INADDR_ANY);
  control_addr.sin_port = htons(port);
  const char *ip = "0.0.0.0";
  if (argc > 2) {
    ip = argv[2];
    if (inet_aton(ip, &(control_addr.sin_addr)) == 0) {
      fputs("Error: invalid IP\n", stderr);
      return 1;
    }
  }
  int control_listen_socket;
  if ((control_listen_socket = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
    perror("socket");
    return 1;
  }
  fputs("Opened main socket\n", stderr);
  if (bind(control_listen_socket, (const struct sockaddr *)&control_addr,
           sizeof(control_addr)) == -1) {
    perror("bind");
    close(control_listen_socket);
    return 1;
  }
  fputs("Bound main socket\n", stderr);
  if (listen(control_listen_socket, 1) == -1) {
    perror("listen");
    close(control_listen_socket);
    return 1;
  }
  fprintf(stderr, "Listening at %s:%u\n", ip, (unsigned int)port);
  for (;;) {
    int control_socket =
        accept(control_listen_socket, (struct sockaddr *)NULL, NULL);
    if (control_socket == -1) {
      perror("accept");
      continue;
    }
    fprintf(stderr, "accept %d\n", control_socket);
    pid_t child = fork();
    if (child < 0) {
      perror("fork");
    }
    if (child == 0) {
      close(control_listen_socket);
      fputs("do_control\n", stderr);
      ftp_do_control(control_socket);
      exit(0);
    } else {
      close(control_socket);
    }
  }
  close(control_listen_socket);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jl     123b <main+0x3b>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10f0 <atoi@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jg     125c <main+0x5c>
mov    0x2d8e(%rip),%rax
mov    (%rax),%esi
lea    0xdb5(%rip),%rdi
call   1050 <fputs@plt>
movl   $0x1,-0x4(%rbp)
jmp    1498 <main+0x298>
lea    -0x28(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1070 <memset@plt>
mov    0x2d75(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    0x2d61(%rip),%rax
mov    (%rax),%edi
call   1060 <htonl@plt>
mov    %eax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <htons@plt>
mov    %eax,-0x24(%rbp)
lea    0xd79(%rip),%rax
mov    %rax,-0x30(%rbp)
cmpl   $0x2,-0x8(%rbp)
jle    12f3 <main+0xf3>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   10a0 <inet_aton@plt>
cmp    $0x0,%rax
jne    12ee <main+0xee>
mov    0x2cfc(%rip),%rax
mov    (%rax),%esi
lea    0xd40(%rip),%rdi
call   1050 <fputs@plt>
movl   $0x1,-0x4(%rbp)
jmp    1498 <main+0x298>
jmp    12f3 <main+0xf3>
mov    0x2cee(%rip),%rax
mov    (%rax),%edi
mov    0x2cc5(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1120 <socket@plt>
mov    %eax,-0x34(%rbp)
cmp    $0xffffffff,%eax
jne    1330 <main+0x130>
lea    0xd11(%rip),%rdi
call   10d0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1498 <main+0x298>
mov    0x2c99(%rip),%rax
mov    (%rax),%esi
lea    0xcf7(%rip),%rdi
call   1050 <fputs@plt>
mov    -0x34(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0x10,%edx
call   10c0 <bind@plt>
cmp    $0xffffffff,%eax
jne    137f <main+0x17f>
lea    0xce5(%rip),%rdi
call   10d0 <perror@plt>
mov    -0x34(%rbp),%edi
call   1080 <close@plt>
movl   $0x1,-0x4(%rbp)
jmp    1498 <main+0x298>
mov    0x2c4a(%rip),%rax
mov    (%rax),%esi
lea    0xcc1(%rip),%rdi
call   1050 <fputs@plt>
mov    -0x34(%rbp),%edi
mov    $0x1,%esi
call   10b0 <listen@plt>
cmp    $0xffffffff,%eax
jne    13ca <main+0x1ca>
lea    0xcb2(%rip),%rdi
call   10d0 <perror@plt>
mov    -0x34(%rbp),%edi
call   1080 <close@plt>
movl   $0x1,-0x4(%rbp)
jmp    1498 <main+0x298>
mov    0x2bff(%rip),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%rdx
mov    -0x18(%rbp),%rax
mov    %eax,%ecx
lea    0xc86(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x34(%rbp),%edi
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rsi
call   10e0 <accept@plt>
mov    %eax,-0x38(%rbp)
cmpl   $0xffffffff,-0x38(%rbp)
jne    1418 <main+0x218>
lea    0xc70(%rip),%rdi
call   10d0 <perror@plt>
jmp    13eb <main+0x1eb>
mov    0x2bb1(%rip),%rax
mov    (%rax),%edi
mov    -0x38(%rbp),%edx
lea    0xc5a(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x0,%al
call   1110 <fork@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jge    1454 <main+0x254>
lea    0xc41(%rip),%rdi
call   10d0 <perror@plt>
cmpq   $0x0,-0x40(%rbp)
jne    148b <main+0x28b>
mov    -0x34(%rbp),%edi
call   1080 <close@plt>
mov    0x2b62(%rip),%rax
mov    (%rax),%esi
lea    0xc1e(%rip),%rdi
call   1050 <fputs@plt>
mov    -0x38(%rbp),%edi
call   1030 <ftp_do_control@plt>
xor    %edi,%edi
call   1100 <exit@plt>
mov    -0x38(%rbp),%edi
call   1080 <close@plt>
jmp    13eb <main+0x1eb>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
cmp    $0x2,%edi
jl     127a <main+0x8a>
mov    %rsi,%rbp
mov    %edi,%ebx
mov    0x8(%rsi),%rdi
call   10e0 <atoi@plt>
test   %rax,%rax
jle    127a <main+0x8a>
mov    %rax,%r15
movl   $0x0,0x14(%rsp)
mov    0x2dc0(%rip),%r14
mov    (%r14),%eax
mov    %eax,0x10(%rsp)
mov    0x2daa(%rip),%rax
mov    (%rax),%edi
call   1060 <htonl@plt>
mov    %eax,0x8(%rsp)
mov    %r15,%rdi
call   1040 <htons@plt>
mov    %eax,0xc(%rsp)
cmp    $0x3,%ebx
jb     12a3 <main+0xb3>
mov    0x10(%rbp),%rbp
lea    0x8(%rsp),%rsi
mov    %rbp,%rdi
call   1090 <inet_aton@plt>
test   %rax,%rax
jne    12aa <main+0xba>
mov    0x2d61(%rip),%rax
mov    (%rax),%esi
lea    0xda5(%rip),%rdi
jmp    128a <main+0x9a>
mov    0x2d4f(%rip),%rax
mov    (%rax),%esi
lea    0xd76(%rip),%rdi
call   1050 <fputs@plt>
mov    $0x1,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd6b(%rip),%rbp
mov    (%r14),%edi
mov    0x2d14(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1110 <socket@plt>
cmp    $0xffffffff,%eax
jne    12d0 <main+0xe0>
lea    0xd67(%rip),%rdi
call   10c0 <perror@plt>
jmp    128f <main+0x9f>
mov    %eax,%r14d
mov    0x2cf6(%rip),%r13
mov    0x0(%r13),%esi
lea    0xd52(%rip),%rdi
call   1050 <fputs@plt>
lea    0x8(%rsp),%rsi
mov    %r14d,%edi
mov    $0x10,%edx
call   10b0 <bind@plt>
cmp    $0xffffffff,%eax
jne    130a <main+0x11a>
lea    0xd43(%rip),%rdi
jmp    1333 <main+0x143>
mov    0x0(%r13),%esi
lea    0xd3b(%rip),%rdi
call   1050 <fputs@plt>
mov    %r14d,%edi
mov    $0x1,%esi
call   10a0 <listen@plt>
cmp    $0xffffffff,%eax
jne    1345 <main+0x155>
lea    0xd30(%rip),%rdi
call   10c0 <perror@plt>
mov    %r14d,%edi
call   1070 <close@plt>
jmp    128f <main+0x9f>
mov    0x0(%r13),%edi
lea    0xd1a(%rip),%rsi
mov    %rbp,%rdx
mov    %r15d,%ecx
xor    %eax,%eax
call   1080 <fprintf@plt>
lea    0xd1a(%rip),%r12
lea    0xd1a(%rip),%rbp
lea    0xd1e(%rip),%r15
jmp    137c <main+0x18c>
mov    %r12,%rdi
call   10c0 <perror@plt>
mov    %r14d,%edi
xor    %esi,%esi
xor    %edx,%edx
call   10d0 <accept@plt>
cmp    $0xffffffff,%eax
je     1374 <main+0x184>
mov    %eax,%ebx
mov    0x0(%r13),%edi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
xor    %eax,%eax
call   1100 <fork@plt>
test   %rax,%rax
js     13b6 <main+0x1c6>
je     13c0 <main+0x1d0>
mov    %ebx,%edi
call   1070 <close@plt>
jmp    137c <main+0x18c>
mov    %r15,%rdi
call   10c0 <perror@plt>
jmp    13ad <main+0x1bd>
mov    %r14d,%edi
call   1070 <close@plt>
mov    0x0(%r13),%esi
lea    0xcc2(%rip),%rdi
call   1050 <fputs@plt>
mov    %ebx,%edi
call   1030 <ftp_do_control@plt>
xor    %edi,%edi
call   10f0 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [21 x i8] c"Error: invalid port\0A\00"
@stderr = global i32 0
@AF_INET = global i32 0
@INADDR_ANY = global i32 0
@.str.1 = [8 x i8] c"0.0.0.0\00"
@.str.2 = [19 x i8] c"Error: invalid IP\0A\00"
@SOCK_STREAM = global i32 0
@.str.3 = [7 x i8] c"socket\00"
@.str.4 = [20 x i8] c"Opened main socket\0A\00"
@.str.5 = [5 x i8] c"bind\00"
@.str.6 = [19 x i8] c"Bound main socket\0A\00"
@.str.7 = [7 x i8] c"listen\00"
@.str.8 = [20 x i8] c"Listening at %s:%u\0A\00"
@.str.9 = [7 x i8] c"accept\00"
@.str.10 = [11 x i8] c"accept %d\0A\00"
@.str.11 = [5 x i8] c"fork\00"
@.str.12 = [12 x i8] c"do_control\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca %struct.sockaddr_in
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 2
br i1 %13, label %20, label %14
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i64 @atoi(i8* %17)
store i64 %18, i64* %6
%19 = icmp sle i64 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %14, %2
%21 = load i32, i32* @stderr
%22 = call i32 @fputs(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %21)
store i32 1, i32* %3
br label %113
23: ; preds = %14
%24 = bitcast %struct.sockaddr_in* %7 to i8*
%25 = load i32, i32* @AF_INET
%26 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 2
store i32 %25, i32* %26
%27 = load i32, i32* @INADDR_ANY
%28 = call i32 @htonl(i32 %27)
%29 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 0
%30 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %29, i32 0, i32 0
store i32 %28, i32* %30
%31 = load i64, i64* %6
%32 = call i32 @htons(i64 %31)
%33 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 1
store i32 %32, i32* %33
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %8
%34 = load i32, i32* %4
%35 = icmp sgt i32 %34, 2
br i1 %35, label %36, label %48
36: ; preds = %23
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 2
%39 = load i8*, i8** %38
store i8* %39, i8** %8
%40 = load i8*, i8** %8
%41 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 0
%42 = call i64 @inet_aton(i8* %40, %struct.TYPE_2__* %41)
%43 = icmp eq i64 %42, 0
br i1 %43, label %44, label %47
44: ; preds = %36
%45 = load i32, i32* @stderr
%46 = call i32 @fputs(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %45)
store i32 1, i32* %3
br label %113
47: ; preds = %36
br label %48
48: ; preds = %47, %23
%49 = load i32, i32* @AF_INET
%50 = load i32, i32* @SOCK_STREAM
%51 = call i32 @socket(i32 %49, i32 %50, i32 0)
store i32 %51, i32* %9
%52 = icmp eq i32 %51, -1
br i1 %52, label %53, label %55
53: ; preds = %48
%54 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %3
br label %113
55: ; preds = %48
%56 = load i32, i32* @stderr
%57 = call i32 @fputs(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i32 %56)
%58 = load i32, i32* %9
%59 = bitcast %struct.sockaddr_in* %7 to %struct.sockaddr*
%60 = call i32 @bind(i32 %58, %struct.sockaddr* %59, i32 16)
%61 = icmp eq i32 %60, -1
br i1 %61, label %62, label %66
62: ; preds = %55
%63 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%64 = load i32, i32* %9
%65 = call i32 @close(i32 %64)
store i32 1, i32* %3
br label %113
66: ; preds = %55
%67 = load i32, i32* @stderr
%68 = call i32 @fputs(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i32 %67)
%69 = load i32, i32* %9
%70 = call i32 @listen(i32 %69, i32 1)
%71 = icmp eq i32 %70, -1
br i1 %71, label %72, label %76
72: ; preds = %66
%73 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
%74 = load i32, i32* %9
%75 = call i32 @close(i32 %74)
store i32 1, i32* %3
br label %113
76: ; preds = %66
%77 = load i32, i32* @stderr
%78 = load i8*, i8** %8
%79 = load i64, i64* %6
%80 = trunc i64 %79 to i32
%81 = call i32 (i32, i8*, ...) @fprintf(i32 %77, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), i8* %78, i32 %80)
br label %82
82: ; preds = %112, %87, %76
%83 = load i32, i32* %9
%84 = call i32 @accept(i32 %83, %struct.sockaddr* null, i32* null)
store i32 %84, i32* %10
%85 = load i32, i32* %10
%86 = icmp eq i32 %85, -1
br i1 %86, label %87, label %89
87: ; preds = %82
%88 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
br label %82
89: ; preds = %82
%90 = load i32, i32* @stderr
%91 = load i32, i32* %10
%92 = call i32 (i32, i8*, ...) @fprintf(i32 %90, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i32 %91)
%93 = call i64 (...) @fork()
store i64 %93, i64* %11
%94 = load i64, i64* %11
%95 = icmp slt i64 %94, 0
br i1 %95, label %96, label %98
96: ; preds = %89
%97 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0))
br label %98
98: ; preds = %96, %89
%99 = load i64, i64* %11
%100 = icmp eq i64 %99, 0
br i1 %100, label %101, label %109
101: ; preds = %98
%102 = load i32, i32* %9
%103 = call i32 @close(i32 %102)
%104 = load i32, i32* @stderr
%105 = call i32 @fputs(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0), i32 %104)
%106 = load i32, i32* %10
%107 = call i32 @ftp_do_control(i32 %106)
%108 = call i32 @exit(i32 0)
unreachable
109: ; preds = %98
%110 = load i32, i32* %10
%111 = call i32 @close(i32 %110)
br label %112
112: ; preds = %109
br label %82
113: ; preds = %72, %62, %53, %44, %20
%114 = load i32, i32* %3
ret i32 %114
}

LLVM IR (-O2):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [21 x i8] c"Error: invalid port\0A\00"
@stderr = global i32 0
@AF_INET = global i32 0
@INADDR_ANY = global i32 0
@.str.1 = [8 x i8] c"0.0.0.0\00"
@.str.2 = [19 x i8] c"Error: invalid IP\0A\00"
@SOCK_STREAM = global i32 0
@.str.3 = [7 x i8] c"socket\00"
@.str.4 = [20 x i8] c"Opened main socket\0A\00"
@.str.5 = [5 x i8] c"bind\00"
@.str.6 = [19 x i8] c"Bound main socket\0A\00"
@.str.7 = [7 x i8] c"listen\00"
@.str.8 = [20 x i8] c"Listening at %s:%u\0A\00"
@.str.9 = [7 x i8] c"accept\00"
@.str.10 = [11 x i8] c"accept %d\0A\00"
@.str.11 = [5 x i8] c"fork\00"
@.str.12 = [12 x i8] c"do_control\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = icmp slt i32 %0, 2
br i1 %4, label %10, label %5
5: ; preds = %2
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = tail call i64 @atoi(i8* %7)
%9 = icmp slt i64 %8, 1
br i1 %9, label %10, label %13
10: ; preds = %5, %2
%11 = load i32, i32* @stderr
%12 = tail call i32 @fputs(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %11)
br label %86
13: ; preds = %5
%14 = bitcast %struct.sockaddr_in* %3 to i8*
%15 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 3
store i32 0, i32* %15
%16 = load i32, i32* @AF_INET
%17 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %16, i32* %17
%18 = load i32, i32* @INADDR_ANY
%19 = tail call i32 @htonl(i32 %18)
%20 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0, i32 0
store i32 %19, i32* %20
%21 = tail call i32 @htons(i64 %8)
%22 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1
store i32 %21, i32* %22
%23 = icmp ugt i32 %0, 2
br i1 %23, label %24, label %33
24: ; preds = %13
%25 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
%26 = getelementptr inbounds i8*, i8** %1, i64 2
%27 = load i8*, i8** %26
%28 = call i64 @inet_aton(i8* %27, %struct.TYPE_2__* %25)
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %33
30: ; preds = %24
%31 = load i32, i32* @stderr
%32 = call i32 @fputs(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %31)
br label %85
33: ; preds = %24, %13
%34 = phi i8* [ %27, %24 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), %13 ]
%35 = load i32, i32* @AF_INET
%36 = load i32, i32* @SOCK_STREAM
%37 = call i32 @socket(i32 %35, i32 %36, i32 0)
%38 = icmp eq i32 %37, -1
br i1 %38, label %39, label %41
39: ; preds = %33
%40 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %85
41: ; preds = %33
%42 = load i32, i32* @stderr
%43 = call i32 @fputs(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i32 %42)
%44 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%45 = call i32 @bind(i32 %37, %struct.sockaddr* %44, i32 16)
%46 = icmp eq i32 %45, -1
br i1 %46, label %47, label %50
47: ; preds = %41
%48 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%49 = call i32 @close(i32 %37)
br label %85
50: ; preds = %41
%51 = load i32, i32* @stderr
%52 = call i32 @fputs(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i32 %51)
%53 = call i32 @listen(i32 %37, i32 1)
%54 = icmp eq i32 %53, -1
br i1 %54, label %55, label %58
55: ; preds = %50
%56 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
%57 = call i32 @close(i32 %37)
br label %85
58: ; preds = %50
%59 = load i32, i32* @stderr
%60 = trunc i64 %8 to i32
%61 = call i32 (i32, i8*, ...) @fprintf(i32 %59, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), i8* %34, i32 %60)
br label %62
62: ; preds = %84, %58
%63 = call i32 @accept(i32 %37, %struct.sockaddr* null, i32* null)
%64 = icmp eq i32 %63, -1
br i1 %64, label %65, label %67
65: ; preds = %62
%66 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
br label %84
67: ; preds = %62
%68 = load i32, i32* @stderr
%69 = call i32 (i32, i8*, ...) @fprintf(i32 %68, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i32 %63)
%70 = call i64 (...) @fork()
%71 = icmp slt i64 %70, 0
br i1 %71, label %72, label %74
72: ; preds = %67
%73 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0))
br label %82
74: ; preds = %67
%75 = icmp eq i64 %70, 0
br i1 %75, label %76, label %82
76: ; preds = %74
%77 = call i32 @close(i32 %37)
%78 = load i32, i32* @stderr
%79 = call i32 @fputs(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0), i32 %78)
%80 = call i32 @ftp_do_control(i32 %63)
%81 = call i32 @exit(i32 0)
unreachable
82: ; preds = %72, %74
%83 = call i32 @close(i32 %63)
br label %84
84: ; preds = %82, %65
br label %62
85: ; preds = %39, %47, %55, %30
br label %86
86: ; preds = %85, %10
ret i32 1
}