#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*/ assert(int /*<<< orphan*/ *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int, int, int);
int /*<<< orphan*/ printf(char *, int, int, int);
void printSummary(int hits, int misses, int evictions) {
  printf("hits:%d misses:%d evictions:%d\n", hits, misses, evictions);
  FILE *output_fp = fopen(".csim_results", "w");
  assert(output_fp);
  fprintf(output_fp, "%d %d %d\n", hits, misses, evictions);
  fclose(output_fp);
}


x86 assembly (clang, -O0):
<printSummary>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xe8f(%rip),%rdi
call   1040 <printf@plt>
lea    0xea3(%rip),%rdi
lea    0xeaa(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <assert@plt>
mov    -0x18(%rbp),%rdi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
mov    -0xc(%rbp),%r8d
lea    0xe85(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printSummary>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %esi,%r15d
mov    %edi,%ebx
lea    0xe9a(%rip),%rdi
mov    %ebx,%esi
mov    %r15d,%edx
mov    %r14d,%ecx
call   1040 <printf@plt>
lea    0xea6(%rip),%rdi
lea    0xead(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rbp
mov    %rax,%rdi
call   1050 <assert@plt>
lea    0xe98(%rip),%rsi
mov    %rbp,%rdi
mov    %ebx,%edx
mov    %r15d,%ecx
mov    %r14d,%r8d
call   1060 <fprintf@plt>
mov    %rbp,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"hits:%d misses:%d evictions:%d\0A\00"
@.str.1 = [14 x i8] c".csim_results\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [10 x i8] c"%d %d %d\0A\00"
define void @printSummary(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %4
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %9, i32 %10)
%12 = call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %12, i32** %7
%13 = load i32*, i32** %7
%14 = call i32 @assert(i32* %13)
%15 = load i32*, i32** %7
%16 = load i32, i32* %4
%17 = load i32, i32* %5
%18 = load i32, i32* %6
%19 = call i32 @fprintf(i32* %15, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %16, i32 %17, i32 %18)
%20 = load i32*, i32** %7
%21 = call i32 @fclose(i32* %20)
ret void
}

LLVM IR (-O2):
@.str = [32 x i8] c"hits:%d misses:%d evictions:%d\0A\00"
@.str.1 = [14 x i8] c".csim_results\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [10 x i8] c"%d %d %d\0A\00"
define void @printSummary(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1, i32 %2)
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call i32 @assert(i32* %5)
%7 = tail call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %0, i32 %1, i32 %2)
%8 = tail call i32 @fclose(i32* %5)
ret void
}