// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/./POA.h
// Function: add_insertionEdge_weight(Graph*, long long, char*, long long)
inline void add_insertionEdge_weight(Graph* g, long long alignNodeID, char* insert, long long insert_length)
{
    
    long long nodeID;
    long long edgeID;
    Edge_alloc* edge = &(g->g_nodes.list[alignNodeID].insertion_edges);

    if (insert_length == 1)
    {
        edgeID = getEdge(g, edge, 1, insert[0]);
        if (edgeID != -1)
        {
            edge->list[edgeID].weight++;
        }
        else ///there is no such edge
        {
            nodeID  = add_Node_Graph(g, insert[0]);
            append_Edge_alloc(edge, alignNodeID, nodeID, 1, 1);
            ///add the new node to alignNodeID by insertion_edges
            //should link to the initial node, instead of the next node of the initial node
            ///append_Edge_alloc(&(g->g_nodes.list[nodeID].insertion_edges), nodeID, alignNodeID + 1, 1, 0);
            append_Edge_alloc(&(g->g_nodes.list[nodeID].insertion_edges), nodeID, alignNodeID, 1, 0);
        }
    }
    else
    {
        ///edgeID = get_insertion_Edges(g, edge, insert_length, insert);
        edgeID = get_insertion_Edges_new(g, alignNodeID, insert_length, insert);
        if (edgeID != -1)
        {
            ///just one outdegree
            edge->list[edgeID].weight++;
        }
        else
        {
            create_insertion_Edges(g, alignNodeID, insert_length, insert);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rdi, %r14
movq 0x18(%rdi), %rax
addq $0x18, %r14
movq %rsi, %rbp
shlq $0x7, %rbp
leaq (%rax,%rbp), %r13
addq $0x60, %r13
cmpq $0x1, %rcx
jne 0x45719
movq %rsi, %rbx
movb (%r15), %cl
movq 0x10(%r13), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
testq %rsi, %rsi
jle 0x457ab
movq (%r13), %rdi
addq $0x20, %rdi
xorl %r8d, %r8d
cmpq $0x1, (%rdi)
jne 0x45708
movq -0x18(%rdi), %r9
shlq $0x7, %r9
cmpb %cl, 0x18(%rax,%r9)
je 0x457a8
incq %r8
addq $0x38, %rdi
cmpq %r8, %rsi
jne 0x456ef
jmp 0x457ab
movq %rcx, %r12
movq %rsi, (%rsp)
movslq %esi, %rsi
shlq $0x7, %rsi
movq 0x70(%rax,%rsi), %rdx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testq %rdx, %rdx
jle 0x45800
addq %rax, %rsi
addq $0x60, %rsi
movq (%rsi), %rdi
xorl %esi, %esi
imulq $0x38, %rsi, %r9
movq 0x20(%rdi,%r9), %r8
testl %r8d, %r8d
je 0x4579e
movslq %r8d, %r10
cmpq %r12, %r10
jne 0x4579e
testl %r8d, %r8d
jle 0x45796
addq %rdi, %r9
movl %r8d, %r11d
andl $0x7fffffff, %r11d      # imm = 0x7FFFFFFF
xorl %r10d, %r10d
movslq 0x8(%r9), %r9
shlq $0x7, %r9
movb 0x18(%rax,%r9), %bl
cmpb (%r15,%r10), %bl
jne 0x45799
movq 0x60(%rax,%r9), %r9
incq %r10
cmpq %r10, %r11
jne 0x45771
movl %r8d, %r10d
jmp 0x45799
xorl %r10d, %r10d
cmpl %r8d, %r10d
je 0x457fe
incq %rsi
cmpq %rdx, %rsi
jne 0x45746
jmp 0x45800
movl %r8d, %edx
cmpl $-0x1, %edx
je 0x457b5
movslq %edx, %rax
jmp 0x45808
movsbl %cl, %esi
movq %r14, %rdi
callq 0x45147
movq %rax, %r15
movl $0x1, %ecx
movl $0x1, %r8d
movq %r13, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x44c37
movq (%r14), %rax
movq %r15, %rcx
shlq $0x7, %rcx
leaq (%rax,%rcx), %rdi
addq $0x60, %rdi
movl $0x1, %ecx
movq %r15, %rsi
movq %rbx, %rdx
jmp 0x458c5
movl %esi, %ecx
cmpl $-0x1, %ecx
je 0x45824
movslq %ecx, %rax
movq (%r13), %rcx
imulq $0x38, %rax, %rax
incq 0x10(%rcx,%rax)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testq %r12, %r12
je 0x45815
movsbl (%r15), %esi
movq %r14, %rdi
callq 0x45147
movq %rax, %r13
movq (%r14), %rax
leaq (%rax,%rbp), %rdi
addq $0x60, %rdi
movl $0x1, %ecx
movq (%rsp), %rsi
movq %r13, %rdx
movq %r12, %r8
callq 0x44c37
cmpq $0x2, %r12
jl 0x458a4
decq %r12
incq %r15
movsbl (%r15), %esi
movq %r14, %rdi
callq 0x45147
movq %rax, %rbp
movq (%r14), %rax
movq %r13, %rcx
shlq $0x7, %rcx
leaq (%rax,%rcx), %rdi
addq $0x60, %rdi
movl $0x1, %ecx
movq %r13, %rsi
movq %rbp, %rdx
movq %r12, %r8
callq 0x44c37
incq %r15
movq %rbp, %r13
decq %r12
jne 0x45863
jmp 0x458a7
movq %r13, %rbp
movq (%r14), %rax
movq %rbp, %rcx
shlq $0x7, %rcx
leaq (%rax,%rcx), %rdi
addq $0x60, %rdi
movl $0x1, %ecx
movq %rbp, %rsi
movq (%rsp), %rdx
xorl %r8d, %r8d
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x44c37
nop