#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 */
double *malloc(int);
double *reservar(int puntos) {
  double *array = malloc(puntos * sizeof(double));
  int i;
  for (i = 0; i < puntos; i++) {
    array[i] = 1.0;
  }
  return array;
}


x86 assembly (clang, -O0):
<reservar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1164 <reservar+0x54>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  0xeaf(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1135 <reservar+0x25>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reservar>:
push   %rbx
mov    %edi,%ebx
lea    0x0(,%rbx,8),%edi
call   1030 <malloc@plt>
test   %ebx,%ebx
jle    123d <reservar+0x12d>
mov    %ebx,%ecx
cmp    $0x4,%ebx
jae    1135 <reservar+0x25>
xor    %edx,%edx
jmp    1217 <reservar+0x107>
mov    %ecx,%edx
and    $0xfffffffc,%edx
lea    -0x4(%rdx),%rbx
mov    %rbx,%rdi
shr    $0x2,%rdi
add    $0x1,%rdi
mov    %edi,%esi
and    $0x7,%esi
cmp    $0x1c,%rbx
jae    115b <reservar+0x4b>
xor    %ebx,%ebx
jmp    11e1 <reservar+0xd1>
and    $0xfffffffffffffff8,%rdi
xor    %ebx,%ebx
movaps 0xe98(%rip),%xmm0
nopl   0x0(%rax,%rax,1)
movups %xmm0,(%rax,%rbx,8)
movups %xmm0,0x10(%rax,%rbx,8)
movups %xmm0,0x20(%rax,%rbx,8)
movups %xmm0,0x30(%rax,%rbx,8)
movups %xmm0,0x40(%rax,%rbx,8)
movups %xmm0,0x50(%rax,%rbx,8)
movups %xmm0,0x60(%rax,%rbx,8)
movups %xmm0,0x70(%rax,%rbx,8)
movups %xmm0,0x80(%rax,%rbx,8)
movups %xmm0,0x90(%rax,%rbx,8)
movups %xmm0,0xa0(%rax,%rbx,8)
movups %xmm0,0xb0(%rax,%rbx,8)
movups %xmm0,0xc0(%rax,%rbx,8)
movups %xmm0,0xd0(%rax,%rbx,8)
movups %xmm0,0xe0(%rax,%rbx,8)
movups %xmm0,0xf0(%rax,%rbx,8)
add    $0x20,%rbx
add    $0xfffffffffffffff8,%rdi
jne    1170 <reservar+0x60>
test   %rsi,%rsi
je     1212 <reservar+0x102>
lea    (%rax,%rbx,8),%rdi
add    $0x10,%rdi
shl    $0x5,%rsi
xor    %ebx,%ebx
movaps 0xe05(%rip),%xmm0
nopl   0x0(%rax,%rax,1)
movups %xmm0,-0x10(%rdi,%rbx,1)
movups %xmm0,(%rdi,%rbx,1)
add    $0x20,%rbx
cmp    %rbx,%rsi
jne    1200 <reservar+0xf0>
cmp    %rcx,%rdx
je     123d <reservar+0x12d>
movabs $0x3ff0000000000000,%rsi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rsi,(%rax,%rdx,8)
add    $0x1,%rdx
cmp    %rdx,%rcx
jne    1230 <reservar+0x120>
pop    %rbx
ret

LLVM IR (-O0):
define double* @reservar(i32 %0) {
%2 = alloca i32
%3 = alloca double*
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = sext i32 %5 to i64
%7 = mul i64 %6, 8
%8 = trunc i64 %7 to i32
%9 = call double* @malloc(i32 %8)
store double* %9, double** %3
store i32 0, i32* %4
br label %10
10: ; preds = %19, %1
%11 = load i32, i32* %4
%12 = load i32, i32* %2
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %22
14: ; preds = %10
%15 = load double*, double** %3
%16 = load i32, i32* %4
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds double, double* %15, i64 %17
store double 1.000000e+00, double* %18
br label %19
19: ; preds = %14
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 1
store i32 %21, i32* %4
br label %10
22: ; preds = %10
%23 = load double*, double** %3
ret double* %23
}

LLVM IR (-O2):
define noalias double* @reservar(i32 %0) {
%2 = shl i32 %0, 3
%3 = tail call double* @malloc(i32 %2)
%4 = icmp sgt i32 %0, 0
br i1 %4, label %5, label %84
5: ; preds = %1
%6 = zext i32 %0 to i64
%7 = icmp ult i32 %0, 4
br i1 %7, label %77, label %8
8: ; preds = %5
%9 = and i64 %6, 4294967292
%10 = add nsw i64 %9, -4
%11 = lshr exact i64 %10, 2
%12 = add nuw nsw i64 %11, 1
%13 = and i64 %12, 7
%14 = icmp ult i64 %10, 28
br i1 %14, label %62, label %15
15: ; preds = %8
%16 = and i64 %12, 9223372036854775800
br label %17
17: ; preds = %17, %15
%18 = phi i64 [ 0, %15 ], [ %59, %17 ]
%19 = phi i64 [ 0, %15 ], [ %60, %17 ]
%20 = getelementptr inbounds double, double* %3, i64 %18
%21 = bitcast double* %20 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %21
%22 = getelementptr inbounds double, double* %20, i64 2
%23 = bitcast double* %22 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %23
%24 = or i64 %18, 4
%25 = getelementptr inbounds double, double* %3, i64 %24
%26 = bitcast double* %25 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %26
%27 = getelementptr inbounds double, double* %25, i64 2
%28 = bitcast double* %27 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %28
%29 = or i64 %18, 8
%30 = getelementptr inbounds double, double* %3, i64 %29
%31 = bitcast double* %30 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %31
%32 = getelementptr inbounds double, double* %30, i64 2
%33 = bitcast double* %32 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %33
%34 = or i64 %18, 12
%35 = getelementptr inbounds double, double* %3, i64 %34
%36 = bitcast double* %35 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %36
%37 = getelementptr inbounds double, double* %35, i64 2
%38 = bitcast double* %37 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %38
%39 = or i64 %18, 16
%40 = getelementptr inbounds double, double* %3, i64 %39
%41 = bitcast double* %40 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %41
%42 = getelementptr inbounds double, double* %40, i64 2
%43 = bitcast double* %42 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %43
%44 = or i64 %18, 20
%45 = getelementptr inbounds double, double* %3, i64 %44
%46 = bitcast double* %45 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %46
%47 = getelementptr inbounds double, double* %45, i64 2
%48 = bitcast double* %47 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %48
%49 = or i64 %18, 24
%50 = getelementptr inbounds double, double* %3, i64 %49
%51 = bitcast double* %50 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %51
%52 = getelementptr inbounds double, double* %50, i64 2
%53 = bitcast double* %52 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %53
%54 = or i64 %18, 28
%55 = getelementptr inbounds double, double* %3, i64 %54
%56 = bitcast double* %55 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %56
%57 = getelementptr inbounds double, double* %55, i64 2
%58 = bitcast double* %57 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %58
%59 = add nuw i64 %18, 32
%60 = add i64 %19, 8
%61 = icmp eq i64 %60, %16
br i1 %61, label %62, label %17
62: ; preds = %17, %8
%63 = phi i64 [ 0, %8 ], [ %59, %17 ]
%64 = icmp eq i64 %13, 0
br i1 %64, label %75, label %65
65: ; preds = %62, %65
%66 = phi i64 [ %72, %65 ], [ %63, %62 ]
%67 = phi i64 [ %73, %65 ], [ 0, %62 ]
%68 = getelementptr inbounds double, double* %3, i64 %66
%69 = bitcast double* %68 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %69
%70 = getelementptr inbounds double, double* %68, i64 2
%71 = bitcast double* %70 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %71
%72 = add nuw i64 %66, 4
%73 = add i64 %67, 1
%74 = icmp eq i64 %73, %13
br i1 %74, label %75, label %65
75: ; preds = %65, %62
%76 = icmp eq i64 %9, %6
br i1 %76, label %84, label %77
77: ; preds = %5, %75
%78 = phi i64 [ 0, %5 ], [ %9, %75 ]
br label %79
79: ; preds = %77, %79
%80 = phi i64 [ %82, %79 ], [ %78, %77 ]
%81 = getelementptr inbounds double, double* %3, i64 %80
store double 1.000000e+00, double* %81
%82 = add nuw nsw i64 %80, 1
%83 = icmp eq i64 %82, %6
br i1 %83, label %84, label %79
84: ; preds = %79, %75, %1
ret double* %3
}