#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_SET;
int fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
void GCMGetDiskHeader(FILE *ifile, char *buf) {
  if (!ifile || !buf)
    return;
  fseek(ifile, 0x0000, SEEK_SET);
  if (fread(buf, 1, 0x0440, ifile) != 0x0440) {
    free(buf);
    return;
  }
}


x86 assembly (clang, -O0):
<GCMGetDiskHeader>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1156 <GCMGetDiskHeader+0x26>
cmpq   $0x0,-0x10(%rbp)
jne    115b <GCMGetDiskHeader+0x2b>
jmp    119a <GCMGetDiskHeader+0x6a>
mov    -0x8(%rbp),%rdi
mov    0x2e7a(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1050 <fseek@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x1,%esi
mov    $0x440,%edx
call   1040 <fread@plt>
cmp    $0x440,%eax
je     119a <GCMGetDiskHeader+0x6a>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GCMGetDiskHeader>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     1170 <GCMGetDiskHeader+0x40>
mov    %rsi,%r14
test   %rsi,%rsi
je     1170 <GCMGetDiskHeader+0x40>
mov    %rdi,%rbx
mov    0x2e95(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1050 <fseek@plt>
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x440,%edx
mov    %rbx,%rcx
call   1040 <fread@plt>
cmp    $0x440,%eax
jne    1178 <GCMGetDiskHeader+0x48>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <free@plt>

LLVM IR (-O0):
@SEEK_SET = global i32 0
define void @GCMGetDiskHeader(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
store i32* %0, i32** %3
store i8* %1, i8** %4
%5 = load i32*, i32** %3
%6 = icmp ne i32* %5, null
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i8*, i8** %4
%9 = icmp ne i8* %8, null
br i1 %9, label %11, label %10
10: ; preds = %7, %2
br label %22
11: ; preds = %7
%12 = load i32*, i32** %3
%13 = load i32, i32* @SEEK_SET
%14 = call i32 @fseek(i32* %12, i32 0, i32 %13)
%15 = load i8*, i8** %4
%16 = load i32*, i32** %3
%17 = call i32 @fread(i8* %15, i32 1, i32 1088, i32* %16)
%18 = icmp ne i32 %17, 1088
br i1 %18, label %19, label %22
19: ; preds = %11
%20 = load i8*, i8** %4
%21 = call i32 @free(i8* %20)
br label %22
22: ; preds = %10, %19, %11
ret void
}

LLVM IR (-O2):
@SEEK_SET = global i32 0
define void @GCMGetDiskHeader(i32* %0, i8* %1) {
%3 = icmp ne i32* %0, null
%4 = icmp ne i8* %1, null
%5 = and i1 %3, %4
br i1 %5, label %6, label %13
6: ; preds = %2
%7 = load i32, i32* @SEEK_SET
%8 = tail call i32 @fseek(i32* %0, i32 0, i32 %7)
%9 = tail call i32 @fread(i8* %1, i32 1, i32 1088, i32* %0)
%10 = icmp eq i32 %9, 1088
br i1 %10, label %13, label %11
11: ; preds = %6
%12 = tail call i32 @free(i8* %1)
br label %13
13: ; preds = %2, %11, %6
ret void
}