// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/Correct.cpp
// Function: generate_seq_from_node(Graph*, Node*, int)
inline void generate_seq_from_node(Graph* DAGCon, Node* node, int direction)
{
    clear_Queue(&(DAGCon->node_q));
    RSet iter;
    uint64_t max;
    Node* max_node = NULL;
    Node* getNodes = 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(getOutputNodes(&iter, DAGCon, node, &getNodes))
            {
                if(getNodes->weight > max)
                {
                    max = getNodes->weight;
                    max_node = getNodes;
                }
            }
            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(getInputNodes(&iter, DAGCon, node, &getNodes))
            {
                if(getNodes->weight > max)
                {
                    max = getNodes->weight;
                    max_node = getNodes;
                }
            }
            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 0x86f3e
cmpq 0xa8(%rbx), %rax
je 0x86ee5
xorl %r12d, %r12d
xorl %r13d, %r13d
movsbq 0x18(%r14), %rbp
movq 0x78(%rbx), %r15
movq 0x88(%rbx), %rsi
cmpq %rsi, %r15
jl 0x86e33
movq (%rsp), %rax
movq (%rax), %rax
testq %rax, %rax
je 0x86df3
subq %rax, %r15
leaq (,%r15,8), %rdx
cmpq %rax, %r15
jle 0x86e17
movq 0x90(%rbx), %rdi
leaq (%rdi,%rax,8), %rsi
callq 0x2360
jmp 0x86e27
leaq (%rsi,%rsi), %rax
movq %rax, 0x88(%rbx)
movq 0x90(%rbx), %rdi
shlq $0x4, %rsi
callq 0x2370
movq %rax, 0x90(%rbx)
jmp 0x86e33
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 0x86ebb
movq 0x60(%r14), %r8
imulq $0x38, %rdx, %r9
movb $0x1, %dil
cmpq $-0x1, 0x8(%r8,%r9)
je 0x86e72
movb $0x1, %r9b
jmp 0x86e92
addq %r8, %r9
addq $0x40, %r9
cmpq %rdx, %rcx
je 0x86eb8
incq %rdx
cmpq $-0x1, (%r9)
leaq 0x38(%r9), %r9
je 0x86e79
cmpq %rax, %rdx
setl %r9b
testb %r9b, %r9b
je 0x86ebb
imulq $0x38, %rdx, %r9
cmpq $-0x1, 0x8(%r8,%r9)
je 0x86ebb
addq %r9, %r8
movq (%r8), %r13
shlq $0x7, %r13
addq 0x18(%rbx), %r13
incq %rdx
xorl %edi, %edi
jmp 0x86ebb
movq %rax, %rdx
testb %dil, %dil
jne 0x86ed1
movq 0x8(%r13), %rdi
cmpq %rsi, %rdi
cmovaq %r13, %r12
cmovaq %rdi, %rsi
jmp 0x86e52
movq (%r12), %rax
movq %r12, %r14
cmpq 0xa8(%rbx), %rax
jne 0x86db0
movq 0x70(%rbx), %rcx
movq 0x78(%rbx), %rdx
movq %rdx, %rsi
subq %rcx, %rsi
cmpq $0x2, %rsi
jl 0x8707d
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 0x86f1f
jmp 0x8707d
cmpq 0xb0(%rbx), %rax
je 0x8707d
xorl %r12d, %r12d
xorl %r13d, %r13d
movsbq 0x18(%r14), %rbp
movq 0x78(%rbx), %r15
movq 0x88(%rbx), %rsi
cmpq %rsi, %r15
jl 0x86fd4
movq (%rsp), %rax
movq (%rax), %rax
testq %rax, %rax
je 0x86f94
subq %rax, %r15
leaq (,%r15,8), %rdx
cmpq %rax, %r15
jle 0x86fb8
movq 0x90(%rbx), %rdi
leaq (%rdi,%rax,8), %rsi
callq 0x2360
jmp 0x86fc8
leaq (%rsi,%rsi), %rax
movq %rax, 0x88(%rbx)
movq 0x90(%rbx), %rdi
shlq $0x4, %rsi
callq 0x2370
movq %rax, 0x90(%rbx)
jmp 0x86fd4
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 0x87053
movq 0x40(%r14), %r9
imulq $0x38, %rdx, %r10
movq 0x8(%r9,%r10), %r8
movb $0x1, %dil
cmpq $-0x1, %r8
je 0x87016
movb $0x1, %r9b
jmp 0x87039
addq %r10, %r9
addq $0x40, %r9
cmpq %rdx, %rcx
je 0x87050
movq (%r9), %r8
addq $0x38, %r9
incq %rdx
cmpq $-0x1, %r8
je 0x8701d
cmpq %rax, %rdx
setl %r9b
testb %r9b, %r9b
je 0x87053
shlq $0x7, %r8
addq 0x18(%rbx), %r8
incq %rdx
xorl %edi, %edi
movq %r8, %r13
jmp 0x87053
movq %rax, %rdx
testb %dil, %dil
jne 0x87069
movq 0x8(%r13), %rdi
cmpq %rsi, %rdi
cmovaq %r13, %r12
cmovaq %rdi, %rsi
jmp 0x86ff3
movq (%r12), %rax
movq %r12, %r14
cmpq 0xb0(%rbx), %rax
jne 0x86f51
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq