#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 find_number_of_snps_in_block_with_start_end_index(
    int window_start_coordinate, int window_end_coordinate, int *snp_locations,
    char *child_sequence, int number_of_snps, int start_index, int end_index) {
  if (number_of_snps == 0) {
    return number_of_snps;
  }
  int i;
  int number_of_snps_in_block = 0;
  start_index = find_starting_index(window_start_coordinate, snp_locations,
                                    start_index, end_index);
  for (i = start_index; i < number_of_snps; i++) {
    if (snp_locations[i] >= window_start_coordinate &&
        snp_locations[i] < window_end_coordinate) {
      if (child_sequence[i] != '-' || child_sequence[i] != 'N') {
        number_of_snps_in_block++;
      }
    }
    if (snp_locations[i] > window_end_coordinate) {
      break;
    }
  }
  return number_of_snps_in_block;
}


x86 assembly (clang, -O0):
<find_number_of_snps_in_block_with_start_end_index>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x10(%rbp),%eax
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9d,-0x28(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    1146 <find_number_of_snps_in_block_with_start_end_index+0x36>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1206 <find_number_of_snps_in_block_with_start_end_index+0xf6>
movl   $0x0,-0x30(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x28(%rbp),%edx
mov    0x10(%rbp),%ecx
call   1030 <find_starting_index@plt>
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1200 <find_number_of_snps_in_block_with_start_end_index+0xf0>
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x8(%rbp),%eax
jl     11d4 <find_number_of_snps_in_block_with_start_end_index+0xc4>
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0xc(%rbp),%eax
jge    11d4 <find_number_of_snps_in_block_with_start_end_index+0xc4>
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2d,%eax
jne    11c6 <find_number_of_snps_in_block_with_start_end_index+0xb6>
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x4e,%eax
je     11cf <find_number_of_snps_in_block_with_start_end_index+0xbf>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11d4 <find_number_of_snps_in_block_with_start_end_index+0xc4>
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0xc(%rbp),%eax
jle    11ed <find_number_of_snps_in_block_with_start_end_index+0xdd>
jmp    1200 <find_number_of_snps_in_block_with_start_end_index+0xf0>
jmp    11f2 <find_number_of_snps_in_block_with_start_end_index+0xe2>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1168 <find_number_of_snps_in_block_with_start_end_index+0x58>
mov    -0x30(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_number_of_snps_in_block_with_start_end_index>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
xor    %ebx,%ebx
test   %r8d,%r8d
je     1179 <find_number_of_snps_in_block_with_start_end_index+0x69>
mov    %r8d,%r12d
mov    %rdx,%r14
mov    %esi,%ebp
mov    %edi,%r15d
mov    0x30(%rsp),%ecx
mov    %rdx,%rsi
mov    %r9d,%edx
call   1030 <find_starting_index@plt>
cmp    %r12d,%eax
jge    1179 <find_number_of_snps_in_block_with_start_end_index+0x69>
movslq %eax,%rcx
movslq %r12d,%rdi
add    $0x1,%rcx
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    %ebx,%edx
mov    -0x4(%r14,%rcx,4),%esi
cmp    %r15d,%esi
setge  %bl
cmp    %ebp,%esi
setl   %al
and    %bl,%al
movzbl %al,%ebx
add    %edx,%ebx
cmp    %ebp,%esi
jg     1179 <find_number_of_snps_in_block_with_start_end_index+0x69>
lea    0x1(%rcx),%rax
cmp    %rdi,%rcx
mov    %rax,%rcx
jl     1150 <find_number_of_snps_in_block_with_start_end_index+0x40>
mov    %ebx,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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