#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*/ bubble_loop(int);
int /*<<< orphan*/ check_stack(int, int, int, int, int, int, int, int, int,
                               int);
int /*<<< orphan*/ quick_loop(int);
int /*<<< orphan*/ quick_rec(int *, int /*<<< orphan*/, int);
int main() {
  int len = 10;
  int A[] = {9, 10, 7, 8, 5, 0, 3, 22, 1, 6};
  bubble_loop(len);
  quick_loop(len);
  quick_rec(A, 0, len - 1);
  check_stack(A[0], A[1], A[2], A[3], A[4], A[5], A[6], A[7], A[8], A[9]);
  return 10101;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x58,%rsp
movl   $0x0,-0xc(%rbp)
movl   $0xa,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xe8e(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
mov    -0x10(%rbp),%edi
call   1060 <bubble_loop@plt>
mov    -0x10(%rbp),%edi
call   1070 <quick_loop@plt>
lea    -0x40(%rbp),%rdi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
call   1050 <quick_rec@plt>
mov    -0x40(%rbp),%edi
mov    -0x3c(%rbp),%esi
mov    -0x38(%rbp),%edx
mov    -0x34(%rbp),%ecx
mov    -0x30(%rbp),%r8d
mov    -0x2c(%rbp),%r9d
mov    -0x28(%rbp),%ebx
mov    -0x24(%rbp),%r11d
mov    -0x20(%rbp),%r10d
mov    -0x1c(%rbp),%eax
mov    %ebx,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
call   1030 <check_stack@plt>
mov    $0x2775,%eax
add    $0x58,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
mov    0xed4(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xeb8(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe9c(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    $0xa,%edi
call   1050 <bubble_loop@plt>
mov    $0xa,%edi
call   1060 <quick_loop@plt>
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0x9,%edx
call   1040 <quick_rec@plt>
mov    (%rsp),%edi
mov    0x4(%rsp),%esi
mov    0x8(%rsp),%edx
mov    0xc(%rsp),%ecx
mov    0x10(%rsp),%r8d
mov    0x14(%rsp),%r9d
mov    0x18(%rsp),%r10d
mov    0x1c(%rsp),%r11d
mov    0x20(%rsp),%eax
mov    0x24(%rsp),%ebx
push   %rbx
push   %rax
push   %r11
push   %r10
call   1030 <check_stack@plt>
add    $0x20,%rsp
mov    $0x2775,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.A = [10 x i32] [i32 9, i32 10, i32 7, i32 8, i32 5, i32 0, i32 3, i32 22, i32 1, i32 6]
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [10 x i32]
store i32 0, i32* %1
store i32 10, i32* %2
%4 = bitcast [10 x i32]* %3 to i8*
%5 = load i32, i32* %2
%6 = call i32 @bubble_loop(i32 %5)
%7 = load i32, i32* %2
%8 = call i32 @quick_loop(i32 %7)
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
%10 = load i32, i32* %2
%11 = sub nsw i32 %10, 1
%12 = call i32 @quick_rec(i32* %9, i32 0, i32 %11)
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
%14 = load i32, i32* %13
%15 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 1
%16 = load i32, i32* %15
%17 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 2
%18 = load i32, i32* %17
%19 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 3
%20 = load i32, i32* %19
%21 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 4
%22 = load i32, i32* %21
%23 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 5
%24 = load i32, i32* %23
%25 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 6
%26 = load i32, i32* %25
%27 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 7
%28 = load i32, i32* %27
%29 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 8
%30 = load i32, i32* %29
%31 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 9
%32 = load i32, i32* %31
%33 = call i32 @check_stack(i32 %14, i32 %16, i32 %18, i32 %20, i32 %22, i32 %24, i32 %26, i32 %28, i32 %30, i32 %32)
ret i32 10101
}

LLVM IR (-O2):
@__const.main.A = [10 x i32] [i32 9, i32 10, i32 7, i32 8, i32 5, i32 0, i32 3, i32 22, i32 1, i32 6]
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = tail call i32 @bubble_loop(i32 10)
%4 = tail call i32 @quick_loop(i32 10)
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%6 = call i32 @quick_rec(i32* %5, i32 0, i32 9)
%7 = load i32, i32* %5
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
%9 = load i32, i32* %8
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 2
%11 = load i32, i32* %10
%12 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 3
%13 = load i32, i32* %12
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
%15 = load i32, i32* %14
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
%17 = load i32, i32* %16
%18 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 6
%19 = load i32, i32* %18
%20 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 7
%21 = load i32, i32* %20
%22 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 8
%23 = load i32, i32* %22
%24 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
%25 = load i32, i32* %24
%26 = call i32 @check_stack(i32 %7, i32 %9, i32 %11, i32 %13, i32 %15, i32 %17, i32 %19, i32 %21, i32 %23, i32 %25)
ret i32 10101
}