// File: 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
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rdi
addq $0x70, %rdi
callq 0x2c900
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
cmpl $0x0, -0x14(%rbp)
jne 0xa00c7
jmp 0xa003c
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0xb0(%rcx), %rax
je 0xa00c2
movq -0x8(%rbp), %rdi
addq $0x70, %rdi
movq -0x10(%rbp), %rax
movsbq 0x18(%rax), %rsi
callq 0xc3300
leaq -0x20(%rbp), %rdi
callq 0x2cce0
movq $0x0, -0x28(%rbp)
movq -0x8(%rbp), %rsi
movq -0x10(%rbp), %rdx
leaq -0x20(%rbp), %rdi
leaq -0x38(%rbp), %rcx
callq 0x9f8b0
cmpl $0x0, %eax
je 0xa00b5
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
cmpq -0x28(%rbp), %rax
jbe 0xa00b3
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x30(%rbp)
jmp 0xa0077
movq -0x30(%rbp), %rax
movq %rax, -0x10(%rbp)
jmp 0xa003c
jmp 0xa01fd
jmp 0xa00c9
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0xa8(%rcx), %rax
je 0xa014f
movq -0x8(%rbp), %rdi
addq $0x70, %rdi
movq -0x10(%rbp), %rax
movsbq 0x18(%rax), %rsi
callq 0xc3300
leaq -0x20(%rbp), %rdi
callq 0x2cce0
movq $0x0, -0x28(%rbp)
movq -0x8(%rbp), %rsi
movq -0x10(%rbp), %rdx
leaq -0x20(%rbp), %rdi
leaq -0x38(%rbp), %rcx
callq 0x9fb50
cmpl $0x0, %eax
je 0xa0142
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
cmpq -0x28(%rbp), %rax
jbe 0xa0140
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x30(%rbp)
jmp 0xa0104
movq -0x30(%rbp), %rax
movq %rax, -0x10(%rbp)
jmp 0xa00c9
movq -0x8(%rbp), %rax
movq 0x78(%rax), %rax
movq -0x8(%rbp), %rcx
subq 0x70(%rcx), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movl $0x2, %ecx
cqto
idivq %rcx
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rax
movq 0x90(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x70(%rcx), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x58(%rbp), %rax
jge 0xa01fb
movq -0x60(%rbp), %rax
movq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x48(%rbp)
movq -0x60(%rbp), %rax
movq -0x50(%rbp), %rcx
subq -0x40(%rbp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rdx
movq -0x60(%rbp), %rax
movq -0x40(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x48(%rbp), %rdx
movq -0x60(%rbp), %rax
movq -0x50(%rbp), %rcx
subq -0x40(%rbp), %rcx
subq $0x1, %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0xa019b
jmp 0xa01fd
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)