#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 */
typedef int /*<<< orphan*/ off_t;

/* Variables and functions */
int /*<<< orphan*/ EX_USAGE;
int /*<<< orphan*/ err(int /*<<< orphan*/, char *);
int /*<<< orphan*/ free(char *);
scalar_t__ read_file(char *, char **, int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  if (argc != 3) {
    err(EX_USAGE, "Usage: %s <binary file> <data file>");
  }
  char *data_buffer;
  off_t data_size;
  if (read_file(argv[1], &data_buffer, &data_size) != 0) {
    return 1;
  }
  free(data_buffer);
}


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)
je     1165 <main+0x35>
mov    0x2e91(%rip),%rax
mov    (%rax),%edi
lea    0xea0(%rip),%rsi
call   1050 <err@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   1040 <read_file@plt>
cmp    $0x0,%rax
je     1190 <main+0x60>
movl   $0x1,-0x4(%rbp)
jmp    1199 <main+0x69>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
cmp    $0x3,%edi
je     1152 <main+0x22>
mov    0x2ea4(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
call   1050 <err@plt>
mov    0x8(%rbx),%rdi
mov    %rsp,%rsi
lea    0xc(%rsp),%rdx
call   1040 <read_file@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
jne    117b <main+0x4b>
mov    (%rsp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@EX_USAGE = global i32 0
@.str = [36 x i8] c"Usage: %s <binary file> <data file>\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%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 ne i32 %8, 3
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load i32, i32* @EX_USAGE
%12 = call i32 @err(i32 %11, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %10, %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i64 @read_file(i8* %16, i8** %6, i32* %7)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %13
store i32 1, i32* %3
br label %23
20: ; preds = %13
%21 = load i8*, i8** %6
%22 = call i32 @free(i8* %21)
br label %23
23: ; preds = %20, %19
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
@EX_USAGE = global i32 0
@.str = [36 x i8] c"Usage: %s <binary file> <data file>\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = icmp eq i32 %0, 3
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = load i32, i32* @EX_USAGE
%8 = tail call i32 @err(i32 %7, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %6, %2
%10 = bitcast i8** %3 to i8*
%11 = bitcast i32* %4 to i8*
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = call i64 @read_file(i8* %13, i8** %3, i32* %4)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %9
%17 = load i8*, i8** %3
%18 = call i32 @free(i8* %17)
br label %19
19: ; preds = %9, %16
%20 = phi i32 [ 0, %16 ], [ 1, %9 ]
ret i32 %20
}