#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 */
typedef int /*<<< orphan*/ UCollator;
typedef int UCollationResult;
typedef int /*<<< orphan*/ UChar;

/* Variables and functions */
#define UCOL_EQUAL 130
#define UCOL_GREATER 129
#define UCOL_LESS 128
int /*<<< orphan*/ assert(int);
int ucol_strcoll(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int,
                 int /*<<< orphan*/ *, int);
int icuCollationColl(void *pCtx, int nLeft, const void *zLeft, int nRight,
                     const void *zRight) {
  UCollationResult res;
  UCollator *p = (UCollator *)pCtx;
  res = ucol_strcoll(p, (UChar *)zLeft, nLeft / 2, (UChar *)zRight, nRight / 2);
  switch (res) {
  case UCOL_LESS:
    return -1;
  case UCOL_GREATER:
    return +1;
  case UCOL_EQUAL:
    return 0;
  }
  assert(!"Unexpected return value from ucol_strcoll()");
  return 0;
}


x86 assembly (clang, -O0):
<icuCollationColl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    %r8,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    %edx,%eax
shr    $0x1f,%eax
add    %eax,%edx
sar    %edx
mov    -0x30(%rbp),%rcx
mov    -0x24(%rbp),%r8d
mov    %r8d,%eax
shr    $0x1f,%eax
add    %eax,%r8d
sar    %r8d
call   1030 <ucol_strcoll@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x44(%rbp)
sub    $0x80,%eax
je     11ae <icuCollationColl+0x8e>
jmp    1188 <icuCollationColl+0x68>
mov    -0x44(%rbp),%eax
sub    $0x81,%eax
je     11ba <icuCollationColl+0x9a>
jmp    119b <icuCollationColl+0x7b>
mov    -0x44(%rbp),%eax
sub    $0x82,%eax
je     11c6 <icuCollationColl+0xa6>
jmp    11d2 <icuCollationColl+0xb2>
movl   $0xffffffff,-0x4(%rbp)
jmp    11e0 <icuCollationColl+0xc0>
movl   $0x1,-0x4(%rbp)
jmp    11e0 <icuCollationColl+0xc0>
movl   $0x0,-0x4(%rbp)
jmp    11e0 <icuCollationColl+0xc0>
xor    %edi,%edi
call   1040 <assert@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<icuCollationColl>:
push   %rbx
mov    %r8,%rbx
mov    %esi,%eax
shr    $0x1f,%eax
add    %esi,%eax
sar    %eax
mov    %ecx,%r8d
shr    $0x1f,%r8d
add    %ecx,%r8d
sar    %r8d
mov    %rdx,%rsi
mov    %eax,%edx
mov    %rbx,%rcx
call   1030 <ucol_strcoll@plt>
add    $0xffffff80,%eax
cmp    $0x3,%eax
jae    115d <icuCollationColl+0x3d>
cltq
lea    0xea8(%rip),%rcx
mov    (%rcx,%rax,4),%ebx
jmp    1166 <icuCollationColl+0x46>
xor    %ebx,%ebx
xor    %edi,%edi
call   1040 <assert@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [44 x i8] c"Unexpected return value from ucol_strcoll()\00"
define i32 @icuCollationColl(i8* %0, i32 %1, i8* %2, i32 %3, i8* %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i32*
store i8* %0, i8** %7
store i32 %1, i32* %8
store i8* %2, i8** %9
store i32 %3, i32* %10
store i8* %4, i8** %11
%14 = load i8*, i8** %7
%15 = bitcast i8* %14 to i32*
store i32* %15, i32** %13
%16 = load i32*, i32** %13
%17 = load i8*, i8** %9
%18 = bitcast i8* %17 to i32*
%19 = load i32, i32* %8
%20 = sdiv i32 %19, 2
%21 = load i8*, i8** %11
%22 = bitcast i8* %21 to i32*
%23 = load i32, i32* %10
%24 = sdiv i32 %23, 2
%25 = call i32 @ucol_strcoll(i32* %16, i32* %18, i32 %20, i32* %22, i32 %24)
store i32 %25, i32* %12
%26 = load i32, i32* %12
switch i32 %26, label %30 [
i32 128, label %27
i32 129, label %28
i32 130, label %29
]
27: ; preds = %5
store i32 -1, i32* %6
br label %32
28: ; preds = %5
store i32 1, i32* %6
br label %32
29: ; preds = %5
store i32 0, i32* %6
br label %32
30: ; preds = %5
%31 = call i32 @assert(i32 0)
store i32 0, i32* %6
br label %32
32: ; preds = %30, %29, %28, %27
%33 = load i32, i32* %6
ret i32 %33
}

LLVM IR (-O2):
@switch.table.icuCollationColl = [3 x i32] [i32 -1, i32 1, i32 0]
define i32 @icuCollationColl(i8* %0, i32 %1, i8* %2, i32 %3, i8* %4) {
%6 = bitcast i8* %0 to i32*
%7 = bitcast i8* %2 to i32*
%8 = sdiv i32 %1, 2
%9 = bitcast i8* %4 to i32*
%10 = sdiv i32 %3, 2
%11 = tail call i32 @ucol_strcoll(i32* %6, i32* %7, i32 %8, i32* %9, i32 %10)
%12 = add i32 %11, -128
%13 = icmp ult i32 %12, 3
br i1 %13, label %16, label %14
14: ; preds = %5
%15 = tail call i32 @assert(i32 0)
br label %20
16: ; preds = %5
%17 = sext i32 %12 to i64
%18 = getelementptr inbounds [3 x i32], [3 x i32]* @switch.table.icuCollationColl, i64 0, i64 %17
%19 = load i32, i32* %18
br label %20
20: ; preds = %16, %14
%21 = phi i32 [ 0, %14 ], [ %19, %16 ]
ret i32 %21
}