#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, int);
void compare(int a, int b) {
  if (a > b)
    printf("%d is greater than %d\n", a, b);
  else if (a < b)
    printf("%d is less than %d\n", a, b);
  else
    printf("%d is equal to %d\n", a, b);
}


x86 assembly (clang, -O0):
<compare>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1141 <compare+0x31>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
jmp    117b <compare+0x6b>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1164 <compare+0x54>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
jmp    1176 <compare+0x66>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
jmp    117b <compare+0x6b>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare>:
mov    %esi,%edx
mov    %edi,%esi
cmp    %edx,%edi
lea    0xefa(%rip),%rax
lea    0xf07(%rip),%rcx
cmovl  %rax,%rcx
lea    0xed1(%rip),%rdi
cmovle %rcx,%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"%d is greater than %d\0A\00"
@.str.1 = [20 x i8] c"%d is less than %d\0A\00"
@.str.2 = [19 x i8] c"%d is equal to %d\0A\00"
define void @compare(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = icmp sgt i32 %5, %6
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %10)
br label %25
12: ; preds = %2
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %20
16: ; preds = %12
%17 = load i32, i32* %3
%18 = load i32, i32* %4
%19 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %17, i32 %18)
br label %24
20: ; preds = %12
%21 = load i32, i32* %3
%22 = load i32, i32* %4
%23 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %21, i32 %22)
br label %24
24: ; preds = %20, %16
br label %25
25: ; preds = %24, %8
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"%d is greater than %d\0A\00"
@.str.1 = [20 x i8] c"%d is less than %d\0A\00"
@.str.2 = [19 x i8] c"%d is equal to %d\0A\00"
define void @compare(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = icmp slt i32 %0, %1
%5 = select i1 %4, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0)
%6 = select i1 %3, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %5
%7 = tail call i32 @printf(i8* %6, i32 %0, i32 %1)
ret void
}