#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 */
char *strrchr(char *, char);
void url_parts_canonicalize_path(char *path) {
  char *source = path;
  char *destination = path;
  char *unfixed_root = path;
  char *slash;
  while (*source != '\0') {
    if (*source != '/') {
      *destination++ = *source++;
      continue;
    }
    if (*(source + 1) == '/') {
      source++;
    } else if (*(source + 1) == '.' && *(source + 2) == '/') {
      if (unfixed_root != destination) {
        source += 2;
      } else {
        *destination++ = *source++;
        *destination++ = *source++;
        unfixed_root += 2;
      }
    } else if (*(source + 1) == '.' && *(source + 2) == '.' &&
               *(source + 3) == '/') {
      if (unfixed_root != destination) {
        source += 3;
        *destination = '\0';
        slash = strrchr(unfixed_root, '/');
        if (slash != NULL)
          destination = slash;
        else
          destination = path;
      } else {
        *destination++ = *source++;
        *destination++ = *source++;
        *destination++ = *source++;
        unfixed_root += 3;
      }
    } else {
      *destination++ = *source++;
    }
  }
  *destination = '\0';
  slash = strrchr(unfixed_root, '/');
  if (slash != NULL && slash != unfixed_root && *(slash + 1) == '.' &&
      *(slash + 2) == '\0') {
    *(slash + 1) = '\0';
  } else if (slash != NULL && slash != unfixed_root && *(slash + 1) == '.' &&
             *(slash + 2) == '.' && *(slash + 3) == '\0') {
    *slash = '\0';
    slash = strrchr(unfixed_root, '/');
    if (slash == NULL) {
      *path = '/';
      *(path + 1) = '\0';
    } else
      *(slash + 1) = '\0';
  }
}


