#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 */
scalar_t__ malloc(size_t);
double *dvector(long nl, long nh) {
  double *v;
  v = (double *)malloc((size_t)((nh - nl + 1 + 1) * sizeof(double)));
  for (int i = 0; i < nh - nl; i++) {
    *(v + i) = 42.0;
  }
  return v - nl + 1;
}


x86 assembly (clang, -O0):
<dvector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
sub    -0x8(%rbp),%rdi
add    $0x1,%rdi
add    $0x1,%rdi
shl    $0x3,%rdi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movslq -0x1c(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    -0x8(%rbp),%rcx
cmp    %rcx,%rax
jge    117c <dvector+0x6c>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  0xe97(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1144 <dvector+0x34>
mov    -0x18(%rbp),%rax
xor    %ecx,%ecx
sub    -0x8(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
add    $0x8,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dvector>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
sub    %rdi,%rbx
lea    0x10(,%rbx,8),%rdi
call   1030 <malloc@plt>
test   %rbx,%rbx
jle    124d <dvector+0x13d>
cmp    $0x4,%rbx
jae    1140 <dvector+0x30>
xor    %ecx,%ecx
jmp    1227 <dvector+0x117>
mov    %rbx,%rcx
and    $0xfffffffffffffffc,%rcx
lea    -0x4(%rcx),%rdi
mov    %rdi,%rsi
shr    $0x2,%rsi
add    $0x1,%rsi
mov    %esi,%edx
and    $0x7,%edx
cmp    $0x1c,%rdi
jae    1168 <dvector+0x58>
xor    %edi,%edi
jmp    11f1 <dvector+0xe1>
and    $0xfffffffffffffff8,%rsi
xor    %edi,%edi
movaps 0xe8b(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
nop
movups %xmm0,(%rax,%rdi,8)
movups %xmm0,0x10(%rax,%rdi,8)
movups %xmm0,0x20(%rax,%rdi,8)
movups %xmm0,0x30(%rax,%rdi,8)
movups %xmm0,0x40(%rax,%rdi,8)
movups %xmm0,0x50(%rax,%rdi,8)
movups %xmm0,0x60(%rax,%rdi,8)
movups %xmm0,0x70(%rax,%rdi,8)
movups %xmm0,0x80(%rax,%rdi,8)
movups %xmm0,0x90(%rax,%rdi,8)
movups %xmm0,0xa0(%rax,%rdi,8)
movups %xmm0,0xb0(%rax,%rdi,8)
movups %xmm0,0xc0(%rax,%rdi,8)
movups %xmm0,0xd0(%rax,%rdi,8)
movups %xmm0,0xe0(%rax,%rdi,8)
movups %xmm0,0xf0(%rax,%rdi,8)
add    $0x20,%rdi
add    $0xfffffffffffffff8,%rsi
jne    1180 <dvector+0x70>
test   %rdx,%rdx
je     1222 <dvector+0x112>
lea    (%rax,%rdi,8),%rsi
add    $0x10,%rsi
shl    $0x5,%rdx
xor    %edi,%edi
movaps 0xdf5(%rip),%xmm0
nopl   0x0(%rax,%rax,1)
movups %xmm0,-0x10(%rsi,%rdi,1)
movups %xmm0,(%rsi,%rdi,1)
add    $0x20,%rdi
cmp    %rdi,%rdx
jne    1210 <dvector+0x100>
cmp    %rcx,%rbx
je     124d <dvector+0x13d>
movabs $0x4045000000000000,%rdx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rdx,(%rax,%rcx,8)
add    $0x1,%rcx
cmp    %rcx,%rbx
jne    1240 <dvector+0x130>
shl    $0x3,%r14
sub    %r14,%rax
add    $0x8,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define double* @dvector(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca double*
%6 = alloca i32
store i64 %0, i64* %3
store i64 %1, i64* %4
%7 = load i64, i64* %4
%8 = load i64, i64* %3
%9 = sub nsw i64 %7, %8
%10 = add nsw i64 %9, 1
%11 = add nsw i64 %10, 1
%12 = mul i64 %11, 8
%13 = call i64 @malloc(i64 %12)
%14 = inttoptr i64 %13 to double*
store double* %14, double** %5
store i32 0, i32* %6
br label %15
15: ; preds = %27, %2
%16 = load i32, i32* %6
%17 = sext i32 %16 to i64
%18 = load i64, i64* %4
%19 = load i64, i64* %3
%20 = sub nsw i64 %18, %19
%21 = icmp slt i64 %17, %20
br i1 %21, label %22, label %30
22: ; preds = %15
%23 = load double*, double** %5
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds double, double* %23, i64 %25
store double 4.200000e+01, double* %26
br label %27
27: ; preds = %22
%28 = load i32, i32* %6
%29 = add nsw i32 %28, 1
store i32 %29, i32* %6
br label %15
30: ; preds = %15
%31 = load double*, double** %5
%32 = load i64, i64* %3
%33 = sub i64 0, %32
%34 = getelementptr inbounds double, double* %31, i64 %33
%35 = getelementptr inbounds double, double* %34, i64 1
ret double* %35
}

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