#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() {
  int ret = 0;
  char str1[100] = {'\0'}, str2[100] = {'\0'};
  printf("\nEnter string 1: ");
  scanf("%s", str1);
  printf("\nEnter string 2: ");
  scanf("%s", str2);
  ret = strcmp(str1, str2);
  if (ret < 0) {
    printf("\nstring1 is less than string2\n");
  } else if (ret > 0) {
    printf("\nstring2 is less than string1\n");
  } else {
    printf("\nstring1 is equal to string2\n");
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1040 <memset@plt>
lea    -0xe0(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1040 <memset@plt>
lea    0xe7d(%rip),%rdi
call   1030 <printf@plt>
lea    -0x70(%rbp),%rsi
lea    0xe7f(%rip),%rdi
call   1060 <scanf@plt>
lea    0xe76(%rip),%rdi
call   1030 <printf@plt>
lea    -0xe0(%rbp),%rsi
lea    0xe60(%rip),%rdi
call   1060 <scanf@plt>
lea    -0x70(%rbp),%rdi
lea    -0xe0(%rbp),%rsi
call   1050 <strcmp@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    11e5 <main+0xa5>
lea    0xe4c(%rip),%rdi
call   1030 <printf@plt>
jmp    1211 <main+0xd1>
cmpl   $0x0,-0x8(%rbp)
jle    1200 <main+0xc0>
lea    0xe50(%rip),%rdi
call   1030 <printf@plt>
jmp    120c <main+0xcc>
lea    0xe5e(%rip),%rdi
call   1030 <printf@plt>
jmp    1211 <main+0xd1>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xe0,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movl   $0x0,0xd0(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movl   $0x0,0x60(%rsp)
lea    0xe4d(%rip),%rdi
call   1040 <printf@plt>
lea    0xe53(%rip),%r15
lea    0x70(%rsp),%r14
mov    %r15,%rdi
mov    %r14,%rsi
call   1060 <scanf@plt>
lea    0xe3f(%rip),%rdi
call   1040 <printf@plt>
mov    %rsp,%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
lea    0xe2a(%rip),%rax
lea    0xe40(%rip),%rcx
cmove  %rax,%rcx
lea    0xe53(%rip),%rdi
cmovns %rcx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [18 x i8] c"\0AEnter string 1: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [18 x i8] c"\0AEnter string 2: \00"
@str = [29 x i8] c"\0Astring1 is equal to string2\00"
@str.6 = [30 x i8] c"\0Astring2 is less than string1\00"
@str.7 = [30 x i8] c"\0Astring1 is less than string2\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 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 @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.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* %4)
%9 = call i32 @strcmp(i8* %3, i8* %4)
%10 = icmp slt i32 %9, 0
%11 = icmp eq i32 %9, 0
%12 = select i1 %11, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @str.6, i64 0, i64 0)
%13 = select i1 %10, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @str.7, i64 0, i64 0), i8* %12
%14 = call i32 @puts(i8* dereferenceable(1) %13)
ret i32 0
}