#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*/ config_file(char *, char *, int);
int /*<<< orphan*/ fileexist(char *);
int /*<<< orphan*/ printf(char *, char *, ...);
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  int quiet = 0;
  if (argc < 2) {
    printf("%s: Invalid syntax.\n", argv[0]);
    printf("Try: '%s <file_name>'\n\n", argv[0]);
  }
  if ((argc == 3) && (strcmp(argv[2], "--quiet") == 0)) {
    quiet = 1;
  }
  if (!fileexist("ossec.conf")) {
    printf("%s: Unable to find ossec config: '%s'.\n", argv[0], "ossec.conf");
  } else {
    config_file(argv[0], argv[1], quiet);
  }
  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)
movl   $0x0,-0x14(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1191 <main+0x51>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x3,-0x8(%rbp)
jne    11c0 <main+0x80>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe83(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11c0 <main+0x80>
movl   $0x1,-0x14(%rbp)
lea    0xe6e(%rip),%rdi
call   1050 <fileexist@plt>
cmp    $0x0,%eax
jne    11f6 <main+0xb6>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe5d(%rip),%rdi
lea    0xe4b(%rip),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
jmp    120d <main+0xcd>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x14(%rbp),%edx
call   1060 <config_file@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x1,%edi
jg     1171 <main+0x31>
mov    (%rbx),%rsi
lea    0xeab(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rbx),%rsi
lea    0xead(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1191 <main+0x51>
xor    %ebp,%ebp
cmp    $0x3,%edi
jne    1191 <main+0x51>
mov    0x10(%rbx),%rdi
lea    0xeaa(%rip),%rsi
call   1040 <strcmp@plt>
xor    %ebp,%ebp
test   %rax,%rax
sete   %bpl
lea    0xe9d(%rip),%rdi
call   1050 <fileexist@plt>
mov    (%rbx),%rcx
test   %eax,%eax
je     11b4 <main+0x74>
mov    0x8(%rbx),%rsi
mov    %rcx,%rdi
mov    %ebp,%edx
call   1060 <config_file@plt>
jmp    11cc <main+0x8c>
lea    0xe85(%rip),%rdi
lea    0xe73(%rip),%rdx
mov    %rcx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [21 x i8] c"%s: Invalid syntax.\0A\00"
@.str.1 = [24 x i8] c"Try: '%s <file_name>'\0A\0A\00"
@.str.2 = [8 x i8] c"--quiet\00"
@.str.3 = [11 x i8] c"ossec.conf\00"
@.str.4 = [40 x i8] c"%s: Unable to find ossec config: '%s'.\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
store i32 0, i32* %6
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %18
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 0
%12 = load i8*, i8** %11
%13 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %16)
br label %18
18: ; preds = %9, %2
%19 = load i32, i32* %4
%20 = icmp eq i32 %19, 3
br i1 %20, label %21, label %28
21: ; preds = %18
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 2
%24 = load i8*, i8** %23
%25 = call i64 @strcmp(i8* %24, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %21
store i32 1, i32* %6
br label %28
28: ; preds = %27, %21, %18
%29 = call i32 @fileexist(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%30 = icmp ne i32 %29, 0
br i1 %30, label %36, label %31
31: ; preds = %28
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 0
%34 = load i8*, i8** %33
%35 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0), i8* %34, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
br label %45
36: ; preds = %28
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 0
%39 = load i8*, i8** %38
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 1
%42 = load i8*, i8** %41
%43 = load i32, i32* %6
%44 = call i32 @config_file(i8* %39, i8* %42, i32 %43)
br label %45
45: ; preds = %36, %31
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"%s: Invalid syntax.\0A\00"
@.str.1 = [24 x i8] c"Try: '%s <file_name>'\0A\0A\00"
@.str.2 = [8 x i8] c"--quiet\00"
@.str.3 = [11 x i8] c"ossec.conf\00"
@.str.4 = [40 x i8] c"%s: Unable to find ossec config: '%s'.\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = load i8*, i8** %1
%8 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %7)
br label %17
9: ; preds = %2
%10 = icmp eq i32 %0, 3
br i1 %10, label %11, label %17
11: ; preds = %9
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = tail call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
%16 = zext i1 %15 to i32
br label %17
17: ; preds = %4, %11, %9
%18 = phi i32 [ 0, %9 ], [ %16, %11 ], [ 0, %4 ]
%19 = tail call i32 @fileexist(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%20 = icmp eq i32 %19, 0
%21 = load i8*, i8** %1
br i1 %20, label %22, label %24
22: ; preds = %17
%23 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0), i8* %21, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
br label %28
24: ; preds = %17
%25 = getelementptr inbounds i8*, i8** %1, i64 1
%26 = load i8*, i8** %25
%27 = tail call i32 @config_file(i8* %21, i8* %26, i32 %18)
br label %28
28: ; preds = %24, %22
ret i32 0
}