#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*/ assert(int);
int median(int, int, ...);
int mode(int, int, ...);
int /*<<< orphan*/ printf(char *);
int main() {
  assert(median(1, 1) == 1);
  assert(median(2, 1, 2) == 1.5);
  assert(median(3, 1, 2, 3) == 2);
  assert(median(3, 3, 2, 1) == 2);
  assert(median(3, 3, 3, 3) == 3);
  assert(median(6, 9, -10, -1, 8, 3, 5) == 4);
  assert(median(7, 5, 6, 4, 1, 2, 3, 7) == 4);
  assert(median(1, 7) == 7);
  assert(median(7, 1, 1, 1, 1, 1, 1, 1) == 1);
  printf("Median done!\n");
  mode(1, 1);
  assert(mode(1, 1) == 1);
  assert(mode(3, 2, 1, 1) == 1);
  assert(mode(7, 1, 1, 1, 2, 2, 2, 2) == 2);
  assert(mode(6, 3, 3, 3, 2, 2, 2) == 2);
  assert(mode(6, 2, 3, 2, 3, 2, 3) == 2);
  printf("Mode done!\n");
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%esi
mov    %esi,%edi
mov    $0x0,%al
call   1030 <median@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    $0x2,%edx
mov    $0x1,%esi
mov    %edx,%edi
mov    $0x0,%al
call   1030 <median@plt>
cvtsi2sd %eax,%xmm0
movsd  0xe74(%rip),%xmm1
ucomisd %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    $0x3,%ecx
mov    $0x1,%esi
mov    $0x2,%edx
mov    %ecx,%edi
mov    $0x0,%al
call   1030 <median@plt>
cmp    $0x2,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    $0x3,%esi
mov    $0x2,%edx
mov    $0x1,%ecx
mov    %esi,%edi
mov    $0x0,%al
call   1030 <median@plt>
cmp    $0x2,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    $0x3,%ecx
mov    %ecx,%edi
mov    %ecx,%esi
mov    %ecx,%edx
mov    $0x0,%al
call   1030 <median@plt>
cmp    $0x3,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    $0x6,%edi
mov    $0x9,%esi
mov    $0xfffffff6,%edx
mov    $0xffffffff,%ecx
mov    $0x8,%r8d
mov    $0x3,%r9d
movl   $0x5,(%rsp)
mov    $0x0,%al
call   1030 <median@plt>
cmp    $0x4,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    $0x7,%edi
mov    $0x5,%esi
mov    $0x6,%edx
mov    $0x4,%ecx
mov    $0x1,%r8d
mov    $0x2,%r9d
movl   $0x3,(%rsp)
movl   $0x7,0x8(%rsp)
mov    $0x0,%al
call   1030 <median@plt>
cmp    $0x4,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    $0x1,%edi
mov    $0x7,%esi
mov    $0x0,%al
call   1030 <median@plt>
cmp    $0x7,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    $0x7,%edi
mov    $0x1,%r9d
mov    %r9d,%esi
mov    %r9d,%edx
mov    %r9d,%ecx
mov    %r9d,%r8d
movl   $0x1,(%rsp)
movl   $0x1,0x8(%rsp)
mov    $0x0,%al
call   1030 <median@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    0xd0b(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%esi
mov    %esi,%edi
mov    $0x0,%al
call   1060 <mode@plt>
mov    $0x1,%esi
mov    %esi,%edi
mov    $0x0,%al
call   1060 <mode@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    $0x3,%edi
mov    $0x2,%esi
mov    $0x1,%ecx
mov    %ecx,%edx
mov    $0x0,%al
call   1060 <mode@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    $0x7,%edi
mov    $0x1,%ecx
mov    $0x2,%r9d
mov    %ecx,%esi
mov    %ecx,%edx
mov    %r9d,%r8d
movl   $0x2,(%rsp)
movl   $0x2,0x8(%rsp)
mov    $0x0,%al
call   1060 <mode@plt>
cmp    $0x2,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    $0x6,%edi
mov    $0x3,%ecx
mov    $0x2,%r9d
mov    %ecx,%esi
mov    %ecx,%edx
mov    %r9d,%r8d
movl   $0x2,(%rsp)
mov    $0x0,%al
call   1060 <mode@plt>
cmp    $0x2,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    $0x6,%edi
mov    $0x2,%r9d
mov    $0x3,%r8d
mov    %r9d,%esi
mov    %r8d,%edx
mov    %r9d,%ecx
movl   $0x3,(%rsp)
mov    $0x0,%al
call   1060 <mode@plt>
cmp    $0x2,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    0xc0f(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <median@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1050 <assert@plt>
mov    $0x2,%edi
mov    $0x1,%esi
mov    $0x2,%edx
xor    %eax,%eax
call   1030 <median@plt>
xor    %edi,%edi
call   1050 <assert@plt>
mov    $0x3,%edi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x3,%ecx
xor    %eax,%eax
call   1030 <median@plt>
xor    %edi,%edi
cmp    $0x2,%eax
sete   %dil
call   1050 <assert@plt>
mov    $0x3,%edi
mov    $0x3,%esi
mov    $0x2,%edx
mov    $0x1,%ecx
xor    %eax,%eax
call   1030 <median@plt>
xor    %edi,%edi
cmp    $0x2,%eax
sete   %dil
call   1050 <assert@plt>
mov    $0x3,%edi
mov    $0x3,%esi
mov    $0x3,%edx
mov    $0x3,%ecx
xor    %eax,%eax
call   1030 <median@plt>
xor    %edi,%edi
cmp    $0x3,%eax
sete   %dil
call   1050 <assert@plt>
sub    $0x8,%rsp
mov    $0x6,%edi
mov    $0x9,%esi
mov    $0xfffffff6,%edx
mov    $0xffffffff,%ecx
mov    $0x8,%r8d
mov    $0x3,%r9d
xor    %eax,%eax
push   $0x5
call   1030 <median@plt>
add    $0x10,%rsp
xor    %edi,%edi
cmp    $0x4,%eax
sete   %dil
call   1050 <assert@plt>
mov    $0x7,%edi
mov    $0x5,%esi
mov    $0x6,%edx
mov    $0x4,%ecx
mov    $0x1,%r8d
mov    $0x2,%r9d
xor    %eax,%eax
push   $0x7
push   $0x3
call   1030 <median@plt>
add    $0x10,%rsp
xor    %edi,%edi
cmp    $0x4,%eax
sete   %dil
call   1050 <assert@plt>
mov    $0x1,%edi
mov    $0x7,%esi
xor    %eax,%eax
call   1030 <median@plt>
xor    %edi,%edi
cmp    $0x7,%eax
sete   %dil
call   1050 <assert@plt>
mov    $0x7,%edi
mov    $0x1,%esi
mov    $0x1,%edx
mov    $0x1,%ecx
mov    $0x1,%r8d
mov    $0x1,%r9d
xor    %eax,%eax
push   $0x1
push   $0x1
call   1030 <median@plt>
add    $0x10,%rsp
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1050 <assert@plt>
lea    0xd29(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
mov    $0x1,%esi
xor    %eax,%eax
call   1060 <mode@plt>
mov    $0x1,%edi
mov    $0x1,%esi
xor    %eax,%eax
call   1060 <mode@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1050 <assert@plt>
mov    $0x3,%edi
mov    $0x2,%esi
mov    $0x1,%edx
mov    $0x1,%ecx
xor    %eax,%eax
call   1060 <mode@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1050 <assert@plt>
mov    $0x7,%edi
mov    $0x1,%esi
mov    $0x1,%edx
mov    $0x1,%ecx
mov    $0x2,%r8d
mov    $0x2,%r9d
xor    %eax,%eax
push   $0x2
push   $0x2
call   1060 <mode@plt>
add    $0x10,%rsp
xor    %edi,%edi
cmp    $0x2,%eax
sete   %dil
call   1050 <assert@plt>
sub    $0x8,%rsp
mov    $0x6,%edi
mov    $0x3,%esi
mov    $0x3,%edx
mov    $0x3,%ecx
mov    $0x2,%r8d
mov    $0x2,%r9d
xor    %eax,%eax
push   $0x2
call   1060 <mode@plt>
add    $0x10,%rsp
xor    %edi,%edi
cmp    $0x2,%eax
sete   %dil
call   1050 <assert@plt>
sub    $0x8,%rsp
mov    $0x6,%edi
mov    $0x2,%esi
mov    $0x3,%edx
mov    $0x2,%ecx
mov    $0x3,%r8d
mov    $0x2,%r9d
xor    %eax,%eax
push   $0x3
call   1060 <mode@plt>
add    $0x10,%rsp
xor    %edi,%edi
cmp    $0x2,%eax
sete   %dil
call   1050 <assert@plt>
lea    0xc16(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Median done!\0A\00"
@.str.1 = [12 x i8] c"Mode done!\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (i32, i32, ...) @median(i32 1, i32 1)
%3 = icmp eq i32 %2, 1
%4 = zext i1 %3 to i32
%5 = call i32 @assert(i32 %4)
%6 = call i32 (i32, i32, ...) @median(i32 2, i32 1, i32 2)
%7 = sitofp i32 %6 to double
%8 = fcmp oeq double %7, 1.500000e+00
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = call i32 (i32, i32, ...) @median(i32 3, i32 1, i32 2, i32 3)
%12 = icmp eq i32 %11, 2
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = call i32 (i32, i32, ...) @median(i32 3, i32 3, i32 2, i32 1)
%16 = icmp eq i32 %15, 2
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
%19 = call i32 (i32, i32, ...) @median(i32 3, i32 3, i32 3, i32 3)
%20 = icmp eq i32 %19, 3
%21 = zext i1 %20 to i32
%22 = call i32 @assert(i32 %21)
%23 = call i32 (i32, i32, ...) @median(i32 6, i32 9, i32 -10, i32 -1, i32 8, i32 3, i32 5)
%24 = icmp eq i32 %23, 4
%25 = zext i1 %24 to i32
%26 = call i32 @assert(i32 %25)
%27 = call i32 (i32, i32, ...) @median(i32 7, i32 5, i32 6, i32 4, i32 1, i32 2, i32 3, i32 7)
%28 = icmp eq i32 %27, 4
%29 = zext i1 %28 to i32
%30 = call i32 @assert(i32 %29)
%31 = call i32 (i32, i32, ...) @median(i32 1, i32 7)
%32 = icmp eq i32 %31, 7
%33 = zext i1 %32 to i32
%34 = call i32 @assert(i32 %33)
%35 = call i32 (i32, i32, ...) @median(i32 7, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1)
%36 = icmp eq i32 %35, 1
%37 = zext i1 %36 to i32
%38 = call i32 @assert(i32 %37)
%39 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%40 = call i32 (i32, i32, ...) @mode(i32 1, i32 1)
%41 = call i32 (i32, i32, ...) @mode(i32 1, i32 1)
%42 = icmp eq i32 %41, 1
%43 = zext i1 %42 to i32
%44 = call i32 @assert(i32 %43)
%45 = call i32 (i32, i32, ...) @mode(i32 3, i32 2, i32 1, i32 1)
%46 = icmp eq i32 %45, 1
%47 = zext i1 %46 to i32
%48 = call i32 @assert(i32 %47)
%49 = call i32 (i32, i32, ...) @mode(i32 7, i32 1, i32 1, i32 1, i32 2, i32 2, i32 2, i32 2)
%50 = icmp eq i32 %49, 2
%51 = zext i1 %50 to i32
%52 = call i32 @assert(i32 %51)
%53 = call i32 (i32, i32, ...) @mode(i32 6, i32 3, i32 3, i32 3, i32 2, i32 2, i32 2)
%54 = icmp eq i32 %53, 2
%55 = zext i1 %54 to i32
%56 = call i32 @assert(i32 %55)
%57 = call i32 (i32, i32, ...) @mode(i32 6, i32 2, i32 3, i32 2, i32 3, i32 2, i32 3)
%58 = icmp eq i32 %57, 2
%59 = zext i1 %58 to i32
%60 = call i32 @assert(i32 %59)
%61 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [13 x i8] c"Median done!\00"
@str.2 = [11 x i8] c"Mode done!\00"
define i32 @main() {
%1 = tail call i32 (i32, i32, ...) @median(i32 1, i32 1)
%2 = icmp eq i32 %1, 1
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i32 (i32, i32, ...) @median(i32 2, i32 1, i32 2)
%6 = tail call i32 @assert(i32 0)
%7 = tail call i32 (i32, i32, ...) @median(i32 3, i32 1, i32 2, i32 3)
%8 = icmp eq i32 %7, 2
%9 = zext i1 %8 to i32
%10 = tail call i32 @assert(i32 %9)
%11 = tail call i32 (i32, i32, ...) @median(i32 3, i32 3, i32 2, i32 1)
%12 = icmp eq i32 %11, 2
%13 = zext i1 %12 to i32
%14 = tail call i32 @assert(i32 %13)
%15 = tail call i32 (i32, i32, ...) @median(i32 3, i32 3, i32 3, i32 3)
%16 = icmp eq i32 %15, 3
%17 = zext i1 %16 to i32
%18 = tail call i32 @assert(i32 %17)
%19 = tail call i32 (i32, i32, ...) @median(i32 6, i32 9, i32 -10, i32 -1, i32 8, i32 3, i32 5)
%20 = icmp eq i32 %19, 4
%21 = zext i1 %20 to i32
%22 = tail call i32 @assert(i32 %21)
%23 = tail call i32 (i32, i32, ...) @median(i32 7, i32 5, i32 6, i32 4, i32 1, i32 2, i32 3, i32 7)
%24 = icmp eq i32 %23, 4
%25 = zext i1 %24 to i32
%26 = tail call i32 @assert(i32 %25)
%27 = tail call i32 (i32, i32, ...) @median(i32 1, i32 7)
%28 = icmp eq i32 %27, 7
%29 = zext i1 %28 to i32
%30 = tail call i32 @assert(i32 %29)
%31 = tail call i32 (i32, i32, ...) @median(i32 7, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1)
%32 = icmp eq i32 %31, 1
%33 = zext i1 %32 to i32
%34 = tail call i32 @assert(i32 %33)
%35 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%36 = tail call i32 (i32, i32, ...) @mode(i32 1, i32 1)
%37 = tail call i32 (i32, i32, ...) @mode(i32 1, i32 1)
%38 = icmp eq i32 %37, 1
%39 = zext i1 %38 to i32
%40 = tail call i32 @assert(i32 %39)
%41 = tail call i32 (i32, i32, ...) @mode(i32 3, i32 2, i32 1, i32 1)
%42 = icmp eq i32 %41, 1
%43 = zext i1 %42 to i32
%44 = tail call i32 @assert(i32 %43)
%45 = tail call i32 (i32, i32, ...) @mode(i32 7, i32 1, i32 1, i32 1, i32 2, i32 2, i32 2, i32 2)
%46 = icmp eq i32 %45, 2
%47 = zext i1 %46 to i32
%48 = tail call i32 @assert(i32 %47)
%49 = tail call i32 (i32, i32, ...) @mode(i32 6, i32 3, i32 3, i32 3, i32 2, i32 2, i32 2)
%50 = icmp eq i32 %49, 2
%51 = zext i1 %50 to i32
%52 = tail call i32 @assert(i32 %51)
%53 = tail call i32 (i32, i32, ...) @mode(i32 6, i32 2, i32 3, i32 2, i32 3, i32 2, i32 3)
%54 = icmp eq i32 %53, 2
%55 = zext i1 %54 to i32
%56 = tail call i32 @assert(i32 %55)
%57 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.2, i64 0, i64 0))
ret i32 0
}