#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 /*<<< orphan*/, int);
int get_list_of_snp_indices_which_fall_in_downstream_recombinations(
    int **current_block_coordinates, int num_blocks, int *snp_locations,
    int number_of_snps, int *snps_in_recombinations) {
  int num_snps_in_recombinations = 0;
  int i = 0;
  for (i = 0; i < num_blocks; i++) {
    int current_index = 0;
    current_index = find_starting_index(current_block_coordinates[0][i],
                                        snp_locations, 0, number_of_snps);
    int beginning_j = current_index;
    for (beginning_j = current_index;
         snp_locations[beginning_j] < current_block_coordinates[0][i];
         beginning_j++) {
    }
    int j;
    for (j = beginning_j; (j < number_of_snps &&
                           snp_locations[j] <= current_block_coordinates[1][i]);
         j++) {
      snps_in_recombinations[num_snps_in_recombinations] = j;
      num_snps_in_recombinations++;
    }
  }
  return num_snps_in_recombinations;
}


x86 assembly (clang, -O0):
<get_list_of_snp_indices_which_fall_in_downstream_recombinations>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    122e <get_list_of_snp_indices_which_fall_in_downstream_recombinations+0x11e>
movl   $0x0,-0x34(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%ecx
xor    %edx,%edx
call   1030 <find_starting_index@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x8(%rbp),%rcx
mov    (%rcx),%rcx
movslq -0x30(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jge    11af <get_list_of_snp_indices_which_fall_in_downstream_recombinations+0x9f>
jmp    11a1 <get_list_of_snp_indices_which_fall_in_downstream_recombinations+0x91>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    117d <get_list_of_snp_indices_which_fall_in_downstream_recombinations+0x6d>
mov    -0x38(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%ecx
xor    %eax,%eax
cmp    -0x1c(%rbp),%ecx
mov    %al,-0x3d(%rbp)
jge    11e6 <get_list_of_snp_indices_which_fall_in_downstream_recombinations+0xd6>
mov    -0x18(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x8(%rbp),%rcx
mov    0x8(%rcx),%rcx
movslq -0x30(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
setle  %al
mov    %al,-0x3d(%rbp)
mov    -0x3d(%rbp),%al
test   $0x1,%al
jne    11f6 <get_list_of_snp_indices_which_fall_in_downstream_recombinations+0xe6>
jmp    121b <get_list_of_snp_indices_which_fall_in_downstream_recombinations+0x10b>
mov    -0x3c(%rbp),%edx
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11b5 <get_list_of_snp_indices_which_fall_in_downstream_recombinations+0xa5>
jmp    1220 <get_list_of_snp_indices_which_fall_in_downstream_recombinations+0x110>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    113f <get_list_of_snp_indices_which_fall_in_downstream_recombinations+0x2f>
mov    -0x2c(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_list_of_snp_indices_which_fall_in_downstream_recombinations>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8,0x8(%rsp)
test   %esi,%esi
jle    1216 <get_list_of_snp_indices_which_fall_in_downstream_recombinations+0x106>
mov    %ecx,%r12d
mov    %rdx,%r15
mov    %rdi,%r9
mov    %esi,%eax
mov    %rax,0x10(%rsp)
mov    (%rdi),%r8
xor    %r14d,%r14d
movabs $0x100000000,%r13
movl   $0x0,0x4(%rsp)
jmp    1173 <get_list_of_snp_indices_which_fall_in_downstream_recombinations+0x63>
cs nopw 0x0(%rax,%rax,1)
nop
add    %ecx,0x4(%rsp)
add    $0x1,%r14
cmp    0x10(%rsp),%r14
je     121e <get_list_of_snp_indices_which_fall_in_downstream_recombinations+0x10e>
mov    (%r8,%r14,4),%edi
mov    %r15,%rsi
xor    %edx,%edx
mov    %r12d,%ecx
mov    %r9,%rbx
call   1030 <find_starting_index@plt>
mov    %rbx,%r9
mov    (%rbx),%r8
mov    (%r8,%r14,4),%edi
movslq %eax,%rbp
lea    -0x1(%rbp),%esi
lea    (%r15,%rbp,4),%rcx
shl    $0x20,%rbp
movabs $0xffffffff00000000,%rdx
ff ff ff
add    %rdx,%rbp
nopl   0x0(%rax)
mov    %eax,%edx
add    %r13,%rbp
add    $0x1,%esi
lea    0x4(%rcx),%rbx
lea    0x1(%rdx),%eax
cmp    %edi,(%rcx)
mov    %rbx,%rcx
jl     11b0 <get_list_of_snp_indices_which_fall_in_downstream_recombinations+0xa0>
cmp    %r12d,%esi
jge    1164 <get_list_of_snp_indices_which_fall_in_downstream_recombinations+0x54>
mov    0x8(%r9),%rax
movslq 0x4(%rsp),%rcx
lea    (%rcx,%r12,1),%edi
sub    %esi,%edi
mov    0x8(%rsp),%rsi
lea    (%rsi,%rcx,4),%rsi
movslq %edx,%rcx
lea    (%r15,%rcx,4),%rbp
xor    %ecx,%ecx
nopl   0x0(%rax)
mov    0x0(%rbp,%rcx,4),%ebx
cmp    (%rax,%r14,4),%ebx
jg     1160 <get_list_of_snp_indices_which_fall_in_downstream_recombinations+0x50>
mov    %edx,(%rsi,%rcx,4)
add    $0x1,%rcx
add    $0x1,%edx
cmp    %edx,%r12d
jne    11f0 <get_list_of_snp_indices_which_fall_in_downstream_recombinations+0xe0>
mov    %edi,0x4(%rsp)
jmp    1164 <get_list_of_snp_indices_which_fall_in_downstream_recombinations+0x54>
movl   $0x0,0x4(%rsp)
mov    0x4(%rsp),%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @get_list_of_snp_indices_which_fall_in_downstream_recombinations(i32** nocapture %0, i32 %1, i32* %2, i32 %3, i32* nocapture writeonly %4) {
%6 = icmp sgt i32 %1, 0
br i1 %6, label %7, label %59
7: ; preds = %5
%8 = getelementptr inbounds i32*, i32** %0, i64 1
%9 = zext i32 %1 to i64
%10 = load i32*, i32** %0
br label %11
11: ; preds = %7, %55
%12 = phi i32* [ %10, %7 ], [ %18, %55 ]
%13 = phi i64 [ 0, %7 ], [ %57, %55 ]
%14 = phi i32 [ 0, %7 ], [ %56, %55 ]
%15 = getelementptr inbounds i32, i32* %12, i64 %13
%16 = load i32, i32* %15
%17 = tail call i32 @find_starting_index(i32 %16, i32* %2, i32 0, i32 %3)
%18 = load i32*, i32** %0
%19 = getelementptr inbounds i32, i32* %18, i64 %13
%20 = load i32, i32* %19
%21 = sext i32 %17 to i64
br label %22
22: ; preds = %22, %11
%23 = phi i64 [ %27, %22 ], [ %21, %11 ]
%24 = getelementptr inbounds i32, i32* %2, i64 %23
%25 = load i32, i32* %24
%26 = icmp slt i32 %25, %20
%27 = add i64 %23, 1
br i1 %26, label %22, label %28
28: ; preds = %22
%29 = trunc i64 %23 to i32
%30 = icmp slt i32 %29, %3
br i1 %30, label %31, label %55
31: ; preds = %28
%32 = load i32*, i32** %8
%33 = getelementptr inbounds i32, i32* %32, i64 %13
%34 = shl i64 %23, 32
%35 = ashr exact i64 %34, 32
%36 = sext i32 %14 to i64
%37 = add i32 %14, %3
%38 = sub i32 %37, %29
br label %39
39: ; preds = %31, %46
%40 = phi i64 [ %36, %31 ], [ %49, %46 ]
%41 = phi i64 [ %35, %31 ], [ %50, %46 ]
%42 = getelementptr inbounds i32, i32* %2, i64 %41
%43 = load i32, i32* %42
%44 = load i32, i32* %33
%45 = icmp sgt i32 %43, %44
br i1 %45, label %53, label %46
46: ; preds = %39
%47 = getelementptr inbounds i32, i32* %4, i64 %40
%48 = trunc i64 %41 to i32
store i32 %48, i32* %47
%49 = add nsw i64 %40, 1
%50 = add nsw i64 %41, 1
%51 = trunc i64 %50 to i32
%52 = icmp eq i32 %51, %3
br i1 %52, label %55, label %39
53: ; preds = %39
%54 = trunc i64 %40 to i32
br label %55
55: ; preds = %46, %53, %28
%56 = phi i32 [ %14, %28 ], [ %54, %53 ], [ %38, %46 ]
%57 = add nuw nsw i64 %13, 1
%58 = icmp eq i64 %57, %9
br i1 %58, label %59, label %11
59: ; preds = %55, %5
%60 = phi i32 [ 0, %5 ], [ %56, %55 ]
ret i32 %60
}