#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 */
struct stat {
  int /*<<< orphan*/ st_mode;
};
typedef int /*<<< orphan*/ mode_t;

/* Variables and functions */
scalar_t__ S_ISDIR(int /*<<< orphan*/);
scalar_t__ chmod(char *, int /*<<< orphan*/);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
int /*<<< orphan*/ free(char *);
scalar_t__ mkdir(char *, int /*<<< orphan*/);
scalar_t__ stat(char *, struct stat *);
int /*<<< orphan*/ stderr;
char *strchr(char *, char);
char *strdup(char *);
char *strerror(int /*<<< orphan*/);
int umask(int);
int mkdirs(char *path, mode_t nmode) {
  int oumask;
  struct stat sb;
  if (stat(path, &sb) == 0) {
    if (S_ISDIR(sb.st_mode) == 0) {
      fprintf(stderr, "%s: file exists but is not a directory", path);
      return 1;
    }
    if (chmod(path, nmode)) {
      fprintf(stderr, "%s: %s", path, strerror(errno));
      return 1;
    }
    return 0;
  }
  oumask = umask(0);
  char *npath = strdup(path);
  char *p = npath;
  while (*p == '/')
    p++;
  while (p = strchr(p, '/')) {
    *p = '\0';
    if (stat(npath, &sb) != 0) {
      if (mkdir(npath, nmode)) {
        fprintf(stderr, "cannot create directory %s: %s", npath,
                strerror(errno));
        umask(oumask);
        free(npath);
        return 1;
      }
    } else if (S_ISDIR(sb.st_mode) == 0) {
      fprintf(stderr, "%s: file exists but is not a directory", npath);
      umask(oumask);
      free(npath);
      return 1;
    }
    *p++ = '/';
    while (*p == '/')
      p++;
  }
  if (stat(npath, &sb) && mkdir(npath, nmode)) {
    fprintf(stderr, "cannot create directory `%s': %s", npath, strerror(errno));
    umask(oumask);
    free(npath);
    return 1;
  }
  umask(oumask);
  free(npath);
  return 0;
}


