#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*/ arreglo;

/* Variables and functions */
int /*<<< orphan*/ imprimir_arreglo(int *);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int /*<<< orphan*/ quicksort(int *, int, int *);
int main() {
  int arreglo[10] = {1, 4, 20, 10, 3, 8, 9, 14, 21, 6};
  int size = sizeof(arreglo) / sizeof(int);
  int iteracion = 1;
  printf("Iteracion #%03d ", iteracion++);
  imprimir_arreglo(arreglo);
  quicksort(arreglo, size, &iteracion);
  printf("Iteracion #%03d ", iteracion++);
  imprimir_arreglo(arreglo);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xea6(%rip),%rsi
mov    $0x28,%edx
call   1050 <memcpy@plt>
movl   $0xa,-0x34(%rbp)
movl   $0x1,-0x38(%rbp)
mov    -0x38(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
lea    0xea4(%rip),%rdi
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
call   1060 <imprimir_arreglo@plt>
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
lea    -0x38(%rbp),%rdx
call   1030 <quicksort@plt>
mov    -0x38(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
lea    0xe74(%rip),%rdi
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
call   1060 <imprimir_arreglo@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
mov    0xee2(%rip),%rax
mov    %rax,0x30(%rsp)
movaps 0xec6(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xeaa(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movl   $0x2,0xc(%rsp)
lea    0xebe(%rip),%r14
mov    %r14,%rdi
mov    $0x1,%esi
call   1040 <printf@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <imprimir_arreglo@plt>
lea    0xc(%rsp),%rdx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <quicksort@plt>
mov    0xc(%rsp),%esi
lea    0x1(%rsi),%eax
mov    %eax,0xc(%rsp)
mov    %r14,%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <imprimir_arreglo@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.arreglo = [10 x i32] [i32 1, i32 4, i32 20, i32 10, i32 3, i32 8, i32 9, i32 14, i32 21, i32 6]
@.str = [17 x i8] c"Iteracion #%03d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [10 x i32]* %2 to i8*
store i32 10, i32* %3
store i32 1, i32* %4
%6 = load i32, i32* %4
%7 = add nsw i32 %6, 1
store i32 %7, i32* %4
%8 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %6)
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%10 = call i32 @imprimir_arreglo(i32* %9)
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%12 = load i32, i32* %3
%13 = call i32 @quicksort(i32* %11, i32 %12, i32* %4)
%14 = load i32, i32* %4
%15 = add nsw i32 %14, 1
store i32 %15, i32* %4
%16 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %14)
%17 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%18 = call i32 @imprimir_arreglo(i32* %17)
ret i32 0
}

LLVM IR (-O2):
@__const.main.arreglo = [10 x i32] [i32 1, i32 4, i32 20, i32 10, i32 3, i32 8, i32 9, i32 14, i32 21, i32 6]
@.str = [17 x i8] c"Iteracion #%03d \00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = alloca i32
%3 = bitcast [10 x i32]* %1 to i8*
%4 = bitcast i32* %2 to i8*
store i32 2, i32* %2
%5 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 1)
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%7 = call i32 @imprimir_arreglo(i32* %6)
%8 = call i32 @quicksort(i32* %6, i32 10, i32* %2)
%9 = load i32, i32* %2
%10 = add nsw i32 %9, 1
store i32 %10, i32* %2
%11 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %9)
%12 = call i32 @imprimir_arreglo(i32* %6)
ret i32 0
}