x86 assembly (clang, -O0):
<url_parts_canonicalize_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1366 <url_parts_canonicalize_path+0x256>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
je     117b <url_parts_canonicalize_path+0x6b>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
jmp    1134 <url_parts_canonicalize_path+0x24>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x2f,%eax
jne    119d <url_parts_canonicalize_path+0x8d>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1361 <url_parts_canonicalize_path+0x251>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x2e,%eax
jne    1233 <url_parts_canonicalize_path+0x123>
mov    -0x10(%rbp),%rax
movsbl 0x2(%rax),%eax
cmp    $0x2f,%eax
jne    1233 <url_parts_canonicalize_path+0x123>
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
je     11de <url_parts_canonicalize_path+0xce>
mov    -0x10(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x10(%rbp)
jmp    122e <url_parts_canonicalize_path+0x11e>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
mov    -0x20(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x20(%rbp)
jmp    135c <url_parts_canonicalize_path+0x24c>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x2e,%eax
jne    1335 <url_parts_canonicalize_path+0x225>
mov    -0x10(%rbp),%rax
movsbl 0x2(%rax),%eax
cmp    $0x2e,%eax
jne    1335 <url_parts_canonicalize_path+0x225>
mov    -0x10(%rbp),%rax
movsbl 0x3(%rax),%eax
cmp    $0x2f,%eax
jne    1335 <url_parts_canonicalize_path+0x225>
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
je     12be <url_parts_canonicalize_path+0x1ae>
mov    -0x10(%rbp),%rax
add    $0x3,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x20(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     12b1 <url_parts_canonicalize_path+0x1a1>
mov    -0x28(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    12b9 <url_parts_canonicalize_path+0x1a9>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1330 <url_parts_canonicalize_path+0x220>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
mov    -0x20(%rbp),%rax
add    $0x3,%rax
mov    %rax,-0x20(%rbp)
jmp    1357 <url_parts_canonicalize_path+0x247>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
jmp    135c <url_parts_canonicalize_path+0x24c>
jmp    1361 <url_parts_canonicalize_path+0x251>
jmp    1134 <url_parts_canonicalize_path+0x24>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x20(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     13c7 <url_parts_canonicalize_path+0x2b7>
mov    -0x28(%rbp),%rax
cmp    -0x20(%rbp),%rax
je     13c7 <url_parts_canonicalize_path+0x2b7>
mov    -0x28(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x2e,%eax
jne    13c7 <url_parts_canonicalize_path+0x2b7>
mov    -0x28(%rbp),%rax
movsbl 0x2(%rax),%eax
cmp    $0x0,%eax
jne    13c7 <url_parts_canonicalize_path+0x2b7>
mov    -0x28(%rbp),%rax
movb   $0x0,0x1(%rax)
jmp    145d <url_parts_canonicalize_path+0x34d>
cmpq   $0x0,-0x28(%rbp)
je     1458 <url_parts_canonicalize_path+0x348>
mov    -0x28(%rbp),%rax
cmp    -0x20(%rbp),%rax
je     1458 <url_parts_canonicalize_path+0x348>
mov    -0x28(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x2e,%eax
jne    1458 <url_parts_canonicalize_path+0x348>
mov    -0x28(%rbp),%rax
movsbl 0x2(%rax),%eax
cmp    $0x2e,%eax
jne    1458 <url_parts_canonicalize_path+0x348>
mov    -0x28(%rbp),%rax
movsbl 0x3(%rax),%eax
cmp    $0x0,%eax
jne    1458 <url_parts_canonicalize_path+0x348>
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x20(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    144b <url_parts_canonicalize_path+0x33b>
mov    -0x8(%rbp),%rax
movb   $0x2f,(%rax)
mov    -0x8(%rbp),%rax
movb   $0x0,0x1(%rax)
jmp    1453 <url_parts_canonicalize_path+0x343>
mov    -0x28(%rbp),%rax
movb   $0x0,0x1(%rax)
jmp    1458 <url_parts_canonicalize_path+0x348>
jmp    145d <url_parts_canonicalize_path+0x34d>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<url_parts_canonicalize_path>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
mov    %rdi,%r12
mov    %rdi,%r15
mov    %r15,%rax
mov    %rax,%rsi
mov    %r12,%rdx
xor    %ecx,%ecx
nopl   0x0(%rax)
movzbl (%rdx,%rcx,1),%eax
test   %al,%al
je     1213 <url_parts_canonicalize_path+0x103>
cmp    $0x2f,%al
je     1150 <url_parts_canonicalize_path+0x40>
mov    %al,(%rsi,%rcx,1)
add    $0x1,%rcx
jmp    1130 <url_parts_canonicalize_path+0x20>
nopl   0x0(%rax)
lea    (%rdx,%rcx,1),%r12
add    $0x1,%r12
mov    0x1(%rdx,%rcx,1),%bl
lea    (%rsi,%rcx,1),%rax
cmp    $0x2e,%bl
je     116c <url_parts_canonicalize_path+0x5c>
cmp    $0x2f,%bl
je     1124 <url_parts_canonicalize_path+0x14>
jmp    11c0 <url_parts_canonicalize_path+0xb0>
mov    0x2(%rdx,%rcx,1),%bl
cmp    $0x2e,%bl
je     1189 <url_parts_canonicalize_path+0x79>
cmp    $0x2f,%bl
jne    11c0 <url_parts_canonicalize_path+0xb0>
lea    (%rdx,%rcx,1),%r12
add    $0x2,%r12
cmp    %r15,%rax
jne    1124 <url_parts_canonicalize_path+0x14>
jmp    11d1 <url_parts_canonicalize_path+0xc1>
cmpb   $0x2f,0x3(%rdx,%rcx,1)
jne    11c0 <url_parts_canonicalize_path+0xb0>
cmp    %r15,%rax
je     11ee <url_parts_canonicalize_path+0xde>
lea    (%rdx,%rcx,1),%r12
add    $0x3,%r12
movb   $0x0,(%rax)
mov    %r15,%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
test   %rax,%rax
cmove  %r14,%rax
jmp    1124 <url_parts_canonicalize_path+0x14>
nopl   0x0(%rax)
lea    (%rsi,%rcx,1),%rax
add    $0x1,%rax
movb   $0x2f,(%rsi,%rcx,1)
jmp    1124 <url_parts_canonicalize_path+0x14>
movb   $0x2f,(%r15)
mov    0x1(%rdx,%rcx,1),%al
mov    %al,0x1(%r15)
add    $0x2,%r15
lea    (%rdx,%rcx,1),%r12
add    $0x2,%r12
jmp    1121 <url_parts_canonicalize_path+0x11>
movb   $0x2f,(%r15)
mov    0x1(%rdx,%rcx,1),%al
mov    %al,0x1(%r15)
mov    0x2(%rdx,%rcx,1),%al
mov    %al,0x2(%r15)
add    $0x3,%r15
lea    (%rdx,%rcx,1),%r12
add    $0x3,%r12
jmp    1121 <url_parts_canonicalize_path+0x11>
movb   $0x0,(%rsi,%rcx,1)
mov    %r15,%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
test   %rax,%rax
je     1262 <url_parts_canonicalize_path+0x152>
cmp    %r15,%rax
je     1262 <url_parts_canonicalize_path+0x152>
cmpb   $0x2e,0x1(%rax)
jne    1262 <url_parts_canonicalize_path+0x152>
cmpb   $0x0,0x2(%rax)
je     125b <url_parts_canonicalize_path+0x14b>
cmpb   $0x2e,0x2(%rax)
jne    1262 <url_parts_canonicalize_path+0x152>
cmpb   $0x0,0x3(%rax)
jne    1262 <url_parts_canonicalize_path+0x152>
movb   $0x0,(%rax)
mov    %r15,%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
test   %rax,%rax
je     126e <url_parts_canonicalize_path+0x15e>
add    $0x1,%rax
movb   $0x0,(%rax)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
movb   $0x2f,(%r14)
add    $0x1,%r14
mov    %r14,%rax
jmp    125f <url_parts_canonicalize_path+0x14f>

LLVM IR (-O0):
define void @url_parts_canonicalize_path(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %2
%7 = load i8*, i8** %2
store i8* %7, i8** %3
%8 = load i8*, i8** %2
store i8* %8, i8** %4
%9 = load i8*, i8** %2
store i8* %9, i8** %5
br label %10
10: ; preds = %130, %20, %1
%11 = load i8*, i8** %3
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %131
15: ; preds = %10
%16 = load i8*, i8** %3
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp ne i32 %18, 47
br i1 %19, label %20, label %26
20: ; preds = %15
%21 = load i8*, i8** %3
%22 = getelementptr inbounds i8, i8* %21, i32 1
store i8* %22, i8** %3
%23 = load i8, i8* %21
%24 = load i8*, i8** %4
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %4
store i8 %23, i8* %24
br label %10
26: ; preds = %15
%27 = load i8*, i8** %3
%28 = getelementptr inbounds i8, i8* %27, i64 1
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 47
br i1 %31, label %32, label %35
32: ; preds = %26
%33 = load i8*, i8** %3
%34 = getelementptr inbounds i8, i8* %33, i32 1
store i8* %34, i8** %3
br label %130
35: ; preds = %26
%36 = load i8*, i8** %3
%37 = getelementptr inbounds i8, i8* %36, i64 1
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = icmp eq i32 %39, 46
br i1 %40, label %41, label %68
41: ; preds = %35
%42 = load i8*, i8** %3
%43 = getelementptr inbounds i8, i8* %42, i64 2
%44 = load i8, i8* %43
%45 = sext i8 %44 to i32
%46 = icmp eq i32 %45, 47
br i1 %46, label %47, label %68
47: ; preds = %41
%48 = load i8*, i8** %5
%49 = load i8*, i8** %4
%50 = icmp ne i8* %48, %49
br i1 %50, label %51, label %54
51: ; preds = %47
%52 = load i8*, i8** %3
%53 = getelementptr inbounds i8, i8* %52, i64 2
store i8* %53, i8** %3
br label %67
54: ; preds = %47
%55 = load i8*, i8** %3
%56 = getelementptr inbounds i8, i8* %55, i32 1
store i8* %56, i8** %3
%57 = load i8, i8* %55
%58 = load i8*, i8** %4
%59 = getelementptr inbounds i8, i8* %58, i32 1
store i8* %59, i8** %4
store i8 %57, i8* %58
%60 = load i8*, i8** %3
%61 = getelementptr inbounds i8, i8* %60, i32 1
store i8* %61, i8** %3
%62 = load i8, i8* %60
%63 = load i8*, i8** %4
%64 = getelementptr inbounds i8, i8* %63, i32 1
store i8* %64, i8** %4
store i8 %62, i8* %63
%65 = load i8*, i8** %5
%66 = getelementptr inbounds i8, i8* %65, i64 2
store i8* %66, i8** %5
br label %67
67: ; preds = %54, %51
br label %129
68: ; preds = %41, %35
%69 = load i8*, i8** %3
%70 = getelementptr inbounds i8, i8* %69, i64 1
%71 = load i8, i8* %70
%72 = sext i8 %71 to i32
%73 = icmp eq i32 %72, 46
br i1 %73, label %74, label %122
74: ; preds = %68
%75 = load i8*, i8** %3
%76 = getelementptr inbounds i8, i8* %75, i64 2
%77 = load i8, i8* %76
%78 = sext i8 %77 to i32
%79 = icmp eq i32 %78, 46
br i1 %79, label %80, label %122
80: ; preds = %74
%81 = load i8*, i8** %3
%82 = getelementptr inbounds i8, i8* %81, i64 3
%83 = load i8, i8* %82
%84 = sext i8 %83 to i32
%85 = icmp eq i32 %84, 47
br i1 %85, label %86, label %122
86: ; preds = %80
%87 = load i8*, i8** %5
%88 = load i8*, i8** %4
%89 = icmp ne i8* %87, %88
br i1 %89, label %90, label %103
90: ; preds = %86
%91 = load i8*, i8** %3
%92 = getelementptr inbounds i8, i8* %91, i64 3
store i8* %92, i8** %3
%93 = load i8*, i8** %4
store i8 0, i8* %93
%94 = load i8*, i8** %5
%95 = call i8* @strrchr(i8* %94, i8 signext 47)
store i8* %95, i8** %6
%96 = load i8*, i8** %6
%97 = icmp ne i8* %96, null
br i1 %97, label %98, label %100
98: ; preds = %90
%99 = load i8*, i8** %6
store i8* %99, i8** %4
br label %102
100: ; preds = %90
%101 = load i8*, i8** %2
store i8* %101, i8** %4
br label %102
102: ; preds = %100, %98
br label %121
103: ; preds = %86
%104 = load i8*, i8** %3
%105 = getelementptr inbounds i8, i8* %104, i32 1
store i8* %105, i8** %3
%106 = load i8, i8* %104
%107 = load i8*, i8** %4
%108 = getelementptr inbounds i8, i8* %107, i32 1
store i8* %108, i8** %4
store i8 %106, i8* %107
%109 = load i8*, i8** %3
%110 = getelementptr inbounds i8, i8* %109, i32 1
store i8* %110, i8** %3
%111 = load i8, i8* %109
%112 = load i8*, i8** %4
%113 = getelementptr inbounds i8, i8* %112, i32 1
store i8* %113, i8** %4
store i8 %111, i8* %112
%114 = load i8*, i8** %3
%115 = getelementptr inbounds i8, i8* %114, i32 1
store i8* %115, i8** %3
%116 = load i8, i8* %114
%117 = load i8*, i8** %4
%118 = getelementptr inbounds i8, i8* %117, i32 1
store i8* %118, i8** %4
store i8 %116, i8* %117
%119 = load i8*, i8** %5
%120 = getelementptr inbounds i8, i8* %119, i64 3
store i8* %120, i8** %5
br label %121
121: ; preds = %103, %102
br label %128
122: ; preds = %80, %74, %68
%123 = load i8*, i8** %3
%124 = getelementptr inbounds i8, i8* %123, i32 1
store i8* %124, i8** %3
%125 = load i8, i8* %123
%126 = load i8*, i8** %4
%127 = getelementptr inbounds i8, i8* %126, i32 1
store i8* %127, i8** %4
store i8 %125, i8* %126
br label %128
128: ; preds = %122, %121
br label %129
129: ; preds = %128, %67
br label %130
130: ; preds = %129, %32
br label %10
131: ; preds = %10
%132 = load i8*, i8** %4
store i8 0, i8* %132
%133 = load i8*, i8** %5
%134 = call i8* @strrchr(i8* %133, i8 signext 47)
store i8* %134, i8** %6
%135 = load i8*, i8** %6
%136 = icmp ne i8* %135, null
br i1 %136, label %137, label %156
137: ; preds = %131
%138 = load i8*, i8** %6
%139 = load i8*, i8** %5
%140 = icmp ne i8* %138, %139
br i1 %140, label %141, label %156
141: ; preds = %137
%142 = load i8*, i8** %6
%143 = getelementptr inbounds i8, i8* %142, i64 1
%144 = load i8, i8* %143
%145 = sext i8 %144 to i32
%146 = icmp eq i32 %145, 46
br i1 %146, label %147, label %156
147: ; preds = %141
%148 = load i8*, i8** %6
%149 = getelementptr inbounds i8, i8* %148, i64 2
%150 = load i8, i8* %149
%151 = sext i8 %150 to i32
%152 = icmp eq i32 %151, 0
br i1 %152, label %153, label %156
153: ; preds = %147
%154 = load i8*, i8** %6
%155 = getelementptr inbounds i8, i8* %154, i64 1
store i8 0, i8* %155
br label %196
156: ; preds = %147, %141, %137, %131
%157 = load i8*, i8** %6
%158 = icmp ne i8* %157, null
br i1 %158, label %159, label %195
159: ; preds = %156
%160 = load i8*, i8** %6
%161 = load i8*, i8** %5
%162 = icmp ne i8* %160, %161
br i1 %162, label %163, label %195
163: ; preds = %159
%164 = load i8*, i8** %6
%165 = getelementptr inbounds i8, i8* %164, i64 1
%166 = load i8, i8* %165
%167 = sext i8 %166 to i32
%168 = icmp eq i32 %167, 46
br i1 %168, label %169, label %195
169: ; preds = %163
%170 = load i8*, i8** %6
%171 = getelementptr inbounds i8, i8* %170, i64 2
%172 = load i8, i8* %171
%173 = sext i8 %172 to i32
%174 = icmp eq i32 %173, 46
br i1 %174, label %175, label %195
175: ; preds = %169
%176 = load i8*, i8** %6
%177 = getelementptr inbounds i8, i8* %176, i64 3
%178 = load i8, i8* %177
%179 = sext i8 %178 to i32
%180 = icmp eq i32 %179, 0
br i1 %180, label %181, label %195
181: ; preds = %175
%182 = load i8*, i8** %6
store i8 0, i8* %182
%183 = load i8*, i8** %5
%184 = call i8* @strrchr(i8* %183, i8 signext 47)
store i8* %184, i8** %6
%185 = load i8*, i8** %6
%186 = icmp eq i8* %185, null
br i1 %186, label %187, label %191
187: ; preds = %181
%188 = load i8*, i8** %2
store i8 47, i8* %188
%189 = load i8*, i8** %2
%190 = getelementptr inbounds i8, i8* %189, i64 1
store i8 0, i8* %190
br label %194
191: ; preds = %181
%192 = load i8*, i8** %6
%193 = getelementptr inbounds i8, i8* %192, i64 1
store i8 0, i8* %193
br label %194
194: ; preds = %191, %187
br label %195
195: ; preds = %194, %175, %169, %163, %159, %156
br label %196
196: ; preds = %195, %153
ret void
}

LLVM IR (-O2):
define void @url_parts_canonicalize_path(i8* %0) {
br label %2
2: ; preds = %30, %1
%3 = phi i8* [ %0, %1 ], [ %31, %30 ]
%4 = phi i8* [ %0, %1 ], [ %32, %30 ]
br label %5
5: ; preds = %18, %2
%6 = phi i8* [ %3, %2 ], [ %19, %18 ]
%7 = phi i8* [ %4, %2 ], [ %20, %18 ]
br label %8
8: ; preds = %5, %12
%9 = phi i8* [ %13, %12 ], [ %6, %5 ]
%10 = phi i8* [ %14, %12 ], [ %7, %5 ]
%11 = load i8, i8* %9
switch i8 %11, label %12 [
i8 0, label %51
i8 47, label %15
]
12: ; preds = %8
%13 = getelementptr inbounds i8, i8* %9, i64 1
%14 = getelementptr inbounds i8, i8* %10, i64 1
store i8 %11, i8* %10
br label %8
15: ; preds = %8
%16 = getelementptr inbounds i8, i8* %9, i64 1
%17 = load i8, i8* %16
switch i8 %17, label %49 [
i8 47, label %18
i8 46, label %21
]
18: ; preds = %15, %39, %24, %49
%19 = phi i8* [ %16, %49 ], [ %22, %24 ], [ %34, %39 ], [ %16, %15 ]
%20 = phi i8* [ %50, %49 ], [ %10, %24 ], [ %42, %39 ], [ %10, %15 ]
br label %5
21: ; preds = %15
%22 = getelementptr inbounds i8, i8* %9, i64 2
%23 = load i8, i8* %22
switch i8 %23, label %49 [
i8 47, label %24
i8 46, label %33
]
24: ; preds = %21
%25 = icmp eq i8* %4, %10
br i1 %25, label %26, label %18
26: ; preds = %24
%27 = getelementptr inbounds i8, i8* %4, i64 1
store i8 47, i8* %4
%28 = load i8, i8* %16
%29 = getelementptr inbounds i8, i8* %4, i64 2
store i8 %28, i8* %27
br label %30
30: ; preds = %26, %43
%31 = phi i8* [ %34, %43 ], [ %22, %26 ]
%32 = phi i8* [ %48, %43 ], [ %29, %26 ]
br label %2
33: ; preds = %21
%34 = getelementptr inbounds i8, i8* %9, i64 3
%35 = load i8, i8* %34
%36 = icmp eq i8 %35, 47
br i1 %36, label %37, label %49
37: ; preds = %33
%38 = icmp eq i8* %4, %10
br i1 %38, label %43, label %39
39: ; preds = %37
store i8 0, i8* %10
%40 = tail call i8* @strrchr(i8* dereferenceable(1) %4, i8 signext 47)
%41 = icmp eq i8* %40, null
%42 = select i1 %41, i8* %0, i8* %40
br label %18
43: ; preds = %37
%44 = getelementptr inbounds i8, i8* %4, i64 1
store i8 47, i8* %4
%45 = load i8, i8* %16
%46 = getelementptr inbounds i8, i8* %4, i64 2
store i8 %45, i8* %44
%47 = load i8, i8* %22
%48 = getelementptr inbounds i8, i8* %4, i64 3
store i8 %47, i8* %46
br label %30
49: ; preds = %21, %15, %33
%50 = getelementptr inbounds i8, i8* %10, i64 1
store i8 47, i8* %10
br label %18
51: ; preds = %8
store i8 0, i8* %10
%52 = tail call i8* @strrchr(i8* dereferenceable(1) %4, i8 signext 47)
%53 = icmp eq i8* %52, null
%54 = icmp eq i8* %52, %4
%55 = select i1 %53, i1 true, i1 %54
br i1 %55, label %81, label %56
56: ; preds = %51
%57 = getelementptr inbounds i8, i8* %52, i64 1
%58 = load i8, i8* %57
%59 = icmp eq i8 %58, 46
br i1 %59, label %60, label %81
60: ; preds = %56
%61 = getelementptr inbounds i8, i8* %52, i64 2
%62 = load i8, i8* %61
%63 = icmp eq i8 %62, 0
br i1 %63, label %79, label %64
64: ; preds = %60
%65 = getelementptr inbounds i8, i8* %52, i64 2
%66 = load i8, i8* %65
%67 = icmp eq i8 %66, 46
br i1 %67, label %68, label %81
68: ; preds = %64
%69 = getelementptr inbounds i8, i8* %52, i64 3
%70 = load i8, i8* %69
%71 = icmp eq i8 %70, 0
br i1 %71, label %72, label %81
72: ; preds = %68
store i8 0, i8* %52
%73 = tail call i8* @strrchr(i8* dereferenceable(1) %4, i8 signext 47)
%74 = icmp eq i8* %73, null
br i1 %74, label %75, label %77
75: ; preds = %72
store i8 47, i8* %0
%76 = getelementptr inbounds i8, i8* %0, i64 1
br label %79
77: ; preds = %72
%78 = getelementptr inbounds i8, i8* %73, i64 1
br label %79
79: ; preds = %60, %75, %77
%80 = phi i8* [ %78, %77 ], [ %76, %75 ], [ %57, %60 ]
store i8 0, i8* %80
br label %81
81: ; preds = %79, %56, %51, %64, %68
ret void
}