#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 */
double log(double);
double simScore(char *, char *, double **, int, char *, int);
double scoreDistij(int i, int j, char *si, char *sj, int seqLength,
                   double simExp, double *simDiags, double **scoreMatrix,
                   char *alphabet, int alphabetSize) {
  double simij, simUpper, ratio;
  simij = simScore(si, sj, scoreMatrix, seqLength, alphabet, alphabetSize);
  simUpper = 0.5 * (simDiags[i] + simDiags[j]);
  ratio = (simij - simExp) / (simUpper - simExp);
  if (ratio <= 0)
    return (5.00);
  else
    return (-100.0 * log(ratio));
}


x86 assembly (clang, -O0):
<scoreDistij>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
movsd  %xmm0,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    0x10(%rbp),%rdx
mov    -0x24(%rbp),%ecx
mov    0x18(%rbp),%r8
mov    0x20(%rbp),%r9d
call   1040 <simScore@plt>
movsd  %xmm0,-0x40(%rbp)
mov    -0x38(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x38(%rbp),%rax
movslq -0x10(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm1
movsd  0xe6f(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
subsd  -0x30(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x50(%rbp),%xmm0
jb     11d7 <scoreDistij+0xb7>
movsd  0xe43(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11f5 <scoreDistij+0xd5>
movsd  -0x50(%rbp),%xmm0
call   1030 <log@plt>
movaps %xmm0,%xmm1
movsd  0xe1c(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scoreDistij>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %r9,%rbx
movsd  %xmm0,(%rsp)
mov    %r8d,%ebp
mov    %rdx,%rax
mov    %esi,%r14d
mov    %edi,%r15d
mov    0x30(%rsp),%rdx
mov    0x38(%rsp),%r8
mov    0x40(%rsp),%r9d
mov    %rax,%rdi
mov    %rcx,%rsi
mov    %ebp,%ecx
call   1040 <simScore@plt>
movslq %r15d,%rax
movsd  (%rbx,%rax,8),%xmm1
movslq %r14d,%rax
addsd  (%rbx,%rax,8),%xmm1
mulsd  0xe91(%rip),%xmm1
movsd  (%rsp),%xmm2
subsd  %xmm2,%xmm0
subsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
jae    1199 <scoreDistij+0x79>
call   1030 <log@plt>
mulsd  0xe79(%rip),%xmm0
jmp    11a1 <scoreDistij+0x81>
movsd  0xe67(%rip),%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @scoreDistij(i32 %0, i32 %1, i8* %2, i8* %3, i32 %4, double %5, double* %6, double** %7, i8* %8, i32 %9) {
%11 = alloca double
%12 = alloca i32
%13 = alloca i32
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i32
%17 = alloca double
%18 = alloca double*
%19 = alloca double**
%20 = alloca i8*
%21 = alloca i32
%22 = alloca double
%23 = alloca double
%24 = alloca double
store i32 %0, i32* %12
store i32 %1, i32* %13
store i8* %2, i8** %14
store i8* %3, i8** %15
store i32 %4, i32* %16
store double %5, double* %17
store double* %6, double** %18
store double** %7, double*** %19
store i8* %8, i8** %20
store i32 %9, i32* %21
%25 = load i8*, i8** %14
%26 = load i8*, i8** %15
%27 = load double**, double*** %19
%28 = load i32, i32* %16
%29 = load i8*, i8** %20
%30 = load i32, i32* %21
%31 = call double @simScore(i8* %25, i8* %26, double** %27, i32 %28, i8* %29, i32 %30)
store double %31, double* %22
%32 = load double*, double** %18
%33 = load i32, i32* %12
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds double, double* %32, i64 %34
%36 = load double, double* %35
%37 = load double*, double** %18
%38 = load i32, i32* %13
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds double, double* %37, i64 %39
%41 = load double, double* %40
%42 = fadd double %36, %41
%43 = fmul double 5.000000e-01, %42
store double %43, double* %23
%44 = load double, double* %22
%45 = load double, double* %17
%46 = fsub double %44, %45
%47 = load double, double* %23
%48 = load double, double* %17
%49 = fsub double %47, %48
%50 = fdiv double %46, %49
store double %50, double* %24
%51 = load double, double* %24
%52 = fcmp ole double %51, 0.000000e+00
br i1 %52, label %53, label %54
53: ; preds = %10
store double 5.000000e+00, double* %11
br label %58
54: ; preds = %10
%55 = load double, double* %24
%56 = call double @log(double %55)
%57 = fmul double -1.000000e+02, %56
store double %57, double* %11
br label %58
58: ; preds = %54, %53
%59 = load double, double* %11
ret double %59
}

LLVM IR (-O2):
define double @scoreDistij(i32 %0, i32 %1, i8* %2, i8* %3, i32 %4, double %5, double* nocapture %6, double** %7, i8* %8, i32 %9) {
%11 = tail call double @simScore(i8* %2, i8* %3, double** %7, i32 %4, i8* %8, i32 %9)
%12 = sext i32 %0 to i64
%13 = getelementptr inbounds double, double* %6, i64 %12
%14 = load double, double* %13
%15 = sext i32 %1 to i64
%16 = getelementptr inbounds double, double* %6, i64 %15
%17 = load double, double* %16
%18 = fadd double %14, %17
%19 = fmul double %18, 5.000000e-01
%20 = fsub double %11, %5
%21 = fsub double %19, %5
%22 = fdiv double %20, %21
%23 = fcmp ugt double %22, 0.000000e+00
br i1 %23, label %24, label %27
24: ; preds = %10
%25 = tail call double @log(double %22)
%26 = fmul double %25, -1.000000e+02
br label %27
27: ; preds = %10, %24
%28 = phi double [ %26, %24 ], [ 5.000000e+00, %10 ]
ret double %28
}