#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, int);
void expr_cmp_test() {
  int a, b, c;
  a = 123;
  b = 456;
  printf("%d == %d = %d\n", a, a, a == a);
  printf("%d != %d = %d\n", a, a, a != a);
  printf("%d < %d = %d\n", a, b, a < b);
  printf("%d <= %d = %d\n", a, b, a <= b);
  printf("%d <= %d = %d\n", a, a, a <= a);
  printf("%d >= %d = %d\n", b, a, b >= a);
  printf("%d >= %d = %d\n", a, a, a >= a);
  printf("%d > %d = %d\n", b, a, b > a);
}


x86 assembly (clang, -O0):
<expr_cmp_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x7b,-0x4(%rbp)
movl   $0x1c8,-0x8(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x4(%rbp),%edx
mov    -0x4(%rbp),%eax
cmp    -0x4(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%ecx
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
mov    -0x4(%rbp),%edx
mov    -0x4(%rbp),%eax
cmp    -0x4(%rbp),%eax
setne  %al
and    $0x1,%al
movzbl %al,%ecx
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
setl   %al
and    $0x1,%al
movzbl %al,%ecx
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
setle  %al
and    $0x1,%al
movzbl %al,%ecx
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
mov    -0x4(%rbp),%edx
mov    -0x4(%rbp),%eax
cmp    -0x4(%rbp),%eax
setle  %al
and    $0x1,%al
movzbl %al,%ecx
lea    0xe6b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
setge  %al
and    $0x1,%al
movzbl %al,%ecx
lea    0xe5a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
mov    -0x4(%rbp),%edx
mov    -0x4(%rbp),%eax
cmp    -0x4(%rbp),%eax
setge  %al
and    $0x1,%al
movzbl %al,%ecx
lea    0xe3a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
setg   %al
and    $0x1,%al
movzbl %al,%ecx
lea    0xe29(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<expr_cmp_test>:
push   %rbx
lea    0xee8(%rip),%rdi
mov    $0x7b,%esi
mov    $0x7b,%edx
mov    $0x1,%ecx
call   1030 <printf@plt>
lea    0xedc(%rip),%rdi
mov    $0x7b,%esi
mov    $0x7b,%edx
xor    %ecx,%ecx
call   1030 <printf@plt>
lea    0xed3(%rip),%rdi
mov    $0x7b,%esi
mov    $0x1c8,%edx
mov    $0x1,%ecx
call   1030 <printf@plt>
lea    0xec6(%rip),%rbx
mov    %rbx,%rdi
mov    $0x7b,%esi
mov    $0x1c8,%edx
mov    $0x1,%ecx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x7b,%esi
mov    $0x7b,%edx
mov    $0x1,%ecx
call   1030 <printf@plt>
lea    0xea0(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1c8,%esi
mov    $0x7b,%edx
mov    $0x1,%ecx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x7b,%esi
mov    $0x7b,%edx
mov    $0x1,%ecx
call   1030 <printf@plt>
lea    0xe7a(%rip),%rdi
mov    $0x1c8,%esi
mov    $0x7b,%edx
mov    $0x1,%ecx
pop    %rbx
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [15 x i8] c"%d == %d = %d\0A\00"
@.str.1 = [15 x i8] c"%d != %d = %d\0A\00"
@.str.2 = [14 x i8] c"%d < %d = %d\0A\00"
@.str.3 = [15 x i8] c"%d <= %d = %d\0A\00"
@.str.4 = [15 x i8] c"%d >= %d = %d\0A\00"
@.str.5 = [14 x i8] c"%d > %d = %d\0A\00"
define void @expr_cmp_test() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 123, i32 123, i32 1)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 123, i32 123, i32 0)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 123, i32 456, i32 1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 123, i32 456, i32 1)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 123, i32 123, i32 1)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 456, i32 123, i32 1)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 123, i32 123, i32 1)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i32 456, i32 123, i32 1)
ret void
}