#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*/ test_canon(char *, char *, int);
void test_canon_all(void) {
  test_canon("./hello///there//..//tim/./file.", "hello/tim/file.", 50);
  test_canon("./hello///there//..//tim/./file../.dir/",
             "hello/tim/file../.dir/", 54);
  test_canon("../", "../", 58);
  test_canon("..", "..", 59);
  test_canon("./..", "..", 60);
  test_canon("../..", "../..", 61);
  test_canon("./../../", "../../", 62);
  test_canon("../../hi", "../../hi", 63);
  test_canon("hi/../../", "../", 64);
  test_canon("../../hi/../..//../", "../../../../", 66);
  test_canon("/usr/include/hi", "/usr/include/hi", 68);
  test_canon("///usr/include/hi", "/usr/include/hi", 69);
}


x86 assembly (clang, -O0):
<test_canon_all>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xeff(%rip),%rsi
mov    $0x32,%edx
call   1030 <test_canon@plt>
lea    0xefe(%rip),%rdi
lea    0xf1f(%rip),%rsi
mov    $0x36,%edx
call   1030 <test_canon@plt>
lea    0xf5b(%rip),%rsi
mov    $0x3a,%edx
mov    %rsi,%rdi
call   1030 <test_canon@plt>
lea    0xf14(%rip),%rsi
mov    $0x3b,%edx
mov    %rsi,%rdi
call   1030 <test_canon@plt>
lea    0xefe(%rip),%rdi
lea    0xef9(%rip),%rsi
mov    $0x3c,%edx
call   1030 <test_canon@plt>
lea    0xee5(%rip),%rsi
mov    $0x3d,%edx
mov    %rsi,%rdi
call   1030 <test_canon@plt>
lea    0xf02(%rip),%rdi
lea    0xefd(%rip),%rsi
mov    $0x3e,%edx
call   1030 <test_canon@plt>
lea    0xebf(%rip),%rsi
mov    $0x3f,%edx
mov    %rsi,%rdi
call   1030 <test_canon@plt>
lea    0xeb4(%rip),%rdi
lea    0xed4(%rip),%rsi
mov    $0x40,%edx
call   1030 <test_canon@plt>
lea    0xea6(%rip),%rdi
lea    0xeb3(%rip),%rsi
mov    $0x42,%edx
call   1030 <test_canon@plt>
lea    0xeb1(%rip),%rsi
mov    $0x44,%edx
mov    %rsi,%rdi
call   1030 <test_canon@plt>
lea    0xe9b(%rip),%rdi
lea    0xe96(%rip),%rsi
mov    $0x45,%edx
call   1030 <test_canon@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_canon_all>:
push   %r14
push   %rbx
push   %rax
lea    0xee5(%rip),%rdi
lea    0xeff(%rip),%rsi
mov    $0x32,%edx
call   1030 <test_canon@plt>
lea    0xefe(%rip),%rdi
lea    0xf1f(%rip),%rsi
mov    $0x36,%edx
call   1030 <test_canon@plt>
lea    0xf5b(%rip),%r14
mov    %r14,%rdi
mov    %r14,%rsi
mov    $0x3a,%edx
call   1030 <test_canon@plt>
lea    0xf11(%rip),%rbx
mov    %rbx,%rdi
mov    %rbx,%rsi
mov    $0x3b,%edx
call   1030 <test_canon@plt>
lea    0xef8(%rip),%rdi
mov    %rbx,%rsi
mov    $0x3c,%edx
call   1030 <test_canon@plt>
lea    0xee3(%rip),%rdi
mov    %rdi,%rsi
mov    $0x3d,%edx
call   1030 <test_canon@plt>
lea    0xf00(%rip),%rdi
lea    0xefb(%rip),%rsi
mov    $0x3e,%edx
call   1030 <test_canon@plt>
lea    0xebd(%rip),%rdi
mov    %rdi,%rsi
mov    $0x3f,%edx
call   1030 <test_canon@plt>
lea    0xeb2(%rip),%rdi
mov    %r14,%rsi
mov    $0x40,%edx
call   1030 <test_canon@plt>
lea    0xea8(%rip),%rdi
lea    0xeb5(%rip),%rsi
mov    $0x42,%edx
call   1030 <test_canon@plt>
lea    0xeb3(%rip),%rbx
mov    %rbx,%rdi
mov    %rbx,%rsi
mov    $0x44,%edx
call   1030 <test_canon@plt>
lea    0xe9a(%rip),%rdi
mov    %rbx,%rsi
mov    $0x45,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <test_canon@plt>

