#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*/ print(char *);
int /*<<< orphan*/ prints(short);
int /*<<< orphan*/ putchar(char);
void cmp(short a, short b) {
  prints(a);
  putchar(' ');
  prints(b);
  if (a == b)
    print(" ==");
  if (a != b)
    print(" !=");
  if (a < b)
    print(" < ");
  if (a > b)
    print(" > ");
  if (a <= b)
    print(" <=");
  if (a >= b)
    print(" >=");
  print("\r\n");
}


x86 assembly (clang, -O0):
<cmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
movswl -0x2(%rbp),%edi
call   1050 <prints@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
movswl -0x4(%rbp),%edi
call   1050 <prints@plt>
movswl -0x2(%rbp),%eax
movswl -0x4(%rbp),%ecx
cmp    %ecx,%eax
jne    117e <cmp+0x4e>
lea    0xe87(%rip),%rdi
call   1040 <print@plt>
movswl -0x2(%rbp),%eax
movswl -0x4(%rbp),%ecx
cmp    %ecx,%eax
je     119a <cmp+0x6a>
lea    0xe6f(%rip),%rdi
call   1040 <print@plt>
movswl -0x2(%rbp),%eax
movswl -0x4(%rbp),%ecx
cmp    %ecx,%eax
jge    11b6 <cmp+0x86>
lea    0xe57(%rip),%rdi
call   1040 <print@plt>
movswl -0x2(%rbp),%eax
movswl -0x4(%rbp),%ecx
cmp    %ecx,%eax
jle    11d2 <cmp+0xa2>
lea    0xe3f(%rip),%rdi
call   1040 <print@plt>
movswl -0x2(%rbp),%eax
movswl -0x4(%rbp),%ecx
cmp    %ecx,%eax
jg     11ee <cmp+0xbe>
lea    0xe27(%rip),%rdi
call   1040 <print@plt>
movswl -0x2(%rbp),%eax
movswl -0x4(%rbp),%ecx
cmp    %ecx,%eax
jl     120a <cmp+0xda>
lea    0xe0f(%rip),%rdi
call   1040 <print@plt>
lea    0xe07(%rip),%rdi
call   1040 <print@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
call   1050 <prints@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    %ebx,%edi
call   1050 <prints@plt>
lea    0xeac(%rip),%rax
lea    0xea9(%rip),%rdi
cmp    %bx,%bp
cmove  %rax,%rdi
lea    0xea3(%rip),%rax
lea    0xea0(%rip),%rcx
cmovle %rcx,%rax
lea    0xe8d(%rip),%rbx
cmovge %rax,%rbx
lea    0xe8e(%rip),%rbp
cmovl  %rcx,%rbp
call   1040 <print@plt>
mov    %rbx,%rdi
call   1040 <print@plt>
mov    %rbp,%rdi
call   1040 <print@plt>
lea    0xe72(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <print@plt>

LLVM IR (-O0):
@.str = [4 x i8] c" ==\00"
@.str.1 = [4 x i8] c" !=\00"
@.str.2 = [4 x i8] c" < \00"
@.str.3 = [4 x i8] c" > \00"
@.str.4 = [4 x i8] c" <=\00"
@.str.5 = [4 x i8] c" >=\00"
@.str.6 = [3 x i8] c"\0D\0A\00"
define void @cmp(i16 signext %0, i16 signext %1) {
%3 = alloca i16
%4 = alloca i16
store i16 %0, i16* %3
store i16 %1, i16* %4
%5 = load i16, i16* %3
%6 = call i32 @prints(i16 signext %5)
%7 = call i32 @putchar(i8 signext 32)
%8 = load i16, i16* %4
%9 = call i32 @prints(i16 signext %8)
%10 = load i16, i16* %3
%11 = sext i16 %10 to i32
%12 = load i16, i16* %4
%13 = sext i16 %12 to i32
%14 = icmp eq i32 %11, %13
br i1 %14, label %15, label %17
15: ; preds = %2
%16 = call i32 @print(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %17
17: ; preds = %15, %2
%18 = load i16, i16* %3
%19 = sext i16 %18 to i32
%20 = load i16, i16* %4
%21 = sext i16 %20 to i32
%22 = icmp ne i32 %19, %21
br i1 %22, label %23, label %25
23: ; preds = %17
%24 = call i32 @print(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %25
25: ; preds = %23, %17
%26 = load i16, i16* %3
%27 = sext i16 %26 to i32
%28 = load i16, i16* %4
%29 = sext i16 %28 to i32
%30 = icmp slt i32 %27, %29
br i1 %30, label %31, label %33
31: ; preds = %25
%32 = call i32 @print(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %33
33: ; preds = %31, %25
%34 = load i16, i16* %3
%35 = sext i16 %34 to i32
%36 = load i16, i16* %4
%37 = sext i16 %36 to i32
%38 = icmp sgt i32 %35, %37
br i1 %38, label %39, label %41
39: ; preds = %33
%40 = call i32 @print(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %41
41: ; preds = %39, %33
%42 = load i16, i16* %3
%43 = sext i16 %42 to i32
%44 = load i16, i16* %4
%45 = sext i16 %44 to i32
%46 = icmp sle i32 %43, %45
br i1 %46, label %47, label %49
47: ; preds = %41
%48 = call i32 @print(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %49
49: ; preds = %47, %41
%50 = load i16, i16* %3
%51 = sext i16 %50 to i32
%52 = load i16, i16* %4
%53 = sext i16 %52 to i32
%54 = icmp sge i32 %51, %53
br i1 %54, label %55, label %57
55: ; preds = %49
%56 = call i32 @print(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
br label %57
57: ; preds = %55, %49
%58 = call i32 @print(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c" ==\00"
@.str.1 = [4 x i8] c" !=\00"
@.str.2 = [4 x i8] c" < \00"
@.str.3 = [4 x i8] c" > \00"
@.str.4 = [4 x i8] c" <=\00"
@.str.5 = [4 x i8] c" >=\00"
@.str.6 = [3 x i8] c"\0D\0A\00"
define void @cmp(i16 signext %0, i16 signext %1) {
%3 = tail call i32 @prints(i16 signext %0)
%4 = tail call i32 @putchar(i8 signext 32)
%5 = tail call i32 @prints(i16 signext %1)
%6 = icmp eq i16 %0, %1
%7 = select i1 %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0)
%8 = tail call i32 @print(i8* %7)
%9 = icmp slt i16 %0, %1
%10 = icmp sgt i16 %0, %1
%11 = select i1 %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0)
%12 = select i1 %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %11
%13 = select i1 %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0)
%14 = tail call i32 @print(i8* %12)
%15 = tail call i32 @print(i8* %13)
%16 = tail call i32 @print(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
ret void
}