#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);
int /*<<< orphan*/ bwt_transform(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ strlen(char *);
void test_bwt_transform() {
  char *string = "el_anele_lepanelen$";
  char *expected = "nle_pl$nnlleee_eaae";
  char result[20];
  bwt_transform(string, result, strlen(string));
  assert(!strcmp(result, expected));
  printf("\tBWT transform test passed\n");
}


x86 assembly (clang, -O0):
<test_bwt_transform>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    0xea1(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xeaa(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x40(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x40(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    %eax,%edx
call   1050 <bwt_transform@plt>
lea    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
lea    0xe6c(%rip),%rdi
call   1040 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_bwt_transform>:
push   %rbx
sub    $0x20,%rsp
lea    0xed4(%rip),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
mov    %eax,%edx
call   1050 <bwt_transform@plt>
movd   0x10(%rsp),%xmm0
pcmpeqb 0xe91(%rip),%xmm0
movdqa (%rsp),%xmm1
pcmpeqb 0xe94(%rip),%xmm1
pand   %xmm0,%xmm1
pmovmskb %xmm1,%eax
xor    %edi,%edi
cmp    $0xffff,%eax
sete   %dil
call   1060 <assert@plt>
lea    0xead(%rip),%rdi
call   1030 <puts@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"el_anele_lepanelen$\00"
@.str.1 = [20 x i8] c"nle_pl$nnlleee_eaae\00"
@.str.2 = [28 x i8] c"\09BWT transform test passed\0A\00"
define void @test_bwt_transform() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca [20 x i8]
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8** %1
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8** %2
%4 = load i8*, i8** %1
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%6 = load i8*, i8** %1
%7 = call i32 @strlen(i8* %6)
%8 = call i32 @bwt_transform(i8* %4, i8* %5, i32 %7)
%9 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%10 = load i8*, i8** %2
%11 = call i32 @strcmp(i8* %9, i8* %10)
%12 = icmp ne i32 %11, 0
%13 = xor i1 %12, true
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"el_anele_lepanelen$\00"
@.str.1 = [20 x i8] c"nle_pl$nnlleee_eaae\00"
@str = [27 x i8] c"\09BWT transform test passed\00"
define void @test_bwt_transform() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @strlen(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @bwt_transform(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %2, i32 %3)
%5 = call i32 @bcmp(i8* dereferenceable(20) %2, i8* dereferenceable(20) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i64 20)
%6 = icmp eq i32 %5, 0
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
ret void
}