#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);
int test_large_diff_length() {
  int a[] = {-10, -4, -1, 3, 7, 9, 14, 17, 19, 21};
  int b[] = {-7, -3, 0, 1, 5, 15, 22};
  return 5.0 == median(a, 10, b, 7) && 5.0 == median(b, 7, a, 10);
}


x86 assembly (clang, -O0):
<test_large_diff_length>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
lea    -0x30(%rbp),%rdi
lea    0xedd(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
mov    0xefc(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xef9(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xef6(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xef4(%rip),%eax
mov    %eax,-0x38(%rbp)
lea    -0x30(%rbp),%rdi
lea    -0x50(%rbp),%rdx
mov    $0xa,%esi
mov    $0x7,%ecx
call   1030 <median@plt>
movaps %xmm0,%xmm1
xor    %eax,%eax
movsd  0xe75(%rip),%xmm0
ucomisd %xmm1,%xmm0
mov    %al,-0x51(%rbp)
jne    11cf <test_large_diff_length+0xaf>
jp     11cf <test_large_diff_length+0xaf>
lea    -0x50(%rbp),%rdi
lea    -0x30(%rbp),%rdx
mov    $0x7,%esi
mov    $0xa,%ecx
call   1030 <median@plt>
movaps %xmm0,%xmm1
movsd  0xe40(%rip),%xmm0
ucomisd %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
mov    %al,-0x51(%rbp)
mov    -0x51(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_large_diff_length>:
sub    $0x48,%rsp
mov    0xf15(%rip),%rax
mov    %rax,0x40(%rsp)
movaps 0xef9(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xedd(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movups 0xf0d(%rip),%xmm0
movups %xmm0,0xc(%rsp)
movapd 0xef4(%rip),%xmm0
movapd %xmm0,(%rsp)
lea    0x20(%rsp),%rdi
mov    %rsp,%rdx
mov    $0xa,%esi
mov    $0x7,%ecx
call   1030 <median@plt>
ucomisd 0xe90(%rip),%xmm0
jne    11a1 <test_large_diff_length+0x91>
jp     11a1 <test_large_diff_length+0x91>
mov    %rsp,%rdi
lea    0x20(%rsp),%rdx
mov    $0x7,%esi
mov    $0xa,%ecx
call   1030 <median@plt>
cmpeqsd 0xe6c(%rip),%xmm0
movq   %xmm0,%rax
and    $0x1,%eax
add    $0x48,%rsp
ret
xor    %eax,%eax
add    $0x48,%rsp
ret

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

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