#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__ mp_get_mp3_header(unsigned char *, int /*<<< orphan*/ *,
                             int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                             int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int mp_check_mp3_header(unsigned int head) {
  unsigned char tmp[4] = {head >> 24, head >> 16, head >> 8, head};
  if ((head & 0xffe00000) != 0xffe00000 || (head & 0x00000c00) == 0x00000c00)
    return 0;
  if (mp_get_mp3_header(tmp, NULL, NULL, NULL, NULL, NULL) <= 0)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<mp_check_mp3_header>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shr    $0x18,%eax
mov    %al,-0xc(%rbp)
mov    -0x8(%rbp),%eax
shr    $0x10,%eax
mov    %al,-0xb(%rbp)
mov    -0x8(%rbp),%eax
shr    $0x8,%eax
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%eax
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%eax
and    $0xffe00000,%eax
cmp    $0xffe00000,%eax
jne    1162 <mp_check_mp3_header+0x52>
mov    -0x8(%rbp),%eax
and    $0xc00,%eax
cmp    $0xc00,%eax
jne    116e <mp_check_mp3_header+0x5e>
movl   $0x0,-0x4(%rbp)
jmp    11a5 <mp_check_mp3_header+0x95>
lea    -0xc(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%r9d
mov    %r9,%rsi
mov    %r9,%rdx
mov    %r9,%rcx
mov    %r9,%r8
call   1030 <mp_get_mp3_header@plt>
cmp    $0x0,%rax
jg     119e <mp_check_mp3_header+0x8e>
movl   $0x0,-0x4(%rbp)
jmp    11a5 <mp_check_mp3_header+0x95>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mp_check_mp3_header>:
push   %rax
mov    %edi,%eax
bswap  %eax
mov    %eax,0x4(%rsp)
xor    %eax,%eax
cmp    $0xffe00000,%edi
jb     1152 <mp_check_mp3_header+0x42>
and    $0xc00,%edi
cmp    $0xc00,%edi
je     1152 <mp_check_mp3_header+0x42>
lea    0x4(%rsp),%rdi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1030 <mp_get_mp3_header@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setg   %al
pop    %rcx
ret

LLVM IR (-O0):
define i32 @mp_check_mp3_header(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [4 x i8]
store i32 %0, i32* %3
%5 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%6 = load i32, i32* %3
%7 = lshr i32 %6, 24
%8 = trunc i32 %7 to i8
store i8 %8, i8* %5
%9 = getelementptr inbounds i8, i8* %5, i64 1
%10 = load i32, i32* %3
%11 = lshr i32 %10, 16
%12 = trunc i32 %11 to i8
store i8 %12, i8* %9
%13 = getelementptr inbounds i8, i8* %9, i64 1
%14 = load i32, i32* %3
%15 = lshr i32 %14, 8
%16 = trunc i32 %15 to i8
store i8 %16, i8* %13
%17 = getelementptr inbounds i8, i8* %13, i64 1
%18 = load i32, i32* %3
%19 = trunc i32 %18 to i8
store i8 %19, i8* %17
%20 = load i32, i32* %3
%21 = and i32 %20, -2097152
%22 = icmp ne i32 %21, -2097152
br i1 %22, label %27, label %23
23: ; preds = %1
%24 = load i32, i32* %3
%25 = and i32 %24, 3072
%26 = icmp eq i32 %25, 3072
br i1 %26, label %27, label %28
27: ; preds = %23, %1
store i32 0, i32* %2
br label %34
28: ; preds = %23
%29 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%30 = call i64 @mp_get_mp3_header(i8* %29, i32* null, i32* null, i32* null, i32* null, i32* null)
%31 = icmp sle i64 %30, 0
br i1 %31, label %32, label %33
32: ; preds = %28
store i32 0, i32* %2
br label %34
33: ; preds = %28
store i32 1, i32* %2
br label %34
34: ; preds = %33, %32, %27
%35 = load i32, i32* %2
ret i32 %35
}

LLVM IR (-O2):
define i32 @mp_check_mp3_header(i32 %0) {
%2 = alloca [4 x i8]
%3 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%4 = lshr i32 %0, 24
%5 = trunc i32 %4 to i8
store i8 %5, i8* %3
%6 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 1
%7 = lshr i32 %0, 16
%8 = trunc i32 %7 to i8
store i8 %8, i8* %6
%9 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 2
%10 = lshr i32 %0, 8
%11 = trunc i32 %10 to i8
store i8 %11, i8* %9
%12 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 3
%13 = trunc i32 %0 to i8
store i8 %13, i8* %12
%14 = icmp ult i32 %0, -2097152
%15 = and i32 %0, 3072
%16 = icmp eq i32 %15, 3072
%17 = or i1 %14, %16
br i1 %17, label %22, label %18
18: ; preds = %1
%19 = call i64 @mp_get_mp3_header(i8* %3, i32* null, i32* null, i32* null, i32* null, i32* null)
%20 = icmp sgt i64 %19, 0
%21 = zext i1 %20 to i32
br label %22
22: ; preds = %18, %1
%23 = phi i32 [ 0, %1 ], [ %21, %18 ]
ret i32 %23
}