#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 */
int /*<<< orphan*/ close(int /*<<< orphan*/, double);
int /*<<< orphan*/ findMedianSortedArrays(int *, int, int *, int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  int n1[] = {1, 3};
  int n2[] = {2};
  int n3[] = {1, 2};
  int n4[] = {3, 4};
  printf("%lf\n", findMedianSortedArrays(n1, 2, n2, 1));
  if (!(close(findMedianSortedArrays(n1, 2, n2, 1), 2.0))) {
    printf("assert fail: %s\n", "test1");
    return -1;
  };
  printf("%lf\n", findMedianSortedArrays(n3, 2, n4, 2));
  if (!(close(findMedianSortedArrays(n3, 2, n4, 2), 2.5))) {
    printf("assert fail: %s\n", "test2");
    return -1;
  };
  printf("everything is fine!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xec3(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xed1(%rip),%eax
mov    %eax,-0x1c(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x24(%rbp)
mov    0xeb4(%rip),%rax
mov    %rax,-0x2c(%rbp)
lea    -0x18(%rbp),%rdi
lea    -0x1c(%rbp),%rdx
mov    $0x2,%esi
mov    $0x1,%ecx
call   1050 <findMedianSortedArrays@plt>
mov    %eax,%esi
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x18(%rbp),%rdi
lea    -0x1c(%rbp),%rdx
mov    $0x2,%esi
mov    $0x1,%ecx
call   1050 <findMedianSortedArrays@plt>
mov    %eax,%edi
movsd  0xe48(%rip),%xmm0
call   1040 <close@plt>
cmp    $0x0,%eax
jne    11e7 <main+0xb7>
lea    0xe64(%rip),%rdi
lea    0xe6e(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    126d <main+0x13d>
lea    -0x24(%rbp),%rdi
lea    -0x2c(%rbp),%rdx
mov    $0x2,%ecx
mov    %ecx,%esi
call   1050 <findMedianSortedArrays@plt>
mov    %eax,%esi
lea    0xe28(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x24(%rbp),%rdi
lea    -0x2c(%rbp),%rdx
mov    $0x2,%ecx
mov    %ecx,%esi
call   1050 <findMedianSortedArrays@plt>
mov    %eax,%edi
movsd  0xddf(%rip),%xmm0
call   1040 <close@plt>
cmp    $0x0,%eax
jne    1258 <main+0x128>
lea    0xdf3(%rip),%rdi
lea    0xe03(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    126d <main+0x13d>
lea    0xdef(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
movabs $0x300000001,%rax
mov    %rax,0x18(%rsp)
movl   $0x2,0x4(%rsp)
movabs $0x200000001,%rax
mov    %rax,0x10(%rsp)
movabs $0x400000003,%rax
mov    %rax,0x8(%rsp)
lea    0x18(%rsp),%rbx
lea    0x4(%rsp),%r14
mov    %rbx,%rdi
mov    $0x2,%esi
mov    %r14,%rdx
mov    $0x1,%ecx
call   1060 <findMedianSortedArrays@plt>
lea    0xe6c(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    %r14,%rdx
mov    $0x1,%ecx
call   1060 <findMedianSortedArrays@plt>
movsd  0xe36(%rip),%xmm0
mov    %eax,%edi
call   1050 <close@plt>
test   %eax,%eax
je     123c <main+0xfc>
lea    0x10(%rsp),%r14
lea    0x8(%rsp),%r15
mov    %r14,%rdi
mov    $0x2,%esi
mov    %r15,%rdx
mov    $0x2,%ecx
call   1060 <findMedianSortedArrays@plt>
lea    0xe15(%rip),%rdi
xor    %ebx,%ebx
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0x2,%esi
mov    %r15,%rdx
mov    $0x2,%ecx
call   1060 <findMedianSortedArrays@plt>
movsd  0xde5(%rip),%xmm0
mov    %eax,%edi
call   1050 <close@plt>
test   %eax,%eax
je     124c <main+0x10c>
lea    0xdfd(%rip),%rdi
call   1030 <puts@plt>
jmp    1266 <main+0x126>
lea    0xdd2(%rip),%rdi
lea    0xddc(%rip),%rsi
jmp    125a <main+0x11a>
lea    0xdc2(%rip),%rdi
lea    0xdd2(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.n1 = [2 x i32] [i32 1, i32 3]
@__const.main.n2 = [1 x i32] [i32 2]
@__const.main.n3 = [2 x i32] [i32 1, i32 2]
@__const.main.n4 = [2 x i32] [i32 3, i32 4]
@.str = [5 x i8] c"%lf\0A\00"
@.str.1 = [17 x i8] c"assert fail: %s\0A\00"
@.str.2 = [6 x i8] c"test1\00"
@.str.3 = [6 x i8] c"test2\00"
@.str.4 = [21 x i8] c"everything is fine!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [2 x i32]
%7 = alloca [1 x i32]
%8 = alloca [2 x i32]
%9 = alloca [2 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = bitcast [2 x i32]* %6 to i8*
%11 = bitcast [1 x i32]* %7 to i8*
%12 = bitcast [2 x i32]* %8 to i8*
%13 = bitcast [2 x i32]* %9 to i8*
%14 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%15 = getelementptr inbounds [1 x i32], [1 x i32]* %7, i64 0, i64 0
%16 = call i32 @findMedianSortedArrays(i32* %14, i32 2, i32* %15, i32 1)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%19 = getelementptr inbounds [1 x i32], [1 x i32]* %7, i64 0, i64 0
%20 = call i32 @findMedianSortedArrays(i32* %18, i32 2, i32* %19, i32 1)
%21 = call i32 @close(i32 %20, double 2.000000e+00)
%22 = icmp ne i32 %21, 0
br i1 %22, label %25, label %23
23: ; preds = %2
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %3
br label %39
25: ; preds = %2
%26 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%27 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
%28 = call i32 @findMedianSortedArrays(i32* %26, i32 2, i32* %27, i32 2)
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %28)
%30 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%31 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
%32 = call i32 @findMedianSortedArrays(i32* %30, i32 2, i32* %31, i32 2)
%33 = call i32 @close(i32 %32, double 2.500000e+00)
%34 = icmp ne i32 %33, 0
br i1 %34, label %37, label %35
35: ; preds = %25
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %3
br label %39
37: ; preds = %25
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %3
br label %39
39: ; preds = %37, %35, %23
%40 = load i32, i32* %3
ret i32 %40
}

LLVM IR (-O2):
@.str = [5 x i8] c"%lf\0A\00"
@.str.1 = [17 x i8] c"assert fail: %s\0A\00"
@.str.2 = [6 x i8] c"test1\00"
@.str.3 = [6 x i8] c"test2\00"
@str = [20 x i8] c"everything is fine!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i64
%4 = alloca [1 x i32]
%5 = alloca i64
%6 = alloca i64
%7 = bitcast i64* %3 to i8*
store i64 12884901889, i64* %3
%8 = bitcast [1 x i32]* %4 to i8*
%9 = getelementptr inbounds [1 x i32], [1 x i32]* %4, i64 0, i64 0
store i32 2, i32* %9
%10 = bitcast i64* %5 to i8*
store i64 8589934593, i64* %5
%11 = bitcast i64* %6 to i8*
store i64 17179869187, i64* %6
%12 = bitcast i64* %3 to i32*
%13 = call i32 @findMedianSortedArrays(i32* %12, i32 2, i32* %9, i32 1)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = call i32 @findMedianSortedArrays(i32* %12, i32 2, i32* %9, i32 1)
%16 = call i32 @close(i32 %15, double 2.000000e+00)
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %2
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %32
20: ; preds = %2
%21 = bitcast i64* %5 to i32*
%22 = bitcast i64* %6 to i32*
%23 = call i32 @findMedianSortedArrays(i32* %21, i32 2, i32* %22, i32 2)
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %23)
%25 = call i32 @findMedianSortedArrays(i32* %21, i32 2, i32* %22, i32 2)
%26 = call i32 @close(i32 %25, double 2.500000e+00)
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %20
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %32
30: ; preds = %20
%31 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
br label %32
32: ; preds = %30, %28, %18
%33 = phi i32 [ 0, %30 ], [ -1, %28 ], [ -1, %18 ]
ret i32 %33
}