#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*/ getch();
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *, ...);
int strcmp(char *, char *);
void main() {
  char s1[50];
  char s2[50];
  int compare;
  printf("\nPlease input string(1):");
  gets(s1);
  printf("\nPlease input string(2):");
  gets(s2);
  compare = strcmp(s1, s2);
  printf("\nString(1):%s", s1);
  printf("\nString(2):%s", s2);
  switch (compare) {
  case 0:
    printf("\nString(1)==String(2)\n");
    break;
  case 1:
    printf("\nString(1)>String(2)\n");
    break;
  case -1:
    printf("\nString(1)<String(2)\n");
    break;
  }
  getch();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
lea    0xeae(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x89(%rbp)
call   1030 <printf@plt>
lea    -0x40(%rbp),%rdi
mov    %rdi,-0xa0(%rbp)
call   1050 <gets@plt>
mov    -0x89(%rbp),%al
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
lea    -0x80(%rbp),%rdi
mov    %rdi,-0x98(%rbp)
call   1050 <gets@plt>
mov    -0xa0(%rbp),%rdi
mov    -0x98(%rbp),%rsi
call   1040 <strcmp@plt>
mov    -0xa0(%rbp),%rsi
mov    %eax,%ecx
mov    -0x89(%rbp),%al
mov    %ecx,-0x84(%rbp)
lea    0xe72(%rip),%rdi
call   1030 <printf@plt>
mov    -0x98(%rbp),%rsi
mov    -0x89(%rbp),%al
lea    0xe67(%rip),%rdi
call   1030 <printf@plt>
mov    -0x84(%rbp),%eax
mov    %eax,-0x88(%rbp)
sub    $0xffffffff,%eax
je     1245 <main+0x105>
jmp    11f8 <main+0xb8>
mov    -0x88(%rbp),%eax
test   %eax,%eax
je     121f <main+0xdf>
jmp    120b <main+0xcb>
mov    -0x88(%rbp),%eax
sub    $0x1,%eax
je     1232 <main+0xf2>
jmp    1253 <main+0x113>
lea    0xe28(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1253 <main+0x113>
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1253 <main+0x113>
lea    0xe2f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1060 <getch@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x80,%rsp
lea    0xe9d(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x40(%rsp),%r14
mov    %r14,%rdi
call   1060 <gets@plt>
lea    0xe9b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%r15
mov    %r15,%rdi
call   1060 <gets@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <strcmp@plt>
mov    %eax,%ebx
lea    0xe8e(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe8b(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebx
cmp    $0x2,%ebx
ja     11dd <main+0x8d>
movslq %ebx,%rax
lea    0xebf(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1070 <getch@plt>
add    $0x80,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [25 x i8] c"\0APlease input string(1):\00"
@.str.1 = [25 x i8] c"\0APlease input string(2):\00"
@.str.2 = [14 x i8] c"\0AString(1):%s\00"
@.str.3 = [14 x i8] c"\0AString(2):%s\00"
@.str.4 = [23 x i8] c"\0AString(1)==String(2)\0A\00"
@.str.5 = [22 x i8] c"\0AString(1)>String(2)\0A\00"
@.str.6 = [22 x i8] c"\0AString(1)<String(2)\0A\00"
define void @main() {
%1 = alloca [50 x i8]
%2 = alloca [50 x i8]
%3 = alloca i32
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%6 = call i32 @gets(i8* %5)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%8 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%9 = call i32 @gets(i8* %8)
%10 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%11 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%12 = call i32 @strcmp(i8* %10, i8* %11)
store i32 %12, i32* %3
%13 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %13)
%15 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* %15)
%17 = load i32, i32* %3
switch i32 %17, label %24 [
i32 0, label %18
i32 1, label %20
i32 -1, label %22
]
18: ; preds = %0
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
br label %24
20: ; preds = %0
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
br label %24
22: ; preds = %0
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0))
br label %24
24: ; preds = %0, %22, %20, %18
%25 = call i32 (...) @getch()
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"\0APlease input string(1):\00"
@.str.1 = [25 x i8] c"\0APlease input string(2):\00"
@.str.2 = [14 x i8] c"\0AString(1):%s\00"
@.str.3 = [14 x i8] c"\0AString(2):%s\00"
@str = [21 x i8] c"\0AString(1)<String(2)\00"
@str.7 = [21 x i8] c"\0AString(1)>String(2)\00"
@str.8 = [22 x i8] c"\0AString(1)==String(2)\00"
@reltable.main = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([21 x i8]* @str to i64), i64 ptrtoint ([3 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([22 x i8]* @str.8 to i64), i64 ptrtoint ([3 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([21 x i8]* @str.7 to i64), i64 ptrtoint ([3 x i32]* @reltable.main to i64)) to i32)]
define void @main() {
%1 = alloca [50 x i8]
%2 = alloca [50 x i8]
%3 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @gets(i8* %3)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @gets(i8* %4)
%9 = call i32 @strcmp(i8* %3, i8* %4)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* %4)
%12 = add i32 %9, 1
%13 = icmp ult i32 %12, 3
br i1 %13, label %14, label %19
14: ; preds = %0
%15 = sext i32 %12 to i64
%16 = shl i64 %15, 2
%17 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.main to i8*), i64 %16)
%18 = call i32 @puts(i8* dereferenceable(1) %17)
br label %19
19: ; preds = %0, %14
%20 = call i32 (...) @getch()
ret void
}