#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*/ assert(int);
scalar_t__ bwt_compare(char **, char **);
int /*<<< orphan*/ printf(char *);
void test_bwt_compare() {
  char *a = "abc";
  char *b = "def";
  assert(bwt_compare(&a, &a) == 0);
  assert(bwt_compare(&b, &a) > 0);
  assert(bwt_compare(&a, &b) < 0);
  printf("\tCompare test passed\n");
}


x86 assembly (clang, -O0):
<test_bwt_compare>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xeba(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    -0x8(%rbp),%rsi
mov    %rsi,%rdi
call   1030 <bwt_compare@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    -0x10(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <bwt_compare@plt>
cmp    $0x0,%rax
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <bwt_compare@plt>
cmp    $0x0,%rax
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    0xe5a(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_bwt_compare>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xec2(%rip),%rax
mov    %rax,0x10(%rsp)
lea    0xeba(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    %rbx,%rsi
call   1030 <bwt_compare@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1050 <assert@plt>
lea    0x8(%rsp),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <bwt_compare@plt>
xor    %edi,%edi
test   %rax,%rax
setg   %dil
call   1050 <assert@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <bwt_compare@plt>
shr    $0x3f,%rax
mov    %eax,%edi
call   1050 <assert@plt>
lea    0xe60(%rip),%rdi
call   1040 <puts@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"abc\00"
@.str.1 = [4 x i8] c"def\00"
@.str.2 = [22 x i8] c"\09Compare test passed\0A\00"
define void @test_bwt_compare() {
%1 = alloca i8*
%2 = alloca i8*
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8** %2
%3 = call i64 @bwt_compare(i8** %1, i8** %1)
%4 = icmp eq i64 %3, 0
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
%7 = call i64 @bwt_compare(i8** %2, i8** %1)
%8 = icmp sgt i64 %7, 0
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = call i64 @bwt_compare(i8** %1, i8** %2)
%12 = icmp slt i64 %11, 0
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"abc\00"
@.str.1 = [4 x i8] c"def\00"
@str = [21 x i8] c"\09Compare test passed\00"
define void @test_bwt_compare() {
%1 = alloca i8*
%2 = alloca i8*
%3 = bitcast i8** %1 to i8*
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %1
%4 = bitcast i8** %2 to i8*
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8** %2
%5 = call i64 @bwt_compare(i8** %1, i8** %1)
%6 = icmp eq i64 %5, 0
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = call i64 @bwt_compare(i8** %2, i8** %1)
%10 = icmp sgt i64 %9, 0
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = call i64 @bwt_compare(i8** %1, i8** %2)
%14 = lshr i64 %13, 63
%15 = trunc i64 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
ret void
}