#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*/ sorted_arrays_aux(int *, size_t, int *, size_t, int *, int);
void sorted_arrays(int arr_a[], int arr_b[], size_t size) {
  if (size == 0)
    return;
  int out_buff[size * 2];
  out_buff[0] = arr_a[0];
  sorted_arrays_aux(arr_a, size, arr_b, size, out_buff, 1);
  out_buff[0] = arr_b[0];
  sorted_arrays_aux(arr_b, size, arr_a, size, out_buff, 1);
}


x86 assembly (clang, -O0):
<sorted_arrays>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1134 <sorted_arrays+0x24>
jmp    11b5 <sorted_arrays+0xa5>
mov    -0x18(%rbp),%rcx
mov    %rcx,%rax
add    %rax,%rax
mov    %rsp,%rdx
mov    %rdx,-0x20(%rbp)
lea    0xf(,%rcx,8),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%r8
sub    %rcx,%r8
mov    %r8,-0x30(%rbp)
mov    %r8,%rsp
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,(%r8)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0x1,%r9d
call   1030 <sorted_arrays_aux@plt>
mov    -0x30(%rbp),%r8
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,(%r8)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x8(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0x1,%r9d
call   1030 <sorted_arrays_aux@plt>
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sorted_arrays>:
test   %rdx,%rdx
je     11a5 <sorted_arrays+0x95>
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%r12
mov    %rsi,%r15
mov    %rdi,%r14
mov    %rsp,-0x38(%rbp)
mov    %rsp,%rbx
mov    %rbx,-0x30(%rbp)
lea    0xf(,%rdx,8),%r13
and    $0xfffffffffffffff0,%r13
sub    %r13,%rbx
mov    %rbx,%rsp
neg    %r13
mov    (%rdi),%eax
mov    %eax,(%rbx)
mov    %rdx,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
mov    %rbx,%r8
mov    $0x1,%r9d
call   1030 <sorted_arrays_aux@plt>
mov    (%r15),%eax
mov    -0x30(%rbp),%rcx
mov    %eax,(%rcx,%r13,1)
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r14,%rdx
mov    %r12,%rcx
mov    %rbx,%r8
mov    $0x1,%r9d
call   1030 <sorted_arrays_aux@plt>
mov    -0x38(%rbp),%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @sorted_arrays(i32* %0, i32* %1, i64 %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i64
store i32* %0, i32** %4
store i32* %1, i32** %5
store i64 %2, i64* %6
%9 = load i64, i64* %6
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %3
br label %36
12: ; preds = %3
%13 = load i64, i64* %6
%14 = mul i64 %13, 2
%15 = call i8* @llvm.stacksave()
store i8* %15, i8** %7
%16 = alloca i32, i64 %14
store i64 %14, i64* %8
%17 = load i32*, i32** %4
%18 = getelementptr inbounds i32, i32* %17, i64 0
%19 = load i32, i32* %18
%20 = getelementptr inbounds i32, i32* %16, i64 0
store i32 %19, i32* %20
%21 = load i32*, i32** %4
%22 = load i64, i64* %6
%23 = load i32*, i32** %5
%24 = load i64, i64* %6
%25 = call i32 @sorted_arrays_aux(i32* %21, i64 %22, i32* %23, i64 %24, i32* %16, i32 1)
%26 = load i32*, i32** %5
%27 = getelementptr inbounds i32, i32* %26, i64 0
%28 = load i32, i32* %27
%29 = getelementptr inbounds i32, i32* %16, i64 0
store i32 %28, i32* %29
%30 = load i32*, i32** %5
%31 = load i64, i64* %6
%32 = load i32*, i32** %4
%33 = load i64, i64* %6
%34 = call i32 @sorted_arrays_aux(i32* %30, i64 %31, i32* %32, i64 %33, i32* %16, i32 1)
%35 = load i8*, i8** %7
br label %36
36: ; preds = %12, %11
ret void
}

LLVM IR (-O2):
define void @sorted_arrays(i32* %0, i32* %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %13, label %5
5: ; preds = %3
%6 = shl i64 %2, 1
%7 = tail call i8* @llvm.stacksave()
%8 = alloca i32, i64 %6
%9 = load i32, i32* %0
store i32 %9, i32* %8
%10 = call i32 @sorted_arrays_aux(i32* %0, i64 %2, i32* %1, i64 %2, i32* %8, i32 1)
%11 = load i32, i32* %1
store i32 %11, i32* %8
%12 = call i32 @sorted_arrays_aux(i32* %1, i64 %2, i32* %0, i64 %2, i32* %8, i32 1)
br label %13
13: ; preds = %3, %5
ret void
}