// File: chhylp123[P]hifiasm/horder.cpp
// Function: gen_mc_clus_backbone_layout(scg_t*, asg64_v*, unsigned int*, unsigned int, unsigned int*)
void gen_mc_clus_backbone_layout(scg_t *sg, asg64_v *res, uint32_t *out, uint32_t out_n, uint32_t *buf)
{
    uint64_t k, l, i, rn, n0, n1, v, z; int64_t m, s, e; osg_arc_t *t = NULL;
    kv_resize(uint64_t, *res, sg->g->n_seq); res->n = sg->g->n_seq;
    memset(res->a, 0, sizeof((*(res->a)))*res->n); rn = res->n;
    // fprintf(stderr, "[M::%s::]******Start******\n",__func__);
    
    for (k = 0; k < sg->g->n_seq; k++) {
        ///I guess this should be (!!(asg_arc_n(lg, k<<1)))^(!!(asg_arc_n(lg, (k<<1)+1)))?
        ///no, since asg_arc_n is at most 1
        n0 = asg_arc_n(sg->g, (k<<1));
        n1 = asg_arc_n(sg->g, ((k<<1)+1));
        assert((n0 <= 1) && (n1 <= 1));
        ///1&&0; 0&&0; 1&&1;
        if((n0^n1) || ((!n0) && (!n1))) {
            v = (n0?(k<<1):((k<<1)+1));
            // if(vis[k<<1] || vis[(k<<1)+1]) continue;
            // if((res->a[k]>>32) || ((uint32_t)res->a[k])) continue;
            if(res->a[k]) continue;

            // kv_pushp(lay_t, *sl, &p);
            // kv_init(*p);
            // kv_push(uint32_t, *p, v^1);
            // kv_push(uint32_t, *p, v);
            // vis[v] = vis[v^1] = 1;
            // kv_push(uint64_t, *res, (((uint64_t)((v^1)<<32))|((uint64_t)(v))|((uint64_t)(0x8000000000000000))));
            kv_push(uint64_t, *res, (((uint64_t)((v^1)<<32))|((uint64_t)(v))));
            // res->a[v>>1] |= ((uint64_t)(1))<<32;
            // res->a[v>>1] |= ((uint64_t)(1));
            res->a[v>>1] = 1;

            while (asg_arc_n(sg->g, v)) {
                v = (arc_first(sg->g, v).v)^1;
                // kv_push(uint32_t, *p, v^1);
                // kv_push(uint32_t, *p, v);
                // vis[v] = vis[v^1] = 1;
                kv_push(uint64_t, *res, ((uint64_t)((v^1)<<32))|((uint64_t)(v)));
                // res->a[v>>1] |= ((uint64_t)(1))<<32;
                // res->a[v>>1] |= ((uint64_t)(1));
                res->a[v>>1] = 1;
            }
        }
    }


    for (k = 0; k < sg->g->n_seq; k++) {
        // if(vis[k<<1] || vis[(k<<1)+1]) continue;
        // if((res->a[k]>>32) || ((uint32_t)res->a[k])) continue;
        if(res->a[k]) continue;
        n0 = asg_arc_n(sg->g, (k<<1));
        n1 = asg_arc_n(sg->g, ((k<<1)+1));
        assert((n0 == 1) && (n1 == 1));///must within a circle


        v = k<<1; t = NULL;
        while (asg_arc_n(sg->g, v)) {
            if((!t) || (t->nw > arc_first(sg->g, v).nw)) {
                t = &(arc_first(sg->g, v));
            } 
            v = (arc_first(sg->g, v).v)^1;
            if(v == (k<<1)) break;
        }

        v = t->v^1;
        // kv_pushp(lay_t, *sl, &p);
        // kv_init(*p);
        // kv_push(uint32_t, *p, v^1);
        // kv_push(uint32_t, *p, v);
        // vis[v] = vis[v^1] = 1;
        // kv_push(uint64_t, *res, (((uint64_t)((v^1)<<32))|((uint64_t)(v))|((uint64_t)(0x8000000000000000))));
        kv_push(uint64_t, *res, ((uint64_t)((v^1)<<32))|((uint64_t)(v)));
        // res->a[v>>1] |= ((uint64_t)(1))<<32;
        // res->a[v>>1] |= ((uint64_t)(1));
        res->a[v>>1] = 1;

        while (1) {
            v = (arc_first(sg->g, v).v)^1;
            // if(vis[v]) break;
            if(res->a[v>>1]) break;
            // kv_push(uint32_t, *p, v^1);
            // kv_push(uint32_t, *p, v);
            // vis[v] = vis[v^1] = 1;
            kv_push(uint64_t, *res, ((uint64_t)((v^1)<<32))|((uint64_t)(v)));
            // res->a[v>>1] |= ((uint64_t)(1))<<32;
            // res->a[v>>1] |= ((uint64_t)(1));
            res->a[v>>1] = 1;
        }
    }

    // uint32_t db_on = 0, db_z = 0;
    assert((res->n-rn) == sg->g->n_seq);
    for (l = 0, k = 1, i = 0; k <= out_n; k++) {
       if(k == out_n || out[k] == (uint32_t)-1) {
            if(k > l) {
                res->a[i++] = ((l<<32)|(k)); ///db_on += k - l;
            } else {
                assert(k == out_n);
            }
            l = k + 1;
       }
    }
    assert(i == sg->g->n_seq && i == rn);
    for (k = rn, z = 0; k < res->n; k++) {
        v = (res->a[k]>>32); 
        s = res->a[v>>1]>>32; e = (uint32_t)res->a[v>>1];
        if(!(v&1)) {
            for (m = s; m < e; m++) buf[z++] = out[m]; 
        } else {
            for (m = e-1; m >= s; m--) buf[z++] = out[m]; 
        }

        // if(e > s) {
        //     fprintf(stderr, "[M::%s::]\t#chain::%ld\tutg%.6ul->utg%.6ul\n", 
        //         __func__, (e-s), buf[z-(e-s)]+1, buf[z-1]+1);
        // }
        
        buf[z++] = (uint32_t)-1; 
        // db_z += e - s;
    }
    // if(!(z == out_n)) {
    //     fprintf(stderr, "[M::%s] sg->g->n_arc::%u, sg->g->n_seq::%u, z::%lu, out_n::%u, db_z::%u, db_on::%u\n", __func__, 
	//         sg->g->n_arc, sg->g->n_seq, z, out_n, db_z, db_on);
    // }
    assert(z == out_n);
    memcpy(out, buf, sizeof((*out))*out_n);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq %r8, -0x28(%rbp)
movq $0x0, -0x88(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
movl 0x14(%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movl %ecx, %ecx
cmpq %rcx, %rax
jae 0x247532
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
shrq %rcx
movq -0x10(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x2, %rcx
movq -0x10(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x4, %rcx
movq -0x10(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x8, %rcx
movq -0x10(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x10, %rcx
movq -0x10(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x247534
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
shlq $0x3, %rdx
xorl %esi, %esi
callq 0x2100
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
movl 0x14(%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movl %ecx, %ecx
cmpq %rcx, %rax
jae 0x247863
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq 0x20(%rax), %rax
movq -0x30(%rbp), %rcx
shlq %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq 0x20(%rax), %rax
movq -0x30(%rbp), %rcx
shlq %rcx
movq 0x8(%rax,%rcx,8), %rax
movl %eax, %eax
movq %rax, -0x58(%rbp)
xorl %eax, %eax
cmpq $0x1, -0x50(%rbp)
movb %al, -0x89(%rbp)
ja 0x2475f0
cmpq $0x1, -0x58(%rbp)
setbe %al
movb %al, -0x89(%rbp)
movb -0x89(%rbp), %al
testb $0x1, %al
jne 0x2475fc
jmp 0x2475fe
jmp 0x24761d
leaq 0x1473b8(%rip), %rdi    # 0x38e9bd
leaq 0x146e6f(%rip), %rsi    # 0x38e47b
movl $0x101f, %edx           # imm = 0x101F
leaq 0x1473bc(%rip), %rcx    # 0x38e9d4
callq 0x2130
movq -0x50(%rbp), %rax
xorq -0x58(%rbp), %rax
cmpq $0x0, %rax
jne 0x247641
cmpq $0x0, -0x50(%rbp)
jne 0x247850
cmpq $0x0, -0x58(%rbp)
jne 0x247850
cmpq $0x0, -0x50(%rbp)
je 0x247658
movq -0x30(%rbp), %rax
shlq %rax
movq %rax, -0x98(%rbp)
jmp 0x24766a
movq -0x30(%rbp), %rax
shlq %rax
addq $0x1, %rax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x30(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0x24768d
jmp 0x247852
jmp 0x24768f
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x247700
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x2476bf
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0xa0(%rbp)
jmp 0x2476cd
movl $0x2, %eax
movq %rax, -0xa0(%rbp)
jmp 0x2476cd
movq -0xa0(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x60(%rbp), %rdx
xorq $0x1, %rdx
shlq $0x20, %rdx
orq -0x60(%rbp), %rdx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movq %rdx, (%rax,%rcx,8)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x60(%rbp), %rcx
shrq %rcx
movq $0x1, (%rax,%rcx,8)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq 0x20(%rax), %rax
movq -0x60(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpl $0x0, %eax
je 0x24784e
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
movq 0x20(%rcx), %rcx
movq -0x60(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl (%rax), %eax
xorl $0x1, %eax
movl %eax, %eax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x247805
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x2477c4
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0xa8(%rbp)
jmp 0x2477d2
movl $0x2, %eax
movq %rax, -0xa8(%rbp)
jmp 0x2477d2
movq -0xa8(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x60(%rbp), %rdx
xorq $0x1, %rdx
shlq $0x20, %rdx
orq -0x60(%rbp), %rdx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movq %rdx, (%rax,%rcx,8)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x60(%rbp), %rcx
shrq %rcx
movq $0x1, (%rax,%rcx,8)
jmp 0x247744
jmp 0x247850
jmp 0x247852
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x24757b
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
movl 0x14(%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movl %ecx, %ecx
cmpq %rcx, %rax
jae 0x247bfd
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x30(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0x2478a2
jmp 0x247bec
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq 0x20(%rax), %rax
movq -0x30(%rbp), %rcx
shlq %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq 0x20(%rax), %rax
movq -0x30(%rbp), %rcx
shlq %rcx
movq 0x8(%rax,%rcx,8), %rax
movl %eax, %eax
movq %rax, -0x58(%rbp)
xorl %eax, %eax
cmpq $0x1, -0x50(%rbp)
movb %al, -0xa9(%rbp)
jne 0x2478f8
cmpq $0x1, -0x58(%rbp)
sete %al
movb %al, -0xa9(%rbp)
movb -0xa9(%rbp), %al
testb $0x1, %al
jne 0x247904
jmp 0x247906
jmp 0x247925
leaq 0x14711e(%rip), %rdi    # 0x38ea2b
leaq 0x146b67(%rip), %rsi    # 0x38e47b
movl $0x1046, %edx           # imm = 0x1046
leaq 0x1470b4(%rip), %rcx    # 0x38e9d4
callq 0x2130
movq -0x30(%rbp), %rax
shlq %rax
movq %rax, -0x60(%rbp)
movq $0x0, -0x88(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq 0x20(%rax), %rax
movq -0x60(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpl $0x0, %eax
je 0x247a18
cmpq $0x0, -0x88(%rbp)
je 0x24799d
movq -0x88(%rbp), %rax
movsd 0x18(%rax), %xmm0
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
movq 0x20(%rcx), %rcx
movq -0x60(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
shlq $0x5, %rcx
addq %rcx, %rax
ucomisd 0x18(%rax), %xmm0
jbe 0x2479cd
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
movq 0x20(%rcx), %rcx
movq -0x60(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x88(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
movq 0x20(%rcx), %rcx
movq -0x60(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl (%rax), %eax
xorl $0x1, %eax
movl %eax, %eax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq -0x30(%rbp), %rcx
shlq %rcx
cmpq %rcx, %rax
jne 0x247a13
jmp 0x247a18
jmp 0x24793b
movq -0x88(%rbp), %rax
movl (%rax), %eax
xorl $0x1, %eax
movl %eax, %eax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x247a9b
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x247a5a
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0xb8(%rbp)
jmp 0x247a68
movl $0x2, %eax
movq %rax, -0xb8(%rbp)
jmp 0x247a68
movq -0xb8(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x60(%rbp), %rdx
xorq $0x1, %rdx
shlq $0x20, %rdx
orq -0x60(%rbp), %rdx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movq %rdx, (%rax,%rcx,8)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x60(%rbp), %rcx
shrq %rcx
movq $0x1, (%rax,%rcx,8)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
movq 0x20(%rcx), %rcx
movq -0x60(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl (%rax), %eax
xorl $0x1, %eax
movl %eax, %eax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x60(%rbp), %rcx
shrq %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0x247b2e
jmp 0x247bea
jmp 0x247b30
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x247ba1
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x247b60
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0xc0(%rbp)
jmp 0x247b6e
movl $0x2, %eax
movq %rax, -0xc0(%rbp)
jmp 0x247b6e
movq -0xc0(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x60(%rbp), %rdx
xorq $0x1, %rdx
shlq $0x20, %rdx
orq -0x60(%rbp), %rdx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movq %rdx, (%rax,%rcx,8)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x60(%rbp), %rcx
shrq %rcx
movq $0x1, (%rax,%rcx,8)
jmp 0x247adf
jmp 0x247bec
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x24786b
movq -0x10(%rbp), %rax
movq (%rax), %rax
subq -0x48(%rbp), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
movl 0x14(%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movl %ecx, %ecx
cmpq %rcx, %rax
jne 0x247c21
jmp 0x247c40
leaq 0x146e1a(%rip), %rdi    # 0x38ea42
leaq 0x14684c(%rip), %rsi    # 0x38e47b
movl $0x106d, %edx           # imm = 0x106D
leaq 0x146d99(%rip), %rcx    # 0x38e9d4
callq 0x2130
movq $0x0, -0x38(%rbp)
movq $0x1, -0x30(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x30(%rbp), %rax
movl -0x1c(%rbp), %ecx
cmpq %rcx, %rax
ja 0x247d03
movq -0x30(%rbp), %rax
movl -0x1c(%rbp), %ecx
cmpq %rcx, %rax
je 0x247c82
movq -0x18(%rbp), %rax
movq -0x30(%rbp), %rcx
cmpl $-0x1, (%rax,%rcx,4)
jne 0x247cf0
movq -0x30(%rbp), %rax
cmpq -0x38(%rbp), %rax
jbe 0x247cb5
movq -0x38(%rbp), %rdx
shlq $0x20, %rdx
orq -0x30(%rbp), %rdx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x40(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0x40(%rbp)
movq %rdx, (%rax,%rcx,8)
jmp 0x247ce4
movq -0x30(%rbp), %rax
movl -0x1c(%rbp), %ecx
cmpq %rcx, %rax
jne 0x247cc3
jmp 0x247ce2
leaq 0x146d94(%rip), %rdi    # 0x38ea5e
leaq 0x1467aa(%rip), %rsi    # 0x38e47b
movl $0x1073, %edx           # imm = 0x1073
leaq 0x146cf7(%rip), %rcx    # 0x38e9d4
callq 0x2130
jmp 0x247ce4
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x247cf2
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x247c58
movq -0x40(%rbp), %rcx
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
movl %eax, %edx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0xc1(%rbp)
jne 0x247d38
movq -0x40(%rbp), %rax
cmpq -0x48(%rbp), %rax
sete %al
movb %al, -0xc1(%rbp)
movb -0xc1(%rbp), %al
testb $0x1, %al
jne 0x247d44
jmp 0x247d46
jmp 0x247d65
leaq 0x146d1c(%rip), %rdi    # 0x38ea69
leaq 0x146727(%rip), %rsi    # 0x38e47b
movl $0x1078, %edx           # imm = 0x1078
leaq 0x146c74(%rip), %rcx    # 0x38e9d4
callq 0x2130
movq -0x48(%rbp), %rax
movq %rax, -0x30(%rbp)
movq $0x0, -0x68(%rbp)
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x247e95
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x60(%rbp), %rcx
shrq %rcx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movq %rax, -0x78(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x60(%rbp), %rcx
shrq %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movq %rax, -0x80(%rbp)
movq -0x60(%rbp), %rax
andq $0x1, %rax
cmpq $0x0, %rax
jne 0x247e23
movq -0x78(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
cmpq -0x80(%rbp), %rax
jge 0x247e21
movq -0x18(%rbp), %rax
movq -0x70(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x28(%rbp), %rax
movq -0x68(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0x68(%rbp)
movl %edx, (%rax,%rcx,4)
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
jmp 0x247de8
jmp 0x247e6a
movq -0x80(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
cmpq -0x78(%rbp), %rax
jl 0x247e68
movq -0x18(%rbp), %rax
movq -0x70(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x28(%rbp), %rax
movq -0x68(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0x68(%rbp)
movl %edx, (%rax,%rcx,4)
movq -0x70(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x70(%rbp)
jmp 0x247e2f
jmp 0x247e6a
movq -0x28(%rbp), %rax
movq -0x68(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x68(%rbp)
movl $0xffffffff, (%rax,%rcx,4) # imm = 0xFFFFFFFF
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x247d75
movq -0x68(%rbp), %rax
movl -0x1c(%rbp), %ecx
cmpq %rcx, %rax
jne 0x247ea3
jmp 0x247ec2
leaq 0x146bdc(%rip), %rdi    # 0x38ea86
leaq 0x1465ca(%rip), %rsi    # 0x38e47b
movl $0x108e, %edx           # imm = 0x108E
leaq 0x146b17(%rip), %rcx    # 0x38e9d4
callq 0x2130
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rsi
movl -0x1c(%rbp), %eax
movl %eax, %edx
shlq $0x2, %rdx
callq 0x2180
addq $0xd0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)