#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 EXIT_SUCCESS;
int /*<<< orphan*/ chdir(char *);
int /*<<< orphan*/ creat(char *, int);
int /*<<< orphan*/ mkdir(char *, int);
int main(int argc, char *argv[]) {
  mkdir("demodlr", 0744);
  creat("y", 0744);
  chdir("demodlr");
  mkdir("a", 0744);
  mkdir("c", 0744);
  chdir("a");
  creat("x", 0744);
  chdir("../c");
  mkdir("d1", 0744);
  mkdir("d2", 0744);
  chdir("d1");
  creat("xlink", 0744);
  chdir("../d2");
  creat("xcopy", 0744);
  chdir("..");
  chdir("..");
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb3(%rip),%rdi
mov    $0x1e4,%esi
call   1030 <mkdir@plt>
lea    0xec6(%rip),%rdi
mov    $0x1e4,%esi
call   1050 <creat@plt>
lea    0xe91(%rip),%rdi
call   1040 <chdir@plt>
lea    0xe8d(%rip),%rdi
mov    $0x1e4,%esi
call   1030 <mkdir@plt>
lea    0xe83(%rip),%rdi
mov    $0x1e4,%esi
call   1030 <mkdir@plt>
lea    0xe6b(%rip),%rdi
call   1040 <chdir@plt>
lea    0xe61(%rip),%rdi
mov    $0x1e4,%esi
call   1050 <creat@plt>
lea    0xe52(%rip),%rdi
call   1040 <chdir@plt>
lea    0xe4b(%rip),%rdi
mov    $0x1e4,%esi
call   1030 <mkdir@plt>
lea    0xe46(%rip),%rdi
mov    $0x1e4,%esi
call   1030 <mkdir@plt>
lea    0xe29(%rip),%rdi
call   1040 <chdir@plt>
lea    0xe20(%rip),%rdi
mov    $0x1e4,%esi
call   1050 <creat@plt>
lea    0xe15(%rip),%rdi
call   1040 <chdir@plt>
lea    0xe0f(%rip),%rdi
mov    $0x1e4,%esi
call   1050 <creat@plt>
lea    0xe04(%rip),%rdi
call   1040 <chdir@plt>
lea    0xdf8(%rip),%rdi
call   1040 <chdir@plt>
mov    0x2da6(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1e4,%esi
call   1030 <mkdir@plt>
lea    0xed8(%rip),%rdi
mov    $0x1e4,%esi
call   1050 <creat@plt>
mov    %rbx,%rdi
call   1040 <chdir@plt>
lea    0xea3(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1e4,%esi
call   1030 <mkdir@plt>
lea    0xe96(%rip),%rdi
mov    $0x1e4,%esi
call   1030 <mkdir@plt>
mov    %rbx,%rdi
call   1040 <chdir@plt>
lea    0xe78(%rip),%rdi
mov    $0x1e4,%esi
call   1050 <creat@plt>
lea    0xe69(%rip),%rdi
call   1040 <chdir@plt>
lea    0xe62(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1e4,%esi
call   1030 <mkdir@plt>
lea    0xe5a(%rip),%rdi
mov    $0x1e4,%esi
call   1030 <mkdir@plt>
mov    %rbx,%rdi
call   1040 <chdir@plt>
lea    0xe38(%rip),%rdi
mov    $0x1e4,%esi
call   1050 <creat@plt>
lea    0xe2d(%rip),%rdi
call   1040 <chdir@plt>
lea    0xe27(%rip),%rdi
mov    $0x1e4,%esi
call   1050 <creat@plt>
lea    0xe1c(%rip),%rbx
mov    %rbx,%rdi
call   1040 <chdir@plt>
mov    %rbx,%rdi
call   1040 <chdir@plt>
mov    0x2dbf(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"demodlr\00"
@.str.1 = [2 x i8] c"y\00"
@.str.2 = [2 x i8] c"a\00"
@.str.3 = [2 x i8] c"c\00"
@.str.4 = [2 x i8] c"x\00"
@.str.5 = [5 x i8] c"../c\00"
@.str.6 = [3 x i8] c"d1\00"
@.str.7 = [3 x i8] c"d2\00"
@.str.8 = [6 x i8] c"xlink\00"
@.str.9 = [6 x i8] c"../d2\00"
@.str.10 = [6 x i8] c"xcopy\00"
@.str.11 = [3 x i8] c"..\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @mkdir(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 484)
%7 = call i32 @creat(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 484)
%8 = call i32 @chdir(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @mkdir(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 484)
%10 = call i32 @mkdir(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 484)
%11 = call i32 @chdir(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @creat(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32 484)
%13 = call i32 @chdir(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%14 = call i32 @mkdir(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 484)
%15 = call i32 @mkdir(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32 484)
%16 = call i32 @chdir(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%17 = call i32 @creat(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i32 484)
%18 = call i32 @chdir(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
%19 = call i32 @creat(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i32 484)
%20 = call i32 @chdir(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
%21 = call i32 @chdir(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
%22 = load i32, i32* @EXIT_SUCCESS
ret i32 %22
}

LLVM IR (-O2):
@.str = [8 x i8] c"demodlr\00"
@.str.1 = [2 x i8] c"y\00"
@.str.2 = [2 x i8] c"a\00"
@.str.3 = [2 x i8] c"c\00"
@.str.4 = [2 x i8] c"x\00"
@.str.5 = [5 x i8] c"../c\00"
@.str.6 = [3 x i8] c"d1\00"
@.str.7 = [3 x i8] c"d2\00"
@.str.8 = [6 x i8] c"xlink\00"
@.str.9 = [6 x i8] c"../d2\00"
@.str.10 = [6 x i8] c"xcopy\00"
@.str.11 = [3 x i8] c"..\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @mkdir(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 484)
%4 = tail call i32 @creat(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 484)
%5 = tail call i32 @chdir(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @mkdir(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 484)
%7 = tail call i32 @mkdir(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 484)
%8 = tail call i32 @chdir(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%9 = tail call i32 @creat(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32 484)
%10 = tail call i32 @chdir(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%11 = tail call i32 @mkdir(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 484)
%12 = tail call i32 @mkdir(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32 484)
%13 = tail call i32 @chdir(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%14 = tail call i32 @creat(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i32 484)
%15 = tail call i32 @chdir(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
%16 = tail call i32 @creat(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i32 484)
%17 = tail call i32 @chdir(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
%18 = tail call i32 @chdir(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
%19 = load i32, i32* @EXIT_SUCCESS
ret i32 %19
}