#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 *, char, char, char, char);
scalar_t__ quicktime_match_32(char *, char *);
int quicktime_codec_to_id(char *codec) {
  if (quicktime_match_32(codec, ".mp3"))
    return 0x55;
  else if (quicktime_match_32(codec, "WMA "))
    return 0x161;
  else
    printf("quicktime_codec_to_id: unknown codec %c%c%c%c\n", codec[0],
           codec[1], codec[2], codec[3]);
}


x86 assembly (clang, -O0):
<quicktime_codec_to_id>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <quicktime_match_32@plt>
cmp    $0x0,%rax
je     1152 <quicktime_codec_to_id+0x32>
movl   $0x55,-0x4(%rbp)
jmp    11b1 <quicktime_codec_to_id+0x91>
mov    -0x10(%rbp),%rdi
lea    0xea8(%rip),%rsi
call   1040 <quicktime_match_32@plt>
cmp    $0x0,%rax
je     1178 <quicktime_codec_to_id+0x58>
movl   $0x161,-0x4(%rbp)
jmp    11b1 <quicktime_codec_to_id+0x91>
mov    -0x10(%rbp),%rax
mov    (%rax),%sil
mov    -0x10(%rbp),%rax
mov    0x1(%rax),%dl
mov    -0x10(%rbp),%rax
mov    0x2(%rax),%cl
mov    -0x10(%rbp),%rax
lea    0xe72(%rip),%rdi
movsbl %sil,%esi
movsbl %dl,%edx
movsbl %cl,%ecx
movsbl 0x3(%rax),%r8d
call   1030 <printf@plt>
jmp    11b1 <quicktime_codec_to_id+0x91>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quicktime_codec_to_id>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rsi
call   1040 <quicktime_match_32@plt>
mov    %rax,%rcx
mov    $0x55,%eax
test   %rcx,%rcx
je     113f <quicktime_codec_to_id+0x1f>
pop    %rbx
ret
lea    0xebf(%rip),%rsi
mov    %rbx,%rdi
call   1040 <quicktime_match_32@plt>
mov    %rax,%rcx
mov    $0x161,%eax
test   %rcx,%rcx
jne    113d <quicktime_codec_to_id+0x1d>
movsbl (%rbx),%esi
movsbl 0x1(%rbx),%edx
movsbl 0x2(%rbx),%ecx
movsbl 0x3(%rbx),%r8d
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c".mp3\00"
@.str.1 = [5 x i8] c"WMA \00"
@.str.2 = [47 x i8] c"quicktime_codec_to_id: unknown codec %c%c%c%c\0A\00"
define i32 @quicktime_codec_to_id(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i64 @quicktime_match_32(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 85, i32* %2
br label %28
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = call i64 @quicktime_match_32(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %8
store i32 353, i32* %2
br label %28
13: ; preds = %8
%14 = load i8*, i8** %3
%15 = getelementptr inbounds i8, i8* %14, i64 0
%16 = load i8, i8* %15
%17 = load i8*, i8** %3
%18 = getelementptr inbounds i8, i8* %17, i64 1
%19 = load i8, i8* %18
%20 = load i8*, i8** %3
%21 = getelementptr inbounds i8, i8* %20, i64 2
%22 = load i8, i8* %21
%23 = load i8*, i8** %3
%24 = getelementptr inbounds i8, i8* %23, i64 3
%25 = load i8, i8* %24
%26 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0), i8 signext %16, i8 signext %19, i8 signext %22, i8 signext %25)
br label %27
27: ; preds = %13
br label %28
28: ; preds = %7, %12, %27
%29 = load i32, i32* %2
ret i32 %29
}

LLVM IR (-O2):
@.str = [5 x i8] c".mp3\00"
@.str.1 = [5 x i8] c"WMA \00"
@.str.2 = [47 x i8] c"quicktime_codec_to_id: unknown codec %c%c%c%c\0A\00"
define i32 @quicktime_codec_to_id(i8* %0) {
%2 = tail call i64 @quicktime_match_32(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %16
4: ; preds = %1
%5 = tail call i64 @quicktime_match_32(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %16
7: ; preds = %4
%8 = load i8, i8* %0
%9 = getelementptr inbounds i8, i8* %0, i64 1
%10 = load i8, i8* %9
%11 = getelementptr inbounds i8, i8* %0, i64 2
%12 = load i8, i8* %11
%13 = getelementptr inbounds i8, i8* %0, i64 3
%14 = load i8, i8* %13
%15 = tail call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0), i8 signext %8, i8 signext %10, i8 signext %12, i8 signext %14)
br label %16
16: ; preds = %4, %1, %7
%17 = phi i32 [ undef, %7 ], [ 85, %1 ], [ 353, %4 ]
ret i32 %17
}