// File: /workspace/github_c_makefile_star2_O1/sachinites[P]CommandParser/cmd_hier.c
// Function: init_param
void
init_param(param_t *param,                               /* pointer to static param_t variable*/
        param_type_t param_type,                         /* CMD|LEAF*/
        char *cmd_name,                                  /* <command name> | NULL*/
        cmd_callback callback,                           /* Callback field*/
        user_validation_callback user_validation_cb_fn,  /* NULL | <callback ptr>*/
        leaf_type_t leaf_type,                           /* INVALID | leaf type*/
        char *leaf_id,                                   /* NULL, <STRING>*/
        char *help){                                     /* Help String*/

    int i = 0;
    if(param_type == CMD){
        GET_PARAM_CMD(param) = (cmd_t *)calloc(1, sizeof(cmd_t));
        param->param_type = CMD;
        strncpy(GET_CMD_NAME(param), cmd_name, MIN(CMD_NAME_SIZE, strlen(cmd_name)));
        GET_CMD_NAME(param)[CMD_NAME_SIZE -1] = '\0';
    }
    else if(param_type == LEAF){
        GET_PARAM_LEAF(param) = (leaf_t *)calloc(1, sizeof(leaf_t));
        param->param_type = LEAF;
        GET_PARAM_LEAF(param)->leaf_type = leaf_type;
        param->cmd_type.leaf->user_validation_cb_fn = user_validation_cb_fn;
        strncpy(GET_LEAF_ID(param), leaf_id, MIN(LEAF_ID_SIZE, strlen(leaf_id)));
        GET_LEAF_ID(param)[LEAF_ID_SIZE -1] = '\0';
    }
    else if(param_type == NO_CMD){
        GET_PARAM_CMD(param) = (cmd_t *)calloc(1, sizeof(cmd_t));
        param->param_type = NO_CMD;
        strncpy(GET_CMD_NAME(param), NEGATE_CHARACTER, strlen(NEGATE_CHARACTER));
        GET_CMD_NAME(param)[CMD_NAME_SIZE -1] = '\0';
    }

    param->ishidden = 0;
    param->parent = NULL;
    param->callback = callback;
    strncpy(GET_PARAM_HELP_STRING(param), help, MIN(PARAM_HELP_STRING_SIZE, strlen(help)));
    GET_PARAM_HELP_STRING(param)[PARAM_HELP_STRING_SIZE -1] = '\0';
    param->disp_callback = NULL;

    for(; i < MAX_OPTION_SIZE; i++){
        param->options[i] = NULL;
    }

    param->CMDCODE = -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r15
movq %rdi, %rbx
cmpl $0x2, %esi
je 0x2987
cmpl $0x1, %esi
je 0x292f
testl %esi, %esi
jne 0x29b1
movq %rdx, %r13
movl $0x20, %r14d
movl $0x1, %edi
movl $0x20, %esi
callq 0x1140
movq %rax, %r12
movq %rax, 0x8(%rbx)
movl $0x0, (%rbx)
movq %r13, %rdi
callq 0x10c0
cmpq $0x20, %rax
cmovbq %rax, %r14
movq %r12, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x1060
jmp 0x29a8
movl %r9d, %r14d
movq %r8, %rbp
movq 0x40(%rsp), %r13
movl $0x1, %edi
movl $0x70, %esi
callq 0x1140
movq %rax, %r12
movq %rax, 0x8(%rbx)
movl $0x1, (%rbx)
movl %r14d, (%rax)
movq %rbp, 0x48(%rax)
leaq 0x50(%rax), %r14
movq %r13, %rdi
callq 0x10c0
cmpq $0x20, %rax
movl $0x20, %edx
cmovbq %rax, %rdx
movq %r14, %rdi
movq %r13, %rsi
callq 0x1060
addq $0x6f, %r12
jmp 0x29ac
movl $0x1, %edi
movl $0x20, %esi
callq 0x1140
movq %rax, %r12
movq %rax, 0x8(%rbx)
movl $0x2, (%rbx)
movw $0x6f6e, (%rax)         # imm = 0x6F6E
addq $0x1f, %r12
movb $0x0, (%r12)
xorl %r12d, %r12d
movb %r12b, 0x18(%rbx)
movq %r12, 0xe0(%rbx)
movq %r15, 0x10(%rbx)
leaq 0x19(%rbx), %r14
movq 0x48(%rsp), %r15
movq %r15, %rdi
callq 0x10c0
cmpq $0x40, %rax
movl $0x40, %edx
cmovbq %rax, %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x1060
movb %r12b, 0x58(%rbx)
movq %r12, 0xe8(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x60(%rbx)
movups %xmm0, 0x70(%rbx)
movups %xmm0, 0x80(%rbx)
movups %xmm0, 0x90(%rbx)
movups %xmm0, 0xa0(%rbx)
movups %xmm0, 0xb0(%rbx)
movups %xmm0, 0xc0(%rbx)
movups %xmm0, 0xd0(%rbx)
movl $0xffffffff, 0xf0(%rbx) # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq