#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*/ cmd;

/* Variables and functions */
int /*<<< orphan*/ F_OK;
scalar_t__ access(char *, int /*<<< orphan*/);
int chmod(char *, int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(char *);
scalar_t__ malloc(unsigned long);
int /*<<< orphan*/ memset(char *, int, int);
int mkdir_p(char *, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, char *);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
scalar_t__ strlen(char const *);
int /*<<< orphan*/ strncpy(char *, char const *, unsigned long);
char *strrchr(char const *, char);
int /*<<< orphan*/ system(char *);
int create_bugreports_dir(const char *bugreportfile) {
  int ret = 0;
  char *pdir;
  char *pend;
  unsigned long tmplen;
  char cmd[256];
  if (NULL == bugreportfile) {
    fprintf(stderr, "bugreport dir is invalide.\n");
    return -1;
  }
  if (0 == strlen(bugreportfile)) {
    fprintf(stderr, "bugreport dir is invalide.\n");
    return -1;
  }
  pend = strrchr(bugreportfile, '/');
  if (NULL == pend) {
    fprintf(stderr, "pend  is invalide.\n");
    return -1;
  }
  tmplen = strlen(bugreportfile) - strlen(pend);
  pdir = (char *)malloc((tmplen + 1) * sizeof(char));
  if (NULL == pdir) {
    fprintf(stderr, "malloc memory fail when create bugreport dir[%s].\n",
            bugreportfile);
    return -1;
  }
  memset(pdir, 0x00, sizeof((tmplen + 1) * sizeof(char)));
  strncpy(pdir, bugreportfile, tmplen);
  pdir[tmplen] = '\0';
  if (access(pdir, F_OK) != 0) {
    ret = mkdir_p(pdir, 0640);
    if (0 == ret) {
      fprintf(stderr, "create bugreport dir[%s] ok.\n", pdir);
      chmod(pdir, 0640);
      snprintf(cmd, sizeof(cmd), "chown %s %s", "root:system", pdir);
      system(cmd);
      free(pdir);
      pdir = NULL;
      return 0;
    } else {
      free(pdir);
      pdir = NULL;
      perror("create bugreport fail!\n");
      return -1;
    }
  } else {
    fprintf(stderr, "bugreport dir[%s] exist.\n", pdir);
    ret = chmod(pdir, 0640);
    if (ret == -1) {
      fprintf(stderr, "chmod dir[%s] err %s:\n", pdir, strerror(errno));
    }
    snprintf(cmd, sizeof(cmd), "chown %s %s", "root:system", pdir);
    system(cmd);
    free(pdir);
    pdir = NULL;
    return 0;
  }
}


x86 assembly (clang, -O0):
<create_bugreports_dir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x150,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
jne    1225 <create_bugreports_dir+0x45>
mov    0x2dd7(%rip),%rax
mov    (%rax),%edi
lea    0xdee(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14d8 <create_bugreports_dir+0x2f8>
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    125f <create_bugreports_dir+0x7f>
mov    0x2d9d(%rip),%rax
mov    (%rax),%edi
lea    0xdb4(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14d8 <create_bugreports_dir+0x2f8>
mov    -0x10(%rbp),%rdi
mov    $0x2f,%esi
call   1080 <strrchr@plt>
mov    %rax,-0x28(%rbp)
xor    %eax,%eax
cmp    -0x28(%rbp),%rax
jne    12a0 <create_bugreports_dir+0xc0>
mov    0x2d5c(%rip),%rax
mov    (%rax),%edi
lea    0xd8f(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14d8 <create_bugreports_dir+0x2f8>
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,-0x138(%rbp)
mov    -0x28(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rcx
mov    -0x138(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
add    $0x1,%rdi
shl    $0x0,%rdi
call   10c0 <malloc@plt>
mov    %rax,-0x20(%rbp)
xor    %eax,%eax
cmp    -0x20(%rbp),%rax
jne    1312 <create_bugreports_dir+0x132>
mov    0x2cee(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xd31(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14d8 <create_bugreports_dir+0x2f8>
mov    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1090 <memset@plt>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x30(%rbp),%rdx
call   1040 <strncpy@plt>
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x20(%rbp),%rdi
mov    0x2c7e(%rip),%rax
mov    (%rax),%esi
call   10e0 <access@plt>
cmp    $0x0,%rax
je     1415 <create_bugreports_dir+0x235>
mov    -0x20(%rbp),%rdi
mov    $0x1a0,%esi
call   10b0 <mkdir_p@plt>
mov    %eax,-0x14(%rbp)
xor    %eax,%eax
cmp    -0x14(%rbp),%eax
jne    13ec <create_bugreports_dir+0x20c>
mov    0x2c62(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xcd8(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    -0x20(%rbp),%rdi
mov    $0x1a0,%esi
call   10d0 <chmod@plt>
lea    -0x130(%rbp),%rdi
mov    -0x20(%rbp),%r8
mov    $0x100,%esi
lea    0xcca(%rip),%rdx
lea    0xccf(%rip),%rcx
call   1070 <snprintf@plt>
lea    -0x130(%rbp),%rdi
call   1060 <system@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x20(%rbp)
movl   $0x0,-0x4(%rbp)
jmp    14d8 <create_bugreports_dir+0x2f8>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x20(%rbp)
lea    0xc95(%rip),%rdi
call   10f0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14d8 <create_bugreports_dir+0x2f8>
mov    0x2bc4(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xc88(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    -0x20(%rbp),%rdi
mov    $0x1a0,%esi
call   10d0 <chmod@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1491 <create_bugreports_dir+0x2b1>
mov    0x2b8e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x144(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x140(%rbp)
mov    0x2b6c(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
mov    -0x144(%rbp),%edi
mov    -0x140(%rbp),%rdx
mov    %rax,%rcx
lea    0xc41(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
lea    -0x130(%rbp),%rdi
mov    -0x20(%rbp),%r8
mov    $0x100,%esi
lea    0xbd9(%rip),%rdx
lea    0xbde(%rip),%rcx
call   1070 <snprintf@plt>
lea    -0x130(%rbp),%rdi
call   1060 <system@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x20(%rbp)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x150,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_bugreports_dir>:
push   %rbp
push   %r14
push   %rbx
sub    $0x100,%rsp
test   %rdi,%rdi
je     12bd <create_bugreports_dir+0xdd>
mov    %rdi,%rbp
call   1050 <strlen@plt>
test   %rax,%rax
je     12bd <create_bugreports_dir+0xdd>
mov    %rax,%rbx
mov    %rbp,%rdi
mov    $0x2f,%esi
call   1080 <strrchr@plt>
test   %rax,%rax
je     12e7 <create_bugreports_dir+0x107>
mov    %rax,%rdi
call   1050 <strlen@plt>
sub    %rax,%rbx
lea    0x1(%rbx),%rdi
call   10c0 <malloc@plt>
test   %rax,%rax
je     12f9 <create_bugreports_dir+0x119>
mov    %rax,%r14
mov    %rax,%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1090 <memset@plt>
mov    %r14,%rdi
mov    %rbp,%rsi
mov    %rbx,%rdx
call   1040 <strncpy@plt>
movb   $0x0,(%r14,%rbx,1)
mov    0x2d61(%rip),%rax
mov    (%rax),%esi
mov    %r14,%rdi
call   10e0 <access@plt>
test   %rax,%rax
je     1315 <create_bugreports_dir+0x135>
mov    %r14,%rdi
mov    $0x1a0,%esi
call   10b0 <mkdir_p@plt>
test   %eax,%eax
jne    139f <create_bugreports_dir+0x1bf>
mov    0x2d4a(%rip),%rax
mov    (%rax),%edi
lea    0xdc4(%rip),%rsi
xor    %ebp,%ebp
mov    %r14,%rdx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    %r14,%rdi
mov    $0x1a0,%esi
call   10d0 <chmod@plt>
jmp    1369 <create_bugreports_dir+0x189>
mov    0x2d1c(%rip),%rax
mov    (%rax),%edi
lea    0xd33(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
add    $0x100,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    0x2cf2(%rip),%rax
mov    (%rax),%edi
lea    0xd25(%rip),%rsi
jmp    12cd <create_bugreports_dir+0xed>
mov    0x2ce0(%rip),%rax
mov    (%rax),%edi
lea    0xd27(%rip),%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   10a0 <fprintf@plt>
jmp    12d4 <create_bugreports_dir+0xf4>
mov    0x2cc4(%rip),%rbx
mov    (%rbx),%edi
lea    0xd8c(%rip),%rsi
xor    %ebp,%ebp
mov    %r14,%rdx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    %r14,%rdi
mov    $0x1a0,%esi
call   10d0 <chmod@plt>
cmp    $0xffffffff,%eax
jne    1369 <create_bugreports_dir+0x189>
mov    (%rbx),%ebx
mov    0x2c8c(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
lea    0xd71(%rip),%rsi
mov    %ebx,%edi
mov    %r14,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   10a0 <fprintf@plt>
lea    0xd11(%rip),%rdx
lea    0xd16(%rip),%rcx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x100,%esi
mov    %r14,%r8
call   1070 <snprintf@plt>
mov    %rbx,%rdi
call   1060 <system@plt>
mov    %r14,%rdi
call   1030 <free@plt>
jmp    12d9 <create_bugreports_dir+0xf9>
mov    %r14,%rdi
call   1030 <free@plt>
lea    0xceb(%rip),%rdi
call   10f0 <perror@plt>
jmp    12d4 <create_bugreports_dir+0xf4>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [28 x i8] c"bugreport dir is invalide.\0A\00"
@.str.1 = [20 x i8] c"pend is invalide.\0A\00"
@.str.2 = [51 x i8] c"malloc memory fail when create bugreport dir[%s].\0A\00"
@F_OK = global i32 0
@.str.3 = [30 x i8] c"create bugreport dir[%s] ok.\0A\00"
@.str.4 = [12 x i8] c"chown %s %s\00"
@.str.5 = [12 x i8] c"root:system\00"
@.str.6 = [24 x i8] c"create bugreport fail!\0A\00"
@.str.7 = [26 x i8] c"bugreport dir[%s] exist.\0A\00"
@.str.8 = [23 x i8] c"chmod dir[%s] err %s:\0A\00"
@errno = global i32 0
define i32 @create_bugreports_dir(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca [256 x i8]
store i8* %0, i8** %3
store i32 0, i32* %4
%9 = load i8*, i8** %3
%10 = icmp eq i8* null, %9
br i1 %10, label %11, label %14
11: ; preds = %1
%12 = load i32, i32* @stderr
%13 = call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %2
br label %104
14: ; preds = %1
%15 = load i8*, i8** %3
%16 = call i64 @strlen(i8* %15)
%17 = icmp eq i64 0, %16
br i1 %17, label %18, label %21
18: ; preds = %14
%19 = load i32, i32* @stderr
%20 = call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %2
br label %104
21: ; preds = %14
%22 = load i8*, i8** %3
%23 = call i8* @strrchr(i8* %22, i8 signext 47)
store i8* %23, i8** %6
%24 = load i8*, i8** %6
%25 = icmp eq i8* null, %24
br i1 %25, label %26, label %29
26: ; preds = %21
%27 = load i32, i32* @stderr
%28 = call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %2
br label %104
29: ; preds = %21
%30 = load i8*, i8** %3
%31 = call i64 @strlen(i8* %30)
%32 = load i8*, i8** %6
%33 = call i64 @strlen(i8* %32)
%34 = sub nsw i64 %31, %33
store i64 %34, i64* %7
%35 = load i64, i64* %7
%36 = add i64 %35, 1
%37 = mul i64 %36, 1
%38 = call i64 @malloc(i64 %37)
%39 = inttoptr i64 %38 to i8*
store i8* %39, i8** %5
%40 = load i8*, i8** %5
%41 = icmp eq i8* null, %40
br i1 %41, label %42, label %46
42: ; preds = %29
%43 = load i32, i32* @stderr
%44 = load i8*, i8** %3
%45 = call i32 (i32, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0), i8* %44)
store i32 -1, i32* %2
br label %104
46: ; preds = %29
%47 = load i8*, i8** %5
%48 = call i32 @memset(i8* %47, i32 0, i32 8)
%49 = load i8*, i8** %5
%50 = load i8*, i8** %3
%51 = load i64, i64* %7
%52 = call i32 @strncpy(i8* %49, i8* %50, i64 %51)
%53 = load i8*, i8** %5
%54 = load i64, i64* %7
%55 = getelementptr inbounds i8, i8* %53, i64 %54
store i8 0, i8* %55
%56 = load i8*, i8** %5
%57 = load i32, i32* @F_OK
%58 = call i64 @access(i8* %56, i32 %57)
%59 = icmp ne i64 %58, 0
br i1 %59, label %60, label %82
60: ; preds = %46
%61 = load i8*, i8** %5
%62 = call i32 @mkdir_p(i8* %61, i32 416)
store i32 %62, i32* %4
%63 = load i32, i32* %4
%64 = icmp eq i32 0, %63
br i1 %64, label %65, label %78
65: ; preds = %60
%66 = load i32, i32* @stderr
%67 = load i8*, i8** %5
%68 = call i32 (i32, i8*, ...) @fprintf(i32 %66, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i8* %67)
%69 = load i8*, i8** %5
%70 = call i32 @chmod(i8* %69, i32 416)
%71 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%72 = load i8*, i8** %5
%73 = call i32 @snprintf(i8* %71, i32 256, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* %72)
%74 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%75 = call i32 @system(i8* %74)
%76 = load i8*, i8** %5
%77 = call i32 @free(i8* %76)
store i8* null, i8** %5
store i32 0, i32* %2
br label %104
78: ; preds = %60
%79 = load i8*, i8** %5
%80 = call i32 @free(i8* %79)
store i8* null, i8** %5
%81 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
store i32 -1, i32* %2
br label %104
82: ; preds = %46
%83 = load i32, i32* @stderr
%84 = load i8*, i8** %5
%85 = call i32 (i32, i8*, ...) @fprintf(i32 %83, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i8* %84)
%86 = load i8*, i8** %5
%87 = call i32 @chmod(i8* %86, i32 416)
store i32 %87, i32* %4
%88 = load i32, i32* %4
%89 = icmp eq i32 %88, -1
br i1 %89, label %90, label %96
90: ; preds = %82
%91 = load i32, i32* @stderr
%92 = load i8*, i8** %5
%93 = load i32, i32* @errno
%94 = call i8* @strerror(i32 %93)
%95 = call i32 (i32, i8*, ...) @fprintf(i32 %91, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0), i8* %92, i8* %94)
br label %96
96: ; preds = %90, %82
%97 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%98 = load i8*, i8** %5
%99 = call i32 @snprintf(i8* %97, i32 256, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* %98)
%100 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%101 = call i32 @system(i8* %100)
%102 = load i8*, i8** %5
%103 = call i32 @free(i8* %102)
store i8* null, i8** %5
store i32 0, i32* %2
br label %104
104: ; preds = %96, %78, %65, %42, %26, %18, %11
%105 = load i32, i32* %2
ret i32 %105
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [28 x i8] c"bugreport dir is invalide.\0A\00"
@.str.1 = [20 x i8] c"pend is invalide.\0A\00"
@.str.2 = [51 x i8] c"malloc memory fail when create bugreport dir[%s].\0A\00"
@F_OK = global i32 0
@.str.3 = [30 x i8] c"create bugreport dir[%s] ok.\0A\00"
@.str.4 = [12 x i8] c"chown %s %s\00"
@.str.5 = [12 x i8] c"root:system\00"
@.str.6 = [24 x i8] c"create bugreport fail!\0A\00"
@.str.7 = [26 x i8] c"bugreport dir[%s] exist.\0A\00"
@.str.8 = [23 x i8] c"chmod dir[%s] err %s:\0A\00"
@errno = global i32 0
define i32 @create_bugreports_dir(i8* %0) {
%2 = alloca [256 x i8]
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%4 = icmp eq i8* %0, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* @stderr
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %64
8: ; preds = %1
%9 = tail call i64 @strlen(i8* %0)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = load i32, i32* @stderr
%13 = tail call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %64
14: ; preds = %8
%15 = tail call i8* @strrchr(i8* %0, i8 signext 47)
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load i32, i32* @stderr
%19 = tail call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
br label %64
20: ; preds = %14
%21 = tail call i64 @strlen(i8* %15)
%22 = sub nsw i64 %9, %21
%23 = add i64 %22, 1
%24 = tail call i64 @malloc(i64 %23)
%25 = inttoptr i64 %24 to i8*
%26 = icmp eq i64 %24, 0
br i1 %26, label %27, label %30
27: ; preds = %20
%28 = load i32, i32* @stderr
%29 = tail call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0), i8* %0)
br label %64
30: ; preds = %20
%31 = tail call i32 @memset(i8* %25, i32 0, i32 8)
%32 = tail call i32 @strncpy(i8* %25, i8* %0, i64 %22)
%33 = getelementptr inbounds i8, i8* %25, i64 %22
store i8 0, i8* %33
%34 = load i32, i32* @F_OK
%35 = tail call i64 @access(i8* %25, i32 %34)
%36 = icmp eq i64 %35, 0
br i1 %36, label %50, label %37
37: ; preds = %30
%38 = tail call i32 @mkdir_p(i8* %25, i32 416)
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %47
40: ; preds = %37
%41 = load i32, i32* @stderr
%42 = tail call i32 (i32, i8*, ...) @fprintf(i32 %41, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i8* %25)
%43 = tail call i32 @chmod(i8* %25, i32 416)
%44 = call i32 @snprintf(i8* %3, i32 256, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* %25)
%45 = call i32 @system(i8* %3)
%46 = call i32 @free(i8* %25)
br label %64
47: ; preds = %37
%48 = tail call i32 @free(i8* %25)
%49 = tail call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
br label %64
50: ; preds = %30
%51 = load i32, i32* @stderr
%52 = tail call i32 (i32, i8*, ...) @fprintf(i32 %51, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i8* %25)
%53 = tail call i32 @chmod(i8* %25, i32 416)
%54 = icmp eq i32 %53, -1
br i1 %54, label %55, label %60
55: ; preds = %50
%56 = load i32, i32* @stderr
%57 = load i32, i32* @errno
%58 = tail call i8* @strerror(i32 %57)
%59 = tail call i32 (i32, i8*, ...) @fprintf(i32 %56, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0), i8* %25, i8* %58)
br label %60
60: ; preds = %55, %50
%61 = call i32 @snprintf(i8* %3, i32 256, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* %25)
%62 = call i32 @system(i8* %3)
%63 = call i32 @free(i8* %25)
br label %64
64: ; preds = %60, %47, %40, %27, %17, %11, %5
%65 = phi i32 [ -1, %5 ], [ -1, %11 ], [ -1, %17 ], [ -1, %27 ], [ 0, %40 ], [ -1, %47 ], [ 0, %60 ]
ret i32 %65
}