#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 */
typedef int /*<<< orphan*/ arrSecond;
typedef int /*<<< orphan*/ arrMerge;
typedef int /*<<< orphan*/ arrFirst;

/* Variables and functions */
int EXIT_SUCCESS;
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  double arrFirst[] = {-10.5, -1.8, 3.5, 6.3, 7.2};
  double arrSecond[] = {-1.8, 3.1, 6.3};
  int worstCase = (sizeof(arrFirst) + sizeof(arrSecond)) / sizeof(double);
  double *arrMerge = (double *)malloc(worstCase);
  printf("Size of a double in bytes: %ld\n", sizeof(double));
  printf("Size of arrFirst: %ld\n", sizeof(arrFirst) / sizeof(double));
  printf("Size of arrSecond: %ld\n", sizeof(arrSecond) / sizeof(double));
  printf("Size of arrMerge: %ld\n", sizeof(arrMerge) / sizeof(double));
  int n = 0, i = 0, j = 0;
  int arr2_length = 2;
  while (j < 6) {
    if (i > arr2_length) {
      arrMerge[j] = arrFirst[n];
      n++;
    } else if (arrFirst[n] < arrSecond[i]) {
      arrMerge[j] = arrFirst[n];
      n++;
    } else if (arrFirst[n] == arrSecond[i]) {
      arrMerge[j] = arrFirst[n];
      n++;
      i++;
    } else {
      arrMerge[j] = arrSecond[i];
      i++;
    }
    printf("%.1lf\n", arrMerge[j]);
    j++;
  }
  printf("Size of arrMerge: %ld\n", sizeof(arrMerge) / sizeof(double));
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
movsd  0xec9(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xeb4(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe9f(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe8a(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe75(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    0xe99(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xe96(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xe93(%rip),%rax
mov    %rax,-0x40(%rbp)
movl   $0x8,-0x54(%rbp)
mov    -0x54(%rbp),%edi
call   1050 <malloc@plt>
mov    %rax,-0x60(%rbp)
lea    0xe7d(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
lea    0xe8c(%rip),%rdi
mov    $0x5,%esi
call   1030 <printf@plt>
lea    0xe92(%rip),%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
lea    0xe99(%rip),%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
movl   $0x0,-0x64(%rbp)
movl   $0x0,-0x68(%rbp)
movl   $0x0,-0x6c(%rbp)
movl   $0x2,-0x70(%rbp)
cmpl   $0x6,-0x6c(%rbp)
jge    1341 <main+0x211>
mov    -0x68(%rbp),%eax
cmp    -0x70(%rbp),%eax
jle    125f <main+0x12f>
movslq -0x64(%rbp),%rax
movsd  -0x30(%rbp,%rax,8),%xmm0
mov    -0x60(%rbp),%rax
movslq -0x6c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    131a <main+0x1ea>
movslq -0x64(%rbp),%rax
movsd  -0x30(%rbp,%rax,8),%xmm1
movslq -0x68(%rbp),%rax
movsd  -0x50(%rbp,%rax,8),%xmm0
ucomisd %xmm1,%xmm0
jbe    12a2 <main+0x172>
movslq -0x64(%rbp),%rax
movsd  -0x30(%rbp,%rax,8),%xmm0
mov    -0x60(%rbp),%rax
movslq -0x6c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1315 <main+0x1e5>
movslq -0x64(%rbp),%rax
movsd  -0x30(%rbp,%rax,8),%xmm0
movslq -0x68(%rbp),%rax
ucomisd -0x50(%rbp,%rax,8),%xmm0
jne    12f0 <main+0x1c0>
jp     12f0 <main+0x1c0>
movslq -0x64(%rbp),%rax
movsd  -0x30(%rbp,%rax,8),%xmm0
mov    -0x60(%rbp),%rax
movslq -0x6c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    1310 <main+0x1e0>
movslq -0x68(%rbp),%rax
movsd  -0x50(%rbp,%rax,8),%xmm0
mov    -0x60(%rbp),%rax
movslq -0x6c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    1315 <main+0x1e5>
jmp    131a <main+0x1ea>
mov    -0x60(%rbp),%rax
movslq -0x6c(%rbp),%rcx
cvttsd2si (%rax,%rcx,8),%esi
lea    0xd80(%rip),%rdi
call   1030 <printf@plt>
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    1224 <main+0xf4>
lea    0xd4f(%rip),%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
mov    0x2c87(%rip),%rax
mov    (%rax),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movaps 0xecb(%rip),%xmm0
movaps %xmm0,(%rsp)
movapd 0xecf(%rip),%xmm0
movapd %xmm0,0x10(%rsp)
movabs $0x401ccccccccccccd,%rax
cc 1c 40
mov    %rax,0x20(%rsp)
mov    $0x8,%edi
call   1040 <malloc@plt>
mov    %rax,%r15
lea    0xece(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
lea    0xedd(%rip),%rdi
mov    $0x5,%esi
call   1030 <printf@plt>
lea    0xee3(%rip),%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
lea    0xeea(%rip),%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
xor    %ebx,%ebx
lea    0xeee(%rip),%r14
lea    0xe69(%rip),%r12
xor    %ebp,%ebp
xor    %r13d,%r13d
jmp    11df <main+0xbf>
xchg   %ax,%ax
movsd  %xmm0,(%r15,%rbx,8)
add    $0x1,%ebp
cvttsd2si %xmm0,%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    $0x6,%rbx
je     1223 <main+0x103>
movslq %ebp,%rax
movsd  (%rsp,%rax,8),%xmm0
cmp    $0x3,%r13d
jge    11c0 <main+0xa0>
movslq %r13d,%rax
movsd  (%r12,%rax,8),%xmm1
ucomisd %xmm0,%xmm1
ja     11c0 <main+0xa0>
ucomisd %xmm1,%xmm0
jne    1213 <main+0xf3>
jp     1213 <main+0xf3>
movsd  %xmm0,(%r15,%rbx,8)
add    $0x1,%ebp
add    $0x1,%r13d
jmp    11c9 <main+0xa9>
movsd  %xmm1,(%r15,%rbx,8)
add    $0x1,%r13d
movapd %xmm1,%xmm0
jmp    11c9 <main+0xa9>
lea    0xe5d(%rip),%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
mov    0x2da5(%rip),%rax
mov    (%rax),%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.arrSecond = [3 x double] [double -1.800000e+00, double 3.100000e+00, double 6.300000e+00]
@.str = [32 x i8] c"Size of a double in bytes: %ld\0A\00"
@.str.1 = [23 x i8] c"Size of arrFirst: %ld\0A\00"
@.str.2 = [24 x i8] c"Size of arrSecond: %ld\0A\00"
@.str.3 = [23 x i8] c"Size of arrMerge: %ld\0A\00"
@.str.4 = [7 x i8] c"%.1lf\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x double]
%3 = alloca [3 x double]
%4 = alloca i32
%5 = alloca double*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
%10 = bitcast [5 x double]* %2 to i8*
%11 = bitcast i8* %10 to [5 x double]*
%12 = getelementptr inbounds [5 x double], [5 x double]* %11, i32 0, i32 0
store double -1.050000e+01, double* %12
%13 = getelementptr inbounds [5 x double], [5 x double]* %11, i32 0, i32 1
store double -1.800000e+00, double* %13
%14 = getelementptr inbounds [5 x double], [5 x double]* %11, i32 0, i32 2
store double 3.500000e+00, double* %14
%15 = getelementptr inbounds [5 x double], [5 x double]* %11, i32 0, i32 3
store double 6.300000e+00, double* %15
%16 = getelementptr inbounds [5 x double], [5 x double]* %11, i32 0, i32 4
store double 7.200000e+00, double* %16
%17 = bitcast [3 x double]* %3 to i8*
store i32 8, i32* %4
%18 = load i32, i32* %4
%19 = call i64 @malloc(i32 %18)
%20 = inttoptr i64 %19 to double*
store double* %20, double** %5
%21 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 8)
%22 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 5)
%23 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 3)
%24 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 1)
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
store i32 2, i32* %9
br label %25
25: ; preds = %100, %0
%26 = load i32, i32* %8
%27 = icmp slt i32 %26, 6
br i1 %27, label %28, label %110
28: ; preds = %25
%29 = load i32, i32* %7
%30 = load i32, i32* %9
%31 = icmp sgt i32 %29, %30
br i1 %31, label %32, label %43
32: ; preds = %28
%33 = load i32, i32* %6
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [5 x double], [5 x double]* %2, i64 0, i64 %34
%36 = load double, double* %35
%37 = load double*, double** %5
%38 = load i32, i32* %8
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds double, double* %37, i64 %39
store double %36, double* %40
%41 = load i32, i32* %6
%42 = add nsw i32 %41, 1
store i32 %42, i32* %6
br label %100
43: ; preds = %28
%44 = load i32, i32* %6
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [5 x double], [5 x double]* %2, i64 0, i64 %45
%47 = load double, double* %46
%48 = load i32, i32* %7
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 %49
%51 = load double, double* %50
%52 = fcmp olt double %47, %51
br i1 %52, label %53, label %64
53: ; preds = %43
%54 = load i32, i32* %6
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [5 x double], [5 x double]* %2, i64 0, i64 %55
%57 = load double, double* %56
%58 = load double*, double** %5
%59 = load i32, i32* %8
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds double, double* %58, i64 %60
store double %57, double* %61
%62 = load i32, i32* %6
%63 = add nsw i32 %62, 1
store i32 %63, i32* %6
br label %99
64: ; preds = %43
%65 = load i32, i32* %6
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [5 x double], [5 x double]* %2, i64 0, i64 %66
%68 = load double, double* %67
%69 = load i32, i32* %7
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 %70
%72 = load double, double* %71
%73 = fcmp oeq double %68, %72
br i1 %73, label %74, label %87
74: ; preds = %64
%75 = load i32, i32* %6
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds [5 x double], [5 x double]* %2, i64 0, i64 %76
%78 = load double, double* %77
%79 = load double*, double** %5
%80 = load i32, i32* %8
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds double, double* %79, i64 %81
store double %78, double* %82
%83 = load i32, i32* %6
%84 = add nsw i32 %83, 1
store i32 %84, i32* %6
%85 = load i32, i32* %7
%86 = add nsw i32 %85, 1
store i32 %86, i32* %7
br label %98
87: ; preds = %64
%88 = load i32, i32* %7
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 %89
%91 = load double, double* %90
%92 = load double*, double** %5
%93 = load i32, i32* %8
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds double, double* %92, i64 %94
store double %91, double* %95
%96 = load i32, i32* %7
%97 = add nsw i32 %96, 1
store i32 %97, i32* %7
br label %98
98: ; preds = %87, %74
br label %99
99: ; preds = %98, %53
br label %100
100: ; preds = %99, %32
%101 = load double*, double** %5
%102 = load i32, i32* %8
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds double, double* %101, i64 %103
%105 = load double, double* %104
%106 = fptosi double %105 to i32
%107 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %106)
%108 = load i32, i32* %8
%109 = add nsw i32 %108, 1
store i32 %109, i32* %8
br label %25
110: ; preds = %25
%111 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 1)
%112 = load i32, i32* @EXIT_SUCCESS
ret i32 %112
}

LLVM IR (-O2):
@__const.main.arrSecond = [3 x double] [double -1.800000e+00, double 3.100000e+00, double 6.300000e+00]
@.str = [32 x i8] c"Size of a double in bytes: %ld\0A\00"
@.str.1 = [23 x i8] c"Size of arrFirst: %ld\0A\00"
@.str.2 = [24 x i8] c"Size of arrSecond: %ld\0A\00"
@.str.3 = [23 x i8] c"Size of arrMerge: %ld\0A\00"
@.str.4 = [7 x i8] c"%.1lf\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca [5 x double]
%2 = bitcast [5 x double]* %1 to i8*
%3 = bitcast [5 x double]* %1 to <2 x double>*
store <2 x double> <double -1.050000e+01, double -1.800000e+00>, <2 x double>* %3
%4 = getelementptr inbounds [5 x double], [5 x double]* %1, i64 0, i64 2
%5 = bitcast double* %4 to <2 x double>*
store <2 x double> <double 3.500000e+00, double 6.300000e+00>, <2 x double>* %5
%6 = getelementptr inbounds [5 x double], [5 x double]* %1, i64 0, i64 4
store double 7.200000e+00, double* %6
%7 = tail call i64 @malloc(i32 8)
%8 = inttoptr i64 %7 to double*
%9 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 8)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 5)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 3)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 1)
br label %13
13: ; preds = %0, %40
%14 = phi i64 [ 0, %0 ], [ %46, %40 ]
%15 = phi i32 [ 0, %0 ], [ %43, %40 ]
%16 = phi i32 [ 0, %0 ], [ %42, %40 ]
%17 = icmp sgt i32 %16, 2
%18 = sext i32 %15 to i64
%19 = getelementptr inbounds [5 x double], [5 x double]* %1, i64 0, i64 %18
%20 = load double, double* %19
br i1 %17, label %21, label %24
21: ; preds = %13
%22 = getelementptr inbounds double, double* %8, i64 %14
store double %20, double* %22
%23 = add nsw i32 %15, 1
br label %40
24: ; preds = %13
%25 = sext i32 %16 to i64
%26 = getelementptr inbounds [3 x double], [3 x double]* @__const.main.arrSecond, i64 0, i64 %25
%27 = load double, double* %26
%28 = fcmp olt double %20, %27
br i1 %28, label %29, label %32
29: ; preds = %24
%30 = getelementptr inbounds double, double* %8, i64 %14
store double %20, double* %30
%31 = add nsw i32 %15, 1
br label %40
32: ; preds = %24
%33 = fcmp oeq double %20, %27
%34 = getelementptr inbounds double, double* %8, i64 %14
br i1 %33, label %35, label %38
35: ; preds = %32
store double %20, double* %34
%36 = add nsw i32 %15, 1
%37 = add nsw i32 %16, 1
br label %40
38: ; preds = %32
store double %27, double* %34
%39 = add nsw i32 %16, 1
br label %40
40: ; preds = %29, %38, %35, %21
%41 = phi double [ %20, %21 ], [ %20, %29 ], [ %20, %35 ], [ %27, %38 ]
%42 = phi i32 [ %16, %21 ], [ %16, %29 ], [ %37, %35 ], [ %39, %38 ]
%43 = phi i32 [ %23, %21 ], [ %31, %29 ], [ %36, %35 ], [ %15, %38 ]
%44 = fptosi double %41 to i32
%45 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %44)
%46 = add nuw nsw i64 %14, 1
%47 = icmp eq i64 %46, 6
br i1 %47, label %48, label %13
48: ; preds = %40
%49 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 1)
%50 = load i32, i32* @EXIT_SUCCESS
ret i32 %50
}