#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*/ LC_ALL;
int /*<<< orphan*/ printf(char *, char const *, char const *, int);
int /*<<< orphan*/ setlocale(int /*<<< orphan*/, char *);
int strcoll(char const *, char const *);
int main(void) {
  const char t1[] = "0-0-0-0-0-0-0-0-0-0.COM";
  const char t2[] = "00000-00000.COM";
  int res1;
  int res2;
  setlocale(LC_ALL, "en_US.ISO-8859-1");
  res1 = strcoll(t1, t2);
  printf("strcoll (\"%s\", \"%s\") = %d\n", t1, t2, res1);
  res2 = strcoll(t2, t1);
  printf("strcoll (\"%s\", \"%s\") = %d\n", t2, t1, res2);
  return ((res1 == 0 && res2 != 0) || (res1 != 0 && res2 == 0) ||
          (res1 < 0 && res2 < 0) || (res1 > 0 && res2 > 0));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xeb4(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xeb9(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xeb6(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0x2e63(%rip),%rax
mov    (%rax),%edi
lea    0xeaa(%rip),%rsi
call   1050 <setlocale@plt>
lea    -0x20(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1040 <strcoll@plt>
mov    %eax,-0x34(%rbp)
lea    -0x20(%rbp),%rsi
lea    -0x30(%rbp),%rdx
mov    -0x34(%rbp),%ecx
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <strcoll@plt>
mov    %eax,-0x38(%rbp)
lea    -0x30(%rbp),%rsi
lea    -0x20(%rbp),%rdx
mov    -0x38(%rbp),%ecx
lea    0xe6d(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x0,-0x34(%rbp)
jne    11f2 <main+0xc2>
mov    $0x1,%al
cmpl   $0x0,-0x38(%rbp)
mov    %al,-0x39(%rbp)
jne    1243 <main+0x113>
cmpl   $0x0,-0x34(%rbp)
je     120b <main+0xdb>
mov    $0x1,%al
cmpl   $0x0,-0x38(%rbp)
mov    %al,-0x39(%rbp)
je     1243 <main+0x113>
cmpl   $0x0,-0x34(%rbp)
jge    1224 <main+0xf4>
mov    $0x1,%al
cmpl   $0x0,-0x38(%rbp)
mov    %al,-0x39(%rbp)
jl     1243 <main+0x113>
xor    %eax,%eax
cmpl   $0x0,-0x34(%rbp)
mov    %al,-0x3a(%rbp)
jle    123d <main+0x10d>
cmpl   $0x0,-0x38(%rbp)
setg   %al
mov    %al,-0x3a(%rbp)
mov    -0x3a(%rbp),%al
mov    %al,-0x39(%rbp)
mov    -0x39(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x30,%rsp
movaps 0xebd(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movabs $0x4d4f432e302d30,%rax
mov    %rax,0x20(%rsp)
movaps 0xec2(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    0x2e77(%rip),%rax
mov    (%rax),%edi
lea    0xebe(%rip),%rsi
call   1050 <setlocale@plt>
lea    0x10(%rsp),%r14
mov    %rsp,%r15
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <strcoll@plt>
mov    %eax,%ebx
lea    0xeae(%rip),%r12
mov    %r12,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %eax,%ecx
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <strcoll@plt>
mov    %eax,%ebp
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
mov    %eax,%ecx
call   1030 <printf@plt>
mov    $0x1,%eax
test   %ebx,%ebx
jne    11cd <main+0x9d>
test   %ebp,%ebp
jne    11f0 <main+0xc0>
test   %ebx,%ebx
setne  %cl
test   %ebp,%ebp
sete   %dl
test   %dl,%cl
jne    11f0 <main+0xc0>
mov    %ebp,%ecx
and    %ebx,%ecx
js     11f0 <main+0xc0>
test   %ebx,%ebx
setg   %al
test   %ebp,%ebp
setg   %cl
and    %al,%cl
movzbl %cl,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.t1 = [24 x i8] c"0-0-0-0-0-0-0-0-0-0.COM\00"
@__const.main.t2 = [16 x i8] c"00000-00000.COM\00"
@LC_ALL = global i32 0
@.str = [17 x i8] c"en_US.ISO-8859-1\00"
@.str.1 = [27 x i8] c"strcoll (\22%s\22, \22%s\22) = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [24 x i8]
%3 = alloca [16 x i8]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [24 x i8]* %2 to i8*
%7 = bitcast [16 x i8]* %3 to i8*
%8 = load i32, i32* @LC_ALL
%9 = call i32 @setlocale(i32 %8, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%10 = getelementptr inbounds [24 x i8], [24 x i8]* %2, i64 0, i64 0
%11 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%12 = call i32 @strcoll(i8* %10, i8* %11)
store i32 %12, i32* %4
%13 = getelementptr inbounds [24 x i8], [24 x i8]* %2, i64 0, i64 0
%14 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%15 = load i32, i32* %4
%16 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %13, i8* %14, i32 %15)
%17 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%18 = getelementptr inbounds [24 x i8], [24 x i8]* %2, i64 0, i64 0
%19 = call i32 @strcoll(i8* %17, i8* %18)
store i32 %19, i32* %5
%20 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%21 = getelementptr inbounds [24 x i8], [24 x i8]* %2, i64 0, i64 0
%22 = load i32, i32* %5
%23 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %20, i8* %21, i32 %22)
%24 = load i32, i32* %4
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %0
%27 = load i32, i32* %5
%28 = icmp ne i32 %27, 0
br i1 %28, label %49, label %29
29: ; preds = %26, %0
%30 = load i32, i32* %4
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %29
%33 = load i32, i32* %5
%34 = icmp eq i32 %33, 0
br i1 %34, label %49, label %35
35: ; preds = %32, %29
%36 = load i32, i32* %4
%37 = icmp slt i32 %36, 0
br i1 %37, label %38, label %41
38: ; preds = %35
%39 = load i32, i32* %5
%40 = icmp slt i32 %39, 0
br i1 %40, label %49, label %41
41: ; preds = %38, %35
%42 = load i32, i32* %4
%43 = icmp sgt i32 %42, 0
br i1 %43, label %44, label %47
44: ; preds = %41
%45 = load i32, i32* %5
%46 = icmp sgt i32 %45, 0
br label %47
47: ; preds = %44, %41
%48 = phi i1 [ false, %41 ], [ %46, %44 ]
br label %49
49: ; preds = %47, %38, %32, %26
%50 = phi i1 [ true, %38 ], [ true, %32 ], [ true, %26 ], [ %48, %47 ]
%51 = zext i1 %50 to i32
ret i32 %51
}

LLVM IR (-O2):
@__const.main.t1 = [24 x i8] c"0-0-0-0-0-0-0-0-0-0.COM\00"
@__const.main.t2 = [16 x i8] c"00000-00000.COM\00"
@LC_ALL = global i32 0
@.str = [17 x i8] c"en_US.ISO-8859-1\00"
@.str.1 = [27 x i8] c"strcoll (\22%s\22, \22%s\22) = %d\0A\00"
define i32 @main() {
%1 = alloca [24 x i8]
%2 = alloca [16 x i8]
%3 = getelementptr inbounds [24 x i8], [24 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%5 = load i32, i32* @LC_ALL
%6 = tail call i32 @setlocale(i32 %5, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @strcoll(i8* %3, i8* %4)
%8 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %3, i8* %4, i32 %7)
%9 = call i32 @strcoll(i8* %4, i8* %3)
%10 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %4, i8* %3, i32 %9)
%11 = icmp eq i32 %7, 0
%12 = icmp ne i32 %9, 0
%13 = and i1 %11, %12
br i1 %13, label %26, label %14
14: ; preds = %0
%15 = icmp ne i32 %7, 0
%16 = icmp eq i32 %9, 0
%17 = and i1 %15, %16
%18 = and i32 %9, %7
%19 = icmp slt i32 %18, 0
%20 = or i1 %17, %19
br i1 %20, label %26, label %21
21: ; preds = %14
%22 = icmp sgt i32 %7, 0
%23 = icmp sgt i32 %9, 0
%24 = and i1 %22, %23
%25 = zext i1 %24 to i32
br label %26
26: ; preds = %14, %0, %21
%27 = phi i32 [ %25, %21 ], [ 1, %0 ], [ 1, %14 ]
ret i32 %27
}