#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*/ merge_array(int *, int, int *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int A[20], B[20], C[40], N1, N2, i;
  scanf("%d", &N1);
  for (i = 0; i < N1; i++) {
    scanf("%d", &A[i]);
  }
  scanf("%d", &N2);
  for (i = 0; i < N2; i++) {
    scanf("%d", &B[i]);
  }
  merge_array(A, N1, B, N2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x160,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec7(%rip),%rdi
lea    -0x154(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x15c(%rbp)
mov    -0x15c(%rbp),%eax
cmp    -0x154(%rbp),%eax
jge    1193 <main+0x73>
movslq -0x15c(%rbp),%rax
lea    -0x60(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe86(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x15c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x15c(%rbp)
jmp    114f <main+0x2f>
lea    0xe66(%rip),%rdi
lea    -0x158(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x15c(%rbp)
mov    -0x15c(%rbp),%eax
cmp    -0x158(%rbp),%eax
jge    11f7 <main+0xd7>
movslq -0x15c(%rbp),%rax
lea    -0xb0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe22(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x15c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x15c(%rbp)
jmp    11b0 <main+0x90>
lea    -0x60(%rbp),%rdi
mov    -0x154(%rbp),%esi
lea    -0xb0(%rbp),%rdx
mov    -0x158(%rbp),%ecx
call   1030 <merge_array@plt>
xor    %eax,%eax
add    $0x160,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xb0,%rsp
lea    0xecd(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,0x8(%rsp)
jle    117d <main+0x5d>
lea    0x60(%rsp),%r15
xor    %ebx,%ebx
lea    0xeae(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
add    $0x1,%rbx
movslq 0x8(%rsp),%rax
add    $0x4,%r15
cmp    %rax,%rbx
jl     1160 <main+0x40>
lea    0xe7c(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%ecx
test   %ecx,%ecx
jle    11cd <main+0xad>
lea    0x10(%rsp),%r15
xor    %ebx,%ebx
lea    0xe5c(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rcx
add    $0x4,%r15
cmp    %rcx,%rbx
jl     11b0 <main+0x90>
mov    0x8(%rsp),%esi
lea    0x60(%rsp),%rdi
lea    0x10(%rsp),%rdx
call   1030 <merge_array@plt>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i32]
%3 = alloca [20 x i32]
%4 = alloca [40 x i32]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
store i32 0, i32* %7
br label %9
9: ; preds = %18, %0
%10 = load i32, i32* %7
%11 = load i32, i32* %5
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %21
13: ; preds = %9
%14 = load i32, i32* %7
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 %15
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %16)
br label %18
18: ; preds = %13
%19 = load i32, i32* %7
%20 = add nsw i32 %19, 1
store i32 %20, i32* %7
br label %9
21: ; preds = %9
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
store i32 0, i32* %7
br label %23
23: ; preds = %32, %21
%24 = load i32, i32* %7
%25 = load i32, i32* %6
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %35
27: ; preds = %23
%28 = load i32, i32* %7
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %29
%31 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %30)
br label %32
32: ; preds = %27
%33 = load i32, i32* %7
%34 = add nsw i32 %33, 1
store i32 %34, i32* %7
br label %23
35: ; preds = %23
%36 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 0
%37 = load i32, i32* %5
%38 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 0
%39 = load i32, i32* %6
%40 = call i32 @merge_array(i32* %36, i32 %37, i32* %38, i32 %39)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca [20 x i32]
%2 = alloca [20 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = bitcast [20 x i32]* %1 to i8*
%6 = bitcast [20 x i32]* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%10 = load i32, i32* %3
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %20
12: ; preds = %0, %12
%13 = phi i64 [ %16, %12 ], [ 0, %0 ]
%14 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 %13
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %14)
%16 = add nuw nsw i64 %13, 1
%17 = load i32, i32* %3
%18 = sext i32 %17 to i64
%19 = icmp slt i64 %16, %18
br i1 %19, label %12, label %20
20: ; preds = %12, %0
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%22 = load i32, i32* %4
%23 = icmp sgt i32 %22, 0
br i1 %23, label %24, label %32
24: ; preds = %20, %24
%25 = phi i64 [ %28, %24 ], [ 0, %20 ]
%26 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 %25
%27 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %26)
%28 = add nuw nsw i64 %25, 1
%29 = load i32, i32* %4
%30 = sext i32 %29 to i64
%31 = icmp slt i64 %28, %30
br i1 %31, label %24, label %32
32: ; preds = %24, %20
%33 = phi i32 [ %22, %20 ], [ %29, %24 ]
%34 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 0
%35 = load i32, i32* %3
%36 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 0
%37 = call i32 @merge_array(i32* %34, i32 %35, i32* %36, i32 %33)
ret i32 0
}