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

/* Variables and functions */
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ fread(int /*<<< orphan*/ *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ mvhd_fseeko64(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int mvhd_is_conectix_str(int /*<<< orphan*/ *);
bool mvhd_file_is_vhd(FILE *f) {
  if (f) {
    uint8_t con_str[8];
    mvhd_fseeko64(f, -512, SEEK_END);
    fread(con_str, sizeof con_str, 1, f);
    return mvhd_is_conectix_str(con_str);
  } else {
    return false;
  }
}


x86 assembly (clang, -O0):
<mvhd_file_is_vhd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1186 <mvhd_file_is_vhd+0x56>
mov    -0x10(%rbp),%rdi
mov    0x2e96(%rip),%rax
mov    (%rax),%edx
mov    $0xfffffe00,%esi
call   1050 <mvhd_fseeko64@plt>
lea    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x20,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
lea    -0x30(%rbp),%rdi
call   1040 <mvhd_is_conectix_str@plt>
mov    %eax,-0x4(%rbp)
jmp    118d <mvhd_file_is_vhd+0x5d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mvhd_file_is_vhd>:
test   %rdi,%rdi
je     117a <mvhd_file_is_vhd+0x4a>
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rdi,%rbx
mov    0x2ea2(%rip),%rax
mov    (%rax),%edx
mov    $0xfffffe00,%esi
call   1050 <mvhd_fseeko64@plt>
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x20,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fread@plt>
mov    %r14,%rdi
call   1040 <mvhd_is_conectix_str@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
@SEEK_END = global i32 0
define i32 @mvhd_file_is_vhd(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca [8 x i32]
store i32* %0, i32** %3
%5 = load i32*, i32** %3
%6 = icmp ne i32* %5, null
br i1 %6, label %7, label %16
7: ; preds = %1
%8 = load i32*, i32** %3
%9 = load i32, i32* @SEEK_END
%10 = call i32 @mvhd_fseeko64(i32* %8, i32 -512, i32 %9)
%11 = getelementptr inbounds [8 x i32], [8 x i32]* %4, i64 0, i64 0
%12 = load i32*, i32** %3
%13 = call i32 @fread(i32* %11, i32 32, i32 1, i32* %12)
%14 = getelementptr inbounds [8 x i32], [8 x i32]* %4, i64 0, i64 0
%15 = call i32 @mvhd_is_conectix_str(i32* %14)
store i32 %15, i32* %2
br label %17
16: ; preds = %1
store i32 0, i32* %2
br label %17
17: ; preds = %16, %7
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
@SEEK_END = global i32 0
define i32 @mvhd_file_is_vhd(i32* %0) {
%2 = alloca [8 x i32]
%3 = icmp eq i32* %0, null
br i1 %3, label %11, label %4
4: ; preds = %1
%5 = bitcast [8 x i32]* %2 to i8*
%6 = load i32, i32* @SEEK_END
%7 = tail call i32 @mvhd_fseeko64(i32* %0, i32 -512, i32 %6)
%8 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%9 = call i32 @fread(i32* %8, i32 32, i32 1, i32* %0)
%10 = call i32 @mvhd_is_conectix_str(i32* %8)
br label %11
11: ; preds = %1, %4
%12 = phi i32 [ %10, %4 ], [ 0, %1 ]
ret i32 %12
}