#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 advance_window_start_to_next_snp(int, int *, char *, int);
int calculate_block_size_without_gaps(char *, int *, int, int, int);
int find_number_of_snps_in_block(int, int, int *, char *, int);
int find_number_of_snps_in_block_with_start_end_index(int, int, int *, char *,
                                                      int, int, int);
int find_starting_index(int, int *, int, int);
double get_block_likelihood(int, int, int, int);
int rewind_window_end_to_last_snp(int, int *, char *, int);
void move_blocks_inwards_while_likelihood_improves(
    int number_of_blocks, int **block_coordinates, int min_snps,
    int *snp_site_coords, int number_of_branch_snps, char *branch_snp_sequence,
    int *snp_locations, int branch_genome_size, char *child_sequence,
    int length_of_sequence, double *block_likelihoods, int cutoff_value) {
  int i;
  int previous_start;
  int previous_end;
  for (i = 0; i < number_of_blocks; i++) {
    int current_start = block_coordinates[0][i];
    int current_end = block_coordinates[1][i];
    int start_index = find_starting_index(current_start, snp_site_coords, 0,
                                          number_of_branch_snps);
    int end_index = find_starting_index(current_end, snp_site_coords,
                                        start_index, number_of_branch_snps);
    if (i == 0) {
      previous_start = block_coordinates[0][i];
      previous_end = block_coordinates[1][i];
    } else if (previous_start == block_coordinates[0][i] &&
               previous_end == block_coordinates[1][i] && i > 0) {
      block_coordinates[0][i] = -1;
      block_coordinates[1][i] = -1;
    } else {
      previous_start = block_coordinates[0][i];
      previous_end = block_coordinates[1][i];
    }
  }
  for (i = 0; i < number_of_blocks; i++) {
    if (block_coordinates[0][i] == -1 || block_coordinates[1][i] == -1) {
      continue;
    }
    int current_start = block_coordinates[0][i];
    int current_end = block_coordinates[1][i];
    double current_block_likelihood = 0;
    int block_genome_size_without_gaps = block_coordinates[3][i];
    int block_snp_count;
    int next_start_position = current_start;
    int start_index = find_starting_index(current_start, snp_site_coords, 0,
                                          number_of_branch_snps);
    int end_index = find_starting_index(current_end, snp_site_coords,
                                        start_index, number_of_branch_snps);
    block_snp_count = find_number_of_snps_in_block_with_start_end_index(
        current_start, current_end, snp_site_coords, branch_snp_sequence,
        number_of_branch_snps, start_index, end_index);
    if (block_genome_size_without_gaps == -1) {
      block_genome_size_without_gaps = calculate_block_size_without_gaps(
          child_sequence, snp_locations, current_start, current_end,
          length_of_sequence);
      block_coordinates[2][i] = current_block_likelihood;
      block_coordinates[3][i] = block_genome_size_without_gaps;
    }
    current_block_likelihood =
        get_block_likelihood(branch_genome_size, number_of_branch_snps,
                             block_genome_size_without_gaps, block_snp_count);
    while (current_start < current_end && block_snp_count >= min_snps) {
      next_start_position++;
      next_start_position = advance_window_start_to_next_snp(
          next_start_position, snp_site_coords, branch_snp_sequence,
          number_of_branch_snps);
      if (next_start_position >= current_end) {
        break;
      }
      if (next_start_position <= current_start) {
        break;
      }
      int previous_block_snp_count = block_snp_count;
      int previous_block_genome_size_without_gaps =
          block_genome_size_without_gaps;
      block_snp_count = find_number_of_snps_in_block_with_start_end_index(
          next_start_position, current_end, snp_site_coords,
          branch_snp_sequence, number_of_branch_snps, start_index, end_index);
      block_genome_size_without_gaps = calculate_block_size_without_gaps(
          child_sequence, snp_locations, next_start_position, current_end,
          length_of_sequence);
      double next_block_likelihood =
          get_block_likelihood(branch_genome_size, number_of_branch_snps,
                               block_genome_size_without_gaps, block_snp_count);
      if (next_block_likelihood <= current_block_likelihood) {
        current_block_likelihood = next_block_likelihood;
        current_start = next_start_position;
        start_index++;
      } else {
        block_snp_count = previous_block_snp_count;
        block_genome_size_without_gaps =
            previous_block_genome_size_without_gaps;
        break;
      }
    }
    int next_end_position = current_end;
    while (current_start < current_end && block_snp_count >= min_snps) {
      next_end_position--;
      next_end_position = rewind_window_end_to_last_snp(
          next_end_position, snp_site_coords, branch_snp_sequence,
          number_of_branch_snps);
      if (next_end_position <= current_start) {
        break;
      }
      if (next_end_position >= current_end) {
        break;
      }
      int previous_block_snp_count = block_snp_count;
      int previous_block_genome_size_without_gaps =
          block_genome_size_without_gaps;
      block_snp_count = find_number_of_snps_in_block(
          current_start, next_end_position, snp_site_coords,
          branch_snp_sequence, number_of_branch_snps);
      block_genome_size_without_gaps = calculate_block_size_without_gaps(
          child_sequence, snp_locations, current_start, next_end_position,
          length_of_sequence);
      double next_block_likelihood =
          get_block_likelihood(branch_genome_size, number_of_branch_snps,
                               block_genome_size_without_gaps, block_snp_count);
      if (next_block_likelihood <= current_block_likelihood) {
        current_block_likelihood = next_block_likelihood;
        current_end = next_end_position;
        end_index--;
      } else {
        block_snp_count = previous_block_snp_count;
        block_genome_size_without_gaps =
            previous_block_genome_size_without_gaps;
        break;
      }
    }
    block_coordinates[0][i] = current_start;
    block_coordinates[1][i] = current_end;
    block_coordinates[2][i] = (int)current_block_likelihood;
    block_coordinates[3][i] = block_genome_size_without_gaps;
    block_likelihoods[i] = current_block_likelihood;
  }
}


