#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);
scalar_t__ mkdir(char *, int);
int /*<<< orphan*/ printf(char *, char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
char *strerror(int /*<<< orphan*/);
void create_nm_roots(char **nm_roots) {
  char **nm_root;
  for (nm_root = nm_roots; *nm_root != NULL; ++nm_root) {
    if (mkdir(*nm_root, 0755) != 0) {
      printf("FAIL: Can't create directory %s - %s\n", *nm_root,
             strerror(errno));
      exit(1);
    }
    char buffer[100000];
    sprintf(buffer, "%s/usercache", *nm_root);
    if (mkdir(buffer, 0755) != 0) {
      printf("FAIL: Can't create directory %s - %s\n", buffer, strerror(errno));
      exit(1);
    }
  }
}


x86 assembly (clang, -O0):
<create_nm_roots>:
push   %rbp
mov    %rsp,%rbp
sub    $0x186c0,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     1253 <create_nm_roots+0x103>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    $0x1ed,%esi
call   1030 <mkdir@plt>
cmp    $0x0,%rax
je     11cc <create_nm_roots+0x7c>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x186b8(%rbp)
mov    0x2e3b(%rip),%rax
mov    (%rax),%edi
call   1070 <strerror@plt>
mov    -0x186b8(%rbp),%rsi
mov    %rax,%rdx
lea    0xe43(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
lea    -0x186b0(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe45(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x186b0(%rbp),%rdi
mov    $0x1ed,%esi
call   1030 <mkdir@plt>
cmp    $0x0,%rax
je     123d <create_nm_roots+0xed>
lea    -0x186b0(%rbp),%rax
mov    %rax,-0x186c0(%rbp)
mov    0x2dca(%rip),%rax
mov    (%rax),%edi
call   1070 <strerror@plt>
mov    -0x186c0(%rbp),%rsi
mov    %rax,%rdx
lea    0xdd2(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
jmp    1242 <create_nm_roots+0xf2>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    1167 <create_nm_roots+0x17>
add    $0x186c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_nm_roots>:
push   %r15
push   %r14
push   %rbx
sub    $0x186a0,%rsp
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     11bc <create_nm_roots+0x6c>
lea    0xeb8(%rip),%r14
mov    %rsp,%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x1ed,%esi
call   1030 <mkdir@plt>
test   %rax,%rax
jne    11c9 <create_nm_roots+0x79>
mov    (%rbx),%rdx
mov    %r15,%rdi
mov    %r14,%rsi
call   1050 <sprintf@plt>
mov    %r15,%rdi
mov    $0x1ed,%esi
call   1030 <mkdir@plt>
test   %rax,%rax
jne    11e6 <create_nm_roots+0x96>
mov    0x8(%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1180 <create_nm_roots+0x30>
add    $0x186a0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
mov    (%rbx),%rbx
mov    0x2e0d(%rip),%rax
mov    (%rax),%edi
call   1070 <strerror@plt>
lea    0xe1f(%rip),%rdi
mov    %rbx,%rsi
jmp    11fe <create_nm_roots+0xae>
mov    0x2df3(%rip),%rax
mov    (%rax),%edi
call   1070 <strerror@plt>
lea    0xe05(%rip),%rdi
mov    %rsp,%rsi
mov    %rax,%rdx
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [38 x i8] c"FAIL: Can't create directory %s - %s\0A\00"
@errno = global i32 0
@.str.1 = [13 x i8] c"%s/usercache\00"
define void @create_nm_roots(i8** %0) {
%2 = alloca i8**
%3 = alloca i8**
%4 = alloca [100000 x i8]
store i8** %0, i8*** %2
%5 = load i8**, i8*** %2
store i8** %5, i8*** %3
br label %6
6: ; preds = %37, %1
%7 = load i8**, i8*** %3
%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*** %3
%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*** %3
%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, 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]* %4, i64 0, i64 0
%24 = load i8**, i8*** %3
%25 = load i8*, i8** %24
%26 = call i32 @sprintf(i8* %23, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %25)
%27 = getelementptr inbounds [100000 x i8], [100000 x i8]* %4, 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]* %4, 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, 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*** %3
%39 = getelementptr inbounds i8*, i8** %38, i32 1
store i8** %39, i8*** %3
br label %6
40: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [38 x i8] c"FAIL: Can't create directory %s - %s\0A\00"
@errno = global i32 0
@.str.1 = [13 x i8] c"%s/usercache\00"
define void @create_nm_roots(i8** nocapture %0) {
%2 = alloca [100000 x i8]
%3 = load i8*, i8** %0
%4 = icmp eq i8* %3, null
br i1 %4, label %32, label %5
5: ; preds = %1
%6 = getelementptr inbounds [100000 x i8], [100000 x i8]* %2, i64 0, i64 0
br label %7
7: ; preds = %5, %28
%8 = phi i8* [ %3, %5 ], [ %30, %28 ]
%9 = phi i8** [ %0, %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, 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 ([13 x i8], [13 x i8]* @.str.1, 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, 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, %1
ret void
}