#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*/ printf(char *);
int /*<<< orphan*/ test(char *);
int main(int argc, char *argv[]) {
  printf("\n");
  test("foo////bar//.//.././x");
  test("foo////bar//.//.././x/");
  test(".");
  test("foo/.");
  test("foo/bar/..");
  test("foo/bar/../");
  test("foo/bar/../..");
  test("foo/bar/../../");
  test("/foo/.");
  test("/foo/bar/..");
  test("/foo/bar/../");
  test("/foo/bar/../..");
  test("/foo/bar/../../");
  test("..");
  test("../../../../../../..");
  test("../../../../../../../");
  test("/../../../../../../..");
  test("/../../../../../../../");
  test("/..");
  test("/../");
  test("/");
  test("/.");
  test("/.///././././etc");
  test("/.///././.././etc");
  test("//");
  test("/./");
  test("///./");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb9(%rip),%rdi
call   1040 <test@plt>
lea    0xec3(%rip),%rdi
call   1040 <test@plt>
lea    0xf21(%rip),%rdi
call   1040 <test@plt>
lea    0xec3(%rip),%rdi
call   1040 <test@plt>
lea    0xebe(%rip),%rdi
call   1040 <test@plt>
lea    0xebe(%rip),%rdi
call   1040 <test@plt>
lea    0xebf(%rip),%rdi
call   1040 <test@plt>
lea    0xec2(%rip),%rdi
call   1040 <test@plt>
lea    0xe86(%rip),%rdi
call   1040 <test@plt>
lea    0xe81(%rip),%rdi
call   1040 <test@plt>
lea    0xe81(%rip),%rdi
call   1040 <test@plt>
lea    0xe82(%rip),%rdi
call   1040 <test@plt>
lea    0xe85(%rip),%rdi
call   1040 <test@plt>
lea    0xe9c(%rip),%rdi
call   1040 <test@plt>
lea    0xe7e(%rip),%rdi
call   1040 <test@plt>
lea    0xe88(%rip),%rdi
call   1040 <test@plt>
lea    0xe65(%rip),%rdi
call   1040 <test@plt>
lea    0xe6f(%rip),%rdi
call   1040 <test@plt>
lea    0xe5f(%rip),%rdi
call   1040 <test@plt>
lea    0xe69(%rip),%rdi
call   1040 <test@plt>
lea    0xe60(%rip),%rdi
call   1040 <test@plt>
lea    0xdee(%rip),%rdi
call   1040 <test@plt>
lea    0xe4a(%rip),%rdi
call   1040 <test@plt>
lea    0xe4f(%rip),%rdi
call   1040 <test@plt>
lea    0xe55(%rip),%rdi
call   1040 <test@plt>
lea    0xe4e(%rip),%rdi
call   1040 <test@plt>
lea    0xe40(%rip),%rdi
call   1040 <test@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xece(%rip),%rdi
call   1040 <test@plt>
lea    0xed8(%rip),%rdi
call   1040 <test@plt>
lea    0xf36(%rip),%rdi
call   1040 <test@plt>
lea    0xed8(%rip),%rdi
call   1040 <test@plt>
lea    0xed3(%rip),%rdi
call   1040 <test@plt>
lea    0xed3(%rip),%rdi
call   1040 <test@plt>
lea    0xed4(%rip),%rdi
call   1040 <test@plt>
lea    0xed7(%rip),%rdi
call   1040 <test@plt>
lea    0xe9b(%rip),%rdi
call   1040 <test@plt>
lea    0xe96(%rip),%rdi
call   1040 <test@plt>
lea    0xe96(%rip),%rdi
call   1040 <test@plt>
lea    0xe97(%rip),%rdi
call   1040 <test@plt>
lea    0xe9a(%rip),%rdi
call   1040 <test@plt>
lea    0xeb1(%rip),%rdi
call   1040 <test@plt>
lea    0xe93(%rip),%rdi
call   1040 <test@plt>
lea    0xe9d(%rip),%rdi
call   1040 <test@plt>
lea    0xe7a(%rip),%rdi
call   1040 <test@plt>
lea    0xe84(%rip),%rdi
call   1040 <test@plt>
lea    0xe74(%rip),%rdi
call   1040 <test@plt>
lea    0xe7e(%rip),%rdi
call   1040 <test@plt>
lea    0xe75(%rip),%rdi
call   1040 <test@plt>
lea    0xe03(%rip),%rdi
call   1040 <test@plt>
lea    0xe5f(%rip),%rdi
call   1040 <test@plt>
lea    0xe64(%rip),%rdi
call   1040 <test@plt>
lea    0xe6a(%rip),%rdi
call   1040 <test@plt>
lea    0xe63(%rip),%rdi
call   1040 <test@plt>
lea    0xe55(%rip),%rdi
call   1040 <test@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [22 x i8] c"foo////bar//.//.././x\00"
@.str.2 = [23 x i8] c"foo////bar//.//.././x/\00"
@.str.3 = [2 x i8] c".\00"
@.str.4 = [6 x i8] c"foo/.\00"
@.str.5 = [11 x i8] c"foo/bar/..\00"
@.str.6 = [12 x i8] c"foo/bar/../\00"
@.str.7 = [14 x i8] c"foo/bar/../..\00"
@.str.8 = [15 x i8] c"foo/bar/../../\00"
@.str.9 = [7 x i8] c"/foo/.\00"
@.str.10 = [12 x i8] c"/foo/bar/..\00"
@.str.11 = [13 x i8] c"/foo/bar/../\00"
@.str.12 = [15 x i8] c"/foo/bar/../..\00"
@.str.13 = [16 x i8] c"/foo/bar/../../\00"
@.str.14 = [3 x i8] c"..\00"
@.str.15 = [21 x i8] c"../../../../../../..\00"
@.str.16 = [22 x i8] c"../../../../../../../\00"
@.str.17 = [22 x i8] c"/../../../../../../..\00"
@.str.18 = [23 x i8] c"/../../../../../../../\00"
@.str.19 = [4 x i8] c"/..\00"
@.str.20 = [5 x i8] c"/../\00"
@.str.21 = [2 x i8] c"/\00"
@.str.22 = [3 x i8] c"/.\00"
@.str.23 = [17 x i8] c"/.///././././etc\00"
@.str.24 = [18 x i8] c"/.///././.././etc\00"
@.str.25 = [3 x i8] c"//\00"
@.str.26 = [4 x i8] c"/./\00"
@.str.27 = [6 x i8] c"///./\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @test(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @test(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @test(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 @test(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%11 = call i32 @test(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
%12 = call i32 @test(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
%13 = call i32 @test(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0))
%14 = call i32 @test(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0))
%15 = call i32 @test(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
%16 = call i32 @test(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
%17 = call i32 @test(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0))
%18 = call i32 @test(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.12, i64 0, i64 0))
%19 = call i32 @test(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.13, i64 0, i64 0))
%20 = call i32 @test(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i64 0, i64 0))
%21 = call i32 @test(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.15, i64 0, i64 0))
%22 = call i32 @test(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.16, i64 0, i64 0))
%23 = call i32 @test(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.17, i64 0, i64 0))
%24 = call i32 @test(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.18, i64 0, i64 0))
%25 = call i32 @test(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.19, i64 0, i64 0))
%26 = call i32 @test(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.20, i64 0, i64 0))
%27 = call i32 @test(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.21, i64 0, i64 0))
%28 = call i32 @test(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.22, i64 0, i64 0))
%29 = call i32 @test(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.23, i64 0, i64 0))
%30 = call i32 @test(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.24, i64 0, i64 0))
%31 = call i32 @test(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.25, i64 0, i64 0))
%32 = call i32 @test(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.26, i64 0, i64 0))
%33 = call i32 @test(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.27, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [22 x i8] c"foo////bar//.//.././x\00"
@.str.2 = [23 x i8] c"foo////bar//.//.././x/\00"
@.str.3 = [2 x i8] c".\00"
@.str.4 = [6 x i8] c"foo/.\00"
@.str.5 = [11 x i8] c"foo/bar/..\00"
@.str.6 = [12 x i8] c"foo/bar/../\00"
@.str.7 = [14 x i8] c"foo/bar/../..\00"
@.str.8 = [15 x i8] c"foo/bar/../../\00"
@.str.9 = [7 x i8] c"/foo/.\00"
@.str.10 = [12 x i8] c"/foo/bar/..\00"
@.str.11 = [13 x i8] c"/foo/bar/../\00"
@.str.12 = [15 x i8] c"/foo/bar/../..\00"
@.str.13 = [16 x i8] c"/foo/bar/../../\00"
@.str.14 = [3 x i8] c"..\00"
@.str.15 = [21 x i8] c"../../../../../../..\00"
@.str.16 = [22 x i8] c"../../../../../../../\00"
@.str.17 = [22 x i8] c"/../../../../../../..\00"
@.str.18 = [23 x i8] c"/../../../../../../../\00"
@.str.19 = [4 x i8] c"/..\00"
@.str.20 = [5 x i8] c"/../\00"
@.str.21 = [2 x i8] c"/\00"
@.str.22 = [3 x i8] c"/.\00"
@.str.23 = [17 x i8] c"/.///././././etc\00"
@.str.24 = [18 x i8] c"/.///././.././etc\00"
@.str.25 = [3 x i8] c"//\00"
@.str.26 = [4 x i8] c"/./\00"
@.str.27 = [6 x i8] c"///./\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @putchar(i32 10)
%4 = tail call i32 @test(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @test(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call i32 @test(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%7 = tail call i32 @test(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%8 = tail call i32 @test(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
%9 = tail call i32 @test(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
%10 = tail call i32 @test(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0))
%11 = tail call i32 @test(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0))
%12 = tail call i32 @test(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
%13 = tail call i32 @test(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
%14 = tail call i32 @test(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0))
%15 = tail call i32 @test(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.12, i64 0, i64 0))
%16 = tail call i32 @test(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.13, i64 0, i64 0))
%17 = tail call i32 @test(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i64 0, i64 0))
%18 = tail call i32 @test(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.15, i64 0, i64 0))
%19 = tail call i32 @test(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.16, i64 0, i64 0))
%20 = tail call i32 @test(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.17, i64 0, i64 0))
%21 = tail call i32 @test(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.18, i64 0, i64 0))
%22 = tail call i32 @test(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.19, i64 0, i64 0))
%23 = tail call i32 @test(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.20, i64 0, i64 0))
%24 = tail call i32 @test(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.21, i64 0, i64 0))
%25 = tail call i32 @test(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.22, i64 0, i64 0))
%26 = tail call i32 @test(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.23, i64 0, i64 0))
%27 = tail call i32 @test(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.24, i64 0, i64 0))
%28 = tail call i32 @test(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.25, i64 0, i64 0))
%29 = tail call i32 @test(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.26, i64 0, i64 0))
%30 = tail call i32 @test(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.27, i64 0, i64 0))
ret i32 0
}