#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*/ O_WRONLY;
int /*<<< orphan*/ chdir(char *);
int /*<<< orphan*/ dup2(int, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
char *load(char *);
int my_system(char *, char **);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stderr;
scalar_t__ strncmp(char *, char *, int);
int main(void) {
  char *pluto_verb;
  char *pluto_peer_client;
  char *pluto_interface;
  char *pluto_me;
  char *pluto_my_client;
  char *argv[20];
  int status;
  int testing = 0;
  if (load("UPDOWN_TESTING") == NULL) {
    chdir("/etc");
  } else
    testing = 1;
  pluto_verb = load("PLUTO_VERB");
  if (pluto_verb == NULL) {
    fprintf(stderr, "PLUTO_VERB not set\n");
    return 1;
  }
  pluto_peer_client = load("PLUTO_PEER_CLIENT");
  if (pluto_peer_client == NULL) {
    fprintf(stderr, "PLUTO_PEER_CLIENT not set\n");
    return 1;
  }
  pluto_interface = load("PLUTO_INTERFACE");
  if (pluto_interface == NULL) {
    fprintf(stderr, "PLUTO_INTERFACE not set\n");
    return 1;
  }
  pluto_me = load("PLUTO_ME");
  if (pluto_me == NULL) {
    fprintf(stderr, "PLUTO_ME not set\n");
    return 1;
  }
  pluto_my_client = load("PLUTO_MY_CLIENT");
  if (pluto_my_client == NULL) {
    fprintf(stderr, "PLUTO_MY_CLIENT not set\n");
    return 1;
  }
  if (strncmp(pluto_verb, "route-", 6) == 0 ||
      strncmp(pluto_verb, "up-", 3) == 0) {
    argv[0] = "/bin/ip";
    argv[1] = "route";
    argv[2] = "add";
    argv[3] = pluto_peer_client;
    argv[4] = "dev";
    argv[5] = pluto_interface;
    argv[6] = "via";
    argv[7] = pluto_me;
    argv[8] = 0;
    if (!testing) {
      status = my_system("/bin/ip", argv);
      if (status != 0)
        return status;
    } else
      printf("route add %s\n", pluto_peer_client);
  }
  if (strncmp(pluto_verb, "unroute-", 8) == 0 ||
      strncmp(pluto_verb, "down-", 5) == 0) {
    argv[0] = "/bin/ip";
    argv[1] = "route";
    argv[2] = "del";
    argv[3] = pluto_peer_client;
    argv[4] = "dev";
    argv[5] = pluto_interface;
    argv[6] = "via";
    argv[7] = pluto_me;
    argv[8] = 0;
    if (!testing) {
      status = my_system("/bin/ip", argv);
      if (status != 0)
        return status;
    } else
      printf("route del %s\n", pluto_peer_client);
  }
  if (strncmp(pluto_verb, "prepare-", 8) == 0) {
    argv[0] = "/bin/ip";
    argv[1] = "route";
    argv[2] = "del";
    argv[3] = pluto_peer_client;
    argv[4] = 0;
    if (!testing) {
      int null = open("/dev/null", O_WRONLY);
      dup2(null, 1);
      dup2(null, 2);
      status = my_system("/bin/ip", argv);
    } else
      printf("prepare del %s\n", pluto_my_client);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xd8(%rbp)
lea    0xe5d(%rip),%rdi
call   10a0 <load@plt>
cmp    $0x0,%rax
jne    11c3 <main+0x43>
lea    0xe56(%rip),%rdi
call   1040 <chdir@plt>
jmp    11cd <main+0x4d>
movl   $0x1,-0xd8(%rbp)
lea    0xe40(%rip),%rdi
call   10a0 <load@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1209 <main+0x89>
mov    0x2df1(%rip),%rax
mov    (%rax),%edi
lea    0xe27(%rip),%rsi
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    15f0 <main+0x470>
lea    0xe23(%rip),%rdi
call   10a0 <load@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1245 <main+0xc5>
mov    0x2db5(%rip),%rax
mov    (%rax),%edi
lea    0xe11(%rip),%rsi
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    15f0 <main+0x470>
lea    0xe14(%rip),%rdi
call   10a0 <load@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1281 <main+0x101>
mov    0x2d79(%rip),%rax
mov    (%rax),%edi
lea    0xe00(%rip),%rsi
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    15f0 <main+0x470>
lea    0xe01(%rip),%rdi
call   10a0 <load@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    12bd <main+0x13d>
mov    0x2d3d(%rip),%rax
mov    (%rax),%edi
lea    0xde6(%rip),%rsi
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    15f0 <main+0x470>
lea    0xde0(%rip),%rdi
call   10a0 <load@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    12f9 <main+0x179>
mov    0x2d01(%rip),%rax
mov    (%rax),%edi
lea    0xdcc(%rip),%rsi
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    15f0 <main+0x470>
mov    -0x10(%rbp),%rdi
lea    0xdf7(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     1337 <main+0x1b7>
mov    -0x10(%rbp),%rdi
lea    0xdaa(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1404 <main+0x284>
lea    0xd93(%rip),%rax
mov    %rax,-0xd0(%rbp)
lea    0xd8d(%rip),%rax
mov    %rax,-0xc8(%rbp)
lea    0xd85(%rip),%rax
mov    %rax,-0xc0(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0xb8(%rbp)
lea    0xd70(%rip),%rax
mov    %rax,-0xb0(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0xa8(%rbp)
lea    0xd5b(%rip),%rax
mov    %rax,-0xa0(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x98(%rbp)
movq   $0x0,-0x90(%rbp)
cmpl   $0x0,-0xd8(%rbp)
jne    13ef <main+0x26f>
lea    -0xd0(%rbp),%rsi
lea    0xd0d(%rip),%rdi
call   1090 <my_system@plt>
mov    %eax,-0xd4(%rbp)
cmpl   $0x0,-0xd4(%rbp)
je     13ea <main+0x26a>
mov    -0xd4(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    15f0 <main+0x470>
jmp    13ff <main+0x27f>
mov    -0x18(%rbp),%rsi
lea    0xcf1(%rip),%rdi
call   1060 <printf@plt>
jmp    1404 <main+0x284>
mov    -0x10(%rbp),%rdi
lea    0xcea(%rip),%rsi
mov    $0x8,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     1442 <main+0x2c2>
mov    -0x10(%rbp),%rdi
lea    0xcd4(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    150f <main+0x38f>
lea    0xc88(%rip),%rax
mov    %rax,-0xd0(%rbp)
lea    0xc82(%rip),%rax
mov    %rax,-0xc8(%rbp)
lea    0xca3(%rip),%rax
mov    %rax,-0xc0(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0xb8(%rbp)
lea    0xc65(%rip),%rax
mov    %rax,-0xb0(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0xa8(%rbp)
lea    0xc50(%rip),%rax
mov    %rax,-0xa0(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x98(%rbp)
movq   $0x0,-0x90(%rbp)
cmpl   $0x0,-0xd8(%rbp)
jne    14fa <main+0x37a>
lea    -0xd0(%rbp),%rsi
lea    0xc02(%rip),%rdi
call   1090 <my_system@plt>
mov    %eax,-0xd4(%rbp)
cmpl   $0x0,-0xd4(%rbp)
je     14f5 <main+0x375>
mov    -0xd4(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    15f0 <main+0x470>
jmp    150a <main+0x38a>
mov    -0x18(%rbp),%rsi
lea    0xc07(%rip),%rdi
call   1060 <printf@plt>
jmp    150f <main+0x38f>
mov    -0x10(%rbp),%rdi
lea    0xc00(%rip),%rsi
mov    $0x8,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    15e9 <main+0x469>
lea    0xb9c(%rip),%rax
mov    %rax,-0xd0(%rbp)
lea    0xb96(%rip),%rax
mov    %rax,-0xc8(%rbp)
lea    0xbb7(%rip),%rax
mov    %rax,-0xc0(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0xb8(%rbp)
movq   $0x0,-0xb0(%rbp)
cmpl   $0x0,-0xd8(%rbp)
jne    15d4 <main+0x454>
mov    0x2a4e(%rip),%rax
mov    (%rax),%esi
lea    0xb98(%rip),%rdi
call   1080 <open@plt>
mov    %eax,-0xdc(%rbp)
mov    -0xdc(%rbp),%edi
mov    $0x1,%esi
call   1050 <dup2@plt>
mov    -0xdc(%rbp),%edi
mov    $0x2,%esi
call   1050 <dup2@plt>
lea    -0xd0(%rbp),%rsi
lea    0xb0d(%rip),%rdi
call   1090 <my_system@plt>
mov    %eax,-0xd4(%rbp)
jmp    15e4 <main+0x464>
mov    -0x30(%rbp),%rsi
lea    0xb4e(%rip),%rdi
call   1060 <printf@plt>
jmp    15e9 <main+0x469>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb8,%rsp
lea    0xe68(%rip),%rdi
call   10a0 <load@plt>
mov    %rax,%r15
test   %rax,%rax
jne    11b1 <main+0x31>
lea    0xe63(%rip),%rdi
call   1040 <chdir@plt>
lea    0xe5c(%rip),%rdi
call   10a0 <load@plt>
test   %rax,%rax
je     13d5 <main+0x255>
mov    %rax,%rbx
lea    0xe63(%rip),%rdi
call   10a0 <load@plt>
test   %rax,%rax
je     13e7 <main+0x267>
mov    %rax,%r14
lea    0xe78(%rip),%rdi
call   10a0 <load@plt>
test   %rax,%rax
je     13f9 <main+0x279>
mov    %rax,%r13
lea    0xe89(%rip),%rdi
call   10a0 <load@plt>
test   %rax,%rax
je     140b <main+0x28b>
mov    %rax,%rbp
lea    0xe8c(%rip),%rdi
call   10a0 <load@plt>
test   %rax,%rax
je     141d <main+0x29d>
mov    %rax,0x8(%rsp)
lea    0xec9(%rip),%rsi
mov    %rbx,%rdi
mov    $0x6,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     125d <main+0xdd>
lea    0xe82(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    12c9 <main+0x149>
lea    0xe6d(%rip),%rax
mov    %rax,0x10(%rsp)
lea    0xe69(%rip),%rax
mov    %rax,0x18(%rsp)
lea    0xe63(%rip),%rax
mov    %rax,0x20(%rsp)
mov    %r14,0x28(%rsp)
lea    0xe56(%rip),%rax
mov    %rax,0x30(%rsp)
mov    %r13,0x38(%rsp)
lea    0xe49(%rip),%rax
mov    %rax,0x40(%rsp)
mov    %rbp,0x48(%rsp)
movq   $0x0,0x50(%rsp)
test   %r15,%r15
je     144d <main+0x2cd>
lea    0xe2a(%rip),%rdi
mov    %r14,%rsi
call   1060 <printf@plt>
lea    0xe29(%rip),%rsi
mov    %rbx,%rdi
mov    $0x8,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     12fb <main+0x17b>
lea    0xe19(%rip),%rsi
mov    %rbx,%rdi
mov    $0x5,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    1367 <main+0x1e7>
lea    0xdcf(%rip),%rax
mov    %rax,0x10(%rsp)
lea    0xdcb(%rip),%rax
mov    %rax,0x18(%rsp)
lea    0xdee(%rip),%rax
mov    %rax,0x20(%rsp)
mov    %r14,0x28(%rsp)
lea    0xdb8(%rip),%rax
mov    %rax,0x30(%rsp)
mov    %r13,0x38(%rsp)
lea    0xdab(%rip),%rax
mov    %rax,0x40(%rsp)
mov    %rbp,0x48(%rsp)
movq   $0x0,0x50(%rsp)
test   %r15,%r15
je     146a <main+0x2ea>
lea    0xdad(%rip),%rdi
mov    %r14,%rsi
call   1060 <printf@plt>
lea    0xdac(%rip),%rsi
mov    %rbx,%rdi
mov    $0x8,%edx
call   1030 <strncmp@plt>
xor    %r12d,%r12d
test   %rax,%rax
jne    1438 <main+0x2b8>
lea    0xd43(%rip),%rax
mov    %rax,0x10(%rsp)
lea    0xd3f(%rip),%rax
mov    %rax,0x18(%rsp)
lea    0xd62(%rip),%rax
mov    %rax,0x20(%rsp)
mov    %r14,0x28(%rsp)
movq   $0x0,0x30(%rsp)
test   %r15,%r15
je     1487 <main+0x307>
lea    0xd64(%rip),%rdi
mov    0x8(%rsp),%rsi
call   1060 <printf@plt>
jmp    1438 <main+0x2b8>
mov    0x2c04(%rip),%rax
mov    (%rax),%edi
lea    0xc3a(%rip),%rsi
jmp    142d <main+0x2ad>
mov    0x2bf2(%rip),%rax
mov    (%rax),%edi
lea    0xc4e(%rip),%rsi
jmp    142d <main+0x2ad>
mov    0x2be0(%rip),%rax
mov    (%rax),%edi
lea    0xc67(%rip),%rsi
jmp    142d <main+0x2ad>
mov    0x2bce(%rip),%rax
mov    (%rax),%edi
lea    0xc77(%rip),%rsi
jmp    142d <main+0x2ad>
mov    0x2bbc(%rip),%rax
mov    (%rax),%edi
lea    0xc87(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%r12d
mov    %r12d,%eax
add    $0xb8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc7d(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1090 <my_system@plt>
mov    %eax,%r12d
test   %eax,%eax
jne    1438 <main+0x2b8>
jmp    12c9 <main+0x149>
lea    0xc60(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1090 <my_system@plt>
mov    %eax,%r12d
test   %eax,%eax
jne    1438 <main+0x2b8>
jmp    1367 <main+0x1e7>
mov    0x2b42(%rip),%rax
mov    (%rax),%esi
lea    0xc8c(%rip),%rdi
call   1080 <open@plt>
mov    %eax,%ebx
mov    %eax,%edi
mov    $0x1,%esi
call   1050 <dup2@plt>
mov    %ebx,%edi
mov    $0x2,%esi
call   1050 <dup2@plt>
lea    0xc14(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1090 <my_system@plt>
jmp    1438 <main+0x2b8>

LLVM IR (-O0):
@.str = [15 x i8] c"UPDOWN_TESTING\00"
@.str.1 = [5 x i8] c"/etc\00"
@.str.2 = [11 x i8] c"PLUTO_VERB\00"
@stderr = global i32 0
@.str.3 = [20 x i8] c"PLUTO_VERB not set\0A\00"
@.str.4 = [18 x i8] c"PLUTO_PEER_CLIENT\00"
@.str.5 = [27 x i8] c"PLUTO_PEER_CLIENT not set\0A\00"
@.str.6 = [16 x i8] c"PLUTO_INTERFACE\00"
@.str.7 = [25 x i8] c"PLUTO_INTERFACE not set\0A\00"
@.str.8 = [9 x i8] c"PLUTO_ME\00"
@.str.9 = [18 x i8] c"PLUTO_ME not set\0A\00"
@.str.10 = [16 x i8] c"PLUTO_MY_CLIENT\00"
@.str.11 = [25 x i8] c"PLUTO_MY_CLIENT not set\0A\00"
@.str.12 = [7 x i8] c"route-\00"
@.str.13 = [4 x i8] c"up-\00"
@.str.14 = [8 x i8] c"/bin/ip\00"
@.str.15 = [6 x i8] c"route\00"
@.str.16 = [4 x i8] c"add\00"
@.str.17 = [4 x i8] c"dev\00"
@.str.18 = [4 x i8] c"via\00"
@.str.19 = [14 x i8] c"route add %s\0A\00"
@.str.20 = [9 x i8] c"unroute-\00"
@.str.21 = [6 x i8] c"down-\00"
@.str.22 = [4 x i8] c"del\00"
@.str.23 = [14 x i8] c"route del %s\0A\00"
@.str.24 = [9 x i8] c"prepare-\00"
@.str.25 = [10 x i8] c"/dev/null\00"
@O_WRONLY = global i32 0
@.str.26 = [16 x i8] c"prepare del %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca [20 x i8*]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %9
%11 = call i8* @load(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %15
13: ; preds = %0
%14 = call i32 @chdir(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %16
15: ; preds = %0
store i32 1, i32* %9
br label %16
16: ; preds = %15, %13
%17 = call i8* @load(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
store i8* %17, i8** %2
%18 = load i8*, i8** %2
%19 = icmp eq i8* %18, null
br i1 %19, label %20, label %23
20: ; preds = %16
%21 = load i32, i32* @stderr
%22 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %1
br label %148
23: ; preds = %16
%24 = call i8* @load(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
store i8* %24, i8** %3
%25 = load i8*, i8** %3
%26 = icmp eq i8* %25, null
br i1 %26, label %27, label %30
27: ; preds = %23
%28 = load i32, i32* @stderr
%29 = call i32 @fprintf(i32 %28, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %1
br label %148
30: ; preds = %23
%31 = call i8* @load(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
store i8* %31, i8** %4
%32 = load i8*, i8** %4
%33 = icmp eq i8* %32, null
br i1 %33, label %34, label %37
34: ; preds = %30
%35 = load i32, i32* @stderr
%36 = call i32 @fprintf(i32 %35, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0))
store i32 1, i32* %1
br label %148
37: ; preds = %30
%38 = call i8* @load(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
store i8* %38, i8** %5
%39 = load i8*, i8** %5
%40 = icmp eq i8* %39, null
br i1 %40, label %41, label %44
41: ; preds = %37
%42 = load i32, i32* @stderr
%43 = call i32 @fprintf(i32 %42, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0))
store i32 1, i32* %1
br label %148
44: ; preds = %37
%45 = call i8* @load(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0))
store i8* %45, i8** %6
%46 = load i8*, i8** %6
%47 = icmp eq i8* %46, null
br i1 %47, label %48, label %51
48: ; preds = %44
%49 = load i32, i32* @stderr
%50 = call i32 @fprintf(i32 %49, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.11, i64 0, i64 0))
store i32 1, i32* %1
br label %148
51: ; preds = %44
%52 = load i8*, i8** %2
%53 = call i64 @strncmp(i8* %52, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), i32 6)
%54 = icmp eq i64 %53, 0
br i1 %54, label %59, label %55
55: ; preds = %51
%56 = load i8*, i8** %2
%57 = call i64 @strncmp(i8* %56, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0), i32 3)
%58 = icmp eq i64 %57, 0
br i1 %58, label %59, label %86
59: ; preds = %55, %51
%60 = getelementptr inbounds [20 x i8*], [20 x i8*]* %7, i64 0, i64 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0), i8** %60
%61 = getelementptr inbounds [20 x i8*], [20 x i8*]* %7, i64 0, i64 1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0), i8** %61
%62 = getelementptr inbounds [20 x i8*], [20 x i8*]* %7, i64 0, i64 2
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.16, i64 0, i64 0), i8** %62
%63 = load i8*, i8** %3
%64 = getelementptr inbounds [20 x i8*], [20 x i8*]* %7, i64 0, i64 3
store i8* %63, i8** %64
%65 = getelementptr inbounds [20 x i8*], [20 x i8*]* %7, i64 0, i64 4
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.17, i64 0, i64 0), i8** %65
%66 = load i8*, i8** %4
%67 = getelementptr inbounds [20 x i8*], [20 x i8*]* %7, i64 0, i64 5
store i8* %66, i8** %67
%68 = getelementptr inbounds [20 x i8*], [20 x i8*]* %7, i64 0, i64 6
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i64 0, i64 0), i8** %68
%69 = load i8*, i8** %5
%70 = getelementptr inbounds [20 x i8*], [20 x i8*]* %7, i64 0, i64 7
store i8* %69, i8** %70
%71 = getelementptr inbounds [20 x i8*], [20 x i8*]* %7, i64 0, i64 8
store i8* null, i8** %71
%72 = load i32, i32* %9
%73 = icmp ne i32 %72, 0
br i1 %73, label %82, label %74
74: ; preds = %59
%75 = getelementptr inbounds [20 x i8*], [20 x i8*]* %7, i64 0, i64 0
%76 = call i32 @my_system(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0), i8** %75)
store i32 %76, i32* %8
%77 = load i32, i32* %8
%78 = icmp ne i32 %77, 0
br i1 %78, label %79, label %81
79: ; preds = %74
%80 = load i32, i32* %8
store i32 %80, i32* %1
br label %148
81: ; preds = %74
br label %85
82: ; preds = %59
%83 = load i8*, i8** %3
%84 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.19, i64 0, i64 0), i8* %83)
br label %85
85: ; preds = %82, %81
br label %86
86: ; preds = %85, %55
%87 = load i8*, i8** %2
%88 = call i64 @strncmp(i8* %87, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.20, i64 0, i64 0), i32 8)
%89 = icmp eq i64 %88, 0
br i1 %89, label %94, label %90
90: ; preds = %86
%91 = load i8*, i8** %2
%92 = call i64 @strncmp(i8* %91, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.21, i64 0, i64 0), i32 5)
%93 = icmp eq i64 %92, 0
br i1 %93, label %94, label %121
94: ; preds = %90, %86
%95 = getelementptr inbounds [20 x i8*], [20 x i8*]* %7, i64 0, i64 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0), i8** %95
%96 = getelementptr inbounds [20 x i8*], [20 x i8*]* %7, i64 0, i64 1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0), i8** %96
%97 = getelementptr inbounds [20 x i8*], [20 x i8*]* %7, i64 0, i64 2
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.22, i64 0, i64 0), i8** %97
%98 = load i8*, i8** %3
%99 = getelementptr inbounds [20 x i8*], [20 x i8*]* %7, i64 0, i64 3
store i8* %98, i8** %99
%100 = getelementptr inbounds [20 x i8*], [20 x i8*]* %7, i64 0, i64 4
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.17, i64 0, i64 0), i8** %100
%101 = load i8*, i8** %4
%102 = getelementptr inbounds [20 x i8*], [20 x i8*]* %7, i64 0, i64 5
store i8* %101, i8** %102
%103 = getelementptr inbounds [20 x i8*], [20 x i8*]* %7, i64 0, i64 6
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i64 0, i64 0), i8** %103
%104 = load i8*, i8** %5
%105 = getelementptr inbounds [20 x i8*], [20 x i8*]* %7, i64 0, i64 7
store i8* %104, i8** %105
%106 = getelementptr inbounds [20 x i8*], [20 x i8*]* %7, i64 0, i64 8
store i8* null, i8** %106
%107 = load i32, i32* %9
%108 = icmp ne i32 %107, 0
br i1 %108, label %117, label %109
109: ; preds = %94
%110 = getelementptr inbounds [20 x i8*], [20 x i8*]* %7, i64 0, i64 0
%111 = call i32 @my_system(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0), i8** %110)
store i32 %111, i32* %8
%112 = load i32, i32* %8
%113 = icmp ne i32 %112, 0
br i1 %113, label %114, label %116
114: ; preds = %109
%115 = load i32, i32* %8
store i32 %115, i32* %1
br label %148
116: ; preds = %109
br label %120
117: ; preds = %94
%118 = load i8*, i8** %3
%119 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.23, i64 0, i64 0), i8* %118)
br label %120
120: ; preds = %117, %116
br label %121
121: ; preds = %120, %90
%122 = load i8*, i8** %2
%123 = call i64 @strncmp(i8* %122, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.24, i64 0, i64 0), i32 8)
%124 = icmp eq i64 %123, 0
br i1 %124, label %125, label %147
125: ; preds = %121
%126 = getelementptr inbounds [20 x i8*], [20 x i8*]* %7, i64 0, i64 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0), i8** %126
%127 = getelementptr inbounds [20 x i8*], [20 x i8*]* %7, i64 0, i64 1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0), i8** %127
%128 = getelementptr inbounds [20 x i8*], [20 x i8*]* %7, i64 0, i64 2
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.22, i64 0, i64 0), i8** %128
%129 = load i8*, i8** %3
%130 = getelementptr inbounds [20 x i8*], [20 x i8*]* %7, i64 0, i64 3
store i8* %129, i8** %130
%131 = getelementptr inbounds [20 x i8*], [20 x i8*]* %7, i64 0, i64 4
store i8* null, i8** %131
%132 = load i32, i32* %9
%133 = icmp ne i32 %132, 0
br i1 %133, label %143, label %134
134: ; preds = %125
%135 = load i32, i32* @O_WRONLY
%136 = call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.25, i64 0, i64 0), i32 %135)
store i32 %136, i32* %10
%137 = load i32, i32* %10
%138 = call i32 @dup2(i32 %137, i32 1)
%139 = load i32, i32* %10
%140 = call i32 @dup2(i32 %139, i32 2)
%141 = getelementptr inbounds [20 x i8*], [20 x i8*]* %7, i64 0, i64 0
%142 = call i32 @my_system(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0), i8** %141)
store i32 %142, i32* %8
br label %146
143: ; preds = %125
%144 = load i8*, i8** %6
%145 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.26, i64 0, i64 0), i8* %144)
br label %146
146: ; preds = %143, %134
br label %147
147: ; preds = %146, %121
store i32 0, i32* %1
br label %148
148: ; preds = %147, %114, %79, %48, %41, %34, %27, %20
%149 = load i32, i32* %1
ret i32 %149
}

