#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 asprintf(char **, char *, char *, char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ *stderr;
void create_default_layout() {
  char *file_name;
  if (asprintf(&file_name, "%s/%s", "_layouts", "default.html") == -1) {
    fprintf(stderr, "ERROR: Could not create default layout file name\n");
    exit(EXIT_FAILURE);
  }
  FILE *fp = fopen(file_name, "w");
  if (fp == NULL) {
    fprintf(stderr, "ERROR: Could not create default layout\n");
    exit(EXIT_FAILURE);
  }
  fprintf(fp, "<!DOCTYPE html>\n");
  fprintf(fp, "<html>\n");
  fprintf(fp, "%s<head>\n", "    ");
  fprintf(fp, "%s%s<meta charset=\"utf-8\">\n", "    ", "    ");
  fprintf(fp, "%s%s<title>SITE_TITLE</title>\n", "    ", "    ");
  fprintf(fp, "%s</head>\n", "    ");
  fprintf(fp, "%s<body>\n", "    ");
  fprintf(fp, "%s%s<nav><a href=\"/\">Home</a></nav>\n", "    ", "    ");
  fprintf(fp, "%s%s{{>content}}\n", "    ", "    ");
  fprintf(fp, "%s</body>\n", "    ");
  fprintf(fp, "</html>\n");
  fclose(fp);
  free(file_name);
}


