#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_normalize(char *, char *);
void test_path_normalize(void) {
  test_normalize("/a/b/c", "/a/b/c");
  test_normalize("/foo/bar//baz/asdf/quux/..", "/foo/bar/baz/asdf");
  test_normalize("/", "/");
  test_normalize("", ".");
  test_normalize("//", "/");
  test_normalize("//...//..././", "/.../...");
  test_normalize(".", ".");
  test_normalize("./", ".");
  test_normalize("./..", "..");
  test_normalize("./a/..", ".");
  test_normalize("a/..", ".");
  test_normalize("..", "..");
  test_normalize("../", "..");
  test_normalize("a/b../c./", "a/b../c.");
  test_normalize("/a/b/../../../../", "/");
  test_normalize("a/b/../../../../", "../..");
  test_normalize("./fixtures///b/../b/c.js", "fixtures/b/c.js");
  test_normalize("/foo/../../../bar", "/bar");
  test_normalize("a//b//../b", "a/b");
  test_normalize("a//b//./c", "a/b/c");
  test_normalize("a//b//.", "a/b");
}


x86 assembly (clang, -O0):
<test_path_normalize>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rsi
mov    %rsi,%rdi
call   1030 <test_normalize@plt>
lea    0xedd(%rip),%rdi
lea    0xef1(%rip),%rsi
call   1030 <test_normalize@plt>
lea    0xf3b(%rip),%rsi
mov    %rsi,%rdi
call   1030 <test_normalize@plt>
lea    0xf01(%rip),%rdi
lea    0xef9(%rip),%rsi
call   1030 <test_normalize@plt>
lea    0xed5(%rip),%rdi
lea    0xf12(%rip),%rsi
call   1030 <test_normalize@plt>
lea    0xec5(%rip),%rdi
lea    0xecc(%rip),%rsi
call   1030 <test_normalize@plt>
lea    0xec7(%rip),%rsi
mov    %rsi,%rdi
call   1030 <test_normalize@plt>
lea    0xee3(%rip),%rdi
lea    0xeb1(%rip),%rsi
call   1030 <test_normalize@plt>
lea    0xed4(%rip),%rdi
lea    0xe9d(%rip),%rsi
call   1030 <test_normalize@plt>
lea    0xe94(%rip),%rdi
lea    0xe8b(%rip),%rsi
call   1030 <test_normalize@plt>
lea    0xe83(%rip),%rdi
lea    0xe78(%rip),%rsi
call   1030 <test_normalize@plt>
lea    0xe6b(%rip),%rsi
mov    %rsi,%rdi
call   1030 <test_normalize@plt>
lea    0xe87(%rip),%rdi
lea    0xe55(%rip),%rsi
call   1030 <test_normalize@plt>
lea    0xe53(%rip),%rdi
lea    0xe56(%rip),%rsi
call   1030 <test_normalize@plt>
lea    0xe53(%rip),%rdi
lea    0xe5c(%rip),%rsi
call   1030 <test_normalize@plt>
lea    0xe41(%rip),%rdi
lea    0xe4b(%rip),%rsi
call   1030 <test_normalize@plt>
lea    0xe45(%rip),%rdi
lea    0xe57(%rip),%rsi
call   1030 <test_normalize@plt>
lea    0xe5b(%rip),%rdi
lea    0xe61(%rip),%rsi
call   1030 <test_normalize@plt>
lea    0xe5a(%rip),%rdi
lea    0xe5e(%rip),%rsi
call   1030 <test_normalize@plt>
lea    0xe56(%rip),%rdi
lea    0xd86(%rip),%rsi
call   1030 <test_normalize@plt>
lea    0xe4d(%rip),%rdi
lea    0xe38(%rip),%rsi
call   1030 <test_normalize@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_path_normalize>:
push   %r15
push   %r14
push   %rbx
lea    0xee4(%rip),%rdi
mov    %rdi,%rsi
call   1030 <test_normalize@plt>
lea    0xedc(%rip),%rdi
lea    0xef0(%rip),%rsi
call   1030 <test_normalize@plt>
lea    0xf3a(%rip),%r14
mov    %r14,%rdi
mov    %r14,%rsi
call   1030 <test_normalize@plt>
lea    0xefd(%rip),%rdi
lea    0xef5(%rip),%r15
mov    %r15,%rsi
call   1030 <test_normalize@plt>
lea    0xece(%rip),%rdi
mov    %r14,%rsi
call   1030 <test_normalize@plt>
lea    0xec2(%rip),%rdi
lea    0xec9(%rip),%rsi
call   1030 <test_normalize@plt>
mov    %r15,%rdi
mov    %r15,%rsi
call   1030 <test_normalize@plt>
lea    0xee4(%rip),%rdi
mov    %r15,%rsi
call   1030 <test_normalize@plt>
lea    0xed9(%rip),%rdi
lea    0xea2(%rip),%rbx
mov    %rbx,%rsi
call   1030 <test_normalize@plt>
lea    0xe96(%rip),%rdi
mov    %r15,%rsi
call   1030 <test_normalize@plt>
lea    0xe89(%rip),%rdi
mov    %r15,%rsi
call   1030 <test_normalize@plt>
mov    %rbx,%rdi
mov    %rbx,%rsi
call   1030 <test_normalize@plt>
lea    0xe95(%rip),%rdi
mov    %rbx,%rsi
call   1030 <test_normalize@plt>
lea    0xe65(%rip),%rdi
lea    0xe68(%rip),%rsi
call   1030 <test_normalize@plt>
lea    0xe65(%rip),%rdi
mov    %r14,%rsi
call   1030 <test_normalize@plt>
lea    0xe57(%rip),%rdi
lea    0xe61(%rip),%rsi
call   1030 <test_normalize@plt>
lea    0xe5b(%rip),%rdi
lea    0xe6d(%rip),%rsi
call   1030 <test_normalize@plt>
lea    0xe71(%rip),%rdi
lea    0xe77(%rip),%rsi
call   1030 <test_normalize@plt>
lea    0xe70(%rip),%rdi
lea    0xe74(%rip),%rbx
mov    %rbx,%rsi
call   1030 <test_normalize@plt>
lea    0xe69(%rip),%rdi
lea    0xd99(%rip),%rsi
call   1030 <test_normalize@plt>
lea    0xe60(%rip),%rdi
mov    %rbx,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <test_normalize@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"/a/b/c\00"
@.str.1 = [27 x i8] c"/foo/bar//baz/asdf/quux/..\00"
@.str.2 = [18 x i8] c"/foo/bar/baz/asdf\00"
@.str.3 = [2 x i8] c"/\00"
@.str.4 = [1 x i8] zeroinitializer
@.str.5 = [2 x i8] c".\00"
@.str.6 = [3 x i8] c"//\00"
@.str.7 = [14 x i8] c"//...//..././\00"
@.str.8 = [9 x i8] c"/.../...\00"
@.str.9 = [3 x i8] c"./\00"
@.str.10 = [5 x i8] c"./..\00"
@.str.11 = [3 x i8] c"..\00"
@.str.12 = [7 x i8] c"./a/..\00"
@.str.13 = [5 x i8] c"a/..\00"
@.str.14 = [4 x i8] c"../\00"
@.str.15 = [10 x i8] c"a/b../c./\00"
@.str.16 = [9 x i8] c"a/b../c.\00"
@.str.17 = [18 x i8] c"/a/b/../../../../\00"
@.str.18 = [17 x i8] c"a/b/../../../../\00"
@.str.19 = [6 x i8] c"../..\00"
@.str.20 = [25 x i8] c"./fixtures///b/../b/c.js\00"
@.str.21 = [16 x i8] c"fixtures/b/c.js\00"
@.str.22 = [18 x i8] c"/foo/../../../bar\00"
@.str.23 = [5 x i8] c"/bar\00"
@.str.24 = [11 x i8] c"a//b//../b\00"
@.str.25 = [4 x i8] c"a/b\00"
@.str.26 = [10 x i8] c"a//b//./c\00"
@.str.27 = [6 x i8] c"a/b/c\00"
@.str.28 = [8 x i8] c"a//b//.\00"
define void @test_path_normalize() {
%1 = call i32 @test_normalize(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @test_normalize(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%3 = call i32 @test_normalize(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%4 = call i32 @test_normalize(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%5 = call i32 @test_normalize(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%6 = call i32 @test_normalize(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
%7 = call i32 @test_normalize(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%8 = call i32 @test_normalize(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%9 = call i32 @test_normalize(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
%10 = call i32 @test_normalize(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%11 = call i32 @test_normalize(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%12 = call i32 @test_normalize(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
%13 = call i32 @test_normalize(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
%14 = call i32 @test_normalize(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.16, i64 0, i64 0))
%15 = call i32 @test_normalize(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.17, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%16 = call i32 @test_normalize(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.19, i64 0, i64 0))
%17 = call i32 @test_normalize(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.20, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.21, i64 0, i64 0))
%18 = call i32 @test_normalize(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.22, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.23, i64 0, i64 0))
%19 = call i32 @test_normalize(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.24, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.25, i64 0, i64 0))
%20 = call i32 @test_normalize(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.26, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.27, i64 0, i64 0))
%21 = call i32 @test_normalize(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.28, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.25, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"/a/b/c\00"
@.str.1 = [27 x i8] c"/foo/bar//baz/asdf/quux/..\00"
@.str.2 = [18 x i8] c"/foo/bar/baz/asdf\00"
@.str.3 = [2 x i8] c"/\00"
@.str.4 = [1 x i8] zeroinitializer
@.str.5 = [2 x i8] c".\00"
@.str.6 = [3 x i8] c"//\00"
@.str.7 = [14 x i8] c"//...//..././\00"
@.str.8 = [9 x i8] c"/.../...\00"
@.str.9 = [3 x i8] c"./\00"
@.str.10 = [5 x i8] c"./..\00"
@.str.11 = [3 x i8] c"..\00"
@.str.12 = [7 x i8] c"./a/..\00"
@.str.13 = [5 x i8] c"a/..\00"
@.str.14 = [4 x i8] c"../\00"
@.str.15 = [10 x i8] c"a/b../c./\00"
@.str.16 = [9 x i8] c"a/b../c.\00"
@.str.17 = [18 x i8] c"/a/b/../../../../\00"
@.str.18 = [17 x i8] c"a/b/../../../../\00"
@.str.19 = [6 x i8] c"../..\00"
@.str.20 = [25 x i8] c"./fixtures///b/../b/c.js\00"
@.str.21 = [16 x i8] c"fixtures/b/c.js\00"
@.str.22 = [18 x i8] c"/foo/../../../bar\00"
@.str.23 = [5 x i8] c"/bar\00"
@.str.24 = [11 x i8] c"a//b//../b\00"
@.str.25 = [4 x i8] c"a/b\00"
@.str.26 = [10 x i8] c"a//b//./c\00"
@.str.27 = [6 x i8] c"a/b/c\00"
@.str.28 = [8 x i8] c"a//b//.\00"
define void @test_path_normalize() {
%1 = tail call i32 @test_normalize(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @test_normalize(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%3 = tail call i32 @test_normalize(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%4 = tail call i32 @test_normalize(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%5 = tail call i32 @test_normalize(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%6 = tail call i32 @test_normalize(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
%7 = tail call i32 @test_normalize(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%8 = tail call i32 @test_normalize(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%9 = tail call i32 @test_normalize(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
%10 = tail call i32 @test_normalize(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%11 = tail call i32 @test_normalize(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%12 = tail call i32 @test_normalize(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
%13 = tail call i32 @test_normalize(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
%14 = tail call i32 @test_normalize(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.16, i64 0, i64 0))
%15 = tail call i32 @test_normalize(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.17, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%16 = tail call i32 @test_normalize(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.19, i64 0, i64 0))
%17 = tail call i32 @test_normalize(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.20, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.21, i64 0, i64 0))
%18 = tail call i32 @test_normalize(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.22, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.23, i64 0, i64 0))
%19 = tail call i32 @test_normalize(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.24, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.25, i64 0, i64 0))
%20 = tail call i32 @test_normalize(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.26, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.27, i64 0, i64 0))
%21 = tail call i32 @test_normalize(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.28, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.25, i64 0, i64 0))
ret void
}