#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*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ fread(unsigned long long *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
void read_internal_iv(char *file, unsigned long long int *iiv) {
  FILE *fp_iiv;
  fp_iiv = fopen(file, "rb");
  if (fp_iiv == NULL) {
    fprintf(stderr, "IV open error\n");
    exit(1);
  }
  rewind(fp_iiv);
  fseek(fp_iiv, 32 + 8, SEEK_SET);
  fread(iiv, 64, 8, fp_iiv);
  fclose(fp_iiv);
}


x86 assembly (clang, -O0):
<read_internal_iv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe75(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11be <read_internal_iv+0x4e>
mov    0x2e3a(%rip),%rax
mov    (%rax),%edi
lea    0xe54(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x18(%rbp),%rdi
call   1050 <rewind@plt>
mov    -0x18(%rbp),%rdi
mov    0x2e06(%rip),%rax
mov    (%rax),%edx
mov    $0x28,%esi
call   1070 <fseek@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x40,%esi
mov    $0x8,%edx
call   1030 <fread@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_internal_iv>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
lea    0xe82(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     11cd <read_internal_iv+0x5d>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <rewind@plt>
mov    0x2e3e(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    $0x28,%esi
call   1070 <fseek@plt>
mov    %r14,%rdi
mov    $0x40,%esi
mov    $0x8,%edx
mov    %rbx,%rcx
call   1030 <fread@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <fclose@plt>
mov    0x2e0c(%rip),%rax
mov    (%rax),%edi
lea    0xe26(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"rb\00"
@stderr = global i32 0
@.str.1 = [15 x i8] c"IV open error\0A\00"
@SEEK_SET = global i32 0
define void @read_internal_iv(i8* %0, i64* %1) {
%3 = alloca i8*
%4 = alloca i64*
%5 = alloca i32*
store i8* %0, i8** %3
store i64* %1, i64** %4
%6 = load i8*, i8** %3
%7 = call i32* @fopen(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %7, i32** %5
%8 = load i32*, i32** %5
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 @exit(i32 1)
unreachable
14: ; preds = %2
%15 = load i32*, i32** %5
%16 = call i32 @rewind(i32* %15)
%17 = load i32*, i32** %5
%18 = load i32, i32* @SEEK_SET
%19 = call i32 @fseek(i32* %17, i32 40, i32 %18)
%20 = load i64*, i64** %4
%21 = load i32*, i32** %5
%22 = call i32 @fread(i64* %20, i32 64, i32 8, i32* %21)
%23 = load i32*, i32** %5
%24 = call i32 @fclose(i32* %23)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"rb\00"
@stderr = global i32 0
@.str.1 = [15 x i8] c"IV open error\0A\00"
@SEEK_SET = global i32 0
define void @read_internal_iv(i8* nocapture %0, i64* nocapture %1) {
%3 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
%10 = tail call i32 @rewind(i32* %3)
%11 = load i32, i32* @SEEK_SET
%12 = tail call i32 @fseek(i32* %3, i32 40, i32 %11)
%13 = tail call i32 @fread(i64* %1, i32 64, i32 8, i32* %3)
%14 = tail call i32 @fclose(i32* %3)
ret void
}