// File: chhylp123[P]hifiasm/Overlaps.cpp
// Function: cal_self_close_tang_flank0(asg_t*, unsigned int, unsigned int, unsigned int, unsigned long, unsigned long, asg32_v*, asg32_v*, unsigned char*, unsigned char*, unsigned long)
uint64_t cal_self_close_tang_flank0(asg_t *g, uint32_t v0, uint32_t s0, uint32_t e0, uint64_t sf, uint64_t ef, asg32_v *b1, asg32_v *b2, uint8_t *f, uint8_t *fs, uint64_t max_path)
{
    uint64_t se = 0, k, v, o, o0, o1, nv, tot = 0; asg_arc_t *av;
    
    if(f[v0]) return (uint64_t)-1;

    // if((v0>>1) == 47687) fprintf(stderr, "+[M::%s] v0->utg%.6ul(%c), s0::%u, e0::%u, sf::%lu, ef::%lu\n", __func__, (v0>>1)+1, "+-"[v0&1], s0, e0, sf, ef);
    
    b1->n = b2->n = 0; kv_push(uint32_t, *b1, v0);
    while(b1->n) {
        v = b1->a[--b1->n];
        if(f[v] && f[v^1]) continue;
        // if((v0>>1) == 47687) fprintf(stderr, "[M::%s] utg%.6lul(%c), tot::%lu\n", __func__, (v>>1)+1, "+-"[v&1], tot);

        v = v; 
        // if((v0>>1) == 47687) fprintf(stderr, "[M::%s] v::%lu, f[v]::%u, fs[v]::%u, fs[v^1]::%u\n", __func__, v, f[v], fs[v], fs[v^1]);
        if((!f[v]) && (v!=(s0^1)) && (v!=e0)) {
            if((fs[v^1] != sf) && (fs[v] != ef)) {
                f[v] = 1; kv_push(uint32_t, *b2, v);
                av = asg_arc_a(g, v); nv = asg_arc_n(g, v); 
                for (k = 0; k < nv; k++) {
                    if(av[k].del) continue;
                    // if((v0>>1) == 47687) fprintf(stderr, "[M::%s] k::%lu, f[av[k].v]::%u, fs[av[k].v]::%u, fs[av[k].v^1]::%u\n", __func__, k, f[av[k].v], fs[av[k].v], fs[av[k].v^1]);
                    if((av[k].v == s0) || (av[k].v == (e0^1))) {
                        se = 1; break;
                    }
                    if(fs[av[k].v] == sf) {
                        fs[av[k].v] = 0;///not a beg node anymore
                        if(!f[av[k].v^1]) kv_push(uint32_t, *b1, (av[k].v^1));///push reverse node
                    }
                    if(fs[(av[k].v^1)] == ef) {
                        fs[(av[k].v^1)] = 0;///not a end node anymore; do not need to push as it will be pushed later
                        if(!f[av[k].v]) kv_push(uint32_t, *b1, (av[k].v));///push reverse node
                    }

                    /**if((fs[av[k].v^1] != sf) && (fs[av[k].v] != ef))**/ {
                        if((!f[av[k].v])) kv_push(uint32_t, *b1, av[k].v);
                    }
                }
                if(se) break;
            }
        }

        v = v^1; 
        // if((v0>>1) == 47687) fprintf(stderr, "[M::%s] v::%lu, f[v]::%u, fs[v]::%u, fs[v^1]::%u\n", __func__, v, f[v], fs[v], fs[v^1]);
        if((!f[v]) && (v != (s0^1)) && (v != e0)) {
            if((fs[v^1] != sf) && (fs[v] != ef)) {
                f[v] = 1; kv_push(uint32_t, *b2, v);
                av = asg_arc_a(g, v); nv = asg_arc_n(g, v); 
                for (k = 0; k < nv; k++) {
                    if(av[k].del) continue;
                    // if((v0>>1) == 47687) fprintf(stderr, "[M::%s] k::%lu, f[av[k].v]::%u, fs[av[k].v]::%u, fs[av[k].v^1]::%u\n", __func__, k, f[av[k].v], fs[av[k].v], fs[av[k].v^1]);
                    if((av[k].v == s0) || (av[k].v == (e0^1))) {
                        se = 1; break;
                    }
                    if(fs[av[k].v] == sf) {
                        fs[av[k].v] = 0;///not a beg node anymore
                        if(!f[av[k].v^1]) kv_push(uint32_t, *b1, (av[k].v^1));///push reverse node
                    }
                    if(fs[(av[k].v^1)] == ef) fs[(av[k].v^1)] = 0;///not a end node anymore; do not need to push as it will be pushed later

                    /**if((fs[av[k].v^1] != sf) && (fs[av[k].v] != ef))**/ {
                        if((!f[av[k].v])) kv_push(uint32_t, *b1, av[k].v);
                    }
                }
                if(se) break;
            }
        }

        if(f[v] && f[v^1]) {
            av = asg_arc_a(g, v); nv = asg_arc_n(g, v); 
            for (k = o = 0; k < nv; k++) {
                if(av[k].del) continue;
                if((f[av[k].v^1]) && (f[av[k].v]) && (o < av[k].ol)) o = av[k].ol;
            }
            o0 = o;

            av = asg_arc_a(g, (v^1)); nv = asg_arc_n(g, (v^1)); 
            for (k = o = 0; k < nv; k++) {
                if(av[k].del) continue;
                if((f[av[k].v^1]) && (f[av[k].v]) && (o < av[k].ol)) o = av[k].ol;
            }
            o1 = o;

            if(o0 + o1 < g->seq[v>>1].len) tot += g->seq[v>>1].len - o0 - o1;
        }

        if(tot > max_path) break;
    }

    // if((v0>>1) == 47687) fprintf(stderr, "-[M::%s] v0->utg%.6ul(%c), tot::%lu, se::%lu\n", __func__, (v0>>1)+1, "+-"[v0&1], tot, se);

    if((!se) && (tot <= max_path)) return tot;
    return (uint64_t)-1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq 0x30(%rbp), %rax
movq 0x28(%rbp), %rax
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x70(%rbp)
movq 0x20(%rbp), %rax
movl -0x14(%rbp), %ecx
cmpb $0x0, (%rax,%rcx)
je 0x12aa5e
movq $-0x1, -0x8(%rbp)
jmp 0x12b673
movq 0x18(%rbp), %rax
movq $0x0, (%rax)
movq 0x10(%rbp), %rax
movq $0x0, (%rax)
movq 0x10(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x12aadc
movq 0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x12aaa1
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x80(%rbp)
jmp 0x12aaac
movl $0x2, %eax
movq %rax, -0x80(%rbp)
jmp 0x12aaac
movq -0x80(%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 $0x2, %rsi
callq 0x2360
movq %rax, %rcx
movq 0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movl -0x14(%rbp), %edx
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x10(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movl %edx, (%rax,%rcx,4)
jmp 0x12aafd
movq 0x10(%rbp), %rax
cmpq $0x0, (%rax)
je 0x12b650
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x10(%rbp), %rdx
movq (%rdx), %rcx
movq %rcx, %rsi
addq $-0x1, %rsi
movq %rsi, (%rdx)
movl -0x4(%rax,%rcx,4), %eax
movq %rax, -0x48(%rbp)
movq 0x20(%rbp), %rax
movq -0x48(%rbp), %rcx
cmpb $0x0, (%rax,%rcx)
je 0x12ab4e
movq 0x20(%rbp), %rax
movq -0x48(%rbp), %rcx
xorq $0x1, %rcx
cmpb $0x0, (%rax,%rcx)
je 0x12ab4e
jmp 0x12aafd
movq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
movq 0x20(%rbp), %rax
movq -0x48(%rbp), %rcx
cmpb $0x0, (%rax,%rcx)
jne 0x12afe5
movq -0x48(%rbp), %rax
movl -0x18(%rbp), %ecx
xorl $0x1, %ecx
movl %ecx, %ecx
cmpq %rcx, %rax
je 0x12afe5
movq -0x48(%rbp), %rax
movl -0x1c(%rbp), %ecx
cmpq %rcx, %rax
je 0x12afe5
movq 0x28(%rbp), %rax
movq -0x48(%rbp), %rcx
xorq $0x1, %rcx
movzbl (%rax,%rcx), %eax
cmpq -0x28(%rbp), %rax
je 0x12afe3
movq 0x28(%rbp), %rax
movq -0x48(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cmpq -0x30(%rbp), %rax
je 0x12afe3
movq 0x20(%rbp), %rax
movq -0x48(%rbp), %rcx
movb $0x1, (%rax,%rcx)
movq 0x18(%rbp), %rax
movq (%rax), %rax
movq 0x18(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x12ac3a
movq 0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x12abf9
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x88(%rbp)
jmp 0x12ac07
movl $0x2, %eax
movq %rax, -0x88(%rbp)
jmp 0x12ac07
movq -0x88(%rbp), %rcx
movq 0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x2, %rsi
callq 0x2360
movq %rax, %rcx
movq 0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x48(%rbp), %rax
movl %eax, %edx
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x18(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movl %edx, (%rax,%rcx,4)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x28(%rcx), %rcx
movq -0x48(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x78(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x48(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movq %rax, -0x68(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x68(%rbp), %rax
jae 0x12afd5
movq -0x78(%rbp), %rax
imulq $0x18, -0x40(%rbp), %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x12accb
jmp 0x12afc4
movq -0x78(%rbp), %rax
imulq $0x18, -0x40(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
cmpl -0x18(%rbp), %eax
je 0x12acf8
movq -0x78(%rbp), %rax
imulq $0x18, -0x40(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl -0x1c(%rbp), %ecx
xorl $0x1, %ecx
cmpl %ecx, %eax
jne 0x12ad05
movq $0x1, -0x38(%rbp)
jmp 0x12afd5
movq 0x28(%rbp), %rax
movq -0x78(%rbp), %rcx
imulq $0x18, -0x40(%rbp), %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
movzbl (%rax,%rcx), %eax
cmpq -0x28(%rbp), %rax
jne 0x12ae04
movq 0x28(%rbp), %rax
movq -0x78(%rbp), %rcx
imulq $0x18, -0x40(%rbp), %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
movb $0x0, (%rax,%rcx)
movq 0x20(%rbp), %rax
movq -0x78(%rbp), %rcx
imulq $0x18, -0x40(%rbp), %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
xorl $0x1, %ecx
movl %ecx, %ecx
cmpb $0x0, (%rax,%rcx)
jne 0x12ae02
jmp 0x12ad61
movq 0x10(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x12add2
movq 0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x12ad91
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x90(%rbp)
jmp 0x12ad9f
movl $0x2, %eax
movq %rax, -0x90(%rbp)
jmp 0x12ad9f
movq -0x90(%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 $0x2, %rsi
callq 0x2360
movq %rax, %rcx
movq 0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x78(%rbp), %rax
imulq $0x18, -0x40(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %edx
xorl $0x1, %edx
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x10(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movl %edx, (%rax,%rcx,4)
jmp 0x12ae02
jmp 0x12ae04
movq 0x28(%rbp), %rax
movq -0x78(%rbp), %rcx
imulq $0x18, -0x40(%rbp), %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
xorl $0x1, %ecx
movl %ecx, %ecx
movzbl (%rax,%rcx), %eax
cmpq -0x30(%rbp), %rax
jne 0x12af05
movq 0x28(%rbp), %rax
movq -0x78(%rbp), %rcx
imulq $0x18, -0x40(%rbp), %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
xorl $0x1, %ecx
movl %ecx, %ecx
movb $0x0, (%rax,%rcx)
movq 0x20(%rbp), %rax
movq -0x78(%rbp), %rcx
imulq $0x18, -0x40(%rbp), %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
cmpb $0x0, (%rax,%rcx)
jne 0x12af03
jmp 0x12ae65
movq 0x10(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x12aed6
movq 0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x12ae95
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x98(%rbp)
jmp 0x12aea3
movl $0x2, %eax
movq %rax, -0x98(%rbp)
jmp 0x12aea3
movq -0x98(%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 $0x2, %rsi
callq 0x2360
movq %rax, %rcx
movq 0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x78(%rbp), %rax
imulq $0x18, -0x40(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %edx
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x10(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movl %edx, (%rax,%rcx,4)
jmp 0x12af03
jmp 0x12af05
movq 0x20(%rbp), %rax
movq -0x78(%rbp), %rcx
imulq $0x18, -0x40(%rbp), %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
cmpb $0x0, (%rax,%rcx)
jne 0x12afc2
jmp 0x12af24
movq 0x10(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x12af95
movq 0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x12af54
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0xa0(%rbp)
jmp 0x12af62
movl $0x2, %eax
movq %rax, -0xa0(%rbp)
jmp 0x12af62
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 $0x2, %rsi
callq 0x2360
movq %rax, %rcx
movq 0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x78(%rbp), %rax
imulq $0x18, -0x40(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %edx
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x10(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movl %edx, (%rax,%rcx,4)
jmp 0x12afc2
jmp 0x12afc4
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x12aca1
cmpq $0x0, -0x38(%rbp)
je 0x12afe1
jmp 0x12b650
jmp 0x12afe3
jmp 0x12afe5
movq -0x48(%rbp), %rax
xorq $0x1, %rax
movq %rax, -0x48(%rbp)
movq 0x20(%rbp), %rax
movq -0x48(%rbp), %rcx
cmpb $0x0, (%rax,%rcx)
jne 0x12b3bd
movq -0x48(%rbp), %rax
movl -0x18(%rbp), %ecx
xorl $0x1, %ecx
movl %ecx, %ecx
cmpq %rcx, %rax
je 0x12b3bd
movq -0x48(%rbp), %rax
movl -0x1c(%rbp), %ecx
cmpq %rcx, %rax
je 0x12b3bd
movq 0x28(%rbp), %rax
movq -0x48(%rbp), %rcx
xorq $0x1, %rcx
movzbl (%rax,%rcx), %eax
cmpq -0x28(%rbp), %rax
je 0x12b3bb
movq 0x28(%rbp), %rax
movq -0x48(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cmpq -0x30(%rbp), %rax
je 0x12b3bb
movq 0x20(%rbp), %rax
movq -0x48(%rbp), %rcx
movb $0x1, (%rax,%rcx)
movq 0x18(%rbp), %rax
movq (%rax), %rax
movq 0x18(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x12b0d5
movq 0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x12b094
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0xa8(%rbp)
jmp 0x12b0a2
movl $0x2, %eax
movq %rax, -0xa8(%rbp)
jmp 0x12b0a2
movq -0xa8(%rbp), %rcx
movq 0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x2, %rsi
callq 0x2360
movq %rax, %rcx
movq 0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x48(%rbp), %rax
movl %eax, %edx
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x18(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movl %edx, (%rax,%rcx,4)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x28(%rcx), %rcx
movq -0x48(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x78(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x48(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movq %rax, -0x68(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x68(%rbp), %rax
jae 0x12b3ad
movq -0x78(%rbp), %rax
imulq $0x18, -0x40(%rbp), %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x12b166
jmp 0x12b39c
movq -0x78(%rbp), %rax
imulq $0x18, -0x40(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
cmpl -0x18(%rbp), %eax
je 0x12b193
movq -0x78(%rbp), %rax
imulq $0x18, -0x40(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl -0x1c(%rbp), %ecx
xorl $0x1, %ecx
cmpl %ecx, %eax
jne 0x12b1a0
movq $0x1, -0x38(%rbp)
jmp 0x12b3ad
movq 0x28(%rbp), %rax
movq -0x78(%rbp), %rcx
imulq $0x18, -0x40(%rbp), %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
movzbl (%rax,%rcx), %eax
cmpq -0x28(%rbp), %rax
jne 0x12b29f
movq 0x28(%rbp), %rax
movq -0x78(%rbp), %rcx
imulq $0x18, -0x40(%rbp), %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
movb $0x0, (%rax,%rcx)
movq 0x20(%rbp), %rax
movq -0x78(%rbp), %rcx
imulq $0x18, -0x40(%rbp), %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
xorl $0x1, %ecx
movl %ecx, %ecx
cmpb $0x0, (%rax,%rcx)
jne 0x12b29d
jmp 0x12b1fc
movq 0x10(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x12b26d
movq 0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x12b22c
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0xb0(%rbp)
jmp 0x12b23a
movl $0x2, %eax
movq %rax, -0xb0(%rbp)
jmp 0x12b23a
movq -0xb0(%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 $0x2, %rsi
callq 0x2360
movq %rax, %rcx
movq 0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x78(%rbp), %rax
imulq $0x18, -0x40(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %edx
xorl $0x1, %edx
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x10(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movl %edx, (%rax,%rcx,4)
jmp 0x12b29d
jmp 0x12b29f
movq 0x28(%rbp), %rax
movq -0x78(%rbp), %rcx
imulq $0x18, -0x40(%rbp), %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
xorl $0x1, %ecx
movl %ecx, %ecx
movzbl (%rax,%rcx), %eax
cmpq -0x30(%rbp), %rax
jne 0x12b2dd
movq 0x28(%rbp), %rax
movq -0x78(%rbp), %rcx
imulq $0x18, -0x40(%rbp), %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
xorl $0x1, %ecx
movl %ecx, %ecx
movb $0x0, (%rax,%rcx)
movq 0x20(%rbp), %rax
movq -0x78(%rbp), %rcx
imulq $0x18, -0x40(%rbp), %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
cmpb $0x0, (%rax,%rcx)
jne 0x12b39a
jmp 0x12b2fc
movq 0x10(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x12b36d
movq 0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x12b32c
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0xb8(%rbp)
jmp 0x12b33a
movl $0x2, %eax
movq %rax, -0xb8(%rbp)
jmp 0x12b33a
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 $0x2, %rsi
callq 0x2360
movq %rax, %rcx
movq 0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x78(%rbp), %rax
imulq $0x18, -0x40(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %edx
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x10(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movl %edx, (%rax,%rcx,4)
jmp 0x12b39a
jmp 0x12b39c
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x12b13c
cmpq $0x0, -0x38(%rbp)
je 0x12b3b9
jmp 0x12b650
jmp 0x12b3bb
jmp 0x12b3bd
movq 0x20(%rbp), %rax
movq -0x48(%rbp), %rcx
cmpb $0x0, (%rax,%rcx)
je 0x12b63f
movq 0x20(%rbp), %rax
movq -0x48(%rbp), %rcx
xorq $0x1, %rcx
cmpb $0x0, (%rax,%rcx)
je 0x12b63f
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x28(%rcx), %rcx
movq -0x48(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x78(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x48(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movq %rax, -0x68(%rbp)
movq $0x0, -0x50(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x68(%rbp), %rax
jae 0x12b4dd
movq -0x78(%rbp), %rax
imulq $0x18, -0x40(%rbp), %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x12b459
jmp 0x12b4cc
movq 0x20(%rbp), %rax
movq -0x78(%rbp), %rcx
imulq $0x18, -0x40(%rbp), %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
xorl $0x1, %ecx
movl %ecx, %ecx
cmpb $0x0, (%rax,%rcx)
je 0x12b4ca
movq 0x20(%rbp), %rax
movq -0x78(%rbp), %rcx
imulq $0x18, -0x40(%rbp), %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
cmpb $0x0, (%rax,%rcx)
je 0x12b4ca
movq -0x50(%rbp), %rax
movq -0x78(%rbp), %rcx
imulq $0x18, -0x40(%rbp), %rdx
addq %rdx, %rcx
movl 0xc(%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movl %ecx, %ecx
cmpq %rcx, %rax
jae 0x12b4ca
movq -0x78(%rbp), %rax
imulq $0x18, -0x40(%rbp), %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
movq %rax, -0x50(%rbp)
jmp 0x12b4cc
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x12b432
movq -0x50(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x28(%rcx), %rcx
movq -0x48(%rbp), %rdx
xorq $0x1, %rdx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x78(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x48(%rbp), %rcx
xorq $0x1, %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movq %rax, -0x68(%rbp)
movq $0x0, -0x50(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x68(%rbp), %rax
jae 0x12b5e5
movq -0x78(%rbp), %rax
imulq $0x18, -0x40(%rbp), %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x12b561
jmp 0x12b5d4
movq 0x20(%rbp), %rax
movq -0x78(%rbp), %rcx
imulq $0x18, -0x40(%rbp), %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
xorl $0x1, %ecx
movl %ecx, %ecx
cmpb $0x0, (%rax,%rcx)
je 0x12b5d2
movq 0x20(%rbp), %rax
movq -0x78(%rbp), %rcx
imulq $0x18, -0x40(%rbp), %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
cmpb $0x0, (%rax,%rcx)
je 0x12b5d2
movq -0x50(%rbp), %rax
movq -0x78(%rbp), %rcx
imulq $0x18, -0x40(%rbp), %rdx
addq %rdx, %rcx
movl 0xc(%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movl %ecx, %ecx
cmpq %rcx, %rax
jae 0x12b5d2
movq -0x78(%rbp), %rax
imulq $0x18, -0x40(%rbp), %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
movq %rax, -0x50(%rbp)
jmp 0x12b5d4
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x12b53a
movq -0x50(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rax
addq -0x60(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x20(%rcx), %rcx
movq -0x48(%rbp), %rdx
shrq %rdx
movl (%rcx,%rdx,8), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movl %ecx, %ecx
cmpq %rcx, %rax
jae 0x12b63d
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x48(%rbp), %rcx
shrq %rcx
movl (%rax,%rcx,8), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
subq -0x58(%rbp), %rax
subq -0x60(%rbp), %rax
addq -0x70(%rbp), %rax
movq %rax, -0x70(%rbp)
jmp 0x12b63f
movq -0x70(%rbp), %rax
cmpq 0x30(%rbp), %rax
jbe 0x12b64b
jmp 0x12b650
jmp 0x12aafd
cmpq $0x0, -0x38(%rbp)
jne 0x12b66b
movq -0x70(%rbp), %rax
cmpq 0x30(%rbp), %rax
ja 0x12b66b
movq -0x70(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x12b673
movq $-0x1, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xc0, %rsp
popq %rbp
retq