#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*/ exit(int);
int /*<<< orphan*/ printf(char *);
int verify_median(int x, int median, int y) {
  int x_greater_y = x >= median && median >= y;
  int y_greater_x = y >= median && median >= x;
  int median_OK = x_greater_y || y_greater_x;
  if (!median_OK) {
    printf("median not OK!");
    exit(55);
  }
  return median_OK;
}


x86 assembly (clang, -O0):
<verify_median>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%ecx
xor    %eax,%eax
cmp    -0x8(%rbp),%ecx
mov    %al,-0x19(%rbp)
jl     114e <verify_median+0x2e>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
setge  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%ecx
xor    %eax,%eax
cmp    -0x8(%rbp),%ecx
mov    %al,-0x1a(%rbp)
jl     1176 <verify_median+0x56>
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
setge  %al
mov    %al,-0x1a(%rbp)
mov    -0x1a(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x14(%rbp)
mov    $0x1,%al
cmpl   $0x0,-0x10(%rbp)
mov    %al,-0x1b(%rbp)
jne    119a <verify_median+0x7a>
cmpl   $0x0,-0x14(%rbp)
setne  %al
mov    %al,-0x1b(%rbp)
mov    -0x1b(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    11c5 <verify_median+0xa5>
lea    0xe4a(%rip),%rdi
call   1030 <printf@plt>
mov    $0x37,%edi
call   1040 <exit@plt>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<verify_median>:
cmp    %esi,%edi
setge  %al
cmp    %edx,%esi
setge  %dl
setle  %r8b
cmp    %edi,%esi
setge  %cl
test   %dl,%al
jne    113c <verify_median+0x1c>
and    %r8b,%cl
je     1142 <verify_median+0x22>
mov    $0x1,%eax
ret
push   %rax
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
mov    $0x37,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"median not OK!\00"
define i32 @verify_median(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%10 = load i32, i32* %4
%11 = load i32, i32* %5
%12 = icmp sge i32 %10, %11
br i1 %12, label %13, label %17
13: ; preds = %3
%14 = load i32, i32* %5
%15 = load i32, i32* %6
%16 = icmp sge i32 %14, %15
br label %17
17: ; preds = %13, %3
%18 = phi i1 [ false, %3 ], [ %16, %13 ]
%19 = zext i1 %18 to i32
store i32 %19, i32* %7
%20 = load i32, i32* %6
%21 = load i32, i32* %5
%22 = icmp sge i32 %20, %21
br i1 %22, label %23, label %27
23: ; preds = %17
%24 = load i32, i32* %5
%25 = load i32, i32* %4
%26 = icmp sge i32 %24, %25
br label %27
27: ; preds = %23, %17
%28 = phi i1 [ false, %17 ], [ %26, %23 ]
%29 = zext i1 %28 to i32
store i32 %29, i32* %8
%30 = load i32, i32* %7
%31 = icmp ne i32 %30, 0
br i1 %31, label %35, label %32
32: ; preds = %27
%33 = load i32, i32* %8
%34 = icmp ne i32 %33, 0
br label %35
35: ; preds = %32, %27
%36 = phi i1 [ true, %27 ], [ %34, %32 ]
%37 = zext i1 %36 to i32
store i32 %37, i32* %9
%38 = load i32, i32* %9
%39 = icmp ne i32 %38, 0
br i1 %39, label %43, label %40
40: ; preds = %35
%41 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%42 = call i32 @exit(i32 55)
unreachable
43: ; preds = %35
%44 = load i32, i32* %9
ret i32 %44
}

LLVM IR (-O2):
@.str = [15 x i8] c"median not OK!\00"
define i32 @verify_median(i32 %0, i32 %1, i32 %2) {
%4 = icmp sge i32 %0, %1
%5 = icmp sge i32 %1, %2
%6 = and i1 %4, %5
%7 = icmp sge i32 %2, %1
%8 = icmp sge i32 %1, %0
%9 = and i1 %8, %7
%10 = or i1 %6, %9
br i1 %10, label %14, label %11
11: ; preds = %3
%12 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%13 = tail call i32 @exit(i32 55)
unreachable
14: ; preds = %3
ret i32 1
}