#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 scalar_t__ pid_t;

/* Variables and functions */
int AT_FDCWD;
int /*<<< orphan*/ EXIT_FAILURE;
int EXIT_SUCCESS;
int O_CREAT;
int /*<<< orphan*/ O_RDONLY;
int O_RDWR;
int O_WRONLY;
int /*<<< orphan*/ _exit(int /*<<< orphan*/);
scalar_t__ chdir(char *);
int /*<<< orphan*/ close(int);
int creat(char *, int);
int /*<<< orphan*/ execlp(char *, char *, char *, char *);
scalar_t__ fchdir(int);
scalar_t__ fork();
scalar_t__ mkdir(char *, int);
scalar_t__ mkdirat(int, char *, int);
int open(char *, int, ...);
int openat(int, char *, int, int);
int /*<<< orphan*/ perror(char *);
scalar_t__ rename(char *, char *);
scalar_t__ renameat(int, char *, int, char *);
scalar_t__ waitpid(scalar_t__, int /*<<< orphan*/ *, int /*<<< orphan*/);
int main(void) {
  pid_t cpid;
  int fd = open("unixsys.c", O_RDONLY);
  if (fd >= 0)
    close(fd);
  else
    perror("open( \"unixsys.c\", O_RDONLY ) = ");
  if (mkdir("dir", 0777) < 0) {
    perror("mkdir( \"dir\", 0777 ) = ");
  } else {
    fd = open("dir/temp_out1.txt", O_WRONLY | O_CREAT, 0666);
    if (fd >= 0)
      close(fd);
    else
      perror("open( \"dir/temp_out1.txt\", O_WRONLY|O_CREAT, 0666 ) = ");
    fd = open("dir/temp_out2.txt", O_RDWR | O_CREAT, 0666);
    if (fd >= 0)
      close(fd);
    else
      perror("open( \"dir/temp_out2.txt\", O_RDWR|O_CREAT, 0666 ) = ");
    fd = openat(AT_FDCWD, "dir/temp_out3.txt", O_RDWR | O_CREAT, 0666);
    if (fd >= 0)
      close(fd);
    else
      perror(
          "openat( AT_FDCWD, \"dir/temp_out3.txt\", O_RDWR|O_CREAT, 0666 ) = ");
    if (mkdirat(AT_FDCWD, "dir/dir2", 0777) < 0)
      perror("mkdirat( AT_FDCWD, \"dir/dir2\", 0777 ) = ");
    if (renameat(AT_FDCWD, "dir/temp_out1.txt", AT_FDCWD, "dir/temp_out4.txt") <
        0)
      perror("renameat( AT_FDCWD, \"dir/temp_out1.txt\", AT_FDCWD, "
             "\"dir/temp_out4.txt\" ) = ");
    fd = open("dir", O_RDONLY);
    if (fd < 0) {
      perror("open( \"dir\", O_RDONLY ) = ");
    } else {
      int fd2;
      fd2 = openat(fd, "temp_out5.txt", O_WRONLY | O_CREAT, 0666);
      if (fd2)
        close(fd2);
      else
        perror("openat( fd, \"temp_out5.txt\", O_WRONLY|O_CREAT, 0666 ) = ");
      if (mkdirat(fd, "dir3", 0777) < 0)
        perror("mkdirat( fd, \"dir3\", 0777 ) = ");
      if (renameat(fd, "temp_out2.txt", fd, "temp_out6.txt") < 0)
        perror("renameat( fd, \"temp_out2.txt\", fd, \"temp_out6.txt\" ) = ");
      if (fchdir(fd) >= 0) {
        fd2 = open("temp_out7.txt", O_WRONLY | O_CREAT, 0666);
        if (fd2 >= 0)
          close(fd2);
        else
          perror("open( \"temp_out7.txt\", O_WRONLY|O_CREAT, 0666 ) = ");
        if (rename("temp_out7.txt", "temp_out8.txt") < 0)
          perror("rename( \"temp_out7.txt\", \"temp_out8.txt\" ) = ");
        if (chdir("..") >= 0) {
          fd2 = open("dir/temp_out9.txt", O_RDWR | O_CREAT, 0666);
          if (fd2 >= 0)
            close(fd2);
          else
            perror("open( \"dir/temp_out9.txt\", O_RDWR|O_CREAT, 0666 ) = ");
        } else
          perror("chdir( \"..\" ) = ");
      } else
        perror("fchdir( fd ) = ");
      close(fd);
    }
    fd = creat("dir/temp_out10.txt", 0666);
    if (fd >= 0)
      close(fd);
    else
      perror("creat( \"dir/temp_out10.txt\", 0666 ) = ");
  }
  if ((cpid = fork()) == 0) {
    execlp("cat", "cat", "hello.lua", (char *)NULL);
    perror("execlp( \"cat\", \"cat\", \"hello.lua\", (char*)NULL ) = ");
    _exit(EXIT_FAILURE);
  } else if (cpid < 0)
    perror("fork() = ");
  else {
    if (waitpid(cpid, NULL, 0) < 0)
      perror("waitpid( cpid, NULL, 0 ) = ");
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2dd2(%rip),%rax
mov    (%rax),%esi
lea    0xdf1(%rip),%rdi
mov    $0x0,%al
call   10b0 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     1230 <main+0x40>
mov    -0x14(%rbp),%edi
call   1070 <close@plt>
jmp    123c <main+0x4c>
lea    0xdd3(%rip),%rdi
call   10c0 <perror@plt>
lea    0xde8(%rip),%rdi
mov    $0x1ff,%esi
call   1040 <mkdir@plt>
cmp    $0x0,%rax
jge    1268 <main+0x78>
lea    0xdd1(%rip),%rdi
call   10c0 <perror@plt>
jmp    15e2 <main+0x3f2>
mov    0x2d41(%rip),%rax
mov    (%rax),%esi
mov    0x2d80(%rip),%rax
or     (%rax),%esi
lea    0xdc6(%rip),%rdi
mov    $0x1b6,%edx
mov    $0x0,%al
call   10b0 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     12a7 <main+0xb7>
mov    -0x14(%rbp),%edi
call   1070 <close@plt>
jmp    12b3 <main+0xc3>
lea    0xdab(%rip),%rdi
call   10c0 <perror@plt>
mov    0x2d26(%rip),%rax
mov    (%rax),%esi
mov    0x2d35(%rip),%rax
or     (%rax),%esi
lea    0xdc4(%rip),%rdi
mov    $0x1b6,%edx
mov    $0x0,%al
call   10b0 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     12f2 <main+0x102>
mov    -0x14(%rbp),%edi
call   1070 <close@plt>
jmp    12fe <main+0x10e>
lea    0xda9(%rip),%rdi
call   10c0 <perror@plt>
mov    0x2ca3(%rip),%rax
mov    (%rax),%edi
mov    0x2cd2(%rip),%rax
mov    (%rax),%edx
mov    0x2ce1(%rip),%rax
or     (%rax),%edx
lea    0xdb7(%rip),%rsi
mov    $0x1b6,%ecx
call   1050 <openat@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     1344 <main+0x154>
mov    -0x14(%rbp),%edi
call   1070 <close@plt>
jmp    1350 <main+0x160>
lea    0xd9e(%rip),%rdi
call   10c0 <perror@plt>
mov    0x2c51(%rip),%rax
mov    (%rax),%edi
lea    0xdca(%rip),%rsi
mov    $0x1ff,%edx
call   1080 <mkdirat@plt>
cmp    $0x0,%rax
jge    1380 <main+0x190>
lea    0xdb8(%rip),%rdi
call   10c0 <perror@plt>
mov    0x2c21(%rip),%rax
mov    (%rax),%edi
mov    0x2c18(%rip),%rax
mov    (%rax),%edx
lea    0xcae(%rip),%rsi
lea    0xdbc(%rip),%rcx
call   10e0 <renameat@plt>
cmp    $0x0,%rax
jge    13bb <main+0x1cb>
lea    0xdb8(%rip),%rdi
call   10c0 <perror@plt>
mov    0x2c16(%rip),%rax
mov    (%rax),%esi
lea    0xc60(%rip),%rdi
mov    $0x0,%al
call   10b0 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    13f0 <main+0x200>
lea    0xdd4(%rip),%rdi
call   10c0 <perror@plt>
jmp    15a6 <main+0x3b6>
mov    -0x14(%rbp),%edi
mov    0x2bb6(%rip),%rax
mov    (%rax),%edx
mov    0x2bf5(%rip),%rax
or     (%rax),%edx
lea    0xdc9(%rip),%rsi
mov    $0x1b6,%ecx
call   1050 <openat@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     1430 <main+0x240>
mov    -0x18(%rbp),%edi
call   1070 <close@plt>
jmp    143c <main+0x24c>
lea    0xdac(%rip),%rdi
call   10c0 <perror@plt>
mov    -0x14(%rbp),%edi
lea    0xdd6(%rip),%rsi
mov    $0x1ff,%edx
call   1080 <mkdirat@plt>
cmp    $0x0,%rax
jge    1466 <main+0x276>
lea    0xdc0(%rip),%rdi
call   10c0 <perror@plt>
mov    -0x14(%rbp),%edi
mov    -0x14(%rbp),%edx
lea    0xc21(%rip),%rsi
lea    0xdc6(%rip),%rcx
call   10e0 <renameat@plt>
cmp    $0x0,%rax
jge    1495 <main+0x2a5>
lea    0xdbe(%rip),%rdi
call   10c0 <perror@plt>
mov    -0x14(%rbp),%edi
call   1090 <fchdir@plt>
cmp    $0x0,%rax
jl     1592 <main+0x3a2>
mov    0x2b02(%rip),%rax
mov    (%rax),%esi
mov    0x2b41(%rip),%rax
or     (%rax),%esi
lea    0xdc6(%rip),%rdi
mov    $0x1b6,%edx
mov    $0x0,%al
call   10b0 <open@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jl     14e6 <main+0x2f6>
mov    -0x18(%rbp),%edi
call   1070 <close@plt>
jmp    14f2 <main+0x302>
lea    0xda7(%rip),%rdi
call   10c0 <perror@plt>
lea    0xd8d(%rip),%rdi
lea    0xdc7(%rip),%rsi
call   10d0 <rename@plt>
cmp    $0x0,%rax
jge    151b <main+0x32b>
lea    0xdbf(%rip),%rdi
call   10c0 <perror@plt>
lea    0xde1(%rip),%rdi
call   1060 <chdir@plt>
cmp    $0x0,%rax
jl     1581 <main+0x391>
mov    0x2aa8(%rip),%rax
mov    (%rax),%esi
mov    0x2ab7(%rip),%rax
or     (%rax),%esi
lea    0xdbc(%rip),%rdi
mov    $0x1b6,%edx
mov    $0x0,%al
call   10b0 <open@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jl     1570 <main+0x380>
mov    -0x18(%rbp),%edi
call   1070 <close@plt>
jmp    157c <main+0x38c>
lea    0xda1(%rip),%rdi
call   10c0 <perror@plt>
jmp    158d <main+0x39d>
lea    0xdc5(%rip),%rdi
call   10c0 <perror@plt>
jmp    159e <main+0x3ae>
lea    0xdc5(%rip),%rdi
call   10c0 <perror@plt>
mov    -0x14(%rbp),%edi
call   1070 <close@plt>
lea    0xdc1(%rip),%rdi
mov    $0x1b6,%esi
call   10f0 <creat@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     15d1 <main+0x3e1>
mov    -0x14(%rbp),%edi
call   1070 <close@plt>
jmp    15dd <main+0x3ed>
lea    0xda9(%rip),%rdi
call   10c0 <perror@plt>
jmp    15e2 <main+0x3f2>
mov    $0x0,%al
call   1110 <fork@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    162b <main+0x43b>
lea    0xdaa(%rip),%rsi
lea    0xda7(%rip),%rdx
xor    %eax,%eax
mov    %eax,%ecx
mov    %rsi,%rdi
call   1100 <execlp@plt>
lea    0xd9e(%rip),%rdi
call   10c0 <perror@plt>
mov    0x29a4(%rip),%rax
mov    (%rax),%edi
call   1030 <_exit@plt>
cmpq   $0x0,-0x10(%rbp)
jge    1647 <main+0x457>
lea    0xdad(%rip),%rdi
call   10c0 <perror@plt>
jmp    1671 <main+0x481>
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   10a0 <waitpid@plt>
cmp    $0x0,%rax
jge    166c <main+0x47c>
lea    0xd8d(%rip),%rdi
call   10c0 <perror@plt>
jmp    1671 <main+0x481>
jmp    1676 <main+0x486>
mov    0x2943(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    0x2dd8(%rip),%r13
mov    0x0(%r13),%esi
lea    0xdf5(%rip),%rdi
xor    %eax,%eax
call   10b0 <open@plt>
test   %eax,%eax
js     1480 <main+0x290>
mov    %eax,%edi
call   1070 <close@plt>
lea    0xe03(%rip),%rdi
mov    $0x1ff,%esi
call   1040 <mkdir@plt>
test   %rax,%rax
js     1491 <main+0x2a1>
mov    0x2d6e(%rip),%r12
mov    0x2daf(%rip),%r14
mov    (%r14),%esi
or     (%r12),%esi
lea    0xdf0(%rip),%rdi
mov    $0x1b6,%edx
xor    %eax,%eax
call   10b0 <open@plt>
test   %eax,%eax
js     14a3 <main+0x2b3>
mov    %eax,%edi
call   1070 <close@plt>
mov    0x2d67(%rip),%r15
mov    (%r14),%esi
or     (%r15),%esi
lea    0xe0a(%rip),%rdi
mov    $0x1b6,%edx
xor    %eax,%eax
call   10b0 <open@plt>
test   %eax,%eax
js     14b4 <main+0x2c4>
mov    %eax,%edi
call   1070 <close@plt>
mov    0x2d00(%rip),%rbx
mov    (%rbx),%edi
mov    (%r14),%edx
or     (%r15),%edx
lea    0xe20(%rip),%rsi
mov    $0x1b6,%ecx
call   1050 <openat@plt>
test   %eax,%eax
js     14c5 <main+0x2d5>
mov    %eax,%edi
call   1070 <close@plt>
mov    (%rbx),%edi
lea    0xe51(%rip),%rsi
mov    $0x1ff,%edx
call   1080 <mkdirat@plt>
test   %rax,%rax
js     14d6 <main+0x2e6>
mov    (%rbx),%edi
lea    0xd52(%rip),%rsi
lea    0xe60(%rip),%rcx
mov    %edi,%edx
call   10e0 <renameat@plt>
test   %rax,%rax
js     14e7 <main+0x2f7>
mov    0x0(%r13),%esi
lea    0xd14(%rip),%rdi
xor    %eax,%eax
call   10b0 <open@plt>
test   %eax,%eax
js     14f8 <main+0x308>
mov    %eax,%ebx
mov    (%r14),%edx
or     (%r12),%edx
lea    0xe9f(%rip),%rsi
mov    %eax,%edi
mov    $0x1b6,%ecx
call   1050 <openat@plt>
test   %eax,%eax
je     152b <main+0x33b>
mov    %eax,%edi
call   1070 <close@plt>
lea    0xec4(%rip),%rsi
mov    %ebx,%edi
mov    $0x1ff,%edx
call   1080 <mkdirat@plt>
test   %rax,%rax
js     153c <main+0x34c>
lea    0xd20(%rip),%rsi
lea    0xec5(%rip),%rcx
mov    %ebx,%edi
mov    %ebx,%edx
call   10e0 <renameat@plt>
test   %rax,%rax
js     154d <main+0x35d>
mov    %ebx,%edi
call   1090 <fchdir@plt>
test   %rax,%rax
js     155e <main+0x36e>
mov    (%r14),%esi
or     (%r12),%esi
lea    0xedb(%rip),%rdi
mov    $0x1b6,%edx
xor    %eax,%eax
call   10b0 <open@plt>
test   %eax,%eax
js     1567 <main+0x377>
mov    %eax,%edi
call   1070 <close@plt>
lea    0xeb9(%rip),%rdi
lea    0xef3(%rip),%rsi
call   10d0 <rename@plt>
test   %rax,%rax
js     1578 <main+0x388>
lea    0xf1a(%rip),%rdi
call   1060 <chdir@plt>
test   %rax,%rax
js     1589 <main+0x399>
mov    (%r14),%esi
or     (%r15),%esi
lea    0xf02(%rip),%rdi
mov    $0x1b6,%edx
xor    %eax,%eax
call   10b0 <open@plt>
test   %eax,%eax
js     1592 <main+0x3a2>
mov    %eax,%edi
call   1070 <close@plt>
mov    %ebx,%edi
call   1070 <close@plt>
lea    0xf41(%rip),%rdi
mov    $0x1b6,%esi
call   10f0 <creat@plt>
test   %eax,%eax
js     1509 <main+0x319>
mov    %eax,%edi
call   1070 <close@plt>
xor    %eax,%eax
call   1110 <fork@plt>
test   %rax,%rax
je     15a3 <main+0x3b3>
js     149a <main+0x2aa>
mov    %rax,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   10a0 <waitpid@plt>
test   %rax,%rax
js     151a <main+0x32a>
mov    0x2b4c(%rip),%rax
mov    (%rax),%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
lea    0xb83(%rip),%rdi
call   10c0 <perror@plt>
jmp    1221 <main+0x31>
lea    0xb97(%rip),%rdi
jmp    1510 <main+0x320>
lea    0xf49(%rip),%rdi
jmp    1521 <main+0x331>
lea    0xbaf(%rip),%rdi
call   10c0 <perror@plt>
jmp    1272 <main+0x82>
lea    0xbe7(%rip),%rdi
call   10c0 <perror@plt>
jmp    12a1 <main+0xb1>
lea    0xc1d(%rip),%rdi
call   10c0 <perror@plt>
jmp    12d0 <main+0xe0>
lea    0xc56(%rip),%rdi
call   10c0 <perror@plt>
jmp    12ec <main+0xfc>
lea    0xc80(%rip),%rdi
call   10c0 <perror@plt>
jmp    130c <main+0x11c>
lea    0xcbb(%rip),%rdi
call   10c0 <perror@plt>
jmp    1426 <main+0x236>
lea    0xe71(%rip),%rdi
call   10c0 <perror@plt>
jmp    1446 <main+0x256>
lea    0xed3(%rip),%rdi
call   10c0 <perror@plt>
jmp    146d <main+0x27d>
lea    0xcb1(%rip),%rdi
call   10c0 <perror@plt>
jmp    1351 <main+0x161>
lea    0xcde(%rip),%rdi
call   10c0 <perror@plt>
jmp    136d <main+0x17d>
lea    0xcfa(%rip),%rdi
call   10c0 <perror@plt>
jmp    138d <main+0x19d>
lea    0xdf9(%rip),%rdi
jmp    1599 <main+0x3a9>
lea    0xd26(%rip),%rdi
call   10c0 <perror@plt>
jmp    13c6 <main+0x1d6>
lea    0xd56(%rip),%rdi
call   10c0 <perror@plt>
jmp    13e2 <main+0x1f2>
lea    0xdbd(%rip),%rdi
jmp    1599 <main+0x3a9>
lea    0xd7f(%rip),%rdi
call   10c0 <perror@plt>
jmp    141f <main+0x22f>
lea    0xdfe(%rip),%rdi
lea    0xdfb(%rip),%rdx
mov    %rdi,%rsi
xor    %ecx,%ecx
call   1100 <execlp@plt>
lea    0xdf4(%rip),%rdi
call   10c0 <perror@plt>
mov    0x29fa(%rip),%rax
mov    (%rax),%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"unixsys.c\00"
@O_RDONLY = global i32 0
@.str.1 = [33 x i8] c"open( \22unixsys.c\22, O_RDONLY ) = \00"
@.str.2 = [4 x i8] c"dir\00"
@.str.3 = [24 x i8] c"mkdir( \22dir\22, 0777 ) = \00"
@.str.4 = [18 x i8] c"dir/temp_out1.txt\00"
@O_WRONLY = global i32 0
@O_CREAT = global i32 0
@.str.5 = [55 x i8] c"open( \22dir/temp_out1.txt\22, O_WRONLY|O_CREAT, 0666 ) = \00"
@.str.6 = [18 x i8] c"dir/temp_out2.txt\00"
@O_RDWR = global i32 0
@.str.7 = [53 x i8] c"open( \22dir/temp_out2.txt\22, O_RDWR|O_CREAT, 0666 ) = \00"
@AT_FDCWD = global i32 0
@.str.8 = [18 x i8] c"dir/temp_out3.txt\00"
@.str.9 = [65 x i8] c"openat( AT_FDCWD, \22dir/temp_out3.txt\22, O_RDWR|O_CREAT, 0666 ) = \00"
@.str.10 = [9 x i8] c"dir/dir2\00"
@.str.11 = [41 x i8] c"mkdirat( AT_FDCWD, \22dir/dir2\22, 0777 ) = \00"
@.str.12 = [18 x i8] c"dir/temp_out4.txt\00"
@.str.13 = [76 x i8] c"renameat( AT_FDCWD, \22dir/temp_out1.txt\22, AT_FDCWD, \22dir/temp_out4.txt\22 ) = \00"
@.str.14 = [27 x i8] c"open( \22dir\22, O_RDONLY ) = \00"
@.str.15 = [14 x i8] c"temp_out5.txt\00"
@.str.16 = [57 x i8] c"openat( fd, \22temp_out5.txt\22, O_WRONLY|O_CREAT, 0666 ) = \00"
@.str.17 = [5 x i8] c"dir3\00"
@.str.18 = [31 x i8] c"mkdirat( fd, \22dir3\22, 0777 ) = \00"
@.str.19 = [14 x i8] c"temp_out2.txt\00"
@.str.20 = [14 x i8] c"temp_out6.txt\00"
@.str.21 = [56 x i8] c"renameat( fd, \22temp_out2.txt\22, fd, \22temp_out6.txt\22 ) = \00"
@.str.22 = [14 x i8] c"temp_out7.txt\00"
@.str.23 = [51 x i8] c"open( \22temp_out7.txt\22, O_WRONLY|O_CREAT, 0666 ) = \00"
@.str.24 = [14 x i8] c"temp_out8.txt\00"
@.str.25 = [46 x i8] c"rename( \22temp_out7.txt\22, \22temp_out8.txt\22 ) = \00"
@.str.26 = [3 x i8] c"..\00"
@.str.27 = [18 x i8] c"dir/temp_out9.txt\00"
@.str.28 = [53 x i8] c"open( \22dir/temp_out9.txt\22, O_RDWR|O_CREAT, 0666 ) = \00"
@.str.29 = [17 x i8] c"chdir( \22..\22 ) = \00"
@.str.30 = [16 x i8] c"fchdir( fd ) = \00"
@.str.31 = [19 x i8] c"dir/temp_out10.txt\00"
@.str.32 = [39 x i8] c"creat( \22dir/temp_out10.txt\22, 0666 ) = \00"
@.str.33 = [4 x i8] c"cat\00"
@.str.34 = [10 x i8] c"hello.lua\00"
@.str.35 = [52 x i8] c"execlp( \22cat\22, \22cat\22, \22hello.lua\22, (char*)NULL ) = \00"
@EXIT_FAILURE = global i32 0
@.str.36 = [10 x i8] c"fork() = \00"
@.str.37 = [28 x i8] c"waitpid( cpid, NULL, 0 ) = \00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = load i32, i32* @O_RDONLY
%6 = call i32 (i8*, i32, ...) @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = icmp sge i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %0
%10 = load i32, i32* %3
%11 = call i32 @close(i32 %10)
br label %14
12: ; preds = %0
%13 = call i32 @perror(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %12, %9
%15 = call i64 @mkdir(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 511)
%16 = icmp slt i64 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
br label %157
19: ; preds = %14
%20 = load i32, i32* @O_WRONLY
%21 = load i32, i32* @O_CREAT
%22 = or i32 %20, %21
%23 = call i32 (i8*, i32, ...) @open(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %22, i32 438)
store i32 %23, i32* %3
%24 = load i32, i32* %3
%25 = icmp sge i32 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %19
%27 = load i32, i32* %3
%28 = call i32 @close(i32 %27)
br label %31
29: ; preds = %19
%30 = call i32 @perror(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.5, i64 0, i64 0))
br label %31
31: ; preds = %29, %26
%32 = load i32, i32* @O_RDWR
%33 = load i32, i32* @O_CREAT
%34 = or i32 %32, %33
%35 = call i32 (i8*, i32, ...) @open(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i32 %34, i32 438)
store i32 %35, i32* %3
%36 = load i32, i32* %3
%37 = icmp sge i32 %36, 0
br i1 %37, label %38, label %41
38: ; preds = %31
%39 = load i32, i32* %3
%40 = call i32 @close(i32 %39)
br label %43
41: ; preds = %31
%42 = call i32 @perror(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.7, i64 0, i64 0))
br label %43
43: ; preds = %41, %38
%44 = load i32, i32* @AT_FDCWD
%45 = load i32, i32* @O_RDWR
%46 = load i32, i32* @O_CREAT
%47 = or i32 %45, %46
%48 = call i32 @openat(i32 %44, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), i32 %47, i32 438)
store i32 %48, i32* %3
%49 = load i32, i32* %3
%50 = icmp sge i32 %49, 0
br i1 %50, label %51, label %54
51: ; preds = %43
%52 = load i32, i32* %3
%53 = call i32 @close(i32 %52)
br label %56
54: ; preds = %43
%55 = call i32 @perror(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.9, i64 0, i64 0))
br label %56
56: ; preds = %54, %51
%57 = load i32, i32* @AT_FDCWD
%58 = call i64 @mkdirat(i32 %57, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i32 511)
%59 = icmp slt i64 %58, 0
br i1 %59, label %60, label %62
60: ; preds = %56
%61 = call i32 @perror(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.11, i64 0, i64 0))
br label %62
62: ; preds = %60, %56
%63 = load i32, i32* @AT_FDCWD
%64 = load i32, i32* @AT_FDCWD
%65 = call i64 @renameat(i32 %63, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %64, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.12, i64 0, i64 0))
%66 = icmp slt i64 %65, 0
br i1 %66, label %67, label %69
67: ; preds = %62
%68 = call i32 @perror(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.13, i64 0, i64 0))
br label %69
69: ; preds = %67, %62
%70 = load i32, i32* @O_RDONLY
%71 = call i32 (i8*, i32, ...) @open(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %70)
store i32 %71, i32* %3
%72 = load i32, i32* %3
%73 = icmp slt i32 %72, 0
br i1 %73, label %74, label %76
74: ; preds = %69
%75 = call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.14, i64 0, i64 0))
br label %147
76: ; preds = %69
%77 = load i32, i32* %3
%78 = load i32, i32* @O_WRONLY
%79 = load i32, i32* @O_CREAT
%80 = or i32 %78, %79
%81 = call i32 @openat(i32 %77, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.15, i64 0, i64 0), i32 %80, i32 438)
store i32 %81, i32* %4
%82 = load i32, i32* %4
%83 = icmp ne i32 %82, 0
br i1 %83, label %84, label %87
84: ; preds = %76
%85 = load i32, i32* %4
%86 = call i32 @close(i32 %85)
br label %89
87: ; preds = %76
%88 = call i32 @perror(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.16, i64 0, i64 0))
br label %89
89: ; preds = %87, %84
%90 = load i32, i32* %3
%91 = call i64 @mkdirat(i32 %90, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.17, i64 0, i64 0), i32 511)
%92 = icmp slt i64 %91, 0
br i1 %92, label %93, label %95
93: ; preds = %89
%94 = call i32 @perror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.18, i64 0, i64 0))
br label %95
95: ; preds = %93, %89
%96 = load i32, i32* %3
%97 = load i32, i32* %3
%98 = call i64 @renameat(i32 %96, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.19, i64 0, i64 0), i32 %97, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.20, i64 0, i64 0))
%99 = icmp slt i64 %98, 0
br i1 %99, label %100, label %102
100: ; preds = %95
%101 = call i32 @perror(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.21, i64 0, i64 0))
br label %102
102: ; preds = %100, %95
%103 = load i32, i32* %3
%104 = call i64 @fchdir(i32 %103)
%105 = icmp sge i64 %104, 0
br i1 %105, label %106, label %142
106: ; preds = %102
%107 = load i32, i32* @O_WRONLY
%108 = load i32, i32* @O_CREAT
%109 = or i32 %107, %108
%110 = call i32 (i8*, i32, ...) @open(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.22, i64 0, i64 0), i32 %109, i32 438)
store i32 %110, i32* %4
%111 = load i32, i32* %4
%112 = icmp sge i32 %111, 0
br i1 %112, label %113, label %116
113: ; preds = %106
%114 = load i32, i32* %4
%115 = call i32 @close(i32 %114)
br label %118
116: ; preds = %106
%117 = call i32 @perror(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.23, i64 0, i64 0))
br label %118
118: ; preds = %116, %113
%119 = call i64 @rename(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.22, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.24, i64 0, i64 0))
%120 = icmp slt i64 %119, 0
br i1 %120, label %121, label %123
121: ; preds = %118
%122 = call i32 @perror(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.25, i64 0, i64 0))
br label %123
123: ; preds = %121, %118
%124 = call i64 @chdir(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.26, i64 0, i64 0))
%125 = icmp sge i64 %124, 0
br i1 %125, label %126, label %139
126: ; preds = %123
%127 = load i32, i32* @O_RDWR
%128 = load i32, i32* @O_CREAT
%129 = or i32 %127, %128
%130 = call i32 (i8*, i32, ...) @open(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.27, i64 0, i64 0), i32 %129, i32 438)
store i32 %130, i32* %4
%131 = load i32, i32* %4
%132 = icmp sge i32 %131, 0
br i1 %132, label %133, label %136
133: ; preds = %126
%134 = load i32, i32* %4
%135 = call i32 @close(i32 %134)
br label %138
136: ; preds = %126
%137 = call i32 @perror(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.28, i64 0, i64 0))
br label %138
138: ; preds = %136, %133
br label %141
139: ; preds = %123
%140 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.29, i64 0, i64 0))
br label %141
141: ; preds = %139, %138
br label %144
142: ; preds = %102
%143 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.30, i64 0, i64 0))
br label %144
144: ; preds = %142, %141
%145 = load i32, i32* %3
%146 = call i32 @close(i32 %145)
br label %147
147: ; preds = %144, %74
%148 = call i32 @creat(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.31, i64 0, i64 0), i32 438)
store i32 %148, i32* %3
%149 = load i32, i32* %3
%150 = icmp sge i32 %149, 0
br i1 %150, label %151, label %154
151: ; preds = %147
%152 = load i32, i32* %3
%153 = call i32 @close(i32 %152)
br label %156
154: ; preds = %147
%155 = call i32 @perror(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.32, i64 0, i64 0))
br label %156
156: ; preds = %154, %151
br label %157
157: ; preds = %156, %17
%158 = call i64 (...) @fork()
store i64 %158, i64* %2
%159 = icmp eq i64 %158, 0
br i1 %159, label %160, label %165
160: ; preds = %157
%161 = call i32 @execlp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.33, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.33, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.34, i64 0, i64 0), i8* null)
%162 = call i32 @perror(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.35, i64 0, i64 0))
%163 = load i32, i32* @EXIT_FAILURE
%164 = call i32 @_exit(i32 %163)
unreachable
165: ; preds = %157
%166 = load i64, i64* %2
%167 = icmp slt i64 %166, 0
br i1 %167, label %168, label %170
168: ; preds = %165
%169 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.36, i64 0, i64 0))
br label %177
170: ; preds = %165
%171 = load i64, i64* %2
%172 = call i64 @waitpid(i64 %171, i32* null, i32 0)
%173 = icmp slt i64 %172, 0
br i1 %173, label %174, label %176
174: ; preds = %170
%175 = call i32 @perror(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.37, i64 0, i64 0))
br label %176
176: ; preds = %174, %170
br label %177
177: ; preds = %176, %168
br label %178
178: ; preds = %177
%179 = load i32, i32* @EXIT_SUCCESS
ret i32 %179
}