LLVM IR (-O0):
@.str = [33 x i8] c"./hello///there//..//tim/./file.\00"
@.str.1 = [16 x i8] c"hello/tim/file.\00"
@.str.2 = [40 x i8] c"./hello///there//..//tim/./file../.dir/\00"
@.str.3 = [23 x i8] c"hello/tim/file../.dir/\00"
@.str.4 = [4 x i8] c"../\00"
@.str.5 = [3 x i8] c"..\00"
@.str.6 = [5 x i8] c"./..\00"
@.str.7 = [6 x i8] c"../..\00"
@.str.8 = [9 x i8] c"./../../\00"
@.str.9 = [7 x i8] c"../../\00"
@.str.10 = [9 x i8] c"../../hi\00"
@.str.11 = [10 x i8] c"hi/../../\00"
@.str.12 = [20 x i8] c"../../hi/../..//../\00"
@.str.13 = [13 x i8] c"../../../../\00"
@.str.14 = [16 x i8] c"/usr/include/hi\00"
@.str.15 = [18 x i8] c"///usr/include/hi\00"
define void @test_canon_all() {
%1 = call i32 @test_canon(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 50)
%2 = call i32 @test_canon(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 54)
%3 = call i32 @test_canon(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 58)
%4 = call i32 @test_canon(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 59)
%5 = call i32 @test_canon(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 60)
%6 = call i32 @test_canon(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32 61)
%7 = call i32 @test_canon(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i32 62)
%8 = call i32 @test_canon(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i32 63)
%9 = call i32 @test_canon(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 64)
%10 = call i32 @test_canon(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0), i32 66)
%11 = call i32 @test_canon(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.14, i64 0, i64 0), i32 68)
%12 = call i32 @test_canon(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.14, i64 0, i64 0), i32 69)
ret void
}

LLVM IR (-O2):
@.str = [33 x i8] c"./hello///there//..//tim/./file.\00"
@.str.1 = [16 x i8] c"hello/tim/file.\00"
@.str.2 = [40 x i8] c"./hello///there//..//tim/./file../.dir/\00"
@.str.3 = [23 x i8] c"hello/tim/file../.dir/\00"
@.str.4 = [4 x i8] c"../\00"
@.str.5 = [3 x i8] c"..\00"
@.str.6 = [5 x i8] c"./..\00"
@.str.7 = [6 x i8] c"../..\00"
@.str.8 = [9 x i8] c"./../../\00"
@.str.9 = [7 x i8] c"../../\00"
@.str.10 = [9 x i8] c"../../hi\00"
@.str.11 = [10 x i8] c"hi/../../\00"
@.str.12 = [20 x i8] c"../../hi/../..//../\00"
@.str.13 = [13 x i8] c"../../../../\00"
@.str.14 = [16 x i8] c"/usr/include/hi\00"
@.str.15 = [18 x i8] c"///usr/include/hi\00"
define void @test_canon_all() {
%1 = tail call i32 @test_canon(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 50)
%2 = tail call i32 @test_canon(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 54)
%3 = tail call i32 @test_canon(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 58)
%4 = tail call i32 @test_canon(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 59)
%5 = tail call i32 @test_canon(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 60)
%6 = tail call i32 @test_canon(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32 61)
%7 = tail call i32 @test_canon(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i32 62)
%8 = tail call i32 @test_canon(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i32 63)
%9 = tail call i32 @test_canon(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 64)
%10 = tail call i32 @test_canon(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0), i32 66)
%11 = tail call i32 @test_canon(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.14, i64 0, i64 0), i32 68)
%12 = tail call i32 @test_canon(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.14, i64 0, i64 0), i32 69)
ret void
}