#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 read_bin(char *, char *);
int main(int argc, char *argv[]) {
  int ret;
  int i;
  if (argc < 3) {
    printf("Wrong input format.\n");
    printf("Try 'eepdump input_file output_file'\n");
    return 0;
  }
  ret = read_bin(argv[1], argv[2]);
  if (ret) {
    printf("Error reading input, aborting\n");
    return 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   $0x3,-0x8(%rbp)
jge    1164 <main+0x44>
lea    0xeb9(%rip),%rdi
call   1040 <printf@plt>
lea    0xec2(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11a5 <main+0x85>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1030 <read_bin@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     119e <main+0x7e>
lea    0xeae(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11a5 <main+0x85>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jg     113b <main+0x1b>
lea    0xef1(%rip),%rdi
call   1030 <puts@plt>
lea    0xef9(%rip),%rdi
jmp    1153 <main+0x33>
mov    0x8(%rsi),%rdi
mov    0x10(%rsi),%rsi
call   1040 <read_bin@plt>
test   %eax,%eax
je     1158 <main+0x38>
lea    0xead(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Wrong input format.\0A\00"
@.str.1 = [38 x i8] c"Try 'eepdump input_file output_file'\0A\00"
@.str.2 = [31 x i8] c"Error reading input, aborting\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 3
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %26
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 2
%19 = load i8*, i8** %18
%20 = call i32 @read_bin(i8* %16, i8* %19)
store i32 %20, i32* %6
%21 = load i32, i32* %6
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %13
%24 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %26
25: ; preds = %13
store i32 0, i32* %3
br label %26
26: ; preds = %25, %23, %10
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
@str = [30 x i8] c"Error reading input, aborting\00"
@str.3 = [20 x i8] c"Wrong input format.\00"
@str.4 = [37 x i8] c"Try 'eepdump input_file output_file'\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.3, i64 0, i64 0))
br label %13
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = getelementptr inbounds i8*, i8** %1, i64 2
%10 = load i8*, i8** %9
%11 = tail call i32 @read_bin(i8* %8, i8* %10)
%12 = icmp eq i32 %11, 0
br i1 %12, label %16, label %13
13: ; preds = %6, %4
%14 = phi i8* [ getelementptr inbounds ([37 x i8], [37 x i8]* @str.4, i64 0, i64 0), %4 ], [ getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0), %6 ]
%15 = tail call i32 @puts(i8* dereferenceable(1) %14)
br label %16
16: ; preds = %13, %6
ret i32 0
}