// File: /workspace/github_c_makefile_star2_O2/zpole[P]IICV/vl/aib.c
// Function: vl_aib_process
VL_EXPORT
void vl_aib_process(VlAIB *aib)
{
    vl_uint i, besti, bestj, newnode, nodei, nodej;
    double I, H;
    double minbeta;

    /* Calculate initial value of cost function */
    vl_aib_calculate_information (aib, &I, &H) ;
    aib->costs[0] = I;

    /* Initially which = all */

    /* For each merge */
    for(i = 0 ; i < aib->nvalues - 1 ; i++) {

      /* update entries in aib-> which */
      vl_aib_update_beta(aib);

      /* find best pair of nodes to merge */
      vl_aib_min_beta (aib, &besti, &bestj, &minbeta);

      if(minbeta == BETA_MAX)
        /* only null-probability entries remain */
        break;

      /* Add the parent pointers for the new node */
      newnode = aib->nvalues + i ;
      nodei = aib->nodes[besti];
      nodej = aib->nodes[bestj];

      aib->parents [nodei] = newnode ;
      aib->parents [nodej] = newnode ;
      aib->parents [newnode] = 0 ;

      /* Merge the nodes which produced the minimum beta */
      vl_aib_merge_nodes (aib, besti, bestj, newnode) ;
      vl_aib_calculate_information (aib, &I, &H) ;

      aib->costs[i+1] = I;

      if (aib->verbosity > 0) {
        VL_PRINTF ("aib: (%5d,%5d)=%5d dE: %10.3g I: %6.4g H: %6.4g updt: %5d\n",
                   nodei,
                   nodej,
                   newnode,
                   minbeta,
                   I,
                   H,
                   aib->nwhich) ;
      }
    }

    /* fill ignored entries with NaNs */
    for(; i < aib->nvalues - 1 ; i++)
        aib->costs[i+1] = VL_NAN_D ;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
leaq 0x18(%rsp), %r14
leaq 0x10(%rsp), %rdx
movq %r14, %rsi
callq 0xa09c
movsd (%r14), %xmm0
movq 0x58(%rbx), %rax
movsd %xmm0, (%rax)
xorl %r13d, %r13d
leaq 0x30(%rsp), %rbp
movl 0x48(%rbx), %r15d
decl %r15d
cmpq %r15, %r13
jae 0xa423
movq %rbx, %rdi
callq 0x9ec3
movq %rbx, %rdi
leaq 0xc(%rsp), %rsi
leaq 0x8(%rsp), %rdx
movq %rbp, %rcx
callq 0x9d2a
movsd 0x30(%rsp), %xmm0
ucomisd 0x22c98(%rip), %xmm0    # 0x2d008
movl 0x48(%rbx), %r15d
jne 0xa37c
jnp 0xa420
movsd %xmm0, 0x28(%rsp)
addq %r13, %r15
movl 0xc(%rsp), %esi
movq (%rbx), %rax
movq 0x50(%rbx), %rcx
movl (%rax,%rsi,4), %r14d
movl 0x8(%rsp), %edx
movl (%rax,%rdx,4), %r12d
movl %r15d, (%rcx,%r14,4)
movl %r15d, (%rcx,%r12,4)
movl %r15d, %eax
andl $0x0, (%rcx,%rax,4)
movq %rbx, %rdi
movl %r15d, %ecx
callq 0x9d73
movq %rbx, %rdi
leaq 0x18(%rsp), %rsi
leaq 0x10(%rsp), %rdx
callq 0xa09c
movsd 0x18(%rsp), %xmm0
movq 0x58(%rbx), %rax
movsd %xmm0, 0x8(%rax,%r13,8)
cmpl $0x0, 0x60(%rbx)
je 0xa418
movsd %xmm0, 0x20(%rsp)
callq 0x9180
movq %rax, %r9
movsd 0x10(%rsp), %xmm2
movl 0x28(%rbx), %r8d
leaq 0x22c12(%rip), %rdi     # 0x2d010
movl %r14d, %esi
movl %r12d, %edx
movl %r15d, %ecx
movsd 0x28(%rsp), %xmm0
movsd 0x20(%rsp), %xmm1
movb $0x3, %al
callq *%r9
incq %r13
jmp 0xa335
decl %r15d
movl %r15d, %eax
cmpq %rax, %r13
cmovaq %r13, %rax
movabsq $0x7ff8000000000000, %rcx # imm = 0x7FF8000000000000
cmpq %r13, %rax
je 0xa44a
movq 0x58(%rbx), %rdx
movq %rcx, 0x8(%rdx,%r13,8)
incq %r13
jmp 0xa437
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)