// File: /workspace/github_c_makefile_star2_O0/jsh58[P]Genrich/Genrich.c
// Function: subsamplePair
void subsamplePair(Aln* aln, int alnLen, uint8_t* count,
    float* score) {

  // insertion sort of aln scores
  float arr[*count];  // sorted array of aln scores
  int k = 0;          // count of valid alns analyzed
  for (int i = 0; i < alnLen; i++) {
    Aln* a = aln + i;
    if (a->paired && a->full && a->score >= *score
        && a->chrom->save && ! a->chrom->skip) {

      // insert a->score into array
      int j;
      for (j = 0; j < k; j++)
        if (a->score > arr[j])
          break;
      for (int m = k; m > j; m--)
        arr[m] = arr[m - 1];
      arr[j] = a->score;
      k++;

    }
  }

  *count = *count > 10 ? 10 : *count - 1; // update count of alns to keep
  *score = arr[*count - 1];               // save new min. score
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x18(%rbp), %rax
movzbl (%rax), %edx
movl %edx, %eax
movq %rsp, %rcx
movq %rcx, -0x28(%rbp)
movl %edx, %ecx
leal 0xf(,%rcx,4), %ecx
andl $-0x10, %ecx
movl %ecx, %edx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x50(%rbp)
movq %rcx, %rsp
movq %rax, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0xde91
movq -0x8(%rbp), %rax
movslq -0x38(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
testb $0x1, 0xd(%rax)
je 0xde81
movq -0x40(%rbp), %rax
testb $0x1, 0xe(%rax)
je 0xde81
movq -0x40(%rbp), %rax
movss 0x8(%rax), %xmm0
movq -0x20(%rbp), %rax
ucomiss (%rax), %xmm0
jb 0xde81
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rax
testb $0x1, 0xd(%rax)
je 0xde81
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rax
testb $0x1, 0xc(%rax)
jne 0xde81
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0xde2e
movq -0x50(%rbp), %rax
movq -0x40(%rbp), %rcx
movss 0x8(%rcx), %xmm0
movslq -0x44(%rbp), %rcx
ucomiss (%rax,%rcx,4), %xmm0
jbe 0xde21
jmp 0xde2e
jmp 0xde23
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0xde00
movl -0x34(%rbp), %eax
movl %eax, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpl -0x44(%rbp), %eax
jle 0xde62
movq -0x50(%rbp), %rax
movl -0x48(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movss (%rax,%rcx,4), %xmm0
movslq -0x48(%rbp), %rcx
movss %xmm0, (%rax,%rcx,4)
movl -0x48(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0xde34
movq -0x50(%rbp), %rax
movq -0x40(%rbp), %rcx
movss 0x8(%rcx), %xmm0
movslq -0x44(%rbp), %rcx
movss %xmm0, (%rax,%rcx,4)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xde83
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0xdd84
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0xa, %eax
jle 0xdea7
movl $0xa, %eax
movl %eax, -0x54(%rbp)
jmp 0xdeb4
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
subl $0x1, %eax
movl %eax, -0x54(%rbp)
movq -0x50(%rbp), %rax
movl -0x54(%rbp), %ecx
movb %cl, %dl
movq -0x18(%rbp), %rcx
movb %dl, (%rcx)
movq -0x18(%rbp), %rcx
movzbl (%rcx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movss (%rax,%rcx,4), %xmm0
movq -0x20(%rbp), %rax
movss %xmm0, (%rax)
movq -0x28(%rbp), %rax
movq %rax, %rsp
movq %rbp, %rsp
popq %rbp
retq
nopl (%rax)