#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_maxclust_monocrit(double const *, double *, int *, int, 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_maxclust_dist(const double *Z, int *T, int n, int mc) {
  double *MD = (double *)malloc(sizeof(double) * n);
  get_max_dist_for_each_cluster(Z, MD, n);
  ;
  form_flat_clusters_maxclust_monocrit(Z, MD, T, n, mc);
  free(MD);
}


x86 assembly (clang, -O0):
<form_flat_clusters_maxclust_dist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1050 <get_max_dist_for_each_cluster@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
call   1040 <form_flat_clusters_maxclust_monocrit@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<form_flat_clusters_maxclust_dist>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %ecx,%r14d
mov    %edx,%ebx
mov    %rsi,%r15
mov    %rdi,%r12
lea    0x0(,%rbx,8),%edi
call   1060 <malloc@plt>
mov    %rax,%rbp
mov    %r12,%rdi
mov    %rax,%rsi
mov    %ebx,%edx
call   1050 <get_max_dist_for_each_cluster@plt>
mov    %r12,%rdi
mov    %rbp,%rsi
mov    %r15,%rdx
mov    %ebx,%ecx
mov    %r14d,%r8d
call   1040 <form_flat_clusters_maxclust_monocrit@plt>
mov    %rbp,%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @form_flat_clusters_maxclust_dist(double* %0, i32* %1, i32 %2, i32 %3) {
%5 = alloca double*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca double*
store double* %0, double** %5
store i32* %1, i32** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = load i32, i32* %7
%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* %7
%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 i32, i32* %7
%24 = load i32, i32* %8
%25 = call i32 @form_flat_clusters_maxclust_monocrit(double* %20, double* %21, i32* %22, i32 %23, i32 %24)
%26 = load double*, double** %9
%27 = call i32 @free(double* %26)
ret void
}

LLVM IR (-O2):
define void @form_flat_clusters_maxclust_dist(double* %0, i32* %1, i32 %2, i32 %3) {
%5 = shl i32 %2, 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 %2)
%9 = tail call i32 @form_flat_clusters_maxclust_monocrit(double* %0, double* %7, i32* %1, i32 %2, i32 %3)
%10 = tail call i32 @free(double* %7)
ret void
}