#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_COLLATE;
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ setlocale(int /*<<< orphan*/, char *);
scalar_t__ strcmp(char *, char *);
scalar_t__ strcoll(char *, char *);
int main(void) {
  char str1[] = "h";
  char str2[] = "ch";
  if (strcmp(str1, str2) < 0) {
    printf("h, ch\n");
  } else {
    printf("ch, h\n");
  }
  if (strcoll(str1, str2) < 0) {
    printf("h, ch\n");
  } else {
    printf("ch, h\n");
  }
  setlocale(LC_COLLATE, "cs_CZ.iso88592");
  if (strcmp(str1, str2) < 0) {
    printf("h, ch\n");
  } else {
    printf("ch, h\n");
  }
  if (strcoll(str1, str2) < 0) {
    printf("h, ch\n");
  } else {
    printf("ch, h\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeab(%rip),%ax
mov    %ax,-0x6(%rbp)
mov    0xe9f(%rip),%ax
mov    %ax,-0x9(%rbp)
mov    0xe97(%rip),%al
mov    %al,-0x7(%rbp)
lea    -0x6(%rbp),%rdi
lea    -0x9(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jge    1196 <main+0x56>
lea    0xe77(%rip),%rdi
call   1030 <printf@plt>
jmp    11a2 <main+0x62>
lea    0xe6d(%rip),%rdi
call   1030 <printf@plt>
lea    -0x6(%rbp),%rdi
lea    -0x9(%rbp),%rsi
call   1050 <strcoll@plt>
cmp    $0x0,%rax
jge    11ca <main+0x8a>
lea    0xe43(%rip),%rdi
call   1030 <printf@plt>
jmp    11d6 <main+0x96>
lea    0xe39(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e0b(%rip),%rax
mov    (%rax),%edi
lea    0xe2b(%rip),%rsi
call   1060 <setlocale@plt>
lea    -0x6(%rbp),%rdi
lea    -0x9(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jge    1213 <main+0xd3>
lea    0xdfa(%rip),%rdi
call   1030 <printf@plt>
jmp    121f <main+0xdf>
lea    0xdf0(%rip),%rdi
call   1030 <printf@plt>
lea    -0x6(%rbp),%rdi
lea    -0x9(%rbp),%rsi
call   1050 <strcoll@plt>
cmp    $0x0,%rax
jge    1247 <main+0x107>
lea    0xdc6(%rip),%rdi
call   1030 <printf@plt>
jmp    1253 <main+0x113>
lea    0xdbc(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
movw   $0x68,0x6(%rsp)
movb   $0x0,0x4(%rsp)
movw   $0x6863,0x2(%rsp)
lea    0x6(%rsp),%r15
lea    0x2(%rsp),%r14
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
lea    0xe9b(%rip),%r12
lea    0xe8e(%rip),%rbx
mov    %rbx,%rdi
cmovs  %r12,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1050 <strcoll@plt>
test   %rax,%rax
mov    %rbx,%rdi
cmovs  %r12,%rdi
call   1030 <puts@plt>
mov    0x2e3a(%rip),%rax
mov    (%rax),%edi
lea    0xe49(%rip),%rsi
call   1060 <setlocale@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
mov    %rbx,%rdi
cmovs  %r12,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1050 <strcoll@plt>
test   %rax,%rax
cmovs  %r12,%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.str1 = [2 x i8] c"h\00"
@__const.main.str2 = [3 x i8] c"ch\00"
@.str = [7 x i8] c"h, ch\0A\00"
@.str.1 = [7 x i8] c"ch, h\0A\00"
@LC_COLLATE = global i32 0
@.str.2 = [15 x i8] c"cs_CZ.iso88592\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x i8]
%3 = alloca [3 x i8]
store i32 0, i32* %1
%4 = bitcast [2 x i8]* %2 to i8*
%5 = bitcast [3 x i8]* %3 to i8*
%6 = getelementptr inbounds [2 x i8], [2 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%8 = call i64 @strcmp(i8* %6, i8* %7)
%9 = icmp slt i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %14
12: ; preds = %0
%13 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %12, %10
%15 = getelementptr inbounds [2 x i8], [2 x i8]* %2, i64 0, i64 0
%16 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%17 = call i64 @strcoll(i8* %15, i8* %16)
%18 = icmp slt i64 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %14
%20 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %23
21: ; preds = %14
%22 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %23
23: ; preds = %21, %19
%24 = load i32, i32* @LC_COLLATE
%25 = call i32 @setlocale(i32 %24, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%26 = getelementptr inbounds [2 x i8], [2 x i8]* %2, i64 0, i64 0
%27 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%28 = call i64 @strcmp(i8* %26, i8* %27)
%29 = icmp slt i64 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %23
%31 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %34
32: ; preds = %23
%33 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %34
34: ; preds = %32, %30
%35 = getelementptr inbounds [2 x i8], [2 x i8]* %2, i64 0, i64 0
%36 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%37 = call i64 @strcoll(i8* %35, i8* %36)
%38 = icmp slt i64 %37, 0
br i1 %38, label %39, label %41
39: ; preds = %34
%40 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %43
41: ; preds = %34
%42 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %43
43: ; preds = %41, %39
ret i32 0
}

LLVM IR (-O2):
@__const.main.str2 = [3 x i8] c"ch\00"
@LC_COLLATE = global i32 0
@.str.2 = [15 x i8] c"cs_CZ.iso88592\00"
@str.5 = [6 x i8] c"ch, h\00"
@str.9 = [6 x i8] c"h, ch\00"
define i32 @main() {
%1 = alloca i16
%2 = alloca [3 x i8]
%3 = bitcast i16* %1 to i8*
store i16 104, i16* %1
%4 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%5 = call i64 @strcmp(i8* %3, i8* %4)
%6 = icmp slt i64 %5, 0
%7 = select i1 %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str.9, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str.5, i64 0, i64 0)
%8 = call i32 @puts(i8* dereferenceable(1) %7)
%9 = call i64 @strcoll(i8* %3, i8* %4)
%10 = icmp slt i64 %9, 0
%11 = select i1 %10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str.9, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str.5, i64 0, i64 0)
%12 = call i32 @puts(i8* dereferenceable(1) %11)
%13 = load i32, i32* @LC_COLLATE
%14 = call i32 @setlocale(i32 %13, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%15 = call i64 @strcmp(i8* %3, i8* %4)
%16 = icmp slt i64 %15, 0
%17 = select i1 %16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str.9, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str.5, i64 0, i64 0)
%18 = call i32 @puts(i8* dereferenceable(1) %17)
%19 = call i64 @strcoll(i8* %3, i8* %4)
%20 = icmp slt i64 %19, 0
%21 = select i1 %20, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str.9, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str.5, i64 0, i64 0)
%22 = call i32 @puts(i8* dereferenceable(1) %21)
ret i32 0
}