#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 */
void copyThruSlash(char **toString, char **fromString) {
  char *to = *toString;
  char *from = *fromString;
  while (1) {
    *to = *from;
    if (*from == '\0') {
      *fromString = NULL;
      return;
    }
    if (*from == '/') {
      *toString = to + 1;
      *fromString = from + 1;
      return;
    }
    from++;
    to++;
  }
}


x86 assembly (clang, -O0):
<copyThruSlash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    114e <copyThruSlash+0x4e>
mov    -0x10(%rbp),%rax
movq   $0x0,(%rax)
jmp    119e <copyThruSlash+0x9e>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    1181 <copyThruSlash+0x81>
mov    -0x18(%rbp),%rcx
add    $0x1,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rcx
add    $0x1,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
jmp    119e <copyThruSlash+0x9e>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1122 <copyThruSlash+0x22>
pop    %rbp
ret

x86 assembly (clang, -O2):
<copyThruSlash>:
mov    (%rdi),%rcx
mov    (%rsi),%rax
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%rcx
add    $0x1,%rax
movzbl -0x1(%rax),%edx
mov    %dl,-0x1(%rcx)
movzbl -0x1(%rax),%edx
test   %dl,%dl
je     1133 <copyThruSlash+0x33>
cmp    $0x2f,%dl
jne    1110 <copyThruSlash+0x10>
mov    %rcx,(%rdi)
mov    %rax,(%rsi)
ret
xor    %eax,%eax
mov    %rax,(%rsi)
ret

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

LLVM IR (-O2):
define void @copyThruSlash(i8** nocapture %0, i8** nocapture %1) {
%3 = load i8*, i8** %0
%4 = load i8*, i8** %1
br label %5
5: ; preds = %13, %2
%6 = phi i8* [ %3, %2 ], [ %15, %13 ]
%7 = phi i8* [ %4, %2 ], [ %14, %13 ]
%8 = load i8, i8* %7
store i8 %8, i8* %6
%9 = load i8, i8* %7
switch i8 %9, label %13 [
i8 0, label %16
i8 47, label %10
]
10: ; preds = %5
%11 = getelementptr inbounds i8, i8* %6, i64 1
store i8* %11, i8** %0
%12 = getelementptr inbounds i8, i8* %7, i64 1
br label %16
13: ; preds = %5
%14 = getelementptr inbounds i8, i8* %7, i64 1
%15 = getelementptr inbounds i8, i8* %6, i64 1
br label %5
16: ; preds = %5, %10
%17 = phi i8* [ %12, %10 ], [ null, %5 ]
store i8* %17, i8** %1
ret void
}