#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*/ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
scalar_t__ mkdir(char *, int);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int /*<<< orphan*/ system(char *);
void cleanup(void) {
  system("rm -rf "
         "test.dir");
  mkdir("test.dir", 0700) == 0 ||
      (fprintf(stderr, "Failed for %s - %s\n", "mkdir", strerror(errno)),
       exit(1), 1);
}


x86 assembly (clang, -O0):
<cleanup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xea1(%rip),%rdi
call   1040 <system@plt>
lea    0xe9c(%rip),%rdi
mov    $0x1c0,%esi
call   1030 <mkdir@plt>
cmp    $0x0,%rax
je     11bc <cleanup+0x6c>
mov    0x2e5a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    0x2e46(%rip),%rax
mov    (%rax),%edi
call   1070 <strerror@plt>
mov    -0x4(%rbp),%edi
mov    %rax,%rcx
lea    0xe6a(%rip),%rsi
lea    0xe77(%rip),%rdx
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cleanup>:
push   %rbx
lea    0xea8(%rip),%rdi
call   1040 <system@plt>
lea    0xea3(%rip),%rdi
mov    $0x1c0,%esi
call   1030 <mkdir@plt>
test   %rax,%rax
jne    1175 <cleanup+0x25>
pop    %rbx
ret
mov    0x2e64(%rip),%rax
mov    (%rax),%ebx
mov    0x2e53(%rip),%rax
mov    (%rax),%edi
call   1070 <strerror@plt>
lea    0xe7d(%rip),%rsi
lea    0xe8a(%rip),%rdx
mov    %ebx,%edi
mov    %rax,%rcx
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"rm -rf test.dir\00"
@.str.1 = [9 x i8] c"test.dir\00"
@stderr = global i32 0
@.str.2 = [20 x i8] c"Failed for %s - %s\0A\00"
@.str.3 = [6 x i8] c"mkdir\00"
@errno = global i32 0
define void @cleanup() {
%1 = call i32 @system(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%2 = call i64 @mkdir(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 448)
%3 = icmp eq i64 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %0
%5 = load i32, i32* @stderr
%6 = load i32, i32* @errno
%7 = call i8* @strerror(i32 %6)
%8 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %7)
%9 = call i32 @exit(i32 1)
unreachable
10: ; No predecessors!
br label %11
11: ; preds = %10, %0
%12 = phi i1 [ true, %0 ], [ true, %10 ]
%13 = zext i1 %12 to i32
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"rm -rf test.dir\00"
@.str.1 = [9 x i8] c"test.dir\00"
@stderr = global i32 0
@.str.2 = [20 x i8] c"Failed for %s - %s\0A\00"
@.str.3 = [6 x i8] c"mkdir\00"
@errno = global i32 0
define void @cleanup() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%2 = tail call i64 @mkdir(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 448)
%3 = icmp eq i64 %2, 0
br i1 %3, label %10, label %4
4: ; preds = %0
%5 = load i32, i32* @stderr
%6 = load i32, i32* @errno
%7 = tail call i8* @strerror(i32 %6)
%8 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %7)
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %0
ret void
}