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

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int fread(scalar_t__ *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *);
uint64_t read_ckDataSize(FILE *infile) {
  uint8_t tmp[8];
  if (fread(tmp, 1, 8, infile) < 8) {
    printf("file ended unexpectedly\n");
    exit(1);
  }
  return (uint64_t)tmp[0] << 56 | (uint64_t)tmp[1] << 48 |
         (uint64_t)tmp[2] << 40 | (uint64_t)tmp[3] << 32 |
         (uint64_t)tmp[4] << 24 | (uint64_t)tmp[5] << 16 |
         (uint64_t)tmp[6] << 8 | (uint64_t)tmp[7];
}


x86 assembly (clang, -O0):
<read_ckDataSize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x1,%esi
mov    $0x8,%edx
call   1030 <fread@plt>
cmp    $0x8,%eax
jge    1172 <read_ckDataSize+0x42>
lea    0xe9d(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x50(%rbp),%rax
mov    $0x38,%ecx
shl    %cl,%eax
mov    -0x48(%rbp),%rcx
mov    %ecx,%edx
mov    $0x30,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    -0x40(%rbp),%rcx
mov    %ecx,%edx
mov    $0x28,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    -0x38(%rbp),%rcx
mov    %ecx,%edx
mov    $0x20,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    -0x30(%rbp),%rcx
shl    $0x18,%ecx
or     %ecx,%eax
mov    -0x28(%rbp),%rcx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x20(%rbp),%rcx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x18(%rbp),%rcx
or     %ecx,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_ckDataSize>:
sub    $0x48,%rsp
mov    %rdi,%rcx
mov    %rsp,%rdi
mov    $0x1,%esi
mov    $0x8,%edx
call   1040 <fread@plt>
cmp    $0x7,%eax
jle    1153 <read_ckDataSize+0x23>
add    $0x48,%rsp
ret
lea    0xea6(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"file ended unexpectedly\0A\00"
define i32 @read_ckDataSize(i32* %0) {
%2 = alloca i32*
%3 = alloca [8 x i64]
store i32* %0, i32** %2
%4 = getelementptr inbounds [8 x i64], [8 x i64]* %3, i64 0, i64 0
%5 = load i32*, i32** %2
%6 = call i32 @fread(i64* %4, i32 1, i32 8, i32* %5)
%7 = icmp slt i32 %6, 8
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @exit(i32 1)
unreachable
11: ; preds = %1
%12 = getelementptr inbounds [8 x i64], [8 x i64]* %3, i64 0, i64 0
%13 = load i64, i64* %12
%14 = trunc i64 %13 to i32
%15 = shl i32 %14, 56
%16 = getelementptr inbounds [8 x i64], [8 x i64]* %3, i64 0, i64 1
%17 = load i64, i64* %16
%18 = trunc i64 %17 to i32
%19 = shl i32 %18, 48
%20 = or i32 %15, %19
%21 = getelementptr inbounds [8 x i64], [8 x i64]* %3, i64 0, i64 2
%22 = load i64, i64* %21
%23 = trunc i64 %22 to i32
%24 = shl i32 %23, 40
%25 = or i32 %20, %24
%26 = getelementptr inbounds [8 x i64], [8 x i64]* %3, i64 0, i64 3
%27 = load i64, i64* %26
%28 = trunc i64 %27 to i32
%29 = shl i32 %28, 32
%30 = or i32 %25, %29
%31 = getelementptr inbounds [8 x i64], [8 x i64]* %3, i64 0, i64 4
%32 = load i64, i64* %31
%33 = trunc i64 %32 to i32
%34 = shl i32 %33, 24
%35 = or i32 %30, %34
%36 = getelementptr inbounds [8 x i64], [8 x i64]* %3, i64 0, i64 5
%37 = load i64, i64* %36
%38 = trunc i64 %37 to i32
%39 = shl i32 %38, 16
%40 = or i32 %35, %39
%41 = getelementptr inbounds [8 x i64], [8 x i64]* %3, i64 0, i64 6
%42 = load i64, i64* %41
%43 = trunc i64 %42 to i32
%44 = shl i32 %43, 8
%45 = or i32 %40, %44
%46 = getelementptr inbounds [8 x i64], [8 x i64]* %3, i64 0, i64 7
%47 = load i64, i64* %46
%48 = trunc i64 %47 to i32
%49 = or i32 %45, %48
ret i32 %49
}

LLVM IR (-O2):
@str = [24 x i8] c"file ended unexpectedly\00"
define i32 @read_ckDataSize(i32* nocapture %0) {
%2 = alloca [8 x i64]
%3 = bitcast [8 x i64]* %2 to i8*
%4 = getelementptr inbounds [8 x i64], [8 x i64]* %2, i64 0, i64 0
%5 = call i32 @fread(i64* %4, i32 1, i32 8, i32* %0)
%6 = icmp slt i32 %5, 8
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %1
ret i32 poison
}