#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 getTarget(int, int *, int, int *, int);
double findMedianSortedArrays(int *nums1, int nums1Size, int *nums2,
                              int nums2Size) {
  int size = nums1Size + nums2Size;
  if (size & 1) {
    return getTarget(size >> 1, nums1, nums1Size, nums2, nums2Size);
  }
  return (getTarget((size >> 1) - 1, nums1, nums1Size, nums2, nums2Size) +
          getTarget(size >> 1, nums1, nums1Size, nums2, nums2Size)) /
         2.0;
}


x86 assembly (clang, -O0):
<findMedianSortedArrays>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    -0x14(%rbp),%eax
add    -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1162 <findMedianSortedArrays+0x52>
mov    -0x28(%rbp),%edi
sar    $0x1,%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    -0x24(%rbp),%r8d
call   1030 <getTarget@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    11bb <findMedianSortedArrays+0xab>
mov    -0x28(%rbp),%edi
sar    $0x1,%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    -0x24(%rbp),%r8d
call   1030 <getTarget@plt>
movsd  %xmm0,-0x30(%rbp)
mov    -0x28(%rbp),%edi
sar    $0x1,%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    -0x24(%rbp),%r8d
call   1030 <getTarget@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  0xe4e(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<findMedianSortedArrays>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %ecx,%r15d
mov    %rdx,%r14
mov    %esi,%r13d
mov    %rdi,%r12
lea    (%r15,%r13,1),%eax
mov    %eax,%ebx
sar    %ebx
test   $0x1,%al
jne    117e <findMedianSortedArrays+0x6e>
lea    -0x1(%rbx),%edi
mov    %r12,%rsi
mov    %r13d,%edx
mov    %r14,%rcx
mov    %r15d,%r8d
call   1030 <getTarget@plt>
movsd  %xmm0,0x8(%rsp)
mov    %ebx,%edi
mov    %r12,%rsi
mov    %r13d,%edx
mov    %r14,%rcx
mov    %r15d,%r8d
call   1030 <getTarget@plt>
addsd  0x8(%rsp),%xmm0
mulsd  0xe90(%rip),%xmm0
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
mov    %ebx,%edi
mov    %r12,%rsi
mov    %r13d,%edx
mov    %r14,%rcx
mov    %r15d,%r8d
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1030 <getTarget@plt>

LLVM IR (-O0):
define double @findMedianSortedArrays(i32* %0, i32 %1, i32* %2, i32 %3) {
%5 = alloca double
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
store i32* %0, i32** %6
store i32 %1, i32* %7
store i32* %2, i32** %8
store i32 %3, i32* %9
%11 = load i32, i32* %7
%12 = load i32, i32* %9
%13 = add nsw i32 %11, %12
store i32 %13, i32* %10
%14 = load i32, i32* %10
%15 = and i32 %14, 1
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %25
17: ; preds = %4
%18 = load i32, i32* %10
%19 = ashr i32 %18, 1
%20 = load i32*, i32** %6
%21 = load i32, i32* %7
%22 = load i32*, i32** %8
%23 = load i32, i32* %9
%24 = call double @getTarget(i32 %19, i32* %20, i32 %21, i32* %22, i32 %23)
store double %24, double* %5
br label %43
25: ; preds = %4
%26 = load i32, i32* %10
%27 = ashr i32 %26, 1
%28 = sub nsw i32 %27, 1
%29 = load i32*, i32** %6
%30 = load i32, i32* %7
%31 = load i32*, i32** %8
%32 = load i32, i32* %9
%33 = call double @getTarget(i32 %28, i32* %29, i32 %30, i32* %31, i32 %32)
%34 = load i32, i32* %10
%35 = ashr i32 %34, 1
%36 = load i32*, i32** %6
%37 = load i32, i32* %7
%38 = load i32*, i32** %8
%39 = load i32, i32* %9
%40 = call double @getTarget(i32 %35, i32* %36, i32 %37, i32* %38, i32 %39)
%41 = fadd double %33, %40
%42 = fdiv double %41, 2.000000e+00
store double %42, double* %5
br label %43
43: ; preds = %25, %17
%44 = load double, double* %5
ret double %44
}

LLVM IR (-O2):
define double @findMedianSortedArrays(i32* %0, i32 %1, i32* %2, i32 %3) {
%5 = add nsw i32 %3, %1
%6 = and i32 %5, 1
%7 = icmp eq i32 %6, 0
%8 = ashr i32 %5, 1
br i1 %7, label %11, label %9
9: ; preds = %4
%10 = tail call double @getTarget(i32 %8, i32* %0, i32 %1, i32* %2, i32 %3)
br label %17
11: ; preds = %4
%12 = add nsw i32 %8, -1
%13 = tail call double @getTarget(i32 %12, i32* %0, i32 %1, i32* %2, i32 %3)
%14 = tail call double @getTarget(i32 %8, i32* %0, i32 %1, i32* %2, i32 %3)
%15 = fadd double %13, %14
%16 = fmul double %15, 5.000000e-01
br label %17
17: ; preds = %11, %9
%18 = phi double [ %10, %9 ], [ %16, %11 ]
ret double %18
}