#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*/ printArray(int *, int);
void unionArray(int arr1[], int arr2[], int arrSize) {
  int temp[arrSize * 2];
  for (int k = 0; k < arrSize; k++) {
    temp[arrSize * 2] = arr1[k];
    temp[arrSize * 2 + 1] = arr2[k];
  }
  printArray(temp, arrSize * 2);
}


x86 assembly (clang, -O0):
<unionArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    %eax,%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11a2 <unionArray+0x92>
mov    -0x38(%rbp),%rax
mov    -0x8(%rbp),%rcx
movslq -0x2c(%rbp),%rdx
mov    (%rcx,%rdx,4),%edx
mov    -0x14(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%rcx
movslq -0x2c(%rbp),%rdx
mov    (%rcx,%rdx,4),%edx
mov    -0x14(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1153 <unionArray+0x43>
mov    -0x38(%rbp),%rdi
mov    -0x14(%rbp),%esi
shl    $0x1,%esi
call   1030 <printArray@plt>
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unionArray>:
push   %rbp
mov    %rsp,%rbp
mov    %rsi,%r8
lea    (%rdx,%rdx,1),%esi
mov    %rsp,%rcx
lea    0xf(,%rsi,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rcx
mov    %rcx,%rsp
test   %edx,%edx
jle    114b <unionArray+0x3b>
movslq %esi,%rax
add    $0xffffffff,%edx
mov    (%rdi,%rdx,4),%edi
mov    (%r8,%rdx,4),%edx
mov    %edi,(%rcx,%rax,4)
or     $0x1,%eax
cltq
mov    %edx,(%rcx,%rax,4)
mov    %rcx,%rdi
call   1030 <printArray@plt>
mov    %rbp,%rsp
pop    %rbp
ret

LLVM IR (-O0):
define void @unionArray(i32* %0, i32* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%10 = load i32, i32* %6
%11 = mul nsw i32 %10, 2
%12 = zext i32 %11 to i64
%13 = call i8* @llvm.stacksave()
store i8* %13, i8** %7
%14 = alloca i32, i64 %12
store i64 %12, i64* %8
store i32 0, i32* %9
br label %15
15: ; preds = %39, %3
%16 = load i32, i32* %9
%17 = load i32, i32* %6
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %42
19: ; preds = %15
%20 = load i32*, i32** %4
%21 = load i32, i32* %9
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %20, i64 %22
%24 = load i32, i32* %23
%25 = load i32, i32* %6
%26 = mul nsw i32 %25, 2
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i32, i32* %14, i64 %27
store i32 %24, i32* %28
%29 = load i32*, i32** %5
%30 = load i32, i32* %9
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i32, i32* %29, i64 %31
%33 = load i32, i32* %32
%34 = load i32, i32* %6
%35 = mul nsw i32 %34, 2
%36 = add nsw i32 %35, 1
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i32, i32* %14, i64 %37
store i32 %33, i32* %38
br label %39
39: ; preds = %19
%40 = load i32, i32* %9
%41 = add nsw i32 %40, 1
store i32 %41, i32* %9
br label %15
42: ; preds = %15
%43 = load i32, i32* %6
%44 = mul nsw i32 %43, 2
%45 = call i32 @printArray(i32* %14, i32 %44)
%46 = load i8*, i8** %7
ret void
}

LLVM IR (-O2):
define void @unionArray(i32* nocapture %0, i32* nocapture %1, i32 %2) {
%4 = shl nsw i32 %2, 1
%5 = zext i32 %4 to i64
%6 = alloca i32, i64 %5
%7 = icmp sgt i32 %2, 0
br i1 %7, label %8, label %20
8: ; preds = %3
%9 = sext i32 %4 to i64
%10 = or i32 %4, 1
%11 = sext i32 %10 to i64
%12 = add nsw i32 %2, -1
%13 = getelementptr inbounds i32, i32* %6, i64 %9
%14 = getelementptr inbounds i32, i32* %6, i64 %11
%15 = zext i32 %12 to i64
%16 = getelementptr inbounds i32, i32* %0, i64 %15
%17 = load i32, i32* %16
%18 = getelementptr inbounds i32, i32* %1, i64 %15
%19 = load i32, i32* %18
store i32 %17, i32* %13
store i32 %19, i32* %14
br label %20
20: ; preds = %8, %3
%21 = call i32 @printArray(i32* %6, i32 %4)
ret void
}