// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/Correct.cpp
// Function: generate_seq_from_path(Graph*, Node*, int)
inline void generate_seq_from_path(Graph* DAGCon, Node* node, int direction)
{
    clear_Queue(&(DAGCon->node_q));
    RSet iter;
    Edge* e = NULL;
    uint64_t max;
    Node* max_node = NULL;
    

    if(direction == 0)
    {
        while (node->ID != DAGCon->s_end_nodeID)
        {
            push_to_Queue(&(DAGCon->node_q), node->base);
            clear_RSet(&iter);
            max = 0;
            while(getOutputEdges(&iter, DAGCon, node, &e))
            {
                if(e->weight > max)
                {
                    max = e->weight;
                    max_node = &(G_Node(*DAGCon, e->out_node));
                }
            }
            node = max_node;
        }
    }
    else
    {
        while (node->ID != DAGCon->s_start_nodeID)
        {
            push_to_Queue(&(DAGCon->node_q), node->base);
            clear_RSet(&iter);
            max = 0;
            while(getInputEdges(&iter, DAGCon, node, &e))
            {
                if(e->weight > max)
                {
                    max = e->weight;
                    max_node = &(G_Node(*DAGCon, e->in_node));
                }
            }
            node = max_node;
        }

        long long i, k;
        long long length = (DAGCon->node_q.end - DAGCon->node_q.beg);
        long long length_ex = length/2;
        long long* array = DAGCon->node_q.buffer + DAGCon->node_q.beg;
        for (i = 0; i < length_ex; i++)
        {
            k = array[i];
            array[i] = array[length - i - 1];
            array[length - i - 1] = k;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x70(%rdi), %rax
movq %rax, (%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x70(%rdi)
movq $0x0, 0x80(%rdi)
movq (%rsi), %rax
testl %edx, %edx
je 0x86c0f
cmpq 0xa8(%rbx), %rax
je 0x86bb6
xorl %r12d, %r12d
xorl %r13d, %r13d
movsbq 0x18(%r14), %rbp
movq 0x78(%rbx), %r15
movq 0x88(%rbx), %rsi
cmpq %rsi, %r15
jl 0x86b03
movq (%rsp), %rax
movq (%rax), %rax
testq %rax, %rax
je 0x86ac3
subq %rax, %r15
leaq (,%r15,8), %rdx
cmpq %rax, %r15
jle 0x86ae7
movq 0x90(%rbx), %rdi
leaq (%rdi,%rax,8), %rsi
callq 0x2360
jmp 0x86af7
leaq (%rsi,%rsi), %rax
movq %rax, 0x88(%rbx)
movq 0x90(%rbx), %rdi
shlq $0x4, %rsi
callq 0x2370
movq %rax, 0x90(%rbx)
jmp 0x86b03
movq 0x90(%rbx), %rdi
leaq (%rdi,%rax,8), %rsi
callq 0x2160
movq $0x0, 0x70(%rbx)
movq %r15, 0x78(%rbx)
movq 0x78(%rbx), %rax
movq 0x90(%rbx), %rcx
movq %rbp, (%rcx,%rax,8)
incq 0x78(%rbx)
movq 0x70(%r14), %rax
leaq -0x1(%rax), %rcx
xorl %edx, %edx
xorl %esi, %esi
movb $0x1, %dil
cmpq %rax, %rdx
jge 0x86b83
movq 0x60(%r14), %r8
imulq $0x38, %rdx, %r9
movb $0x1, %dil
cmpq $-0x1, 0x8(%r8,%r9)
je 0x86b42
movb $0x1, %r9b
jmp 0x86b62
addq %r8, %r9
addq $0x40, %r9
cmpq %rdx, %rcx
je 0x86b80
incq %rdx
cmpq $-0x1, (%r9)
leaq 0x38(%r9), %r9
je 0x86b49
cmpq %rax, %rdx
setl %r9b
testb %r9b, %r9b
je 0x86b83
imulq $0x38, %rdx, %r9
cmpq $-0x1, 0x8(%r8,%r9)
je 0x86b83
addq %r9, %r8
incq %rdx
xorl %edi, %edi
movq %r8, %r13
jmp 0x86b83
movq %rax, %rdx
testb %dil, %dil
jne 0x86ba2
movq 0x10(%r13), %rdi
cmpq %rsi, %rdi
jbe 0x86b22
movq (%r13), %r12
shlq $0x7, %r12
addq 0x18(%rbx), %r12
movq %rdi, %rsi
jmp 0x86b22
movq (%r12), %rax
movq %r12, %r14
cmpq 0xa8(%rbx), %rax
jne 0x86a80
movq 0x70(%rbx), %rcx
movq 0x78(%rbx), %rdx
movq %rdx, %rsi
subq %rcx, %rsi
cmpq $0x2, %rsi
jl 0x86d58
movq %rsi, %rax
shrq $0x3f, %rax
addq %rsi, %rax
sarq %rax
movq 0x90(%rbx), %rsi
leaq (%rsi,%rcx,8), %rcx
leaq (%rsi,%rdx,8), %rdx
addq $-0x8, %rdx
xorl %esi, %esi
movq (%rcx,%rsi,8), %rdi
movq (%rdx), %r8
movq %r8, (%rcx,%rsi,8)
movq %rdi, (%rdx)
incq %rsi
addq $-0x8, %rdx
cmpq %rsi, %rax
jne 0x86bf0
jmp 0x86d58
cmpq 0xb0(%rbx), %rax
je 0x86d58
xorl %r12d, %r12d
xorl %r13d, %r13d
movsbq 0x18(%r14), %rbp
movq 0x78(%rbx), %r15
movq 0x88(%rbx), %rsi
cmpq %rsi, %r15
jl 0x86ca5
movq (%rsp), %rax
movq (%rax), %rax
testq %rax, %rax
je 0x86c65
subq %rax, %r15
leaq (,%r15,8), %rdx
cmpq %rax, %r15
jle 0x86c89
movq 0x90(%rbx), %rdi
leaq (%rdi,%rax,8), %rsi
callq 0x2360
jmp 0x86c99
leaq (%rsi,%rsi), %rax
movq %rax, 0x88(%rbx)
movq 0x90(%rbx), %rdi
shlq $0x4, %rsi
callq 0x2370
movq %rax, 0x90(%rbx)
jmp 0x86ca5
movq 0x90(%rbx), %rdi
leaq (%rdi,%rax,8), %rsi
callq 0x2160
movq $0x0, 0x70(%rbx)
movq %r15, 0x78(%rbx)
movq 0x78(%rbx), %rax
movq 0x90(%rbx), %rcx
movq %rbp, (%rcx,%rax,8)
incq 0x78(%rbx)
movq 0x50(%r14), %rax
leaq -0x1(%rax), %rcx
xorl %edx, %edx
xorl %esi, %esi
movb $0x1, %dil
cmpq %rax, %rdx
jge 0x86d25
movq 0x40(%r14), %r8
imulq $0x38, %rdx, %r9
movb $0x1, %dil
cmpq $-0x1, 0x8(%r8,%r9)
je 0x86ce4
movb $0x1, %r9b
jmp 0x86d04
addq %r8, %r9
addq $0x40, %r9
cmpq %rdx, %rcx
je 0x86d22
incq %rdx
cmpq $-0x1, (%r9)
leaq 0x38(%r9), %r9
je 0x86ceb
cmpq %rax, %rdx
setl %r9b
testb %r9b, %r9b
je 0x86d25
imulq $0x38, %rdx, %r9
cmpq $-0x1, 0x8(%r8,%r9)
je 0x86d25
addq %r9, %r8
incq %rdx
xorl %edi, %edi
movq %r8, %r13
jmp 0x86d25
movq %rax, %rdx
testb %dil, %dil
jne 0x86d44
movq 0x10(%r13), %rdi
cmpq %rsi, %rdi
jbe 0x86cc4
movq 0x8(%r13), %r12
shlq $0x7, %r12
addq 0x18(%rbx), %r12
movq %rdi, %rsi
jmp 0x86cc4
movq (%r12), %rax
movq %r12, %r14
cmpq 0xb0(%rbx), %rax
jne 0x86c22
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq