#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*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
scalar_t__ malloc(int);
int /*<<< orphan*/ stderr;
void make_intervals(double themin, double themax, int breaks,
                    double **delivery_array) {
  double range = themax - themin;
  double *to_return_array;
  int to_return_arrayindex = 0;
  double upto = themin;
  double thedivide = range / breaks - 1;
  int i;
  to_return_array = (double *)malloc((breaks + 1) * sizeof(double));
  if (to_return_array == NULL) {
    fputs("Error allocating memory", stderr);
    exit(EXIT_FAILURE);
  }
  for (i = 0; i < breaks; i++) {
    double newupto = i * thedivide + ((i - 1) * 1) + themin + 1;
    to_return_array[to_return_arrayindex] = newupto;
    to_return_arrayindex++;
    upto = newupto;
  }
  to_return_array[to_return_arrayindex] = themax + 1;
  *delivery_array = to_return_array;
}


x86 assembly (clang, -O0):
<make_intervals>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %edi,-0x14(%rbp)
mov    %rsi,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movl   $0x0,-0x34(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm0
cvtsi2sdl -0x14(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe81(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    11cd <make_intervals+0x9d>
mov    0x2e2f(%rip),%rax
mov    (%rax),%esi
lea    0xe4e(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2e12(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1248 <make_intervals+0x118>
cvtsi2sdl -0x4c(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
mov    -0x4c(%rbp),%eax
sub    $0x1,%eax
shl    $0x0,%eax
cvtsi2sd %eax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  0xdf4(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    11d4 <make_intervals+0xa4>
movsd  0xdb0(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_intervals>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r14
mov    %edi,%ebx
movsd  %xmm1,0x8(%rsp)
movapd %xmm0,0x10(%rsp)
lea    0x8(,%rbx,8),%edi
call   1040 <malloc@plt>
test   %rax,%rax
je     130e <make_intervals+0x1de>
test   %ebx,%ebx
jle    1198 <make_intervals+0x68>
movsd  0x8(%rsp),%xmm10
movapd %xmm10,%xmm0
movapd 0x10(%rsp),%xmm5
subsd  %xmm5,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %ebx,%xmm1
divsd  %xmm1,%xmm0
addsd  0xe76(%rip),%xmm0
mov    %ebx,%ecx
cmp    $0x1,%ebx
jne    11a6 <make_intervals+0x76>
xor    %edx,%edx
jmp    12a8 <make_intervals+0x178>
xor    %ecx,%ecx
movsd  0x8(%rsp),%xmm10
jmp    12df <make_intervals+0x1af>
mov    %ecx,%edx
and    $0xfffffffe,%edx
movapd %xmm0,%xmm2
unpcklpd %xmm0,%xmm2
movapd %xmm5,%xmm1
unpcklpd %xmm5,%xmm1
lea    -0x2(%rdx),%rsi
mov    %rsi,%rbx
shr    %rbx
add    $0x1,%rbx
test   %rsi,%rsi
je     12f9 <make_intervals+0x1c9>
mov    %rbx,%rdi
and    $0xfffffffffffffffe,%rdi
movdqa 0xe2f(%rip),%xmm7
xor    %esi,%esi
pcmpeqd %xmm11,%xmm11
movapd 0xe30(%rip),%xmm4
movdqa 0xe37(%rip),%xmm8
movdqa 0xe3e(%rip),%xmm9
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cvtdq2pd %xmm7,%xmm6
movdqa %xmm7,%xmm3
paddd  %xmm11,%xmm3
cvtdq2pd %xmm3,%xmm3
mulpd  %xmm2,%xmm6
addpd  %xmm3,%xmm6
addpd  %xmm1,%xmm6
addpd  %xmm4,%xmm6
movdqa %xmm7,%xmm3
paddd  %xmm8,%xmm3
cvtdq2pd %xmm3,%xmm3
movupd %xmm6,(%rax,%rsi,8)
movdqa %xmm7,%xmm6
psubd  %xmm11,%xmm6
cvtdq2pd %xmm6,%xmm6
mulpd  %xmm2,%xmm3
addpd  %xmm6,%xmm3
addpd  %xmm1,%xmm3
addpd  %xmm4,%xmm3
movupd %xmm3,0x10(%rax,%rsi,8)
add    $0x4,%rsi
paddd  %xmm9,%xmm7
add    $0xfffffffffffffffe,%rdi
jne    1210 <make_intervals+0xe0>
test   $0x1,%bl
je     12a3 <make_intervals+0x173>
cvtdq2pd %xmm7,%xmm3
pcmpeqd %xmm4,%xmm4
paddd  %xmm7,%xmm4
cvtdq2pd %xmm4,%xmm4
mulpd  %xmm2,%xmm3
addpd  %xmm4,%xmm3
addpd  %xmm1,%xmm3
addpd  0xd82(%rip),%xmm3
movupd %xmm3,(%rax,%rsi,8)
cmp    %rcx,%rdx
je     12df <make_intervals+0x1af>
movsd  0xd58(%rip),%xmm1
xorps  %xmm2,%xmm2
cvtsi2sd %edx,%xmm2
lea    -0x1(%rdx),%esi
xorps  %xmm3,%xmm3
cvtsi2sd %esi,%xmm3
mulsd  %xmm0,%xmm2
addsd  %xmm3,%xmm2
addsd  %xmm5,%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,(%rax,%rdx,8)
add    $0x1,%rdx
cmp    %rdx,%rcx
jne    12b0 <make_intervals+0x180>
addsd  0xd20(%rip),%xmm10
movsd  %xmm10,(%rax,%rcx,8)
mov    %rax,(%r14)
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret
movdqa 0xd0f(%rip),%xmm7
xor    %esi,%esi
test   $0x1,%bl
jne    127a <make_intervals+0x14a>
jmp    12a3 <make_intervals+0x173>
mov    0x2ccb(%rip),%rax
mov    (%rax),%esi
lea    0xd32(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2cae(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"Error allocating memory\00"
@stderr = global i32 0
@EXIT_FAILURE = global i32 0
define void @make_intervals(double %0, double %1, i32 %2, double** %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca i32
%8 = alloca double**
%9 = alloca double
%10 = alloca double*
%11 = alloca i32
%12 = alloca double
%13 = alloca double
%14 = alloca i32
%15 = alloca double
store double %0, double* %5
store double %1, double* %6
store i32 %2, i32* %7
store double** %3, double*** %8
%16 = load double, double* %6
%17 = load double, double* %5
%18 = fsub double %16, %17
store double %18, double* %9
store i32 0, i32* %11
%19 = load double, double* %5
store double %19, double* %12
%20 = load double, double* %9
%21 = load i32, i32* %7
%22 = sitofp i32 %21 to double
%23 = fdiv double %20, %22
%24 = fsub double %23, 1.000000e+00
store double %24, double* %13
%25 = load i32, i32* %7
%26 = add nsw i32 %25, 1
%27 = sext i32 %26 to i64
%28 = mul i64 %27, 8
%29 = trunc i64 %28 to i32
%30 = call i64 @malloc(i32 %29)
%31 = inttoptr i64 %30 to double*
store double* %31, double** %10
%32 = load double*, double** %10
%33 = icmp eq double* %32, null
br i1 %33, label %34, label %39
34: ; preds = %4
%35 = load i32, i32* @stderr
%36 = call i32 @fputs(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %35)
%37 = load i32, i32* @EXIT_FAILURE
%38 = call i32 @exit(i32 %37)
unreachable
39: ; preds = %4
store i32 0, i32* %14
br label %40
40: ; preds = %64, %39
%41 = load i32, i32* %14
%42 = load i32, i32* %7
%43 = icmp slt i32 %41, %42
br i1 %43, label %44, label %67
44: ; preds = %40
%45 = load i32, i32* %14
%46 = sitofp i32 %45 to double
%47 = load double, double* %13
%48 = load i32, i32* %14
%49 = sub nsw i32 %48, 1
%50 = mul nsw i32 %49, 1
%51 = sitofp i32 %50 to double
%52 = call double @llvm.fmuladd.f64(double %46, double %47, double %51)
%53 = load double, double* %5
%54 = fadd double %52, %53
%55 = fadd double %54, 1.000000e+00
store double %55, double* %15
%56 = load double, double* %15
%57 = load double*, double** %10
%58 = load i32, i32* %11
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds double, double* %57, i64 %59
store double %56, double* %60
%61 = load i32, i32* %11
%62 = add nsw i32 %61, 1
store i32 %62, i32* %11
%63 = load double, double* %15
store double %63, double* %12
br label %64
64: ; preds = %44
%65 = load i32, i32* %14
%66 = add nsw i32 %65, 1
store i32 %66, i32* %14
br label %40
67: ; preds = %40
%68 = load double, double* %6
%69 = fadd double %68, 1.000000e+00
%70 = load double*, double** %10
%71 = load i32, i32* %11
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds double, double* %70, i64 %72
store double %69, double* %73
%74 = load double*, double** %10
%75 = load double**, double*** %8
store double* %74, double** %75
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"Error allocating memory\00"
@stderr = global i32 0
@EXIT_FAILURE = global i32 0
define void @make_intervals(double %0, double %1, i32 %2, double** nocapture writeonly %3) {
%5 = fsub double %1, %0
%6 = sitofp i32 %2 to double
%7 = fdiv double %5, %6
%8 = fadd double %7, -1.000000e+00
%9 = shl i32 %2, 3
%10 = add i32 %9, 8
%11 = tail call i64 @malloc(i32 %10)
%12 = inttoptr i64 %11 to double*
%13 = icmp eq i64 %11, 0
br i1 %13, label %75, label %14
14: ; preds = %4
%15 = icmp sgt i32 %2, 0
br i1 %15, label %16, label %94
16: ; preds = %14
%17 = zext i32 %2 to i64
%18 = icmp eq i32 %2, 1
br i1 %18, label %73, label %19
19: ; preds = %16
%20 = and i64 %17, 4294967294
%21 = insertelement <2 x double> poison, double %8, i64 0
%22 = shufflevector <2 x double> %21, <2 x double> poison, <2 x i32> zeroinitializer
%23 = insertelement <2 x double> poison, double %0, i64 0
%24 = shufflevector <2 x double> %23, <2 x double> poison, <2 x i32> zeroinitializer
%25 = add nsw i64 %20, -2
%26 = lshr exact i64 %25, 1
%27 = add nuw i64 %26, 1
%28 = and i64 %27, 1
%29 = icmp eq i64 %25, 0
br i1 %29, label %58, label %30
30: ; preds = %19
%31 = and i64 %27, -2
br label %32
32: ; preds = %32, %30
%33 = phi i64 [ 0, %30 ], [ %54, %32 ]
%34 = phi <2 x i32> [ <i32 0, i32 1>, %30 ], [ %55, %32 ]
%35 = phi i64 [ 0, %30 ], [ %56, %32 ]
%36 = sitofp <2 x i32> %34 to <2 x double>
%37 = add nsw <2 x i32> %34, <i32 -1, i32 -1>
%38 = sitofp <2 x i32> %37 to <2 x double>
%39 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %36, <2 x double> %22, <2 x double> %38)
%40 = fadd <2 x double> %39, %24
%41 = fadd <2 x double> %40, <double 1.000000e+00, double 1.000000e+00>
%42 = getelementptr inbounds double, double* %12, i64 %33
%43 = bitcast double* %42 to <2 x double>*
store <2 x double> %41, <2 x double>* %43
%44 = or i64 %33, 2
%45 = add <2 x i32> %34, <i32 2, i32 2>
%46 = sitofp <2 x i32> %45 to <2 x double>
%47 = add <2 x i32> %34, <i32 1, i32 1>
%48 = sitofp <2 x i32> %47 to <2 x double>
%49 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %46, <2 x double> %22, <2 x double> %48)
%50 = fadd <2 x double> %49, %24
%51 = fadd <2 x double> %50, <double 1.000000e+00, double 1.000000e+00>
%52 = getelementptr inbounds double, double* %12, i64 %44
%53 = bitcast double* %52 to <2 x double>*
store <2 x double> %51, <2 x double>* %53
%54 = add nuw i64 %33, 4
%55 = add <2 x i32> %34, <i32 4, i32 4>
%56 = add nuw i64 %35, 2
%57 = icmp eq i64 %56, %31
br i1 %57, label %58, label %32
58: ; preds = %32, %19
%59 = phi i64 [ 0, %19 ], [ %54, %32 ]
%60 = phi <2 x i32> [ <i32 0, i32 1>, %19 ], [ %55, %32 ]
%61 = icmp eq i64 %28, 0
br i1 %61, label %71, label %62
62: ; preds = %58
%63 = sitofp <2 x i32> %60 to <2 x double>
%64 = add nsw <2 x i32> %60, <i32 -1, i32 -1>
%65 = sitofp <2 x i32> %64 to <2 x double>
%66 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %63, <2 x double> %22, <2 x double> %65)
%67 = fadd <2 x double> %66, %24
%68 = fadd <2 x double> %67, <double 1.000000e+00, double 1.000000e+00>
%69 = getelementptr inbounds double, double* %12, i64 %59
%70 = bitcast double* %69 to <2 x double>*
store <2 x double> %68, <2 x double>* %70
br label %71
71: ; preds = %58, %62
%72 = icmp eq i64 %20, %17
br i1 %72, label %92, label %73
73: ; preds = %16, %71
%74 = phi i64 [ 0, %16 ], [ %20, %71 ]
br label %80
75: ; preds = %4
%76 = load i32, i32* @stderr
%77 = tail call i32 @fputs(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %76)
%78 = load i32, i32* @EXIT_FAILURE
%79 = tail call i32 @exit(i32 %78)
unreachable
80: ; preds = %73, %80
%81 = phi i64 [ %90, %80 ], [ %74, %73 ]
%82 = trunc i64 %81 to i32
%83 = sitofp i32 %82 to double
%84 = add nsw i32 %82, -1
%85 = sitofp i32 %84 to double
%86 = tail call double @llvm.fmuladd.f64(double %83, double %8, double %85)
%87 = fadd double %86, %0
%88 = fadd double %87, 1.000000e+00
%89 = getelementptr inbounds double, double* %12, i64 %81
store double %88, double* %89
%90 = add nuw nsw i64 %81, 1
%91 = icmp eq i64 %90, %17
br i1 %91, label %92, label %80
92: ; preds = %80, %71
%93 = zext i32 %2 to i64
br label %94
94: ; preds = %14, %92
%95 = phi i64 [ %93, %92 ], [ 0, %14 ]
%96 = fadd double %1, 1.000000e+00
%97 = getelementptr inbounds double, double* %12, i64 %95
store double %96, double* %97
store double* %12, double** %3
ret void
}