x86 assembly (clang, -O0):
<mkdirs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1090 <stat@plt>
cmp    $0x0,%rax
jne    1267 <mkdirs+0xc7>
mov    -0x20(%rbp),%edi
call   1060 <S_ISDIR@plt>
cmp    $0x0,%rax
jne    11ff <mkdirs+0x5f>
mov    0x2e01(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe14(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    147b <mkdirs+0x2db>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   10a0 <chmod@plt>
cmp    $0x0,%rax
je     125b <mkdirs+0xbb>
mov    0x2dc4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    0x2da8(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    -0x3c(%rbp),%edi
mov    -0x38(%rbp),%rdx
mov    %rax,%rcx
lea    0xdf7(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    147b <mkdirs+0x2db>
movl   $0x0,-0x4(%rbp)
jmp    147b <mkdirs+0x2db>
xor    %edi,%edi
call   1080 <umask@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   10b0 <strdup@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    12a7 <mkdirs+0x107>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1286 <mkdirs+0xe6>
jmp    12ac <mkdirs+0x10c>
mov    -0x30(%rbp),%rdi
mov    $0x2f,%esi
call   1050 <strchr@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
je     13df <mkdirs+0x23f>
mov    -0x30(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x28(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1090 <stat@plt>
cmp    $0x0,%rax
je     1358 <mkdirs+0x1b8>
mov    -0x28(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <mkdir@plt>
cmp    $0x0,%rax
je     1353 <mkdirs+0x1b3>
mov    0x2cdd(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    0x2cc1(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    -0x4c(%rbp),%edi
mov    -0x48(%rbp),%rdx
mov    %rax,%rcx
lea    0xcf8(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x18(%rbp),%edi
call   1080 <umask@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
movl   $0x1,-0x4(%rbp)
jmp    147b <mkdirs+0x2db>
jmp    13a7 <mkdirs+0x207>
mov    -0x20(%rbp),%edi
call   1060 <S_ISDIR@plt>
cmp    $0x0,%rax
jne    13a2 <mkdirs+0x202>
mov    0x2c6f(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rdx
lea    0xc82(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x18(%rbp),%edi
call   1080 <umask@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
movl   $0x1,-0x4(%rbp)
jmp    147b <mkdirs+0x2db>
jmp    13a7 <mkdirs+0x207>
mov    -0x30(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x30(%rbp)
movb   $0x2f,(%rax)
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    13da <mkdirs+0x23a>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    13b9 <mkdirs+0x219>
jmp    12ac <mkdirs+0x10c>
mov    -0x28(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1090 <stat@plt>
cmp    $0x0,%rax
je     1463 <mkdirs+0x2c3>
mov    -0x28(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <mkdir@plt>
cmp    $0x0,%rax
je     1463 <mkdirs+0x2c3>
mov    0x2bcd(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    0x2bb1(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    -0x5c(%rbp),%edi
mov    -0x58(%rbp),%rdx
mov    %rax,%rcx
lea    0xc07(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x18(%rbp),%edi
call   1080 <umask@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
movl   $0x1,-0x4(%rbp)
jmp    147b <mkdirs+0x2db>
mov    -0x18(%rbp),%edi
call   1080 <umask@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mkdirs>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %esi,%r15d
mov    %rdi,%rbx
lea    0x8(%rsp),%rsi
call   1090 <stat@plt>
test   %rax,%rax
je     12d8 <mkdirs+0x138>
xor    %edi,%edi
call   1080 <umask@plt>
mov    %eax,%r14d
mov    %rbx,%rdi
call   10b0 <strdup@plt>
mov    %rax,%rbx
mov    %rax,%rdi
add    $0xffffffffffffffff,%rdi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmpb   $0x2f,0x1(%rdi)
lea    0x1(%rdi),%rdi
je     11f0 <mkdirs+0x50>
mov    $0x2f,%esi
call   1050 <strchr@plt>
test   %rax,%rax
je     128f <mkdirs+0xef>
mov    %rax,%rbp
lea    0x8(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
nop
movb   $0x0,0x0(%rbp)
mov    %rbx,%rdi
mov    %r12,%rsi
call   1090 <stat@plt>
test   %rax,%rax
je     1250 <mkdirs+0xb0>
mov    %rbx,%rdi
mov    %r15d,%esi
call   1040 <mkdir@plt>
test   %rax,%rax
je     1262 <mkdirs+0xc2>
jmp    1358 <mkdirs+0x1b8>
nopl   0x0(%rax)
mov    0x8(%rsp),%edi
call   1060 <S_ISDIR@plt>
test   %rax,%rax
je     1387 <mkdirs+0x1e7>
movb   $0x2f,0x0(%rbp)
cs nopw 0x0(%rax,%rax,1)
cmpb   $0x2f,0x1(%rbp)
lea    0x1(%rbp),%rbp
je     1270 <mkdirs+0xd0>
mov    %rbp,%rdi
mov    $0x2f,%esi
call   1050 <strchr@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    1220 <mkdirs+0x80>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1090 <stat@plt>
test   %rax,%rax
je     1328 <mkdirs+0x188>
mov    %rbx,%rdi
mov    %r15d,%esi
call   1040 <mkdir@plt>
test   %rax,%rax
je     1328 <mkdirs+0x188>
mov    0x2d24(%rip),%rax
mov    (%rax),%ebp
mov    0x2d13(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xd73(%rip),%rsi
jmp    1376 <mkdirs+0x1d6>
mov    0x8(%rsp),%edi
call   1060 <S_ISDIR@plt>
test   %rax,%rax
je     133c <mkdirs+0x19c>
mov    %rbx,%rdi
mov    %r15d,%esi
call   10a0 <chmod@plt>
test   %rax,%rax
je     1338 <mkdirs+0x198>
mov    0x2ce3(%rip),%rax
mov    (%rax),%ebp
mov    0x2cd2(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xd2b(%rip),%rsi
mov    %ebp,%edi
mov    %rbx,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1070 <fprintf@plt>
jmp    13b1 <mkdirs+0x211>
mov    %r14d,%edi
call   1080 <umask@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
jmp    13b6 <mkdirs+0x216>
mov    0x2c9d(%rip),%rax
mov    (%rax),%edi
lea    0xcb4(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
jmp    13b1 <mkdirs+0x211>
mov    0x2c81(%rip),%rax
mov    (%rax),%ebp
mov    0x2c70(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xcb1(%rip),%rsi
mov    %ebp,%edi
mov    %rbx,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1070 <fprintf@plt>
jmp    13a1 <mkdirs+0x201>
mov    0x2c52(%rip),%rax
mov    (%rax),%edi
lea    0xc69(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %r14d,%edi
call   1080 <umask@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@stderr = global i32 0
@.str = [39 x i8] c"%s: file exists but is not a directory\00"
@.str.1 = [7 x i8] c"%s: %s\00"
@errno = global i32 0
@.str.2 = [31 x i8] c"cannot create directory %s: %s\00"
@.str.3 = [33 x i8] c"cannot create directory `%s': %s\00"
define i32 @mkdirs(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca %struct.stat
%8 = alloca i8*
%9 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
%10 = load i8*, i8** %4
%11 = call i64 @stat(i8* %10, %struct.stat* %7)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %34
13: ; preds = %2
%14 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 0
%15 = load i32, i32* %14
%16 = call i64 @S_ISDIR(i32 %15)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %22
18: ; preds = %13
%19 = load i32, i32* @stderr
%20 = load i8*, i8** %4
%21 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %20)
store i32 1, i32* %3
br label %123
22: ; preds = %13
%23 = load i8*, i8** %4
%24 = load i32, i32* %5
%25 = call i64 @chmod(i8* %23, i32 %24)
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %33
27: ; preds = %22
%28 = load i32, i32* @stderr
%29 = load i8*, i8** %4
%30 = load i32, i32* @errno
%31 = call i8* @strerror(i32 %30)
%32 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %29, i8* %31)
store i32 1, i32* %3
br label %123
33: ; preds = %22
store i32 0, i32* %3
br label %123
34: ; preds = %2
%35 = call i32 @umask(i32 0)
store i32 %35, i32* %6
%36 = load i8*, i8** %4
%37 = call i8* @strdup(i8* %36)
store i8* %37, i8** %8
%38 = load i8*, i8** %8
store i8* %38, i8** %9
br label %39
39: ; preds = %44, %34
%40 = load i8*, i8** %9
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
%43 = icmp eq i32 %42, 47
br i1 %43, label %44, label %47
44: ; preds = %39
%45 = load i8*, i8** %9
%46 = getelementptr inbounds i8, i8* %45, i32 1
store i8* %46, i8** %9
br label %39
47: ; preds = %39
br label %48
48: ; preds = %98, %47
%49 = load i8*, i8** %9
%50 = call i8* @strchr(i8* %49, i8 signext 47)
store i8* %50, i8** %9
%51 = icmp ne i8* %50, null
br i1 %51, label %52, label %99
52: ; preds = %48
%53 = load i8*, i8** %9
store i8 0, i8* %53
%54 = load i8*, i8** %8
%55 = call i64 @stat(i8* %54, %struct.stat* %7)
%56 = icmp ne i64 %55, 0
br i1 %56, label %57, label %73
57: ; preds = %52
%58 = load i8*, i8** %8
%59 = load i32, i32* %5
%60 = call i64 @mkdir(i8* %58, i32 %59)
%61 = icmp ne i64 %60, 0
br i1 %61, label %62, label %72
62: ; preds = %57
%63 = load i32, i32* @stderr
%64 = load i8*, i8** %8
%65 = load i32, i32* @errno
%66 = call i8* @strerror(i32 %65)
%67 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %63, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i8* %64, i8* %66)
%68 = load i32, i32* %6
%69 = call i32 @umask(i32 %68)
%70 = load i8*, i8** %8
%71 = call i32 @free(i8* %70)
store i32 1, i32* %3
br label %123
72: ; preds = %57
br label %87
73: ; preds = %52
%74 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 0
%75 = load i32, i32* %74
%76 = call i64 @S_ISDIR(i32 %75)
%77 = icmp eq i64 %76, 0
br i1 %77, label %78, label %86
78: ; preds = %73
%79 = load i32, i32* @stderr
%80 = load i8*, i8** %8
%81 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %79, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %80)
%82 = load i32, i32* %6
%83 = call i32 @umask(i32 %82)
%84 = load i8*, i8** %8
%85 = call i32 @free(i8* %84)
store i32 1, i32* %3
br label %123
86: ; preds = %73
br label %87
87: ; preds = %86, %72
%88 = load i8*, i8** %9
%89 = getelementptr inbounds i8, i8* %88, i32 1
store i8* %89, i8** %9
store i8 47, i8* %88
br label %90
90: ; preds = %95, %87
%91 = load i8*, i8** %9
%92 = load i8, i8* %91
%93 = sext i8 %92 to i32
%94 = icmp eq i32 %93, 47
br i1 %94, label %95, label %98
95: ; preds = %90
%96 = load i8*, i8** %9
%97 = getelementptr inbounds i8, i8* %96, i32 1
store i8* %97, i8** %9
br label %90
98: ; preds = %90
br label %48
99: ; preds = %48
%100 = load i8*, i8** %8
%101 = call i64 @stat(i8* %100, %struct.stat* %7)
%102 = icmp ne i64 %101, 0
br i1 %102, label %103, label %118
103: ; preds = %99
%104 = load i8*, i8** %8
%105 = load i32, i32* %5
%106 = call i64 @mkdir(i8* %104, i32 %105)
%107 = icmp ne i64 %106, 0
br i1 %107, label %108, label %118
108: ; preds = %103
%109 = load i32, i32* @stderr
%110 = load i8*, i8** %8
%111 = load i32, i32* @errno
%112 = call i8* @strerror(i32 %111)
%113 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %109, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i8* %110, i8* %112)
%114 = load i32, i32* %6
%115 = call i32 @umask(i32 %114)
%116 = load i8*, i8** %8
%117 = call i32 @free(i8* %116)
store i32 1, i32* %3
br label %123
118: ; preds = %103, %99
%119 = load i32, i32* %6
%120 = call i32 @umask(i32 %119)
%121 = load i8*, i8** %8
%122 = call i32 @free(i8* %121)
store i32 0, i32* %3
br label %123
123: ; preds = %118, %108, %78, %62, %33, %27, %18
%124 = load i32, i32* %3
ret i32 %124
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@stderr = global i32 0
@.str = [39 x i8] c"%s: file exists but is not a directory\00"
@.str.1 = [7 x i8] c"%s: %s\00"
@errno = global i32 0
@.str.2 = [31 x i8] c"cannot create directory %s: %s\00"
@.str.3 = [33 x i8] c"cannot create directory `%s': %s\00"
define i32 @mkdirs(i8* %0, i32 %1) {
%3 = alloca %struct.stat
%4 = bitcast %struct.stat* %3 to i8*
%5 = call i64 @stat(i8* %0, %struct.stat* %3)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %23
7: ; preds = %2
%8 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%9 = load i32, i32* %8
%10 = call i64 @S_ISDIR(i32 %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %7
%13 = load i32, i32* @stderr
%14 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %84
15: ; preds = %7
%16 = call i64 @chmod(i8* %0, i32 %1)
%17 = icmp eq i64 %16, 0
br i1 %17, label %84, label %18
18: ; preds = %15
%19 = load i32, i32* @stderr
%20 = load i32, i32* @errno
%21 = call i8* @strerror(i32 %20)
%22 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* %21)
br label %84
23: ; preds = %2
%24 = call i32 @umask(i32 0)
%25 = call i8* @strdup(i8* %0)
br label %26
26: ; preds = %26, %23
%27 = phi i8* [ %25, %23 ], [ %30, %26 ]
%28 = load i8, i8* %27
%29 = icmp eq i8 %28, 47
%30 = getelementptr inbounds i8, i8* %27, i64 1
br i1 %29, label %26, label %31
31: ; preds = %26
%32 = call i8* @strchr(i8* %27, i8 signext 47)
%33 = icmp eq i8* %32, null
br i1 %33, label %68, label %34
34: ; preds = %31
%35 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
br label %39
36: ; preds = %63
%37 = call i8* @strchr(i8* %65, i8 signext 47)
%38 = icmp eq i8* %37, null
br i1 %38, label %68, label %39
39: ; preds = %34, %36
%40 = phi i8* [ %32, %34 ], [ %37, %36 ]
store i8 0, i8* %40
%41 = call i64 @stat(i8* %25, %struct.stat* %3)
%42 = icmp eq i64 %41, 0
br i1 %42, label %53, label %43
43: ; preds = %39
%44 = call i64 @mkdir(i8* %25, i32 %1)
%45 = icmp eq i64 %44, 0
br i1 %45, label %62, label %46
46: ; preds = %43
%47 = load i32, i32* @stderr
%48 = load i32, i32* @errno
%49 = call i8* @strerror(i32 %48)
%50 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %47, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i8* %25, i8* %49)
%51 = call i32 @umask(i32 %24)
%52 = call i32 @free(i8* %25)
br label %84
53: ; preds = %39
%54 = load i32, i32* %35
%55 = call i64 @S_ISDIR(i32 %54)
%56 = icmp eq i64 %55, 0
br i1 %56, label %57, label %62
57: ; preds = %53
%58 = load i32, i32* @stderr
%59 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %58, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %25)
%60 = call i32 @umask(i32 %24)
%61 = call i32 @free(i8* %25)
br label %84
62: ; preds = %53, %43
store i8 47, i8* %40
br label %63
63: ; preds = %63, %62
%64 = phi i8* [ %40, %62 ], [ %65, %63 ]
%65 = getelementptr inbounds i8, i8* %64, i64 1
%66 = load i8, i8* %65
%67 = icmp eq i8 %66, 47
br i1 %67, label %63, label %36
68: ; preds = %36, %31
%69 = call i64 @stat(i8* %25, %struct.stat* %3)
%70 = icmp eq i64 %69, 0
br i1 %70, label %81, label %71
71: ; preds = %68
%72 = call i64 @mkdir(i8* %25, i32 %1)
%73 = icmp eq i64 %72, 0
br i1 %73, label %81, label %74
74: ; preds = %71
%75 = load i32, i32* @stderr
%76 = load i32, i32* @errno
%77 = call i8* @strerror(i32 %76)
%78 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %75, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i8* %25, i8* %77)
%79 = call i32 @umask(i32 %24)
%80 = call i32 @free(i8* %25)
br label %84
81: ; preds = %71, %68
%82 = call i32 @umask(i32 %24)
%83 = call i32 @free(i8* %25)
br label %84
84: ; preds = %46, %57, %74, %81, %15, %18, %12
%85 = phi i32 [ 1, %12 ], [ 1, %18 ], [ 0, %15 ], [ 1, %46 ], [ 1, %57 ], [ 1, %74 ], [ 0, %81 ]
ret i32 %85
}