#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 */
struct stat {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ debug(int /*<<< orphan*/, char *, ...);
int help();
struct stat *malloc(int);
int parse_file(char *);
scalar_t__ parse_short(char *);
int stat(char *, struct stat *);
int /*<<< orphan*/ strcmp(char *, char *);
int get_config_files(int argc, char **argv) {
  int i;
  int ret = 0;
  struct stat *file_stats = malloc(sizeof(struct stat));
  if (argc < 2) {
    debug(0, "[conf]: "
             "Please supply one or more config files");
    return -1;
  }
  for (i = 1; i < argc; i++) {
    if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h"))
      return help();
    if (argv[i][0] == '-') {
      if (parse_short(argv[i]))
        return help();
      else
        continue;
    }
    if ((ret = stat(argv[i], file_stats)) < 0) {
      debug(0,
            "[conf]: "
            "File does not exist %s",
            argv[i]);
      continue;
    }
    if ((ret = parse_file(argv[i])) < 0) {
      debug(0,
            "[conf]: "
            "Could not parse file %s (ret = %d)",
            argv[i], ret);
      continue;
    }
  }
  return ret;
}


x86 assembly (clang, -O0):
<get_config_files>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
mov    $0x4,%edi
call   1060 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11ba <get_config_files+0x4a>
xor    %edi,%edi
lea    0xe59(%rip),%rsi
mov    $0x0,%al
call   1030 <debug@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1301 <get_config_files+0x191>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12fb <get_config_files+0x18b>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe4f(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
je     120f <get_config_files+0x9f>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe35(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    121e <get_config_files+0xae>
mov    $0x0,%al
call   1090 <help@plt>
mov    %eax,-0x4(%rbp)
jmp    1301 <get_config_files+0x191>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1265 <get_config_files+0xf5>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1070 <parse_short@plt>
cmp    $0x0,%rax
je     1260 <get_config_files+0xf0>
mov    $0x0,%al
call   1090 <help@plt>
mov    %eax,-0x4(%rbp)
jmp    1301 <get_config_files+0x191>
jmp    12ed <get_config_files+0x17d>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x20(%rbp),%rsi
call   1050 <stat@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
jge    12a7 <get_config_files+0x137>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
xor    %edi,%edi
lea    0xd9e(%rip),%rsi
mov    $0x0,%al
call   1030 <debug@plt>
jmp    12ed <get_config_files+0x17d>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1080 <parse_file@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
jge    12e8 <get_config_files+0x178>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x18(%rbp),%ecx
xor    %edi,%edi
lea    0xd7c(%rip),%rsi
mov    $0x0,%al
call   1030 <debug@plt>
jmp    12ed <get_config_files+0x17d>
jmp    12ed <get_config_files+0x17d>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11c1 <get_config_files+0x51>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_config_files>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    $0x4,%edi
call   1060 <malloc@plt>
cmp    $0x2,%ebp
jge    11b5 <get_config_files+0x45>
lea    0xe6a(%rip),%rsi
xor    %edi,%edi
xor    %eax,%eax
call   1030 <debug@plt>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rax,%r14
mov    %ebp,%r12d
mov    $0x1,%r15d
xor    %ebp,%ebp
jmp    11ea <get_config_files+0x7a>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r13,%rdi
call   1070 <parse_short@plt>
test   %rax,%rax
jne    126b <get_config_files+0xfb>
add    $0x1,%r15
cmp    %r15,%r12
je     11a4 <get_config_files+0x34>
mov    (%rbx,%r15,8),%r13
mov    %r13,%rdi
lea    0xe37(%rip),%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
je     126b <get_config_files+0xfb>
mov    %r13,%rdi
lea    0xe2b(%rip),%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
je     126b <get_config_files+0xfb>
cmpb   $0x2d,0x0(%r13)
je     11d0 <get_config_files+0x60>
mov    %r13,%rdi
mov    %r14,%rsi
call   1050 <stat@plt>
mov    (%rbx,%r15,8),%rdx
test   %eax,%eax
js     1254 <get_config_files+0xe4>
mov    %rdx,%rdi
call   1080 <parse_file@plt>
mov    %eax,%ebp
test   %eax,%eax
jns    11e1 <get_config_files+0x71>
mov    (%rbx,%r15,8),%rdx
xor    %edi,%edi
lea    0xe0f(%rip),%rsi
mov    %ebp,%ecx
xor    %eax,%eax
call   1030 <debug@plt>
jmp    11e1 <get_config_files+0x71>
mov    %eax,%ebp
xor    %edi,%edi
lea    0xdda(%rip),%rsi
xor    %eax,%eax
call   1030 <debug@plt>
jmp    11e1 <get_config_files+0x71>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1090 <help@plt>

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [47 x i8] c"[conf]: Please supply one or more config files\00"
@.str.1 = [7 x i8] c"--help\00"
@.str.2 = [3 x i8] c"-h\00"
@.str.3 = [31 x i8] c"[conf]: File does not exist %s\00"
@.str.4 = [43 x i8] c"[conf]: Could not parse file %s (ret = %d)\00"
define i32 @get_config_files(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.stat*
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
%9 = call %struct.stat* @malloc(i32 4)
store %struct.stat* %9, %struct.stat** %8
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 2
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 (i32, i8*, ...) @debug(i32 0, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %96
14: ; preds = %2
store i32 1, i32* %6
br label %15
15: ; preds = %91, %14
%16 = load i32, i32* %6
%17 = load i32, i32* %4
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %94
19: ; preds = %15
%20 = load i8**, i8*** %5
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8*, i8** %20, i64 %22
%24 = load i8*, i8** %23
%25 = call i32 @strcmp(i8* %24, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %35
27: ; preds = %19
%28 = load i8**, i8*** %5
%29 = load i32, i32* %6
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8*, i8** %28, i64 %30
%32 = load i8*, i8** %31
%33 = call i32 @strcmp(i8* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%34 = icmp ne i32 %33, 0
br i1 %34, label %37, label %35
35: ; preds = %27, %19
%36 = call i32 (...) @help()
store i32 %36, i32* %3
br label %96
37: ; preds = %27
%38 = load i8**, i8*** %5
%39 = load i32, i32* %6
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8*, i8** %38, i64 %40
%42 = load i8*, i8** %41
%43 = getelementptr inbounds i8, i8* %42, i64 0
%44 = load i8, i8* %43
%45 = sext i8 %44 to i32
%46 = icmp eq i32 %45, 45
br i1 %46, label %47, label %58
47: ; preds = %37
%48 = load i8**, i8*** %5
%49 = load i32, i32* %6
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i8*, i8** %48, i64 %50
%52 = load i8*, i8** %51
%53 = call i64 @parse_short(i8* %52)
%54 = icmp ne i64 %53, 0
br i1 %54, label %55, label %57
55: ; preds = %47
%56 = call i32 (...) @help()
store i32 %56, i32* %3
br label %96
57: ; preds = %47
br label %91
58: ; preds = %37
%59 = load i8**, i8*** %5
%60 = load i32, i32* %6
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i8*, i8** %59, i64 %61
%63 = load i8*, i8** %62
%64 = load %struct.stat*, %struct.stat** %8
%65 = call i32 @stat(i8* %63, %struct.stat* %64)
store i32 %65, i32* %7
%66 = icmp slt i32 %65, 0
br i1 %66, label %67, label %74
67: ; preds = %58
%68 = load i8**, i8*** %5
%69 = load i32, i32* %6
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds i8*, i8** %68, i64 %70
%72 = load i8*, i8** %71
%73 = call i32 (i32, i8*, ...) @debug(i32 0, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i8* %72)
br label %91
74: ; preds = %58
%75 = load i8**, i8*** %5
%76 = load i32, i32* %6
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds i8*, i8** %75, i64 %77
%79 = load i8*, i8** %78
%80 = call i32 @parse_file(i8* %79)
store i32 %80, i32* %7
%81 = icmp slt i32 %80, 0
br i1 %81, label %82, label %90
82: ; preds = %74
%83 = load i8**, i8*** %5
%84 = load i32, i32* %6
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds i8*, i8** %83, i64 %85
%87 = load i8*, i8** %86
%88 = load i32, i32* %7
%89 = call i32 (i32, i8*, ...) @debug(i32 0, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), i8* %87, i32 %88)
br label %91
90: ; preds = %74
br label %91
91: ; preds = %90, %82, %67, %57
%92 = load i32, i32* %6
%93 = add nsw i32 %92, 1
store i32 %93, i32* %6
br label %15
94: ; preds = %15
%95 = load i32, i32* %7
store i32 %95, i32* %3
br label %96
96: ; preds = %94, %55, %35, %12
%97 = load i32, i32* %3
ret i32 %97
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [47 x i8] c"[conf]: Please supply one or more config files\00"
@.str.1 = [7 x i8] c"--help\00"
@.str.2 = [3 x i8] c"-h\00"
@.str.3 = [31 x i8] c"[conf]: File does not exist %s\00"
@.str.4 = [43 x i8] c"[conf]: Could not parse file %s (ret = %d)\00"
define i32 @get_config_files(i32 %0, i8** nocapture %1) {
%3 = tail call %struct.stat* @malloc(i32 4)
%4 = icmp slt i32 %0, 2
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = zext i32 %0 to i64
br label %9
7: ; preds = %2
%8 = tail call i32 (i32, i8*, ...) @debug(i32 0, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
br label %45
9: ; preds = %5, %41
%10 = phi i64 [ 1, %5 ], [ %43, %41 ]
%11 = phi i32 [ 0, %5 ], [ %42, %41 ]
%12 = getelementptr inbounds i8*, i8** %1, i64 %10
%13 = load i8*, i8** %12
%14 = tail call i32 @strcmp(i8* dereferenceable(1) %13, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i32 %14, 0
br i1 %15, label %19, label %16
16: ; preds = %9
%17 = tail call i32 @strcmp(i8* dereferenceable(1) %13, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %16, %9
%20 = tail call i32 (...) @help()
br label %45
21: ; preds = %16
%22 = load i8, i8* %13
%23 = icmp eq i8 %22, 45
br i1 %23, label %24, label %29
24: ; preds = %21
%25 = tail call i64 @parse_short(i8* %13)
%26 = icmp eq i64 %25, 0
br i1 %26, label %41, label %27
27: ; preds = %24
%28 = tail call i32 (...) @help()
br label %45
29: ; preds = %21
%30 = tail call i32 @stat(i8* %13, %struct.stat* %3)
%31 = icmp slt i32 %30, 0
%32 = load i8*, i8** %12
br i1 %31, label %33, label %35
33: ; preds = %29
%34 = tail call i32 (i32, i8*, ...) @debug(i32 0, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i8* %32)
br label %41
35: ; preds = %29
%36 = tail call i32 @parse_file(i8* %32)
%37 = icmp slt i32 %36, 0
br i1 %37, label %38, label %41
38: ; preds = %35
%39 = load i8*, i8** %12
%40 = tail call i32 (i32, i8*, ...) @debug(i32 0, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), i8* %39, i32 %36)
br label %41
41: ; preds = %35, %24, %38, %33
%42 = phi i32 [ %11, %24 ], [ %30, %33 ], [ %36, %38 ], [ %36, %35 ]
%43 = add nuw nsw i64 %10, 1
%44 = icmp eq i64 %43, %6
br i1 %44, label %45, label %9
45: ; preds = %41, %27, %19, %7
%46 = phi i32 [ -1, %7 ], [ %28, %27 ], [ %20, %19 ], [ %42, %41 ]
ret i32 %46
}