#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 find_starting_index(int, int *, int, int);
int calculate_block_size_without_gaps_with_start_end_index(
    char *child_sequence, int *snp_locations, int starting_coordinate,
    int ending_coordinate, int length_of_original_genome, int start_index,
    int end_index) {
  int i;
  int block_size = ending_coordinate - starting_coordinate;
  start_index = find_starting_index(starting_coordinate, snp_locations,
                                    start_index, end_index);
  for (i = start_index; i < length_of_original_genome; i++) {
    if (snp_locations[i] < ending_coordinate &&
        snp_locations[i] >= starting_coordinate) {
      if (child_sequence[i] == '-' || child_sequence[i] == 'N') {
        block_size--;
      }
    }
    if (snp_locations[i] > ending_coordinate) {
      break;
    }
  }
  return block_size;
}


x86 assembly (clang, -O0):
<calculate_block_size_without_gaps_with_start_end_index>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
mov    -0x18(%rbp),%eax
sub    -0x14(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%edx
mov    0x10(%rbp),%ecx
call   1030 <find_starting_index@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11ed <calculate_block_size_without_gaps_with_start_end_index+0xdd>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x18(%rbp),%eax
jge    11c1 <calculate_block_size_without_gaps_with_start_end_index+0xb1>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x14(%rbp),%eax
jl     11c1 <calculate_block_size_without_gaps_with_start_end_index+0xb1>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2d,%eax
je     11b3 <calculate_block_size_without_gaps_with_start_end_index+0xa3>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x4e,%eax
jne    11bc <calculate_block_size_without_gaps_with_start_end_index+0xac>
mov    -0x28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x28(%rbp)
jmp    11c1 <calculate_block_size_without_gaps_with_start_end_index+0xb1>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x18(%rbp),%eax
jle    11da <calculate_block_size_without_gaps_with_start_end_index+0xca>
jmp    11ed <calculate_block_size_without_gaps_with_start_end_index+0xdd>
jmp    11df <calculate_block_size_without_gaps_with_start_end_index+0xcf>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1155 <calculate_block_size_without_gaps_with_start_end_index+0x45>
mov    -0x28(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculate_block_size_without_gaps_with_start_end_index>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8d,%ebx
mov    %ecx,%ebp
mov    %edx,%r15d
mov    %rsi,%r13
mov    %rdi,%r12
mov    0x40(%rsp),%ecx
mov    %ebp,%r14d
sub    %edx,%r14d
mov    %edx,%edi
mov    %r9d,%edx
call   1030 <find_starting_index@plt>
cmp    %ebx,%eax
jge    1182 <calculate_block_size_without_gaps_with_start_end_index+0x72>
movslq %eax,%rcx
movslq %ebx,%rax
add    $0x1,%rcx
nopl   0x0(%rax,%rax,1)
mov    -0x4(%r13,%rcx,4),%edx
cmp    %ebp,%edx
jge    1172 <calculate_block_size_without_gaps_with_start_end_index+0x62>
cmp    %r15d,%edx
jl     1172 <calculate_block_size_without_gaps_with_start_end_index+0x62>
movzbl -0x1(%r12,%rcx,1),%ebx
cmp    $0x4e,%bl
je     116e <calculate_block_size_without_gaps_with_start_end_index+0x5e>
cmp    $0x2d,%bl
jne    1172 <calculate_block_size_without_gaps_with_start_end_index+0x62>
add    $0xffffffff,%r14d
cmp    %ebp,%edx
jg     1182 <calculate_block_size_without_gaps_with_start_end_index+0x72>
lea    0x1(%rcx),%rdx
cmp    %rax,%rcx
mov    %rdx,%rcx
jl     1150 <calculate_block_size_without_gaps_with_start_end_index+0x40>
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @calculate_block_size_without_gaps_with_start_end_index(i8* %0, i32* %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = alloca i8*
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store i8* %0, i8** %8
store i32* %1, i32** %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32 %5, i32* %13
store i32 %6, i32* %14
%17 = load i32, i32* %11
%18 = load i32, i32* %10
%19 = sub nsw i32 %17, %18
store i32 %19, i32* %16
%20 = load i32, i32* %10
%21 = load i32*, i32** %9
%22 = load i32, i32* %13
%23 = load i32, i32* %14
%24 = call i32 @find_starting_index(i32 %20, i32* %21, i32 %22, i32 %23)
store i32 %24, i32* %13
%25 = load i32, i32* %13
store i32 %25, i32* %15
br label %26
26: ; preds = %76, %7
%27 = load i32, i32* %15
%28 = load i32, i32* %12
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %79
30: ; preds = %26
%31 = load i32*, i32** %9
%32 = load i32, i32* %15
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i32, i32* %31, i64 %33
%35 = load i32, i32* %34
%36 = load i32, i32* %11
%37 = icmp slt i32 %35, %36
br i1 %37, label %38, label %66
38: ; preds = %30
%39 = load i32*, i32** %9
%40 = load i32, i32* %15
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i32, i32* %39, i64 %41
%43 = load i32, i32* %42
%44 = load i32, i32* %10
%45 = icmp sge i32 %43, %44
br i1 %45, label %46, label %66
46: ; preds = %38
%47 = load i8*, i8** %8
%48 = load i32, i32* %15
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i8, i8* %47, i64 %49
%51 = load i8, i8* %50
%52 = sext i8 %51 to i32
%53 = icmp eq i32 %52, 45
br i1 %53, label %62, label %54
54: ; preds = %46
%55 = load i8*, i8** %8
%56 = load i32, i32* %15
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds i8, i8* %55, i64 %57
%59 = load i8, i8* %58
%60 = sext i8 %59 to i32
%61 = icmp eq i32 %60, 78
br i1 %61, label %62, label %65
62: ; preds = %54, %46
%63 = load i32, i32* %16
%64 = add nsw i32 %63, -1
store i32 %64, i32* %16
br label %65
65: ; preds = %62, %54
br label %66
66: ; preds = %65, %38, %30
%67 = load i32*, i32** %9
%68 = load i32, i32* %15
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds i32, i32* %67, i64 %69
%71 = load i32, i32* %70
%72 = load i32, i32* %11
%73 = icmp sgt i32 %71, %72
br i1 %73, label %74, label %75
74: ; preds = %66
br label %79
75: ; preds = %66
br label %76
76: ; preds = %75
%77 = load i32, i32* %15
%78 = add nsw i32 %77, 1
store i32 %78, i32* %15
br label %26
79: ; preds = %74, %26
%80 = load i32, i32* %16
ret i32 %80
}

LLVM IR (-O2):
define i32 @calculate_block_size_without_gaps_with_start_end_index(i8* nocapture %0, i32* %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = sub nsw i32 %3, %2
%9 = tail call i32 @find_starting_index(i32 %2, i32* %1, i32 %5, i32 %6)
%10 = icmp slt i32 %9, %4
br i1 %10, label %11, label %33
11: ; preds = %7
%12 = sext i32 %9 to i64
%13 = sext i32 %4 to i64
br label %14
14: ; preds = %27, %11
%15 = phi i64 [ %30, %27 ], [ %12, %11 ]
%16 = phi i32 [ %28, %27 ], [ %8, %11 ]
%17 = getelementptr inbounds i32, i32* %1, i64 %15
%18 = load i32, i32* %17
%19 = icmp sge i32 %18, %3
%20 = icmp slt i32 %18, %2
%21 = or i1 %19, %20
br i1 %21, label %27, label %22
22: ; preds = %14
%23 = getelementptr inbounds i8, i8* %0, i64 %15
%24 = load i8, i8* %23
switch i8 %24, label %27 [
i8 45, label %25
i8 78, label %25
]
25: ; preds = %22, %22
%26 = add nsw i32 %16, -1
br label %27
27: ; preds = %22, %25, %14
%28 = phi i32 [ %26, %25 ], [ %16, %14 ], [ %16, %22 ]
%29 = icmp sle i32 %18, %3
%30 = add nsw i64 %15, 1
%31 = icmp slt i64 %30, %13
%32 = select i1 %29, i1 %31, i1 false
br i1 %32, label %14, label %33
33: ; preds = %27, %7
%34 = phi i32 [ %8, %7 ], [ %28, %27 ]
ret i32 %34
}