#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*/ Q_mkdir(char *);
void CreatePath(char *path) {
  char *ofs, c;
  for (ofs = path + 1; *ofs; ofs++) {
    c = *ofs;
    if (c == '/' || c == '\\') {
      *ofs = 0;
      Q_mkdir(path);
      *ofs = c;
    }
  }
}


x86 assembly (clang, -O0):
<CreatePath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1187 <CreatePath+0x77>
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
cmp    $0x2f,%eax
je     1158 <CreatePath+0x48>
movsbl -0x11(%rbp),%eax
cmp    $0x5c,%eax
jne    1171 <CreatePath+0x61>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
call   1030 <Q_mkdir@plt>
mov    -0x11(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
jmp    1176 <CreatePath+0x66>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1128 <CreatePath+0x18>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CreatePath>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
lea    0x1(%rdi),%r15
jmp    1133 <CreatePath+0x23>
xchg   %ax,%ax
movb   $0x0,(%r15)
mov    %r14,%rdi
call   1030 <Q_mkdir@plt>
mov    %bl,(%r15)
add    $0x1,%r15
movzbl (%r15),%ebx
cmp    $0x2f,%bl
je     1120 <CreatePath+0x10>
cmp    $0x5c,%bl
je     1120 <CreatePath+0x10>
test   %bl,%bl
je     114b <CreatePath+0x3b>
add    $0x1,%r15
jmp    1133 <CreatePath+0x23>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @CreatePath(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = getelementptr inbounds i8, i8* %5, i64 1
store i8* %6, i8** %3
br label %7
7: ; preds = %28, %1
%8 = load i8*, i8** %3
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 0
br i1 %10, label %11, label %31
11: ; preds = %7
%12 = load i8*, i8** %3
%13 = load i8, i8* %12
store i8 %13, i8* %4
%14 = load i8, i8* %4
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 47
br i1 %16, label %21, label %17
17: ; preds = %11
%18 = load i8, i8* %4
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 92
br i1 %20, label %21, label %27
21: ; preds = %17, %11
%22 = load i8*, i8** %3
store i8 0, i8* %22
%23 = load i8*, i8** %2
%24 = call i32 @Q_mkdir(i8* %23)
%25 = load i8, i8* %4
%26 = load i8*, i8** %3
store i8 %25, i8* %26
br label %27
27: ; preds = %21, %17
br label %28
28: ; preds = %27
%29 = load i8*, i8** %3
%30 = getelementptr inbounds i8, i8* %29, i32 1
store i8* %30, i8** %3
br label %7
31: ; preds = %7
ret void
}

LLVM IR (-O2):
define void @CreatePath(i8* %0) {
br label %2
2: ; preds = %6, %1
%3 = phi i8* [ %0, %1 ], [ %4, %6 ]
%4 = getelementptr inbounds i8, i8* %3, i64 1
%5 = load i8, i8* %4
switch i8 %5, label %6 [
i8 0, label %9
i8 92, label %7
i8 47, label %7
]
6: ; preds = %2, %7
br label %2
7: ; preds = %2, %2
store i8 0, i8* %4
%8 = tail call i32 @Q_mkdir(i8* %0)
store i8 %5, i8* %4
br label %6
9: ; preds = %2
ret void
}