#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*/ conftext;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int /*<<< orphan*/ configure(char *, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ help();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  char *conffile = "/etc/ngsdhcp/default.conf";
  FILE *conf;
  printf("Checking args\n");
  if (argc > 1) {
    printf("In the if-statement\n");
    for (int i = 1; i < argc; i++) {
      if (!strcmp("-h", argv[i])) {
        help();
      } else if (!strcmp("-c", argv[i])) {
        printf("It seems you have used -c\n");
        conffile = argv[i + 1];
      }
    }
  }
  printf("The considered configfile is: %s\n", conffile);
  conf = fopen(conffile, "r");
  printf("Opened\n");
  int tmp, i = 0;
  char conftext[189];
  while ((tmp = fgetc(conf)) != EOF) {
    conftext[i] = tmp;
    i++;
  }
  printf("Go to configure\n");
  configure(conftext, (sizeof(conftext) / sizeof(conftext[0])));
  fclose(conf);
  printf("DHCP-Server just has started\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe70(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x1,-0x8(%rbp)
jle    125b <main+0xeb>
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1256 <main+0xe6>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe5e(%rip),%rdi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    11fa <main+0x8a>
mov    $0x0,%al
call   1090 <help@plt>
jmp    1243 <main+0xd3>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe34(%rip),%rdi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    123e <main+0xce>
lea    0xe22(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x18(%rbp)
jmp    1243 <main+0xd3>
jmp    1248 <main+0xd8>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11c1 <main+0x51>
jmp    125b <main+0xeb>
mov    -0x18(%rbp),%rsi
lea    0xdf9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
lea    0xe09(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x20(%rbp)
lea    0xdfb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %eax,-0x28(%rbp)
mov    0x2d3f(%rip),%rcx
cmp    (%rcx),%eax
je     12cf <main+0x15f>
mov    -0x28(%rbp),%eax
mov    %al,%cl
movslq -0x2c(%rbp),%rax
mov    %cl,-0xf0(%rbp,%rax,1)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1296 <main+0x126>
lea    0xdb5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xf0(%rbp),%rdi
mov    $0xbd,%esi
call   1070 <configure@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
lea    0xd9e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc8,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xea4(%rip),%rdi
call   1030 <puts@plt>
cmp    $0x2,%ebp
jl     1219 <main+0x99>
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
mov    %ebp,%r13d
lea    0xe43(%rip),%r14
mov    $0x1,%r12d
lea    0xe50(%rip),%r15
jmp    11e0 <main+0x60>
nopl   0x0(%rax)
xor    %eax,%eax
call   10a0 <help@plt>
add    $0x1,%r12
cmp    %r12,%r13
je     1220 <main+0xa0>
mov    (%rbx,%r12,8),%rbp
mov    %r15,%rdi
mov    %rbp,%rsi
call   1070 <strcmp@plt>
test   %eax,%eax
je     11d0 <main+0x50>
lea    0xeb4(%rip),%rdi
mov    %rbp,%rsi
call   1070 <strcmp@plt>
test   %eax,%eax
jne    11d7 <main+0x57>
lea    0xe8a(%rip),%rdi
call   1030 <puts@plt>
mov    0x8(%rbx,%r12,8),%r14
jmp    11d7 <main+0x57>
lea    0xde0(%rip),%r14
lea    0xdf6(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe07(%rip),%rsi
mov    %r14,%rdi
call   1090 <fopen@plt>
mov    %rax,%rbx
lea    0xe05(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1060 <fgetc@plt>
mov    0x2d8a(%rip),%r14
cmp    (%r14),%eax
je     1284 <main+0x104>
mov    %rsp,%rbp
cs nopw 0x0(%rax,%rax,1)
mov    %al,0x0(%rbp)
mov    %rbx,%rdi
call   1060 <fgetc@plt>
add    $0x1,%rbp
cmp    (%r14),%eax
jne    1270 <main+0xf0>
lea    0xdcb(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rdi
mov    $0xbd,%esi
call   1080 <configure@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
lea    0xdba(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0xc8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [26 x i8] c"/etc/ngsdhcp/default.conf\00"
@.str.1 = [15 x i8] c"Checking args\0A\00"
@.str.2 = [21 x i8] c"In the if-statement\0A\00"
@.str.3 = [3 x i8] c"-h\00"
@.str.4 = [3 x i8] c"-c\00"
@.str.5 = [27 x i8] c"It seems you have used -c\0A\00"
@.str.6 = [34 x i8] c"The considered configfile is: %s\0A\00"
@.str.7 = [2 x i8] c"r\00"
@.str.8 = [8 x i8] c"Opened\0A\00"
@EOF = global i32 0
@.str.9 = [17 x i8] c"Go to configure\0A\00"
@.str.10 = [30 x i8] c"DHCP-Server just has started\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca [189 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8** %6
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%13 = load i32, i32* %4
%14 = icmp sgt i32 %13, 1
br i1 %14, label %15, label %53
15: ; preds = %2
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %8
br label %17
17: ; preds = %49, %15
%18 = load i32, i32* %8
%19 = load i32, i32* %4
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %52
21: ; preds = %17
%22 = load i8**, i8*** %5
%23 = load i32, i32* %8
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8*, i8** %22, i64 %24
%26 = load i8*, i8** %25
%27 = call i32 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %26)
%28 = icmp ne i32 %27, 0
br i1 %28, label %31, label %29
29: ; preds = %21
%30 = call i32 (...) @help()
br label %48
31: ; preds = %21
%32 = load i8**, i8*** %5
%33 = load i32, i32* %8
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8*, i8** %32, i64 %34
%36 = load i8*, i8** %35
%37 = call i32 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %36)
%38 = icmp ne i32 %37, 0
br i1 %38, label %47, label %39
39: ; preds = %31
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
%41 = load i8**, i8*** %5
%42 = load i32, i32* %8
%43 = add nsw i32 %42, 1
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8*, i8** %41, i64 %44
%46 = load i8*, i8** %45
store i8* %46, i8** %6
br label %47
47: ; preds = %39, %31
br label %48
48: ; preds = %47, %29
br label %49
49: ; preds = %48
%50 = load i32, i32* %8
%51 = add nsw i32 %50, 1
store i32 %51, i32* %8
br label %17
52: ; preds = %17
br label %53
53: ; preds = %52, %2
%54 = load i8*, i8** %6
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0), i8* %54)
%56 = load i8*, i8** %6
%57 = call i32* @fopen(i8* %56, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
store i32* %57, i32** %7
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
store i32 0, i32* %10
br label %59
59: ; preds = %64, %53
%60 = load i32*, i32** %7
%61 = call i32 @fgetc(i32* %60)
store i32 %61, i32* %9
%62 = load i32, i32* @EOF
%63 = icmp ne i32 %61, %62
br i1 %63, label %64, label %72
64: ; preds = %59
%65 = load i32, i32* %9
%66 = trunc i32 %65 to i8
%67 = load i32, i32* %10
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [189 x i8], [189 x i8]* %11, i64 0, i64 %68
store i8 %66, i8* %69
%70 = load i32, i32* %10
%71 = add nsw i32 %70, 1
store i32 %71, i32* %10
br label %59
72: ; preds = %59
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0))
%74 = getelementptr inbounds [189 x i8], [189 x i8]* %11, i64 0, i64 0
%75 = call i32 @configure(i8* %74, i32 189)
%76 = load i32*, i32** %7
%77 = call i32 @fclose(i32* %76)
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.10, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [26 x i8] c"/etc/ngsdhcp/default.conf\00"
@.str.3 = [3 x i8] c"-h\00"
@.str.4 = [3 x i8] c"-c\00"
@.str.6 = [34 x i8] c"The considered configfile is: %s\0A\00"
@.str.7 = [2 x i8] c"r\00"
@EOF = global i32 0
@str = [14 x i8] c"Checking args\00"
@str.11 = [7 x i8] c"Opened\00"
@str.12 = [16 x i8] c"Go to configure\00"
@str.13 = [29 x i8] c"DHCP-Server just has started\00"
@str.14 = [20 x i8] c"In the if-statement\00"
@str.15 = [26 x i8] c"It seems you have used -c\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [189 x i8]
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %30
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.14, i64 0, i64 0))
%8 = zext i32 %0 to i64
br label %9
9: ; preds = %6, %26
%10 = phi i64 [ 1, %6 ], [ %28, %26 ]
%11 = phi i8* [ getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), %6 ], [ %27, %26 ]
%12 = getelementptr inbounds i8*, i8** %1, i64 %10
%13 = load i8*, i8** %12
%14 = tail call i32 @strcmp(i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* dereferenceable(1) %13)
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %9
%17 = tail call i32 (...) @help()
br label %26
18: ; preds = %9
%19 = tail call i32 @strcmp(i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* dereferenceable(1) %13)
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %26
21: ; preds = %18
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.15, i64 0, i64 0))
%23 = add nuw nsw i64 %10, 1
%24 = getelementptr inbounds i8*, i8** %1, i64 %23
%25 = load i8*, i8** %24
br label %26
26: ; preds = %16, %21, %18
%27 = phi i8* [ %11, %18 ], [ %25, %21 ], [ %11, %16 ]
%28 = add nuw nsw i64 %10, 1
%29 = icmp eq i64 %28, %8
br i1 %29, label %30, label %9
30: ; preds = %26, %2
%31 = phi i8* [ getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), %2 ], [ %27, %26 ]
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0), i8* %31)
%33 = tail call i32* @fopen(i8* %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%34 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.11, i64 0, i64 0))
%35 = getelementptr inbounds [189 x i8], [189 x i8]* %3, i64 0, i64 0
%36 = tail call i32 @fgetc(i32* %33)
%37 = load i32, i32* @EOF
%38 = icmp eq i32 %36, %37
br i1 %38, label %48, label %39
39: ; preds = %30, %39
%40 = phi i64 [ %44, %39 ], [ 0, %30 ]
%41 = phi i32 [ %45, %39 ], [ %36, %30 ]
%42 = trunc i32 %41 to i8
%43 = getelementptr inbounds [189 x i8], [189 x i8]* %3, i64 0, i64 %40
store i8 %42, i8* %43
%44 = add nuw i64 %40, 1
%45 = tail call i32 @fgetc(i32* %33)
%46 = load i32, i32* @EOF
%47 = icmp eq i32 %45, %46
br i1 %47, label %48, label %39
48: ; preds = %39, %30
%49 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.12, i64 0, i64 0))
%50 = call i32 @configure(i8* %35, i32 189)
%51 = call i32 @fclose(i32* %33)
%52 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.13, i64 0, i64 0))
ret i32 0
}