#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 */
int /*<<< orphan*/ SIGCHLD;
int /*<<< orphan*/ SIG_IGN;
int /*<<< orphan*/ accept_connection(int, char *, int);
int open_listening_port(int);
int /*<<< orphan*/ parse_arguments(int, char **, int *, char **, int *);
int /*<<< orphan*/ signal(int /*<<< orphan*/, int /*<<< orphan*/);
int main(int argc, char **argv) {
  int server_port, forward_port, server_socket;
  char *forward_name;
  parse_arguments(argc, argv, &server_port, &forward_name, &forward_port);
  signal(SIGCHLD, SIG_IGN);
  server_socket = open_listening_port(server_port);
  while (1) {
    accept_connection(server_socket, forward_name, forward_port);
  }
  return 0;
}


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    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
lea    -0x28(%rbp),%rcx
lea    -0x18(%rbp),%r8
call   1030 <parse_arguments@plt>
mov    0x2e73(%rip),%rax
mov    (%rax),%edi
mov    0x2e62(%rip),%rax
mov    (%rax),%esi
call   1040 <signal@plt>
mov    -0x14(%rbp),%edi
call   1060 <open_listening_port@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x28(%rbp),%rsi
mov    -0x18(%rbp),%edx
call   1050 <accept_connection@plt>
jmp    1190 <main+0x50>

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0x4(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    %rsp,%r8
call   1030 <parse_arguments@plt>
mov    0x2e8a(%rip),%rax
mov    (%rax),%edi
mov    0x2e79(%rip),%rax
mov    (%rax),%esi
call   1040 <signal@plt>
mov    0x4(%rsp),%edi
call   1060 <open_listening_port@plt>
mov    %eax,%ebx
nopl   0x0(%rax)
mov    0x8(%rsp),%rsi
mov    (%rsp),%edx
mov    %ebx,%edi
call   1050 <accept_connection@plt>
jmp    1180 <main+0x40>

LLVM IR (-O0):
@SIGCHLD = global i32 0
@SIG_IGN = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = load i8**, i8*** %5
%12 = call i32 @parse_arguments(i32 %10, i8** %11, i32* %6, i8** %9, i32* %7)
%13 = load i32, i32* @SIGCHLD
%14 = load i32, i32* @SIG_IGN
%15 = call i32 @signal(i32 %13, i32 %14)
%16 = load i32, i32* %6
%17 = call i32 @open_listening_port(i32 %16)
store i32 %17, i32* %8
br label %18
18: ; preds = %2, %18
%19 = load i32, i32* %8
%20 = load i8*, i8** %9
%21 = load i32, i32* %7
%22 = call i32 @accept_connection(i32 %19, i8* %20, i32 %21)
br label %18
}

LLVM IR (-O2):
@SIGCHLD = global i32 0
@SIG_IGN = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = bitcast i32* %3 to i8*
%7 = bitcast i32* %4 to i8*
%8 = bitcast i8** %5 to i8*
%9 = call i32 @parse_arguments(i32 %0, i8** %1, i32* %3, i8** %5, i32* %4)
%10 = load i32, i32* @SIGCHLD
%11 = load i32, i32* @SIG_IGN
%12 = call i32 @signal(i32 %10, i32 %11)
%13 = load i32, i32* %3
%14 = call i32 @open_listening_port(i32 %13)
br label %15
15: ; preds = %15, %2
%16 = load i8*, i8** %5
%17 = load i32, i32* %4
%18 = call i32 @accept_connection(i32 %14, i8* %16, i32 %17)
br label %15
}