x86 assembly (clang, -O0):
<create_default_layout>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
lea    0xe8d(%rip),%rsi
lea    0xe8c(%rip),%rdx
lea    0xe8e(%rip),%rcx
call   1060 <asprintf@plt>
cmp    $0xffffffff,%eax
jne    11b5 <create_default_layout+0x55>
mov    0x2e4a(%rip),%rax
mov    (%rax),%rdi
lea    0xe7c(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2e2a(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
mov    -0x8(%rbp),%rdi
lea    0xe8e(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11fa <create_default_layout+0x9a>
mov    0x2e05(%rip),%rax
mov    (%rax),%rdi
lea    0xe6b(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2de5(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rdi
lea    0xe73(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x10(%rbp),%rdi
lea    0xe72(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x10(%rbp),%rdi
lea    0xe68(%rip),%rsi
lea    0xe6b(%rip),%rdx
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x10(%rbp),%rdi
lea    0xe5e(%rip),%rsi
lea    0xe52(%rip),%rcx
mov    %rcx,%rdx
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x10(%rbp),%rdi
lea    0xe5e(%rip),%rsi
lea    0xe36(%rip),%rcx
mov    %rcx,%rdx
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x10(%rbp),%rdi
lea    0xe61(%rip),%rsi
lea    0xe1a(%rip),%rdx
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x10(%rbp),%rdi
lea    0xe53(%rip),%rsi
lea    0xe01(%rip),%rdx
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x10(%rbp),%rdi
lea    0xe44(%rip),%rsi
lea    0xde8(%rip),%rcx
mov    %rcx,%rdx
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x10(%rbp),%rdi
lea    0xe4d(%rip),%rsi
lea    0xdcc(%rip),%rcx
mov    %rcx,%rdx
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x10(%rbp),%rdi
lea    0xe43(%rip),%rsi
lea    0xdb0(%rip),%rdx
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x10(%rbp),%rdi
lea    0xe35(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_default_layout>:
push   %r14
push   %rbx
push   %rax
lea    0xe85(%rip),%rsi
lea    0xe84(%rip),%rdx
lea    0xe86(%rip),%rcx
mov    %rsp,%rdi
call   1060 <asprintf@plt>
cmp    $0xffffffff,%eax
je     12cd <create_default_layout+0x15d>
mov    (%rsp),%rdi
lea    0xea9(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     12e5 <create_default_layout+0x175>
mov    %rax,%rbx
lea    0xebb(%rip),%rdi
mov    $0x10,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1090 <fwrite@plt>
lea    0xeb3(%rip),%rdi
mov    $0x7,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1090 <fwrite@plt>
lea    0xea2(%rip),%rsi
lea    0xea5(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rdx
xor    %eax,%eax
call   1050 <fprintf@plt>
lea    0xe96(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
mov    %r14,%rcx
xor    %eax,%eax
call   1050 <fprintf@plt>
lea    0xe9b(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
mov    %r14,%rcx
xor    %eax,%eax
call   1050 <fprintf@plt>
lea    0xea3(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
xor    %eax,%eax
call   1050 <fprintf@plt>
lea    0xe9a(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
xor    %eax,%eax
call   1050 <fprintf@plt>
lea    0xe90(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
mov    %r14,%rcx
xor    %eax,%eax
call   1050 <fprintf@plt>
lea    0xe9e(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
mov    %r14,%rcx
xor    %eax,%eax
call   1050 <fprintf@plt>
lea    0xe99(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
xor    %eax,%eax
call   1050 <fprintf@plt>
lea    0xe90(%rip),%rdi
mov    $0x8,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1090 <fwrite@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    (%rsp),%rdi
call   1030 <free@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2d0c(%rip),%rax
mov    (%rax),%rcx
lea    0xd3e(%rip),%rdi
mov    $0x31,%esi
jmp    12fb <create_default_layout+0x18b>
mov    0x2cf4(%rip),%rax
mov    (%rax),%rcx
lea    0xd5a(%rip),%rdi
mov    $0x27,%esi
mov    $0x1,%edx
call   1090 <fwrite@plt>
mov    0x2ccc(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"%s/%s\00"
@.str.1 = [9 x i8] c"_layouts\00"
@.str.2 = [13 x i8] c"default.html\00"
@stderr = global i32* null
@.str.3 = [50 x i8] c"ERROR: Could not create default layout file name\0A\00"
@EXIT_FAILURE = global i32 0
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [40 x i8] c"ERROR: Could not create default layout\0A\00"
@.str.6 = [17 x i8] c"<!DOCTYPE html>\0A\00"
@.str.7 = [8 x i8] c"<html>\0A\00"
@.str.8 = [10 x i8] c"%s<head>\0A\00"
@.str.9 = [5 x i8] c" \00"
@.str.10 = [28 x i8] c"%s%s<meta charset=\22utf-8\22>\0A\00"
@.str.11 = [31 x i8] c"%s%s<title>SITE_TITLE</title>\0A\00"
@.str.12 = [11 x i8] c"%s</head>\0A\00"
@.str.13 = [10 x i8] c"%s<body>\0A\00"
@.str.14 = [37 x i8] c"%s%s<nav><a href=\22/\22>Home</a></nav>\0A\00"
@.str.15 = [18 x i8] c"%s%s{{>content}}\0A\00"
@.str.16 = [11 x i8] c"%s</body>\0A\00"
@.str.17 = [9 x i8] c"</html>\0A\00"
define void @create_default_layout() {
%1 = alloca i8*
%2 = alloca i32*
%3 = call i32 @asprintf(i8** %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %10
5: ; preds = %0
%6 = load i32*, i32** @stderr
%7 = call i32 (i32*, i8*, ...) @fprintf(i32* %6, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0))
%8 = load i32, i32* @EXIT_FAILURE
%9 = call i32 @exit(i32 %8)
unreachable
10: ; preds = %0
%11 = load i8*, i8** %1
%12 = call i32* @fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %12, i32** %2
%13 = load i32*, i32** %2
%14 = icmp eq i32* %13, null
br i1 %14, label %15, label %20
15: ; preds = %10
%16 = load i32*, i32** @stderr
%17 = call i32 (i32*, i8*, ...) @fprintf(i32* %16, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0))
%18 = load i32, i32* @EXIT_FAILURE
%19 = call i32 @exit(i32 %18)
unreachable
20: ; preds = %10
%21 = load i32*, i32** %2
%22 = call i32 (i32*, i8*, ...) @fprintf(i32* %21, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0))
%23 = load i32*, i32** %2
%24 = call i32 (i32*, i8*, ...) @fprintf(i32* %23, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
%25 = load i32*, i32** %2
%26 = call i32 (i32*, i8*, ...) @fprintf(i32* %25, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%27 = load i32*, i32** %2
%28 = call i32 (i32*, i8*, ...) @fprintf(i32* %27, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%29 = load i32*, i32** %2
%30 = call i32 (i32*, i8*, ...) @fprintf(i32* %29, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%31 = load i32*, i32** %2
%32 = call i32 (i32*, i8*, ...) @fprintf(i32* %31, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%33 = load i32*, i32** %2
%34 = call i32 (i32*, i8*, ...) @fprintf(i32* %33, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%35 = load i32*, i32** %2
%36 = call i32 (i32*, i8*, ...) @fprintf(i32* %35, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%37 = load i32*, i32** %2
%38 = call i32 (i32*, i8*, ...) @fprintf(i32* %37, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%39 = load i32*, i32** %2
%40 = call i32 (i32*, i8*, ...) @fprintf(i32* %39, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%41 = load i32*, i32** %2
%42 = call i32 (i32*, i8*, ...) @fprintf(i32* %41, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.17, i64 0, i64 0))
%43 = load i32*, i32** %2
%44 = call i32 @fclose(i32* %43)
%45 = load i8*, i8** %1
%46 = call i32 @free(i8* %45)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s/%s\00"
@.str.1 = [9 x i8] c"_layouts\00"
@.str.2 = [13 x i8] c"default.html\00"
@stderr = global i32* null
@.str.3 = [50 x i8] c"ERROR: Could not create default layout file name\0A\00"
@EXIT_FAILURE = global i32 0
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [40 x i8] c"ERROR: Could not create default layout\0A\00"
@.str.6 = [17 x i8] c"<!DOCTYPE html>\0A\00"
@.str.7 = [8 x i8] c"<html>\0A\00"
@.str.8 = [10 x i8] c"%s<head>\0A\00"
@.str.9 = [5 x i8] c" \00"
@.str.10 = [28 x i8] c"%s%s<meta charset=\22utf-8\22>\0A\00"
@.str.11 = [31 x i8] c"%s%s<title>SITE_TITLE</title>\0A\00"
@.str.12 = [11 x i8] c"%s</head>\0A\00"
@.str.13 = [10 x i8] c"%s<body>\0A\00"
@.str.14 = [37 x i8] c"%s%s<nav><a href=\22/\22>Home</a></nav>\0A\00"
@.str.15 = [18 x i8] c"%s%s{{>content}}\0A\00"
@.str.16 = [11 x i8] c"%s</body>\0A\00"
@.str.17 = [9 x i8] c"</html>\0A\00"
define void @create_default_layout() {
%1 = alloca i8*
%2 = bitcast i8** %1 to i8*
%3 = call i32 @asprintf(i8** %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %10
5: ; preds = %0
%6 = load i32*, i32** @stderr
%7 = call i64 @fwrite(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0), i64 49, i64 1, i32* %6)
%8 = load i32, i32* @EXIT_FAILURE
%9 = call i32 @exit(i32 %8)
unreachable
10: ; preds = %0
%11 = load i8*, i8** %1
%12 = call i32* @fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %19
14: ; preds = %10
%15 = load i32*, i32** @stderr
%16 = call i64 @fwrite(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0), i64 39, i64 1, i32* %15)
%17 = load i32, i32* @EXIT_FAILURE
%18 = call i32 @exit(i32 %17)
unreachable
19: ; preds = %10
%20 = call i64 @fwrite(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0), i64 16, i64 1, i32* %12)
%21 = call i64 @fwrite(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i64 7, i64 1, i32* %12)
%22 = call i32 (i32*, i8*, ...) @fprintf(i32* %12, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%23 = call i32 (i32*, i8*, ...) @fprintf(i32* %12, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%24 = call i32 (i32*, i8*, ...) @fprintf(i32* %12, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%25 = call i32 (i32*, i8*, ...) @fprintf(i32* %12, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%26 = call i32 (i32*, i8*, ...) @fprintf(i32* %12, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%27 = call i32 (i32*, i8*, ...) @fprintf(i32* %12, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%28 = call i32 (i32*, i8*, ...) @fprintf(i32* %12, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%29 = call i32 (i32*, i8*, ...) @fprintf(i32* %12, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%30 = call i64 @fwrite(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.17, i64 0, i64 0), i64 8, i64 1, i32* %12)
%31 = call i32 @fclose(i32* %12)
%32 = load i8*, i8** %1
%33 = call i32 @free(i8* %32)
ret void
}