#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*/ Exit(char *);
int S_IRGRP;
int S_IRWXU;
int S_IXGRP;
scalar_t__ mkdir(char *, int);
void Folder(char *path) {
  int i;
  for (i = 0; path[i]; i++) {
    if ((path[i] == '/') || (path[i] == '\\')) {
      path[i] = 0;
      if (mkdir(path, S_IRWXU | S_IRGRP | S_IXGRP) > 0)
        Exit("Make directory error\n");
      path[i] = '/';
    }
  }
}


x86 assembly (clang, -O0):
<Folder>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     11d4 <Folder+0xb4>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2f,%eax
je     116f <Folder+0x4f>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5c,%eax
jne    11c1 <Folder+0xa1>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rdi
mov    0x2e62(%rip),%rax
mov    (%rax),%esi
mov    0x2e41(%rip),%rax
or     (%rax),%esi
mov    0x2e48(%rip),%rax
or     (%rax),%esi
call   1030 <mkdir@plt>
cmp    $0x0,%rax
jle    11b5 <Folder+0x95>
lea    0xe50(%rip),%rdi
call   1040 <Exit@plt>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x2f,(%rax,%rcx,1)
jmp    11c6 <Folder+0xa6>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <Folder+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Folder>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2eb3(%rip),%r15
mov    0x2e94(%rip),%r12
mov    0x2e9d(%rip),%r13
lea    0xeb6(%rip),%r14
mov    %rdi,%rbp
jmp    1158 <Folder+0x38>
nop
test   %al,%al
je     118e <Folder+0x6e>
add    $0x1,%rbp
movzbl 0x0(%rbp),%eax
cmp    $0x2f,%al
je     1164 <Folder+0x44>
cmp    $0x5c,%al
jne    1150 <Folder+0x30>
movb   $0x0,0x0(%rbp)
mov    (%r12),%esi
or     (%r15),%esi
or     0x0(%r13),%esi
mov    %rbx,%rdi
call   1030 <mkdir@plt>
test   %rax,%rax
jle    1188 <Folder+0x68>
mov    %r14,%rdi
call   1040 <Exit@plt>
movb   $0x2f,0x0(%rbp)
jmp    1154 <Folder+0x34>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@S_IRWXU = global i32 0
@S_IRGRP = global i32 0
@S_IXGRP = global i32 0
@.str = [22 x i8] c"Make directory error\0A\00"
define void @Folder(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %48, %1
%5 = load i8*, i8** %2
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %5, i64 %7
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 0
br i1 %10, label %11, label %51
11: ; preds = %4
%12 = load i8*, i8** %2
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 47
br i1 %18, label %27, label %19
19: ; preds = %11
%20 = load i8*, i8** %2
%21 = load i32, i32* %3
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %20, i64 %22
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 92
br i1 %26, label %27, label %47
27: ; preds = %19, %11
%28 = load i8*, i8** %2
%29 = load i32, i32* %3
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %28, i64 %30
store i8 0, i8* %31
%32 = load i8*, i8** %2
%33 = load i32, i32* @S_IRWXU
%34 = load i32, i32* @S_IRGRP
%35 = or i32 %33, %34
%36 = load i32, i32* @S_IXGRP
%37 = or i32 %35, %36
%38 = call i64 @mkdir(i8* %32, i32 %37)
%39 = icmp sgt i64 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %27
%41 = call i32 @Exit(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %42
42: ; preds = %40, %27
%43 = load i8*, i8** %2
%44 = load i32, i32* %3
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i8, i8* %43, i64 %45
store i8 47, i8* %46
br label %47
47: ; preds = %42, %19
br label %48
48: ; preds = %47
%49 = load i32, i32* %3
%50 = add nsw i32 %49, 1
store i32 %50, i32* %3
br label %4
51: ; preds = %4
ret void
}

LLVM IR (-O2):
@S_IRWXU = global i32 0
@S_IRGRP = global i32 0
@S_IXGRP = global i32 0
@.str = [22 x i8] c"Make directory error\0A\00"
define void @Folder(i8* nocapture %0) {
br label %2
2: ; preds = %17, %1
%3 = phi i64 [ %18, %17 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
switch i8 %5, label %17 [
i8 0, label %19
i8 47, label %6
i8 92, label %6
]
6: ; preds = %2, %2
store i8 0, i8* %4
%7 = load i32, i32* @S_IRWXU
%8 = load i32, i32* @S_IRGRP
%9 = or i32 %8, %7
%10 = load i32, i32* @S_IXGRP
%11 = or i32 %9, %10
%12 = tail call i64 @mkdir(i8* %0, i32 %11)
%13 = icmp sgt i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %6
%15 = tail call i32 @Exit(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %16
16: ; preds = %14, %6
store i8 47, i8* %4
br label %17
17: ; preds = %2, %16
%18 = add nuw i64 %3, 1
br label %2
19: ; preds = %2
ret void
}