#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 test(char *, char *);
int main(void) {
  int result = 0;
  result |= test("/usr/lib", "/usr");
  result |= test("/usr/", "/");
  result |= test("usr", ".");
  result |= test("/", "/");
  result |= test(".", ".");
  result |= test("..", ".");
  result |= test("/usr/lib/", "/usr");
  result |= test("/usr", "/");
  result |= test("a//", ".");
  result |= test("a////", ".");
  result |= test("////usr", "/");
  result |= test("////usr//", "/");
  result |= test("//usr", "//");
  result |= test("//usr//", "//");
  result |= test("//", "//");
  result |= test("x///y", "x");
  result |= test("x/////y", "x");
  return result != 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xed3(%rip),%rdi
lea    0xef5(%rip),%rsi
call   1030 <test@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
lea    0xec3(%rip),%rdi
lea    0xed7(%rip),%rsi
call   1030 <test@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
lea    0xecb(%rip),%rdi
lea    0xeaa(%rip),%rsi
call   1030 <test@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
lea    0xeac(%rip),%rsi
mov    %rsi,%rdi
call   1030 <test@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
lea    0xe83(%rip),%rsi
mov    %rsi,%rdi
call   1030 <test@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
lea    0xe6d(%rip),%rdi
lea    0xe67(%rip),%rsi
call   1030 <test@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
lea    0xe57(%rip),%rdi
lea    0xe67(%rip),%rsi
call   1030 <test@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
lea    0xe55(%rip),%rdi
lea    0xe49(%rip),%rsi
call   1030 <test@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
lea    0xe2f(%rip),%rdi
lea    0xe1c(%rip),%rsi
call   1030 <test@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
lea    0xe1a(%rip),%rdi
lea    0xe03(%rip),%rsi
call   1030 <test@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
lea    0xe07(%rip),%rdi
lea    0xdfe(%rip),%rsi
call   1030 <test@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
lea    0xdf6(%rip),%rdi
lea    0xde5(%rip),%rsi
call   1030 <test@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
lea    0xdd7(%rip),%rdi
lea    0xdcb(%rip),%rsi
call   1030 <test@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
lea    0xdc6(%rip),%rdi
lea    0xdb2(%rip),%rsi
call   1030 <test@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
lea    0xda0(%rip),%rsi
mov    %rsi,%rdi
call   1030 <test@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
lea    0xda0(%rip),%rdi
lea    0xd9f(%rip),%rsi
call   1030 <test@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
lea    0xd8f(%rip),%rdi
lea    0xd86(%rip),%rsi
call   1030 <test@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xede(%rip),%rdi
lea    0xf00(%rip),%r14
mov    %r14,%rsi
call   1030 <test@plt>
mov    %eax,%ebx
lea    0xecf(%rip),%rdi
lea    0xee3(%rip),%r15
mov    %r15,%rsi
call   1030 <test@plt>
mov    %eax,%ebp
or     %ebx,%ebp
lea    0xed6(%rip),%rdi
lea    0xeb5(%rip),%r12
mov    %r12,%rsi
call   1030 <test@plt>
mov    %eax,%r13d
mov    %r15,%rdi
mov    %r15,%rsi
call   1030 <test@plt>
mov    %eax,%ebx
or     %r13d,%ebx
or     %ebp,%ebx
mov    %r12,%rdi
mov    %r12,%rsi
call   1030 <test@plt>
mov    %eax,%r13d
lea    0xe82(%rip),%rdi
mov    %r12,%rsi
call   1030 <test@plt>
mov    %eax,%ebp
or     %r13d,%ebp
lea    0xe71(%rip),%rdi
mov    %r14,%rsi
call   1030 <test@plt>
mov    %eax,%r13d
or     %ebp,%r13d
or     %ebx,%r13d
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <test@plt>
mov    %eax,%ebx
lea    0xe56(%rip),%rdi
mov    %r12,%rsi
call   1030 <test@plt>
mov    %eax,%ebp
or     %ebx,%ebp
lea    0xe47(%rip),%rdi
mov    %r12,%rsi
call   1030 <test@plt>
mov    %eax,%ebx
or     %ebp,%ebx
lea    0xe3a(%rip),%rdi
mov    %r15,%rsi
call   1030 <test@plt>
mov    %eax,%r12d
or     %ebx,%r12d
or     %r13d,%r12d
lea    0xe2a(%rip),%rdi
mov    %r15,%rsi
call   1030 <test@plt>
mov    %eax,%r15d
lea    0xe12(%rip),%rdi
lea    0xe06(%rip),%r14
mov    %r14,%rsi
call   1030 <test@plt>
mov    %eax,%ebx
or     %r15d,%ebx
lea    0xdff(%rip),%rdi
mov    %r14,%rsi
call   1030 <test@plt>
mov    %eax,%ebp
or     %ebx,%ebp
mov    %r14,%rdi
mov    %r14,%rsi
call   1030 <test@plt>
mov    %eax,%ebx
or     %ebp,%ebx
lea    0xde5(%rip),%rdi
lea    0xde4(%rip),%r14
mov    %r14,%rsi
call   1030 <test@plt>
mov    %eax,%ebp
or     %ebx,%ebp
or     %r12d,%ebp
lea    0xdd0(%rip),%rdi
mov    %r14,%rsi
call   1030 <test@plt>
xor    %ecx,%ecx
or     %ebp,%eax
setne  %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"/usr/lib\00"
@.str.1 = [5 x i8] c"/usr\00"
@.str.2 = [6 x i8] c"/usr/\00"
@.str.3 = [2 x i8] c"/\00"
@.str.4 = [4 x i8] c"usr\00"
@.str.5 = [2 x i8] c".\00"
@.str.6 = [3 x i8] c"..\00"
@.str.7 = [10 x i8] c"/usr/lib/\00"
@.str.8 = [4 x i8] c"a//\00"
@.str.9 = [6 x i8] c"a////\00"
@.str.10 = [8 x i8] c"////usr\00"
@.str.11 = [10 x i8] c"////usr//\00"
@.str.12 = [6 x i8] c"//usr\00"
@.str.13 = [3 x i8] c"//\00"
@.str.14 = [8 x i8] c"//usr//\00"
@.str.15 = [6 x i8] c"x///y\00"
@.str.16 = [2 x i8] c"x\00"
@.str.17 = [8 x i8] c"x/////y\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = call i32 @test(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%4 = load i32, i32* %2
%5 = or i32 %4, %3
store i32 %5, i32* %2
%6 = call i32 @test(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%7 = load i32, i32* %2
%8 = or i32 %7, %6
store i32 %8, i32* %2
%9 = call i32 @test(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%10 = load i32, i32* %2
%11 = or i32 %10, %9
store i32 %11, i32* %2
%12 = call i32 @test(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))
%13 = load i32, i32* %2
%14 = or i32 %13, %12
store i32 %14, i32* %2
%15 = call i32 @test(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))
%16 = load i32, i32* %2
%17 = or i32 %16, %15
store i32 %17, i32* %2
%18 = call i32 @test(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.5, i64 0, i64 0))
%19 = load i32, i32* %2
%20 = or i32 %19, %18
store i32 %20, i32* %2
%21 = call i32 @test(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%22 = load i32, i32* %2
%23 = or i32 %22, %21
store i32 %23, i32* %2
%24 = call i32 @test(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%25 = load i32, i32* %2
%26 = or i32 %25, %24
store i32 %26, i32* %2
%27 = call i32 @test(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%28 = load i32, i32* %2
%29 = or i32 %28, %27
store i32 %29, i32* %2
%30 = call i32 @test(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%31 = load i32, i32* %2
%32 = or i32 %31, %30
store i32 %32, i32* %2
%33 = call i32 @test(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%34 = load i32, i32* %2
%35 = or i32 %34, %33
store i32 %35, i32* %2
%36 = call i32 @test(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%37 = load i32, i32* %2
%38 = or i32 %37, %36
store i32 %38, i32* %2
%39 = call i32 @test(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0))
%40 = load i32, i32* %2
%41 = or i32 %40, %39
store i32 %41, i32* %2
%42 = call i32 @test(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0))
%43 = load i32, i32* %2
%44 = or i32 %43, %42
store i32 %44, i32* %2
%45 = call i32 @test(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0))
%46 = load i32, i32* %2
%47 = or i32 %46, %45
store i32 %47, i32* %2
%48 = call i32 @test(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.16, i64 0, i64 0))
%49 = load i32, i32* %2
%50 = or i32 %49, %48
store i32 %50, i32* %2
%51 = call i32 @test(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.17, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.16, i64 0, i64 0))
%52 = load i32, i32* %2
%53 = or i32 %52, %51
store i32 %53, i32* %2
%54 = load i32, i32* %2
%55 = icmp ne i32 %54, 0
%56 = zext i1 %55 to i32
ret i32 %56
}