LLVM IR (-O2):
@.str = [10 x i8] c"unixsys.c\00"
@O_RDONLY = global i32 0
@.str.1 = [33 x i8] c"open( \22unixsys.c\22, O_RDONLY ) = \00"
@.str.2 = [4 x i8] c"dir\00"
@.str.3 = [24 x i8] c"mkdir( \22dir\22, 0777 ) = \00"
@.str.4 = [18 x i8] c"dir/temp_out1.txt\00"
@O_WRONLY = global i32 0
@O_CREAT = global i32 0
@.str.5 = [55 x i8] c"open( \22dir/temp_out1.txt\22, O_WRONLY|O_CREAT, 0666 ) = \00"
@.str.6 = [18 x i8] c"dir/temp_out2.txt\00"
@O_RDWR = global i32 0
@.str.7 = [53 x i8] c"open( \22dir/temp_out2.txt\22, O_RDWR|O_CREAT, 0666 ) = \00"
@AT_FDCWD = global i32 0
@.str.8 = [18 x i8] c"dir/temp_out3.txt\00"
@.str.9 = [65 x i8] c"openat( AT_FDCWD, \22dir/temp_out3.txt\22, O_RDWR|O_CREAT, 0666 ) = \00"
@.str.10 = [9 x i8] c"dir/dir2\00"
@.str.11 = [41 x i8] c"mkdirat( AT_FDCWD, \22dir/dir2\22, 0777 ) = \00"
@.str.12 = [18 x i8] c"dir/temp_out4.txt\00"
@.str.13 = [76 x i8] c"renameat( AT_FDCWD, \22dir/temp_out1.txt\22, AT_FDCWD, \22dir/temp_out4.txt\22 ) = \00"
@.str.14 = [27 x i8] c"open( \22dir\22, O_RDONLY ) = \00"
@.str.15 = [14 x i8] c"temp_out5.txt\00"
@.str.16 = [57 x i8] c"openat( fd, \22temp_out5.txt\22, O_WRONLY|O_CREAT, 0666 ) = \00"
@.str.17 = [5 x i8] c"dir3\00"
@.str.18 = [31 x i8] c"mkdirat( fd, \22dir3\22, 0777 ) = \00"
@.str.19 = [14 x i8] c"temp_out2.txt\00"
@.str.20 = [14 x i8] c"temp_out6.txt\00"
@.str.21 = [56 x i8] c"renameat( fd, \22temp_out2.txt\22, fd, \22temp_out6.txt\22 ) = \00"
@.str.22 = [14 x i8] c"temp_out7.txt\00"
@.str.23 = [51 x i8] c"open( \22temp_out7.txt\22, O_WRONLY|O_CREAT, 0666 ) = \00"
@.str.24 = [14 x i8] c"temp_out8.txt\00"
@.str.25 = [46 x i8] c"rename( \22temp_out7.txt\22, \22temp_out8.txt\22 ) = \00"
@.str.26 = [3 x i8] c"..\00"
@.str.27 = [18 x i8] c"dir/temp_out9.txt\00"
@.str.28 = [53 x i8] c"open( \22dir/temp_out9.txt\22, O_RDWR|O_CREAT, 0666 ) = \00"
@.str.29 = [17 x i8] c"chdir( \22..\22 ) = \00"
@.str.30 = [16 x i8] c"fchdir( fd ) = \00"
@.str.31 = [19 x i8] c"dir/temp_out10.txt\00"
@.str.32 = [39 x i8] c"creat( \22dir/temp_out10.txt\22, 0666 ) = \00"
@.str.33 = [4 x i8] c"cat\00"
@.str.34 = [10 x i8] c"hello.lua\00"
@.str.35 = [52 x i8] c"execlp( \22cat\22, \22cat\22, \22hello.lua\22, (char*)NULL ) = \00"
@EXIT_FAILURE = global i32 0
@.str.36 = [10 x i8] c"fork() = \00"
@.str.37 = [28 x i8] c"waitpid( cpid, NULL, 0 ) = \00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = load i32, i32* @O_RDONLY
%2 = tail call i32 (i8*, i32, ...) @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = icmp sgt i32 %2, -1
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = tail call i32 @close(i32 %2)
br label %8
6: ; preds = %0
%7 = tail call i32 @perror(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
br label %8
8: ; preds = %6, %4
%9 = tail call i64 @mkdir(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 511)
%10 = icmp slt i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = tail call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
br label %126
13: ; preds = %8
%14 = load i32, i32* @O_WRONLY
%15 = load i32, i32* @O_CREAT
%16 = or i32 %15, %14
%17 = tail call i32 (i8*, i32, ...) @open(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %16, i32 438)
%18 = icmp sgt i32 %17, -1
br i1 %18, label %19, label %21
19: ; preds = %13
%20 = tail call i32 @close(i32 %17)
br label %23
21: ; preds = %13
%22 = tail call i32 @perror(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.5, i64 0, i64 0))
br label %23
23: ; preds = %21, %19
%24 = load i32, i32* @O_RDWR
%25 = load i32, i32* @O_CREAT
%26 = or i32 %25, %24
%27 = tail call i32 (i8*, i32, ...) @open(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i32 %26, i32 438)
%28 = icmp sgt i32 %27, -1
br i1 %28, label %29, label %31
29: ; preds = %23
%30 = tail call i32 @close(i32 %27)
br label %33
31: ; preds = %23
%32 = tail call i32 @perror(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.7, i64 0, i64 0))
br label %33
33: ; preds = %31, %29
%34 = load i32, i32* @AT_FDCWD
%35 = load i32, i32* @O_RDWR
%36 = load i32, i32* @O_CREAT
%37 = or i32 %36, %35
%38 = tail call i32 @openat(i32 %34, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), i32 %37, i32 438)
%39 = icmp sgt i32 %38, -1
br i1 %39, label %40, label %42
40: ; preds = %33
%41 = tail call i32 @close(i32 %38)
br label %44
42: ; preds = %33
%43 = tail call i32 @perror(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.9, i64 0, i64 0))
br label %44
44: ; preds = %42, %40
%45 = load i32, i32* @AT_FDCWD
%46 = tail call i64 @mkdirat(i32 %45, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i32 511)
%47 = icmp slt i64 %46, 0
br i1 %47, label %48, label %50
48: ; preds = %44
%49 = tail call i32 @perror(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.11, i64 0, i64 0))
br label %50
50: ; preds = %48, %44
%51 = load i32, i32* @AT_FDCWD
%52 = tail call i64 @renameat(i32 %51, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %51, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.12, i64 0, i64 0))
%53 = icmp slt i64 %52, 0
br i1 %53, label %54, label %56
54: ; preds = %50
%55 = tail call i32 @perror(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.13, i64 0, i64 0))
br label %56
56: ; preds = %54, %50
%57 = load i32, i32* @O_RDONLY
%58 = tail call i32 (i8*, i32, ...) @open(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %57)
%59 = icmp slt i32 %58, 0
br i1 %59, label %60, label %62
60: ; preds = %56
%61 = tail call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.14, i64 0, i64 0))
br label %119
62: ; preds = %56
%63 = load i32, i32* @O_WRONLY
%64 = load i32, i32* @O_CREAT
%65 = or i32 %64, %63
%66 = tail call i32 @openat(i32 %58, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.15, i64 0, i64 0), i32 %65, i32 438)
%67 = icmp eq i32 %66, 0
br i1 %67, label %70, label %68
68: ; preds = %62
%69 = tail call i32 @close(i32 %66)
br label %72
70: ; preds = %62
%71 = tail call i32 @perror(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.16, i64 0, i64 0))
br label %72
72: ; preds = %70, %68
%73 = tail call i64 @mkdirat(i32 %58, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.17, i64 0, i64 0), i32 511)
%74 = icmp slt i64 %73, 0
br i1 %74, label %75, label %77
75: ; preds = %72
%76 = tail call i32 @perror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.18, i64 0, i64 0))
br label %77
77: ; preds = %75, %72
%78 = tail call i64 @renameat(i32 %58, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.19, i64 0, i64 0), i32 %58, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.20, i64 0, i64 0))
%79 = icmp slt i64 %78, 0
br i1 %79, label %80, label %82
80: ; preds = %77
%81 = tail call i32 @perror(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.21, i64 0, i64 0))
br label %82
82: ; preds = %80, %77
%83 = tail call i64 @fchdir(i32 %58)
%84 = icmp sgt i64 %83, -1
br i1 %84, label %85, label %115
85: ; preds = %82
%86 = load i32, i32* @O_WRONLY
%87 = load i32, i32* @O_CREAT
%88 = or i32 %87, %86
%89 = tail call i32 (i8*, i32, ...) @open(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.22, i64 0, i64 0), i32 %88, i32 438)
%90 = icmp sgt i32 %89, -1
br i1 %90, label %91, label %93
91: ; preds = %85
%92 = tail call i32 @close(i32 %89)
br label %95
93: ; preds = %85
%94 = tail call i32 @perror(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.23, i64 0, i64 0))
br label %95
95: ; preds = %93, %91
%96 = tail call i64 @rename(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.22, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.24, i64 0, i64 0))
%97 = icmp slt i64 %96, 0
br i1 %97, label %98, label %100
98: ; preds = %95
%99 = tail call i32 @perror(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.25, i64 0, i64 0))
br label %100
100: ; preds = %98, %95
%101 = tail call i64 @chdir(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.26, i64 0, i64 0))
%102 = icmp sgt i64 %101, -1
br i1 %102, label %103, label %113
103: ; preds = %100
%104 = load i32, i32* @O_RDWR
%105 = load i32, i32* @O_CREAT
%106 = or i32 %105, %104
%107 = tail call i32 (i8*, i32, ...) @open(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.27, i64 0, i64 0), i32 %106, i32 438)
%108 = icmp sgt i32 %107, -1
br i1 %108, label %109, label %111
109: ; preds = %103
%110 = tail call i32 @close(i32 %107)
br label %117
111: ; preds = %103
%112 = tail call i32 @perror(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.28, i64 0, i64 0))
br label %117
113: ; preds = %100
%114 = tail call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.29, i64 0, i64 0))
br label %117
115: ; preds = %82
%116 = tail call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.30, i64 0, i64 0))
br label %117
117: ; preds = %113, %111, %109, %115
%118 = tail call i32 @close(i32 %58)
br label %119
119: ; preds = %117, %60
%120 = tail call i32 @creat(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.31, i64 0, i64 0), i32 438)
%121 = icmp sgt i32 %120, -1
br i1 %121, label %122, label %124
122: ; preds = %119
%123 = tail call i32 @close(i32 %120)
br label %126
124: ; preds = %119
%125 = tail call i32 @perror(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.32, i64 0, i64 0))
br label %126
126: ; preds = %122, %124, %11
%127 = tail call i64 (...) @fork()
%128 = icmp eq i64 %127, 0
br i1 %128, label %129, label %134
129: ; preds = %126
%130 = tail call i32 @execlp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.33, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.33, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.34, i64 0, i64 0), i8* null)
%131 = tail call i32 @perror(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.35, i64 0, i64 0))
%132 = load i32, i32* @EXIT_FAILURE
%133 = tail call i32 @_exit(i32 %132)
unreachable
134: ; preds = %126
%135 = icmp slt i64 %127, 0
br i1 %135, label %139, label %136
136: ; preds = %134
%137 = tail call i64 @waitpid(i64 %127, i32* null, i32 0)
%138 = icmp slt i64 %137, 0
br i1 %138, label %139, label %142
139: ; preds = %136, %134
%140 = phi i8* [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.36, i64 0, i64 0), %134 ], [ getelementptr inbounds ([28 x i8], [28 x i8]* @.str.37, i64 0, i64 0), %136 ]
%141 = tail call i32 @perror(i8* %140)
br label %142
142: ; preds = %139, %136
%143 = load i32, i32* @EXIT_SUCCESS
ret i32 %143
}