#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 */

/* Variables and functions */
int /*<<< orphan*/ create_file(char *, char *, int);
int /*<<< orphan*/ mkdir(char *, int);
void setup() {
  create_file("file", "abcdef", 0777);
  mkdir("dir", 0777);
  create_file("dir/file", "abcdef", 0777);
  mkdir("dir/subdir", 0777);
  mkdir("dir-readonly", 0555);
  mkdir("dir-nonempty", 0777);
  mkdir("dir/subdir3", 0777);
  mkdir("dir/subdir3/subdir3_1", 0777);
  create_file("dir-nonempty/file", "abcdef", 0777);
}


x86 assembly (clang, -O0):
<setup>:
push   %rbp
mov    %rsp,%rbp
lea    0xee0(%rip),%rdi
lea    0xece(%rip),%rsi
mov    $0x1ff,%edx
call   1040 <create_file@plt>
lea    0xed4(%rip),%rdi
mov    $0x1ff,%esi
call   1030 <mkdir@plt>
lea    0xeb3(%rip),%rdi
lea    0xea5(%rip),%rsi
mov    $0x1ff,%edx
call   1040 <create_file@plt>
lea    0xea4(%rip),%rdi
mov    $0x1ff,%esi
call   1030 <mkdir@plt>
lea    0xe9e(%rip),%rdi
mov    $0x16d,%esi
call   1030 <mkdir@plt>
lea    0xe9a(%rip),%rdi
mov    $0x1ff,%esi
call   1030 <mkdir@plt>
lea    0xe96(%rip),%rdi
mov    $0x1ff,%esi
call   1030 <mkdir@plt>
lea    0xe91(%rip),%rdi
mov    $0x1ff,%esi
call   1030 <mkdir@plt>
lea    0xe96(%rip),%rdi
lea    0xe38(%rip),%rsi
mov    $0x1ff,%edx
call   1040 <create_file@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<setup>:
push   %rbx
lea    0xee3(%rip),%rdi
lea    0xed1(%rip),%rbx
mov    %rbx,%rsi
mov    $0x1ff,%edx
call   1040 <create_file@plt>
lea    0xed4(%rip),%rdi
mov    $0x1ff,%esi
call   1030 <mkdir@plt>
lea    0xeb3(%rip),%rdi
mov    %rbx,%rsi
mov    $0x1ff,%edx
call   1040 <create_file@plt>
lea    0xea8(%rip),%rdi
mov    $0x1ff,%esi
call   1030 <mkdir@plt>
lea    0xea2(%rip),%rdi
mov    $0x16d,%esi
call   1030 <mkdir@plt>
lea    0xe9e(%rip),%rdi
mov    $0x1ff,%esi
call   1030 <mkdir@plt>
lea    0xe9a(%rip),%rdi
mov    $0x1ff,%esi
call   1030 <mkdir@plt>
lea    0xe95(%rip),%rdi
mov    $0x1ff,%esi
call   1030 <mkdir@plt>
lea    0xe9a(%rip),%rdi
mov    %rbx,%rsi
mov    $0x1ff,%edx
pop    %rbx
jmp    1040 <create_file@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"file\00"
@.str.1 = [7 x i8] c"abcdef\00"
@.str.2 = [4 x i8] c"dir\00"
@.str.3 = [9 x i8] c"dir/file\00"
@.str.4 = [11 x i8] c"dir/subdir\00"
@.str.5 = [13 x i8] c"dir-readonly\00"
@.str.6 = [13 x i8] c"dir-nonempty\00"
@.str.7 = [12 x i8] c"dir/subdir3\00"
@.str.8 = [22 x i8] c"dir/subdir3/subdir3_1\00"
@.str.9 = [18 x i8] c"dir-nonempty/file\00"
define void @setup() {
%1 = call i32 @create_file(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 511)
%2 = call i32 @mkdir(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 511)
%3 = call i32 @create_file(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 511)
%4 = call i32 @mkdir(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 511)
%5 = call i32 @mkdir(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 365)
%6 = call i32 @mkdir(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i32 511)
%7 = call i32 @mkdir(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i32 511)
%8 = call i32 @mkdir(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0), i32 511)
%9 = call i32 @create_file(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 511)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"file\00"
@.str.1 = [7 x i8] c"abcdef\00"
@.str.2 = [4 x i8] c"dir\00"
@.str.3 = [9 x i8] c"dir/file\00"
@.str.4 = [11 x i8] c"dir/subdir\00"
@.str.5 = [13 x i8] c"dir-readonly\00"
@.str.6 = [13 x i8] c"dir-nonempty\00"
@.str.7 = [12 x i8] c"dir/subdir3\00"
@.str.8 = [22 x i8] c"dir/subdir3/subdir3_1\00"
@.str.9 = [18 x i8] c"dir-nonempty/file\00"
define void @setup() {
%1 = tail call i32 @create_file(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 511)
%2 = tail call i32 @mkdir(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 511)
%3 = tail call i32 @create_file(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 511)
%4 = tail call i32 @mkdir(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 511)
%5 = tail call i32 @mkdir(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 365)
%6 = tail call i32 @mkdir(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i32 511)
%7 = tail call i32 @mkdir(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i32 511)
%8 = tail call i32 @mkdir(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0), i32 511)
%9 = tail call i32 @create_file(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 511)
ret void
}