// File: chhylp123[P]hifiasm/gfa_ut.cpp
// Function: push_flex_asg_t(flex_asg_t*, asg_arc_t*)
void push_flex_asg_t(flex_asg_t *fg, asg_arc_t *z)
{
    asg_arc_t *av; uint32_t nv, k, v = z->ul>>32;
    av = asg_arc_a(fg->g, v); nv = asg_arc_n(fg->g, v);
    for (k = 0; k < nv; k++) {
        if(av[k].del) {
            av[k] = *z; 
            if(!(fg->need_srt)) {
                if(k > 0 && av[k].ul < av[k-1].ul) fg->need_srt = 1;
                if(k+1 < nv && av[k].ul > av[k+1].ul) fg->need_srt = 1;
            }
            return;
        }
    }

    k = fg->n; fg->need_srt = 1;
    kv_push(asg_arc_t, *fg, *z); 
    kv_push(uint32_t, fg->pi, fg->idx[v]); fg->idx[v] = k;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
shrq $0x20, %rax
movl %eax, -0x24(%rbp)
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movq 0x8(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x30(%rcx), %rcx
movq 0x28(%rcx), %rcx
movl -0x24(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movq 0x28(%rax), %rax
movl -0x24(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jae 0x319b47
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x319b37
movq -0x10(%rbp), %rcx
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rcx
movq %rcx, 0x10(%rax)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x20(%rax)
jne 0x319b32
cmpl $0x0, -0x20(%rbp)
jbe 0x319af0
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movl -0x20(%rbp), %edx
subl $0x1, %edx
movl %edx, %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
cmpq (%rcx), %rax
jae 0x319af0
movq -0x8(%rbp), %rax
movq $0x1, 0x20(%rax)
movl -0x20(%rbp), %eax
addl $0x1, %eax
cmpl -0x1c(%rbp), %eax
jae 0x319b30
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movl -0x20(%rbp), %edx
addl $0x1, %edx
movl %edx, %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
cmpq (%rcx), %rax
jbe 0x319b30
movq -0x8(%rbp), %rax
movq $0x1, 0x20(%rax)
jmp 0x319b32
jmp 0x319ca8
jmp 0x319b39
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x319a59
movq -0x8(%rbp), %rax
movq 0x60(%rax), %rax
movl %eax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq $0x1, 0x20(%rax)
movq -0x8(%rbp), %rax
movq 0x60(%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0x68(%rcx), %rax
jne 0x319bc4
movq -0x8(%rbp), %rax
cmpq $0x0, 0x68(%rax)
je 0x319b8c
movq -0x8(%rbp), %rax
movq 0x68(%rax), %rax
shlq %rax
movq %rax, -0x30(%rbp)
jmp 0x319b97
movl $0x2, %eax
movq %rax, -0x30(%rbp)
jmp 0x319b97
movq -0x30(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x68(%rax)
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rdi
movq -0x8(%rbp), %rax
imulq $0x18, 0x68(%rax), %rsi
callq 0x2360
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x58(%rax)
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x8(%rbp), %rsi
movq 0x60(%rsi), %rdx
movq %rdx, %rdi
addq $0x1, %rdi
movq %rdi, 0x60(%rsi)
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rcx
movq %rcx, 0x10(%rax)
jmp 0x319c02
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0x48(%rcx), %rax
jne 0x319c6b
movq -0x8(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x319c30
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
shlq %rax
movq %rax, -0x38(%rbp)
jmp 0x319c3b
movl $0x2, %eax
movq %rax, -0x38(%rbp)
jmp 0x319c3b
movq -0x38(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x8(%rbp), %rax
movq 0x50(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rsi
shlq $0x2, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movl -0x24(%rbp), %ecx
movl (%rax,%rcx,4), %edx
movq -0x8(%rbp), %rax
movq 0x50(%rax), %rax
movq -0x8(%rbp), %rsi
movq 0x40(%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, 0x40(%rsi)
movl %edx, (%rax,%rcx,4)
movl -0x20(%rbp), %edx
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movl -0x24(%rbp), %ecx
movl %edx, (%rax,%rcx,4)
addq $0x40, %rsp
popq %rbp
retq
nop