#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*/ form_flat_clusters_from_monotonic_criterion(double const *,
                                                               double *, int *,
                                                               double, int);
int /*<<< orphan*/ free(double *);
int /*<<< orphan*/ get_max_dist_for_each_cluster(double const *, double *, int);
scalar_t__ malloc(int);
void form_flat_clusters_from_dist(const double *Z, int *T, double cutoff,
                                  int n) {
  double *max_dists = (double *)malloc(sizeof(double) * n);
  get_max_dist_for_each_cluster(Z, max_dists, n);
  ;
  form_flat_clusters_from_monotonic_criterion(Z, max_dists, T, cutoff, n);
  free(max_dists);
}


x86 assembly (clang, -O0):
<form_flat_clusters_from_dist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movslq -0x1c(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1040 <get_max_dist_for_each_cluster@plt>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x10(%rbp),%rdx
movsd  -0x18(%rbp),%xmm0
mov    -0x1c(%rbp),%ecx
call   1060 <form_flat_clusters_from_monotonic_criterion@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<form_flat_clusters_from_dist>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %edx,%r12d
movsd  %xmm0,(%rsp)
mov    %rsi,%r14
mov    %rdi,%r15
lea    0x0(,%r12,8),%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %r15,%rdi
mov    %rax,%rsi
mov    %r12d,%edx
call   1040 <get_max_dist_for_each_cluster@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
movsd  (%rsp),%xmm0
mov    %r12d,%ecx
call   1060 <form_flat_clusters_from_monotonic_criterion@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @form_flat_clusters_from_dist(double* %0, i32* %1, double %2, i32 %3) {
%5 = alloca double*
%6 = alloca i32*
%7 = alloca double
%8 = alloca i32
%9 = alloca double*
store double* %0, double** %5
store i32* %1, i32** %6
store double %2, double* %7
store i32 %3, i32* %8
%10 = load i32, i32* %8
%11 = sext i32 %10 to i64
%12 = mul i64 8, %11
%13 = trunc i64 %12 to i32
%14 = call i64 @malloc(i32 %13)
%15 = inttoptr i64 %14 to double*
store double* %15, double** %9
%16 = load double*, double** %5
%17 = load double*, double** %9
%18 = load i32, i32* %8
%19 = call i32 @get_max_dist_for_each_cluster(double* %16, double* %17, i32 %18)
%20 = load double*, double** %5
%21 = load double*, double** %9
%22 = load i32*, i32** %6
%23 = load double, double* %7
%24 = load i32, i32* %8
%25 = call i32 @form_flat_clusters_from_monotonic_criterion(double* %20, double* %21, i32* %22, double %23, i32 %24)
%26 = load double*, double** %9
%27 = call i32 @free(double* %26)
ret void
}

LLVM IR (-O2):
define void @form_flat_clusters_from_dist(double* %0, i32* %1, double %2, i32 %3) {
%5 = shl i32 %3, 3
%6 = tail call i64 @malloc(i32 %5)
%7 = inttoptr i64 %6 to double*
%8 = tail call i32 @get_max_dist_for_each_cluster(double* %0, double* %7, i32 %3)
%9 = tail call i32 @form_flat_clusters_from_monotonic_criterion(double* %0, double* %7, i32* %1, double %2, i32 %3)
%10 = tail call i32 @free(double* %7)
ret void
}