#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 find_median_sorted_arrays_helper(int *, int, int /*<<< orphan*/, int *,
                                        int, int /*<<< orphan*/, int);
double find_median_sorted_arrays(int *nums1, int nums1_size, int *nums2,
                                 int nums2_size) {
  int len;
  len = nums1_size + nums2_size;
  if (len % 2 == 1) {
    return find_median_sorted_arrays_helper(nums1, nums1_size, 0, nums2,
                                            nums2_size, 0, len / 2 + 1);
  } else {
    return (find_median_sorted_arrays_helper(nums1, nums1_size, 0, nums2,
                                             nums2_size, 0, len / 2) +
            find_median_sorted_arrays_helper(nums1, nums1_size, 0, nums2,
                                             nums2_size, 0, len / 2 + 1)) /
           2.0;
  }
}


x86 assembly (clang, -O0):
<find_median_sorted_arrays>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%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
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    117a <find_median_sorted_arrays+0x6a>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rcx
mov    -0x24(%rbp),%r8d
mov    -0x28(%rbp),%eax
mov    $0x2,%r9d
cltd
idiv   %r9d
add    $0x1,%eax
xor    %r9d,%r9d
mov    %r9d,%edx
mov    %eax,(%rsp)
call   1030 <find_median_sorted_arrays_helper@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    11f3 <find_median_sorted_arrays+0xe3>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rcx
mov    -0x24(%rbp),%r8d
mov    -0x28(%rbp),%eax
mov    $0x2,%r9d
cltd
idiv   %r9d
xor    %r9d,%r9d
mov    %r9d,%edx
mov    %eax,(%rsp)
call   1030 <find_median_sorted_arrays_helper@plt>
movsd  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rcx
mov    -0x24(%rbp),%r8d
mov    -0x28(%rbp),%eax
mov    $0x2,%r9d
cltd
idiv   %r9d
add    $0x1,%eax
xor    %r9d,%r9d
mov    %r9d,%edx
mov    %eax,(%rsp)
call   1030 <find_median_sorted_arrays_helper@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  0xe16(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_median_sorted_arrays>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %ecx,%r15d
mov    %rdx,%r14
mov    %esi,%ebx
mov    %rdi,%r12
lea    (%r15,%rbx,1),%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
mov    %ecx,%ebp
sar    %ebp
and    $0xfffffffe,%ecx
sub    %ecx,%eax
cmp    $0x1,%eax
jne    115d <find_median_sorted_arrays+0x4d>
add    $0x1,%ebp
mov    %ebp,(%rsp)
mov    %r12,%rdi
mov    %ebx,%esi
xor    %edx,%edx
mov    %r14,%rcx
mov    %r15d,%r8d
xor    %r9d,%r9d
call   1030 <find_median_sorted_arrays_helper@plt>
jmp    11a4 <find_median_sorted_arrays+0x94>
mov    %ebp,(%rsp)
mov    %r12,%rdi
mov    %ebx,%esi
xor    %edx,%edx
mov    %r14,%rcx
mov    %r15d,%r8d
xor    %r9d,%r9d
call   1030 <find_median_sorted_arrays_helper@plt>
movsd  %xmm0,0x8(%rsp)
add    $0x1,%ebp
mov    %ebp,(%rsp)
mov    %r12,%rdi
mov    %ebx,%esi
xor    %edx,%edx
mov    %r14,%rcx
mov    %r15d,%r8d
xor    %r9d,%r9d
call   1030 <find_median_sorted_arrays_helper@plt>
addsd  0x8(%rsp),%xmm0
mulsd  0xe5c(%rip),%xmm0
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @find_median_sorted_arrays(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 = srem i32 %14, 2
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %26
17: ; preds = %4
%18 = load i32*, i32** %6
%19 = load i32, i32* %7
%20 = load i32*, i32** %8
%21 = load i32, i32* %9
%22 = load i32, i32* %10
%23 = sdiv i32 %22, 2
%24 = add nsw i32 %23, 1
%25 = call double @find_median_sorted_arrays_helper(i32* %18, i32 %19, i32 0, i32* %20, i32 %21, i32 0, i32 %24)
store double %25, double* %5
br label %44
26: ; preds = %4
%27 = load i32*, i32** %6
%28 = load i32, i32* %7
%29 = load i32*, i32** %8
%30 = load i32, i32* %9
%31 = load i32, i32* %10
%32 = sdiv i32 %31, 2
%33 = call double @find_median_sorted_arrays_helper(i32* %27, i32 %28, i32 0, i32* %29, i32 %30, i32 0, i32 %32)
%34 = load i32*, i32** %6
%35 = load i32, i32* %7
%36 = load i32*, i32** %8
%37 = load i32, i32* %9
%38 = load i32, i32* %10
%39 = sdiv i32 %38, 2
%40 = add nsw i32 %39, 1
%41 = call double @find_median_sorted_arrays_helper(i32* %34, i32 %35, i32 0, i32* %36, i32 %37, i32 0, i32 %40)
%42 = fadd double %33, %41
%43 = fdiv double %42, 2.000000e+00
store double %43, double* %5
br label %44
44: ; preds = %26, %17
%45 = load double, double* %5
ret double %45
}

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