#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*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ *stderr;
void create_default_config_file() {
  FILE *fp = fopen("_config.json", "w");
  if (fp == NULL) {
    fprintf(stderr, "ERROR: Could not open config file for writing\n");
    exit(EXIT_FAILURE);
  }
  fprintf(fp, "{\n");
  fprintf(fp, "\t\"title\": \"SITE_TITLE\",\n");
  fprintf(fp, "\t\"url\": \"SITE_URL\",\n");
  fprintf(fp, "\t\"author\": \"YOUR_NAME\"\n");
  fprintf(fp, "}");
  fclose(fp);
}


x86 assembly (clang, -O0):
<create_default_config_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
lea    0xeb7(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    118e <create_default_config_file+0x4e>
mov    0x2e6f(%rip),%rax
mov    (%rax),%rdi
lea    0xe94(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e51(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    -0x8(%rbp),%rdi
lea    0xea5(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe98(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xea1(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xea6(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xeae(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_default_config_file>:
push   %rbx
lea    0xea8(%rip),%rdi
lea    0xeae(%rip),%rsi
call   1050 <fopen@plt>
test   %rax,%rax
je     11e6 <create_default_config_file+0x96>
mov    %rax,%rbx
lea    0xecb(%rip),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1070 <fwrite@plt>
lea    0xeb5(%rip),%rdi
mov    $0x18,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1070 <fwrite@plt>
lea    0xeb5(%rip),%rdi
mov    $0x14,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1070 <fwrite@plt>
lea    0xeb1(%rip),%rdi
mov    $0x17,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1070 <fwrite@plt>
mov    $0x7d,%edi
mov    %rbx,%rsi
call   1040 <fputc@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <fclose@plt>
mov    0x2df3(%rip),%rax
mov    (%rax),%rcx
lea    0xe18(%rip),%rdi
mov    $0x2e,%esi
mov    $0x1,%edx
call   1070 <fwrite@plt>
mov    0x2dcb(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"_config.json\00"
@.str.1 = [2 x i8] c"w\00"
@stderr = global i32* null
@.str.2 = [47 x i8] c"ERROR: Could not open config file for writing\0A\00"
@EXIT_FAILURE = global i32 0
@.str.3 = [3 x i8] c"{\0A\00"
@.str.4 = [25 x i8] c"\09\22title\22: \22SITE_TITLE\22,\0A\00"
@.str.5 = [21 x i8] c"\09\22url\22: \22SITE_URL\22,\0A\00"
@.str.6 = [24 x i8] c"\09\22author\22: \22YOUR_NAME\22\0A\00"
@.str.7 = [2 x i8] c"}\00"
define void @create_default_config_file() {
%1 = alloca i32*
%2 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 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 = icmp eq i32* %3, null
br i1 %4, label %5, label %10
5: ; preds = %0
%6 = load i32*, i32** @stderr
%7 = call i32 @fprintf(i32* %6, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0))
%8 = load i32, i32* @EXIT_FAILURE
%9 = call i32 @exit(i32 %8)
unreachable
10: ; preds = %0
%11 = load i32*, i32** %1
%12 = call i32 @fprintf(i32* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%13 = load i32*, i32** %1
%14 = call i32 @fprintf(i32* %13, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0))
%15 = load i32*, i32** %1
%16 = call i32 @fprintf(i32* %15, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
%17 = load i32*, i32** %1
%18 = call i32 @fprintf(i32* %17, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
%19 = load i32*, i32** %1
%20 = call i32 @fprintf(i32* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%21 = load i32*, i32** %1
%22 = call i32 @fclose(i32* %21)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"_config.json\00"
@.str.1 = [2 x i8] c"w\00"
@stderr = global i32* null
@.str.2 = [47 x i8] c"ERROR: Could not open config file for writing\0A\00"
@EXIT_FAILURE = global i32 0
@.str.3 = [3 x i8] c"{\0A\00"
@.str.4 = [25 x i8] c"\09\22title\22: \22SITE_TITLE\22,\0A\00"
@.str.5 = [21 x i8] c"\09\22url\22: \22SITE_URL\22,\0A\00"
@.str.6 = [24 x i8] c"\09\22author\22: \22YOUR_NAME\22\0A\00"
define void @create_default_config_file() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i32* %1, null
br i1 %2, label %3, label %8
3: ; preds = %0
%4 = load i32*, i32** @stderr
%5 = tail call i64 @fwrite(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0), i64 46, i64 1, i32* %4)
%6 = load i32, i32* @EXIT_FAILURE
%7 = tail call i32 @exit(i32 %6)
unreachable
8: ; preds = %0
%9 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i64 2, i64 1, i32* %1)
%10 = tail call i64 @fwrite(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i64 24, i64 1, i32* %1)
%11 = tail call i64 @fwrite(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i64 20, i64 1, i32* %1)
%12 = tail call i64 @fwrite(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), i64 23, i64 1, i32* %1)
%13 = tail call i32 @fputc(i32 125, i32* %1)
%14 = tail call i32 @fclose(i32* %1)
ret void
}