#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*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ fread(unsigned char *, int, size_t, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
size_t ftell(int /*<<< orphan*/ *);
unsigned char *malloc(size_t);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int get_data(char *rom, unsigned char **buf, FILE *file, size_t *s) {
  fseek(file, 0, SEEK_END);
  *s = ftell(file);
  rewind(file);
  *buf = malloc(*s);
  fread(*buf, 1, *s, file);
}


x86 assembly (clang, -O0):
<get_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    0x2e75(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1070 <fseek@plt>
mov    -0x20(%rbp),%rdi
call   1050 <ftell@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rdi
call   1040 <rewind@plt>
mov    -0x28(%rbp),%rax
mov    (%rax),%rdi
call   1060 <malloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
mov    -0x28(%rbp),%rax
mov    (%rax),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x1,%esi
call   1030 <fread@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_data>:
push   %r15
push   %r14
push   %rbx
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %rsi,%r15
mov    0x2e83(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1070 <fseek@plt>
mov    %rbx,%rdi
call   1050 <ftell@plt>
mov    %rax,(%r14)
mov    %rbx,%rdi
call   1040 <rewind@plt>
mov    (%r14),%r14
mov    %r14,%rdi
call   1060 <malloc@plt>
mov    %rax,(%r15)
mov    %rax,%rdi
mov    $0x1,%esi
mov    %r14,%rdx
mov    %rbx,%rcx
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <fread@plt>

LLVM IR (-O0):
@SEEK_END = global i32 0
define i32 @get_data(i8* %0, i8** %1, i32* %2, i64* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8**
%8 = alloca i32*
%9 = alloca i64*
store i8* %0, i8** %6
store i8** %1, i8*** %7
store i32* %2, i32** %8
store i64* %3, i64** %9
%10 = load i32*, i32** %8
%11 = load i32, i32* @SEEK_END
%12 = call i32 @fseek(i32* %10, i32 0, i32 %11)
%13 = load i32*, i32** %8
%14 = call i64 @ftell(i32* %13)
%15 = load i64*, i64** %9
store i64 %14, i64* %15
%16 = load i32*, i32** %8
%17 = call i32 @rewind(i32* %16)
%18 = load i64*, i64** %9
%19 = load i64, i64* %18
%20 = call i8* @malloc(i64 %19)
%21 = load i8**, i8*** %7
store i8* %20, i8** %21
%22 = load i8**, i8*** %7
%23 = load i8*, i8** %22
%24 = load i64*, i64** %9
%25 = load i64, i64* %24
%26 = load i32*, i32** %8
%27 = call i32 @fread(i8* %23, i32 1, i64 %25, i32* %26)
%28 = load i32, i32* %5
ret i32 %28
}

LLVM IR (-O2):
@SEEK_END = global i32 0
define i32 @get_data(i8* nocapture readnone %0, i8** nocapture writeonly %1, i32* nocapture %2, i64* nocapture %3) {
%5 = load i32, i32* @SEEK_END
%6 = tail call i32 @fseek(i32* %2, i32 0, i32 %5)
%7 = tail call i64 @ftell(i32* %2)
store i64 %7, i64* %3
%8 = tail call i32 @rewind(i32* %2)
%9 = load i64, i64* %3
%10 = tail call i8* @malloc(i64 %9)
store i8* %10, i8** %1
%11 = tail call i32 @fread(i8* %10, i32 1, i64 %9, i32* %2)
ret i32 undef
}