#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 */
scalar_t__ memcmp(char *, char *, int);
bool comp(char *b) {
  if (b == NULL) {
    return false;
  }
  char n1[4] = {0xff, 0xd8, 0xff, 0xe0};
  char n2[4] = {0xff, 0xd8, 0xff, 0xe1};
  if (memcmp(b, n1, 4) == 0 || memcmp(b, n2, 4) == 0) {
    return true;
  } else
    return false;
}


x86 assembly (clang, -O0):
<comp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1133 <comp+0x23>
movl   $0x0,-0x4(%rbp)
jmp    1190 <comp+0x80>
mov    0xec7(%rip),%eax
mov    %eax,-0x14(%rbp)
mov    0xec2(%rip),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x4,%edx
call   1030 <memcmp@plt>
cmp    $0x0,%rax
je     117d <comp+0x6d>
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x4,%edx
call   1030 <memcmp@plt>
cmp    $0x0,%rax
jne    1189 <comp+0x79>
movl   $0x1,-0x4(%rbp)
jmp    1190 <comp+0x80>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<comp>:
test   %rdi,%rdi
je     1160 <comp+0x50>
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movl   $0xe0ffd8ff,0xc(%rsp)
e0
movl   $0xe1ffd8ff,0x8(%rsp)
e1
lea    0xc(%rsp),%rsi
mov    $0x4,%edx
call   1030 <memcmp@plt>
test   %rax,%rax
je     1163 <comp+0x53>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1030 <memcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
jmp    1168 <comp+0x58>
xor    %eax,%eax
ret
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.comp.n1 = [4 x i8] c"\FF\D8\FF\E0"
@__const.comp.n2 = [4 x i8] c"\FF\D8\FF\E1"
define i32 @comp(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [4 x i8]
%5 = alloca [4 x i8]
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 0, i32* %2
br label %23
9: ; preds = %1
%10 = bitcast [4 x i8]* %4 to i8*
%11 = bitcast [4 x i8]* %5 to i8*
%12 = load i8*, i8** %3
%13 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%14 = call i64 @memcmp(i8* %12, i8* %13, i32 4)
%15 = icmp eq i64 %14, 0
br i1 %15, label %21, label %16
16: ; preds = %9
%17 = load i8*, i8** %3
%18 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 0
%19 = call i64 @memcmp(i8* %17, i8* %18, i32 4)
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %16, %9
store i32 1, i32* %2
br label %23
22: ; preds = %16
store i32 0, i32* %2
br label %23
23: ; preds = %22, %21, %8
%24 = load i32, i32* %2
ret i32 %24
}

LLVM IR (-O2):
define i32 @comp(i8* %0) {
%2 = alloca i32
%3 = alloca i32
%4 = icmp eq i8* %0, null
br i1 %4, label %16, label %5
5: ; preds = %1
%6 = bitcast i32* %2 to i8*
store i32 -520103681, i32* %2
%7 = bitcast i32* %3 to i8*
store i32 -503326465, i32* %3
%8 = call i64 @memcmp(i8* %0, i8* %6, i32 4)
%9 = icmp eq i64 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %5
%11 = call i64 @memcmp(i8* %0, i8* %7, i32 4)
%12 = icmp eq i64 %11, 0
%13 = zext i1 %12 to i32
br label %14
14: ; preds = %10, %5
%15 = phi i32 [ 1, %5 ], [ %13, %10 ]
br label %16
16: ; preds = %1, %14
%17 = phi i32 [ %15, %14 ], [ 0, %1 ]
ret i32 %17
}