// File: /workspace/github_c_makefile_star2_O2/sachinites[P]CommandParser/cmd_hier.c
// Function: build_cmd_tree_leaves_data
void
build_cmd_tree_leaves_data(ser_buff_t *tlv_buff,/*Output serialize buffer*/
        param_t *src_param, /*Source command*/
        param_t *dst_param){/*Destination command*/

    assert(tlv_buff);
    assert(src_param);
    assert(dst_param);

    tlv_struct_t tlv, *tlv_temp = NULL;
    unsigned int tlv_units = 0, i = 0, j = 0;

    memset(&tlv, 0, sizeof(tlv_struct_t));
    reset_serialize_buffer(tlv_buff);

    while(dst_param != src_param){
        if(IS_PARAM_CMD(dst_param)){
            dst_param = dst_param->parent;
            continue;
        }

        prepare_tlv_from_leaf(GET_PARAM_LEAF(dst_param), (&tlv));
        put_value_in_tlv((&tlv), GET_LEAF_VALUE_PTR(dst_param)); 
        collect_tlv(tlv_buff, &tlv);
        memset(&tlv, 0, sizeof(tlv_struct_t));

        dst_param = dst_param->parent;
    }

    if(IS_PARAM_LEAF(dst_param)){
        prepare_tlv_from_leaf(GET_PARAM_LEAF(dst_param), (&tlv));
        put_value_in_tlv((&tlv), GET_LEAF_VALUE_PTR(dst_param)); 
        collect_tlv(tlv_buff, &tlv);
    }

    /*Now reverse the TLV buffer*/
    if(get_serialize_buffer_size(tlv_buff) < (sizeof(tlv_struct_t) << 1)){
        return;
    }

    tlv_units = get_serialize_buffer_size(tlv_buff)/sizeof(tlv_struct_t);
    tlv_temp = (tlv_struct_t *)(tlv_buff->b);
    j = tlv_units -1;

    for(; i < (tlv_units >> 1); i++, j--){
        swap_tlv_units(tlv_temp+i, tlv_temp +j);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
testq %rdi, %rdi
je 0x3093
movq %rsi, %r13
testq %rsi, %rsi
je 0x30b2
movq %rdx, %r14
testq %rdx, %rdx
je 0x30d1
movq %rdi, %rbx
xorps %xmm0, %xmm0
leaq 0x14(%rsp), %r12
movaps %xmm0, 0x4c(%r12)
movaps %xmm0, 0x3c(%r12)
movaps %xmm0, 0x2c(%r12)
movaps %xmm0, 0x1c(%r12)
movaps %xmm0, 0xc(%r12)
movaps %xmm0, -0x4(%r12)
andl $0x0, 0x5c(%r12)
callq 0x45de
pushq $0x64
popq %r15
movl (%r14), %eax
cmpq %r13, %r14
je 0x2f82
testl %eax, %eax
je 0x2f76
movq 0x8(%r14), %rbp
movl (%rbp), %eax
movl %eax, 0x10(%rsp)
addq $0x50, %rbp
movq %rbp, %rdi
callq 0x10c0
cmpq $0x20, %rax
jb 0x2f09
pushq $0x20
popq %rax
movq %r12, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0x1060
movq 0x8(%r14), %rbp
addq $0x4, %rbp
movq %rbp, %rdi
callq 0x10c0
cmpq $0x40, %rax
jb 0x2f30
pushq $0x40
popq %rax
leaq 0x34(%rsp), %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0x1060
movq %rbx, %rdi
leaq 0x10(%rsp), %rsi
movl %r15d, %edx
callq 0x43d2
xorps %xmm0, %xmm0
movaps %xmm0, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
andl $0x0, 0x70(%rsp)
movq 0xe0(%r14), %r14
jmp 0x2ed5
cmpl $0x1, %eax
jne 0x2fef
movq 0x8(%r14), %r13
movl (%r13), %eax
leaq 0x10(%rsp), %r15
movl %eax, (%r15)
addq $0x50, %r13
movq %r13, %rdi
callq 0x10c0
cmpq $0x20, %rax
pushq $0x20
popq %rdx
cmovbq %rax, %rdx
movq %r12, %rdi
movq %r13, %rsi
callq 0x1060
movq 0x8(%r14), %r14
addq $0x4, %r14
movq %r14, %rdi
callq 0x10c0
cmpq $0x40, %rax
pushq $0x40
popq %rdx
cmovbq %rax, %rdx
leaq 0x34(%rsp), %rdi
movq %r14, %rsi
callq 0x1060
pushq $0x64
popq %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x43d2
movq %rbx, %rdi
callq 0x3fde
cmpl $0xc8, %eax
jae 0x3010
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
callq 0x3fde
cltq
xorl %ebp, %ebp
pushq $0x64
popq %rcx
xorl %edx, %edx
divq %rcx
movq %rax, %r15
movq (%rbx), %rax
movq %rax, (%rsp)
movl %r15d, %eax
shrl %eax
imulq $0x64, %rax, %rax
movq %rax, 0x8(%rsp)
decl %r15d
pushq $0x64
popq %rbx
cmpq %rbp, 0x8(%rsp)
je 0x2ffe
movq (%rsp), %rcx
leaq (%rcx,%rbp), %r12
movl %r15d, %eax
imulq $0x64, %rax, %r13
addq %rcx, %r13
leaq 0x74(%rsp), %r14
movq %r14, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x1190
movq %r12, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x1190
movq %r13, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x1190
addq $0x64, %rbp
decl %r15d
jmp 0x3042
leaq 0x48a2(%rip), %rdi      # 0x793c
leaq 0x41ff(%rip), %rsi      # 0x72a0
leaq 0x489d(%rip), %rcx      # 0x7945
movl $0x2fb, %edx            # imm = 0x2FB
callq 0x10f0
leaq 0x48d0(%rip), %rdi      # 0x7989
leaq 0x41e0(%rip), %rsi      # 0x72a0
leaq 0x487e(%rip), %rcx      # 0x7945
movl $0x2fc, %edx            # imm = 0x2FC
callq 0x10f0
leaq 0x4812(%rip), %rdi      # 0x78ea
leaq 0x41c1(%rip), %rsi      # 0x72a0
leaq 0x485f(%rip), %rcx      # 0x7945
movl $0x2fd, %edx            # imm = 0x2FD
callq 0x10f0