// File: /workspace/github_cpp_makefile_star2_O2/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
subq $0x18, %rsp
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x70(%rdi), %rax
movq %rax, 0x10(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x70(%rdi)
andq $0x0, 0x80(%rdi)
andq $0x0, (%rsp)
xorl %ebp, %ebp
leaq 0x8(%rsp), %r12
movq %rsp, %r13
testl %edx, %edx
je 0x52bb5
movq (%r15), %rax
cmpq 0xa8(%rbx), %rax
je 0x52bd0
movsbq 0x18(%r15), %rsi
movq 0x10(%rsp), %rdi
callq 0x63770
andq $0x0, 0x8(%rsp)
xorl %r14d, %r14d
movq %r12, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq %r13, %rcx
callq 0x18a44
testl %eax, %eax
je 0x52b62
movq (%rsp), %rcx
movq 0x10(%rcx), %rax
cmpq %r14, %rax
jbe 0x52b30
movq (%rcx), %rbp
shlq $0x7, %rbp
addq 0x18(%rbx), %rbp
movq %rax, %r14
jmp 0x52b30
movq %rbp, %r15
jmp 0x52b08
movsbq 0x18(%r15), %rsi
movq 0x10(%rsp), %rdi
callq 0x63770
andq $0x0, 0x8(%rsp)
xorl %r14d, %r14d
movq %r12, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq %r13, %rcx
callq 0x52a35
testl %eax, %eax
je 0x52bb2
movq (%rsp), %rcx
movq 0x10(%rcx), %rax
cmpq %r14, %rax
jbe 0x52b7f
movq 0x8(%rcx), %rbp
shlq $0x7, %rbp
addq 0x18(%rbx), %rbp
movq %rax, %r14
jmp 0x52b7f
movq %rbp, %r15
movq (%r15), %rax
cmpq 0xb0(%rbx), %rax
jne 0x52b67
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x70(%rbx), %rcx
movq 0x78(%rbx), %rsi
movq %rsi, %rax
subq %rcx, %rax
pushq $0x2
popq %rdi
cqto
idivq %rdi
movq 0x90(%rbx), %rdi
leaq (%rdi,%rcx,8), %rcx
xorl %edx, %edx
testq %rax, %rax
cmovleq %rdx, %rax
leaq (%rdi,%rsi,8), %rsi
addq $-0x8, %rsi
cmpq %rdx, %rax
je 0x52bc1
movq (%rcx,%rdx,8), %rdi
movq (%rsi), %r8
movq %r8, (%rcx,%rdx,8)
movq %rdi, (%rsi)
incq %rdx
addq $-0x8, %rsi
jmp 0x52c02