#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 */
scalar_t__ GCMGetFSTOffset(int /*<<< orphan*/ *);
int /*<<< orphan*/ SEEK_SET;
int fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, scalar_t__, int /*<<< orphan*/);
void GCMGetNthRawFileEntry(FILE *ifile, int n, char *buf) {
  if (!ifile || n < 0 || !buf) {
    return;
  }
  fseek(ifile, GCMGetFSTOffset(ifile) + (0x000c * n), SEEK_SET);
  if (fread(buf, 1, 0x000c, ifile) != 0x000c) {
    free(buf);
    return;
  }
}


x86 assembly (clang, -O0):
<GCMGetNthRawFileEntry>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1173 <GCMGetNthRawFileEntry+0x33>
cmpl   $0x0,-0xc(%rbp)
jl     1173 <GCMGetNthRawFileEntry+0x33>
cmpq   $0x0,-0x18(%rbp)
jne    1178 <GCMGetNthRawFileEntry+0x38>
jmp    11d0 <GCMGetNthRawFileEntry+0x90>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <GCMGetFSTOffset@plt>
mov    -0x20(%rbp),%rdi
mov    %rax,%rsi
imul   $0xc,-0xc(%rbp),%eax
cltq
add    %rax,%rsi
mov    0x2e40(%rip),%rax
mov    (%rax),%edx
call   1060 <fseek@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x1,%esi
mov    $0xc,%edx
call   1040 <fread@plt>
cmp    $0xc,%eax
je     11d0 <GCMGetNthRawFileEntry+0x90>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GCMGetNthRawFileEntry>:
push   %r15
push   %r14
push   %rbx
test   %rdi,%rdi
je     1197 <GCMGetNthRawFileEntry+0x57>
mov    %esi,%ebx
test   %esi,%esi
js     1197 <GCMGetNthRawFileEntry+0x57>
mov    %rdx,%r14
test   %rdx,%rdx
je     1197 <GCMGetNthRawFileEntry+0x57>
mov    %rdi,%r15
call   1050 <GCMGetFSTOffset@plt>
shl    $0x2,%ebx
lea    (%rbx,%rbx,2),%ecx
movslq %ecx,%rsi
add    %rax,%rsi
mov    0x2e6d(%rip),%rax
mov    (%rax),%edx
mov    %r15,%rdi
call   1060 <fseek@plt>
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0xc,%edx
mov    %r15,%rcx
call   1040 <fread@plt>
cmp    $0xc,%eax
jne    119d <GCMGetNthRawFileEntry+0x5d>
pop    %rbx
pop    %r14
pop    %r15
ret
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
@SEEK_SET = global i32 0
define void @GCMGetNthRawFileEntry(i32* %0, i32 %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i8*
store i32* %0, i32** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i32*, i32** %4
%8 = icmp ne i32* %7, null
br i1 %8, label %9, label %15
9: ; preds = %3
%10 = load i32, i32* %5
%11 = icmp slt i32 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %9
%13 = load i8*, i8** %6
%14 = icmp ne i8* %13, null
br i1 %14, label %16, label %15
15: ; preds = %12, %9, %3
br label %33
16: ; preds = %12
%17 = load i32*, i32** %4
%18 = load i32*, i32** %4
%19 = call i64 @GCMGetFSTOffset(i32* %18)
%20 = load i32, i32* %5
%21 = mul nsw i32 12, %20
%22 = sext i32 %21 to i64
%23 = add nsw i64 %19, %22
%24 = load i32, i32* @SEEK_SET
%25 = call i32 @fseek(i32* %17, i64 %23, i32 %24)
%26 = load i8*, i8** %6
%27 = load i32*, i32** %4
%28 = call i32 @fread(i8* %26, i32 1, i32 12, i32* %27)
%29 = icmp ne i32 %28, 12
br i1 %29, label %30, label %33
30: ; preds = %16
%31 = load i8*, i8** %6
%32 = call i32 @free(i8* %31)
br label %33
33: ; preds = %15, %30, %16
ret void
}

LLVM IR (-O2):
@SEEK_SET = global i32 0
define void @GCMGetNthRawFileEntry(i32* %0, i32 %1, i8* %2) {
%4 = icmp ne i32* %0, null
%5 = icmp sgt i32 %1, -1
%6 = and i1 %4, %5
%7 = icmp ne i8* %2, null
%8 = and i1 %6, %7
br i1 %8, label %9, label %20
9: ; preds = %3
%10 = tail call i64 @GCMGetFSTOffset(i32* %0)
%11 = mul nsw i32 %1, 12
%12 = sext i32 %11 to i64
%13 = add nsw i64 %10, %12
%14 = load i32, i32* @SEEK_SET
%15 = tail call i32 @fseek(i32* %0, i64 %13, i32 %14)
%16 = tail call i32 @fread(i8* %2, i32 1, i32 12, i32* %0)
%17 = icmp eq i32 %16, 12
br i1 %17, label %20, label %18
18: ; preds = %9
%19 = tail call i32 @free(i8* %2)
br label %20
20: ; preds = %3, %18, %9
ret void
}