#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 EXIT_SUCCESS;
int /*<<< orphan*/ chop(char *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ stdin;
int strcmp(char *, char *);
int main() {
  char str1[128];
  char str2[128];
  int sc;
  printf("Enter the first string: ");
  fgets(str1, 128, stdin);
  chop(str1);
  printf("Enter the second string: ");
  fgets(str2, 128, stdin);
  chop(str2);
  sc = strcmp(str1, str2);
  if (sc == 0) {
    puts("The two strings are identical.");
  } else if (sc < 0) {
    puts("The first string is less than the second one.");
  } else {
    puts("The first string is greater than the second one.");
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe97(%rip),%rdi
call   1040 <printf@plt>
lea    -0x90(%rbp),%rdi
mov    0x2e6c(%rip),%rax
mov    (%rax),%edx
mov    $0x80,%esi
call   1060 <fgets@plt>
lea    -0x90(%rbp),%rdi
call   1050 <chop@plt>
lea    0xe7e(%rip),%rdi
call   1040 <printf@plt>
lea    -0x110(%rbp),%rdi
mov    0x2e3a(%rip),%rax
mov    (%rax),%edx
mov    $0x80,%esi
call   1060 <fgets@plt>
lea    -0x110(%rbp),%rdi
call   1050 <chop@plt>
lea    -0x90(%rbp),%rdi
lea    -0x110(%rbp),%rsi
call   1070 <strcmp@plt>
mov    %eax,-0x114(%rbp)
cmpl   $0x0,-0x114(%rbp)
jne    11fd <main+0xad>
lea    0xe40(%rip),%rdi
call   1030 <puts@plt>
jmp    122c <main+0xdc>
cmpl   $0x0,-0x114(%rbp)
jge    121b <main+0xcb>
lea    0xe41(%rip),%rdi
call   1030 <puts@plt>
jmp    1227 <main+0xd7>
lea    0xe5e(%rip),%rdi
call   1030 <puts@plt>
jmp    122c <main+0xdc>
mov    0x2da5(%rip),%rax
mov    (%rax),%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x108,%rsp
lea    0xe9f(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e7b(%rip),%rbx
mov    (%rbx),%edx
lea    0x80(%rsp),%r14
mov    %r14,%rdi
mov    $0x80,%esi
call   1060 <fgets@plt>
mov    %r14,%rdi
call   1050 <chop@plt>
lea    0xe86(%rip),%rdi
call   1040 <printf@plt>
mov    (%rbx),%edx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x80,%esi
call   1060 <fgets@plt>
mov    %rbx,%rdi
call   1050 <chop@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1070 <strcmp@plt>
test   %eax,%eax
lea    0xe8c(%rip),%rax
lea    0xeb3(%rip),%rcx
cmovs  %rax,%rcx
lea    0xe5b(%rip),%rdi
cmovne %rcx,%rdi
call   1030 <puts@plt>
mov    0x2df0(%rip),%rax
mov    (%rax),%eax
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Enter the first string: \00"
@stdin = global i32 0
@.str.1 = [26 x i8] c"Enter the second string: \00"
@.str.2 = [31 x i8] c"The two strings are identical.\00"
@.str.3 = [46 x i8] c"The first string is less than the second one.\00"
@.str.4 = [49 x i8] c"The first string is greater than the second one.\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [128 x i8]
%3 = alloca [128 x i8]
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%7 = load i32, i32* @stdin
%8 = call i32 @fgets(i8* %6, i32 128, i32 %7)
%9 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%10 = call i32 @chop(i8* %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%12 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%13 = load i32, i32* @stdin
%14 = call i32 @fgets(i8* %12, i32 128, i32 %13)
%15 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%16 = call i32 @chop(i8* %15)
%17 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%18 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%19 = call i32 @strcmp(i8* %17, i8* %18)
store i32 %19, i32* %4
%20 = load i32, i32* %4
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %0
%23 = call i32 @puts(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
br label %32
24: ; preds = %0
%25 = load i32, i32* %4
%26 = icmp slt i32 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = call i32 @puts(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0))
br label %31
29: ; preds = %24
%30 = call i32 @puts(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.4, i64 0, i64 0))
br label %31
31: ; preds = %29, %27
br label %32
32: ; preds = %31, %22
%33 = load i32, i32* @EXIT_SUCCESS
ret i32 %33
}

LLVM IR (-O2):
@.str = [25 x i8] c"Enter the first string: \00"
@stdin = global i32 0
@.str.1 = [26 x i8] c"Enter the second string: \00"
@.str.2 = [31 x i8] c"The two strings are identical.\00"
@.str.3 = [46 x i8] c"The first string is less than the second one.\00"
@.str.4 = [49 x i8] c"The first string is greater than the second one.\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca [128 x i8]
%2 = alloca [128 x i8]
%3 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @stdin
%7 = call i32 @fgets(i8* %3, i32 128, i32 %6)
%8 = call i32 @chop(i8* %3)
%9 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%10 = load i32, i32* @stdin
%11 = call i32 @fgets(i8* %4, i32 128, i32 %10)
%12 = call i32 @chop(i8* %4)
%13 = call i32 @strcmp(i8* %3, i8* %4)
%14 = icmp eq i32 %13, 0
%15 = icmp slt i32 %13, 0
%16 = select i1 %15, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.4, i64 0, i64 0)
%17 = select i1 %14, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i8* %16
%18 = call i32 @puts(i8* dereferenceable(1) %17)
%19 = load i32, i32* @EXIT_SUCCESS
ret i32 %19
}