LLVM IR (-O2):
@.str = [9 x i8] c"/usr/lib\00"
@.str.1 = [5 x i8] c"/usr\00"
@.str.2 = [6 x i8] c"/usr/\00"
@.str.3 = [2 x i8] c"/\00"
@.str.4 = [4 x i8] c"usr\00"
@.str.5 = [2 x i8] c".\00"
@.str.6 = [3 x i8] c"..\00"
@.str.7 = [10 x i8] c"/usr/lib/\00"
@.str.8 = [4 x i8] c"a//\00"
@.str.9 = [6 x i8] c"a////\00"
@.str.10 = [8 x i8] c"////usr\00"
@.str.11 = [10 x i8] c"////usr//\00"
@.str.12 = [6 x i8] c"//usr\00"
@.str.13 = [3 x i8] c"//\00"
@.str.14 = [8 x i8] c"//usr//\00"
@.str.15 = [6 x i8] c"x///y\00"
@.str.16 = [2 x i8] c"x\00"
@.str.17 = [8 x i8] c"x/////y\00"
define i32 @main() {
%1 = tail call i32 @test(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @test(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%3 = or i32 %2, %1
%4 = tail call i32 @test(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%5 = or i32 %3, %4
%6 = tail call i32 @test(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))
%7 = or i32 %5, %6
%8 = tail call i32 @test(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))
%9 = or i32 %7, %8
%10 = tail call i32 @test(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.5, i64 0, i64 0))
%11 = or i32 %9, %10
%12 = tail call i32 @test(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%13 = or i32 %11, %12
%14 = tail call i32 @test(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%15 = or i32 %13, %14
%16 = tail call i32 @test(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%17 = or i32 %15, %16
%18 = tail call i32 @test(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%19 = or i32 %17, %18
%20 = tail call i32 @test(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%21 = or i32 %19, %20
%22 = tail call i32 @test(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%23 = or i32 %21, %22
%24 = tail call i32 @test(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0))
%25 = or i32 %23, %24
%26 = tail call i32 @test(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0))
%27 = or i32 %25, %26
%28 = tail call i32 @test(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0))
%29 = or i32 %27, %28
%30 = tail call i32 @test(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.16, i64 0, i64 0))
%31 = or i32 %29, %30
%32 = tail call i32 @test(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.17, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.16, i64 0, i64 0))
%33 = or i32 %31, %32
%34 = icmp ne i32 %33, 0
%35 = zext i1 %34 to i32
ret i32 %35
}