#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 is_sorted(int *, int);
int /*<<< orphan*/ merge(int *, int, int *, int);
int test_merge() {
  int a[] = {1, 3, 5, 7, 9, 0, 0, 0, 0};
  int b[] = {2, 4, 6, 8};
  merge(a, 5, b, 4);
  return is_sorted(a, 9);
}


x86 assembly (clang, -O0):
<test_merge>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x24,%edx
call   1040 <memset@plt>
movl   $0x1,-0x30(%rbp)
movl   $0x3,-0x2c(%rbp)
movl   $0x5,-0x28(%rbp)
movl   $0x7,-0x24(%rbp)
movl   $0x9,-0x20(%rbp)
mov    0xe8e(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xe8b(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    -0x30(%rbp),%rdi
lea    -0x40(%rbp),%rdx
mov    $0x5,%esi
mov    $0x4,%ecx
call   1050 <merge@plt>
lea    -0x30(%rbp),%rdi
mov    $0x9,%esi
call   1030 <is_sorted@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_merge>:
push   %rbx
sub    $0x40,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movl   $0x0,0x20(%rsp)
movaps 0xec4(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0x9,0x10(%rsp)
movaps 0xec1(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
mov    %rsp,%rbx
lea    0x30(%rsp),%rdx
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0x4,%ecx
call   1040 <merge@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
call   1030 <is_sorted@plt>
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.test_merge.b = [4 x i32] [i32 2, i32 4, i32 6, i32 8]
define i32 @test_merge() {
%1 = alloca [9 x i32]
%2 = alloca [4 x i32]
%3 = bitcast [9 x i32]* %1 to i8*
%4 = bitcast i8* %3 to [9 x i32]*
%5 = getelementptr inbounds [9 x i32], [9 x i32]* %4, i32 0, i32 0
store i32 1, i32* %5
%6 = getelementptr inbounds [9 x i32], [9 x i32]* %4, i32 0, i32 1
store i32 3, i32* %6
%7 = getelementptr inbounds [9 x i32], [9 x i32]* %4, i32 0, i32 2
store i32 5, i32* %7
%8 = getelementptr inbounds [9 x i32], [9 x i32]* %4, i32 0, i32 3
store i32 7, i32* %8
%9 = getelementptr inbounds [9 x i32], [9 x i32]* %4, i32 0, i32 4
store i32 9, i32* %9
%10 = bitcast [4 x i32]* %2 to i8*
%11 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 0
%12 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
%13 = call i32 @merge(i32* %11, i32 5, i32* %12, i32 4)
%14 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 0
%15 = call i32 @is_sorted(i32* %14, i32 9)
ret i32 %15
}

LLVM IR (-O2):
@__const.test_merge.b = [4 x i32] [i32 2, i32 4, i32 6, i32 8]
define i32 @test_merge() {
%1 = alloca [9 x i32]
%2 = alloca [4 x i32]
%3 = bitcast [9 x i32]* %1 to i8*
%4 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 4
%5 = bitcast i32* %4 to i8*
%6 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 0
%7 = bitcast [9 x i32]* %1 to <4 x i32>*
store <4 x i32> <i32 1, i32 3, i32 5, i32 7>, <4 x i32>* %7
%8 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 4
store i32 9, i32* %8
%9 = bitcast [4 x i32]* %2 to i8*
%10 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
%11 = call i32 @merge(i32* %6, i32 5, i32* %10, i32 4)
%12 = call i32 @is_sorted(i32* %6, i32 9)
ret i32 %12
}