#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 smith_waterman_gotoh(double const *, int, char const *, int, int, int,
                            int, int, int *);
double calc_prob_region_dp(const double *matrix, int read_length,
                           const char *seq, int seq_length, int pos, int start,
                           int end, int gap_op, int gap_ex, int *seqnt_map) {
  if (start < 0)
    start = 0;
  else if (start >= seq_length)
    start = seq_length - 1;
  end += read_length;
  if (end < 0)
    end = 0;
  else if (end >= seq_length)
    end = seq_length - 1;
  return smith_waterman_gotoh(matrix, read_length, seq, seq_length, start, end,
                              gap_op, gap_ex, seqnt_map);
}


x86 assembly (clang, -O0):
<calc_prob_region_dp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jge    1151 <calc_prob_region_dp+0x41>
movl   $0x0,-0x24(%rbp)
jmp    116b <calc_prob_region_dp+0x5b>
mov    -0x24(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jl     1166 <calc_prob_region_dp+0x56>
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    116b <calc_prob_region_dp+0x5b>
mov    -0xc(%rbp),%eax
add    0x10(%rbp),%eax
mov    %eax,0x10(%rbp)
cmpl   $0x0,0x10(%rbp)
jge    118a <calc_prob_region_dp+0x7a>
movl   $0x0,0x10(%rbp)
jmp    11a4 <calc_prob_region_dp+0x94>
mov    0x10(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jl     119f <calc_prob_region_dp+0x8f>
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
mov    %eax,0x10(%rbp)
jmp    11a4 <calc_prob_region_dp+0x94>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x24(%rbp),%r8d
mov    0x10(%rbp),%r9d
mov    0x18(%rbp),%r11d
mov    0x20(%rbp),%r10d
mov    0x28(%rbp),%rax
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1030 <smith_waterman_gotoh@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_prob_region_dp>:
push   %r14
push   %rbx
push   %rax
mov    0x28(%rsp),%r10d
lea    -0x1(%rcx),%ebx
cmp    %ecx,%r9d
mov    %ebx,%r8d
cmovl  %r9d,%r8d
xor    %r11d,%r11d
test   %r9d,%r9d
cmovs  %r11d,%r8d
mov    0x20(%rsp),%eax
add    %esi,%eax
cmp    %ecx,%eax
cmovl  %eax,%ebx
mov    0x30(%rsp),%r14d
test   %eax,%eax
cmovs  %r11d,%ebx
sub    $0x8,%rsp
mov    %ebx,%r9d
push   0x40(%rsp)
push   %r14
push   %r10
call   1030 <smith_waterman_gotoh@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define double @calc_prob_region_dp(double* %0, i32 %1, i8* %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32* %9) {
%11 = alloca double*
%12 = alloca i32
%13 = alloca i8*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32*
store double* %0, double** %11
store i32 %1, i32* %12
store i8* %2, i8** %13
store i32 %3, i32* %14
store i32 %4, i32* %15
store i32 %5, i32* %16
store i32 %6, i32* %17
store i32 %7, i32* %18
store i32 %8, i32* %19
store i32* %9, i32** %20
%21 = load i32, i32* %16
%22 = icmp slt i32 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %10
store i32 0, i32* %16
br label %32
24: ; preds = %10
%25 = load i32, i32* %16
%26 = load i32, i32* %14
%27 = icmp sge i32 %25, %26
br i1 %27, label %28, label %31
28: ; preds = %24
%29 = load i32, i32* %14
%30 = sub nsw i32 %29, 1
store i32 %30, i32* %16
br label %31
31: ; preds = %28, %24
br label %32
32: ; preds = %31, %23
%33 = load i32, i32* %12
%34 = load i32, i32* %17
%35 = add nsw i32 %34, %33
store i32 %35, i32* %17
%36 = load i32, i32* %17
%37 = icmp slt i32 %36, 0
br i1 %37, label %38, label %39
38: ; preds = %32
store i32 0, i32* %17
br label %47
39: ; preds = %32
%40 = load i32, i32* %17
%41 = load i32, i32* %14
%42 = icmp sge i32 %40, %41
br i1 %42, label %43, label %46
43: ; preds = %39
%44 = load i32, i32* %14
%45 = sub nsw i32 %44, 1
store i32 %45, i32* %17
br label %46
46: ; preds = %43, %39
br label %47
47: ; preds = %46, %38
%48 = load double*, double** %11
%49 = load i32, i32* %12
%50 = load i8*, i8** %13
%51 = load i32, i32* %14
%52 = load i32, i32* %16
%53 = load i32, i32* %17
%54 = load i32, i32* %18
%55 = load i32, i32* %19
%56 = load i32*, i32** %20
%57 = call double @smith_waterman_gotoh(double* %48, i32 %49, i8* %50, i32 %51, i32 %52, i32 %53, i32 %54, i32 %55, i32* %56)
ret double %57
}

LLVM IR (-O2):
define double @calc_prob_region_dp(double* %0, i32 %1, i8* %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32* %9) {
%11 = icmp slt i32 %5, 0
%12 = icmp slt i32 %5, %3
%13 = add nsw i32 %3, -1
%14 = select i1 %12, i32 %5, i32 %13
%15 = select i1 %11, i32 0, i32 %14
%16 = add nsw i32 %6, %1
%17 = icmp slt i32 %16, 0
%18 = icmp slt i32 %16, %3
%19 = select i1 %18, i32 %16, i32 %13
%20 = select i1 %17, i32 0, i32 %19
%21 = tail call double @smith_waterman_gotoh(double* %0, i32 %1, i8* %2, i32 %3, i32 %15, i32 %20, i32 %7, i32 %8, i32* %9)
ret double %21
}