LLVM IR (-O2):
@.str = [15 x i8] c"UPDOWN_TESTING\00"
@.str.1 = [5 x i8] c"/etc\00"
@.str.2 = [11 x i8] c"PLUTO_VERB\00"
@stderr = global i32 0
@.str.3 = [20 x i8] c"PLUTO_VERB not set\0A\00"
@.str.4 = [18 x i8] c"PLUTO_PEER_CLIENT\00"
@.str.5 = [27 x i8] c"PLUTO_PEER_CLIENT not set\0A\00"
@.str.6 = [16 x i8] c"PLUTO_INTERFACE\00"
@.str.7 = [25 x i8] c"PLUTO_INTERFACE not set\0A\00"
@.str.8 = [9 x i8] c"PLUTO_ME\00"
@.str.9 = [18 x i8] c"PLUTO_ME not set\0A\00"
@.str.10 = [16 x i8] c"PLUTO_MY_CLIENT\00"
@.str.11 = [25 x i8] c"PLUTO_MY_CLIENT not set\0A\00"
@.str.12 = [7 x i8] c"route-\00"
@.str.13 = [4 x i8] c"up-\00"
@.str.14 = [8 x i8] c"/bin/ip\00"
@.str.15 = [6 x i8] c"route\00"
@.str.16 = [4 x i8] c"add\00"
@.str.17 = [4 x i8] c"dev\00"
@.str.18 = [4 x i8] c"via\00"
@.str.19 = [14 x i8] c"route add %s\0A\00"
@.str.20 = [9 x i8] c"unroute-\00"
@.str.21 = [6 x i8] c"down-\00"
@.str.22 = [4 x i8] c"del\00"
@.str.23 = [14 x i8] c"route del %s\0A\00"
@.str.24 = [9 x i8] c"prepare-\00"
@.str.25 = [10 x i8] c"/dev/null\00"
@O_WRONLY = global i32 0
@.str.26 = [16 x i8] c"prepare del %s\0A\00"
define i32 @main() {
%1 = alloca [20 x i8*]
%2 = bitcast [20 x i8*]* %1 to i8*
%3 = tail call i8* @load(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = tail call i32 @chdir(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %7
7: ; preds = %0, %5
%8 = tail call i8* @load(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = load i32, i32* @stderr
%12 = tail call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
br label %96
13: ; preds = %7
%14 = tail call i8* @load(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%15 = icmp eq i8* %14, null
br i1 %15, label %16, label %19
16: ; preds = %13
%17 = load i32, i32* @stderr
%18 = tail call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
br label %96
19: ; preds = %13
%20 = tail call i8* @load(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
%21 = icmp eq i8* %20, null
br i1 %21, label %22, label %25
22: ; preds = %19
%23 = load i32, i32* @stderr
%24 = tail call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0))
br label %96
25: ; preds = %19
%26 = tail call i8* @load(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
%27 = icmp eq i8* %26, null
br i1 %27, label %28, label %31
28: ; preds = %25
%29 = load i32, i32* @stderr
%30 = tail call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0))
br label %96
31: ; preds = %25
%32 = tail call i8* @load(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0))
%33 = icmp eq i8* %32, null
br i1 %33, label %34, label %37
34: ; preds = %31
%35 = load i32, i32* @stderr
%36 = tail call i32 @fprintf(i32 %35, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.11, i64 0, i64 0))
br label %96
37: ; preds = %31
%38 = tail call i64 @strncmp(i8* %8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), i32 6)
%39 = icmp eq i64 %38, 0
br i1 %39, label %43, label %40
40: ; preds = %37
%41 = tail call i64 @strncmp(i8* %8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0), i32 3)
%42 = icmp eq i64 %41, 0
br i1 %42, label %43, label %58
43: ; preds = %40, %37
%44 = getelementptr inbounds [20 x i8*], [20 x i8*]* %1, i64 0, i64 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0), i8** %44
%45 = getelementptr inbounds [20 x i8*], [20 x i8*]* %1, i64 0, i64 1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0), i8** %45
%46 = getelementptr inbounds [20 x i8*], [20 x i8*]* %1, i64 0, i64 2
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.16, i64 0, i64 0), i8** %46
%47 = getelementptr inbounds [20 x i8*], [20 x i8*]* %1, i64 0, i64 3
store i8* %14, i8** %47
%48 = getelementptr inbounds [20 x i8*], [20 x i8*]* %1, i64 0, i64 4
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.17, i64 0, i64 0), i8** %48
%49 = getelementptr inbounds [20 x i8*], [20 x i8*]* %1, i64 0, i64 5
store i8* %20, i8** %49
%50 = getelementptr inbounds [20 x i8*], [20 x i8*]* %1, i64 0, i64 6
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i64 0, i64 0), i8** %50
%51 = getelementptr inbounds [20 x i8*], [20 x i8*]* %1, i64 0, i64 7
store i8* %26, i8** %51
%52 = getelementptr inbounds [20 x i8*], [20 x i8*]* %1, i64 0, i64 8
store i8* null, i8** %52
br i1 %4, label %53, label %56
53: ; preds = %43
%54 = call i32 @my_system(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0), i8** %44)
%55 = icmp eq i32 %54, 0
br i1 %55, label %58, label %96
56: ; preds = %43
%57 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.19, i64 0, i64 0), i8* %14)
br label %58
58: ; preds = %56, %53, %40
%59 = call i64 @strncmp(i8* %8, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.20, i64 0, i64 0), i32 8)
%60 = icmp eq i64 %59, 0
br i1 %60, label %64, label %61
61: ; preds = %58
%62 = call i64 @strncmp(i8* %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.21, i64 0, i64 0), i32 5)
%63 = icmp eq i64 %62, 0
br i1 %63, label %64, label %79
64: ; preds = %61, %58
%65 = getelementptr inbounds [20 x i8*], [20 x i8*]* %1, i64 0, i64 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0), i8** %65
%66 = getelementptr inbounds [20 x i8*], [20 x i8*]* %1, i64 0, i64 1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0), i8** %66
%67 = getelementptr inbounds [20 x i8*], [20 x i8*]* %1, i64 0, i64 2
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.22, i64 0, i64 0), i8** %67
%68 = getelementptr inbounds [20 x i8*], [20 x i8*]* %1, i64 0, i64 3
store i8* %14, i8** %68
%69 = getelementptr inbounds [20 x i8*], [20 x i8*]* %1, i64 0, i64 4
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.17, i64 0, i64 0), i8** %69
%70 = getelementptr inbounds [20 x i8*], [20 x i8*]* %1, i64 0, i64 5
store i8* %20, i8** %70
%71 = getelementptr inbounds [20 x i8*], [20 x i8*]* %1, i64 0, i64 6
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i64 0, i64 0), i8** %71
%72 = getelementptr inbounds [20 x i8*], [20 x i8*]* %1, i64 0, i64 7
store i8* %26, i8** %72
%73 = getelementptr inbounds [20 x i8*], [20 x i8*]* %1, i64 0, i64 8
store i8* null, i8** %73
br i1 %4, label %74, label %77
74: ; preds = %64
%75 = call i32 @my_system(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0), i8** %65)
%76 = icmp eq i32 %75, 0
br i1 %76, label %79, label %96
77: ; preds = %64
%78 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.23, i64 0, i64 0), i8* %14)
br label %79
79: ; preds = %77, %74, %61
%80 = call i64 @strncmp(i8* %8, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.24, i64 0, i64 0), i32 8)
%81 = icmp eq i64 %80, 0
br i1 %81, label %82, label %96
82: ; preds = %79
%83 = getelementptr inbounds [20 x i8*], [20 x i8*]* %1, i64 0, i64 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0), i8** %83
%84 = getelementptr inbounds [20 x i8*], [20 x i8*]* %1, i64 0, i64 1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0), i8** %84
%85 = getelementptr inbounds [20 x i8*], [20 x i8*]* %1, i64 0, i64 2
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.22, i64 0, i64 0), i8** %85
%86 = getelementptr inbounds [20 x i8*], [20 x i8*]* %1, i64 0, i64 3
store i8* %14, i8** %86
%87 = getelementptr inbounds [20 x i8*], [20 x i8*]* %1, i64 0, i64 4
store i8* null, i8** %87
br i1 %4, label %88, label %94
88: ; preds = %82
%89 = load i32, i32* @O_WRONLY
%90 = call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.25, i64 0, i64 0), i32 %89)
%91 = call i32 @dup2(i32 %90, i32 1)
%92 = call i32 @dup2(i32 %90, i32 2)
%93 = call i32 @my_system(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0), i8** %83)
br label %96
94: ; preds = %82
%95 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.26, i64 0, i64 0), i8* %32)
br label %96
96: ; preds = %79, %94, %88, %74, %53, %34, %28, %22, %16, %10
%97 = phi i32 [ 1, %10 ], [ 1, %16 ], [ 1, %22 ], [ 1, %28 ], [ 1, %34 ], [ %54, %53 ], [ %75, %74 ], [ 0, %88 ], [ 0, %94 ], [ 0, %79 ]
ret i32 %97
}