int main(argc, argv)
int argc;
char *argv[];
{
  int result = 0;
  result |= test("/usr/lib", "/usr");
  result |= test("/usr", "/");
  result |= test("usr", ".");
  result |= test("/", "/");
  result |= test(".", ".");
  result |= test("..", ".");
  return result != 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xecc(%rip),%rdi
lea    0xece(%rip),%rsi
mov    $0x0,%al
call   1030 <test@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
lea    0xeba(%rip),%rdi
lea    0xeb8(%rip),%rsi
mov    $0x0,%al
call   1030 <test@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
lea    0xea0(%rip),%rdi
lea    0xea0(%rip),%rsi
mov    $0x0,%al
call   1030 <test@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
lea    0xe89(%rip),%rsi
mov    %rsi,%rdi
mov    $0x0,%al
call   1030 <test@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
lea    0xe75(%rip),%rsi
mov    %rsi,%rdi
mov    $0x0,%al
call   1030 <test@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
lea    0xe5d(%rip),%rdi
lea    0xe57(%rip),%rsi
mov    $0x0,%al
call   1030 <test@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
lea    0xee1(%rip),%rdi
lea    0xee3(%rip),%r14
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <test@plt>
mov    %eax,%ebp
lea    0xed5(%rip),%r15
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <test@plt>
mov    %eax,%ebx
or     %ebp,%ebx
lea    0xeb9(%rip),%rdi
lea    0xeb9(%rip),%r14
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <test@plt>
mov    %eax,%r12d
mov    %r15,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <test@plt>
mov    %eax,%ebp
or     %r12d,%ebp
or     %ebx,%ebp
mov    %r14,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <test@plt>
mov    %eax,%ebx
or     %ebp,%ebx
lea    0xe7f(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <test@plt>
xor    %ecx,%ecx
or     %ebx,%eax
setne  %cl
mov    %ecx,%eax
pop    %rbx
pop    %r12
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 = [2 x i8] c"/\00"
@.str.3 = [4 x i8] c"usr\00"
@.str.4 = [2 x i8] c".\00"
@.str.5 = [3 x i8] c"..\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%7 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @test to i32 (i8*, i8*, ...)*)(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))
%8 = load i32, i32* %6
%9 = or i32 %8, %7
store i32 %9, i32* %6
%10 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @test to i32 (i8*, i8*, ...)*)(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.2, i64 0, i64 0))
%11 = load i32, i32* %6
%12 = or i32 %11, %10
store i32 %12, i32* %6
%13 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @test to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%14 = load i32, i32* %6
%15 = or i32 %14, %13
store i32 %15, i32* %6
%16 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @test to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%17 = load i32, i32* %6
%18 = or i32 %17, %16
store i32 %18, i32* %6
%19 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @test to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%20 = load i32, i32* %6
%21 = or i32 %20, %19
store i32 %21, i32* %6
%22 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @test to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%23 = load i32, i32* %6
%24 = or i32 %23, %22
store i32 %24, i32* %6
%25 = load i32, i32* %6
%26 = icmp ne i32 %25, 0
%27 = zext i1 %26 to i32
ret i32 %27
}

LLVM IR (-O2):
@.str = [9 x i8] c"/usr/lib\00"
@.str.1 = [5 x i8] c"/usr\00"
@.str.2 = [2 x i8] c"/\00"
@.str.3 = [4 x i8] c"usr\00"
@.str.4 = [2 x i8] c".\00"
@.str.5 = [3 x i8] c"..\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @test to i32 (i8*, i8*, ...)*)(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 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @test to i32 (i8*, i8*, ...)*)(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.2, i64 0, i64 0))
%5 = or i32 %4, %3
%6 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @test to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%7 = or i32 %5, %6
%8 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @test to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%9 = or i32 %7, %8
%10 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @test to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%11 = or i32 %9, %10
%12 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @test to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%13 = or i32 %11, %12
%14 = icmp ne i32 %13, 0
%15 = zext i1 %14 to i32
ret i32 %15
}