#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 extractInfo(char *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  int i;
  char *fname = "/etc/fstab";
  for (i = 0; i < argc; i++) {
    if (strcmp("-h", argv[i]) == 0) {
      printf("JSON-DISK v%s\n%s\n\n", "0.0.3",
             "https://github.com/GentooXativa/json-disk");
      printf("Usage: json_disk [-h] [-m]\n");
      printf("\t-h\tShow this help\n");
      printf("\t-m\tUse /etc/mtab instead of /etc/fstab\n");
      return 0;
    }
    if (strcmp("-m", argv[i]) == 0) {
      fname = "/etc/mtab";
      continue;
    }
  }
  return extractInfo(fname);
}


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)
lea    0xeb3(%rip),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    121d <main+0xed>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe94(%rip),%rdi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11d8 <main+0xa8>
lea    0xe81(%rip),%rdi
lea    0xe8d(%rip),%rsi
lea    0xe8c(%rip),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1229 <main+0xf9>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xebf(%rip),%rdi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    120a <main+0xda>
lea    0xeac(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    120f <main+0xdf>
jmp    120f <main+0xdf>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1158 <main+0x28>
mov    -0x20(%rbp),%rdi
call   1050 <extractInfo@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    11a3 <main+0x63>
mov    %rsi,%r14
mov    %edi,%r13d
lea    0xf42(%rip),%rbx
xor    %ebp,%ebp
lea    0xe9b(%rip),%r15
lea    0xedd(%rip),%r12
nopl   0x0(%rax)
mov    (%r14,%rbp,8),%rsi
mov    %r15,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11c0 <main+0x80>
mov    (%r14,%rbp,8),%rsi
lea    0xeba(%rip),%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
cmove  %r12,%rbx
add    $0x1,%rbp
cmp    %rbp,%r13
jne    1170 <main+0x30>
jmp    11aa <main+0x6a>
lea    0xef4(%rip),%rbx
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <extractInfo@plt>
lea    0xe3c(%rip),%rdi
lea    0xe48(%rip),%rsi
lea    0xe47(%rip),%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe70(%rip),%rdi
call   1030 <puts@plt>
lea    0xe7f(%rip),%rdi
call   1030 <puts@plt>
lea    0xe86(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"/etc/fstab\00"
@.str.1 = [3 x i8] c"-h\00"
@.str.2 = [19 x i8] c"JSON-DISK v%s\0A%s\0A\0A\00"
@.str.3 = [6 x i8] c"0.0.3\00"
@.str.4 = [42 x i8] c"https://github.com/GentooXativa/json-disk\00"
@.str.5 = [28 x i8] c"Usage: json_disk [-h] [-m]\0A\00"
@.str.6 = [20 x i8] c"\09-h\09Show this help\0A\00"
@.str.7 = [41 x i8] c"\09-m\09Use /etc/mtab instead of /etc/fstab\0A\00"
@.str.8 = [3 x i8] c"-m\00"
@.str.9 = [10 x i8] c"/etc/mtab\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8** %7
store i32 0, i32* %6
br label %8
8: ; preds = %35, %2
%9 = load i32, i32* %6
%10 = load i32, i32* %4
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %38
12: ; preds = %8
%13 = load i8**, i8*** %5
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8*, i8** %13, i64 %15
%17 = load i8*, i8** %16
%18 = call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %17)
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %25
20: ; preds = %12
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0))
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0))
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %3
br label %41
25: ; preds = %12
%26 = load i8**, i8*** %5
%27 = load i32, i32* %6
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8*, i8** %26, i64 %28
%30 = load i8*, i8** %29
%31 = call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %30)
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %34
33: ; preds = %25
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i8** %7
br label %35
34: ; preds = %25
br label %35
35: ; preds = %34, %33
%36 = load i32, i32* %6
%37 = add nsw i32 %36, 1
store i32 %37, i32* %6
br label %8
38: ; preds = %8
%39 = load i8*, i8** %7
%40 = call i32 @extractInfo(i8* %39)
store i32 %40, i32* %3
br label %41
41: ; preds = %38, %20
%42 = load i32, i32* %3
ret i32 %42
}

LLVM IR (-O2):
@.str = [11 x i8] c"/etc/fstab\00"
@.str.1 = [3 x i8] c"-h\00"
@.str.2 = [19 x i8] c"JSON-DISK v%s\0A%s\0A\0A\00"
@.str.3 = [6 x i8] c"0.0.3\00"
@.str.4 = [42 x i8] c"https://github.com/GentooXativa/json-disk\00"
@.str.8 = [3 x i8] c"-m\00"
@.str.9 = [10 x i8] c"/etc/mtab\00"
@str = [27 x i8] c"Usage: json_disk [-h] [-m]\00"
@str.10 = [19 x i8] c"\09-h\09Show this help\00"
@str.11 = [40 x i8] c"\09-m\09Use /etc/mtab instead of /etc/fstab\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %25
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %18
%7 = phi i64 [ 0, %4 ], [ %23, %18 ]
%8 = phi i8* [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), %4 ], [ %22, %18 ]
%9 = getelementptr inbounds i8*, i8** %1, i64 %7
%10 = load i8*, i8** %9
%11 = tail call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %18
13: ; preds = %6
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0))
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.10, i64 0, i64 0))
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.11, i64 0, i64 0))
br label %28
18: ; preds = %6
%19 = load i8*, i8** %9
%20 = tail call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %19)
%21 = icmp eq i64 %20, 0
%22 = select i1 %21, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i8* %8
%23 = add nuw nsw i64 %7, 1
%24 = icmp eq i64 %23, %5
br i1 %24, label %25, label %6
25: ; preds = %18, %2
%26 = phi i8* [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), %2 ], [ %22, %18 ]
%27 = tail call i32 @extractInfo(i8* %26)
br label %28
28: ; preds = %25, %13
%29 = phi i32 [ 0, %13 ], [ %27, %25 ]
ret i32 %29
}