#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__ string_nocase_compare(char *, char *);
void test_string_nocase_compare(void) {
  char test1[] = "Apple";
  char test2[] = "Orange";
  char test3[] = "Apple";
  char test4[] = "Alpha";
  char test5[] = "bravo";
  char test6[] = "Charlie";
  assert(string_nocase_compare(test1, test2) < 0);
  assert(string_nocase_compare(test2, test1) > 0);
  assert(string_nocase_compare(test1, test3) == 0);
  assert(string_nocase_compare(test4, test5) < 0);
  assert(string_nocase_compare(test5, test6) < 0);
}


x86 assembly (clang, -O0):
<test_string_nocase_compare>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0xed2(%rip),%eax
mov    %eax,-0x6(%rbp)
mov    0xecc(%rip),%ax
mov    %ax,-0x2(%rbp)
mov    0xec4(%rip),%eax
mov    %eax,-0xd(%rbp)
mov    0xebe(%rip),%ax
mov    %ax,-0x9(%rbp)
mov    0xeb6(%rip),%al
mov    %al,-0x7(%rbp)
mov    0xea1(%rip),%eax
mov    %eax,-0x13(%rbp)
mov    0xe9b(%rip),%ax
mov    %ax,-0xf(%rbp)
mov    0xe9a(%rip),%eax
mov    %eax,-0x19(%rbp)
mov    0xe94(%rip),%ax
mov    %ax,-0x15(%rbp)
mov    0xe8c(%rip),%eax
mov    %eax,-0x1f(%rbp)
mov    0xe86(%rip),%ax
mov    %ax,-0x1b(%rbp)
mov    0xe7d(%rip),%rax
mov    %rax,-0x27(%rbp)
lea    -0x6(%rbp),%rdi
lea    -0xd(%rbp),%rsi
call   1030 <string_nocase_compare@plt>
cmp    $0x0,%rax
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    -0xd(%rbp),%rdi
lea    -0x6(%rbp),%rsi
call   1030 <string_nocase_compare@plt>
cmp    $0x0,%rax
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    -0x6(%rbp),%rdi
lea    -0x13(%rbp),%rsi
call   1030 <string_nocase_compare@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    -0x19(%rbp),%rdi
lea    -0x1f(%rbp),%rsi
call   1030 <string_nocase_compare@plt>
cmp    $0x0,%rax
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    -0x1f(%rbp),%rdi
lea    -0x27(%rbp),%rsi
call   1030 <string_nocase_compare@plt>
cmp    $0x0,%rax
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_string_nocase_compare>:
push   %r14
push   %rbx
sub    $0x38,%rsp
movw   $0x65,0x24(%rsp)
movl   $0x6c707041,0x20(%rsp)
6c
movl   $0x65676e,0x2b(%rsp)
movl   $0x6e61724f,0x28(%rsp)
6e
movw   $0x65,0x1c(%rsp)
movl   $0x6c707041,0x18(%rsp)
6c
movw   $0x61,0x14(%rsp)
movl   $0x68706c41,0x10(%rsp)
68
movw   $0x6f,0xc(%rsp)
movl   $0x76617262,0x8(%rsp)
76
movabs $0x65696c72616843,%rax
mov    %rax,0x30(%rsp)
lea    0x20(%rsp),%r14
lea    0x28(%rsp),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <string_nocase_compare@plt>
shr    $0x3f,%rax
mov    %eax,%edi
call   1040 <assert@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <string_nocase_compare@plt>
xor    %edi,%edi
test   %rax,%rax
setg   %dil
call   1040 <assert@plt>
lea    0x18(%rsp),%rsi
mov    %r14,%rdi
call   1030 <string_nocase_compare@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1040 <assert@plt>
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rbx
mov    %rbx,%rsi
call   1030 <string_nocase_compare@plt>
shr    $0x3f,%rax
mov    %eax,%edi
call   1040 <assert@plt>
lea    0x30(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <string_nocase_compare@plt>
shr    $0x3f,%rax
mov    %eax,%edi
call   1040 <assert@plt>
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.test_string_nocase_compare.test1 = [6 x i8] c"Apple\00"
@__const.test_string_nocase_compare.test2 = [7 x i8] c"Orange\00"
@__const.test_string_nocase_compare.test3 = [6 x i8] c"Apple\00"
@__const.test_string_nocase_compare.test4 = [6 x i8] c"Alpha\00"
@__const.test_string_nocase_compare.test5 = [6 x i8] c"bravo\00"
@__const.test_string_nocase_compare.test6 = [8 x i8] c"Charlie\00"
define void @test_string_nocase_compare() {
%1 = alloca [6 x i8]
%2 = alloca [7 x i8]
%3 = alloca [6 x i8]
%4 = alloca [6 x i8]
%5 = alloca [6 x i8]
%6 = alloca [8 x i8]
%7 = bitcast [6 x i8]* %1 to i8*
%8 = bitcast [7 x i8]* %2 to i8*
%9 = bitcast [6 x i8]* %3 to i8*
%10 = bitcast [6 x i8]* %4 to i8*
%11 = bitcast [6 x i8]* %5 to i8*
%12 = bitcast [8 x i8]* %6 to i8*
%13 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%14 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%15 = call i64 @string_nocase_compare(i8* %13, i8* %14)
%16 = icmp slt i64 %15, 0
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
%19 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%20 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%21 = call i64 @string_nocase_compare(i8* %19, i8* %20)
%22 = icmp sgt i64 %21, 0
%23 = zext i1 %22 to i32
%24 = call i32 @assert(i32 %23)
%25 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%26 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
%27 = call i64 @string_nocase_compare(i8* %25, i8* %26)
%28 = icmp eq i64 %27, 0
%29 = zext i1 %28 to i32
%30 = call i32 @assert(i32 %29)
%31 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 0
%32 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 0
%33 = call i64 @string_nocase_compare(i8* %31, i8* %32)
%34 = icmp slt i64 %33, 0
%35 = zext i1 %34 to i32
%36 = call i32 @assert(i32 %35)
%37 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 0
%38 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 0
%39 = call i64 @string_nocase_compare(i8* %37, i8* %38)
%40 = icmp slt i64 %39, 0
%41 = zext i1 %40 to i32
%42 = call i32 @assert(i32 %41)
ret void
}

LLVM IR (-O2):
@__const.test_string_nocase_compare.test2 = [7 x i8] c"Orange\00"
@__const.test_string_nocase_compare.test3 = [6 x i8] c"Apple\00"
@__const.test_string_nocase_compare.test4 = [6 x i8] c"Alpha\00"
@__const.test_string_nocase_compare.test5 = [6 x i8] c"bravo\00"
define void @test_string_nocase_compare() {
%1 = alloca [6 x i8]
%2 = alloca [7 x i8]
%3 = alloca [6 x i8]
%4 = alloca [6 x i8]
%5 = alloca [6 x i8]
%6 = alloca i64
%7 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%8 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%9 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
%10 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 0
%11 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 0
%12 = bitcast i64* %6 to i8*
store i64 28544887144147011, i64* %6
%13 = call i64 @string_nocase_compare(i8* %7, i8* %8)
%14 = lshr i64 %13, 63
%15 = trunc i64 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = call i64 @string_nocase_compare(i8* %8, i8* %7)
%18 = icmp sgt i64 %17, 0
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
%21 = call i64 @string_nocase_compare(i8* %7, i8* %9)
%22 = icmp eq i64 %21, 0
%23 = zext i1 %22 to i32
%24 = call i32 @assert(i32 %23)
%25 = call i64 @string_nocase_compare(i8* %10, i8* %11)
%26 = lshr i64 %25, 63
%27 = trunc i64 %26 to i32
%28 = call i32 @assert(i32 %27)
%29 = call i64 @string_nocase_compare(i8* %11, i8* %12)
%30 = lshr i64 %29, 63
%31 = trunc i64 %30 to i32
%32 = call i32 @assert(i32 %31)
ret void
}