#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*/ R_OK;
int access(char *, int /*<<< orphan*/);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputc(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ fwrite(int *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  FILE *in, *out;
  int counter;
  int size = 0;
  int number;
  int *nm = &number;
  int *sz = &size;
  if (argc != 3) {
    printf("\n          `mkwav' v. 0.1.2\n");
    printf("\n Copies any arbitrary file to a new file with an\n");
    printf(" RIFF, 16 bit, mono, 44,100 khz .wav file header.\n");
    printf("\n           Use: mkwav infile outfile\n");
    printf("\n No error-checking.  Will overwrite output file.\n");
    printf("\n Use at own risk.             evans.winner@gmail.com\n");
    return 0;
  }
  if (access(argv[1], R_OK) == -1) {
    printf("Input file does not exist\n");
    exit(1);
  }
  in = fopen(argv[1], "r");
  while (!feof(in)) {
    counter = fgetc(in);
    if (!feof(in))
      size++;
  }
  fclose(in);
  in = fopen(argv[1], "r");
  out = fopen(argv[2], "w");
  fputs("RIFF", out);
  size = (size + 36);
  fwrite(sz, 2, 1, out);
  number = 0;
  fwrite(nm, 2, 1, out);
  fputs("WAVEfmt ", out);
  number = 16;
  fwrite(nm, 2, 1, out);
  number = 0;
  fwrite(nm, 2, 1, out);
  number = 1;
  fwrite(nm, 2, 1, out);
  fwrite(nm, 2, 1, out);
  number = 44100;
  fwrite(nm, 2, 1, out);
  number = 0;
  fwrite(nm, 2, 1, out);
  number = 22664;
  fwrite(nm, 2, 1, out);
  number = 1;
  fwrite(nm, 2, 1, out);
  number = 2;
  fwrite(nm, 2, 1, out);
  number = 16;
  fwrite(nm, 2, 1, out);
  fputs("data", out);
  size = (size - 36);
  fwrite(sz, 2, 1, out);
  number = 0;
  fwrite(nm, 2, 1, out);
  while (!feof(in)) {
    counter = fgetc(in);
    if (!feof(in))
      fputc(counter, out);
  }
  fclose(in);
  fclose(out);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x28(%rbp)
lea    -0x2c(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    -0x28(%rbp),%rax
mov    %rax,-0x40(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     122b <main+0x8b>
lea    0xe22(%rip),%rdi
call   1040 <printf@plt>
lea    0xe33(%rip),%rdi
call   1040 <printf@plt>
lea    0xe5a(%rip),%rdi
call   1040 <printf@plt>
lea    0xe81(%rip),%rdi
call   1040 <printf@plt>
lea    0xe9c(%rip),%rdi
call   1040 <printf@plt>
lea    0xec3(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1532 <main+0x392>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2da6(%rip),%rax
mov    (%rax),%esi
call   1090 <access@plt>
cmp    $0xffffffff,%eax
jne    1260 <main+0xc0>
lea    0xec3(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xec0(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1080 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1296 <main+0xf6>
jmp    12c2 <main+0x122>
mov    -0x18(%rbp),%rdi
call   1060 <fgetc@plt>
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
call   1080 <feof@plt>
cmp    $0x0,%eax
jne    12bd <main+0x11d>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1278 <main+0xd8>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe55(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe3f(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe2d(%rip),%rdi
call   1050 <fputs@plt>
mov    -0x28(%rbp),%eax
add    $0x24,%eax
mov    %eax,-0x28(%rbp)
mov    -0x40(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x2,%esi
mov    $0x1,%edx
call   10c0 <fwrite@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x2,%esi
mov    $0x1,%edx
call   10c0 <fwrite@plt>
mov    -0x20(%rbp),%rsi
lea    0xde4(%rip),%rdi
call   1050 <fputs@plt>
movl   $0x10,-0x2c(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x2,%esi
mov    $0x1,%edx
call   10c0 <fwrite@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x2,%esi
mov    $0x1,%edx
call   10c0 <fwrite@plt>
movl   $0x1,-0x2c(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x2,%esi
mov    $0x1,%edx
call   10c0 <fwrite@plt>
mov    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x2,%esi
mov    $0x1,%edx
call   10c0 <fwrite@plt>
movl   $0xac44,-0x2c(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x2,%esi
mov    $0x1,%edx
call   10c0 <fwrite@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x2,%esi
mov    $0x1,%edx
call   10c0 <fwrite@plt>
movl   $0x5888,-0x2c(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x2,%esi
mov    $0x1,%edx
call   10c0 <fwrite@plt>
movl   $0x1,-0x2c(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x2,%esi
mov    $0x1,%edx
call   10c0 <fwrite@plt>
movl   $0x2,-0x2c(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x2,%esi
mov    $0x1,%edx
call   10c0 <fwrite@plt>
movl   $0x10,-0x2c(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x2,%esi
mov    $0x1,%edx
call   10c0 <fwrite@plt>
mov    -0x20(%rbp),%rsi
lea    0xcb8(%rip),%rdi
call   1050 <fputs@plt>
mov    -0x28(%rbp),%eax
sub    $0x24,%eax
mov    %eax,-0x28(%rbp)
mov    -0x40(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x2,%esi
mov    $0x1,%edx
call   10c0 <fwrite@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x2,%esi
mov    $0x1,%edx
call   10c0 <fwrite@plt>
mov    -0x18(%rbp),%rdi
call   1080 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    14ea <main+0x34a>
jmp    1519 <main+0x379>
mov    -0x18(%rbp),%rdi
call   1060 <fgetc@plt>
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
call   1080 <feof@plt>
cmp    $0x0,%eax
jne    1514 <main+0x374>
mov    -0x24(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1070 <fputc@plt>
jmp    14cc <main+0x32c>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
cmp    $0x3,%edi
jne    144e <main+0x2be>
mov    %rsi,%r14
mov    0x8(%rsi),%rdi
mov    0x2e2d(%rip),%rax
mov    (%rax),%esi
call   1080 <access@plt>
cmp    $0xffffffff,%eax
je     14b7 <main+0x327>
mov    0x8(%r14),%rdi
lea    0xe32(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1070 <feof@plt>
mov    $0x24,%ebp
test   %eax,%eax
jne    1215 <main+0x85>
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1050 <fgetc@plt>
mov    %rbx,%rdi
call   1070 <feof@plt>
cmp    $0x1,%eax
adc    $0x0,%ebp
mov    %rbx,%rdi
call   1070 <feof@plt>
test   %eax,%eax
je     11f0 <main+0x60>
add    $0x24,%ebp
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    0x8(%r14),%rdi
lea    0xdd8(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%rbx
mov    0x10(%r14),%rdi
lea    0xdc7(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%r14
lea    0xdba(%rip),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   10b0 <fwrite@plt>
mov    %ebp,0xc(%rsp)
lea    0xc(%rsp),%r15
mov    %r15,%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10b0 <fwrite@plt>
movl   $0x0,0x8(%rsp)
lea    0x8(%rsp),%r12
mov    %r12,%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10b0 <fwrite@plt>
lea    0xd66(%rip),%rdi
mov    $0x8,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10b0 <fwrite@plt>
movl   $0x10,0x8(%rsp)
mov    %r12,%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10b0 <fwrite@plt>
movl   $0x0,0x8(%rsp)
mov    %r12,%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10b0 <fwrite@plt>
movl   $0x1,0x8(%rsp)
mov    %r12,%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10b0 <fwrite@plt>
mov    %r12,%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10b0 <fwrite@plt>
movl   $0xac44,0x8(%rsp)
mov    %r12,%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10b0 <fwrite@plt>
movl   $0x0,0x8(%rsp)
mov    %r12,%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10b0 <fwrite@plt>
movl   $0x5888,0x8(%rsp)
mov    %r12,%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10b0 <fwrite@plt>
movl   $0x1,0x8(%rsp)
mov    %r12,%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10b0 <fwrite@plt>
movl   $0x2,0x8(%rsp)
mov    %r12,%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10b0 <fwrite@plt>
movl   $0x10,0x8(%rsp)
mov    %r12,%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10b0 <fwrite@plt>
lea    0xc3c(%rip),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10b0 <fwrite@plt>
addl   $0xffffffdc,0xc(%rsp)
mov    %r15,%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10b0 <fwrite@plt>
movl   $0x0,0x8(%rsp)
mov    %r12,%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10b0 <fwrite@plt>
nop
mov    %rbx,%rdi
call   1070 <feof@plt>
test   %eax,%eax
jne    1498 <main+0x308>
mov    %rbx,%rdi
call   1050 <fgetc@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1070 <feof@plt>
test   %eax,%eax
jne    1420 <main+0x290>
mov    %ebp,%edi
mov    %r14,%rsi
call   1060 <fputc@plt>
jmp    1420 <main+0x290>
lea    0xbdc(%rip),%rdi
call   1030 <puts@plt>
lea    0xbec(%rip),%rdi
call   1030 <puts@plt>
lea    0xc12(%rip),%rdi
call   1030 <puts@plt>
lea    0xc38(%rip),%rdi
call   1030 <puts@plt>
lea    0xc52(%rip),%rdi
call   1030 <puts@plt>
lea    0xc78(%rip),%rdi
call   1030 <puts@plt>
jmp    14a8 <main+0x318>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xb59(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"\0A `mkwav' v. 0.1.2\0A\00"
@.str.1 = [51 x i8] c"\0A Copies any arbitrary file to a new file with an\0A\00"
@.str.2 = [51 x i8] c" RIFF, 16 bit, mono, 44,100 khz .wav file header.\0A\00"
@.str.3 = [39 x i8] c"\0A Use: mkwav infile outfile\0A\00"
@.str.4 = [51 x i8] c"\0A No error-checking. Will overwrite output file.\0A\00"
@.str.5 = [55 x i8] c"\0A Use at own risk. evans.winner@gmail.com\0A\00"
@R_OK = global i32 0
@.str.6 = [27 x i8] c"Input file does not exist\0A\00"
@.str.7 = [2 x i8] c"r\00"
@.str.8 = [2 x i8] c"w\00"
@.str.9 = [5 x i8] c"RIFF\00"
@.str.10 = [9 x i8] c"WAVEfmt \00"
@.str.11 = [5 x i8] c"data\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 i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32*
%12 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %9
store i32* %10, i32** %11
store i32* %9, i32** %12
%13 = load i32, i32* %4
%14 = icmp ne i32 %13, 3
br i1 %14, label %15, label %22
15: ; preds = %2
%16 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%17 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0))
%18 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0))
%19 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0))
%20 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.4, i64 0, i64 0))
%21 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %3
br label %136
22: ; preds = %2
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = load i32, i32* @R_OK
%27 = call i32 @access(i8* %25, i32 %26)
%28 = icmp eq i32 %27, -1
br i1 %28, label %29, label %32
29: ; preds = %22
%30 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0))
%31 = call i32 @exit(i32 1)
unreachable
32: ; preds = %22
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 1
%35 = load i8*, i8** %34
%36 = call i32* @fopen(i8* %35, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
store i32* %36, i32** %6
br label %37
37: ; preds = %51, %32
%38 = load i32*, i32** %6
%39 = call i32 @feof(i32* %38)
%40 = icmp ne i32 %39, 0
%41 = xor i1 %40, true
br i1 %41, label %42, label %52
42: ; preds = %37
%43 = load i32*, i32** %6
%44 = call i32 @fgetc(i32* %43)
store i32 %44, i32* %8
%45 = load i32*, i32** %6
%46 = call i32 @feof(i32* %45)
%47 = icmp ne i32 %46, 0
br i1 %47, label %51, label %48
48: ; preds = %42
%49 = load i32, i32* %9
%50 = add nsw i32 %49, 1
store i32 %50, i32* %9
br label %51
51: ; preds = %48, %42
br label %37
52: ; preds = %37
%53 = load i32*, i32** %6
%54 = call i32 @fclose(i32* %53)
%55 = load i8**, i8*** %5
%56 = getelementptr inbounds i8*, i8** %55, i64 1
%57 = load i8*, i8** %56
%58 = call i32* @fopen(i8* %57, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
store i32* %58, i32** %6
%59 = load i8**, i8*** %5
%60 = getelementptr inbounds i8*, i8** %59, i64 2
%61 = load i8*, i8** %60
%62 = call i32* @fopen(i8* %61, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
store i32* %62, i32** %7
%63 = load i32*, i32** %7
%64 = call i32 @fputs(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i32* %63)
%65 = load i32, i32* %9
%66 = add nsw i32 %65, 36
store i32 %66, i32* %9
%67 = load i32*, i32** %12
%68 = load i32*, i32** %7
%69 = call i32 @fwrite(i32* %67, i32 2, i32 1, i32* %68)
store i32 0, i32* %10
%70 = load i32*, i32** %11
%71 = load i32*, i32** %7
%72 = call i32 @fwrite(i32* %70, i32 2, i32 1, i32* %71)
%73 = load i32*, i32** %7
%74 = call i32 @fputs(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i32* %73)
store i32 16, i32* %10
%75 = load i32*, i32** %11
%76 = load i32*, i32** %7
%77 = call i32 @fwrite(i32* %75, i32 2, i32 1, i32* %76)
store i32 0, i32* %10
%78 = load i32*, i32** %11
%79 = load i32*, i32** %7
%80 = call i32 @fwrite(i32* %78, i32 2, i32 1, i32* %79)
store i32 1, i32* %10
%81 = load i32*, i32** %11
%82 = load i32*, i32** %7
%83 = call i32 @fwrite(i32* %81, i32 2, i32 1, i32* %82)
%84 = load i32*, i32** %11
%85 = load i32*, i32** %7
%86 = call i32 @fwrite(i32* %84, i32 2, i32 1, i32* %85)
store i32 44100, i32* %10
%87 = load i32*, i32** %11
%88 = load i32*, i32** %7
%89 = call i32 @fwrite(i32* %87, i32 2, i32 1, i32* %88)
store i32 0, i32* %10
%90 = load i32*, i32** %11
%91 = load i32*, i32** %7
%92 = call i32 @fwrite(i32* %90, i32 2, i32 1, i32* %91)
store i32 22664, i32* %10
%93 = load i32*, i32** %11
%94 = load i32*, i32** %7
%95 = call i32 @fwrite(i32* %93, i32 2, i32 1, i32* %94)
store i32 1, i32* %10
%96 = load i32*, i32** %11
%97 = load i32*, i32** %7
%98 = call i32 @fwrite(i32* %96, i32 2, i32 1, i32* %97)
store i32 2, i32* %10
%99 = load i32*, i32** %11
%100 = load i32*, i32** %7
%101 = call i32 @fwrite(i32* %99, i32 2, i32 1, i32* %100)
store i32 16, i32* %10
%102 = load i32*, i32** %11
%103 = load i32*, i32** %7
%104 = call i32 @fwrite(i32* %102, i32 2, i32 1, i32* %103)
%105 = load i32*, i32** %7
%106 = call i32 @fputs(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i32* %105)
%107 = load i32, i32* %9
%108 = sub nsw i32 %107, 36
store i32 %108, i32* %9
%109 = load i32*, i32** %12
%110 = load i32*, i32** %7
%111 = call i32 @fwrite(i32* %109, i32 2, i32 1, i32* %110)
store i32 0, i32* %10
%112 = load i32*, i32** %11
%113 = load i32*, i32** %7
%114 = call i32 @fwrite(i32* %112, i32 2, i32 1, i32* %113)
br label %115
115: ; preds = %130, %52
%116 = load i32*, i32** %6
%117 = call i32 @feof(i32* %116)
%118 = icmp ne i32 %117, 0
%119 = xor i1 %118, true
br i1 %119, label %120, label %131
120: ; preds = %115
%121 = load i32*, i32** %6
%122 = call i32 @fgetc(i32* %121)
store i32 %122, i32* %8
%123 = load i32*, i32** %6
%124 = call i32 @feof(i32* %123)
%125 = icmp ne i32 %124, 0
br i1 %125, label %130, label %126
126: ; preds = %120
%127 = load i32, i32* %8
%128 = load i32*, i32** %7
%129 = call i32 @fputc(i32 %127, i32* %128)
br label %130
130: ; preds = %126, %120
br label %115
131: ; preds = %115
%132 = load i32*, i32** %6
%133 = call i32 @fclose(i32* %132)
%134 = load i32*, i32** %7
%135 = call i32 @fclose(i32* %134)
store i32 0, i32* %3
br label %136
136: ; preds = %131, %15
%137 = load i32, i32* %3
ret i32 %137
}

LLVM IR (-O2):
@R_OK = global i32 0
@.str.7 = [2 x i8] c"r\00"
@.str.8 = [2 x i8] c"w\00"
@.str.9 = [5 x i8] c"RIFF\00"
@.str.10 = [9 x i8] c"WAVEfmt \00"
@.str.11 = [5 x i8] c"data\00"
@str = [26 x i8] c"Input file does not exist\00"
@str.12 = [28 x i8] c"\0A `mkwav' v. 0.1.2\00"
@str.13 = [50 x i8] c"\0A Copies any arbitrary file to a new file with an\00"
@str.14 = [50 x i8] c" RIFF, 16 bit, mono, 44,100 khz .wav file header.\00"
@str.15 = [38 x i8] c"\0A Use: mkwav infile outfile\00"
@str.16 = [50 x i8] c"\0A No error-checking. Will overwrite output file.\00"
@str.17 = [54 x i8] c"\0A Use at own risk. evans.winner@gmail.com\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = icmp eq i32 %0, 3
br i1 %7, label %15, label %8
8: ; preds = %2
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.12, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str.13, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str.14, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.15, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str.16, i64 0, i64 0))
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str.17, i64 0, i64 0))
br label %81
15: ; preds = %2
%16 = getelementptr inbounds i8*, i8** %1, i64 1
%17 = load i8*, i8** %16
%18 = load i32, i32* @R_OK
%19 = tail call i32 @access(i8* %17, i32 %18)
%20 = icmp eq i32 %19, -1
br i1 %20, label %21, label %24
21: ; preds = %15
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%23 = tail call i32 @exit(i32 1)
unreachable
24: ; preds = %15
%25 = load i8*, i8** %16
%26 = tail call i32* @fopen(i8* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%27 = tail call i32 @feof(i32* %26)
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %40
29: ; preds = %24, %29
%30 = phi i32 [ %35, %29 ], [ 0, %24 ]
%31 = tail call i32 @fgetc(i32* %26)
%32 = tail call i32 @feof(i32* %26)
%33 = icmp eq i32 %32, 0
%34 = zext i1 %33 to i32
%35 = add nuw nsw i32 %30, %34
%36 = tail call i32 @feof(i32* %26)
%37 = icmp eq i32 %36, 0
br i1 %37, label %29, label %38
38: ; preds = %29
%39 = add nuw i32 %35, 36
br label %40
40: ; preds = %38, %24
%41 = phi i32 [ 36, %24 ], [ %39, %38 ]
%42 = tail call i32 @fclose(i32* %26)
%43 = load i8*, i8** %16
%44 = tail call i32* @fopen(i8* %43, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%45 = getelementptr inbounds i8*, i8** %1, i64 2
%46 = load i8*, i8** %45
%47 = tail call i32* @fopen(i8* %46, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%48 = tail call i64 bitcast (i32 (i32*, i32, i32, i32*)* @fwrite to i64 (i8*, i64, i64, i32*)*)(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i64 4, i64 1, i32* %47)
store i32 %41, i32* %3
%49 = call i32 @fwrite(i32* %3, i32 2, i32 1, i32* %47)
store i32 0, i32* %4
%50 = call i32 @fwrite(i32* %4, i32 2, i32 1, i32* %47)
%51 = tail call i64 bitcast (i32 (i32*, i32, i32, i32*)* @fwrite to i64 (i8*, i64, i64, i32*)*)(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i64 8, i64 1, i32* %47)
store i32 16, i32* %4
%52 = call i32 @fwrite(i32* %4, i32 2, i32 1, i32* %47)
store i32 0, i32* %4
%53 = call i32 @fwrite(i32* %4, i32 2, i32 1, i32* %47)
store i32 1, i32* %4
%54 = call i32 @fwrite(i32* %4, i32 2, i32 1, i32* %47)
%55 = call i32 @fwrite(i32* %4, i32 2, i32 1, i32* %47)
store i32 44100, i32* %4
%56 = call i32 @fwrite(i32* %4, i32 2, i32 1, i32* %47)
store i32 0, i32* %4
%57 = call i32 @fwrite(i32* %4, i32 2, i32 1, i32* %47)
store i32 22664, i32* %4
%58 = call i32 @fwrite(i32* %4, i32 2, i32 1, i32* %47)
store i32 1, i32* %4
%59 = call i32 @fwrite(i32* %4, i32 2, i32 1, i32* %47)
store i32 2, i32* %4
%60 = call i32 @fwrite(i32* %4, i32 2, i32 1, i32* %47)
store i32 16, i32* %4
%61 = call i32 @fwrite(i32* %4, i32 2, i32 1, i32* %47)
%62 = tail call i64 bitcast (i32 (i32*, i32, i32, i32*)* @fwrite to i64 (i8*, i64, i64, i32*)*)(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i64 4, i64 1, i32* %47)
%63 = load i32, i32* %3
%64 = add nsw i32 %63, -36
store i32 %64, i32* %3
%65 = call i32 @fwrite(i32* %3, i32 2, i32 1, i32* %47)
store i32 0, i32* %4
%66 = call i32 @fwrite(i32* %4, i32 2, i32 1, i32* %47)
%67 = tail call i32 @feof(i32* %44)
%68 = icmp eq i32 %67, 0
br i1 %68, label %69, label %78
69: ; preds = %40, %75
%70 = tail call i32 @fgetc(i32* %44)
%71 = tail call i32 @feof(i32* %44)
%72 = icmp eq i32 %71, 0
br i1 %72, label %73, label %75
73: ; preds = %69
%74 = tail call i32 @fputc(i32 %70, i32* %47)
br label %75
75: ; preds = %73, %69
%76 = tail call i32 @feof(i32* %44)
%77 = icmp eq i32 %76, 0
br i1 %77, label %69, label %78
78: ; preds = %75, %40
%79 = tail call i32 @fclose(i32* %44)
%80 = tail call i32 @fclose(i32* %47)
br label %81
81: ; preds = %78, %8
ret i32 0
}