#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*/ PerformArraySOM(int /*<<< orphan*/ *, int, int, int, double,
                                   char);
int /*<<< orphan*/ PerformGeneSOM(int /*<<< orphan*/ *, int, int, int, double,
                                  char);
int /*<<< orphan*/ ResetIndex(char);
void PerformSOM(FILE *GeneFile, int GeneXDim, int GeneYDim, int GeneIters,
                double GeneTau, char GeneMetric, FILE *ArrayFile, int ArrayXDim,
                int ArrayYDim, int ArrayIters, double ArrayTau,
                char ArrayMetric) {
  if (GeneIters > 0)
    PerformGeneSOM(GeneFile, GeneXDim, GeneYDim, GeneIters, GeneTau,
                   GeneMetric);
  else
    ResetIndex('g');
  if (ArrayIters > 0)
    PerformArraySOM(ArrayFile, ArrayXDim, ArrayYDim, ArrayIters, ArrayTau,
                    ArrayMetric);
  else
    ResetIndex('a');
  return;
}


x86 assembly (clang, -O0):
<PerformSOM>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %r8b,%al
mov    0x28(%rbp),%r8b
mov    0x20(%rbp),%r8d
mov    0x18(%rbp),%r8d
mov    0x10(%rbp),%r8d
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
movsd  %xmm0,-0x20(%rbp)
mov    %al,-0x21(%rbp)
mov    %r9,-0x30(%rbp)
movsd  %xmm1,-0x38(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    1194 <PerformSOM+0x64>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
movsd  -0x20(%rbp),%xmm0
movsbl -0x21(%rbp),%r8d
call   1030 <PerformGeneSOM@plt>
jmp    119e <PerformSOM+0x6e>
mov    $0x67,%edi
call   1040 <ResetIndex@plt>
cmpl   $0x0,0x20(%rbp)
jle    11c9 <PerformSOM+0x99>
mov    -0x30(%rbp),%rdi
mov    0x10(%rbp),%esi
mov    0x18(%rbp),%edx
mov    0x20(%rbp),%ecx
movsd  -0x38(%rbp),%xmm0
movsbl 0x28(%rbp),%r8d
call   1050 <PerformArraySOM@plt>
jmp    11d3 <PerformSOM+0xa3>
mov    $0x61,%edi
call   1040 <ResetIndex@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PerformSOM>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
movsd  %xmm1,0x8(%rsp)
mov    %r9,%r14
mov    0x58(%rsp),%r12b
mov    0x50(%rsp),%ebp
mov    0x48(%rsp),%r15d
mov    0x40(%rsp),%ebx
test   %ecx,%ecx
jle    118d <PerformSOM+0x5d>
movsbl %r8b,%r8d
call   1030 <PerformGeneSOM@plt>
test   %ebp,%ebp
jle    119b <PerformSOM+0x6b>
movsbl %r12b,%r8d
mov    %r14,%rdi
mov    %ebx,%esi
mov    %r15d,%edx
mov    %ebp,%ecx
movsd  0x8(%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <PerformArraySOM@plt>
mov    $0x67,%edi
call   1040 <ResetIndex@plt>
test   %ebp,%ebp
jg     1168 <PerformSOM+0x38>
mov    $0x61,%edi
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <ResetIndex@plt>

LLVM IR (-O0):
define void @PerformSOM(i32* %0, i32 %1, i32 %2, i32 %3, double %4, i8 signext %5, i32* %6, i32 %7, i32 %8, i32 %9, double %10, i8 signext %11) {
%13 = alloca i32*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca double
%18 = alloca i8
%19 = alloca i32*
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca double
%24 = alloca i8
store i32* %0, i32** %13
store i32 %1, i32* %14
store i32 %2, i32* %15
store i32 %3, i32* %16
store double %4, double* %17
store i8 %5, i8* %18
store i32* %6, i32** %19
store i32 %7, i32* %20
store i32 %8, i32* %21
store i32 %9, i32* %22
store double %10, double* %23
store i8 %11, i8* %24
%25 = load i32, i32* %16
%26 = icmp sgt i32 %25, 0
br i1 %26, label %27, label %35
27: ; preds = %12
%28 = load i32*, i32** %13
%29 = load i32, i32* %14
%30 = load i32, i32* %15
%31 = load i32, i32* %16
%32 = load double, double* %17
%33 = load i8, i8* %18
%34 = call i32 @PerformGeneSOM(i32* %28, i32 %29, i32 %30, i32 %31, double %32, i8 signext %33)
br label %37
35: ; preds = %12
%36 = call i32 @ResetIndex(i8 signext 103)
br label %37
37: ; preds = %35, %27
%38 = load i32, i32* %22
%39 = icmp sgt i32 %38, 0
br i1 %39, label %40, label %48
40: ; preds = %37
%41 = load i32*, i32** %19
%42 = load i32, i32* %20
%43 = load i32, i32* %21
%44 = load i32, i32* %22
%45 = load double, double* %23
%46 = load i8, i8* %24
%47 = call i32 @PerformArraySOM(i32* %41, i32 %42, i32 %43, i32 %44, double %45, i8 signext %46)
br label %50
48: ; preds = %37
%49 = call i32 @ResetIndex(i8 signext 97)
br label %50
50: ; preds = %48, %40
ret void
}

LLVM IR (-O2):
define void @PerformSOM(i32* %0, i32 %1, i32 %2, i32 %3, double %4, i8 signext %5, i32* %6, i32 %7, i32 %8, i32 %9, double %10, i8 signext %11) {
%13 = icmp sgt i32 %3, 0
br i1 %13, label %14, label %16
14: ; preds = %12
%15 = tail call i32 @PerformGeneSOM(i32* %0, i32 %1, i32 %2, i32 %3, double %4, i8 signext %5)
br label %18
16: ; preds = %12
%17 = tail call i32 @ResetIndex(i8 signext 103)
br label %18
18: ; preds = %16, %14
%19 = icmp sgt i32 %9, 0
br i1 %19, label %20, label %22
20: ; preds = %18
%21 = tail call i32 @PerformArraySOM(i32* %6, i32 %7, i32 %8, i32 %9, double %10, i8 signext %11)
br label %24
22: ; preds = %18
%23 = tail call i32 @ResetIndex(i8 signext 97)
br label %24
24: ; preds = %22, %20
ret void
}