#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 */
double median(int *, int, int *, int);
double median_opt(int *, int *, int);
int test_large_same_length() {
  int a[] = {-10, -4, -1, 3, 7, 9, 14};
  int b[] = {-7, -3, 0, 1, 5, 15, 22};
  return 2.0 == median(a, 7, b, 7) && 2.0 == median(b, 7, a, 7) &&
         2.0 == median_opt(a, b, 7) && 2.0 == median_opt(b, a, 7);
}


x86 assembly (clang, -O0):
<test_large_same_length>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0xee1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xede(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xedb(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xed9(%rip),%eax
mov    %eax,-0x8(%rbp)
mov    0xed7(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xed4(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xed1(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xecf(%rip),%eax
mov    %eax,-0x28(%rbp)
lea    -0x20(%rbp),%rdi
lea    -0x40(%rbp),%rdx
mov    $0x7,%ecx
mov    %ecx,%esi
call   1030 <median@plt>
movaps %xmm0,%xmm1
xor    %eax,%eax
movsd  0xe63(%rip),%xmm0
ucomisd %xmm1,%xmm0
mov    %al,-0x41(%rbp)
jne    1242 <test_large_same_length+0x122>
jp     1242 <test_large_same_length+0x122>
lea    -0x40(%rbp),%rdi
lea    -0x20(%rbp),%rdx
mov    $0x7,%ecx
mov    %ecx,%esi
call   1030 <median@plt>
movaps %xmm0,%xmm1
xor    %eax,%eax
movsd  0xe2f(%rip),%xmm0
ucomisd %xmm1,%xmm0
mov    %al,-0x41(%rbp)
jne    1242 <test_large_same_length+0x122>
jp     1242 <test_large_same_length+0x122>
lea    -0x20(%rbp),%rdi
lea    -0x40(%rbp),%rsi
mov    $0x7,%edx
call   1040 <median_opt@plt>
movaps %xmm0,%xmm1
xor    %eax,%eax
movsd  0xdfd(%rip),%xmm0
ucomisd %xmm1,%xmm0
mov    %al,-0x41(%rbp)
jne    1242 <test_large_same_length+0x122>
jp     1242 <test_large_same_length+0x122>
lea    -0x40(%rbp),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x7,%edx
call   1040 <median_opt@plt>
movaps %xmm0,%xmm1
movsd  0xdcd(%rip),%xmm0
ucomisd %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
mov    %al,-0x41(%rbp)
mov    -0x41(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_large_same_length>:
push   %rbx
sub    $0x40,%rsp
movups 0xef0(%rip),%xmm0
movups %xmm0,0x2c(%rsp)
movaps 0xed8(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movups 0xef8(%rip),%xmm0
movups %xmm0,0xc(%rsp)
movapd 0xedf(%rip),%xmm0
movapd %xmm0,(%rsp)
lea    0x20(%rsp),%rdi
mov    %rsp,%rdx
mov    $0x7,%esi
mov    $0x7,%ecx
call   1030 <median@plt>
xor    %ebx,%ebx
ucomisd 0xe89(%rip),%xmm0
jne    11df <test_large_same_length+0xbf>
jp     11df <test_large_same_length+0xbf>
mov    %rsp,%rdi
lea    0x20(%rsp),%rdx
mov    $0x7,%esi
mov    $0x7,%ecx
call   1030 <median@plt>
ucomisd 0xe66(%rip),%xmm0
jne    11df <test_large_same_length+0xbf>
jp     11df <test_large_same_length+0xbf>
lea    0x20(%rsp),%rdi
mov    %rsp,%rsi
mov    $0x7,%edx
call   1040 <median_opt@plt>
ucomisd 0xe48(%rip),%xmm0
jne    11df <test_large_same_length+0xbf>
jp     11df <test_large_same_length+0xbf>
mov    %rsp,%rdi
lea    0x20(%rsp),%rsi
mov    $0x7,%edx
call   1040 <median_opt@plt>
cmpeqsd 0xe29(%rip),%xmm0
movq   %xmm0,%rbx
and    $0x1,%ebx
mov    %ebx,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.test_large_same_length.a = [7 x i32] [i32 -10, i32 -4, i32 -1, i32 3, i32 7, i32 9, i32 14]
@__const.test_large_same_length.b = [7 x i32] [i32 -7, i32 -3, i32 0, i32 1, i32 5, i32 15, i32 22]
define i32 @test_large_same_length() {
%1 = alloca [7 x i32]
%2 = alloca [7 x i32]
%3 = bitcast [7 x i32]* %1 to i8*
%4 = bitcast [7 x i32]* %2 to i8*
%5 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 0
%6 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 0
%7 = call double @median(i32* %5, i32 7, i32* %6, i32 7)
%8 = fcmp oeq double 2.000000e+00, %7
br i1 %8, label %9, label %24
9: ; preds = %0
%10 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 0
%11 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 0
%12 = call double @median(i32* %10, i32 7, i32* %11, i32 7)
%13 = fcmp oeq double 2.000000e+00, %12
br i1 %13, label %14, label %24
14: ; preds = %9
%15 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 0
%16 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 0
%17 = call double @median_opt(i32* %15, i32* %16, i32 7)
%18 = fcmp oeq double 2.000000e+00, %17
br i1 %18, label %19, label %24
19: ; preds = %14
%20 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 0
%21 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 0
%22 = call double @median_opt(i32* %20, i32* %21, i32 7)
%23 = fcmp oeq double 2.000000e+00, %22
br label %24
24: ; preds = %19, %14, %9, %0
%25 = phi i1 [ false, %14 ], [ false, %9 ], [ false, %0 ], [ %23, %19 ]
%26 = zext i1 %25 to i32
ret i32 %26
}

LLVM IR (-O2):
@__const.test_large_same_length.a = [7 x i32] [i32 -10, i32 -4, i32 -1, i32 3, i32 7, i32 9, i32 14]
@__const.test_large_same_length.b = [7 x i32] [i32 -7, i32 -3, i32 0, i32 1, i32 5, i32 15, i32 22]
define i32 @test_large_same_length() {
%1 = alloca [7 x i32]
%2 = alloca [7 x i32]
%3 = bitcast [7 x i32]* %1 to i8*
%4 = bitcast [7 x i32]* %2 to i8*
%5 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 0
%6 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 0
%7 = call double @median(i32* %5, i32 7, i32* %6, i32 7)
%8 = fcmp oeq double %7, 2.000000e+00
br i1 %8, label %9, label %19
9: ; preds = %0
%10 = call double @median(i32* %6, i32 7, i32* %5, i32 7)
%11 = fcmp oeq double %10, 2.000000e+00
br i1 %11, label %12, label %19
12: ; preds = %9
%13 = call double @median_opt(i32* %5, i32* %6, i32 7)
%14 = fcmp oeq double %13, 2.000000e+00
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = call double @median_opt(i32* %6, i32* %5, i32 7)
%17 = fcmp oeq double %16, 2.000000e+00
%18 = zext i1 %17 to i32
br label %19
19: ; preds = %15, %12, %9, %0
%20 = phi i32 [ 0, %12 ], [ 0, %9 ], [ 0, %0 ], [ %18, %15 ]
ret i32 %20
}