#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*/ getLine(char *, int);
int /*<<< orphan*/ printf(char *, ...);
size_t strcmp(char *, char *);
int main() {
  char s1[20], s2[20];
  size_t n;
  printf("Enter string s1: ");
  getLine(s1, 20);
  printf("Enter string s2: ");
  getLine(s2, 20);
  n = strcmp(s1, s2);
  if (n == 0) {
    printf("The two strings are the same\n");
  } else if (n == -1) {
    printf("%s is less than %s\n", s1, s2);
  } else
    printf("%s is greater than %s\n", s1, s2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
mov    $0x14,%esi
call   1050 <getLine@plt>
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x40(%rbp),%rdi
mov    $0x14,%esi
call   1050 <getLine@plt>
lea    -0x20(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1040 <strcmp@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
jne    11a6 <main+0x76>
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e7 <main+0xb7>
cmpq   $0xffffffffffffffff,-0x48(%rbp)
jne    11cc <main+0x9c>
lea    -0x20(%rbp),%rsi
lea    -0x40(%rbp),%rdx
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e2 <main+0xb2>
lea    -0x20(%rbp),%rsi
lea    -0x40(%rbp),%rdx
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e7 <main+0xb7>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
lea    0xeb2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x20(%rsp),%r14
mov    %r14,%rdi
mov    $0x14,%esi
call   1060 <getLine@plt>
lea    0xea4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x14,%esi
call   1060 <getLine@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <strcmp@plt>
cmp    $0xffffffffffffffff,%rax
je     11a9 <main+0x69>
test   %rax,%rax
jne    11b2 <main+0x72>
lea    0xead(%rip),%rdi
call   1030 <puts@plt>
jmp    11c8 <main+0x88>
lea    0xe74(%rip),%rdi
jmp    11b9 <main+0x79>
lea    0xe7f(%rip),%rdi
lea    0x20(%rsp),%rsi
mov    %rsp,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Enter string s1: \00"
@.str.1 = [18 x i8] c"Enter string s2: \00"
@.str.2 = [30 x i8] c"The two strings are the same\0A\00"
@.str.3 = [20 x i8] c"%s is less than %s\0A\00"
@.str.4 = [23 x i8] c"%s is greater than %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i8]
%3 = alloca [20 x i8]
%4 = alloca i64
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%7 = call i32 @getLine(i8* %6, i32 20)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%9 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%10 = call i32 @getLine(i8* %9, i32 20)
%11 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%12 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%13 = call i64 @strcmp(i8* %11, i8* %12)
store i64 %13, i64* %4
%14 = load i64, i64* %4
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %0
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
br label %30
18: ; preds = %0
%19 = load i64, i64* %4
%20 = icmp eq i64 %19, -1
br i1 %20, label %21, label %25
21: ; preds = %18
%22 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%23 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i8* %22, i8* %23)
br label %29
25: ; preds = %18
%26 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%27 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 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, %16
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"Enter string s1: \00"
@.str.1 = [18 x i8] c"Enter string s2: \00"
@.str.3 = [20 x i8] c"%s is less than %s\0A\00"
@.str.4 = [23 x i8] c"%s is greater than %s\0A\00"
@str = [29 x i8] c"The two strings are the same\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = alloca [20 x i8]
%3 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @getLine(i8* %3, i32 20)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @getLine(i8* %4, i32 20)
%9 = call i64 @strcmp(i8* %3, i8* %4)
switch i64 %9, label %14 [
i64 0, label %10
i64 -1, label %12
]
10: ; preds = %0
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
br label %16
12: ; preds = %0
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i8* %3, i8* %4)
br label %16
14: ; preds = %0
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* %3, i8* %4)
br label %16
16: ; preds = %12, %14, %10
ret i32 0
}