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

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ fwrite(int /*<<< orphan*/ *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int writeIndexEntry(FILE *hf, u_int32_t trixel_id, u_int32_t offset,
                    u_int32_t nrec) {
  if (hf == NULL)
    return 0;
  fwrite(&trixel_id, 4, 1, hf);
  fwrite(&offset, 4, 1, hf);
  fwrite(&nrec, 4, 1, hf);
  if (4 + 4 + 4 != 12) {
    fprintf(stderr, "CODE ERROR: 4 + 4 + 4 != INDEX_ENTRY_SIZE\n");
  }
  return 1;
}


x86 assembly (clang, -O0):
<writeIndexEntry>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    113c <writeIndexEntry+0x2c>
movl   $0x0,-0x4(%rbp)
jmp    1188 <writeIndexEntry+0x78>
mov    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <fwrite@plt>
mov    -0x10(%rbp),%rcx
lea    -0x18(%rbp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <fwrite@plt>
mov    -0x10(%rbp),%rcx
lea    -0x1c(%rbp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <fwrite@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeIndexEntry>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %esi,0x14(%rsp)
mov    %edx,0x10(%rsp)
mov    %ecx,0xc(%rsp)
test   %rdi,%rdi
je     1176 <writeIndexEntry+0x66>
mov    %rdi,%rbx
lea    0x14(%rsp),%rdi
mov    $0x1,%ebp
mov    $0x4,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fwrite@plt>
lea    0x10(%rsp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fwrite@plt>
lea    0xc(%rsp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fwrite@plt>
jmp    1178 <writeIndexEntry+0x68>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@stderr = global i32 0
define i32 @writeIndexEntry(i32* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 %3, i32* %7
%8 = icmp eq i32* %0, null
br i1 %8, label %13, label %9
9: ; preds = %4
%10 = call i32 @fwrite(i32* %5, i32 4, i32 1, i32* %0)
%11 = call i32 @fwrite(i32* %6, i32 4, i32 1, i32* %0)
%12 = call i32 @fwrite(i32* %7, i32 4, i32 1, i32* %0)
br label %13
13: ; preds = %4, %9
%14 = phi i32 [ 1, %9 ], [ 0, %4 ]
ret i32 %14
}