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

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
size_t fread(int /*<<< orphan*/ *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ otfcc_endian_convert64(int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
uint64_t otfcc_get64u(FILE *file) {
  uint64_t tmp;
  size_t sizeRead = fread(&tmp, 8, 1, file);
  if (!sizeRead) {
    fprintf(stderr, "File corruption of terminated unexpectedly.\n");
    exit(EXIT_FAILURE);
  }
  return otfcc_endian_convert64(tmp);
}


x86 assembly (clang, -O0):
<otfcc_get64u>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
lea    -0xc(%rbp),%rdi
mov    $0x8,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1195 <otfcc_get64u+0x55>
mov    0x2e67(%rip),%rax
mov    (%rax),%edi
lea    0xe7e(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e4a(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    -0xc(%rbp),%edi
call   1050 <otfcc_endian_convert64@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<otfcc_get64u>:
push   %rax
mov    %rdi,%rcx
lea    0x4(%rsp),%rdi
mov    $0x8,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
test   %rax,%rax
je     1167 <otfcc_get64u+0x27>
mov    0x4(%rsp),%edi
pop    %rax
jmp    1050 <otfcc_endian_convert64@plt>
mov    0x2e72(%rip),%rax
mov    (%rax),%edi
lea    0xe89(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e55(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [45 x i8] c"File corruption of terminated unexpectedly.\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @otfcc_get64u(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i64
store i32* %0, i32** %2
%5 = load i32*, i32** %2
%6 = call i64 @fread(i32* %3, i32 8, i32 1, i32* %5)
store i64 %6, i64* %4
%7 = load i64, i64* %4
%8 = icmp ne i64 %7, 0
br i1 %8, label %14, label %9
9: ; preds = %1
%10 = load i32, i32* @stderr
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* @EXIT_FAILURE
%13 = call i32 @exit(i32 %12)
unreachable
14: ; preds = %1
%15 = load i32, i32* %3
%16 = call i32 @otfcc_endian_convert64(i32 %15)
ret i32 %16
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [45 x i8] c"File corruption of terminated unexpectedly.\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @otfcc_get64u(i32* nocapture %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i64 @fread(i32* %2, i32 8, i32 1, i32* %0)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* @EXIT_FAILURE
%10 = tail call i32 @exit(i32 %9)
unreachable
11: ; preds = %1
%12 = load i32, i32* %2
%13 = tail call i32 @otfcc_endian_convert64(i32 %12)
ret i32 %13
}