// File: /workspace/github_c_makefile_star2_O0/sc932[P]ALE/src/ALEhelpers.c
// Function: assemblySanityCheck
int assemblySanityCheck(assemblyT *theAssembly){
    int i, j, num = theAssembly->numContigs;
    int error = 1;
    int countAmbiguous = 0;
    for(j=0; j < num ; j++){
        contig_t *contig = theAssembly->contigs[j];
        for(i = 0; i < contig->seqLen; i++){
            if(contig->seq[i] != 'A' && contig->seq[i] != 'T' && contig->seq[i] != 'C' && contig->seq[i] != 'G' && contig->seq[i] != 'N'){
                //printf("Found an ambiguous base in the assembly, contig %d, position %d = %c\n", j, i, contig->seq[i]);
                //contig->seq[i] = 'N';
                error = 0;
                countAmbiguous++;
                int c = contig->ambiguousBaseCount;
                contig->ambiguousBasePositions = (int32_t*) realloc(contig->ambiguousBasePositions, sizeof(*contig->ambiguousBasePositions) * kroundup32(c));
                contig->ambiguousBasePositions[ contig->ambiguousBaseCount++ ] = i;
            }
        }
    }
    if(error == 0){
      printf("Found %d ambiguous bases (excluding N) in the assembly.\n", countAmbiguous);
    }
    return error;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x14(%rbp)
movl $0x1, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0xe827
movq -0x8(%rbp), %rax
movq 0xa0(%rax), %rax
movslq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x28(%rbp)
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
movq -0x28(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0xe817
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0xc(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x41, %eax
je 0xe807
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0xc(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x54, %eax
je 0xe807
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0xc(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x43, %eax
je 0xe807
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0xc(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x47, %eax
je 0xe807
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0xc(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x4e, %eax
je 0xe807
movl $0x0, -0x18(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movq -0x28(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, -0x2c(%rbp)
movq -0x28(%rbp), %rax
movq 0x28(%rax), %rdi
movl -0x2c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
sarl %eax
orl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
sarl $0x2, %eax
orl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
sarl $0x4, %eax
orl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
sarl $0x8, %eax
orl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
sarl $0x10, %eax
orl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
movslq %eax, %rsi
shlq $0x2, %rsi
callq 0x3470
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x28(%rax)
movl -0xc(%rbp), %edx
movq -0x28(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x28(%rbp), %rsi
movl 0x20(%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, 0x20(%rsi)
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
jmp 0xe809
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0xe6d4
jmp 0xe819
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0xe6aa
cmpl $0x0, -0x18(%rbp)
jne 0xe83e
movl -0x1c(%rbp), %esi
leaq 0x233d5(%rip), %rdi     # 0x31c0c
movb $0x0, %al
callq 0x3200
movl -0x18(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)