#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 */
struct ct_path {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int);
struct ct_path *ct_path_alloc(char *, char *);
scalar_t__ ct_path_compare_path(struct ct_path *, struct ct_path *);
int /*<<< orphan*/ ct_path_free(struct ct_path *);
void test_path_compare_path(void) {
  struct ct_path *path1 = ct_path_alloc("/tmp", "foo");
  struct ct_path *path2 = ct_path_alloc("/var", "/tmp/foo");
  struct ct_path *path3 = ct_path_alloc("/tmp", "bar");
  assert(0 == ct_path_compare_path(path1, path1));
  assert(0 == ct_path_compare_path(path2, path2));
  assert(0 == ct_path_compare_path(path1, path2));
  assert(0 == ct_path_compare_path(path2, path1));
  assert(ct_path_compare_path(path1, path3) > 0);
  assert(ct_path_compare_path(path3, path1) < 0);
  ct_path_free(path3);
  ct_path_free(path2);
  ct_path_free(path1);
}


x86 assembly (clang, -O0):
<test_path_compare_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xeb1(%rip),%rdi
lea    0xeb9(%rip),%rsi
call   1060 <ct_path_alloc@plt>
mov    %rax,-0x8(%rbp)
lea    0xe9f(%rip),%rdi
lea    0xe9d(%rip),%rsi
call   1060 <ct_path_alloc@plt>
mov    %rax,-0x10(%rbp)
lea    0xe83(%rip),%rdi
lea    0xe8f(%rip),%rsi
call   1060 <ct_path_alloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1050 <ct_path_compare_path@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x10(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <ct_path_compare_path@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <ct_path_compare_path@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1050 <ct_path_compare_path@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <ct_path_compare_path@plt>
cmp    $0x0,%rax
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1050 <ct_path_compare_path@plt>
cmp    $0x0,%rax
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x18(%rbp),%rdi
call   1030 <ct_path_free@plt>
mov    -0x10(%rbp),%rdi
call   1030 <ct_path_free@plt>
mov    -0x8(%rbp),%rdi
call   1030 <ct_path_free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_path_compare_path>:
push   %r15
push   %r14
push   %rbx
lea    0xeb4(%rip),%r15
lea    0xebc(%rip),%rsi
mov    %r15,%rdi
call   1060 <ct_path_alloc@plt>
mov    %rax,%rbx
lea    0xea0(%rip),%rdi
lea    0xe9e(%rip),%rsi
call   1060 <ct_path_alloc@plt>
mov    %rax,%r14
lea    0xe98(%rip),%rsi
mov    %r15,%rdi
call   1060 <ct_path_alloc@plt>
mov    %rax,%r15
mov    %rbx,%rdi
mov    %rbx,%rsi
call   1050 <ct_path_compare_path@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1040 <assert@plt>
mov    %r14,%rdi
mov    %r14,%rsi
call   1050 <ct_path_compare_path@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1040 <assert@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <ct_path_compare_path@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1040 <assert@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <ct_path_compare_path@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1040 <assert@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <ct_path_compare_path@plt>
xor    %edi,%edi
test   %rax,%rax
setg   %dil
call   1040 <assert@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <ct_path_compare_path@plt>
shr    $0x3f,%rax
mov    %eax,%edi
call   1040 <assert@plt>
mov    %r15,%rdi
call   1030 <ct_path_free@plt>
mov    %r14,%rdi
call   1030 <ct_path_free@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <ct_path_free@plt>

LLVM IR (-O0):
%struct.ct_path = type { i32 }
@.str = [5 x i8] c"/tmp\00"
@.str.1 = [4 x i8] c"foo\00"
@.str.2 = [5 x i8] c"/var\00"
@.str.3 = [9 x i8] c"/tmp/foo\00"
@.str.4 = [4 x i8] c"bar\00"
define void @test_path_compare_path() {
%1 = alloca %struct.ct_path*
%2 = alloca %struct.ct_path*
%3 = alloca %struct.ct_path*
%4 = call %struct.ct_path* @ct_path_alloc(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store %struct.ct_path* %4, %struct.ct_path** %1
%5 = call %struct.ct_path* @ct_path_alloc(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
store %struct.ct_path* %5, %struct.ct_path** %2
%6 = call %struct.ct_path* @ct_path_alloc(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
store %struct.ct_path* %6, %struct.ct_path** %3
%7 = load %struct.ct_path*, %struct.ct_path** %1
%8 = load %struct.ct_path*, %struct.ct_path** %1
%9 = call i64 @ct_path_compare_path(%struct.ct_path* %7, %struct.ct_path* %8)
%10 = icmp eq i64 0, %9
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = load %struct.ct_path*, %struct.ct_path** %2
%14 = load %struct.ct_path*, %struct.ct_path** %2
%15 = call i64 @ct_path_compare_path(%struct.ct_path* %13, %struct.ct_path* %14)
%16 = icmp eq i64 0, %15
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
%19 = load %struct.ct_path*, %struct.ct_path** %1
%20 = load %struct.ct_path*, %struct.ct_path** %2
%21 = call i64 @ct_path_compare_path(%struct.ct_path* %19, %struct.ct_path* %20)
%22 = icmp eq i64 0, %21
%23 = zext i1 %22 to i32
%24 = call i32 @assert(i32 %23)
%25 = load %struct.ct_path*, %struct.ct_path** %2
%26 = load %struct.ct_path*, %struct.ct_path** %1
%27 = call i64 @ct_path_compare_path(%struct.ct_path* %25, %struct.ct_path* %26)
%28 = icmp eq i64 0, %27
%29 = zext i1 %28 to i32
%30 = call i32 @assert(i32 %29)
%31 = load %struct.ct_path*, %struct.ct_path** %1
%32 = load %struct.ct_path*, %struct.ct_path** %3
%33 = call i64 @ct_path_compare_path(%struct.ct_path* %31, %struct.ct_path* %32)
%34 = icmp sgt i64 %33, 0
%35 = zext i1 %34 to i32
%36 = call i32 @assert(i32 %35)
%37 = load %struct.ct_path*, %struct.ct_path** %3
%38 = load %struct.ct_path*, %struct.ct_path** %1
%39 = call i64 @ct_path_compare_path(%struct.ct_path* %37, %struct.ct_path* %38)
%40 = icmp slt i64 %39, 0
%41 = zext i1 %40 to i32
%42 = call i32 @assert(i32 %41)
%43 = load %struct.ct_path*, %struct.ct_path** %3
%44 = call i32 @ct_path_free(%struct.ct_path* %43)
%45 = load %struct.ct_path*, %struct.ct_path** %2
%46 = call i32 @ct_path_free(%struct.ct_path* %45)
%47 = load %struct.ct_path*, %struct.ct_path** %1
%48 = call i32 @ct_path_free(%struct.ct_path* %47)
ret void
}

LLVM IR (-O2):
%struct.ct_path = type { i32 }
@.str = [5 x i8] c"/tmp\00"
@.str.1 = [4 x i8] c"foo\00"
@.str.2 = [5 x i8] c"/var\00"
@.str.3 = [9 x i8] c"/tmp/foo\00"
@.str.4 = [4 x i8] c"bar\00"
define void @test_path_compare_path() {
%1 = tail call %struct.ct_path* @ct_path_alloc(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call %struct.ct_path* @ct_path_alloc(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%3 = tail call %struct.ct_path* @ct_path_alloc(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%4 = tail call i64 @ct_path_compare_path(%struct.ct_path* %1, %struct.ct_path* %1)
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
%8 = tail call i64 @ct_path_compare_path(%struct.ct_path* %2, %struct.ct_path* %2)
%9 = icmp eq i64 %8, 0
%10 = zext i1 %9 to i32
%11 = tail call i32 @assert(i32 %10)
%12 = tail call i64 @ct_path_compare_path(%struct.ct_path* %1, %struct.ct_path* %2)
%13 = icmp eq i64 %12, 0
%14 = zext i1 %13 to i32
%15 = tail call i32 @assert(i32 %14)
%16 = tail call i64 @ct_path_compare_path(%struct.ct_path* %2, %struct.ct_path* %1)
%17 = icmp eq i64 %16, 0
%18 = zext i1 %17 to i32
%19 = tail call i32 @assert(i32 %18)
%20 = tail call i64 @ct_path_compare_path(%struct.ct_path* %1, %struct.ct_path* %3)
%21 = icmp sgt i64 %20, 0
%22 = zext i1 %21 to i32
%23 = tail call i32 @assert(i32 %22)
%24 = tail call i64 @ct_path_compare_path(%struct.ct_path* %3, %struct.ct_path* %1)
%25 = lshr i64 %24, 63
%26 = trunc i64 %25 to i32
%27 = tail call i32 @assert(i32 %26)
%28 = tail call i32 @ct_path_free(%struct.ct_path* %3)
%29 = tail call i32 @ct_path_free(%struct.ct_path* %2)
%30 = tail call i32 @ct_path_free(%struct.ct_path* %1)
ret void
}