x86 assembly (clang, -O0):
<move_blocks_inwards_while_likelihood_improves>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    0x38(%rbp),%eax
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    12d5 <move_blocks_inwards_while_likelihood_improves+0x165>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x44(%rbp)
mov    -0x40(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%ecx
xor    %edx,%edx
call   1080 <find_starting_index@plt>
mov    %eax,-0x48(%rbp)
mov    -0x44(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x48(%rbp),%edx
mov    -0x24(%rbp),%ecx
call   1080 <find_starting_index@plt>
mov    %eax,-0x4c(%rbp)
cmpl   $0x0,-0x34(%rbp)
jne    1237 <move_blocks_inwards_while_likelihood_improves+0xc7>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x3c(%rbp)
jmp    12c2 <move_blocks_inwards_while_likelihood_improves+0x152>
mov    -0x38(%rbp),%eax
mov    -0x10(%rbp),%rcx
mov    (%rcx),%rcx
movslq -0x34(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jne    129a <move_blocks_inwards_while_likelihood_improves+0x12a>
mov    -0x3c(%rbp),%eax
mov    -0x10(%rbp),%rcx
mov    0x8(%rcx),%rcx
movslq -0x34(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jne    129a <move_blocks_inwards_while_likelihood_improves+0x12a>
cmpl   $0x0,-0x34(%rbp)
jle    129a <move_blocks_inwards_while_likelihood_improves+0x12a>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movslq -0x34(%rbp),%rcx
movl   $0xffffffff,(%rax,%rcx,4)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movslq -0x34(%rbp),%rcx
movl   $0xffffffff,(%rax,%rcx,4)
jmp    12bd <move_blocks_inwards_while_likelihood_improves+0x14d>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x3c(%rbp)
jmp    12c2 <move_blocks_inwards_while_likelihood_improves+0x152>
jmp    12c7 <move_blocks_inwards_while_likelihood_improves+0x157>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11ad <move_blocks_inwards_while_likelihood_improves+0x3d>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    16e7 <move_blocks_inwards_while_likelihood_improves+0x577>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movslq -0x34(%rbp),%rcx
cmpl   $0xffffffff,(%rax,%rcx,4)
je     1313 <move_blocks_inwards_while_likelihood_improves+0x1a3>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movslq -0x34(%rbp),%rcx
cmpl   $0xffffffff,(%rax,%rcx,4)
jne    1318 <move_blocks_inwards_while_likelihood_improves+0x1a8>
jmp    16d9 <move_blocks_inwards_while_likelihood_improves+0x569>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x50(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x54(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x64(%rbp)
mov    -0x50(%rbp),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x50(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%ecx
xor    %edx,%edx
call   1080 <find_starting_index@plt>
mov    %eax,-0x70(%rbp)
mov    -0x54(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x70(%rbp),%edx
mov    -0x24(%rbp),%ecx
call   1080 <find_starting_index@plt>
mov    %eax,-0x74(%rbp)
mov    -0x50(%rbp),%edi
mov    -0x54(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    -0x24(%rbp),%r8d
mov    -0x70(%rbp),%r9d
mov    -0x74(%rbp),%eax
mov    %eax,(%rsp)
call   1030 <find_number_of_snps_in_block_with_start_end_index@plt>
mov    %eax,-0x68(%rbp)
cmpl   $0xffffffff,-0x64(%rbp)
jne    13f2 <move_blocks_inwards_while_likelihood_improves+0x282>
mov    0x20(%rbp),%rdi
mov    0x10(%rbp),%rsi
mov    -0x50(%rbp),%edx
mov    -0x54(%rbp),%ecx
mov    0x28(%rbp),%r8d
call   1040 <calculate_block_size_without_gaps@plt>
mov    %eax,-0x64(%rbp)
cvttsd2si -0x60(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movslq -0x34(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x64(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
movslq -0x34(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    0x18(%rbp),%edi
mov    -0x24(%rbp),%esi
mov    -0x64(%rbp),%edx
mov    -0x68(%rbp),%ecx
call   1070 <get_block_likelihood@plt>
movsd  %xmm0,-0x60(%rbp)
mov    -0x50(%rbp),%ecx
xor    %eax,%eax
cmp    -0x54(%rbp),%ecx
mov    %al,-0xa1(%rbp)
jge    142b <move_blocks_inwards_while_likelihood_improves+0x2bb>
mov    -0x68(%rbp),%eax
cmp    -0x14(%rbp),%eax
setge  %al
mov    %al,-0xa1(%rbp)
mov    -0xa1(%rbp),%al
test   $0x1,%al
jne    143e <move_blocks_inwards_while_likelihood_improves+0x2ce>
jmp    1530 <move_blocks_inwards_while_likelihood_improves+0x3c0>
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
mov    -0x6c(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x24(%rbp),%ecx
call   1060 <advance_window_start_to_next_snp@plt>
mov    %eax,-0x6c(%rbp)
mov    -0x6c(%rbp),%eax
cmp    -0x54(%rbp),%eax
jl     146e <move_blocks_inwards_while_likelihood_improves+0x2fe>
jmp    1530 <move_blocks_inwards_while_likelihood_improves+0x3c0>
mov    -0x6c(%rbp),%eax
cmp    -0x50(%rbp),%eax
jg     147f <move_blocks_inwards_while_likelihood_improves+0x30f>
jmp    1530 <move_blocks_inwards_while_likelihood_improves+0x3c0>
mov    -0x68(%rbp),%eax
mov    %eax,-0x78(%rbp)
mov    -0x64(%rbp),%eax
mov    %eax,-0x7c(%rbp)
mov    -0x6c(%rbp),%edi
mov    -0x54(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    -0x24(%rbp),%r8d
mov    -0x70(%rbp),%r9d
mov    -0x74(%rbp),%eax
mov    %eax,(%rsp)
call   1030 <find_number_of_snps_in_block_with_start_end_index@plt>
mov    %eax,-0x68(%rbp)
mov    0x20(%rbp),%rdi
mov    0x10(%rbp),%rsi
mov    -0x6c(%rbp),%edx
mov    -0x54(%rbp),%ecx
mov    0x28(%rbp),%r8d
call   1040 <calculate_block_size_without_gaps@plt>
mov    %eax,-0x64(%rbp)
mov    0x18(%rbp),%edi
mov    -0x24(%rbp),%esi
mov    -0x64(%rbp),%edx
mov    -0x68(%rbp),%ecx
call   1070 <get_block_likelihood@plt>
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x88(%rbp),%xmm1
ff
movsd  -0x60(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     151a <move_blocks_inwards_while_likelihood_improves+0x3aa>
movsd  -0x88(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x6c(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    -0x70(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x70(%rbp)
jmp    152b <move_blocks_inwards_while_likelihood_improves+0x3bb>
mov    -0x78(%rbp),%eax
mov    %eax,-0x68(%rbp)
mov    -0x7c(%rbp),%eax
mov    %eax,-0x64(%rbp)
jmp    1530 <move_blocks_inwards_while_likelihood_improves+0x3c0>
jmp    1408 <move_blocks_inwards_while_likelihood_improves+0x298>
mov    -0x54(%rbp),%eax
mov    %eax,-0x8c(%rbp)
mov    -0x50(%rbp),%ecx
xor    %eax,%eax
cmp    -0x54(%rbp),%ecx
mov    %al,-0xa2(%rbp)
jge    155c <move_blocks_inwards_while_likelihood_improves+0x3ec>
mov    -0x68(%rbp),%eax
cmp    -0x14(%rbp),%eax
setge  %al
mov    %al,-0xa2(%rbp)
mov    -0xa2(%rbp),%al
test   $0x1,%al
jne    156f <move_blocks_inwards_while_likelihood_improves+0x3ff>
jmp    167e <move_blocks_inwards_while_likelihood_improves+0x50e>
mov    -0x8c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8c(%rbp)
mov    -0x8c(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x24(%rbp),%ecx
call   1090 <rewind_window_end_to_last_snp@plt>
mov    %eax,-0x8c(%rbp)
mov    -0x8c(%rbp),%eax
cmp    -0x50(%rbp),%eax
jg     15ae <move_blocks_inwards_while_likelihood_improves+0x43e>
jmp    167e <move_blocks_inwards_while_likelihood_improves+0x50e>
mov    -0x8c(%rbp),%eax
cmp    -0x54(%rbp),%eax
jl     15c2 <move_blocks_inwards_while_likelihood_improves+0x452>
jmp    167e <move_blocks_inwards_while_likelihood_improves+0x50e>
mov    -0x68(%rbp),%eax
mov    %eax,-0x90(%rbp)
mov    -0x64(%rbp),%eax
mov    %eax,-0x94(%rbp)
mov    -0x50(%rbp),%edi
mov    -0x8c(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    -0x24(%rbp),%r8d
call   1050 <find_number_of_snps_in_block@plt>
mov    %eax,-0x68(%rbp)
mov    0x20(%rbp),%rdi
mov    0x10(%rbp),%rsi
mov    -0x50(%rbp),%edx
mov    -0x8c(%rbp),%ecx
mov    0x28(%rbp),%r8d
call   1040 <calculate_block_size_without_gaps@plt>
mov    %eax,-0x64(%rbp)
mov    0x18(%rbp),%edi
mov    -0x24(%rbp),%esi
mov    -0x64(%rbp),%edx
mov    -0x68(%rbp),%ecx
call   1070 <get_block_likelihood@plt>
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0xa0(%rbp),%xmm1
ff
movsd  -0x60(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1662 <move_blocks_inwards_while_likelihood_improves+0x4f2>
movsd  -0xa0(%rbp),%xmm0
ff
movsd  %xmm0,-0x60(%rbp)
mov    -0x8c(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    -0x74(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x74(%rbp)
jmp    1679 <move_blocks_inwards_while_likelihood_improves+0x509>
mov    -0x90(%rbp),%eax
mov    %eax,-0x68(%rbp)
mov    -0x94(%rbp),%eax
mov    %eax,-0x64(%rbp)
jmp    167e <move_blocks_inwards_while_likelihood_improves+0x50e>
jmp    1539 <move_blocks_inwards_while_likelihood_improves+0x3c9>
mov    -0x50(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movslq -0x34(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x54(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movslq -0x34(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
cvttsd2si -0x60(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movslq -0x34(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x64(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
movslq -0x34(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
movsd  -0x60(%rbp),%xmm0
mov    0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    12dc <move_blocks_inwards_while_likelihood_improves+0x16c>
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<move_blocks_inwards_while_likelihood_improves>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %r9,0x30(%rsp)
mov    %r8d,0xc(%rsp)
mov    %rcx,0x18(%rsp)
mov    %edx,0x24(%rsp)
test   %edi,%edi
jle    1667 <move_blocks_inwards_while_likelihood_improves+0x4f7>
mov    %rsi,%r14
mov    %edi,%ebx
mov    %edi,%eax
mov    %rax,0x48(%rsp)
mov    (%rsi),%rax
mov    0x8(%rsi),%rcx
mov    (%rax),%edi
mov    (%rcx),%r15d
mov    0x18(%rsp),%r12
mov    %r12,%rsi
xor    %edx,%edx
mov    0xc(%rsp),%ebp
mov    %ebp,%ecx
call   1080 <find_starting_index@plt>
mov    %r15d,%edi
mov    %r12,%rsi
mov    %eax,%edx
mov    %ebp,%ecx
call   1080 <find_starting_index@plt>
cmp    $0x1,%ebx
mov    %r14,0x38(%rsp)
je     1275 <move_blocks_inwards_while_likelihood_improves+0x105>
mov    %ebx,0x8(%rsp)
mov    (%r14),%rax
mov    0x8(%r14),%rcx
mov    (%rcx),%r12d
mov    (%rax),%r13d
mov    $0x1,%ebx
mov    0xc(%rsp),%ebp
jmp    1211 <move_blocks_inwards_while_likelihood_improves+0xa1>
nop
add    $0x1,%rbx
mov    %esi,%r13d
mov    %edx,%r12d
cmp    %rbx,0x48(%rsp)
je     126a <move_blocks_inwards_while_likelihood_improves+0xfa>
mov    (%rax,%rbx,4),%edi
mov    (%rcx,%rbx,4),%r15d
mov    0x18(%rsp),%r14
mov    %r14,%rsi
xor    %edx,%edx
mov    %ebp,%ecx
call   1080 <find_starting_index@plt>
mov    %r15d,%edi
mov    %r14,%rsi
mov    0x38(%rsp),%r14
mov    %eax,%edx
mov    %ebp,%ecx
call   1080 <find_starting_index@plt>
mov    (%r14),%rax
mov    0x8(%r14),%rcx
mov    (%rax,%rbx,4),%esi
mov    (%rcx,%rbx,4),%edx
cmp    %esi,%r13d
jne    1200 <move_blocks_inwards_while_likelihood_improves+0x90>
cmp    %edx,%r12d
jne    1200 <move_blocks_inwards_while_likelihood_improves+0x90>
movl   $0xffffffff,(%rax,%rbx,4)
movl   $0xffffffff,(%rcx,%rbx,4)
mov    %r12d,%edx
mov    %r13d,%esi
jmp    1200 <move_blocks_inwards_while_likelihood_improves+0x90>
cmpl   $0x0,0x8(%rsp)
jle    1667 <move_blocks_inwards_while_likelihood_improves+0x4f7>
mov    (%r14),%rax
xor    %ebp,%ebp
jmp    12cb <move_blocks_inwards_while_likelihood_improves+0x15b>
mov    %r14d,%r15d
mov    %esi,%ebx
mov    0x38(%rsp),%r14
mov    (%r14),%rax
mov    0x50(%rsp),%rbp
mov    0x8(%rsp),%ecx
mov    %ecx,(%rax,%rbp,4)
mov    0x8(%r14),%rcx
mov    %ebx,(%rcx,%rbp,4)
cvttsd2si %xmm1,%ecx
mov    0x10(%r14),%rdx
mov    %ecx,(%rdx,%rbp,4)
mov    0x18(%r14),%rcx
mov    %r15d,(%rcx,%rbp,4)
mov    0xb0(%rsp),%rcx
movsd  %xmm1,(%rcx,%rbp,8)
add    $0x1,%rbp
cmp    0x48(%rsp),%rbp
je     1667 <move_blocks_inwards_while_likelihood_improves+0x4f7>
mov    (%rax,%rbp,4),%r15d
cmp    $0xffffffff,%r15d
je     12bc <move_blocks_inwards_while_likelihood_improves+0x14c>
mov    0x8(%r14),%rcx
mov    (%rcx,%rbp,4),%r12d
cmp    $0xffffffff,%r12d
je     12bc <move_blocks_inwards_while_likelihood_improves+0x14c>
mov    0x18(%r14),%rax
mov    (%rax,%rbp,4),%eax
mov    %eax,0x8(%rsp)
mov    %r15d,%edi
mov    0x18(%rsp),%r13
mov    %r13,%rsi
xor    %edx,%edx
mov    0xc(%rsp),%ebx
mov    %ebx,%ecx
call   1080 <find_starting_index@plt>
mov    %eax,%r14d
mov    %r12d,%edi
mov    %r13,%rsi
mov    %eax,%edx
mov    %ebx,%ecx
call   1080 <find_starting_index@plt>
mov    %eax,0x40(%rsp)
mov    %eax,(%rsp)
mov    %r15d,%edi
mov    %r12d,%esi
mov    %r13,%rdx
mov    0x30(%rsp),%rcx
mov    %ebx,%r8d
mov    %r14d,%r13d
mov    %r14d,%r9d
mov    0x8(%rsp),%r14d
call   1030 <find_number_of_snps_in_block_with_start_end_index@plt>
mov    %eax,%ecx
cmp    $0xffffffff,%r14d
jne    138c <move_blocks_inwards_while_likelihood_improves+0x21c>
mov    0xa0(%rsp),%rdi
mov    0x90(%rsp),%rsi
mov    %r15d,%edx
mov    %ecx,%r14d
mov    %r12d,%ecx
mov    0xa8(%rsp),%r8d
call   1040 <calculate_block_size_without_gaps@plt>
mov    %r14d,%ecx
mov    %eax,%r14d
mov    0x38(%rsp),%rdx
mov    0x10(%rdx),%rax
movl   $0x0,(%rax,%rbp,4)
mov    0x18(%rdx),%rax
mov    %r14d,(%rax,%rbp,4)
mov    0x98(%rsp),%edi
mov    %ebx,%esi
mov    %r14d,%edx
mov    %ecx,%ebx
call   1070 <get_block_likelihood@plt>
mov    %r12,0x28(%rsp)
cmp    %r12d,%r15d
mov    %rbp,0x50(%rsp)
jge    14e8 <move_blocks_inwards_while_likelihood_improves+0x378>
cmp    0x24(%rsp),%ebx
jl     14e8 <move_blocks_inwards_while_likelihood_improves+0x378>
movsd  %xmm0,0x10(%rsp)
mov    %ebx,%r12d
lea    0x1(%r15),%edi
mov    0x18(%rsp),%rsi
mov    0x30(%rsp),%rdx
mov    0xc(%rsp),%ecx
call   1060 <advance_window_start_to_next_snp@plt>
cmp    0x28(%rsp),%eax
jge    14f8 <move_blocks_inwards_while_likelihood_improves+0x388>
cmp    %r15d,%eax
mov    %r15,%rbx
jle    1505 <move_blocks_inwards_while_likelihood_improves+0x395>
mov    0x28(%rsp),%rsi
mov    %r14d,%r15d
movsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
mov    %ebx,0x8(%rsp)
mov    %r12d,0x44(%rsp)
mov    %r15d,%r14d
mov    %eax,%ebx
mov    0x40(%rsp),%eax
mov    %eax,(%rsp)
mov    %ebx,%edi
mov    0x18(%rsp),%rdx
mov    0x30(%rsp),%rcx
mov    0xc(%rsp),%ebp
mov    %ebp,%r8d
mov    %r13d,%r9d
call   1030 <find_number_of_snps_in_block_with_start_end_index@plt>
mov    %eax,%r12d
mov    0xa0(%rsp),%rdi
mov    0x90(%rsp),%rsi
mov    %ebx,%edx
mov    0x28(%rsp),%rcx
mov    0xa8(%rsp),%r8d
call   1040 <calculate_block_size_without_gaps@plt>
mov    %eax,%r15d
mov    0x98(%rsp),%edi
mov    %ebp,%esi
mov    0x28(%rsp),%rbp
mov    %eax,%edx
mov    %r12d,%ecx
call   1070 <get_block_likelihood@plt>
mov    0x44(%rsp),%edx
mov    %rbp,%rsi
movsd  0x10(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jb     1540 <move_blocks_inwards_while_likelihood_improves+0x3d0>
cmp    0x24(%rsp),%r12d
jl     1524 <move_blocks_inwards_while_likelihood_improves+0x3b4>
movsd  %xmm0,0x10(%rsp)
lea    0x1(%rbx),%edi
mov    %rsi,%r14
mov    0x18(%rsp),%rsi
mov    0x30(%rsp),%rdx
mov    0xc(%rsp),%ecx
call   1060 <advance_window_start_to_next_snp@plt>
mov    %r14,%rsi
cmp    %esi,%eax
jge    1646 <move_blocks_inwards_while_likelihood_improves+0x4d6>
add    $0x1,%r13d
mov    %r15d,%r14d
mov    %r12d,%edx
mov    %ebx,%ecx
mov    %ebx,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
movapd %xmm0,%xmm1
cmp    %ebx,%eax
jg     1400 <move_blocks_inwards_while_likelihood_improves+0x290>
jmp    1540 <move_blocks_inwards_while_likelihood_improves+0x3d0>
mov    %ebx,%edx
mov    %r15d,%eax
mov    %r15d,0x8(%rsp)
movapd %xmm0,%xmm1
jmp    1514 <move_blocks_inwards_while_likelihood_improves+0x3a4>
mov    %r12d,%edx
mov    %r15d,%eax
mov    %r15d,0x8(%rsp)
jmp    150e <move_blocks_inwards_while_likelihood_improves+0x39e>
mov    %r12d,%edx
mov    %ebx,%eax
mov    %ebx,0x8(%rsp)
movsd  0x10(%rsp),%xmm1
mov    0x28(%rsp),%rsi
cmp    %esi,0x8(%rsp)
jl     154a <move_blocks_inwards_while_likelihood_improves+0x3da>
jmp    127c <move_blocks_inwards_while_likelihood_improves+0x10c>
mov    %r15d,%r14d
mov    %r12d,%edx
mov    %ebx,%eax
mov    %ebx,0x8(%rsp)
movapd %xmm0,%xmm1
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmp    %esi,0x8(%rsp)
jge    127c <move_blocks_inwards_while_likelihood_improves+0x10c>
cmp    0x24(%rsp),%edx
jl     127c <move_blocks_inwards_while_likelihood_improves+0x10c>
movsd  %xmm1,0x10(%rsp)
lea    -0x1(%rsi),%edi
mov    %rsi,%r13
mov    0x18(%rsp),%rsi
mov    0x30(%rsp),%rdx
mov    0xc(%rsp),%ecx
call   1090 <rewind_window_end_to_last_snp@plt>
cmp    0x8(%rsp),%eax
jle    1626 <move_blocks_inwards_while_likelihood_improves+0x4b6>
mov    %r14d,%r15d
movsd  0x10(%rsp),%xmm0
movapd %xmm0,%xmm1
mov    %r13d,%ebx
cmp    %r13d,%eax
jge    1281 <move_blocks_inwards_while_likelihood_improves+0x111>
mov    %r13d,%ebx
movsd  %xmm0,0x10(%rsp)
mov    %r14d,%r15d
mov    %eax,%r13d
mov    0x8(%rsp),%r14d
mov    %r14d,%edi
mov    %eax,%esi
mov    0x18(%rsp),%rdx
mov    0x30(%rsp),%rcx
mov    0xc(%rsp),%r12d
mov    %r12d,%r8d
call   1050 <find_number_of_snps_in_block@plt>
mov    %eax,%ebp
mov    0xa0(%rsp),%rdi
mov    0x90(%rsp),%rsi
mov    %r14d,%edx
mov    %r13d,%ecx
mov    0xa8(%rsp),%r8d
call   1040 <calculate_block_size_without_gaps@plt>
mov    %eax,%r14d
mov    0x98(%rsp),%edi
mov    %r12d,%esi
mov    %eax,%edx
mov    %ebp,%ecx
call   1070 <get_block_likelihood@plt>
movsd  0x10(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jb     1281 <move_blocks_inwards_while_likelihood_improves+0x111>
cmp    0x24(%rsp),%ebp
jl     1637 <move_blocks_inwards_while_likelihood_improves+0x4c7>
movsd  %xmm0,0x10(%rsp)
lea    -0x1(%r13),%edi
jmp    1560 <move_blocks_inwards_while_likelihood_improves+0x3f0>
mov    %r14d,%r15d
movsd  0x10(%rsp),%xmm1
mov    %r13d,%ebx
jmp    1281 <move_blocks_inwards_while_likelihood_improves+0x111>
mov    %r14d,%r15d
movapd %xmm0,%xmm1
mov    %r13d,%ebx
jmp    1281 <move_blocks_inwards_while_likelihood_improves+0x111>
mov    %r15d,%r14d
mov    %r12d,%edx
mov    %ebx,%eax
mov    %ebx,0x8(%rsp)
movsd  0x10(%rsp),%xmm1
cmp    %esi,0x8(%rsp)
jl     154a <move_blocks_inwards_while_likelihood_improves+0x3da>
jmp    127c <move_blocks_inwards_while_likelihood_improves+0x10c>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @move_blocks_inwards_while_likelihood_improves(i32 %0, i32** %1, i32 %2, i32* %3, i32 %4, i8* %5, i32* %6, i32 %7, i8* %8, i32 %9, double* %10, i32 %11) {
%13 = alloca i32
%14 = alloca i32**
%15 = alloca i32
%16 = alloca i32*
%17 = alloca i32
%18 = alloca i8*
%19 = alloca i32*
%20 = alloca i32
%21 = alloca i8*
%22 = alloca i32
%23 = alloca double*
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
%28 = alloca i32
%29 = alloca i32
%30 = alloca i32
%31 = alloca i32
%32 = alloca i32
%33 = alloca i32
%34 = alloca double
%35 = alloca i32
%36 = alloca i32
%37 = alloca i32
%38 = alloca i32
%39 = alloca i32
%40 = alloca i32
%41 = alloca i32
%42 = alloca double
%43 = alloca i32
%44 = alloca i32
%45 = alloca i32
%46 = alloca double
store i32 %0, i32* %13
store i32** %1, i32*** %14
store i32 %2, i32* %15
store i32* %3, i32** %16
store i32 %4, i32* %17
store i8* %5, i8** %18
store i32* %6, i32** %19
store i32 %7, i32* %20
store i8* %8, i8** %21
store i32 %9, i32* %22
store double* %10, double** %23
store i32 %11, i32* %24
store i32 0, i32* %25
br label %47
47: ; preds = %145, %12
%48 = load i32, i32* %25
%49 = load i32, i32* %13
%50 = icmp slt i32 %48, %49
br i1 %50, label %51, label %148
51: ; preds = %47
%52 = load i32**, i32*** %14
%53 = getelementptr inbounds i32*, i32** %52, i64 0
%54 = load i32*, i32** %53
%55 = load i32, i32* %25
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds i32, i32* %54, i64 %56
%58 = load i32, i32* %57
store i32 %58, i32* %28
%59 = load i32**, i32*** %14
%60 = getelementptr inbounds i32*, i32** %59, i64 1
%61 = load i32*, i32** %60
%62 = load i32, i32* %25
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds i32, i32* %61, i64 %63
%65 = load i32, i32* %64
store i32 %65, i32* %29
%66 = load i32, i32* %28
%67 = load i32*, i32** %16
%68 = load i32, i32* %17
%69 = call i32 @find_starting_index(i32 %66, i32* %67, i32 0, i32 %68)
store i32 %69, i32* %30
%70 = load i32, i32* %29
%71 = load i32*, i32** %16
%72 = load i32, i32* %30
%73 = load i32, i32* %17
%74 = call i32 @find_starting_index(i32 %70, i32* %71, i32 %72, i32 %73)
store i32 %74, i32* %31
%75 = load i32, i32* %25
%76 = icmp eq i32 %75, 0
br i1 %76, label %77, label %92
77: ; preds = %51
%78 = load i32**, i32*** %14
%79 = getelementptr inbounds i32*, i32** %78, i64 0
%80 = load i32*, i32** %79
%81 = load i32, i32* %25
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds i32, i32* %80, i64 %82
%84 = load i32, i32* %83
store i32 %84, i32* %26
%85 = load i32**, i32*** %14
%86 = getelementptr inbounds i32*, i32** %85, i64 1
%87 = load i32*, i32** %86
%88 = load i32, i32* %25
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds i32, i32* %87, i64 %89
%91 = load i32, i32* %90
store i32 %91, i32* %27
br label %144
92: ; preds = %51
%93 = load i32, i32* %26
%94 = load i32**, i32*** %14
%95 = getelementptr inbounds i32*, i32** %94, i64 0
%96 = load i32*, i32** %95
%97 = load i32, i32* %25
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds i32, i32* %96, i64 %98
%100 = load i32, i32* %99
%101 = icmp eq i32 %93, %100
br i1 %101, label %102, label %128
102: ; preds = %92
%103 = load i32, i32* %27
%104 = load i32**, i32*** %14
%105 = getelementptr inbounds i32*, i32** %104, i64 1
%106 = load i32*, i32** %105
%107 = load i32, i32* %25
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds i32, i32* %106, i64 %108
%110 = load i32, i32* %109
%111 = icmp eq i32 %103, %110
br i1 %111, label %112, label %128
112: ; preds = %102
%113 = load i32, i32* %25
%114 = icmp sgt i32 %113, 0
br i1 %114, label %115, label %128
115: ; preds = %112
%116 = load i32**, i32*** %14
%117 = getelementptr inbounds i32*, i32** %116, i64 0
%118 = load i32*, i32** %117
%119 = load i32, i32* %25
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds i32, i32* %118, i64 %120
store i32 -1, i32* %121
%122 = load i32**, i32*** %14
%123 = getelementptr inbounds i32*, i32** %122, i64 1
%124 = load i32*, i32** %123
%125 = load i32, i32* %25
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds i32, i32* %124, i64 %126
store i32 -1, i32* %127
br label %143
128: ; preds = %112, %102, %92
%129 = load i32**, i32*** %14
%130 = getelementptr inbounds i32*, i32** %129, i64 0
%131 = load i32*, i32** %130
%132 = load i32, i32* %25
%133 = sext i32 %132 to i64
%134 = getelementptr inbounds i32, i32* %131, i64 %133
%135 = load i32, i32* %134
store i32 %135, i32* %26
%136 = load i32**, i32*** %14
%137 = getelementptr inbounds i32*, i32** %136, i64 1
%138 = load i32*, i32** %137
%139 = load i32, i32* %25
%140 = sext i32 %139 to i64
%141 = getelementptr inbounds i32, i32* %138, i64 %140
%142 = load i32, i32* %141
store i32 %142, i32* %27
br label %143
143: ; preds = %128, %115
br label %144
144: ; preds = %143, %77
br label %145
145: ; preds = %144
%146 = load i32, i32* %25
%147 = add nsw i32 %146, 1
store i32 %147, i32* %25
br label %47
148: ; preds = %47
store i32 0, i32* %25
br label %149
149: ; preds = %399, %148
%150 = load i32, i32* %25
%151 = load i32, i32* %13
%152 = icmp slt i32 %150, %151
br i1 %152, label %153, label %402
153: ; preds = %149
%154 = load i32**, i32*** %14
%155 = getelementptr inbounds i32*, i32** %154, i64 0
%156 = load i32*, i32** %155
%157 = load i32, i32* %25
%158 = sext i32 %157 to i64
%159 = getelementptr inbounds i32, i32* %156, i64 %158
%160 = load i32, i32* %159
%161 = icmp eq i32 %160, -1
br i1 %161, label %171, label %162
162: ; preds = %153
%163 = load i32**, i32*** %14
%164 = getelementptr inbounds i32*, i32** %163, i64 1
%165 = load i32*, i32** %164
%166 = load i32, i32* %25
%167 = sext i32 %166 to i64
%168 = getelementptr inbounds i32, i32* %165, i64 %167
%169 = load i32, i32* %168
%170 = icmp eq i32 %169, -1
br i1 %170, label %171, label %172
171: ; preds = %162, %153
br label %399
172: ; preds = %162
%173 = load i32**, i32*** %14
%174 = getelementptr inbounds i32*, i32** %173, i64 0
%175 = load i32*, i32** %174
%176 = load i32, i32* %25
%177 = sext i32 %176 to i64
%178 = getelementptr inbounds i32, i32* %175, i64 %177
%179 = load i32, i32* %178
store i32 %179, i32* %32
%180 = load i32**, i32*** %14
%181 = getelementptr inbounds i32*, i32** %180, i64 1
%182 = load i32*, i32** %181
%183 = load i32, i32* %25
%184 = sext i32 %183 to i64
%185 = getelementptr inbounds i32, i32* %182, i64 %184
%186 = load i32, i32* %185
store i32 %186, i32* %33
store double 0.000000e+00, double* %34
%187 = load i32**, i32*** %14
%188 = getelementptr inbounds i32*, i32** %187, i64 3
%189 = load i32*, i32** %188
%190 = load i32, i32* %25
%191 = sext i32 %190 to i64
%192 = getelementptr inbounds i32, i32* %189, i64 %191
%193 = load i32, i32* %192
store i32 %193, i32* %35
%194 = load i32, i32* %32
store i32 %194, i32* %37
%195 = load i32, i32* %32
%196 = load i32*, i32** %16
%197 = load i32, i32* %17
%198 = call i32 @find_starting_index(i32 %195, i32* %196, i32 0, i32 %197)
store i32 %198, i32* %38
%199 = load i32, i32* %33
%200 = load i32*, i32** %16
%201 = load i32, i32* %38
%202 = load i32, i32* %17
%203 = call i32 @find_starting_index(i32 %199, i32* %200, i32 %201, i32 %202)
store i32 %203, i32* %39
%204 = load i32, i32* %32
%205 = load i32, i32* %33
%206 = load i32*, i32** %16
%207 = load i8*, i8** %18
%208 = load i32, i32* %17
%209 = load i32, i32* %38
%210 = load i32, i32* %39
%211 = call i32 @find_number_of_snps_in_block_with_start_end_index(i32 %204, i32 %205, i32* %206, i8* %207, i32 %208, i32 %209, i32 %210)
store i32 %211, i32* %36
%212 = load i32, i32* %35
%213 = icmp eq i32 %212, -1
br i1 %213, label %214, label %236
214: ; preds = %172
%215 = load i8*, i8** %21
%216 = load i32*, i32** %19
%217 = load i32, i32* %32
%218 = load i32, i32* %33
%219 = load i32, i32* %22
%220 = call i32 @calculate_block_size_without_gaps(i8* %215, i32* %216, i32 %217, i32 %218, i32 %219)
store i32 %220, i32* %35
%221 = load double, double* %34
%222 = fptosi double %221 to i32
%223 = load i32**, i32*** %14
%224 = getelementptr inbounds i32*, i32** %223, i64 2
%225 = load i32*, i32** %224
%226 = load i32, i32* %25
%227 = sext i32 %226 to i64
%228 = getelementptr inbounds i32, i32* %225, i64 %227
store i32 %222, i32* %228
%229 = load i32, i32* %35
%230 = load i32**, i32*** %14
%231 = getelementptr inbounds i32*, i32** %230, i64 3
%232 = load i32*, i32** %231
%233 = load i32, i32* %25
%234 = sext i32 %233 to i64
%235 = getelementptr inbounds i32, i32* %232, i64 %234
store i32 %229, i32* %235
br label %236
236: ; preds = %214, %172
%237 = load i32, i32* %20
%238 = load i32, i32* %17
%239 = load i32, i32* %35
%240 = load i32, i32* %36
%241 = call double @get_block_likelihood(i32 %237, i32 %238, i32 %239, i32 %240)
store double %241, double* %34
br label %242
242: ; preds = %302, %236
%243 = load i32, i32* %32
%244 = load i32, i32* %33
%245 = icmp slt i32 %243, %244
br i1 %245, label %246, label %250
246: ; preds = %242
%247 = load i32, i32* %36
%248 = load i32, i32* %15
%249 = icmp sge i32 %247, %248
br label %250
250: ; preds = %246, %242
%251 = phi i1 [ false, %242 ], [ %249, %246 ]
br i1 %251, label %252, label %303
252: ; preds = %250
%253 = load i32, i32* %37
%254 = add nsw i32 %253, 1
store i32 %254, i32* %37
%255 = load i32, i32* %37
%256 = load i32*, i32** %16
%257 = load i8*, i8** %18
%258 = load i32, i32* %17
%259 = call i32 @advance_window_start_to_next_snp(i32 %255, i32* %256, i8* %257, i32 %258)
store i32 %259, i32* %37
%260 = load i32, i32* %37
%261 = load i32, i32* %33
%262 = icmp sge i32 %260, %261
br i1 %262, label %263, label %264
263: ; preds = %252
br label %303
264: ; preds = %252
%265 = load i32, i32* %37
%266 = load i32, i32* %32
%267 = icmp sle i32 %265, %266
br i1 %267, label %268, label %269
268: ; preds = %264
br label %303
269: ; preds = %264
%270 = load i32, i32* %36
store i32 %270, i32* %40
%271 = load i32, i32* %35
store i32 %271, i32* %41
%272 = load i32, i32* %37
%273 = load i32, i32* %33
%274 = load i32*, i32** %16
%275 = load i8*, i8** %18
%276 = load i32, i32* %17
%277 = load i32, i32* %38
%278 = load i32, i32* %39
%279 = call i32 @find_number_of_snps_in_block_with_start_end_index(i32 %272, i32 %273, i32* %274, i8* %275, i32 %276, i32 %277, i32 %278)
store i32 %279, i32* %36
%280 = load i8*, i8** %21
%281 = load i32*, i32** %19
%282 = load i32, i32* %37
%283 = load i32, i32* %33
%284 = load i32, i32* %22
%285 = call i32 @calculate_block_size_without_gaps(i8* %280, i32* %281, i32 %282, i32 %283, i32 %284)
store i32 %285, i32* %35
%286 = load i32, i32* %20
%287 = load i32, i32* %17
%288 = load i32, i32* %35
%289 = load i32, i32* %36
%290 = call double @get_block_likelihood(i32 %286, i32 %287, i32 %288, i32 %289)
store double %290, double* %42
%291 = load double, double* %42
%292 = load double, double* %34
%293 = fcmp ole double %291, %292
br i1 %293, label %294, label %299
294: ; preds = %269
%295 = load double, double* %42
store double %295, double* %34
%296 = load i32, i32* %37
store i32 %296, i32* %32
%297 = load i32, i32* %38
%298 = add nsw i32 %297, 1
store i32 %298, i32* %38
br label %302
299: ; preds = %269
%300 = load i32, i32* %40
store i32 %300, i32* %36
%301 = load i32, i32* %41
store i32 %301, i32* %35
br label %303
302: ; preds = %294
br label %242
303: ; preds = %299, %268, %263, %250
%304 = load i32, i32* %33
store i32 %304, i32* %43
br label %305
305: ; preds = %363, %303
%306 = load i32, i32* %32
%307 = load i32, i32* %33
%308 = icmp slt i32 %306, %307
br i1 %308, label %309, label %313
309: ; preds = %305
%310 = load i32, i32* %36
%311 = load i32, i32* %15
%312 = icmp sge i32 %310, %311
br label %313
313: ; preds = %309, %305
%314 = phi i1 [ false, %305 ], [ %312, %309 ]
br i1 %314, label %315, label %364
315: ; preds = %313
%316 = load i32, i32* %43
%317 = add nsw i32 %316, -1
store i32 %317, i32* %43
%318 = load i32, i32* %43
%319 = load i32*, i32** %16
%320 = load i8*, i8** %18
%321 = load i32, i32* %17
%322 = call i32 @rewind_window_end_to_last_snp(i32 %318, i32* %319, i8* %320, i32 %321)
store i32 %322, i32* %43
%323 = load i32, i32* %43
%324 = load i32, i32* %32
%325 = icmp sle i32 %323, %324
br i1 %325, label %326, label %327
326: ; preds = %315
br label %364
327: ; preds = %315
%328 = load i32, i32* %43
%329 = load i32, i32* %33
%330 = icmp sge i32 %328, %329
br i1 %330, label %331, label %332
331: ; preds = %327
br label %364
332: ; preds = %327
%333 = load i32, i32* %36
store i32 %333, i32* %44
%334 = load i32, i32* %35
store i32 %334, i32* %45
%335 = load i32, i32* %32
%336 = load i32, i32* %43
%337 = load i32*, i32** %16
%338 = load i8*, i8** %18
%339 = load i32, i32* %17
%340 = call i32 @find_number_of_snps_in_block(i32 %335, i32 %336, i32* %337, i8* %338, i32 %339)
store i32 %340, i32* %36
%341 = load i8*, i8** %21
%342 = load i32*, i32** %19
%343 = load i32, i32* %32
%344 = load i32, i32* %43
%345 = load i32, i32* %22
%346 = call i32 @calculate_block_size_without_gaps(i8* %341, i32* %342, i32 %343, i32 %344, i32 %345)
store i32 %346, i32* %35
%347 = load i32, i32* %20
%348 = load i32, i32* %17
%349 = load i32, i32* %35
%350 = load i32, i32* %36
%351 = call double @get_block_likelihood(i32 %347, i32 %348, i32 %349, i32 %350)
store double %351, double* %46
%352 = load double, double* %46
%353 = load double, double* %34
%354 = fcmp ole double %352, %353
br i1 %354, label %355, label %360
355: ; preds = %332
%356 = load double, double* %46
store double %356, double* %34
%357 = load i32, i32* %43
store i32 %357, i32* %33
%358 = load i32, i32* %39
%359 = add nsw i32 %358, -1
store i32 %359, i32* %39
br label %363
360: ; preds = %332
%361 = load i32, i32* %44
store i32 %361, i32* %36
%362 = load i32, i32* %45
store i32 %362, i32* %35
br label %364
363: ; preds = %355
br label %305
364: ; preds = %360, %331, %326, %313
%365 = load i32, i32* %32
%366 = load i32**, i32*** %14
%367 = getelementptr inbounds i32*, i32** %366, i64 0
%368 = load i32*, i32** %367
%369 = load i32, i32* %25
%370 = sext i32 %369 to i64
%371 = getelementptr inbounds i32, i32* %368, i64 %370
store i32 %365, i32* %371
%372 = load i32, i32* %33
%373 = load i32**, i32*** %14
%374 = getelementptr inbounds i32*, i32** %373, i64 1
%375 = load i32*, i32** %374
%376 = load i32, i32* %25
%377 = sext i32 %376 to i64
%378 = getelementptr inbounds i32, i32* %375, i64 %377
store i32 %372, i32* %378
%379 = load double, double* %34
%380 = fptosi double %379 to i32
%381 = load i32**, i32*** %14
%382 = getelementptr inbounds i32*, i32** %381, i64 2
%383 = load i32*, i32** %382
%384 = load i32, i32* %25
%385 = sext i32 %384 to i64
%386 = getelementptr inbounds i32, i32* %383, i64 %385
store i32 %380, i32* %386
%387 = load i32, i32* %35
%388 = load i32**, i32*** %14
%389 = getelementptr inbounds i32*, i32** %388, i64 3
%390 = load i32*, i32** %389
%391 = load i32, i32* %25
%392 = sext i32 %391 to i64
%393 = getelementptr inbounds i32, i32* %390, i64 %392
store i32 %387, i32* %393
%394 = load double, double* %34
%395 = load double*, double** %23
%396 = load i32, i32* %25
%397 = sext i32 %396 to i64
%398 = getelementptr inbounds double, double* %395, i64 %397
store double %394, double* %398
br label %399
399: ; preds = %364, %171
%400 = load i32, i32* %25
%401 = add nsw i32 %400, 1
store i32 %401, i32* %25
br label %149
402: ; preds = %149
ret void
}

LLVM IR (-O2):
define void @move_blocks_inwards_while_likelihood_improves(i32 %0, i32** nocapture %1, i32 %2, i32* %3, i32 %4, i8* %5, i32* %6, i32 %7, i8* %8, i32 %9, double* nocapture writeonly %10, i32 %11) {
%13 = icmp sgt i32 %0, 0
br i1 %13, label %14, label %169
14: ; preds = %12
%15 = getelementptr inbounds i32*, i32** %1, i64 1
%16 = zext i32 %0 to i64
%17 = load i32*, i32** %1
%18 = load i32, i32* %17
%19 = load i32*, i32** %15
%20 = load i32, i32* %19
%21 = tail call i32 @find_starting_index(i32 %18, i32* %3, i32 0, i32 %4)
%22 = tail call i32 @find_starting_index(i32 %20, i32* %3, i32 %21, i32 %4)
%23 = load i32*, i32** %1
%24 = load i32*, i32** %15
%25 = icmp eq i32 %0, 1
br i1 %25, label %30, label %26
26: ; preds = %14
%27 = load i32, i32* %24
%28 = load i32, i32* %23
br label %36
29: ; preds = %58
br i1 %13, label %30, label %169
30: ; preds = %14, %29
%31 = getelementptr inbounds i32*, i32** %1, i64 1
%32 = getelementptr inbounds i32*, i32** %1, i64 3
%33 = getelementptr inbounds i32*, i32** %1, i64 2
%34 = zext i32 %0 to i64
%35 = load i32*, i32** %1
br label %63
36: ; preds = %26, %58
%37 = phi i32* [ %52, %58 ], [ %24, %26 ]
%38 = phi i32* [ %48, %58 ], [ %23, %26 ]
%39 = phi i64 [ %61, %58 ], [ 1, %26 ]
%40 = phi i32 [ %60, %58 ], [ %28, %26 ]
%41 = phi i32 [ %59, %58 ], [ %27, %26 ]
%42 = getelementptr inbounds i32, i32* %38, i64 %39
%43 = load i32, i32* %42
%44 = getelementptr inbounds i32, i32* %37, i64 %39
%45 = load i32, i32* %44
%46 = tail call i32 @find_starting_index(i32 %43, i32* %3, i32 0, i32 %4)
%47 = tail call i32 @find_starting_index(i32 %45, i32* %3, i32 %46, i32 %4)
%48 = load i32*, i32** %1
%49 = getelementptr inbounds i32, i32* %48, i64 %39
%50 = load i32, i32* %49
%51 = icmp eq i32 %40, %50
%52 = load i32*, i32** %15
%53 = getelementptr inbounds i32, i32* %52, i64 %39
%54 = load i32, i32* %53
%55 = icmp eq i32 %41, %54
%56 = select i1 %51, i1 %55, i1 false
br i1 %56, label %57, label %58
57: ; preds = %36
store i32 -1, i32* %49
store i32 -1, i32* %53
br label %58
58: ; preds = %36, %57
%59 = phi i32 [ %41, %57 ], [ %54, %36 ]
%60 = phi i32 [ %40, %57 ], [ %50, %36 ]
%61 = add nuw nsw i64 %39, 1
%62 = icmp eq i64 %61, %16
br i1 %62, label %29, label %36
63: ; preds = %30, %165
%64 = phi i32* [ %35, %30 ], [ %166, %165 ]
%65 = phi i64 [ 0, %30 ], [ %167, %165 ]
%66 = getelementptr inbounds i32, i32* %64, i64 %65
%67 = load i32, i32* %66
%68 = icmp eq i32 %67, -1
br i1 %68, label %165, label %69
69: ; preds = %63
%70 = load i32*, i32** %31
%71 = getelementptr inbounds i32, i32* %70, i64 %65
%72 = load i32, i32* %71
%73 = icmp eq i32 %72, -1
br i1 %73, label %165, label %74
74: ; preds = %69
%75 = load i32*, i32** %32
%76 = getelementptr inbounds i32, i32* %75, i64 %65
%77 = load i32, i32* %76
%78 = tail call i32 @find_starting_index(i32 %67, i32* %3, i32 0, i32 %4)
%79 = tail call i32 @find_starting_index(i32 %72, i32* %3, i32 %78, i32 %4)
%80 = tail call i32 @find_number_of_snps_in_block_with_start_end_index(i32 %67, i32 %72, i32* %3, i8* %5, i32 %4, i32 %78, i32 %79)
%81 = icmp eq i32 %77, -1
br i1 %81, label %82, label %88
82: ; preds = %74
%83 = tail call i32 @calculate_block_size_without_gaps(i8* %8, i32* %6, i32 %67, i32 %72, i32 %9)
%84 = load i32*, i32** %33
%85 = getelementptr inbounds i32, i32* %84, i64 %65
store i32 0, i32* %85
%86 = load i32*, i32** %32
%87 = getelementptr inbounds i32, i32* %86, i64 %65
store i32 %83, i32* %87
br label %88
88: ; preds = %82, %74
%89 = phi i32 [ %83, %82 ], [ %77, %74 ]
%90 = tail call double @get_block_likelihood(i32 %7, i32 %4, i32 %89, i32 %80)
%91 = icmp slt i32 %67, %72
%92 = icmp sge i32 %80, %2
%93 = select i1 %91, i1 %92, i1 false
br i1 %93, label %94, label %120
94: ; preds = %88
%95 = add nsw i32 %67, 1
%96 = tail call i32 @advance_window_start_to_next_snp(i32 %95, i32* %3, i8* %5, i32 %4)
%97 = icmp slt i32 %96, %72
%98 = icmp sgt i32 %96, %67
%99 = select i1 %97, i1 %98, i1 false
br i1 %99, label %109, label %120
100: ; preds = %109
%101 = icmp slt i32 %116, %2
br i1 %101, label %120, label %102
102: ; preds = %100
%103 = add nsw i32 %114, 1
%104 = add nsw i32 %110, 1
%105 = tail call i32 @advance_window_start_to_next_snp(i32 %104, i32* %3, i8* %5, i32 %4)
%106 = icmp slt i32 %105, %72
%107 = icmp sgt i32 %105, %110
%108 = and i1 %106, %107
br i1 %108, label %109, label %120
109: ; preds = %94, %102
%110 = phi i32 [ %105, %102 ], [ %96, %94 ]
%111 = phi i32 [ %117, %102 ], [ %89, %94 ]
%112 = phi i32 [ %116, %102 ], [ %80, %94 ]
%113 = phi i32 [ %110, %102 ], [ %67, %94 ]
%114 = phi i32 [ %103, %102 ], [ %78, %94 ]
%115 = phi double [ %118, %102 ], [ %90, %94 ]
%116 = tail call i32 @find_number_of_snps_in_block_with_start_end_index(i32 %110, i32 %72, i32* %3, i8* %5, i32 %4, i32 %114, i32 %79)
%117 = tail call i32 @calculate_block_size_without_gaps(i8* %8, i32* %6, i32 %110, i32 %72, i32 %9)
%118 = tail call double @get_block_likelihood(i32 %7, i32 %4, i32 %117, i32 %116)
%119 = fcmp ugt double %118, %115
br i1 %119, label %120, label %100
120: ; preds = %109, %102, %100, %94, %88
%121 = phi i32 [ %89, %88 ], [ %89, %94 ], [ %117, %100 ], [ %117, %102 ], [ %111, %109 ]
%122 = phi i32 [ %80, %88 ], [ %80, %94 ], [ %116, %100 ], [ %116, %102 ], [ %112, %109 ]
%123 = phi i32 [ %67, %88 ], [ %67, %94 ], [ %110, %100 ], [ %110, %102 ], [ %113, %109 ]
%124 = phi double [ %90, %88 ], [ %90, %94 ], [ %118, %100 ], [ %118, %102 ], [ %115, %109 ]
%125 = icmp slt i32 %123, %72
%126 = icmp sge i32 %122, %2
%127 = select i1 %125, i1 %126, i1 false
br i1 %127, label %128, label %151
128: ; preds = %120
%129 = add nsw i32 %72, -1
%130 = tail call i32 @rewind_window_end_to_last_snp(i32 %129, i32* %3, i8* %5, i32 %4)
%131 = icmp sgt i32 %130, %123
%132 = icmp slt i32 %130, %72
%133 = select i1 %131, i1 %132, i1 false
br i1 %133, label %142, label %151
134: ; preds = %142
%135 = icmp slt i32 %147, %2
br i1 %135, label %151, label %136
136: ; preds = %134
%137 = add nsw i32 %143, -1
%138 = tail call i32 @rewind_window_end_to_last_snp(i32 %137, i32* %3, i8* %5, i32 %4)
%139 = icmp sgt i32 %138, %123
%140 = icmp slt i32 %138, %143
%141 = and i1 %139, %140
br i1 %141, label %142, label %151
142: ; preds = %128, %136
%143 = phi i32 [ %138, %136 ], [ %130, %128 ]
%144 = phi i32 [ %148, %136 ], [ %121, %128 ]
%145 = phi double [ %149, %136 ], [ %124, %128 ]
%146 = phi i32 [ %143, %136 ], [ %72, %128 ]
%147 = tail call i32 @find_number_of_snps_in_block(i32 %123, i32 %143, i32* %3, i8* %5, i32 %4)
%148 = tail call i32 @calculate_block_size_without_gaps(i8* %8, i32* %6, i32 %123, i32 %143, i32 %9)
%149 = tail call double @get_block_likelihood(i32 %7, i32 %4, i32 %148, i32 %147)
%150 = fcmp ugt double %149, %145
br i1 %150, label %151, label %134
151: ; preds = %142, %136, %134, %128, %120
%152 = phi i32 [ %121, %120 ], [ %121, %128 ], [ %148, %134 ], [ %148, %136 ], [ %144, %142 ]
%153 = phi double [ %124, %120 ], [ %124, %128 ], [ %149, %134 ], [ %149, %136 ], [ %145, %142 ]
%154 = phi i32 [ %72, %120 ], [ %72, %128 ], [ %143, %134 ], [ %143, %136 ], [ %146, %142 ]
%155 = load i32*, i32** %1
%156 = getelementptr inbounds i32, i32* %155, i64 %65
store i32 %123, i32* %156
%157 = load i32*, i32** %31
%158 = getelementptr inbounds i32, i32* %157, i64 %65
store i32 %154, i32* %158
%159 = fptosi double %153 to i32
%160 = load i32*, i32** %33
%161 = getelementptr inbounds i32, i32* %160, i64 %65
store i32 %159, i32* %161
%162 = load i32*, i32** %32
%163 = getelementptr inbounds i32, i32* %162, i64 %65
store i32 %152, i32* %163
%164 = getelementptr inbounds double, double* %10, i64 %65
store double %153, double* %164
br label %165
165: ; preds = %63, %69, %151
%166 = phi i32* [ %64, %63 ], [ %64, %69 ], [ %155, %151 ]
%167 = add nuw nsw i64 %65, 1
%168 = icmp eq i64 %167, %34
br i1 %168, label %169, label %63
169: ; preds = %165, %12, %29
ret void
}