#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ HierarchicalClusterPartition(char *, char, int, char, int);
int /*<<< orphan*/ free(char *const);
char *malloc(int const);
int strlen(char *);
void HierarchicalPartition(char genemetric, char arraymetric, char method,
                           char *jobname, int minK) {
  FILE *outputfile;
  const int n = strlen(jobname) + strlen(".ext") + 1;
  char *const filename = malloc(n * sizeof(char));
  if (genemetric) {
    HierarchicalClusterPartition(jobname, genemetric, 0, method, minK);
  }
  if (arraymetric) {
    HierarchicalClusterPartition(jobname, arraymetric, 1, method, minK);
  }
  free(filename);
  return;
}


x86 assembly (clang, -O0):
<HierarchicalPartition>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %dl,%al
mov    %sil,%dl
mov    %dil,%sil
mov    %sil,-0x1(%rbp)
mov    %dl,-0x2(%rbp)
mov    %al,-0x3(%rbp)
mov    %rcx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x34(%rbp)
lea    0xe8b(%rip),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
add    %ecx,%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
movslq -0x24(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x30(%rbp)
cmpb   $0x0,-0x1(%rbp)
je     11bf <HierarchicalPartition+0x7f>
mov    -0x10(%rbp),%rdi
mov    -0x1(%rbp),%cl
mov    -0x3(%rbp),%al
mov    -0x14(%rbp),%r8d
xor    %edx,%edx
movsbl %cl,%esi
movsbl %al,%ecx
call   1060 <HierarchicalClusterPartition@plt>
cmpb   $0x0,-0x2(%rbp)
je     11e7 <HierarchicalPartition+0xa7>
mov    -0x10(%rbp),%rdi
mov    -0x2(%rbp),%cl
mov    -0x3(%rbp),%al
mov    -0x14(%rbp),%r8d
mov    $0x1,%edx
movsbl %cl,%esi
movsbl %al,%ecx
call   1060 <HierarchicalClusterPartition@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HierarchicalPartition>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8d,%r15d
mov    %rcx,%r13
mov    %edx,%r14d
mov    %esi,%r12d
mov    %edi,%ebp
mov    %rcx,%rdi
call   1040 <strlen@plt>
mov    %eax,%ebx
lea    0xe96(%rip),%rdi
call   1040 <strlen@plt>
lea    (%rbx,%rax,1),%edi
add    $0x1,%edi
call   1050 <malloc@plt>
mov    %rax,(%rsp)
movsbl %r14b,%ebx
test   %bpl,%bpl
je     119a <HierarchicalPartition+0x5a>
movsbl %bpl,%esi
mov    %r13,%rdi
xor    %edx,%edx
mov    %ebx,%ecx
mov    %r15d,%r8d
call   1060 <HierarchicalClusterPartition@plt>
test   %r12b,%r12b
je     11b5 <HierarchicalPartition+0x75>
movsbl %r12b,%esi
mov    %r13,%rdi
mov    $0x1,%edx
mov    %ebx,%ecx
mov    %r15d,%r8d
call   1060 <HierarchicalClusterPartition@plt>
mov    (%rsp),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [5 x i8] c".ext\00"
define void @HierarchicalPartition(i8 signext %0, i8 signext %1, i8 signext %2, i8* %3, i32 %4) {
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32*
%12 = alloca i32
%13 = alloca i8*
store i8 %0, i8* %6
store i8 %1, i8* %7
store i8 %2, i8* %8
store i8* %3, i8** %9
store i32 %4, i32* %10
%14 = load i8*, i8** %9
%15 = call i32 @strlen(i8* %14)
%16 = call i32 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%17 = add nsw i32 %15, %16
%18 = add nsw i32 %17, 1
store i32 %18, i32* %12
%19 = load i32, i32* %12
%20 = sext i32 %19 to i64
%21 = mul i64 %20, 1
%22 = trunc i64 %21 to i32
%23 = call i8* @malloc(i32 %22)
store i8* %23, i8** %13
%24 = load i8, i8* %6
%25 = icmp ne i8 %24, 0
br i1 %25, label %26, label %32
26: ; preds = %5
%27 = load i8*, i8** %9
%28 = load i8, i8* %6
%29 = load i8, i8* %8
%30 = load i32, i32* %10
%31 = call i32 @HierarchicalClusterPartition(i8* %27, i8 signext %28, i32 0, i8 signext %29, i32 %30)
br label %32
32: ; preds = %26, %5
%33 = load i8, i8* %7
%34 = icmp ne i8 %33, 0
br i1 %34, label %35, label %41
35: ; preds = %32
%36 = load i8*, i8** %9
%37 = load i8, i8* %7
%38 = load i8, i8* %8
%39 = load i32, i32* %10
%40 = call i32 @HierarchicalClusterPartition(i8* %36, i8 signext %37, i32 1, i8 signext %38, i32 %39)
br label %41
41: ; preds = %35, %32
%42 = load i8*, i8** %13
%43 = call i32 @free(i8* %42)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c".ext\00"
define void @HierarchicalPartition(i8 signext %0, i8 signext %1, i8 signext %2, i8* %3, i32 %4) {
%6 = tail call i32 @strlen(i8* %3)
%7 = tail call i32 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%8 = add i32 %6, 1
%9 = add i32 %8, %7
%10 = tail call i8* @malloc(i32 %9)
%11 = icmp eq i8 %0, 0
br i1 %11, label %14, label %12
12: ; preds = %5
%13 = tail call i32 @HierarchicalClusterPartition(i8* %3, i8 signext %0, i32 0, i8 signext %2, i32 %4)
br label %14
14: ; preds = %12, %5
%15 = icmp eq i8 %1, 0
br i1 %15, label %18, label %16
16: ; preds = %14
%17 = tail call i32 @HierarchicalClusterPartition(i8* %3, i8 signext %1, i32 1, i8 signext %2, i32 %4)
br label %18
18: ; preds = %16, %14
%19 = tail call i32 @free(i8* %10)
ret void
}