#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*/ printf(char *, ...);
scalar_t__ strncmp(char *, char *, int);
int system(char *);
int main(int argc, char *argv[]) {
  int apache_return_val;
  if (argc > 1) {
    if (strncmp(argv[1], "configtest", 16) == 0) {
      apache_return_val = system("/usr/sbin/apache2ctl configtest");
      return apache_return_val;
    } else if (strncmp(argv[1], "restart", 16) == 0) {
      apache_return_val = system("/usr/sbin/apache2ctl configtest");
      if (apache_return_val == 0) {
        apache_return_val = system("/usr/sbin/apache2ctl restart");
        if (apache_return_val == 0)
          printf("Restart successful\n");
        else
          printf("Restart was problematic. Please check error messages, fix "
                 "the problem and try again.\n");
        return apache_return_val;
      } else {
        printf("\n\nThe configuration files have an error. Refusing to restart "
               "apache until the errors are corrected.\n\n");
      }
      return apache_return_val;
    }
  }
  printf("Usage: %s configtest|restart\n", argv[0]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1231 <main+0x101>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x10,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    118d <main+0x5d>
lea    0xe86(%rip),%rdi
call   1040 <system@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    124d <main+0x11d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe99(%rip),%rsi
mov    $0x10,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1227 <main+0xf7>
lea    0xe49(%rip),%rdi
call   1040 <system@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    120e <main+0xde>
lea    0xe50(%rip),%rdi
call   1040 <system@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    11f5 <main+0xc5>
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1203 <main+0xd3>
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    124d <main+0x11d>
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    124d <main+0x11d>
jmp    122c <main+0xfc>
jmp    1231 <main+0x101>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
cmp    $0x2,%edi
jl     117d <main+0x3d>
mov    0x8(%rbx),%rdi
lea    0xec1(%rip),%rsi
mov    $0x10,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1194 <main+0x54>
mov    0x8(%rbx),%rdi
lea    0xec7(%rip),%rsi
mov    $0x10,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11a1 <main+0x61>
mov    (%rbx),%rsi
lea    0xeb6(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret
lea    0xe65(%rip),%rdi
pop    %rbx
jmp    1050 <system@plt>
lea    0xe58(%rip),%rdi
call   1050 <system@plt>
test   %eax,%eax
je     11c1 <main+0x81>
mov    %eax,%ebx
lea    0xea1(%rip),%rdi
call   1040 <puts@plt>
jmp    1190 <main+0x50>
lea    0xe58(%rip),%rdi
call   1050 <system@plt>
test   %eax,%eax
je     11e1 <main+0xa1>
mov    %eax,%ebx
lea    0xee6(%rip),%rdi
call   1040 <puts@plt>
jmp    1190 <main+0x50>
lea    0xf2d(%rip),%rdi
call   1040 <puts@plt>
xor    %ebx,%ebx
jmp    1190 <main+0x50>

LLVM IR (-O0):
@.str = [11 x i8] c"configtest\00"
@.str.1 = [32 x i8] c"/usr/sbin/apache2ctl configtest\00"
@.str.2 = [8 x i8] c"restart\00"
@.str.3 = [29 x i8] c"/usr/sbin/apache2ctl restart\00"
@.str.4 = [20 x i8] c"Restart successful\0A\00"
@.str.5 = [86 x i8] c"Restart was problematic. Please check error messages, fix the problem and try again.\0A\00"
@.str.6 = [102 x i8] c"\0A\0AThe configuration files have an error. Refusing to restart apache until the errors are corrected.\0A\0A\00"
@.str.7 = [30 x i8] c"Usage: %s configtest|restart\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 1
br i1 %8, label %9, label %44
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i64 @strncmp(i8* %12, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 16)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %9
%16 = call i32 @system(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
store i32 %16, i32* %6
%17 = load i32, i32* %6
store i32 %17, i32* %3
br label %49
18: ; preds = %9
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i64 @strncmp(i8* %21, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 16)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %42
24: ; preds = %18
%25 = call i32 @system(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
store i32 %25, i32* %6
%26 = load i32, i32* %6
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %38
28: ; preds = %24
%29 = call i32 @system(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
store i32 %29, i32* %6
%30 = load i32, i32* %6
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %28
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
br label %36
34: ; preds = %28
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str.5, i64 0, i64 0))
br label %36
36: ; preds = %34, %32
%37 = load i32, i32* %6
store i32 %37, i32* %3
br label %49
38: ; preds = %24
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([102 x i8], [102 x i8]* @.str.6, i64 0, i64 0))
br label %40
40: ; preds = %38
%41 = load i32, i32* %6
store i32 %41, i32* %3
br label %49
42: ; preds = %18
br label %43
43: ; preds = %42
br label %44
44: ; preds = %43, %2
%45 = load i8**, i8*** %5
%46 = getelementptr inbounds i8*, i8** %45, i64 0
%47 = load i8*, i8** %46
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0), i8* %47)
store i32 0, i32* %3
br label %49
49: ; preds = %44, %40, %36, %15
%50 = load i32, i32* %3
ret i32 %50
}

LLVM IR (-O2):
@.str = [11 x i8] c"configtest\00"
@.str.1 = [32 x i8] c"/usr/sbin/apache2ctl configtest\00"
@.str.2 = [8 x i8] c"restart\00"
@.str.3 = [29 x i8] c"/usr/sbin/apache2ctl restart\00"
@.str.7 = [30 x i8] c"Usage: %s configtest|restart\0A\00"
@str = [101 x i8] c"\0A\0AThe configuration files have an error. Refusing to restart apache until the errors are corrected.\0A\00"
@str.8 = [85 x i8] c"Restart was problematic. Please check error messages, fix the problem and try again.\00"
@str.9 = [19 x i8] c"Restart successful\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %27
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i64 @strncmp(i8* %6, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 16)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %4
%10 = tail call i32 @system(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
br label %30
11: ; preds = %4
%12 = load i8*, i8** %5
%13 = tail call i64 @strncmp(i8* %12, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 16)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %27
15: ; preds = %11
%16 = tail call i32 @system(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %25
18: ; preds = %15
%19 = tail call i32 @system(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.9, i64 0, i64 0))
br label %30
23: ; preds = %18
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([85 x i8], [85 x i8]* @str.8, i64 0, i64 0))
br label %30
25: ; preds = %15
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([101 x i8], [101 x i8]* @str, i64 0, i64 0))
br label %30
27: ; preds = %11, %2
%28 = load i8*, i8** %1
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0), i8* %28)
br label %30
30: ; preds = %21, %23, %27, %25, %9
%31 = phi i32 [ %10, %9 ], [ %16, %25 ], [ 0, %27 ], [ %19, %23 ], [ 0, %21 ]
ret i32 %31
}