#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*/ free_values(char **);
char **get_values(char *);
scalar_t__ mkdir(char *, int);
int /*<<< orphan*/ printf(char *, char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
char *strerror(int /*<<< orphan*/);
void create_tt_roots() {
  char **tt_roots = get_values("mapred.local.dir");
  char **tt_root;
  for (tt_root = tt_roots; *tt_root != NULL; ++tt_root) {
    if (mkdir(*tt_root, 0755) != 0) {
      printf("FAIL: Can't create directory %s - %s\n", *tt_root,
             strerror(errno));
      exit(1);
    }
    char buffer[100000];
    sprintf(buffer, "%s/taskTracker", *tt_root);
    if (mkdir(buffer, 0755) != 0) {
      printf("FAIL: Can't create directory %s - %s\n", buffer, strerror(errno));
      exit(1);
    }
  }
  free_values(tt_roots);
}


x86 assembly (clang, -O0):
<create_tt_roots>:
push   %rbp
mov    %rsp,%rbp
sub    $0x186c0,%rsp
lea    0xe7e(%rip),%rdi
call   1060 <get_values@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     127f <create_tt_roots+0x10f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    $0x1ed,%esi
call   1030 <mkdir@plt>
cmp    $0x0,%rax
je     11f8 <create_tt_roots+0x88>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x186b8(%rbp)
mov    0x2e0f(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
mov    -0x186b8(%rbp),%rsi
mov    %rax,%rdx
lea    0xe28(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
lea    -0x186b0(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe2a(%rip),%rsi
call   1070 <sprintf@plt>
lea    -0x186b0(%rbp),%rdi
mov    $0x1ed,%esi
call   1030 <mkdir@plt>
cmp    $0x0,%rax
je     1269 <create_tt_roots+0xf9>
lea    -0x186b0(%rbp),%rax
mov    %rax,-0x186c0(%rbp)
mov    0x2d9e(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
mov    -0x186c0(%rbp),%rsi
mov    %rax,%rdx
lea    0xdb7(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
jmp    126e <create_tt_roots+0xfe>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    1193 <create_tt_roots+0x23>
mov    -0x8(%rbp),%rdi
call   1050 <free_values@plt>
add    $0x186c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_tt_roots>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x186a8,%rsp
lea    0xe7b(%rip),%rdi
call   1060 <get_values@plt>
mov    %rax,%r14
mov    (%rax),%rdi
test   %rdi,%rdi
je     11ec <create_tt_roots+0x7c>
lea    0xe9b(%rip),%r15
mov    %rsp,%r12
mov    %r14,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x1ed,%esi
call   1030 <mkdir@plt>
test   %rax,%rax
jne    1202 <create_tt_roots+0x92>
mov    (%rbx),%rdx
mov    %r12,%rdi
mov    %r15,%rsi
call   1070 <sprintf@plt>
mov    %r12,%rdi
mov    $0x1ed,%esi
call   1030 <mkdir@plt>
test   %rax,%rax
jne    121f <create_tt_roots+0xaf>
mov    0x8(%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    11b0 <create_tt_roots+0x40>
mov    %r14,%rdi
add    $0x186a8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1050 <free_values@plt>
mov    (%rbx),%rbx
mov    0x2dd4(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
lea    0xdf7(%rip),%rdi
mov    %rbx,%rsi
jmp    1237 <create_tt_roots+0xc7>
mov    0x2dba(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
lea    0xddd(%rip),%rdi
mov    %rsp,%rsi
mov    %rax,%rdx
call   1040 <printf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"mapred.local.dir\00"
@.str.1 = [38 x i8] c"FAIL: Can't create directory %s - %s\0A\00"
@errno = global i32 0
@.str.2 = [15 x i8] c"%s/taskTracker\00"
define void @create_tt_roots() {
%1 = alloca i8**
%2 = alloca i8**
%3 = alloca [100000 x i8]
%4 = call i8** @get_values(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
store i8** %4, i8*** %1
%5 = load i8**, i8*** %1
store i8** %5, i8*** %2
br label %6
6: ; preds = %37, %0
%7 = load i8**, i8*** %2
%8 = load i8*, i8** %7
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %40
10: ; preds = %6
%11 = load i8**, i8*** %2
%12 = load i8*, i8** %11
%13 = call i64 @mkdir(i8* %12, i32 493)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %22
15: ; preds = %10
%16 = load i8**, i8*** %2
%17 = load i8*, i8** %16
%18 = load i32, i32* @errno
%19 = call i8* @strerror(i32 %18)
%20 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %17, i8* %19)
%21 = call i32 @exit(i32 1)
unreachable
22: ; preds = %10
%23 = getelementptr inbounds [100000 x i8], [100000 x i8]* %3, i64 0, i64 0
%24 = load i8**, i8*** %2
%25 = load i8*, i8** %24
%26 = call i32 @sprintf(i8* %23, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %25)
%27 = getelementptr inbounds [100000 x i8], [100000 x i8]* %3, i64 0, i64 0
%28 = call i64 @mkdir(i8* %27, i32 493)
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %36
30: ; preds = %22
%31 = getelementptr inbounds [100000 x i8], [100000 x i8]* %3, i64 0, i64 0
%32 = load i32, i32* @errno
%33 = call i8* @strerror(i32 %32)
%34 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %31, i8* %33)
%35 = call i32 @exit(i32 1)
unreachable
36: ; preds = %22
br label %37
37: ; preds = %36
%38 = load i8**, i8*** %2
%39 = getelementptr inbounds i8*, i8** %38, i32 1
store i8** %39, i8*** %2
br label %6
40: ; preds = %6
%41 = load i8**, i8*** %1
%42 = call i32 @free_values(i8** %41)
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"mapred.local.dir\00"
@.str.1 = [38 x i8] c"FAIL: Can't create directory %s - %s\0A\00"
@errno = global i32 0
@.str.2 = [15 x i8] c"%s/taskTracker\00"
define void @create_tt_roots() {
%1 = alloca [100000 x i8]
%2 = tail call i8** @get_values(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%3 = load i8*, i8** %2
%4 = icmp eq i8* %3, null
br i1 %4, label %32, label %5
5: ; preds = %0
%6 = getelementptr inbounds [100000 x i8], [100000 x i8]* %1, i64 0, i64 0
br label %7
7: ; preds = %5, %28
%8 = phi i8* [ %3, %5 ], [ %30, %28 ]
%9 = phi i8** [ %2, %5 ], [ %29, %28 ]
%10 = tail call i64 @mkdir(i8* %8, i32 493)
%11 = icmp eq i64 %10, 0
br i1 %11, label %18, label %12
12: ; preds = %7
%13 = load i8*, i8** %9
%14 = load i32, i32* @errno
%15 = tail call i8* @strerror(i32 %14)
%16 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %13, i8* %15)
%17 = tail call i32 @exit(i32 1)
unreachable
18: ; preds = %7
%19 = load i8*, i8** %9
%20 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %19)
%21 = call i64 @mkdir(i8* %6, i32 493)
%22 = icmp eq i64 %21, 0
br i1 %22, label %28, label %23
23: ; preds = %18
%24 = load i32, i32* @errno
%25 = tail call i8* @strerror(i32 %24)
%26 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %6, i8* %25)
%27 = call i32 @exit(i32 1)
unreachable
28: ; preds = %18
%29 = getelementptr inbounds i8*, i8** %9, i64 1
%30 = load i8*, i8** %29
%31 = icmp eq i8* %30, null
br i1 %31, label %32, label %7
32: ; preds = %28, %0
%33 = tail call i32 @free_values(i8** %2)
ret void
}