#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 /*<<< orphan*/ scanf(char *, char *);
int strcmp(char *, char *);
int main(void) {
  char str1[256];
  char str2[] = "ABCDE";
  int compare_result;
  printf("str1: ");
  scanf("%s", str1);
  compare_result = strcmp(str1, str2);
  if (compare_result < 0) {
    printf("str1(\"%s\") < str2(\"%s\")\n", str1, str2);
  } else if (compare_result > 0) {
    printf("str1(\"%s\") > str2(\"%s\")\n", str1, str2);
  } else {
    printf("str1(\"%s\") == str2(\"%s\")\n", str1, str2);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeb8(%rip),%eax
mov    %eax,-0x116(%rbp)
mov    0xeaf(%rip),%ax
mov    %ax,-0x112(%rbp)
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x110(%rbp),%rsi
lea    0xe95(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x110(%rbp),%rdi
lea    -0x116(%rbp),%rsi
call   1040 <strcmp@plt>
mov    %eax,-0x11c(%rbp)
cmpl   $0x0,-0x11c(%rbp)
jge    11c4 <main+0x94>
lea    -0x110(%rbp),%rsi
lea    -0x116(%rbp),%rdx
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1213 <main+0xe3>
cmpl   $0x0,-0x11c(%rbp)
jle    11f2 <main+0xc2>
lea    -0x110(%rbp),%rsi
lea    -0x116(%rbp),%rdx
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    120e <main+0xde>
lea    -0x110(%rbp),%rsi
lea    -0x116(%rbp),%rdx
lea    0xe3b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1213 <main+0xe3>
xor    %eax,%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x118,%rsp
movw   $0x45,0xc(%rsp)
movl   $0x44434241,0x8(%rsp)
44
lea    0xeb6(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeaf(%rip),%rdi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
call   1050 <scanf@plt>
lea    0x8(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
lea    0xebe(%rip),%rax
lea    0xe9e(%rip),%rcx
cmove  %rax,%rcx
lea    0xe7a(%rip),%rdi
cmovns %rcx,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x118,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@__const.main.str2 = [6 x i8] c"ABCDE\00"
@.str = [7 x i8] c"str1: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [25 x i8] c"str1(\22%s\22) < str2(\22%s\22)\0A\00"
@.str.3 = [25 x i8] c"str1(\22%s\22) > str2(\22%s\22)\0A\00"
@.str.4 = [26 x i8] c"str1(\22%s\22) == str2(\22%s\22)\0A\00"
define i32 @main() {
%1 = alloca [256 x i8]
%2 = alloca [6 x i8]
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%7 = call i32 @strcmp(i8* %3, i8* %4)
%8 = icmp slt i32 %7, 0
%9 = icmp eq i32 %7, 0
%10 = select i1 %9, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0)
%11 = select i1 %8, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %10
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %11, i8* %3, i8* %4)
ret i32 0
}