#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 */

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void check_magic_number(unsigned file_value, char *var_name, char *func_name) {
  if (file_value != 0x214d4352) {
    fprintf(stderr, "%s:  expected %s 0x%08x; got 0x%08x.\n", func_name,
            var_name, 0x214d4352, file_value);
    fprintf(stderr, "Incorrect file format, or file format has changed?\n");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<check_magic_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x214d4352,-0x4(%rbp)
je     118a <check_magic_number+0x6a>
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x4(%rbp),%r9d
lea    0xea4(%rip),%rsi
mov    $0x214d4352,%r8d
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e70(%rip),%rax
mov    (%rax),%edi
lea    0xead(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_magic_number>:
cmp    $0x214d4352,%edi
jne    1129 <check_magic_number+0x9>
ret
push   %rbx
mov    %rsi,%rcx
mov    %edi,%r9d
mov    0x2ea9(%rip),%rbx
mov    (%rbx),%edi
lea    0xec0(%rip),%rsi
mov    $0x214d4352,%r8d
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xed0(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [38 x i8] c"%s: expected %s 0x%08x; got 0x%08x.\0A\00"
@.str.1 = [52 x i8] c"Incorrect file format, or file format has changed?\0A\00"
define void @check_magic_number(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 558711634
br i1 %8, label %9, label %18
9: ; preds = %3
%10 = load i32, i32* @stderr
%11 = load i8*, i8** %6
%12 = load i8*, i8** %5
%13 = load i32, i32* %4
%14 = call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %11, i8* %12, i32 558711634, i32 %13)
%15 = load i32, i32* @stderr
%16 = call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0))
%17 = call i32 @exit(i32 1)
unreachable
18: ; preds = %3
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [38 x i8] c"%s: expected %s 0x%08x; got 0x%08x.\0A\00"
@.str.1 = [52 x i8] c"Incorrect file format, or file format has changed?\0A\00"
define void @check_magic_number(i32 %0, i8* %1, i8* %2) {
%4 = icmp eq i32 %0, 558711634
br i1 %4, label %11, label %5
5: ; preds = %3
%6 = load i32, i32* @stderr
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %2, i8* %1, i32 558711634, i32 %0)
%8 = load i32, i32* @stderr
%9 = tail call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0))
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %3
ret void
}