// File: /workspace/github_cpp_makefile_star2_O3/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), %r15
xorps %xmm0, %xmm0
movups %xmm0, 0x70(%rdi)
movq $0x0, 0x80(%rdi)
movq (%rsi), %rax
testl %edx, %edx
je 0x860d1
cmpq 0xa8(%rbx), %rax
jne 0x861e7
movq 0x90(%rbx), %rax
xorl %edx, %edx
xorl %r12d, %r12d
jmp 0x862ed
cmpq 0xb0(%rbx), %rax
je 0x8632e
xorl %r13d, %r13d
xorl %r12d, %r12d
movsbq 0x18(%r14), %rbp
movq 0x88(%rbx), %rsi
cmpq %rsi, %r13
jl 0x86158
movq (%r15), %rax
testq %rax, %rax
je 0x8611f
subq %rax, %r13
leaq (,%r13,8), %rdx
movq 0x90(%rbx), %rdi
leaq (%rdi,%rax,8), %rsi
cmpq %rax, %r13
jle 0x86147
callq 0x2360
jmp 0x8614c
leaq (%rsi,%rsi), %rax
movq %rax, 0x88(%rbx)
movq 0x90(%rbx), %rdi
shlq $0x4, %rsi
callq 0x2370
movq %rax, 0x90(%rbx)
movq 0x78(%rbx), %r13
jmp 0x86158
callq 0x2160
movq $0x0, 0x70(%rbx)
movq %r13, 0x78(%rbx)
movq 0x90(%rbx), %rax
movq %rbp, (%rax,%r13,8)
movq 0x78(%rbx), %r13
incq %r13
movq %r13, 0x78(%rbx)
movq 0x50(%r14), %rax
testq %rax, %rax
jle 0x861ce
movq 0x40(%r14), %rcx
addq $0x10, %rcx
movq %rax, %rdx
negq %rdx
xorl %edi, %edi
xorl %esi, %esi
imulq $0x38, %rsi, %r8
addq %rcx, %r8
incq %rsi
movq -0x8(%r8), %r9
cmpq $-0x1, %r9
jne 0x861b3
addq $0x38, %r8
leaq (%rdx,%rsi), %r9
incq %r9
incq %rsi
cmpq $0x1, %r9
jne 0x86193
jmp 0x861ce
movq (%r8), %r8
cmpq %rdi, %r8
jbe 0x861c9
shlq $0x7, %r9
addq 0x18(%rbx), %r9
movq %r9, %r12
movq %r8, %rdi
cmpq %rax, %rsi
jl 0x86189
movq (%r12), %rax
movq %r12, %r14
cmpq 0xb0(%rbx), %rax
jne 0x860e4
jmp 0x8632e
xorl %r12d, %r12d
xorl %r13d, %r13d
movsbq 0x18(%r14), %rbp
movq 0x88(%rbx), %rsi
cmpq %rsi, %r12
jl 0x86261
movq (%r15), %rax
testq %rax, %rax
je 0x86228
subq %rax, %r12
leaq (,%r12,8), %rdx
movq 0x90(%rbx), %rdi
leaq (%rdi,%rax,8), %rsi
cmpq %rax, %r12
jle 0x86250
callq 0x2360
jmp 0x86255
leaq (%rsi,%rsi), %rax
movq %rax, 0x88(%rbx)
movq 0x90(%rbx), %rdi
shlq $0x4, %rsi
callq 0x2370
movq %rax, 0x90(%rbx)
movq 0x78(%rbx), %r12
jmp 0x86261
callq 0x2160
movq $0x0, 0x70(%rbx)
movq %r12, 0x78(%rbx)
movq 0x90(%rbx), %rax
movq %rbp, (%rax,%r12,8)
movq 0x78(%rbx), %r12
incq %r12
movq %r12, 0x78(%rbx)
movq 0x70(%r14), %rcx
testq %rcx, %rcx
jle 0x862d6
movq 0x60(%r14), %rdx
addq $0x10, %rdx
movq %rcx, %rsi
negq %rsi
xorl %r8d, %r8d
xorl %edi, %edi
imulq $0x38, %rdi, %r9
incq %rdi
addq %rdx, %r9
cmpq $-0x1, -0x8(%r9)
jne 0x862ba
addq $0x38, %r9
leaq (%rsi,%rdi), %r10
incq %r10
incq %rdi
cmpq $0x1, %r10
jne 0x8629d
jmp 0x862d6
movq (%r9), %r10
cmpq %r8, %r10
jbe 0x862d1
movq -0x10(%r9), %r13
shlq $0x7, %r13
addq 0x18(%rbx), %r13
movq %r10, %r8
cmpq %rcx, %rdi
jl 0x86293
movq (%r13), %rcx
movq %r13, %r14
cmpq 0xa8(%rbx), %rcx
jne 0x861ed
movq (%r15), %rdx
movq %r12, %rsi
subq %rdx, %rsi
cmpq $0x2, %rsi
jl 0x8632e
movq %rsi, %rcx
shrq $0x3f, %rcx
addq %rsi, %rcx
sarq %rcx
leaq (%rax,%rdx,8), %rdx
leaq (%rax,%r12,8), %rax
addq $-0x8, %rax
xorl %esi, %esi
movq (%rdx,%rsi,8), %rdi
movq (%rax), %r8
movq %r8, (%rdx,%rsi,8)
movq %rdi, (%rax)
incq %rsi
addq $-0x8, %rax
cmpq %rsi, %rcx
jne 0x86314
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq