#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 GetTotalNumber();
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ printf(char *);
void create_configuration(void) {
  FILE *fp_configuration;
  fp_configuration = fopen("configuration.txt", "w");
  printf("Create configuration...\n");
  fprintf(fp_configuration, "[Configuration From File] = 1\n");
  fprintf(fp_configuration, "[Total Number] = %d\n", GetTotalNumber());
  fprintf(fp_configuration, "[L_MIT] = 5000\n");
  fprintf(fp_configuration, "[R_MIT] = 9999\n");
  fprintf(fp_configuration, "[BITWIDTH] = 3\n");
  fclose(fp_configuration);
  printf("configuration done !\n");
}


x86 assembly (clang, -O0):
<create_configuration>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xea1(%rip),%rdi
lea    0xeac(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x8(%rbp)
lea    0xe9e(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    0xea7(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1060 <GetTotalNumber@plt>
mov    -0x10(%rbp),%rdi
mov    %eax,%edx
lea    0xea3(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xea6(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xea4(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xea2(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
lea    0xe9b(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_configuration>:
push   %rbx
lea    0xe98(%rip),%rdi
lea    0xea3(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rbx
lea    0xefa(%rip),%rdi
call   1030 <puts@plt>
lea    0xe8a(%rip),%rdi
mov    $0x1e,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1080 <fwrite@plt>
xor    %eax,%eax
call   1060 <GetTotalNumber@plt>
lea    0xe89(%rip),%rsi
mov    %rbx,%rdi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
lea    0xe8b(%rip),%rdi
mov    $0xf,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1080 <fwrite@plt>
lea    0xe82(%rip),%rdi
mov    $0xf,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1080 <fwrite@plt>
lea    0xe79(%rip),%rdi
mov    $0xf,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1080 <fwrite@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
lea    0xe80(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"configuration.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [25 x i8] c"Create configuration...\0A\00"
@.str.3 = [31 x i8] c"[Configuration From File] = 1\0A\00"
@.str.4 = [21 x i8] c"[Total Number] = %d\0A\00"
@.str.5 = [16 x i8] c"[L_MIT] = 5000\0A\00"
@.str.6 = [16 x i8] c"[R_MIT] = 9999\0A\00"
@.str.7 = [16 x i8] c"[BITWIDTH] = 3\0A\00"
@.str.8 = [22 x i8] c"configuration done !\0A\00"
define void @create_configuration() {
%1 = alloca i32*
%2 = call i32* @fopen(i8* getelementptr inbounds ([18 x i8], [18 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 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%4 = load i32*, i32** %1
%5 = call i32 (i32*, i8*, ...) @fprintf(i32* %4, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
%6 = load i32*, i32** %1
%7 = call i32 (...) @GetTotalNumber()
%8 = call i32 (i32*, i8*, ...) @fprintf(i32* %6, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 %7)
%9 = load i32*, i32** %1
%10 = call i32 (i32*, i8*, ...) @fprintf(i32* %9, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
%11 = load i32*, i32** %1
%12 = call i32 (i32*, i8*, ...) @fprintf(i32* %11, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
%13 = load i32*, i32** %1
%14 = call i32 (i32*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
%15 = load i32*, i32** %1
%16 = call i32 @fclose(i32* %15)
%17 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"configuration.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.3 = [31 x i8] c"[Configuration From File] = 1\0A\00"
@.str.4 = [21 x i8] c"[Total Number] = %d\0A\00"
@.str.5 = [16 x i8] c"[L_MIT] = 5000\0A\00"
@.str.6 = [16 x i8] c"[R_MIT] = 9999\0A\00"
@.str.7 = [16 x i8] c"[BITWIDTH] = 3\0A\00"
@str = [24 x i8] c"Create configuration...\00"
@str.9 = [21 x i8] c"configuration done !\00"
define void @create_configuration() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([18 x i8], [18 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 i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%3 = tail call i64 @fwrite(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i64 30, i64 1, i32* %1)
%4 = tail call i32 (...) @GetTotalNumber()
%5 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 %4)
%6 = tail call i64 @fwrite(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i64 15, i64 1, i32* %1)
%7 = tail call i64 @fwrite(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i64 15, i64 1, i32* %1)
%8 = tail call i64 @fwrite(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i64 15, i64 1, i32* %1)
%9 = tail call i32 @fclose(i32* %1)
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.9, i64 0, i64 0))
ret void
}