#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 *);
int /*<<< orphan*/ memcpy(char *, char const *, int);
void CreatePath(const char *path) {
  const char *ofs;
  char c;
  char dir[1024];
  if (path[1] == ':')
    path += 2;
  for (ofs = path + 1; *ofs; ofs++) {
    c = *ofs;
    if (c == '/' || c == '\\') {
      memcpy(dir, path, ofs - path);
      dir[ofs - path] = 0;
      Q_mkdir(dir);
    }
  }
}


x86 assembly (clang, -O0):
<CreatePath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x3a,%eax
jne    114c <CreatePath+0x2c>
mov    -0x8(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11da <CreatePath+0xba>
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
cmp    $0x2f,%eax
je     1188 <CreatePath+0x68>
movsbl -0x11(%rbp),%eax
cmp    $0x5c,%eax
jne    11c4 <CreatePath+0xa4>
lea    -0x420(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%edx
call   1040 <memcpy@plt>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
movb   $0x0,-0x420(%rbp,%rax,1)
lea    -0x420(%rbp),%rdi
call   1030 <Q_mkdir@plt>
jmp    11c9 <CreatePath+0xa9>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1158 <CreatePath+0x38>
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CreatePath>:
push   %r15
push   %r14
push   %rbx
sub    $0x400,%rsp
xor    %eax,%eax
cmpb   $0x3a,0x1(%rdi)
sete   %al
lea    (%rdi,%rax,2),%r14
mov    $0x1,%ebx
mov    %rsp,%r15
jmp    116d <CreatePath+0x4d>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
call   1040 <memcpy@plt>
movb   $0x0,(%rsp,%rbx,1)
mov    %r15,%rdi
call   1030 <Q_mkdir@plt>
add    $0x1,%rbx
movzbl (%r14,%rbx,1),%eax
cmp    $0x2f,%al
je     1150 <CreatePath+0x30>
cmp    $0x5c,%al
je     1150 <CreatePath+0x30>
test   %al,%al
je     1184 <CreatePath+0x64>
add    $0x1,%rbx
jmp    116d <CreatePath+0x4d>
add    $0x400,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @CreatePath(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8
%5 = alloca [1024 x i8]
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 58
br i1 %10, label %11, label %14
11: ; preds = %1
%12 = load i8*, i8** %2
%13 = getelementptr inbounds i8, i8* %12, i64 2
store i8* %13, i8** %2
br label %14
14: ; preds = %11, %1
%15 = load i8*, i8** %2
%16 = getelementptr inbounds i8, i8* %15, i64 1
store i8* %16, i8** %3
br label %17
17: ; preds = %50, %14
%18 = load i8*, i8** %3
%19 = load i8, i8* %18
%20 = icmp ne i8 %19, 0
br i1 %20, label %21, label %53
21: ; preds = %17
%22 = load i8*, i8** %3
%23 = load i8, i8* %22
store i8 %23, i8* %4
%24 = load i8, i8* %4
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 47
br i1 %26, label %31, label %27
27: ; preds = %21
%28 = load i8, i8* %4
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 92
br i1 %30, label %31, label %49
31: ; preds = %27, %21
%32 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%33 = load i8*, i8** %2
%34 = load i8*, i8** %3
%35 = load i8*, i8** %2
%36 = ptrtoint i8* %34 to i64
%37 = ptrtoint i8* %35 to i64
%38 = sub i64 %36, %37
%39 = trunc i64 %38 to i32
%40 = call i32 @memcpy(i8* %32, i8* %33, i32 %39)
%41 = load i8*, i8** %3
%42 = load i8*, i8** %2
%43 = ptrtoint i8* %41 to i64
%44 = ptrtoint i8* %42 to i64
%45 = sub i64 %43, %44
%46 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %45
store i8 0, i8* %46
%47 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%48 = call i32 @Q_mkdir(i8* %47)
br label %49
49: ; preds = %31, %27
br label %50
50: ; preds = %49
%51 = load i8*, i8** %3
%52 = getelementptr inbounds i8, i8* %51, i32 1
store i8* %52, i8** %3
br label %17
53: ; preds = %17
ret void
}

LLVM IR (-O2):
define void @CreatePath(i8* %0) {
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 58
%7 = select i1 %6, i64 2, i64 0
%8 = getelementptr i8, i8* %0, i64 %7
%9 = ptrtoint i8* %8 to i64
br label %10
10: ; preds = %14, %1
%11 = phi i8* [ %8, %1 ], [ %12, %14 ]
%12 = getelementptr inbounds i8, i8* %11, i64 1
%13 = load i8, i8* %12
switch i8 %13, label %14 [
i8 0, label %22
i8 92, label %15
i8 47, label %15
]
14: ; preds = %10, %15
br label %10
15: ; preds = %10, %10
%16 = ptrtoint i8* %12 to i64
%17 = sub i64 %16, %9
%18 = trunc i64 %17 to i32
%19 = call i32 @memcpy(i8* %3, i8* %8, i32 %18)
%20 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %17
store i8 0, i8* %20
%21 = call i32 @Q_mkdir(i8* %3)
br label %14
22: ; preds = %10
ret void
}