#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*/ ins;
typedef int /*<<< orphan*/ exp;

/* Variables and functions */
int check_int_heap(int *, int const *, int);
int /*<<< orphan*/ insert_ints(int const *, int, int *);
int test_insert_descending_integers_into_heap(void) {
  static int const exp[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
  static int const ins[(sizeof(exp) / sizeof 0 [exp])] = {10, 9, 8, 7, 6, 5,
                                                          4,  3, 2, 1, 0};
  int heap[(sizeof(exp) / sizeof 0 [exp])];
  insert_ints(ins, (sizeof(ins) / sizeof 0 [ins]), heap);
  return check_int_heap(heap, exp, (sizeof(exp) / sizeof 0 [exp]));
}


x86 assembly (clang, -O0):
<test_insert_descending_integers_into_heap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x30(%rbp),%rdx
lea    0xefd(%rip),%rdi
mov    $0xb,%esi
call   1030 <insert_ints@plt>
lea    -0x30(%rbp),%rdi
lea    0xeb8(%rip),%rsi
mov    $0xb,%edx
call   1040 <check_int_heap@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_insert_descending_integers_into_heap>:
push   %rbx
sub    $0x30,%rsp
lea    0xf04(%rip),%rdi
mov    %rsp,%rbx
mov    $0xb,%esi
mov    %rbx,%rdx
call   1030 <insert_ints@plt>
lea    0xebd(%rip),%rsi
mov    %rbx,%rdi
mov    $0xb,%edx
call   1040 <check_int_heap@plt>
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@test_insert_descending_integers_into_heap.exp = internal constant [11 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10]
@test_insert_descending_integers_into_heap.ins = internal constant [11 x i32] [i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0]
define i32 @test_insert_descending_integers_into_heap() {
%1 = alloca [11 x i32]
%2 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 0
%3 = call i32 @insert_ints(i32* getelementptr inbounds ([11 x i32], [11 x i32]* @test_insert_descending_integers_into_heap.ins, i64 0, i64 0), i32 11, i32* %2)
%4 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 0
%5 = call i32 @check_int_heap(i32* %4, i32* getelementptr inbounds ([11 x i32], [11 x i32]* @test_insert_descending_integers_into_heap.exp, i64 0, i64 0), i32 11)
ret i32 %5
}

LLVM IR (-O2):
@test_insert_descending_integers_into_heap.exp = internal constant [11 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10]
@test_insert_descending_integers_into_heap.ins = internal constant [11 x i32] [i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0]
define i32 @test_insert_descending_integers_into_heap() {
%1 = alloca [11 x i32]
%2 = bitcast [11 x i32]* %1 to i8*
%3 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 0
%4 = call i32 @insert_ints(i32* getelementptr inbounds ([11 x i32], [11 x i32]* @test_insert_descending_integers_into_heap.ins, i64 0, i64 0), i32 11, i32* %3)
%5 = call i32 @check_int_heap(i32* %3, i32* getelementptr inbounds ([11 x i32], [11 x i32]* @test_insert_descending_integers_into_heap.exp, i64 0, i64 0), i32 11)
ret i32 %5
}