#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*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void make_config() {
  FILE *fp;
  fp = fopen(".config", "w");
  fprintf(fp, "# Cache Simulator Config File\n\n");
  fprintf(fp, "L1_BLOCKSIZE 64\n");
  fprintf(fp, "L1_ASSOCIATE 1\n");
  fprintf(fp, "L1_INDEX 1024\n");
  fprintf(fp, "# L2_BLOCKSIZE 64\n");
  fprintf(fp, "# L2_ASSOCIATE 1\n");
  fprintf(fp, "# L2_INDEX 1024\n");
  fprintf(fp, "# STREAM_BUFFER 1\n");
  fprintf(fp, "# VICTIM_BUFFER 4\n");
  fclose(fp);
}


x86 assembly (clang, -O0):
<make_config>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    0xec2(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb0(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xec0(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xec1(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xec1(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xec0(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xec3(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xec5(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xec6(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_config>:
push   %rbx
lea    0xec8(%rip),%rdi
lea    0xec9(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%rbx
lea    0xebc(%rip),%rdi
mov    $0x1f,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1050 <fwrite@plt>
lea    0xec3(%rip),%rdi
mov    $0x10,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fwrite@plt>
lea    0xebb(%rip),%rdi
mov    $0xf,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fwrite@plt>
lea    0xeb2(%rip),%rdi
mov    $0xe,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fwrite@plt>
lea    0xea8(%rip),%rdi
mov    $0x12,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fwrite@plt>
lea    0xea2(%rip),%rdi
mov    $0x11,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fwrite@plt>
lea    0xe9b(%rip),%rdi
mov    $0x10,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fwrite@plt>
lea    0xe93(%rip),%rdi
mov    $0x12,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fwrite@plt>
lea    0xe8d(%rip),%rdi
mov    $0x12,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fwrite@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [8 x i8] c".config\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [32 x i8] c"# Cache Simulator Config File\0A\0A\00"
@.str.3 = [17 x i8] c"L1_BLOCKSIZE 64\0A\00"
@.str.4 = [16 x i8] c"L1_ASSOCIATE 1\0A\00"
@.str.5 = [15 x i8] c"L1_INDEX 1024\0A\00"
@.str.6 = [19 x i8] c"# L2_BLOCKSIZE 64\0A\00"
@.str.7 = [18 x i8] c"# L2_ASSOCIATE 1\0A\00"
@.str.8 = [17 x i8] c"# L2_INDEX 1024\0A\00"
@.str.9 = [19 x i8] c"# STREAM_BUFFER 1\0A\00"
@.str.10 = [19 x i8] c"# VICTIM_BUFFER 4\0A\00"
define void @make_config() {
%1 = alloca i32*
%2 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %2, i32** %1
%3 = load i32*, i32** %1
%4 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
%5 = load i32*, i32** %1
%6 = call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%7 = load i32*, i32** %1
%8 = call i32 @fprintf(i32* %7, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
%9 = load i32*, i32** %1
%10 = call i32 @fprintf(i32* %9, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
%11 = load i32*, i32** %1
%12 = call i32 @fprintf(i32* %11, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
%13 = load i32*, i32** %1
%14 = call i32 @fprintf(i32* %13, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0))
%15 = load i32*, i32** %1
%16 = call i32 @fprintf(i32* %15, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0))
%17 = load i32*, i32** %1
%18 = call i32 @fprintf(i32* %17, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0))
%19 = load i32*, i32** %1
%20 = call i32 @fprintf(i32* %19, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0))
%21 = load i32*, i32** %1
%22 = call i32 @fclose(i32* %21)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c".config\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [32 x i8] c"# Cache Simulator Config File\0A\0A\00"
@.str.3 = [17 x i8] c"L1_BLOCKSIZE 64\0A\00"
@.str.4 = [16 x i8] c"L1_ASSOCIATE 1\0A\00"
@.str.5 = [15 x i8] c"L1_INDEX 1024\0A\00"
@.str.6 = [19 x i8] c"# L2_BLOCKSIZE 64\0A\00"
@.str.7 = [18 x i8] c"# L2_ASSOCIATE 1\0A\00"
@.str.8 = [17 x i8] c"# L2_INDEX 1024\0A\00"
@.str.9 = [19 x i8] c"# STREAM_BUFFER 1\0A\00"
@.str.10 = [19 x i8] c"# VICTIM_BUFFER 4\0A\00"
define void @make_config() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i64 31, i64 1, i32* %1)
%3 = tail call i64 @fwrite(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i64 16, i64 1, i32* %1)
%4 = tail call i64 @fwrite(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i64 15, i64 1, i32* %1)
%5 = tail call i64 @fwrite(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i64 14, i64 1, i32* %1)
%6 = tail call i64 @fwrite(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i64 18, i64 1, i32* %1)
%7 = tail call i64 @fwrite(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i64 17, i64 1, i32* %1)
%8 = tail call i64 @fwrite(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i64 16, i64 1, i32* %1)
%9 = tail call i64 @fwrite(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0), i64 18, i64 1, i32* %1)
%10 = tail call i64 @fwrite(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0), i64 18, i64 1, i32* %1)
%11 = tail call i32 @fclose(i32* %1)
ret void
}