#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 */
scalar_t__ does_column_contain_snps(int, char);
int /*<<< orphan*/ remove_filtered_snp_locations(int *, int *, int);
int refilter_existing_snps(char *reference_bases, int number_of_snps,
                           int *snp_locations, int *filtered_snp_locations,
                           int internal_nodes[]) {
  int i;
  int number_of_filtered_snps = number_of_snps;
  for (i = 0; i < number_of_snps; i++) {
    if (does_column_contain_snps(i, reference_bases[i]) == 0) {
      snp_locations[i] = -1;
      reference_bases[i] = '*';
      number_of_filtered_snps--;
    }
  }
  remove_filtered_snp_locations(filtered_snp_locations, snp_locations,
                                number_of_snps);
  return number_of_filtered_snps;
}


x86 assembly (clang, -O0):
<refilter_existing_snps>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x30(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11a9 <refilter_existing_snps+0x89>
mov    -0x2c(%rbp),%edi
mov    -0x8(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
call   1040 <does_column_contain_snps@plt>
cmp    $0x0,%rax
jne    1196 <refilter_existing_snps+0x76>
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movl   $0xffffffff,(%rax,%rcx,4)
mov    -0x8(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movb   $0x2a,(%rax,%rcx,1)
mov    -0x30(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x30(%rbp)
jmp    119b <refilter_existing_snps+0x7b>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1148 <refilter_existing_snps+0x28>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <remove_filtered_snp_locations@plt>
mov    -0x30(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<refilter_existing_snps>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,(%rsp)
mov    %rdx,%r12
mov    %esi,%r15d
mov    %esi,%r13d
test   %esi,%esi
jle    117d <refilter_existing_snps+0x5d>
mov    %rdi,%rbp
mov    %r15d,%r14d
xor    %ebx,%ebx
mov    %r15d,%r13d
jmp    1159 <refilter_existing_snps+0x39>
nopl   0x0(%rax)
add    $0x1,%rbx
cmp    %rbx,%r14
je     117d <refilter_existing_snps+0x5d>
movsbl 0x0(%rbp,%rbx,1),%esi
mov    %ebx,%edi
call   1040 <does_column_contain_snps@plt>
test   %rax,%rax
jne    1150 <refilter_existing_snps+0x30>
movl   $0xffffffff,(%r12,%rbx,4)
ff
movb   $0x2a,0x0(%rbp,%rbx,1)
add    $0xffffffff,%r13d
jmp    1150 <refilter_existing_snps+0x30>
mov    (%rsp),%rdi
mov    %r12,%rsi
mov    %r15d,%edx
call   1030 <remove_filtered_snp_locations@plt>
mov    %r13d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @refilter_existing_snps(i8* %0, i32 %1, i32* %2, i32* %3, i32* %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i32
store i8* %0, i8** %6
store i32 %1, i32* %7
store i32* %2, i32** %8
store i32* %3, i32** %9
store i32* %4, i32** %10
%13 = load i32, i32* %7
store i32 %13, i32* %12
store i32 0, i32* %11
br label %14
14: ; preds = %39, %5
%15 = load i32, i32* %11
%16 = load i32, i32* %7
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %42
18: ; preds = %14
%19 = load i32, i32* %11
%20 = load i8*, i8** %6
%21 = load i32, i32* %11
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %20, i64 %22
%24 = load i8, i8* %23
%25 = call i64 @does_column_contain_snps(i32 %19, i8 signext %24)
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %38
27: ; preds = %18
%28 = load i32*, i32** %8
%29 = load i32, i32* %11
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i32, i32* %28, i64 %30
store i32 -1, i32* %31
%32 = load i8*, i8** %6
%33 = load i32, i32* %11
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %32, i64 %34
store i8 42, i8* %35
%36 = load i32, i32* %12
%37 = add nsw i32 %36, -1
store i32 %37, i32* %12
br label %38
38: ; preds = %27, %18
br label %39
39: ; preds = %38
%40 = load i32, i32* %11
%41 = add nsw i32 %40, 1
store i32 %41, i32* %11
br label %14
42: ; preds = %14
%43 = load i32*, i32** %9
%44 = load i32*, i32** %8
%45 = load i32, i32* %7
%46 = call i32 @remove_filtered_snp_locations(i32* %43, i32* %44, i32 %45)
%47 = load i32, i32* %12
ret i32 %47
}

LLVM IR (-O2):
define i32 @refilter_existing_snps(i8* nocapture %0, i32 %1, i32* %2, i32* %3, i32* nocapture readnone %4) {
%6 = icmp sgt i32 %1, 0
br i1 %6, label %7, label %24
7: ; preds = %5
%8 = zext i32 %1 to i64
br label %9
9: ; preds = %7, %20
%10 = phi i64 [ 0, %7 ], [ %22, %20 ]
%11 = phi i32 [ %1, %7 ], [ %21, %20 ]
%12 = getelementptr inbounds i8, i8* %0, i64 %10
%13 = load i8, i8* %12
%14 = trunc i64 %10 to i32
%15 = tail call i64 @does_column_contain_snps(i32 %14, i8 signext %13)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %9
%18 = getelementptr inbounds i32, i32* %2, i64 %10
store i32 -1, i32* %18
store i8 42, i8* %12
%19 = add nsw i32 %11, -1
br label %20
20: ; preds = %9, %17
%21 = phi i32 [ %19, %17 ], [ %11, %9 ]
%22 = add nuw nsw i64 %10, 1
%23 = icmp eq i64 %22, %8
br i1 %23, label %24, label %9
24: ; preds = %20, %5
%25 = phi i32 [ %1, %5 ], [ %21, %20 ]
%26 = tail call i32 @remove_filtered_snp_locations(i32* %3, i32* %2, i32 %1)
ret i32 %25
}