#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*/ printf(char *, ...);
int strcmp(char *, char *);
int main() {
  char ch1[] = "Linux C";
  char ch2[] = "Linux C";
  int res;
  printf("ch1 : %s\n", ch1);
  printf("ch2 : %s\n", ch2);
  res = strcmp(ch1, ch2);
  if (res == 0)
    printf("ch1 == ch2\n");
  else if (res < 0)
    printf("ch1 < ch2\n");
  else
    printf("ch1 > ch2\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0xc(%rbp)
mov    0xebf(%rip),%rax
mov    %rax,-0x14(%rbp)
lea    -0xc(%rbp),%rsi
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x14(%rbp),%rsi
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xc(%rbp),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <strcmp@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    1196 <main+0x76>
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c6 <main+0xa6>
cmpl   $0x0,-0x18(%rbp)
jge    11b3 <main+0x93>
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c1 <main+0xa1>
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c6 <main+0xa6>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movabs $0x432078756e694c,%rax
mov    %rax,0x10(%rsp)
mov    %rax,0x8(%rsp)
lea    0xeae(%rip),%rdi
lea    0x10(%rsp),%r14
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea2(%rip),%rdi
lea    0x8(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
lea    0xe93(%rip),%rax
lea    0xe82(%rip),%rcx
cmovs  %rax,%rcx
lea    0xe8b(%rip),%rdi
cmovne %rcx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.ch1 = [8 x i8] c"Linux C\00"
@__const.main.ch2 = [8 x i8] c"Linux C\00"
@.str = [10 x i8] c"ch1 : %s\0A\00"
@.str.1 = [10 x i8] c"ch2 : %s\0A\00"
@.str.2 = [12 x i8] c"ch1 == ch2\0A\00"
@.str.3 = [11 x i8] c"ch1 < ch2\0A\00"
@.str.4 = [11 x i8] c"ch1 > ch2\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [8 x i8]
%3 = alloca [8 x i8]
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [8 x i8]* %2 to i8*
%6 = bitcast [8 x i8]* %3 to i8*
%7 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%12 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%13 = call i32 @strcmp(i8* %11, i8* %12)
store i32 %13, i32* %4
%14 = load i32, i32* %4
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %0
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %26
18: ; preds = %0
%19 = load i32, i32* %4
%20 = icmp slt i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
br label %25
23: ; preds = %18
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
br label %25
25: ; preds = %23, %21
br label %26
26: ; preds = %25, %16
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"ch1 : %s\0A\00"
@.str.1 = [10 x i8] c"ch2 : %s\0A\00"
@str = [10 x i8] c"ch1 > ch2\00"
@str.5 = [10 x i8] c"ch1 < ch2\00"
@str.6 = [11 x i8] c"ch1 == ch2\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i64
%3 = bitcast i64* %1 to i8*
store i64 18894525177948492, i64* %1
%4 = bitcast i64* %2 to i8*
store i64 18894525177948492, i64* %2
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i64* %1)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i64* %2)
%7 = call i32 @strcmp(i8* %3, i8* %4)
%8 = icmp eq i32 %7, 0
%9 = icmp slt i32 %7, 0
%10 = select i1 %9, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @str.5, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0)
%11 = select i1 %8, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @str.6, i64 0, i64 0), i8* %10
%12 = call i32 @puts(i8* dereferenceable(1) %11)
ret i32 0
}