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

/* Variables and functions */
int /*<<< orphan*/ insercion(double *, int);
int /*<<< orphan*/ printf(char *, ...);
main() {
  double lista[] = {46, 54, 12, 30, 84, 18, 10, 77};
  int n_elementos = sizeof(lista) / sizeof(double);
  int i;
  insercion(lista, n_elementos);
  printf("Lista ordenada:\n");
  for (i = 0; i < n_elementos; i++)
    printf("%g ", lista[i]);
  printf("\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x40,%edx
call   1040 <memcpy@plt>
movl   $0x8,-0x54(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x54(%rbp),%esi
call   1050 <insercion@plt>
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x58(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x54(%rbp),%eax
jge    11ae <main+0x7e>
movslq -0x58(%rbp),%rax
movsd  -0x50(%rbp,%rax,8),%xmm0
lea    0xeb8(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    117c <main+0x4c>
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
movaps 0xee4(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xeac(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe90(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x8,%esi
call   1060 <insercion@plt>
lea    0xebc(%rip),%rdi
call   1040 <puts@plt>
movsd  (%rsp),%xmm0
lea    0xea7(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x8(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x10(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x18(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x20(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x28(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x30(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x38(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.lista = [8 x double] [double 4.600000e+01, double 5.400000e+01, double 1.200000e+01, double 3.000000e+01, double 8.400000e+01, double 1.800000e+01, double 1.000000e+01, double 7.700000e+01]
@.str = [17 x i8] c"Lista ordenada:\0A\00"
@.str.1 = [4 x i8] c"%g \00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [8 x double]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [8 x double]* %2 to i8*
store i32 8, i32* %3
%6 = getelementptr inbounds [8 x double], [8 x double]* %2, i64 0, i64 0
%7 = load i32, i32* %3
%8 = call i32 @insercion(double* %6, i32 %7)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %4
br label %10
10: ; preds = %20, %0
%11 = load i32, i32* %4
%12 = load i32, i32* %3
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %23
14: ; preds = %10
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [8 x double], [8 x double]* %2, i64 0, i64 %16
%18 = load double, double* %17
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %18)
br label %20
20: ; preds = %14
%21 = load i32, i32* %4
%22 = add nsw i32 %21, 1
store i32 %22, i32* %4
br label %10
23: ; preds = %10
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%25 = load i32, i32* %1
ret i32 %25
}

LLVM IR (-O2):
@__const.main.lista = [8 x double] [double 4.600000e+01, double 5.400000e+01, double 1.200000e+01, double 3.000000e+01, double 8.400000e+01, double 1.800000e+01, double 1.000000e+01, double 7.700000e+01]
@.str.1 = [4 x i8] c"%g \00"
@str = [16 x i8] c"Lista ordenada:\00"
define i32 @main() {
%1 = alloca [8 x double]
%2 = bitcast [8 x double]* %1 to i8*
%3 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 0
%4 = call i32 @insercion(double* %3, i32 8)
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%6 = load double, double* %3
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %6)
%8 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 1
%9 = load double, double* %8
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %9)
%11 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 2
%12 = load double, double* %11
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %12)
%14 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 3
%15 = load double, double* %14
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %15)
%17 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 4
%18 = load double, double* %17
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %18)
%20 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 5
%21 = load double, double* %20
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %21)
%23 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 6
%24 = load double, double* %23
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %24)
%26 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 7
%27 = load double, double* %26
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %27)
%29 = call i32 @putchar(i32 10)
ret i32 0
}