#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*/ EXIT_FAILURE;
int /*<<< orphan*/ add_proxy_cmd(char *, int, char *);
int atoi(char *);
int /*<<< orphan*/ delete_proxy_cmd(char *, int, char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(char *);
int getopt(int, char **, char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ memset(char *, int, int);
char *optarg;
int sprintf(char *, char *, char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strncpy(char *, char *, int);
int /*<<< orphan*/ system(char *);
int main(int argc, char *argv[]) {
  int opt;
  char *addr;
  char *prt;
  char *namespace;
  int mode;
  int portNumber;
  int addr_not_found = 1;
  int namespace_not_found = 1;
  fprintf(stdout, "in main");
  mode = 0;
  addr = (char *)malloc(sizeof(char) * 21);
  prt = (char *)malloc(sizeof(char) * 6);
  namespace = (char *)malloc(sizeof(char) * 100);
  while ((opt = getopt(argc, argv, "m:a:p:n:")) != -1) {
    switch (opt) {
    case 'm':
      if (*optarg == 'c' || *optarg == 'C') {
        mode = 1;
      } else if (*optarg == 'd' || *optarg == 'D') {
        mode = 2;
      } else if (*optarg == 'x' || *optarg == 'X') {
        mode = 3;
      } else if (*optarg == 'l' || *optarg == 'L') {
        mode = 4;
      } else {
        fprintf(stderr, "Usage %s -m [{c|d} -a address | x]\n", argv[0]);
        exit(EXIT_FAILURE);
      }
      break;
    case 'p':
      strncpy(prt, optarg, 6);
      break;
    case 'a':
      strncpy(addr, optarg, 21);
      addr_not_found = 0;
      break;
    case 'n':
      strncpy(namespace, optarg, 100);
      namespace_not_found = 0;
      break;
    default:
      fprintf(stderr, "Usage %s -m [{c|d} -a address | x]\n", argv[0]);
      exit(EXIT_FAILURE);
    }
  }
  if (mode == 0 || (mode != 4 && mode != 3 && addr_not_found)) {
    free(addr);
    fprintf(stderr, "Usage %s -m [{c|d} -a address | x]\n", argv[0]);
    exit(EXIT_FAILURE);
  }
  if (mode == 4) {
    int cmdlen;
    char *cmd;
    cmd = (char *)malloc(sizeof(char) * 200);
    memset(cmd, (int)'\0', 200);
    cmdlen = sprintf(cmd, "ip netns exec %s %s -L -t nat --line-numbers",
                     namespace, "/sbin/iptables");
    fprintf(stdout, "%s\n", cmd);
    system(cmd);
  } else if (mode == 1) {
    portNumber = atoi(prt);
    add_proxy_cmd(addr, portNumber, namespace);
  } else if (mode == 2) {
    portNumber = atoi(prt);
    delete_proxy_cmd(addr, portNumber, namespace);
  } else {
    fprintf(stdout, "Unknown command %s\n", addr);
  }
  free(addr);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x3c(%rbp)
movl   $0x1,-0x40(%rbp)
mov    0x2ddd(%rip),%rax
mov    (%rax),%edi
lea    0xe4c(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x0,-0x34(%rbp)
mov    $0x15,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    $0x6,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    $0x64,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe0e(%rip),%rdx
call   10b0 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     142a <main+0x26a>
mov    -0x14(%rbp),%eax
add    $0xffffff9f,%eax
mov    %eax,%ecx
mov    %rcx,-0x58(%rbp)
sub    $0xf,%eax
ja     13f9 <main+0x239>
mov    -0x58(%rbp),%rax
lea    0xd95(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2d7d(%rip),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x63,%eax
je     12a0 <main+0xe0>
mov    0x2d67(%rip),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x43,%eax
jne    12ac <main+0xec>
movl   $0x1,-0x34(%rbp)
jmp    138f <main+0x1cf>
mov    0x2d45(%rip),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x64,%eax
je     12d8 <main+0x118>
mov    0x2d2f(%rip),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x44,%eax
jne    12e4 <main+0x124>
movl   $0x2,-0x34(%rbp)
jmp    138a <main+0x1ca>
mov    0x2d0d(%rip),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x78,%eax
je     1310 <main+0x150>
mov    0x2cf7(%rip),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x58,%eax
jne    131c <main+0x15c>
movl   $0x3,-0x34(%rbp)
jmp    1385 <main+0x1c5>
mov    0x2cd5(%rip),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x6c,%eax
je     1348 <main+0x188>
mov    0x2cbf(%rip),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x4c,%eax
jne    1354 <main+0x194>
movl   $0x4,-0x34(%rbp)
jmp    1380 <main+0x1c0>
mov    0x2c7d(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xce6(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2c57(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
jmp    1385 <main+0x1c5>
jmp    138a <main+0x1ca>
jmp    138f <main+0x1cf>
jmp    1425 <main+0x265>
mov    -0x28(%rbp),%rdi
mov    0x2c59(%rip),%rax
mov    (%rax),%rsi
mov    $0x6,%edx
call   1040 <strncpy@plt>
jmp    1425 <main+0x265>
mov    -0x20(%rbp),%rdi
mov    0x2c3c(%rip),%rax
mov    (%rax),%rsi
mov    $0x15,%edx
call   1040 <strncpy@plt>
movl   $0x0,-0x3c(%rbp)
jmp    1425 <main+0x265>
mov    -0x30(%rbp),%rdi
mov    0x2c18(%rip),%rax
mov    (%rax),%rsi
mov    $0x64,%edx
call   1040 <strncpy@plt>
movl   $0x0,-0x40(%rbp)
jmp    1425 <main+0x265>
mov    0x2bd8(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xc41(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2bb2(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
jmp    122c <main+0x6c>
cmpl   $0x0,-0x34(%rbp)
je     1452 <main+0x292>
cmpl   $0x4,-0x34(%rbp)
je     1487 <main+0x2c7>
cmpl   $0x3,-0x34(%rbp)
je     1487 <main+0x2c7>
cmpl   $0x0,-0x3c(%rbp)
je     1487 <main+0x2c7>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    0x2b76(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xbdf(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2b50(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
cmpl   $0x4,-0x34(%rbp)
jne    14f6 <main+0x336>
mov    $0xc8,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0xc8,%edx
call   1060 <memset@plt>
mov    -0x50(%rbp),%rdi
mov    -0x30(%rbp),%rdx
lea    0xbb7(%rip),%rsi
lea    0xbdd(%rip),%rcx
call   10d0 <sprintf@plt>
mov    %eax,-0x44(%rbp)
mov    0x2af4(%rip),%rax
mov    (%rax),%edi
mov    -0x50(%rbp),%rdx
lea    0xbe0(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x50(%rbp),%rdi
call   1050 <system@plt>
jmp    1571 <main+0x3b1>
cmpl   $0x1,-0x34(%rbp)
jne    1521 <main+0x361>
mov    -0x28(%rbp),%rdi
call   10c0 <atoi@plt>
mov    %eax,-0x38(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x38(%rbp),%esi
mov    -0x30(%rbp),%rdx
call   1090 <add_proxy_cmd@plt>
jmp    156c <main+0x3ac>
cmpl   $0x2,-0x34(%rbp)
jne    154c <main+0x38c>
mov    -0x28(%rbp),%rdi
call   10c0 <atoi@plt>
mov    %eax,-0x38(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x38(%rbp),%esi
mov    -0x30(%rbp),%rdx
call   1070 <delete_proxy_cmd@plt>
jmp    1567 <main+0x3a7>
mov    0x2a75(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xb51(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
jmp    156c <main+0x3ac>
jmp    1571 <main+0x3b1>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
xor    %edi,%edi
call   10e0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x2dee(%rip),%rax
mov    (%rax),%edi
lea    0xf35(%rip),%rsi
xor    %r14d,%r14d
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x15,%edi
call   10a0 <malloc@plt>
mov    %rax,0x8(%rsp)
mov    $0x6,%edi
call   10a0 <malloc@plt>
mov    %rax,0x20(%rsp)
mov    $0x64,%edi
call   10a0 <malloc@plt>
mov    %rax,0x18(%rsp)
movl   $0x1,0x14(%rsp)
lea    0xef7(%rip),%r13
lea    0xdd0(%rip),%r12
mov    0x2dc1(%rip),%r15
jmp    1252 <main+0x92>
nopl   0x0(%rax)
mov    (%r15),%rsi
mov    0x18(%rsp),%rdi
mov    $0x64,%edx
call   1040 <strncpy@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r13,%rdx
call   10b0 <getopt@plt>
lea    -0x61(%rax),%ecx
cmp    $0xf,%ecx
ja     12ed <main+0x12d>
movslq (%r12,%rcx,4),%rax
add    %r12,%rax
jmp    *%rax
mov    (%r15),%rsi
mov    0x8(%rsp),%rdi
mov    $0x15,%edx
call   1040 <strncpy@plt>
movl   $0x0,0x14(%rsp)
jmp    1252 <main+0x92>
mov    (%r15),%rax
movzbl (%rax),%eax
add    $0xbd,%al
cmp    $0x35,%al
ja     1311 <main+0x151>
mov    $0x1,%r14d
movzbl %al,%eax
lea    0xd94(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x2,%r14d
jmp    1252 <main+0x92>
nopl   (%rax)
mov    (%r15),%rsi
mov    0x20(%rsp),%rdi
mov    $0x6,%edx
call   1040 <strncpy@plt>
jmp    1252 <main+0x92>
mov    $0x4,%r14d
jmp    1252 <main+0x92>
mov    $0x3,%r14d
jmp    1252 <main+0x92>
cmp    $0xffffffff,%eax
jne    1311 <main+0x151>
test   %r14d,%r14d
je     1307 <main+0x147>
lea    -0x5(%r14),%eax
cmp    $0xfffffffd,%eax
ja     1339 <main+0x179>
cmpl   $0x0,0x14(%rsp)
je     1339 <main+0x179>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
mov    0x2cc0(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe05(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    0x2c9e(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
cmp    $0x1,%r14d
je     13b3 <main+0x1f3>
cmp    $0x2,%r14d
je     13d3 <main+0x213>
cmp    $0x4,%r14d
jne    13f3 <main+0x233>
mov    $0xc8,%edi
call   10a0 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
mov    $0xc8,%edx
call   1060 <memset@plt>
lea    0xdd7(%rip),%rsi
lea    0xdfd(%rip),%rcx
mov    %rbx,%rdi
mov    0x18(%rsp),%rdx
call   10d0 <sprintf@plt>
mov    0x2c37(%rip),%rax
mov    (%rax),%edi
lea    0xdff(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %rbx,%rdi
call   1050 <system@plt>
mov    0x8(%rsp),%rbx
jmp    1412 <main+0x252>
mov    0x20(%rsp),%rdi
call   10c0 <atoi@plt>
mov    0x8(%rsp),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
mov    0x18(%rsp),%rdx
call   1090 <add_proxy_cmd@plt>
jmp    1412 <main+0x252>
mov    0x20(%rsp),%rdi
call   10c0 <atoi@plt>
mov    0x8(%rsp),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
mov    0x18(%rsp),%rdx
call   1070 <delete_proxy_cmd@plt>
jmp    1412 <main+0x252>
mov    0x2bce(%rip),%rax
mov    (%rax),%edi
lea    0xd86(%rip),%rsi
mov    0x8(%rsp),%rbx
mov    %rbx,%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %edi,%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [8 x i8] c"in main\00"
@.str.1 = [9 x i8] c"m:a:p:n:\00"
@optarg = global i8* null
@stderr = global i32 0
@.str.2 = [36 x i8] c"Usage %s -m [{c|d} -a address | x]\0A\00"
@EXIT_FAILURE = global i32 0
@.str.3 = [45 x i8] c"ip netns exec %s %s -L -t nat --line-numbers\00"
@.str.4 = [15 x i8] c"/sbin/iptables\00"
@.str.5 = [4 x i8] c"%s\0A\00"
@.str.6 = [20 x i8] c"Unknown command %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %12
store i32 1, i32* %13
%16 = load i32, i32* @stdout
%17 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %10
%18 = call i64 @malloc(i32 21)
%19 = inttoptr i64 %18 to i8*
store i8* %19, i8** %7
%20 = call i64 @malloc(i32 6)
%21 = inttoptr i64 %20 to i8*
store i8* %21, i8** %8
%22 = call i64 @malloc(i32 100)
%23 = inttoptr i64 %22 to i8*
store i8* %23, i8** %9
br label %24
24: ; preds = %107, %2
%25 = load i32, i32* %4
%26 = load i8**, i8*** %5
%27 = call i32 @getopt(i32 %25, i8** %26, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
store i32 %27, i32* %6
%28 = icmp ne i32 %27, -1
br i1 %28, label %29, label %108
29: ; preds = %24
%30 = load i32, i32* %6
switch i32 %30, label %99 [
i32 109, label %31
i32 112, label %87
i32 97, label %91
i32 110, label %95
]
31: ; preds = %29
%32 = load i8*, i8** @optarg
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 99
br i1 %35, label %41, label %36
36: ; preds = %31
%37 = load i8*, i8** @optarg
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = icmp eq i32 %39, 67
br i1 %40, label %41, label %42
41: ; preds = %36, %31
store i32 1, i32* %10
br label %86
42: ; preds = %36
%43 = load i8*, i8** @optarg
%44 = load i8, i8* %43
%45 = sext i8 %44 to i32
%46 = icmp eq i32 %45, 100
br i1 %46, label %52, label %47
47: ; preds = %42
%48 = load i8*, i8** @optarg
%49 = load i8, i8* %48
%50 = sext i8 %49 to i32
%51 = icmp eq i32 %50, 68
br i1 %51, label %52, label %53
52: ; preds = %47, %42
store i32 2, i32* %10
br label %85
53: ; preds = %47
%54 = load i8*, i8** @optarg
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = icmp eq i32 %56, 120
br i1 %57, label %63, label %58
58: ; preds = %53
%59 = load i8*, i8** @optarg
%60 = load i8, i8* %59
%61 = sext i8 %60 to i32
%62 = icmp eq i32 %61, 88
br i1 %62, label %63, label %64
63: ; preds = %58, %53
store i32 3, i32* %10
br label %84
64: ; preds = %58
%65 = load i8*, i8** @optarg
%66 = load i8, i8* %65
%67 = sext i8 %66 to i32
%68 = icmp eq i32 %67, 108
br i1 %68, label %74, label %69
69: ; preds = %64
%70 = load i8*, i8** @optarg
%71 = load i8, i8* %70
%72 = sext i8 %71 to i32
%73 = icmp eq i32 %72, 76
br i1 %73, label %74, label %75
74: ; preds = %69, %64
store i32 4, i32* %10
br label %83
75: ; preds = %69
%76 = load i32, i32* @stderr
%77 = load i8**, i8*** %5
%78 = getelementptr inbounds i8*, i8** %77, i64 0
%79 = load i8*, i8** %78
%80 = call i32 (i32, i8*, ...) @fprintf(i32 %76, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i8* %79)
%81 = load i32, i32* @EXIT_FAILURE
%82 = call i32 @exit(i32 %81)
unreachable
83: ; preds = %74
br label %84
84: ; preds = %83, %63
br label %85
85: ; preds = %84, %52
br label %86
86: ; preds = %85, %41
br label %107
87: ; preds = %29
%88 = load i8*, i8** %8
%89 = load i8*, i8** @optarg
%90 = call i32 @strncpy(i8* %88, i8* %89, i32 6)
br label %107
91: ; preds = %29
%92 = load i8*, i8** %7
%93 = load i8*, i8** @optarg
%94 = call i32 @strncpy(i8* %92, i8* %93, i32 21)
store i32 0, i32* %12
br label %107
95: ; preds = %29
%96 = load i8*, i8** %9
%97 = load i8*, i8** @optarg
%98 = call i32 @strncpy(i8* %96, i8* %97, i32 100)
store i32 0, i32* %13
br label %107
99: ; preds = %29
%100 = load i32, i32* @stderr
%101 = load i8**, i8*** %5
%102 = getelementptr inbounds i8*, i8** %101, i64 0
%103 = load i8*, i8** %102
%104 = call i32 (i32, i8*, ...) @fprintf(i32 %100, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i8* %103)
%105 = load i32, i32* @EXIT_FAILURE
%106 = call i32 @exit(i32 %105)
unreachable
107: ; preds = %95, %91, %87, %86
br label %24
108: ; preds = %24
%109 = load i32, i32* %10
%110 = icmp eq i32 %109, 0
br i1 %110, label %120, label %111
111: ; preds = %108
%112 = load i32, i32* %10
%113 = icmp ne i32 %112, 4
br i1 %113, label %114, label %130
114: ; preds = %111
%115 = load i32, i32* %10
%116 = icmp ne i32 %115, 3
br i1 %116, label %117, label %130
117: ; preds = %114
%118 = load i32, i32* %12
%119 = icmp ne i32 %118, 0
br i1 %119, label %120, label %130
120: ; preds = %117, %108
%121 = load i8*, i8** %7
%122 = call i32 @free(i8* %121)
%123 = load i32, i32* @stderr
%124 = load i8**, i8*** %5
%125 = getelementptr inbounds i8*, i8** %124, i64 0
%126 = load i8*, i8** %125
%127 = call i32 (i32, i8*, ...) @fprintf(i32 %123, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i8* %126)
%128 = load i32, i32* @EXIT_FAILURE
%129 = call i32 @exit(i32 %128)
unreachable
130: ; preds = %117, %114, %111
%131 = load i32, i32* %10
%132 = icmp eq i32 %131, 4
br i1 %132, label %133, label %146
133: ; preds = %130
%134 = call i64 @malloc(i32 200)
%135 = inttoptr i64 %134 to i8*
store i8* %135, i8** %15
%136 = load i8*, i8** %15
%137 = call i32 @memset(i8* %136, i32 0, i32 200)
%138 = load i8*, i8** %15
%139 = load i8*, i8** %9
%140 = call i32 @sprintf(i8* %138, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i8* %139, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
store i32 %140, i32* %14
%141 = load i32, i32* @stdout
%142 = load i8*, i8** %15
%143 = call i32 (i32, i8*, ...) @fprintf(i32 %141, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %142)
%144 = load i8*, i8** %15
%145 = call i32 @system(i8* %144)
br label %172
146: ; preds = %130
%147 = load i32, i32* %10
%148 = icmp eq i32 %147, 1
br i1 %148, label %149, label %156
149: ; preds = %146
%150 = load i8*, i8** %8
%151 = call i32 @atoi(i8* %150)
store i32 %151, i32* %11
%152 = load i8*, i8** %7
%153 = load i32, i32* %11
%154 = load i8*, i8** %9
%155 = call i32 @add_proxy_cmd(i8* %152, i32 %153, i8* %154)
br label %171
156: ; preds = %146
%157 = load i32, i32* %10
%158 = icmp eq i32 %157, 2
br i1 %158, label %159, label %166
159: ; preds = %156
%160 = load i8*, i8** %8
%161 = call i32 @atoi(i8* %160)
store i32 %161, i32* %11
%162 = load i8*, i8** %7
%163 = load i32, i32* %11
%164 = load i8*, i8** %9
%165 = call i32 @delete_proxy_cmd(i8* %162, i32 %163, i8* %164)
br label %170
166: ; preds = %156
%167 = load i32, i32* @stdout
%168 = load i8*, i8** %7
%169 = call i32 (i32, i8*, ...) @fprintf(i32 %167, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i8* %168)
br label %170
170: ; preds = %166, %159
br label %171
171: ; preds = %170, %149
br label %172
172: ; preds = %171, %133
%173 = load i8*, i8** %7
%174 = call i32 @free(i8* %173)
%175 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [8 x i8] c"in main\00"
@.str.1 = [9 x i8] c"m:a:p:n:\00"
@optarg = global i8* null
@stderr = global i32 0
@.str.2 = [36 x i8] c"Usage %s -m [{c|d} -a address | x]\0A\00"
@EXIT_FAILURE = global i32 0
@.str.3 = [45 x i8] c"ip netns exec %s %s -L -t nat --line-numbers\00"
@.str.4 = [15 x i8] c"/sbin/iptables\00"
@.str.5 = [4 x i8] c"%s\0A\00"
@.str.6 = [20 x i8] c"Unknown command %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = load i32, i32* @stdout
%4 = tail call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%5 = tail call i64 @malloc(i32 21)
%6 = inttoptr i64 %5 to i8*
%7 = tail call i64 @malloc(i32 6)
%8 = inttoptr i64 %7 to i8*
%9 = tail call i64 @malloc(i32 100)
%10 = inttoptr i64 %9 to i8*
br label %11
11: ; preds = %18, %2
%12 = phi i32 [ 1, %2 ], [ %19, %18 ]
%13 = phi i32 [ 0, %2 ], [ %20, %18 ]
%14 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
switch i32 %14, label %39 [
i32 -1, label %45
i32 109, label %15
i32 112, label %30
i32 97, label %33
i32 110, label %36
]
15: ; preds = %11
%16 = load i8*, i8** @optarg
%17 = load i8, i8* %16
switch i8 %17, label %24 [
i8 99, label %18
i8 67, label %18
i8 100, label %21
i8 68, label %21
i8 120, label %22
i8 88, label %22
i8 108, label %23
i8 76, label %23
]
18: ; preds = %15, %15, %22, %23, %21, %36, %33, %30
%19 = phi i32 [ %12, %36 ], [ 0, %33 ], [ %12, %30 ], [ %12, %21 ], [ %12, %22 ], [ %12, %23 ], [ %12, %15 ], [ %12, %15 ]
%20 = phi i32 [ %13, %36 ], [ %13, %33 ], [ %13, %30 ], [ 2, %21 ], [ 3, %22 ], [ 4, %23 ], [ 1, %15 ], [ 1, %15 ]
br label %11
21: ; preds = %15, %15
br label %18
22: ; preds = %15, %15
br label %18
23: ; preds = %15, %15
br label %18
24: ; preds = %15
%25 = load i32, i32* @stderr
%26 = load i8*, i8** %1
%27 = tail call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i8* %26)
%28 = load i32, i32* @EXIT_FAILURE
%29 = tail call i32 @exit(i32 %28)
unreachable
30: ; preds = %11
%31 = load i8*, i8** @optarg
%32 = tail call i32 @strncpy(i8* %8, i8* %31, i32 6)
br label %18
33: ; preds = %11
%34 = load i8*, i8** @optarg
%35 = tail call i32 @strncpy(i8* %6, i8* %34, i32 21)
br label %18
36: ; preds = %11
%37 = load i8*, i8** @optarg
%38 = tail call i32 @strncpy(i8* %10, i8* %37, i32 100)
br label %18
39: ; preds = %11
%40 = load i32, i32* @stderr
%41 = load i8*, i8** %1
%42 = tail call i32 (i32, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i8* %41)
%43 = load i32, i32* @EXIT_FAILURE
%44 = tail call i32 @exit(i32 %43)
unreachable
45: ; preds = %11
%46 = icmp eq i32 %13, 0
br i1 %46, label %52, label %47
47: ; preds = %45
%48 = add nsw i32 %13, -5
%49 = icmp ult i32 %48, -2
%50 = icmp ne i32 %12, 0
%51 = select i1 %49, i1 %50, i1 false
br i1 %51, label %52, label %59
52: ; preds = %47, %45
%53 = tail call i32 @free(i8* %6)
%54 = load i32, i32* @stderr
%55 = load i8*, i8** %1
%56 = tail call i32 (i32, i8*, ...) @fprintf(i32 %54, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i8* %55)
%57 = load i32, i32* @EXIT_FAILURE
%58 = tail call i32 @exit(i32 %57)
unreachable
59: ; preds = %47
switch i32 %13, label %74 [
i32 4, label %60
i32 1, label %68
i32 2, label %71
]
60: ; preds = %59
%61 = tail call i64 @malloc(i32 200)
%62 = inttoptr i64 %61 to i8*
%63 = tail call i32 @memset(i8* %62, i32 0, i32 200)
%64 = tail call i32 @sprintf(i8* dereferenceable(1) %62, i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i8* %10, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
%65 = load i32, i32* @stdout
%66 = tail call i32 (i32, i8*, ...) @fprintf(i32 %65, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %62)
%67 = tail call i32 @system(i8* %62)
br label %77
68: ; preds = %59
%69 = tail call i32 @atoi(i8* %8)
%70 = tail call i32 @add_proxy_cmd(i8* %6, i32 %69, i8* %10)
br label %77
71: ; preds = %59
%72 = tail call i32 @atoi(i8* %8)
%73 = tail call i32 @delete_proxy_cmd(i8* %6, i32 %72, i8* %10)
br label %77
74: ; preds = %59
%75 = load i32, i32* @stdout
%76 = tail call i32 (i32, i8*, ...) @fprintf(i32 %75, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i8* %6)
br label %77
77: ; preds = %68, %74, %71, %60
%78 = tail call i32 @free(i8* %6)
%79 = tail call i32 @exit(i32 0)
unreachable
}