#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 *);
int readlog(char *);
int main(int argc, char *argv[]) {
  if (argc < 2) {
    printf("No logfile name specified\n");
  } else {
    if (readlog(argv[1]) == 1)
      printf("\nSuccessful\n");
    else
      printf("\nCould not open logfile\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1151 <main+0x31>
lea    0xeb9(%rip),%rdi
call   1040 <printf@plt>
jmp    1189 <main+0x69>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <readlog@plt>
cmp    $0x1,%eax
jne    1178 <main+0x58>
lea    0xead(%rip),%rdi
call   1040 <printf@plt>
jmp    1184 <main+0x64>
lea    0xea9(%rip),%rdi
call   1040 <printf@plt>
jmp    1189 <main+0x69>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jge    112f <main+0xf>
lea    0xef7(%rip),%rdi
jmp    114d <main+0x2d>
mov    0x8(%rsi),%rdi
call   1040 <readlog@plt>
cmp    $0x1,%eax
lea    0xed6(%rip),%rax
lea    0xeb7(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"No logfile name specified\0A\00"
@.str.1 = [13 x i8] c"\0ASuccessful\0A\00"
@.str.2 = [25 x i8] c"\0ACould not open logfile\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 2
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
br label %21
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32 @readlog(i8* %13)
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %18
16: ; preds = %10
%17 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %20
18: ; preds = %10
%19 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
br label %20
20: ; preds = %18, %16
br label %21
21: ; preds = %20, %8
ret i32 0
}

LLVM IR (-O2):
@str = [24 x i8] c"\0ACould not open logfile\00"
@str.3 = [12 x i8] c"\0ASuccessful\00"
@str.4 = [26 x i8] c"No logfile name specified\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %10, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @readlog(i8* %6)
%8 = icmp eq i32 %7, 1
%9 = select i1 %8, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @str.3, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0)
br label %10
10: ; preds = %4, %2
%11 = phi i8* [ getelementptr inbounds ([26 x i8], [26 x i8]* @str.4, i64 0, i64 0), %2 ], [ %9, %4 ]
%12 = tail call i32 @puts(i8* dereferenceable(1) %11)
ret i32 0
}