#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*/ initValue;
typedef int /*<<< orphan*/ filename;

/* Variables and functions */
int /*<<< orphan*/ abort();
scalar_t__ fork();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
char *getenv(char *);
int /*<<< orphan*/ *mkdtemp(char *);
int mkstemp(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ reader(int);
int rmdir(char *);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int unlink(char *);
int write(int, int *, int);
int /*<<< orphan*/ writer(int);
int main() {
  int fd;
  int rc;
  char filename[100];
  char dir1[100];
  char dir2[100];
  char *dir = getenv("DMTCP_TMPDIR");
  if (!dir) {
    dir = getenv("TMPDIR");
  }
  if (!dir) {
    dir = "/tmp";
  }
  if (sizeof(filename) < strlen(dir) + 3 * sizeof("/dmtcp_file_XXXXXX")) {
    printf("Directory string too large.\n");
    return 1;
  }
  strcpy(filename, dir);
  strcat(filename, "/dmtcp_dir1_XXXXXX");
  strcpy(dir1, filename);
  strcat(filename, "/dmtcp_dir2_XXXXXX");
  strcpy(dir2, filename);
  strcat(filename, "/dmtcp_file_XXXXXX");
  if (mkdtemp(dir1) == NULL) {
    abort();
  }
  strncpy(dir2, dir1, strlen(dir1));
  if (mkdtemp(dir2) == NULL) {
    abort();
  }
  strncpy(filename, dir2, strlen(dir2));
  fd = mkstemp(filename);
  if (fd == -1) {
    abort();
  }
  fprintf(stdout, "Opened %s\n", filename);
  fprintf(stdout, "Deleting %s\n", filename);
  rc = unlink(filename);
  if (rc == -1) {
    abort();
  }
  fprintf(stdout, "Deleting %s\n", dir2);
  rc = rmdir(dir2);
  if (rc == -1) {
    abort();
  }
  fprintf(stdout, "Deleting %s\n", dir1);
  rc = rmdir(dir1);
  if (rc == -1) {
    abort();
  }
  int initValue = -1;
  while (write(fd, &initValue, sizeof(initValue)) != sizeof(initValue)) {
    continue;
  }
  if (fork()) {
    writer(fd);
  } else {
    reader(fd);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x180,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xde7(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x158(%rbp)
cmpq   $0x0,-0x158(%rbp)
jne    1246 <main+0x46>
lea    0xdcc(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x158(%rbp)
cmpq   $0x0,-0x158(%rbp)
jne    1262 <main+0x62>
lea    0xdb2(%rip),%rax
mov    %rax,-0x158(%rbp)
mov    -0x158(%rbp),%rdi
call   10b0 <strlen@plt>
movslq %eax,%rcx
add    $0x39,%rcx
mov    $0x64,%eax
cmp    %rcx,%rax
jae    129b <main+0x9b>
lea    0xd88(%rip),%rdi
call   10c0 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14ec <main+0x2ec>
lea    -0x70(%rbp),%rdi
mov    -0x158(%rbp),%rsi
call   1070 <strcpy@plt>
lea    -0x70(%rbp),%rdi
lea    0xd79(%rip),%rsi
call   1110 <strcat@plt>
lea    -0xe0(%rbp),%rdi
lea    -0x70(%rbp),%rsi
call   1070 <strcpy@plt>
lea    -0x70(%rbp),%rdi
lea    0xd6c(%rip),%rsi
call   1110 <strcat@plt>
lea    -0x150(%rbp),%rdi
lea    -0x70(%rbp),%rsi
call   1070 <strcpy@plt>
lea    -0x70(%rbp),%rdi
lea    0xd5f(%rip),%rsi
call   1110 <strcat@plt>
lea    -0xe0(%rbp),%rdi
call   10f0 <mkdtemp@plt>
cmp    $0x0,%rax
jne    1318 <main+0x118>
mov    $0x0,%al
call   1040 <abort@plt>
lea    -0x150(%rbp),%rax
mov    %rax,-0x170(%rbp)
lea    -0xe0(%rbp),%rax
mov    %rax,-0x168(%rbp)
lea    -0xe0(%rbp),%rdi
call   10b0 <strlen@plt>
mov    -0x170(%rbp),%rdi
mov    -0x168(%rbp),%rsi
mov    %eax,%edx
call   1060 <strncpy@plt>
lea    -0x150(%rbp),%rdi
call   10f0 <mkdtemp@plt>
cmp    $0x0,%rax
jne    1372 <main+0x172>
mov    $0x0,%al
call   1040 <abort@plt>
lea    -0x70(%rbp),%rax
mov    %rax,-0x180(%rbp)
lea    -0x150(%rbp),%rax
mov    %rax,-0x178(%rbp)
lea    -0x150(%rbp),%rdi
call   10b0 <strlen@plt>
mov    -0x180(%rbp),%rdi
mov    -0x178(%rbp),%rsi
mov    %eax,%edx
call   1060 <strncpy@plt>
lea    -0x70(%rbp),%rdi
call   10e0 <mkstemp@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jne    13c9 <main+0x1c9>
mov    $0x0,%al
call   1040 <abort@plt>
mov    0x2c10(%rip),%rax
mov    (%rax),%edi
lea    -0x70(%rbp),%rdx
lea    0xc8b(%rip),%rsi
call   10d0 <fprintf@plt>
mov    0x2bf7(%rip),%rax
mov    (%rax),%edi
lea    -0x70(%rbp),%rdx
lea    0xc7d(%rip),%rsi
call   10d0 <fprintf@plt>
lea    -0x70(%rbp),%rdi
call   1050 <unlink@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    1418 <main+0x218>
mov    $0x0,%al
call   1040 <abort@plt>
mov    0x2bc1(%rip),%rax
mov    (%rax),%edi
lea    -0x150(%rbp),%rdx
lea    0xc44(%rip),%rsi
call   10d0 <fprintf@plt>
lea    -0x150(%rbp),%rdi
call   10a0 <rmdir@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    1454 <main+0x254>
mov    $0x0,%al
call   1040 <abort@plt>
mov    0x2b85(%rip),%rax
mov    (%rax),%edi
lea    -0xe0(%rbp),%rdx
lea    0xc08(%rip),%rsi
call   10d0 <fprintf@plt>
lea    -0xe0(%rbp),%rdi
call   10a0 <rmdir@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    1490 <main+0x290>
mov    $0x0,%al
call   1040 <abort@plt>
movl   $0xffffffff,-0x15c(%rbp)
ff ff ff
mov    -0x8(%rbp),%edi
lea    -0x15c(%rbp),%rsi
mov    $0x4,%edx
call   1080 <write@plt>
cltq
cmp    $0x4,%rax
je     14bf <main+0x2bf>
jmp    149a <main+0x29a>
mov    $0x0,%al
call   1120 <fork@plt>
cmp    $0x0,%rax
je     14dd <main+0x2dd>
mov    -0x8(%rbp),%edi
call   1100 <writer@plt>
jmp    14e5 <main+0x2e5>
mov    -0x8(%rbp),%edi
call   1090 <reader@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x180,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x160,%rsp
lea    0xdee(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
jne    1228 <main+0x28>
lea    0xde3(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
lea    0xddb(%rip),%rbx
cmovne %rax,%rbx
mov    %rbx,%rdi
call   10c0 <strlen@plt>
cltq
add    $0xffffffffffffffd4,%rax
cmp    $0xffffffffffffff9a,%rax
ja     1260 <main+0x60>
lea    0xe12(%rip),%rdi
call   1080 <puts@plt>
mov    $0x1,%eax
jmp    1410 <main+0x210>
lea    0xf0(%rsp),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1070 <strcpy@plt>
lea    0xd98(%rip),%rsi
mov    %r14,%rdi
call   1110 <strcat@plt>
lea    0x80(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <strcpy@plt>
lea    0xd89(%rip),%rsi
mov    %r14,%rdi
call   1110 <strcat@plt>
lea    0x10(%rsp),%rdi
mov    %r14,%rsi
call   1070 <strcpy@plt>
lea    0xd80(%rip),%rsi
mov    %r14,%rdi
call   1110 <strcat@plt>
mov    %rbx,%rdi
call   10f0 <mkdtemp@plt>
test   %rax,%rax
je     141c <main+0x21c>
lea    0x80(%rsp),%rbx
mov    %rbx,%rdi
call   10c0 <strlen@plt>
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1060 <strncpy@plt>
mov    %rbp,%rdi
call   10f0 <mkdtemp@plt>
test   %rax,%rax
je     141c <main+0x21c>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   10c0 <strlen@plt>
lea    0xf0(%rsp),%rbp
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1060 <strncpy@plt>
mov    %rbp,%rdi
call   10e0 <mkstemp@plt>
cmp    $0xffffffff,%eax
je     141c <main+0x21c>
mov    %eax,%ebp
mov    0x2ca0(%rip),%r14
mov    (%r14),%edi
lea    0xd01(%rip),%rsi
lea    0xf0(%rsp),%rbx
mov    %rbx,%rdx
call   10d0 <fprintf@plt>
mov    (%r14),%edi
lea    0xcf2(%rip),%rsi
mov    %rbx,%rdx
call   10d0 <fprintf@plt>
mov    %rbx,%rdi
call   1050 <unlink@plt>
cmp    $0xffffffff,%eax
je     141c <main+0x21c>
mov    (%r14),%edi
lea    0xccf(%rip),%rsi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdx
call   10d0 <fprintf@plt>
mov    %rbx,%rdi
call   10b0 <rmdir@plt>
cmp    $0xffffffff,%eax
je     141c <main+0x21c>
mov    (%r14),%edi
lea    0xcab(%rip),%rsi
lea    0x80(%rsp),%rbx
mov    %rbx,%rdx
call   10d0 <fprintf@plt>
mov    %rbx,%rdi
call   10b0 <rmdir@plt>
cmp    $0xffffffff,%eax
je     141c <main+0x21c>
movl   $0xffffffff,0xc(%rsp)
ff
lea    0xc(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x4,%edx
call   1090 <write@plt>
cmp    $0x4,%eax
jne    13e0 <main+0x1e0>
xor    %eax,%eax
call   1120 <fork@plt>
mov    %ebp,%edi
test   %rax,%rax
je     1409 <main+0x209>
call   1100 <writer@plt>
jmp    140e <main+0x20e>
call   10a0 <reader@plt>
xor    %eax,%eax
add    $0x160,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
xor    %eax,%eax
call   1040 <abort@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"DMTCP_TMPDIR\00"
@.str.1 = [7 x i8] c"TMPDIR\00"
@.str.2 = [5 x i8] c"/tmp\00"
@.str.3 = [29 x i8] c"Directory string too large.\0A\00"
@.str.4 = [19 x i8] c"/dmtcp_dir1_XXXXXX\00"
@.str.5 = [19 x i8] c"/dmtcp_dir2_XXXXXX\00"
@.str.6 = [19 x i8] c"/dmtcp_file_XXXXXX\00"
@stdout = global i32 0
@.str.7 = [11 x i8] c"Opened %s\0A\00"
@.str.8 = [13 x i8] c"Deleting %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [100 x i8]
%5 = alloca [100 x i8]
%6 = alloca [100 x i8]
%7 = alloca i8*
%8 = alloca i32
store i32 0, i32* %1
%9 = call i8* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
store i8* %9, i8** %7
%10 = load i8*, i8** %7
%11 = icmp ne i8* %10, null
br i1 %11, label %14, label %12
12: ; preds = %0
%13 = call i8* @getenv(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
store i8* %13, i8** %7
br label %14
14: ; preds = %12, %0
%15 = load i8*, i8** %7
%16 = icmp ne i8* %15, null
br i1 %16, label %18, label %17
17: ; preds = %14
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8** %7
br label %18
18: ; preds = %17, %14
%19 = load i8*, i8** %7
%20 = call i32 @strlen(i8* %19)
%21 = sext i32 %20 to i64
%22 = add i64 %21, 57
%23 = icmp ult i64 100, %22
br i1 %23, label %24, label %26
24: ; preds = %18
%25 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %1
br label %120
26: ; preds = %18
%27 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%28 = load i8*, i8** %7
%29 = call i32 @strcpy(i8* %27, i8* %28)
%30 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%31 = call i32 @strcat(i8* %30, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
%32 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%33 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%34 = call i32 @strcpy(i8* %32, i8* %33)
%35 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%36 = call i32 @strcat(i8* %35, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
%37 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%38 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%39 = call i32 @strcpy(i8* %37, i8* %38)
%40 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%41 = call i32 @strcat(i8* %40, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
%42 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%43 = call i32* @mkdtemp(i8* %42)
%44 = icmp eq i32* %43, null
br i1 %44, label %45, label %47
45: ; preds = %26
%46 = call i32 (...) @abort()
unreachable
47: ; preds = %26
%48 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%49 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%50 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%51 = call i32 @strlen(i8* %50)
%52 = call i32 @strncpy(i8* %48, i8* %49, i32 %51)
%53 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%54 = call i32* @mkdtemp(i8* %53)
%55 = icmp eq i32* %54, null
br i1 %55, label %56, label %58
56: ; preds = %47
%57 = call i32 (...) @abort()
unreachable
58: ; preds = %47
%59 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%60 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%61 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%62 = call i32 @strlen(i8* %61)
%63 = call i32 @strncpy(i8* %59, i8* %60, i32 %62)
%64 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%65 = call i32 @mkstemp(i8* %64)
store i32 %65, i32* %2
%66 = load i32, i32* %2
%67 = icmp eq i32 %66, -1
br i1 %67, label %68, label %70
68: ; preds = %58
%69 = call i32 (...) @abort()
unreachable
70: ; preds = %58
%71 = load i32, i32* @stdout
%72 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%73 = call i32 @fprintf(i32 %71, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i8* %72)
%74 = load i32, i32* @stdout
%75 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%76 = call i32 @fprintf(i32 %74, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i8* %75)
%77 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%78 = call i32 @unlink(i8* %77)
store i32 %78, i32* %3
%79 = load i32, i32* %3
%80 = icmp eq i32 %79, -1
br i1 %80, label %81, label %83
81: ; preds = %70
%82 = call i32 (...) @abort()
unreachable
83: ; preds = %70
%84 = load i32, i32* @stdout
%85 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%86 = call i32 @fprintf(i32 %84, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i8* %85)
%87 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%88 = call i32 @rmdir(i8* %87)
store i32 %88, i32* %3
%89 = load i32, i32* %3
%90 = icmp eq i32 %89, -1
br i1 %90, label %91, label %93
91: ; preds = %83
%92 = call i32 (...) @abort()
unreachable
93: ; preds = %83
%94 = load i32, i32* @stdout
%95 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%96 = call i32 @fprintf(i32 %94, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i8* %95)
%97 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%98 = call i32 @rmdir(i8* %97)
store i32 %98, i32* %3
%99 = load i32, i32* %3
%100 = icmp eq i32 %99, -1
br i1 %100, label %101, label %103
101: ; preds = %93
%102 = call i32 (...) @abort()
unreachable
103: ; preds = %93
store i32 -1, i32* %8
br label %104
104: ; preds = %109, %103
%105 = load i32, i32* %2
%106 = call i32 @write(i32 %105, i32* %8, i32 4)
%107 = sext i32 %106 to i64
%108 = icmp ne i64 %107, 4
br i1 %108, label %109, label %110
109: ; preds = %104
br label %104
110: ; preds = %104
%111 = call i64 (...) @fork()
%112 = icmp ne i64 %111, 0
br i1 %112, label %113, label %116
113: ; preds = %110
%114 = load i32, i32* %2
%115 = call i32 @writer(i32 %114)
br label %119
116: ; preds = %110
%117 = load i32, i32* %2
%118 = call i32 @reader(i32 %117)
br label %119
119: ; preds = %116, %113
store i32 0, i32* %1
br label %120
120: ; preds = %119, %24
%121 = load i32, i32* %1
ret i32 %121
}

LLVM IR (-O2):
@.str = [13 x i8] c"DMTCP_TMPDIR\00"
@.str.1 = [7 x i8] c"TMPDIR\00"
@.str.2 = [5 x i8] c"/tmp\00"
@.str.4 = [19 x i8] c"/dmtcp_dir1_XXXXXX\00"
@.str.5 = [19 x i8] c"/dmtcp_dir2_XXXXXX\00"
@.str.6 = [19 x i8] c"/dmtcp_file_XXXXXX\00"
@stdout = global i32 0
@.str.7 = [11 x i8] c"Opened %s\0A\00"
@.str.8 = [13 x i8] c"Deleting %s\0A\00"
@str = [28 x i8] c"Directory string too large.\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca [100 x i8]
%3 = alloca [100 x i8]
%4 = alloca i32
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%8 = tail call i8* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = tail call i8* @getenv(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %10, %0
%13 = phi i8* [ %8, %0 ], [ %11, %10 ]
%14 = icmp eq i8* %13, null
%15 = select i1 %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %13
%16 = tail call i32 @strlen(i8* %15)
%17 = sext i32 %16 to i64
%18 = add nsw i64 %17, -44
%19 = icmp ult i64 %18, -101
br i1 %19, label %20, label %22
20: ; preds = %12
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
br label %83
22: ; preds = %12
%23 = call i32 @strcpy(i8* %5, i8* %15)
%24 = call i32 @strcat(i8* %5, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
%25 = call i32 @strcpy(i8* %6, i8* %5)
%26 = call i32 @strcat(i8* %5, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
%27 = call i32 @strcpy(i8* %7, i8* %5)
%28 = call i32 @strcat(i8* %5, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
%29 = call i32* @mkdtemp(i8* %6)
%30 = icmp eq i32* %29, null
br i1 %30, label %31, label %33
31: ; preds = %22
%32 = call i32 (...) @abort()
unreachable
33: ; preds = %22
%34 = call i32 @strlen(i8* %6)
%35 = call i32 @strncpy(i8* %7, i8* %6, i32 %34)
%36 = call i32* @mkdtemp(i8* %7)
%37 = icmp eq i32* %36, null
br i1 %37, label %38, label %40
38: ; preds = %33
%39 = call i32 (...) @abort()
unreachable
40: ; preds = %33
%41 = call i32 @strlen(i8* %7)
%42 = call i32 @strncpy(i8* %5, i8* %7, i32 %41)
%43 = call i32 @mkstemp(i8* %5)
%44 = icmp eq i32 %43, -1
br i1 %44, label %45, label %47
45: ; preds = %40
%46 = call i32 (...) @abort()
unreachable
47: ; preds = %40
%48 = load i32, i32* @stdout
%49 = call i32 @fprintf(i32 %48, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i8* %5)
%50 = load i32, i32* @stdout
%51 = call i32 @fprintf(i32 %50, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i8* %5)
%52 = call i32 @unlink(i8* %5)
%53 = icmp eq i32 %52, -1
br i1 %53, label %54, label %56
54: ; preds = %47
%55 = call i32 (...) @abort()
unreachable
56: ; preds = %47
%57 = load i32, i32* @stdout
%58 = call i32 @fprintf(i32 %57, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i8* %7)
%59 = call i32 @rmdir(i8* %7)
%60 = icmp eq i32 %59, -1
br i1 %60, label %61, label %63
61: ; preds = %56
%62 = call i32 (...) @abort()
unreachable
63: ; preds = %56
%64 = load i32, i32* @stdout
%65 = call i32 @fprintf(i32 %64, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i8* %6)
%66 = call i32 @rmdir(i8* %6)
%67 = icmp eq i32 %66, -1
br i1 %67, label %68, label %70
68: ; preds = %63
%69 = call i32 (...) @abort()
unreachable
70: ; preds = %63
%71 = bitcast i32* %4 to i8*
store i32 -1, i32* %4
br label %72
72: ; preds = %72, %70
%73 = call i32 @write(i32 %43, i32* %4, i32 4)
%74 = icmp eq i32 %73, 4
br i1 %74, label %75, label %72
75: ; preds = %72
%76 = call i64 (...) @fork()
%77 = icmp eq i64 %76, 0
br i1 %77, label %80, label %78
78: ; preds = %75
%79 = call i32 @writer(i32 %43)
br label %82
80: ; preds = %75
%81 = call i32 @reader(i32 %43)
br label %82
82: ; preds = %80, %78
br label %83
83: ; preds = %82, %20
%84 = phi i32 [ 1, %20 ], [ 0, %82 ]
ret i32 %84
}