// File: chhylp123[P]hifiasm/tovlp.cpp
// Function: chain_trans_d(utg_trans_t*, unsigned int*, unsigned int, unsigned int, unsigned long*, unsigned int*, unsigned int, unsigned int, unsigned long*, ma_ug_t*, unsigned int, double, char const*)
void chain_trans_d(utg_trans_t *o, 
uint32_t *pri_a, uint32_t pri_n, uint32_t pri_beg, uint64_t *i_pri_len, 
uint32_t *aux_a, uint32_t aux_n, uint32_t aux_beg, uint64_t *i_aux_len,
ma_ug_t *ug, uint32_t flag, double score, const char* cmd)
{
    uint32_t i, len, bn;
    uint64_t pri_len, aux_len;
    kvec_asg_arc_t_offset* u_buffer = &(o->u_buffer);
    kvec_t_i32_warp* tailIndex = &(o->tailIndex);
    asg_arc_t_offset *tt = NULL;
    ca_buf_t *tx = NULL;

    if(i_pri_len) pri_len = (*i_pri_len);
    else pri_len = get_utg_chain_length(ug, pri_a, pri_n);
    
    if(i_aux_len) aux_len = (*i_aux_len);
    else aux_len = get_utg_chain_length(ug, aux_a, aux_n);
        
    tt = NULL; o->c_buf.n = 0; o->k_t_b.n = 0;
    if(tailIndex->a.n > 0) tt = &(u_buffer->a.a[tailIndex->a.a[0]]);
    if(!tt || (pri_beg < (tt->Off>>32) && aux_beg < ((uint32_t)tt->Off)))
    {
        kv_pushp(ca_buf_t, o->c_buf, &tx);
        tx->c_x_p = pri_beg; 
        tx->c_y_p = aux_beg;

        for (i = 0; i < tailIndex->a.n; i++)
        {
            tt = &(u_buffer->a.a[tailIndex->a.a[i]]);
            kv_pushp(ca_buf_t, o->c_buf, &tx);

            tx->c_x_p = tt->Off>>32;
            tx->c_y_p = (uint32_t)tt->Off;
        }
    }
    else if(tailIndex->a.n == 1)//1 ele in chain
    {
        kv_pushp(ca_buf_t, o->c_buf, &tx);
        tx->c_x_p = pri_beg; tx->c_y_p = aux_beg;
    }
    else if(tailIndex->a.n > 0)
    {
        uint32_t cx, cy, ax, ay, found = 0;
        for (i = 0; i < tailIndex->a.n; i++)
        {
            cx = cy = ax = ay = (uint32_t)-1;

            cx = u_buffer->a.a[tailIndex->a.a[i]].Off>>32;
            cy = (uint32_t)u_buffer->a.a[tailIndex->a.a[i]].Off;
            if((i + 1) < tailIndex->a.n)
            {
                ax = u_buffer->a.a[tailIndex->a.a[i+1]].Off>>32;
                ay = (uint32_t)u_buffer->a.a[tailIndex->a.a[i+1]].Off;
            }

            kv_pushp(ca_buf_t, o->c_buf, &tx);
            tx->c_x_p = cx; tx->c_y_p = cy;

            if(found) continue;
            if(pri_beg > cx && pri_beg < ax && aux_beg > cy && aux_beg < ay)
            {
                kv_pushp(ca_buf_t, o->c_buf, &tx);
                tx->c_x_p = pri_beg; tx->c_y_p = aux_beg;
                found = 1;
            } 
        }
    }

    
    // fprintf(stderr, "\ncmd-%s\n", cmd);
    // fprintf(stderr, "pri_beg=%u, pri_len=%lu\n", pri_beg, pri_len);
    // fprintf(stderr, "aux_beg=%u, aux_len=%lu\n", aux_beg, aux_len);

    // print_buf_t(ug, pri, "pri");
    // print_buf_t(ug, aux, "aux");


    tx = &(o->c_buf.a[o->c_buf.n-1]);
    len = MIN(pri_len - tx->c_x_p, aux_len - tx->c_y_p);
    if(len > 0)///insert boundary
    {
        kv_pushp(ca_buf_t, o->c_buf, &tx);
        tx->c_x_p = o->c_buf.a[o->c_buf.n-2].c_x_p + len;
        tx->c_y_p = o->c_buf.a[o->c_buf.n-2].c_y_p + len;     
    }

    tx = &(o->c_buf.a[0]);///insert boundary
    if(tx->c_x_p != 0 && tx->c_y_p != 0)///already at boundary
    {
        len = MIN(tx->c_x_p, tx->c_y_p);///offset
        kv_pushp(ca_buf_t, o->c_buf, &tx);
        for (i = 0; (i + 1)< o->c_buf.n; i++)
        {
            o->c_buf.a[o->c_buf.n - i - 1] = o->c_buf.a[o->c_buf.n - i - 2];
        }
        o->c_buf.a[0].c_x_p = o->c_buf.a[1].c_x_p - len;
        o->c_buf.a[0].c_y_p = o->c_buf.a[1].c_y_p - len;
    }

    ///chain is [s, e)
    if(o->c_buf.a[0].c_x_p != 0 && o->c_buf.a[0].c_y_p != 0) fprintf(stderr, "ERROR1\n");
    if(o->c_buf.a[o->c_buf.n-1].c_x_p!= pri_len && 
                                            o->c_buf.a[o->c_buf.n-1].c_y_p!= aux_len)
    {
        fprintf(stderr, "ERROR2\n");
    }

    utg_trans_hit_idx iter;
    utg_thit_t hit, *kh = NULL;
    ////////prx
    reset_utg_trans_hit_idx(&iter, pri_a, pri_n, ug, o, o->c_buf.a[0].c_x_p, o->c_buf.a[o->c_buf.n-1].c_x_p);    
    while(get_utg_trans_hit(&iter, &hit))//get [qs, qe), [qus, que)
    {
        refine_utg_thit_t(&hit, &(o->c_buf)); ///get [ts, te)
        kv_push(utg_thit_t, o->k_t_b, hit);
    }
    bn = o->k_t_b.n;
    
    ////////aux
    reset_utg_trans_hit_idx(&iter, aux_a, aux_n, ug, o, o->c_buf.a[0].c_y_p, o->c_buf.a[o->c_buf.n-1].c_y_p);    
    while(get_utg_trans_hit(&iter, &hit))
    {
        extract_sub_overlaps_utg_thit(hit.qs, hit.qe, hit.qus, hit.que, hit.qn, &(o->k_t_b), bn);
    }

    if(o->k_t_b.n - bn == 0) fprintf(stderr, "ERROR7\n");
    
    // fprintf(stderr, "\n******o->k_t_b.n: %u, bn: %u\n", (uint32_t)o->k_t_b.n, bn);
    // for (i = 0; i < pri_n; i++)
    // {
    //     fprintf(stderr, "p-utg%.6ul\n", (pri_a[i]>>1) + 1);
    // }
    // for (i = 0; i < aux_n; i++)
    // {
    //     fprintf(stderr, "a-utg%.6ul\n", (aux_a[i]>>1) + 1);
    // }

    u_trans_t *kt = NULL;
    double x_score, y_score;
    for (i = bn; i < o->k_t_b.n; i++)
    {
        kh = &(o->k_t_b.a[i]);
        if(kh->que <= kh->qus) continue;
        if(kh->tue <= kh->tus) continue;
        kv_pushp(u_trans_t, o->k_trans, &kt);
        kt->f = flag; kt->rev = ((kh->qn ^ kh->tn) & 1); kt->del = 0; 
        kt->qn = kh->qn>>1; kt->qs = kh->qus; kt->qe = kh->que; ///kt->qo = kh->qn&1;
        kt->tn = kh->tn>>1; kt->ts = kh->tus; kt->te = kh->tue; ///kt->to = kh->tn&1;
        if(score < 0)
        {
            kt->nw = (MIN((kt->qe - kt->qs), (kt->te - kt->ts)))*CHAIN_MATCH;
        } 
        else
        {
            x_score = ((double)(kt->qe-kt->qs)/(double)(o->c_buf.a[o->c_buf.n-1].c_x_p-o->c_buf.a[0].c_x_p))*score;
            y_score = ((double)(kt->te-kt->ts)/(double)(o->c_buf.a[o->c_buf.n-1].c_y_p-o->c_buf.a[0].c_y_p))*score;
            kt->nw = MIN(x_score, y_score);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x170, %rsp            # imm = 0x170
movq 0x38(%rbp), %rax
movl 0x30(%rbp), %eax
movq 0x28(%rbp), %rax
movq 0x20(%rbp), %rax
movl 0x18(%rbp), %eax
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movq %r8, -0x20(%rbp)
movq %r9, -0x28(%rbp)
movsd %xmm0, -0x30(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rax
movq %rax, -0x60(%rbp)
movq $0x0, -0x68(%rbp)
movq $0x0, -0x70(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x26f9e7
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x48(%rbp)
jmp 0x26f9fb
movq 0x28(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
callq 0x26eb00
movq %rax, -0x48(%rbp)
cmpq $0x0, 0x20(%rbp)
je 0x26fa0f
movq 0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x50(%rbp)
jmp 0x26fa23
movq 0x28(%rbp), %rdi
movq -0x28(%rbp), %rsi
movl 0x10(%rbp), %edx
callq 0x26eb00
movq %rax, -0x50(%rbp)
movq $0x0, -0x68(%rbp)
movq -0x8(%rbp), %rax
movq $0x0, 0x98(%rax)
movq -0x8(%rbp), %rax
movq $0x0, 0x80(%rax)
movq -0x60(%rbp), %rax
cmpq $0x0, (%rax)
jbe 0x26fa71
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x60(%rbp), %rcx
movq 0x10(%rcx), %rcx
movslq (%rcx), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x68(%rbp)
cmpq $0x0, -0x68(%rbp)
je 0x26faa3
movl -0x18(%rbp), %eax
movq -0x68(%rbp), %rcx
movq 0x18(%rcx), %rcx
shrq $0x20, %rcx
cmpq %rcx, %rax
jae 0x26fc97
movl 0x18(%rbp), %eax
movq -0x68(%rbp), %rcx
movq 0x18(%rcx), %rcx
cmpl %ecx, %eax
jae 0x26fc97
jmp 0x26faa5
movq -0x8(%rbp), %rax
movq 0x98(%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0xa0(%rcx), %rax
jne 0x26fb2c
movq -0x8(%rbp), %rax
cmpq $0x0, 0xa0(%rax)
je 0x26fae2
movq -0x8(%rbp), %rax
movq 0xa0(%rax), %rax
shlq %rax
movq %rax, -0x108(%rbp)
jmp 0x26faf0
movl $0x2, %eax
movq %rax, -0x108(%rbp)
jmp 0x26faf0
movq -0x108(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xa0(%rax)
movq -0x8(%rbp), %rax
movq 0xa8(%rax), %rdi
movq -0x8(%rbp), %rax
imulq $0x1c, 0xa0(%rax), %rsi
callq 0x2360
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xa8(%rax)
movq -0x8(%rbp), %rax
movq 0xa8(%rax), %rax
movq -0x8(%rbp), %rdx
movq 0x98(%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, 0x98(%rdx)
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x70(%rbp)
movl -0x18(%rbp), %ecx
movq -0x70(%rbp), %rax
movl %ecx, 0x10(%rax)
movl 0x18(%rbp), %ecx
movq -0x70(%rbp), %rax
movl %ecx, 0x14(%rax)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x60(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x26fc92
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x60(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x34(%rbp), %edx
movslq (%rcx,%rdx,4), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x68(%rbp)
movq -0x8(%rbp), %rax
movq 0x98(%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0xa0(%rcx), %rax
jne 0x26fc2f
movq -0x8(%rbp), %rax
cmpq $0x0, 0xa0(%rax)
je 0x26fbe5
movq -0x8(%rbp), %rax
movq 0xa0(%rax), %rax
shlq %rax
movq %rax, -0x110(%rbp)
jmp 0x26fbf3
movl $0x2, %eax
movq %rax, -0x110(%rbp)
jmp 0x26fbf3
movq -0x110(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xa0(%rax)
movq -0x8(%rbp), %rax
movq 0xa8(%rax), %rdi
movq -0x8(%rbp), %rax
imulq $0x1c, 0xa0(%rax), %rsi
callq 0x2360
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xa8(%rax)
movq -0x8(%rbp), %rax
movq 0xa8(%rax), %rax
movq -0x8(%rbp), %rdx
movq 0x98(%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, 0x98(%rdx)
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x70(%rbp)
movq -0x68(%rbp), %rax
movq 0x18(%rax), %rax
shrq $0x20, %rax
movl %eax, %ecx
movq -0x70(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x68(%rbp), %rax
movq 0x18(%rax), %rax
movl %eax, %ecx
movq -0x70(%rbp), %rax
movl %ecx, 0x14(%rax)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x26fb76
jmp 0x27006e
movq -0x60(%rbp), %rax
cmpq $0x1, (%rax)
jne 0x26fd76
jmp 0x26fca7
movq -0x8(%rbp), %rax
movq 0x98(%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0xa0(%rcx), %rax
jne 0x26fd2e
movq -0x8(%rbp), %rax
cmpq $0x0, 0xa0(%rax)
je 0x26fce4
movq -0x8(%rbp), %rax
movq 0xa0(%rax), %rax
shlq %rax
movq %rax, -0x118(%rbp)
jmp 0x26fcf2
movl $0x2, %eax
movq %rax, -0x118(%rbp)
jmp 0x26fcf2
movq -0x118(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xa0(%rax)
movq -0x8(%rbp), %rax
movq 0xa8(%rax), %rdi
movq -0x8(%rbp), %rax
imulq $0x1c, 0xa0(%rax), %rsi
callq 0x2360
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xa8(%rax)
movq -0x8(%rbp), %rax
movq 0xa8(%rax), %rax
movq -0x8(%rbp), %rdx
movq 0x98(%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, 0x98(%rdx)
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x70(%rbp)
movl -0x18(%rbp), %ecx
movq -0x70(%rbp), %rax
movl %ecx, 0x10(%rax)
movl 0x18(%rbp), %ecx
movq -0x70(%rbp), %rax
movl %ecx, 0x14(%rax)
jmp 0x27006c
movq -0x60(%rbp), %rax
cmpq $0x0, (%rax)
jbe 0x27006a
movl $0x0, -0x84(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x60(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x270068
movl $0xffffffff, -0x80(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x7c(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x78(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x74(%rbp) # imm = 0xFFFFFFFF
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x60(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x34(%rbp), %edx
movslq (%rcx,%rdx,4), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
shrq $0x20, %rax
movl %eax, -0x74(%rbp)
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x60(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x34(%rbp), %edx
movslq (%rcx,%rdx,4), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
movl %eax, -0x78(%rbp)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, %eax
movq -0x60(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x26fe78
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x60(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x34(%rbp), %edx
addl $0x1, %edx
movl %edx, %edx
movslq (%rcx,%rdx,4), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
shrq $0x20, %rax
movl %eax, -0x7c(%rbp)
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x60(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x34(%rbp), %edx
addl $0x1, %edx
movl %edx, %edx
movslq (%rcx,%rdx,4), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
movl %eax, -0x80(%rbp)
jmp 0x26fe7a
movq -0x8(%rbp), %rax
movq 0x98(%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0xa0(%rcx), %rax
jne 0x26ff01
movq -0x8(%rbp), %rax
cmpq $0x0, 0xa0(%rax)
je 0x26feb7
movq -0x8(%rbp), %rax
movq 0xa0(%rax), %rax
shlq %rax
movq %rax, -0x120(%rbp)
jmp 0x26fec5
movl $0x2, %eax
movq %rax, -0x120(%rbp)
jmp 0x26fec5
movq -0x120(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xa0(%rax)
movq -0x8(%rbp), %rax
movq 0xa8(%rax), %rdi
movq -0x8(%rbp), %rax
imulq $0x1c, 0xa0(%rax), %rsi
callq 0x2360
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xa8(%rax)
movq -0x8(%rbp), %rax
movq 0xa8(%rax), %rax
movq -0x8(%rbp), %rdx
movq 0x98(%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, 0x98(%rdx)
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x70(%rbp)
movl -0x74(%rbp), %ecx
movq -0x70(%rbp), %rax
movl %ecx, 0x10(%rax)
movl -0x78(%rbp), %ecx
movq -0x70(%rbp), %rax
movl %ecx, 0x14(%rax)
cmpl $0x0, -0x84(%rbp)
je 0x26ff52
jmp 0x27005a
movl -0x18(%rbp), %eax
cmpl -0x74(%rbp), %eax
jbe 0x270058
movl -0x18(%rbp), %eax
cmpl -0x7c(%rbp), %eax
jae 0x270058
movl 0x18(%rbp), %eax
cmpl -0x78(%rbp), %eax
jbe 0x270058
movl 0x18(%rbp), %eax
cmpl -0x80(%rbp), %eax
jae 0x270058
jmp 0x26ff84
movq -0x8(%rbp), %rax
movq 0x98(%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0xa0(%rcx), %rax
jne 0x27000b
movq -0x8(%rbp), %rax
cmpq $0x0, 0xa0(%rax)
je 0x26ffc1
movq -0x8(%rbp), %rax
movq 0xa0(%rax), %rax
shlq %rax
movq %rax, -0x128(%rbp)
jmp 0x26ffcf
movl $0x2, %eax
movq %rax, -0x128(%rbp)
jmp 0x26ffcf
movq -0x128(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xa0(%rax)
movq -0x8(%rbp), %rax
movq 0xa8(%rax), %rdi
movq -0x8(%rbp), %rax
imulq $0x1c, 0xa0(%rax), %rsi
callq 0x2360
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xa8(%rax)
movq -0x8(%rbp), %rax
movq 0xa8(%rax), %rax
movq -0x8(%rbp), %rdx
movq 0x98(%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, 0x98(%rdx)
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x70(%rbp)
movl -0x18(%rbp), %ecx
movq -0x70(%rbp), %rax
movl %ecx, 0x10(%rax)
movl 0x18(%rbp), %ecx
movq -0x70(%rbp), %rax
movl %ecx, 0x14(%rax)
movl $0x1, -0x84(%rbp)
jmp 0x27005a
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x26fd95
jmp 0x27006a
jmp 0x27006c
jmp 0x27006e
movq -0x8(%rbp), %rax
movq 0xa8(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x98(%rcx), %rcx
subq $0x1, %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x70(%rbp)
movq -0x48(%rbp), %rax
movq -0x70(%rbp), %rcx
movl 0x10(%rcx), %ecx
subq %rcx, %rax
movq -0x50(%rbp), %rcx
movq -0x70(%rbp), %rdx
movl 0x14(%rdx), %edx
subq %rdx, %rcx
cmpq %rcx, %rax
ja 0x2700cb
movq -0x48(%rbp), %rax
movq -0x70(%rbp), %rcx
movl 0x10(%rcx), %ecx
subq %rcx, %rax
movq %rax, -0x130(%rbp)
jmp 0x2700e0
movq -0x50(%rbp), %rax
movq -0x70(%rbp), %rcx
movl 0x14(%rcx), %ecx
subq %rcx, %rax
movq %rax, -0x130(%rbp)
movq -0x130(%rbp), %rax
movl %eax, -0x38(%rbp)
cmpl $0x0, -0x38(%rbp)
jbe 0x270208
jmp 0x2700f6
movq -0x8(%rbp), %rax
movq 0x98(%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0xa0(%rcx), %rax
jne 0x27017d
movq -0x8(%rbp), %rax
cmpq $0x0, 0xa0(%rax)
je 0x270133
movq -0x8(%rbp), %rax
movq 0xa0(%rax), %rax
shlq %rax
movq %rax, -0x138(%rbp)
jmp 0x270141
movl $0x2, %eax
movq %rax, -0x138(%rbp)
jmp 0x270141
movq -0x138(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xa0(%rax)
movq -0x8(%rbp), %rax
movq 0xa8(%rax), %rdi
movq -0x8(%rbp), %rax
imulq $0x1c, 0xa0(%rax), %rsi
callq 0x2360
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xa8(%rax)
movq -0x8(%rbp), %rax
movq 0xa8(%rax), %rax
movq -0x8(%rbp), %rdx
movq 0x98(%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, 0x98(%rdx)
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x70(%rbp)
movq -0x8(%rbp), %rax
movq 0xa8(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x98(%rcx), %rcx
subq $0x2, %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %ecx
addl -0x38(%rbp), %ecx
movq -0x70(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x8(%rbp), %rax
movq 0xa8(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x98(%rcx), %rcx
subq $0x2, %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl 0x14(%rax), %ecx
addl -0x38(%rbp), %ecx
movq -0x70(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x8(%rbp), %rax
movq 0xa8(%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
cmpl $0x0, 0x10(%rax)
je 0x2703f0
movq -0x70(%rbp), %rax
cmpl $0x0, 0x14(%rax)
je 0x2703f0
movq -0x70(%rbp), %rax
movl 0x10(%rax), %eax
movq -0x70(%rbp), %rcx
cmpl 0x14(%rcx), %eax
ja 0x270252
movq -0x70(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x13c(%rbp)
jmp 0x27025f
movq -0x70(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, -0x13c(%rbp)
movl -0x13c(%rbp), %eax
movl %eax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq 0x98(%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0xa0(%rcx), %rax
jne 0x2702ef
movq -0x8(%rbp), %rax
cmpq $0x0, 0xa0(%rax)
je 0x2702a5
movq -0x8(%rbp), %rax
movq 0xa0(%rax), %rax
shlq %rax
movq %rax, -0x148(%rbp)
jmp 0x2702b3
movl $0x2, %eax
movq %rax, -0x148(%rbp)
jmp 0x2702b3
movq -0x148(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xa0(%rax)
movq -0x8(%rbp), %rax
movq 0xa8(%rax), %rdi
movq -0x8(%rbp), %rax
imulq $0x1c, 0xa0(%rax), %rsi
callq 0x2360
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xa8(%rax)
movq -0x8(%rbp), %rax
movq 0xa8(%rax), %rax
movq -0x8(%rbp), %rdx
movq 0x98(%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, 0x98(%rdx)
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x70(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, %eax
movq -0x8(%rbp), %rcx
cmpq 0x98(%rcx), %rax
jae 0x2703b2
movq -0x8(%rbp), %rax
movq 0xa8(%rax), %rcx
movq -0x8(%rbp), %rax
movq 0x98(%rax), %rax
movl -0x34(%rbp), %edx
subq %rdx, %rax
subq $0x2, %rax
imulq $0x1c, %rax, %rax
addq %rax, %rcx
movq -0x8(%rbp), %rax
movq 0xa8(%rax), %rax
movq -0x8(%rbp), %rdx
movq 0x98(%rdx), %rdx
movl -0x34(%rbp), %esi
subq %rsi, %rdx
subq $0x1, %rdx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rax
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rdx
movq %rdx, 0x10(%rax)
movl 0x18(%rcx), %ecx
movl %ecx, 0x18(%rax)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x270325
movq -0x8(%rbp), %rax
movq 0xa8(%rax), %rax
movl 0x2c(%rax), %ecx
subl -0x38(%rbp), %ecx
movq -0x8(%rbp), %rax
movq 0xa8(%rax), %rax
movl %ecx, 0x10(%rax)
movq -0x8(%rbp), %rax
movq 0xa8(%rax), %rax
movl 0x30(%rax), %ecx
subl -0x38(%rbp), %ecx
movq -0x8(%rbp), %rax
movq 0xa8(%rax), %rax
movl %ecx, 0x14(%rax)
movq -0x8(%rbp), %rax
movq 0xa8(%rax), %rax
cmpl $0x0, 0x10(%rax)
je 0x27042a
movq -0x8(%rbp), %rax
movq 0xa8(%rax), %rax
cmpl $0x0, 0x14(%rax)
je 0x27042a
movq 0x153bc7(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x116e37(%rip), %rsi    # 0x38725a
movb $0x0, %al
callq 0x22a0
movq -0x8(%rbp), %rax
movq 0xa8(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x98(%rcx), %rcx
subq $0x1, %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
cmpq -0x48(%rbp), %rax
je 0x270496
movq -0x8(%rbp), %rax
movq 0xa8(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x98(%rcx), %rcx
subq $0x1, %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
cmpq -0x50(%rbp), %rax
je 0x270496
movq 0x153b5b(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x116dd3(%rip), %rsi    # 0x387262
movb $0x0, %al
callq 0x22a0
movq $0x0, -0xe8(%rbp)
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
movq 0x28(%rbp), %rcx
movq -0x8(%rbp), %r8
movq -0x8(%rbp), %rax
movq 0xa8(%rax), %rax
movl 0x10(%rax), %r9d
movq -0x8(%rbp), %rax
movq 0xa8(%rax), %rax
movq -0x8(%rbp), %rdi
movq 0x98(%rdi), %rdi
subq $0x1, %rdi
imulq $0x1c, %rdi, %rdi
addq %rdi, %rax
movl 0x10(%rax), %eax
leaq -0xb8(%rbp), %rdi
movl %eax, (%rsp)
callq 0x26f8f0
leaq -0xb8(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x26f510
cmpl $0x0, %eax
je 0x2705ed
movq -0x8(%rbp), %rsi
addq $0x98, %rsi
leaq -0xe0(%rbp), %rdi
callq 0x26eca0
movq -0x8(%rbp), %rax
movq 0x80(%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0x88(%rcx), %rax
jne 0x2705ac
movq -0x8(%rbp), %rax
cmpq $0x0, 0x88(%rax)
je 0x270562
movq -0x8(%rbp), %rax
movq 0x88(%rax), %rax
shlq %rax
movq %rax, -0x150(%rbp)
jmp 0x270570
movl $0x2, %eax
movq %rax, -0x150(%rbp)
jmp 0x270570
movq -0x150(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x88(%rax)
movq -0x8(%rbp), %rax
movq 0x90(%rax), %rdi
movq -0x8(%rbp), %rax
imulq $0x28, 0x88(%rax), %rsi
callq 0x2360
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x90(%rax)
movq -0x8(%rbp), %rax
movq 0x90(%rax), %rdi
movq -0x8(%rbp), %rcx
movq 0x80(%rcx), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x80(%rcx)
imulq $0x28, %rax, %rax
addq %rax, %rdi
leaq -0xe0(%rbp), %rsi
movl $0x28, %edx
callq 0x2180
jmp 0x2704f2
movq -0x8(%rbp), %rax
movq 0x80(%rax), %rax
movl %eax, -0x3c(%rbp)
movq -0x28(%rbp), %rsi
movl 0x10(%rbp), %edx
movq 0x28(%rbp), %rcx
movq -0x8(%rbp), %r8
movq -0x8(%rbp), %rax
movq 0xa8(%rax), %rax
movl 0x14(%rax), %r9d
movq -0x8(%rbp), %rax
movq 0xa8(%rax), %rax
movq -0x8(%rbp), %rdi
movq 0x98(%rdi), %rdi
subq $0x1, %rdi
imulq $0x1c, %rdi, %rdi
addq %rdi, %rax
movl 0x14(%rax), %eax
leaq -0xb8(%rbp), %rdi
movl %eax, (%rsp)
callq 0x26f8f0
leaq -0xb8(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x26f510
cmpl $0x0, %eax
je 0x27069b
movl -0xe0(%rbp), %edi
movl -0xdc(%rbp), %esi
movl -0xd4(%rbp), %edx
movl -0xd0(%rbp), %ecx
movl -0xd8(%rbp), %r8d
movq -0x8(%rbp), %r9
addq $0x80, %r9
movl -0x3c(%rbp), %eax
movl %eax, (%rsp)
callq 0x26f010
jmp 0x27064c
movq -0x8(%rbp), %rax
movq 0x80(%rax), %rax
movl -0x3c(%rbp), %ecx
subq %rcx, %rax
cmpq $0x0, %rax
jne 0x2706ca
movq 0x153927(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x11fecb(%rip), %rsi    # 0x39058e
movb $0x0, %al
callq 0x22a0
movq $0x0, -0xf0(%rbp)
movl -0x3c(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpq 0x80(%rcx), %rax
jae 0x270a5c
movq -0x8(%rbp), %rax
movq 0x90(%rax), %rax
movl -0x34(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xe8(%rbp)
movq -0xe8(%rbp), %rax
movl 0x10(%rax), %eax
movq -0xe8(%rbp), %rcx
cmpl 0xc(%rcx), %eax
ja 0x270726
jmp 0x270a4e
movq -0xe8(%rbp), %rax
movl 0x24(%rax), %eax
movq -0xe8(%rbp), %rcx
cmpl 0x20(%rcx), %eax
ja 0x270741
jmp 0x270a4e
jmp 0x270743
movq -0x8(%rbp), %rax
movq 0xb0(%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0xb8(%rcx), %rax
jne 0x2707ca
movq -0x8(%rbp), %rax
cmpq $0x0, 0xb8(%rax)
je 0x270780
movq -0x8(%rbp), %rax
movq 0xb8(%rax), %rax
shlq %rax
movq %rax, -0x158(%rbp)
jmp 0x27078e
movl $0x2, %eax
movq %rax, -0x158(%rbp)
jmp 0x27078e
movq -0x158(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xb8(%rax)
movq -0x8(%rbp), %rax
movq 0xc0(%rax), %rdi
movq -0x8(%rbp), %rax
imulq $0x30, 0xb8(%rax), %rsi
callq 0x2360
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xc0(%rax)
movq -0x8(%rbp), %rax
movq 0xc0(%rax), %rax
movq -0x8(%rbp), %rdx
movq 0xb0(%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, 0xb0(%rdx)
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xf0(%rbp)
movl 0x30(%rbp), %eax
movb %al, %dl
movq -0xf0(%rbp), %rax
movb 0x28(%rax), %cl
andb $0x3f, %dl
andb $-0x40, %cl
orb %dl, %cl
movb %cl, 0x28(%rax)
movq -0xe8(%rbp), %rax
movl 0x8(%rax), %eax
movq -0xe8(%rbp), %rcx
xorl 0x1c(%rcx), %eax
andl $0x1, %eax
movb %al, %dl
movq -0xf0(%rbp), %rax
movb 0x28(%rax), %cl
andb $0x1, %dl
shlb $0x6, %dl
andb $-0x41, %cl
orb %dl, %cl
movb %cl, 0x28(%rax)
movq -0xf0(%rbp), %rax
movb 0x28(%rax), %cl
andb $0x7f, %cl
orb $0x0, %cl
movb %cl, 0x28(%rax)
movq -0xe8(%rbp), %rax
movl 0x8(%rax), %ecx
shrl %ecx
movq -0xf0(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0xe8(%rbp), %rax
movl 0xc(%rax), %ecx
movq -0xf0(%rbp), %rax
movl %ecx, (%rax)
movq -0xe8(%rbp), %rax
movl 0x10(%rax), %ecx
movq -0xf0(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0xe8(%rbp), %rax
movl 0x1c(%rax), %ecx
shrl %ecx
movq -0xf0(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0xe8(%rbp), %rax
movl 0x20(%rax), %ecx
movq -0xf0(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0xe8(%rbp), %rax
movl 0x24(%rax), %ecx
movq -0xf0(%rbp), %rax
movl %ecx, 0x10(%rax)
xorps %xmm0, %xmm0
ucomisd -0x30(%rbp), %xmm0
jbe 0x27095d
movq -0xf0(%rbp), %rax
movl 0x4(%rax), %eax
movq -0xf0(%rbp), %rcx
subl (%rcx), %eax
movq -0xf0(%rbp), %rcx
movl 0x10(%rcx), %ecx
movq -0xf0(%rbp), %rdx
subl 0xc(%rdx), %ecx
cmpl %ecx, %eax
ja 0x270925
movq -0xf0(%rbp), %rax
movl 0x4(%rax), %eax
movq -0xf0(%rbp), %rcx
subl (%rcx), %eax
movl %eax, -0x15c(%rbp)
jmp 0x27093f
movq -0xf0(%rbp), %rax
movl 0x10(%rax), %eax
movq -0xf0(%rbp), %rcx
subl 0xc(%rcx), %eax
movl %eax, -0x15c(%rbp)
movl -0x15c(%rbp), %eax
movl %eax, %eax
cvtsi2sd %rax, %xmm0
movq -0xf0(%rbp), %rax
movsd %xmm0, 0x20(%rax)
jmp 0x270a4c
movq -0xf0(%rbp), %rax
movl (%rax), %ecx
movl 0x4(%rax), %eax
subl %ecx, %eax
cvtsi2sd %rax, %xmm0
movq -0x8(%rbp), %rax
movq 0x98(%rax), %rdx
movq 0xa8(%rax), %rcx
leaq (%rdx,%rdx,8), %rax
leaq (%rax,%rax,2), %rax
addq %rdx, %rax
movl -0xc(%rcx,%rax), %eax
movl 0x10(%rcx), %ecx
subl %ecx, %eax
cvtsi2sd %rax, %xmm1
divsd %xmm1, %xmm0
movsd -0x30(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0xf8(%rbp)
movq -0xf0(%rbp), %rax
movl 0xc(%rax), %ecx
movl 0x10(%rax), %eax
subl %ecx, %eax
cvtsi2sd %rax, %xmm0
movq -0x8(%rbp), %rax
movq 0x98(%rax), %rdx
movq 0xa8(%rax), %rcx
leaq (%rdx,%rdx,8), %rax
leaq (%rax,%rax,2), %rax
addq %rdx, %rax
movl -0x8(%rcx,%rax), %eax
movl 0x14(%rcx), %ecx
subl %ecx, %eax
cvtsi2sd %rax, %xmm1
divsd %xmm1, %xmm0
mulsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x100(%rbp)
movsd -0xf8(%rbp), %xmm1
movsd -0x100(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jb 0x270a28
movsd -0xf8(%rbp), %xmm0
movsd %xmm0, -0x168(%rbp)
jmp 0x270a38
movsd -0x100(%rbp), %xmm0
movsd %xmm0, -0x168(%rbp)
movsd -0x168(%rbp), %xmm0
movq -0xf0(%rbp), %rax
movsd %xmm0, 0x20(%rax)
jmp 0x270a4e
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x2706db
addq $0x170, %rsp            # imm = 0x170
popq %rbp
retq
nopw %cs:(%rax,%rax)