#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 /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int fwrite(char *, int, int, int /*<<< orphan*/ *);
int GCMPutDiskHeaderInfo(FILE *ofile, char *buf) {
  if (!ofile || !buf)
    return 1;
  fseek(ofile, 0x0440, SEEK_SET);
  if (fwrite(buf, 1, 0x2000, ofile) != 0x2000) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<GCMPutDiskHeaderInfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1146 <GCMPutDiskHeaderInfo+0x26>
cmpq   $0x0,-0x18(%rbp)
jne    1152 <GCMPutDiskHeaderInfo+0x32>
movl   $0x1,-0x4(%rbp)
jmp    119e <GCMPutDiskHeaderInfo+0x7e>
mov    -0x10(%rbp),%rdi
mov    0x2e83(%rip),%rax
mov    (%rax),%edx
mov    $0x440,%esi
call   1030 <fseek@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x1,%esi
mov    $0x2000,%edx
call   1040 <fwrite@plt>
cmp    $0x2000,%eax
je     1197 <GCMPutDiskHeaderInfo+0x77>
movl   $0x1,-0x4(%rbp)
jmp    119e <GCMPutDiskHeaderInfo+0x7e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GCMPutDiskHeaderInfo>:
push   %r14
push   %rbx
push   %rax
mov    $0x1,%eax
test   %rdi,%rdi
je     116e <GCMPutDiskHeaderInfo+0x4e>
mov    %rsi,%r14
test   %rsi,%rsi
je     116e <GCMPutDiskHeaderInfo+0x4e>
mov    %rdi,%rbx
mov    0x2ea0(%rip),%rax
mov    (%rax),%edx
mov    $0x440,%esi
call   1030 <fseek@plt>
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x2000,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x2000,%ecx
setne  %al
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@SEEK_SET = global i32 0
define i32 @GCMPutDiskHeaderInfo(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 %12
6: ; preds = %2
%7 = load i32, i32* @SEEK_SET
%8 = tail call i32 @fseek(i32* %0, i32 1088, i32 %7)
%9 = tail call i32 @fwrite(i8* %1, i32 1, i32 8192, i32* %0)
%10 = icmp ne i32 %9, 8192
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %6, %2
%13 = phi i32 [ 1, %2 ], [ %11, %6 ]
ret i32 %13
}