#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int fread(unsigned char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  FILE *f;
  int i;
  unsigned char buf[128000];
  f = fopen("mp.mp3", "r");
  if (f) {
    if (fread(buf, 1, 128000, f) < 128000) {
      fprintf(stderr, "FAN!\n");
      exit(1);
    }
    printf("int mp3datalen = 128000;\n");
    printf("unsigned char mp3data[128000] =\n{");
    for (i = 0; i < 128000; i++) {
      if (i % 8 == 0) {
        printf("\n");
      }
      printf("0x%02x, ", buf[i]);
    }
    printf("};\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1f420,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe90(%rip),%rdi
lea    0xe90(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1257 <main+0x107>
lea    -0x1f420(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0x1f400,%edx
call   1030 <fread@plt>
cmp    $0x1f400,%eax
jge    11cf <main+0x7f>
mov    0x2e29(%rip),%rax
mov    (%rax),%edi
lea    0xe49(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
lea    0xe39(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x1f400,-0x1c(%rbp)
jge    1249 <main+0xf9>
mov    -0x1c(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1221 <main+0xd1>
lea    0xdf3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movslq -0x1c(%rbp),%rax
movzbl -0x1f420(%rbp,%rax,1),%esi
ff
lea    0xe17(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11f2 <main+0xa2>
lea    0xe04(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1f420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x1f408,%rsp
lea    0xe7f(%rip),%rdi
lea    0xe7f(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     1218 <main+0xa8>
mov    %rsp,%rdi
mov    $0x1,%esi
mov    $0x1f400,%edx
mov    %rax,%rcx
call   1050 <fread@plt>
cmp    $0x1f3ff,%eax
jle    1225 <main+0xb5>
lea    0xe81(%rip),%rdi
call   1040 <puts@plt>
lea    0xe4a(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe5e(%rip),%r14
xor    %ebx,%ebx
jmp    11fb <main+0x8b>
nopw   0x0(%rax,%rax,1)
movzbl (%rsp,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%rbx
cmp    $0x1f400,%rbx
je     120c <main+0x9c>
test   $0x7,%bl
jne    11e0 <main+0x70>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    11e0 <main+0x70>
lea    0xe40(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x1f408,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2db4(%rip),%rax
mov    (%rax),%edi
lea    0xdd4(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"mp.mp3\00"
@.str.1 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.2 = [6 x i8] c"FAN!\0A\00"
@.str.3 = [26 x i8] c"int mp3datalen = 128000;\0A\00"
@.str.4 = [34 x i8] c"unsigned char mp3data[128000] =\0A{\00"
@.str.5 = [2 x i8] c"\0A\00"
@.str.6 = [9 x i8] c"0x%02x, \00"
@.str.7 = [4 x i8] c"};\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32
%8 = alloca [128000 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32* @fopen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %9, i32** %6
%10 = load i32*, i32** %6
%11 = icmp ne i32* %10, null
br i1 %11, label %12, label %45
12: ; preds = %2
%13 = getelementptr inbounds [128000 x i8], [128000 x i8]* %8, i64 0, i64 0
%14 = load i32*, i32** %6
%15 = call i32 @fread(i8* %13, i32 1, i32 128000, i32* %14)
%16 = icmp slt i32 %15, 128000
br i1 %16, label %17, label %21
17: ; preds = %12
%18 = load i32, i32* @stderr
%19 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%20 = call i32 @exit(i32 1)
unreachable
21: ; preds = %12
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %7
br label %24
24: ; preds = %40, %21
%25 = load i32, i32* %7
%26 = icmp slt i32 %25, 128000
br i1 %26, label %27, label %43
27: ; preds = %24
%28 = load i32, i32* %7
%29 = srem i32 %28, 8
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %27
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %33
33: ; preds = %31, %27
%34 = load i32, i32* %7
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [128000 x i8], [128000 x i8]* %8, i64 0, i64 %35
%37 = load i8, i8* %36
%38 = zext i8 %37 to i32
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i32 %38)
br label %40
40: ; preds = %33
%41 = load i32, i32* %7
%42 = add nsw i32 %41, 1
store i32 %42, i32* %7
br label %24
43: ; preds = %24
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
br label %45
45: ; preds = %43, %2
%46 = load i32, i32* %3
ret i32 %46
}

LLVM IR (-O2):
@.str = [7 x i8] c"mp.mp3\00"
@.str.1 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.2 = [6 x i8] c"FAN!\0A\00"
@.str.4 = [34 x i8] c"unsigned char mp3data[128000] =\0A{\00"
@.str.6 = [9 x i8] c"0x%02x, \00"
@str = [25 x i8] c"int mp3datalen = 128000;\00"
@str.8 = [3 x i8] c"};\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [128000 x i8]
%4 = getelementptr inbounds [128000 x i8], [128000 x i8]* %3, i64 0, i64 0
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i32* %5, null
br i1 %6, label %32, label %7
7: ; preds = %2
%8 = call i32 @fread(i8* %4, i32 1, i32 128000, i32* %5)
%9 = icmp slt i32 %8, 128000
br i1 %9, label %10, label %14
10: ; preds = %7
%11 = load i32, i32* @stderr
%12 = tail call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%13 = tail call i32 @exit(i32 1)
unreachable
14: ; preds = %7
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0))
br label %17
17: ; preds = %14, %23
%18 = phi i64 [ 0, %14 ], [ %28, %23 ]
%19 = and i64 %18, 7
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %17
%22 = tail call i32 @putchar(i32 10)
br label %23
23: ; preds = %21, %17
%24 = getelementptr inbounds [128000 x i8], [128000 x i8]* %3, i64 0, i64 %18
%25 = load i8, i8* %24
%26 = zext i8 %25 to i32
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i32 %26)
%28 = add nuw nsw i64 %18, 1
%29 = icmp eq i64 %28, 128000
br i1 %29, label %30, label %17
30: ; preds = %23
%31 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.8, i64 0, i64 0))
br label %32
32: ; preds = %30, %2
ret i32 0
}