#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*/ FILE;

/* Variables and functions */
int EINVAL;
scalar_t__ EOF;
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ print_usage();
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int system(char *);
int main(int argc, char **argv) {
  char buf[128] = "bootpc ";
  char ipv4_addr[128] = "";
  char netmask[128] = "";
  char gw[128] = "";
  char hw_addr[128] = "";
  int err;
  FILE *input;
  if (argc != 2) {
    print_usage();
    return -EINVAL;
  }
  strcat(buf, argv[1]);
  if ((err = system(buf))) {
    printf("BOOTP failed, loading default config for %s...\n", argv[1]);
    input = fopen("network", "r");
    while (fscanf(input, "%s", buf) != EOF) {
      if (!strcmp(buf, "iface")) {
        fscanf(input, "%s", buf);
        if (strcmp(buf, argv[1]))
          continue;
        while (fscanf(input, "%s", buf) != EOF && strcmp(buf, "iface")) {
          if (!strcmp(buf, "address"))
            fscanf(input, "%s", ipv4_addr);
          else if (!strcmp(buf, "netmask"))
            fscanf(input, "%s", netmask);
          else if (!strcmp(buf, "gateway"))
            fscanf(input, "%s", gw);
          else if (!strcmp(buf, "hwaddress"))
            fscanf(input, "%s", hw_addr);
          else
            printf("WARNING: Unknown iface parameter: %s\n", buf);
        }
        strcpy(buf, "ifconfig ");
        strcat(buf, argv[1]);
        strcat(buf, " ");
        strcat(buf, ipv4_addr);
        if (netmask[0]) {
          strcat(buf, " netmask ");
          strcat(buf, netmask);
        }
        if (hw_addr[0]) {
          strcat(buf, " hw ether ");
          strcat(buf, hw_addr);
        }
        strcat(buf, " up");
        if ((err = system(buf)))
          return err;
        if (gw[0]) {
          strcpy(buf, "route add default gw ");
          strcat(buf, gw);
          strcat(buf, " ");
          strcat(buf, argv[1]);
          if ((err = system(buf)))
            return err;
        }
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2b0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x90(%rbp),%rdi
lea    0xe39(%rip),%rsi
mov    $0x80,%edx
call   1090 <memcpy@plt>
lea    -0x110(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1060 <memset@plt>
lea    -0x190(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1060 <memset@plt>
lea    -0x210(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1060 <memset@plt>
lea    -0x290(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1060 <memset@plt>
cmpl   $0x2,-0x8(%rbp)
je     1241 <main+0xa1>
mov    $0x0,%al
call   10c0 <print_usage@plt>
xor    %eax,%eax
mov    0x2da1(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    1633 <main+0x493>
lea    -0x90(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   10b0 <strcat@plt>
lea    -0x90(%rbp),%rdi
call   1040 <system@plt>
mov    %eax,-0x294(%rbp)
cmp    $0x0,%eax
je     162c <main+0x48c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe01(%rip),%rdi
call   1050 <printf@plt>
lea    0xe25(%rip),%rdi
lea    0xe26(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x2a0(%rbp)
mov    -0x2a0(%rbp),%rdi
lea    -0x90(%rbp),%rdx
lea    0xe07(%rip),%rsi
call   1070 <fscanf@plt>
mov    0x2d29(%rip),%rcx
cmp    (%rcx),%rax
je     1627 <main+0x487>
lea    -0x90(%rbp),%rdi
lea    0xde7(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1622 <main+0x482>
mov    -0x2a0(%rbp),%rdi
lea    -0x90(%rbp),%rdx
lea    0xdc0(%rip),%rsi
call   1070 <fscanf@plt>
lea    -0x90(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
je     1322 <main+0x182>
jmp    129e <main+0xfe>
jmp    1327 <main+0x187>
mov    -0x2a0(%rbp),%rdi
lea    -0x90(%rbp),%rdx
lea    0xd7e(%rip),%rsi
call   1070 <fscanf@plt>
mov    %rax,%rcx
xor    %eax,%eax
mov    0x2c9b(%rip),%rdx
cmp    (%rdx),%rcx
mov    %al,-0x2a1(%rbp)
je     137c <main+0x1dc>
lea    -0x90(%rbp),%rdi
lea    0xd53(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x2a1(%rbp)
mov    -0x2a1(%rbp),%al
test   $0x1,%al
jne    138f <main+0x1ef>
jmp    14a6 <main+0x306>
lea    -0x90(%rbp),%rdi
lea    0xd38(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    13cb <main+0x22b>
mov    -0x2a0(%rbp),%rdi
lea    -0x110(%rbp),%rdx
lea    0xcf9(%rip),%rsi
call   1070 <fscanf@plt>
jmp    14a1 <main+0x301>
lea    -0x90(%rbp),%rdi
lea    0xcea(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1407 <main+0x267>
mov    -0x2a0(%rbp),%rdi
lea    -0x190(%rbp),%rdx
lea    0xcbd(%rip),%rsi
call   1070 <fscanf@plt>
jmp    149c <main+0x2fc>
lea    -0x90(%rbp),%rdi
lea    0xcb6(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1443 <main+0x2a3>
mov    -0x2a0(%rbp),%rdi
lea    -0x210(%rbp),%rdx
lea    0xc81(%rip),%rsi
call   1070 <fscanf@plt>
jmp    1497 <main+0x2f7>
lea    -0x90(%rbp),%rdi
lea    0xc82(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    147f <main+0x2df>
mov    -0x2a0(%rbp),%rdi
lea    -0x290(%rbp),%rdx
lea    0xc45(%rip),%rsi
call   1070 <fscanf@plt>
jmp    1492 <main+0x2f2>
lea    -0x90(%rbp),%rsi
lea    0xc50(%rip),%rdi
call   1050 <printf@plt>
jmp    1497 <main+0x2f7>
jmp    149c <main+0x2fc>
jmp    14a1 <main+0x301>
jmp    1327 <main+0x187>
lea    -0x90(%rbp),%rdi
lea    0xc4f(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x90(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   10b0 <strcat@plt>
lea    -0x90(%rbp),%rdi
lea    0xc30(%rip),%rsi
call   10b0 <strcat@plt>
lea    -0x90(%rbp),%rdi
lea    -0x110(%rbp),%rsi
call   10b0 <strcat@plt>
cmpb   $0x0,-0x190(%rbp)
je     1526 <main+0x386>
lea    -0x90(%rbp),%rdi
lea    0xbff(%rip),%rsi
call   10b0 <strcat@plt>
lea    -0x90(%rbp),%rdi
lea    -0x190(%rbp),%rsi
call   10b0 <strcat@plt>
cmpb   $0x0,-0x290(%rbp)
je     1559 <main+0x3b9>
lea    -0x90(%rbp),%rdi
lea    0xbd6(%rip),%rsi
call   10b0 <strcat@plt>
lea    -0x90(%rbp),%rdi
lea    -0x290(%rbp),%rsi
call   10b0 <strcat@plt>
lea    -0x90(%rbp),%rdi
lea    0xbbb(%rip),%rsi
call   10b0 <strcat@plt>
lea    -0x90(%rbp),%rdi
call   1040 <system@plt>
mov    %eax,-0x294(%rbp)
cmp    $0x0,%eax
je     1595 <main+0x3f5>
mov    -0x294(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1633 <main+0x493>
cmpb   $0x0,-0x210(%rbp)
je     161d <main+0x47d>
lea    -0x90(%rbp),%rdi
lea    0xb76(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x90(%rbp),%rdi
lea    -0x210(%rbp),%rsi
call   10b0 <strcat@plt>
lea    -0x90(%rbp),%rdi
lea    0xb35(%rip),%rsi
call   10b0 <strcat@plt>
lea    -0x90(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   10b0 <strcat@plt>
lea    -0x90(%rbp),%rdi
call   1040 <system@plt>
mov    %eax,-0x294(%rbp)
cmp    $0x0,%eax
je     1618 <main+0x478>
mov    -0x294(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1633 <main+0x493>
jmp    161d <main+0x47d>
jmp    1622 <main+0x482>
jmp    129e <main+0xfe>
jmp    162c <main+0x48c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x2b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x288,%rsp
movaps 0xed8(%rip),%xmm0
movaps %xmm0,0x1f0(%rsp)
movaps 0xeb9(%rip),%xmm0
movaps %xmm0,0x1e0(%rsp)
movaps 0xe9a(%rip),%xmm0
movaps %xmm0,0x1d0(%rsp)
movaps 0xe7b(%rip),%xmm0
movaps %xmm0,0x1c0(%rsp)
movaps 0xe5c(%rip),%xmm0
movaps %xmm0,0x1b0(%rsp)
movaps 0xe3d(%rip),%xmm0
movaps %xmm0,0x1a0(%rsp)
movaps 0xe1e(%rip),%xmm0
movaps %xmm0,0x190(%rsp)
movaps 0xdff(%rip),%xmm0
movaps %xmm0,0x180(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x270(%rsp)
movaps %xmm0,0x260(%rsp)
movaps %xmm0,0x250(%rsp)
movaps %xmm0,0x240(%rsp)
movaps %xmm0,0x230(%rsp)
movaps %xmm0,0x220(%rsp)
movaps %xmm0,0x210(%rsp)
movaps %xmm0,0x200(%rsp)
movaps %xmm0,0x170(%rsp)
movaps %xmm0,0x160(%rsp)
movaps %xmm0,0x150(%rsp)
movaps %xmm0,0x140(%rsp)
movaps %xmm0,0x130(%rsp)
movaps %xmm0,0x120(%rsp)
movaps %xmm0,0x110(%rsp)
movaps %xmm0,0x100(%rsp)
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
cmp    $0x2,%edi
jne    15cd <main+0x44d>
mov    %rsi,%r15
mov    0x8(%rsi),%rsi
lea    0x180(%rsp),%rbx
mov    %rbx,%rdi
call   1090 <strcat@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
xor    %ebx,%ebx
test   %eax,%eax
je     15e3 <main+0x463>
mov    0x8(%r15),%rsi
lea    0xd50(%rip),%rdi
call   1050 <printf@plt>
lea    0xd74(%rip),%rdi
lea    0xd75(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%rbp
lea    0xd68(%rip),%rsi
lea    0x180(%rsp),%rdx
mov    %rax,%rdi
call   1060 <fscanf@plt>
mov    0x2c7f(%rip),%r14
cmp    (%r14),%rax
je     15e3 <main+0x463>
lea    0xd44(%rip),%r12
lea    0x180(%rsp),%rbx
lea    0xd32(%rip),%r13
jmp    13a7 <main+0x227>
nopw   0x0(%rax,%rax,1)
mov    %rbp,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
call   1060 <fscanf@plt>
cmp    (%r14),%rax
je     15e1 <main+0x461>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    1390 <main+0x210>
mov    %rbp,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
call   1060 <fscanf@plt>
mov    0x8(%r15),%rsi
mov    %rbx,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    1390 <main+0x210>
jmp    13f3 <main+0x273>
nopl   0x0(%rax,%rax,1)
mov    %rbp,%rdi
mov    %r13,%rsi
lea    0x200(%rsp),%rdx
call   1060 <fscanf@plt>
mov    %rbp,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
call   1060 <fscanf@plt>
cmp    (%r14),%rax
je     14d3 <main+0x353>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     14d3 <main+0x353>
mov    %rbx,%rdi
lea    0xcad(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     13e0 <main+0x260>
mov    %rbx,%rdi
lea    0xc87(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1490 <main+0x310>
mov    %rbx,%rdi
lea    0xc7b(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     14a8 <main+0x328>
mov    %rbx,%rdi
lea    0xc6f(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     14c0 <main+0x340>
lea    0xc68(%rip),%rdi
mov    %rbx,%rsi
call   1050 <printf@plt>
jmp    13f3 <main+0x273>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbp,%rdi
mov    %r13,%rsi
lea    0x100(%rsp),%rdx
call   1060 <fscanf@plt>
jmp    13f3 <main+0x273>
mov    %rbp,%rdi
mov    %r13,%rsi
lea    0x80(%rsp),%rdx
call   1060 <fscanf@plt>
jmp    13f3 <main+0x273>
mov    %rbp,%rdi
mov    %r13,%rsi
mov    %rsp,%rdx
call   1060 <fscanf@plt>
jmp    13f3 <main+0x273>
mov    %rbx,%rdi
lea    0xc26(%rip),%rsi
call   1030 <strcpy@plt>
mov    0x8(%r15),%rsi
mov    %rbx,%rdi
call   1090 <strcat@plt>
mov    %rbx,%rdi
lea    0xc13(%rip),%rsi
call   1090 <strcat@plt>
mov    %rbx,%rdi
lea    0x200(%rsp),%rsi
call   1090 <strcat@plt>
cmpb   $0x0,0x100(%rsp)
je     1536 <main+0x3b6>
mov    %rbx,%rdi
lea    0xbec(%rip),%rsi
call   1090 <strcat@plt>
mov    %rbx,%rdi
lea    0x100(%rsp),%rsi
call   1090 <strcat@plt>
cmpb   $0x0,(%rsp)
je     1556 <main+0x3d6>
mov    %rbx,%rdi
lea    0xbd1(%rip),%rsi
call   1090 <strcat@plt>
mov    %rbx,%rdi
mov    %rsp,%rsi
call   1090 <strcat@plt>
mov    %rbx,%rdi
lea    0xbc2(%rip),%rsi
call   1090 <strcat@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
test   %eax,%eax
jne    15c9 <main+0x449>
cmpb   $0x0,0x80(%rsp)
je     1390 <main+0x210>
mov    %rbx,%rdi
lea    0xb9d(%rip),%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
lea    0x80(%rsp),%rsi
call   1090 <strcat@plt>
mov    %rbx,%rdi
lea    0xb63(%rip),%rsi
call   1090 <strcat@plt>
mov    0x8(%r15),%rsi
mov    %rbx,%rdi
call   1090 <strcat@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
test   %eax,%eax
je     1390 <main+0x210>
mov    %eax,%ebx
jmp    15e3 <main+0x463>
xor    %ebx,%ebx
xor    %eax,%eax
call   10a0 <print_usage@plt>
mov    0x29fb(%rip),%rax
sub    (%rax),%ebx
jmp    15e3 <main+0x463>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x288,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.buf = [128 x i8] c"bootpc \00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@EINVAL = global i32 0
@.str = [48 x i8] c"BOOTP failed, loading default config for %s...\0A\00"
@.str.1 = [8 x i8] c"network\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [3 x i8] c"%s\00"
@EOF = global i64 0
@.str.4 = [6 x i8] c"iface\00"
@.str.5 = [8 x i8] c"address\00"
@.str.6 = [8 x i8] c"netmask\00"
@.str.7 = [8 x i8] c"gateway\00"
@.str.8 = [10 x i8] c"hwaddress\00"
@.str.9 = [38 x i8] c"WARNING: Unknown iface parameter: %s\0A\00"
@.str.10 = [10 x i8] c"ifconfig \00"
@.str.11 = [2 x i8] c" \00"
@.str.12 = [10 x i8] c" netmask \00"
@.str.13 = [11 x i8] c" hw ether \00"
@.str.14 = [4 x i8] c" up\00"
@.str.15 = [22 x i8] c"route add default gw \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [128 x i8]
%7 = alloca [128 x i8]
%8 = alloca [128 x i8]
%9 = alloca [128 x i8]
%10 = alloca [128 x i8]
%11 = alloca i32
%12 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = bitcast [128 x i8]* %6 to i8*
%14 = bitcast [128 x i8]* %7 to i8*
%15 = bitcast [128 x i8]* %8 to i8*
%16 = bitcast [128 x i8]* %9 to i8*
%17 = bitcast [128 x i8]* %10 to i8*
%18 = load i32, i32* %4
%19 = icmp ne i32 %18, 2
br i1 %19, label %20, label %24
20: ; preds = %2
%21 = call i32 (...) @print_usage()
%22 = load i32, i32* @EINVAL
%23 = sub nsw i32 0, %22
store i32 %23, i32* %3
br label %179
24: ; preds = %2
%25 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = call i32 @strcat(i8* %25, i8* %28)
%30 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%31 = call i32 @system(i8* %30)
store i32 %31, i32* %11
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %178
33: ; preds = %24
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 1
%36 = load i8*, i8** %35
%37 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8* %36)
%38 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %38, i32** %12
br label %39
39: ; preds = %176, %59, %33
%40 = load i32*, i32** %12
%41 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%42 = call i64 @fscanf(i32* %40, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %41)
%43 = load i64, i64* @EOF
%44 = icmp ne i64 %42, %43
br i1 %44, label %45, label %177
45: ; preds = %39
%46 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%47 = call i64 @strcmp(i8* %46, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%48 = icmp ne i64 %47, 0
br i1 %48, label %176, label %49
49: ; preds = %45
%50 = load i32*, i32** %12
%51 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%52 = call i64 @fscanf(i32* %50, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %51)
%53 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%54 = load i8**, i8*** %5
%55 = getelementptr inbounds i8*, i8** %54, i64 1
%56 = load i8*, i8** %55
%57 = call i64 @strcmp(i8* %53, i8* %56)
%58 = icmp ne i64 %57, 0
br i1 %58, label %59, label %60
59: ; preds = %49
br label %39
60: ; preds = %49
br label %61
61: ; preds = %111, %60
%62 = load i32*, i32** %12
%63 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%64 = call i64 @fscanf(i32* %62, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %63)
%65 = load i64, i64* @EOF
%66 = icmp ne i64 %64, %65
br i1 %66, label %67, label %71
67: ; preds = %61
%68 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%69 = call i64 @strcmp(i8* %68, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%70 = icmp ne i64 %69, 0
br label %71
71: ; preds = %67, %61
%72 = phi i1 [ false, %61 ], [ %70, %67 ]
br i1 %72, label %73, label %112
73: ; preds = %71
%74 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%75 = call i64 @strcmp(i8* %74, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%76 = icmp ne i64 %75, 0
br i1 %76, label %81, label %77
77: ; preds = %73
%78 = load i32*, i32** %12
%79 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%80 = call i64 @fscanf(i32* %78, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %79)
br label %111
81: ; preds = %73
%82 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%83 = call i64 @strcmp(i8* %82, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
%84 = icmp ne i64 %83, 0
br i1 %84, label %89, label %85
85: ; preds = %81
%86 = load i32*, i32** %12
%87 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%88 = call i64 @fscanf(i32* %86, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %87)
br label %110
89: ; preds = %81
%90 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%91 = call i64 @strcmp(i8* %90, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
%92 = icmp ne i64 %91, 0
br i1 %92, label %97, label %93
93: ; preds = %89
%94 = load i32*, i32** %12
%95 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%96 = call i64 @fscanf(i32* %94, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %95)
br label %109
97: ; preds = %89
%98 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%99 = call i64 @strcmp(i8* %98, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
%100 = icmp ne i64 %99, 0
br i1 %100, label %105, label %101
101: ; preds = %97
%102 = load i32*, i32** %12
%103 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%104 = call i64 @fscanf(i32* %102, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %103)
br label %108
105: ; preds = %97
%106 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%107 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.9, i64 0, i64 0), i8* %106)
br label %108
108: ; preds = %105, %101
br label %109
109: ; preds = %108, %93
br label %110
110: ; preds = %109, %85
br label %111
111: ; preds = %110, %77
br label %61
112: ; preds = %71
%113 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%114 = call i32 @strcpy(i8* %113, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0))
%115 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%116 = load i8**, i8*** %5
%117 = getelementptr inbounds i8*, i8** %116, i64 1
%118 = load i8*, i8** %117
%119 = call i32 @strcat(i8* %115, i8* %118)
%120 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%121 = call i32 @strcat(i8* %120, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
%122 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%123 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%124 = call i32 @strcat(i8* %122, i8* %123)
%125 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%126 = load i8, i8* %125
%127 = icmp ne i8 %126, 0
br i1 %127, label %128, label %134
128: ; preds = %112
%129 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%130 = call i32 @strcat(i8* %129, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0))
%131 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%132 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%133 = call i32 @strcat(i8* %131, i8* %132)
br label %134
134: ; preds = %128, %112
%135 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%136 = load i8, i8* %135
%137 = icmp ne i8 %136, 0
br i1 %137, label %138, label %144
138: ; preds = %134
%139 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%140 = call i32 @strcat(i8* %139, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.13, i64 0, i64 0))
%141 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%142 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%143 = call i32 @strcat(i8* %141, i8* %142)
br label %144
144: ; preds = %138, %134
%145 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%146 = call i32 @strcat(i8* %145, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i64 0, i64 0))
%147 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%148 = call i32 @system(i8* %147)
store i32 %148, i32* %11
%149 = icmp ne i32 %148, 0
br i1 %149, label %150, label %152
150: ; preds = %144
%151 = load i32, i32* %11
store i32 %151, i32* %3
br label %179
152: ; preds = %144
%153 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%154 = load i8, i8* %153
%155 = icmp ne i8 %154, 0
br i1 %155, label %156, label %175
156: ; preds = %152
%157 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%158 = call i32 @strcpy(i8* %157, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.15, i64 0, i64 0))
%159 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%160 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%161 = call i32 @strcat(i8* %159, i8* %160)
%162 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%163 = call i32 @strcat(i8* %162, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
%164 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%165 = load i8**, i8*** %5
%166 = getelementptr inbounds i8*, i8** %165, i64 1
%167 = load i8*, i8** %166
%168 = call i32 @strcat(i8* %164, i8* %167)
%169 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%170 = call i32 @system(i8* %169)
store i32 %170, i32* %11
%171 = icmp ne i32 %170, 0
br i1 %171, label %172, label %174
172: ; preds = %156
%173 = load i32, i32* %11
store i32 %173, i32* %3
br label %179
174: ; preds = %156
br label %175
175: ; preds = %174, %152
br label %176
176: ; preds = %175, %45
br label %39
177: ; preds = %39
br label %178
178: ; preds = %177, %24
store i32 0, i32* %3
br label %179
179: ; preds = %178, %172, %150, %20
%180 = load i32, i32* %3
ret i32 %180
}

LLVM IR (-O2):
@__const.main.buf = [128 x i8] c"bootpc \00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@EINVAL = global i32 0
@.str = [48 x i8] c"BOOTP failed, loading default config for %s...\0A\00"
@.str.1 = [8 x i8] c"network\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [3 x i8] c"%s\00"
@EOF = global i64 0
@.str.4 = [6 x i8] c"iface\00"
@.str.5 = [8 x i8] c"address\00"
@.str.6 = [8 x i8] c"netmask\00"
@.str.7 = [8 x i8] c"gateway\00"
@.str.8 = [10 x i8] c"hwaddress\00"
@.str.9 = [38 x i8] c"WARNING: Unknown iface parameter: %s\0A\00"
@.str.10 = [10 x i8] c"ifconfig \00"
@.str.11 = [2 x i8] c" \00"
@.str.12 = [10 x i8] c" netmask \00"
@.str.13 = [11 x i8] c" hw ether \00"
@.str.14 = [4 x i8] c" up\00"
@.str.15 = [22 x i8] c"route add default gw \00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [128 x i8]
%4 = alloca [128 x i8]
%5 = alloca [128 x i8]
%6 = alloca [128 x i8]
%7 = alloca [128 x i8]
%8 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%10 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%11 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%12 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%13 = icmp eq i32 %0, 2
br i1 %13, label %18, label %14
14: ; preds = %2
%15 = tail call i32 (...) @print_usage()
%16 = load i32, i32* @EINVAL
%17 = sub nsw i32 0, %16
br label %108
18: ; preds = %2
%19 = getelementptr inbounds i8*, i8** %1, i64 1
%20 = load i8*, i8** %19
%21 = call i32 @strcat(i8* %8, i8* %20)
%22 = call i32 @system(i8* %8)
%23 = icmp eq i32 %22, 0
br i1 %23, label %108, label %24
24: ; preds = %18
%25 = load i8*, i8** %19
%26 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8* %25)
%27 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%28 = call i64 @fscanf(i32* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %8)
%29 = load i64, i64* @EOF
%30 = icmp eq i64 %28, %29
br i1 %30, label %108, label %31
31: ; preds = %24, %104
%32 = call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %104
34: ; preds = %31
%35 = call i64 @fscanf(i32* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %8)
%36 = load i8*, i8** %19
%37 = call i64 @strcmp(i8* %8, i8* %36)
%38 = icmp eq i64 %37, 0
br i1 %38, label %39, label %104
39: ; preds = %34
%40 = call i64 @fscanf(i32* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %8)
%41 = load i64, i64* @EOF
%42 = icmp eq i64 %40, %41
br i1 %42, label %72, label %43
43: ; preds = %39, %68
%44 = call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%45 = icmp eq i64 %44, 0
br i1 %45, label %72, label %46
46: ; preds = %43
%47 = call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%48 = icmp eq i64 %47, 0
br i1 %48, label %49, label %51
49: ; preds = %46
%50 = call i64 @fscanf(i32* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %9)
br label %68
51: ; preds = %46
%52 = call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
%53 = icmp eq i64 %52, 0
br i1 %53, label %54, label %56
54: ; preds = %51
%55 = call i64 @fscanf(i32* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %10)
br label %68
56: ; preds = %51
%57 = call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
%58 = icmp eq i64 %57, 0
br i1 %58, label %59, label %61
59: ; preds = %56
%60 = call i64 @fscanf(i32* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %11)
br label %68
61: ; preds = %56
%62 = call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
%63 = icmp eq i64 %62, 0
br i1 %63, label %64, label %66
64: ; preds = %61
%65 = call i64 @fscanf(i32* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %12)
br label %68
66: ; preds = %61
%67 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.9, i64 0, i64 0), i8* %8)
br label %68
68: ; preds = %54, %64, %66, %59, %49
%69 = call i64 @fscanf(i32* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %8)
%70 = load i64, i64* @EOF
%71 = icmp eq i64 %69, %70
br i1 %71, label %72, label %43
72: ; preds = %43, %68, %39
%73 = call i32 @strcpy(i8* %8, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0))
%74 = load i8*, i8** %19
%75 = call i32 @strcat(i8* %8, i8* %74)
%76 = call i32 @strcat(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
%77 = call i32 @strcat(i8* %8, i8* %9)
%78 = load i8, i8* %10
%79 = icmp eq i8 %78, 0
br i1 %79, label %83, label %80
80: ; preds = %72
%81 = call i32 @strcat(i8* %8, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0))
%82 = call i32 @strcat(i8* %8, i8* %10)
br label %83
83: ; preds = %80, %72
%84 = load i8, i8* %12
%85 = icmp eq i8 %84, 0
br i1 %85, label %89, label %86
86: ; preds = %83
%87 = call i32 @strcat(i8* %8, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.13, i64 0, i64 0))
%88 = call i32 @strcat(i8* %8, i8* %12)
br label %89
89: ; preds = %86, %83
%90 = call i32 @strcat(i8* %8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i64 0, i64 0))
%91 = call i32 @system(i8* %8)
%92 = icmp eq i32 %91, 0
br i1 %92, label %93, label %108
93: ; preds = %89
%94 = load i8, i8* %11
%95 = icmp eq i8 %94, 0
br i1 %95, label %104, label %96
96: ; preds = %93
%97 = call i32 @strcpy(i8* %8, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.15, i64 0, i64 0))
%98 = call i32 @strcat(i8* %8, i8* %11)
%99 = call i32 @strcat(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
%100 = load i8*, i8** %19
%101 = call i32 @strcat(i8* %8, i8* %100)
%102 = call i32 @system(i8* %8)
%103 = icmp eq i32 %102, 0
br i1 %103, label %104, label %108
104: ; preds = %31, %96, %93, %34
%105 = call i64 @fscanf(i32* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %8)
%106 = load i64, i64* @EOF
%107 = icmp eq i64 %105, %106
br i1 %107, label %108, label %31
108: ; preds = %89, %96, %104, %24, %18, %14
%109 = phi i32 [ %17, %14 ], [ 0, %18 ], [ 0, %24 ], [ %91, %89 ], [ %102, %96 ], [ 0, %104 ]
ret i32 %109
}