#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_repeating() {
  int a[] = {1, 1, 1};
  int b[] = {1, 1, 1};
  return 1.0 == median(a, 3, b, 3) && 1.0 == median(b, 3, a, 3) &&
         1.0 == median_opt(a, b, 3) && 1.0 == median_opt(b, a, 3);
}


x86 assembly (clang, -O0):
<test_repeating>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xed9(%rip),%rax
mov    %rax,-0xc(%rbp)
mov    0xed7(%rip),%eax
mov    %eax,-0x4(%rbp)
mov    0xed1(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xecf(%rip),%eax
mov    %eax,-0x10(%rbp)
lea    -0xc(%rbp),%rdi
lea    -0x18(%rbp),%rdx
mov    $0x3,%ecx
mov    %ecx,%esi
call   1030 <median@plt>
movaps %xmm0,%xmm1
xor    %eax,%eax
movsd  0xe8f(%rip),%xmm0
ucomisd %xmm1,%xmm0
mov    %al,-0x19(%rbp)
jne    1216 <test_repeating+0xf6>
jp     1216 <test_repeating+0xf6>
lea    -0x18(%rbp),%rdi
lea    -0xc(%rbp),%rdx
mov    $0x3,%ecx
mov    %ecx,%esi
call   1030 <median@plt>
movaps %xmm0,%xmm1
xor    %eax,%eax
movsd  0xe5b(%rip),%xmm0
ucomisd %xmm1,%xmm0
mov    %al,-0x19(%rbp)
jne    1216 <test_repeating+0xf6>
jp     1216 <test_repeating+0xf6>
lea    -0xc(%rbp),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x3,%edx
call   1040 <median_opt@plt>
movaps %xmm0,%xmm1
xor    %eax,%eax
movsd  0xe29(%rip),%xmm0
ucomisd %xmm1,%xmm0
mov    %al,-0x19(%rbp)
jne    1216 <test_repeating+0xf6>
jp     1216 <test_repeating+0xf6>
lea    -0x18(%rbp),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x3,%edx
call   1040 <median_opt@plt>
movaps %xmm0,%xmm1
movsd  0xdf9(%rip),%xmm0
ucomisd %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_repeating>:
push   %rbx
sub    $0x20,%rsp
mov    0xee5(%rip),%eax
mov    %eax,0x18(%rsp)
mov    0xed2(%rip),%rcx
mov    %rcx,0x10(%rsp)
mov    %eax,0x8(%rsp)
mov    %rcx,(%rsp)
lea    0x10(%rsp),%rdi
mov    %rsp,%rdx
mov    $0x3,%esi
mov    $0x3,%ecx
call   1030 <median@plt>
xor    %ebx,%ebx
ucomisd 0xe9c(%rip),%xmm0
jne    11cc <test_repeating+0xac>
jp     11cc <test_repeating+0xac>
mov    %rsp,%rdi
lea    0x10(%rsp),%rdx
mov    $0x3,%esi
mov    $0x3,%ecx
call   1030 <median@plt>
ucomisd 0xe79(%rip),%xmm0
jne    11cc <test_repeating+0xac>
jp     11cc <test_repeating+0xac>
lea    0x10(%rsp),%rdi
mov    %rsp,%rsi
mov    $0x3,%edx
call   1040 <median_opt@plt>
ucomisd 0xe5b(%rip),%xmm0
jne    11cc <test_repeating+0xac>
jp     11cc <test_repeating+0xac>
mov    %rsp,%rdi
lea    0x10(%rsp),%rsi
mov    $0x3,%edx
call   1040 <median_opt@plt>
cmpeqsd 0xe3c(%rip),%xmm0
movq   %xmm0,%rbx
and    $0x1,%ebx
mov    %ebx,%eax
add    $0x20,%rsp
pop    %rbx
ret

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