#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*/ printf(char *);
int Check_MAP(char check[]) {
  int c1;
  char sMc[5] = {'M', 'A', 'P', ' '};
  for (c1 = 0; c1 < 4; c1++) {
    if (check[c1] != sMc[c1]) {
      printf("Not a map file.");
      return 0;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<Check_MAP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    0xede(%rip),%eax
mov    %eax,-0x19(%rbp)
mov    0xed9(%rip),%al
mov    %al,-0x15(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jge    1187 <Check_MAP+0x77>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
movslq -0x14(%rbp),%rcx
movsbl -0x19(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
je     1174 <Check_MAP+0x64>
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    118e <Check_MAP+0x7e>
jmp    1179 <Check_MAP+0x69>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1135 <Check_MAP+0x25>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Check_MAP>:
push   %rax
cmpb   $0x4d,(%rdi)
jne    112d <Check_MAP+0x1d>
cmpb   $0x41,0x1(%rdi)
jne    112d <Check_MAP+0x1d>
cmpb   $0x50,0x2(%rdi)
jne    112d <Check_MAP+0x1d>
mov    $0x1,%eax
cmpb   $0x20,0x3(%rdi)
je     113b <Check_MAP+0x2b>
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.Check_MAP.sMc = [5 x i8] c"MAP \00"
@.str = [16 x i8] c"Not a map file.\00"
define i32 @Check_MAP(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [5 x i8]
store i8* %0, i8** %3
%6 = bitcast [5 x i8]* %5 to i8*
store i32 0, i32* %4
br label %7
7: ; preds = %26, %1
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 4
br i1 %9, label %10, label %29
10: ; preds = %7
%11 = load i8*, i8** %3
%12 = load i32, i32* %4
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [5 x i8], [5 x i8]* %5, i64 0, i64 %18
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp ne i32 %16, %21
br i1 %22, label %23, label %25
23: ; preds = %10
%24 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %30
25: ; preds = %10
br label %26
26: ; preds = %25
%27 = load i32, i32* %4
%28 = add nsw i32 %27, 1
store i32 %28, i32* %4
br label %7
29: ; preds = %7
store i32 1, i32* %2
br label %30
30: ; preds = %29, %23
%31 = load i32, i32* %2
ret i32 %31
}

LLVM IR (-O2):
@.str = [16 x i8] c"Not a map file.\00"
define i32 @Check_MAP(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 77
br i1 %3, label %4, label %16
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 65
br i1 %7, label %8, label %16
8: ; preds = %4
%9 = getelementptr inbounds i8, i8* %0, i64 2
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 80
br i1 %11, label %12, label %16
12: ; preds = %8
%13 = getelementptr inbounds i8, i8* %0, i64 3
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 32
br i1 %15, label %18, label %16
16: ; preds = %12, %8, %4, %1
%17 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %18
18: ; preds = %12, %16
%19 = phi i32 [ 0, %16 ], [ 1, %12 ]
ret i32 %19
}