#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*/ hashStr(char const *);
int /*<<< orphan*/ printf(char *, ...);
void printHashes(void) {
  static const char *exts[] = {"mp4", "m4v", "mkv", "mpeg",
                               "mpg", "avi", "wmv", NULL};
  const char **ext = exts;
  printf("\n");
  while (*ext != NULL) {
    printf("#define kHash_%s\t0x%016lX\n", *ext, hashStr(*ext));
    ext++;
  }
  ext = exts;
  while (*ext != NULL) {
    printf("\tcase kHash_%s:\n", *ext);
    ext++;
  }
}


x86 assembly (clang, -O0):
<printHashes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0x2f11(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xf0d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     118b <printHashes+0x6b>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1040 <hashStr@plt>
mov    -0x10(%rbp),%rsi
mov    %eax,%edx
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
jmp    1141 <printHashes+0x21>
lea    0x2eae(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     11ca <printHashes+0xaa>
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
jmp    1196 <printHashes+0x76>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printHashes>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xeb4(%rip),%rbp
mov    %rbp,%rdi
call   1050 <hashStr@plt>
lea    0xec2(%rip),%rbx
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe93(%rip),%rbp
mov    %rbp,%rdi
call   1050 <hashStr@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe79(%rip),%r12
mov    %r12,%rdi
call   1050 <hashStr@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe5f(%rip),%r13
mov    %r13,%rdi
call   1050 <hashStr@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe46(%rip),%rbp
mov    %rbp,%rdi
call   1050 <hashStr@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe2c(%rip),%r14
mov    %r14,%rdi
call   1050 <hashStr@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe12(%rip),%r15
mov    %r15,%rdi
call   1050 <hashStr@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe13(%rip),%rbx
mov    %rbx,%rdi
lea    0xdd1(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
lea    0xdc4(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@printHashes.exts = internal global [8 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i32 0, i32 0), i8* null]
@.str = [4 x i8] c"mp4\00"
@.str.1 = [4 x i8] c"m4v\00"
@.str.2 = [4 x i8] c"mkv\00"
@.str.3 = [5 x i8] c"mpeg\00"
@.str.4 = [4 x i8] c"mpg\00"
@.str.5 = [4 x i8] c"avi\00"
@.str.6 = [4 x i8] c"wmv\00"
@.str.7 = [2 x i8] c"\0A\00"
@.str.8 = [27 x i8] c"#define kHash_%s\090x%016lX\0A\00"
@.str.9 = [17 x i8] c"\09case kHash_%s:\0A\00"
define void @printHashes() {
%1 = alloca i8**
store i8** getelementptr inbounds ([8 x i8*], [8 x i8*]* @printHashes.exts, i64 0, i64 0), i8*** %1
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %3
3: ; preds = %7, %0
%4 = load i8**, i8*** %1
%5 = load i8*, i8** %4
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %16
7: ; preds = %3
%8 = load i8**, i8*** %1
%9 = load i8*, i8** %8
%10 = load i8**, i8*** %1
%11 = load i8*, i8** %10
%12 = call i32 @hashStr(i8* %11)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), i8* %9, i32 %12)
%14 = load i8**, i8*** %1
%15 = getelementptr inbounds i8*, i8** %14, i32 1
store i8** %15, i8*** %1
br label %3
16: ; preds = %3
store i8** getelementptr inbounds ([8 x i8*], [8 x i8*]* @printHashes.exts, i64 0, i64 0), i8*** %1
br label %17
17: ; preds = %21, %16
%18 = load i8**, i8*** %1
%19 = load i8*, i8** %18
%20 = icmp ne i8* %19, null
br i1 %20, label %21, label %27
21: ; preds = %17
%22 = load i8**, i8*** %1
%23 = load i8*, i8** %22
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i8* %23)
%25 = load i8**, i8*** %1
%26 = getelementptr inbounds i8*, i8** %25, i32 1
store i8** %26, i8*** %1
br label %17
27: ; preds = %17
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"mp4\00"
@.str.1 = [4 x i8] c"m4v\00"
@.str.2 = [4 x i8] c"mkv\00"
@.str.3 = [5 x i8] c"mpeg\00"
@.str.4 = [4 x i8] c"mpg\00"
@.str.5 = [4 x i8] c"avi\00"
@.str.6 = [4 x i8] c"wmv\00"
@.str.8 = [27 x i8] c"#define kHash_%s\090x%016lX\0A\00"
@.str.9 = [17 x i8] c"\09case kHash_%s:\0A\00"
define void @printHashes() {
%1 = tail call i32 @putchar(i32 10)
%2 = tail call i32 @hashStr(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = tail call i32 @hashStr(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = tail call i32 @hashStr(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %6)
%8 = tail call i32 @hashStr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %8)
%10 = tail call i32 @hashStr(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %10)
%12 = tail call i32 @hashStr(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %12)
%14 = tail call i32 @hashStr(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %14)
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
ret void
}