#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fileInit(char *, char *);
int /*<<< orphan*/ fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ print(char *, char *);
void playback(char *fileName, int chars) {
  FILE *file = fileInit(fileName, "r");
  char buffer[chars * sizeof(char)];
  fread(buffer, sizeof(char), chars, file);
  fclose(file);
  print("%s", buffer);
}


x86 assembly (clang, -O0):
<playback>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea6(%rip),%rsi
call   1060 <fileInit@plt>
mov    %rax,-0x18(%rbp)
movslq -0xc(%rbp),%rax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x30(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
call   1030 <fread@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x30(%rbp),%rsi
lea    0xe53(%rip),%rdi
call   1050 <print@plt>
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<playback>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%r14d
lea    0xeac(%rip),%rsi
call   1060 <fileInit@plt>
mov    %rax,%r15
movslq %r14d,%rdx
mov    %rsp,%rbx
lea    0xf(%rdx),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %r15,%rcx
call   1030 <fread@plt>
mov    %r15,%rdi
call   1040 <fclose@plt>
lea    0xe73(%rip),%rdi
mov    %rbx,%rsi
call   1050 <print@plt>
lea    -0x18(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [3 x i8] c"%s\00"
define void @playback(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i64
store i8* %0, i8** %3
store i32 %1, i32* %4
%8 = load i8*, i8** %3
%9 = call i32* @fileInit(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %9, i32** %5
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = mul i64 %11, 1
%13 = call i8* @llvm.stacksave()
store i8* %13, i8** %6
%14 = alloca i8, i64 %12
store i64 %12, i64* %7
%15 = load i32, i32* %4
%16 = load i32*, i32** %5
%17 = call i32 @fread(i8* %14, i32 1, i32 %15, i32* %16)
%18 = load i32*, i32** %5
%19 = call i32 @fclose(i32* %18)
%20 = call i32 @print(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%21 = load i8*, i8** %6
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [3 x i8] c"%s\00"
define void @playback(i8* %0, i32 %1) {
%3 = tail call i32* @fileInit(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = sext i32 %1 to i64
%5 = alloca i8, i64 %4
%6 = call i32 @fread(i8* %5, i32 1, i32 %1, i32* %3)
%7 = tail call i32 @fclose(i32* %3)
%8 = call i32 @print(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %5)
ret void
}