// File: /workspace/github_c_makefile_star2_O3/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
movq 0x48(%rsp), %r14
cmpl $0x2, %esi
je 0x297e
cmpl $0x1, %esi
je 0x2925
testl %esi, %esi
jne 0x299c
movq %rdx, %r12
movl $0x20, %r13d
movl $0x1, %edi
movl $0x20, %esi
callq 0x1140
movq %rax, %rbp
movq %rax, 0x8(%rbx)
movl $0x0, (%rbx)
movq %r12, %rdi
callq 0x10c0
cmpq $0x20, %rax
cmovbq %rax, %r13
movq %rbp, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x1060
movb $0x0, 0x1f(%rbp)
jmp 0x299c
movl %r9d, %ebp
movq %r8, %r13
movl $0x1, %edi
movl $0x70, %esi
callq 0x1140
movq %rax, %r12
movq %rax, 0x8(%rbx)
movl $0x1, (%rbx)
movl %ebp, (%rax)
movq %r13, 0x48(%rax)
leaq 0x50(%rax), %r13
movq 0x40(%rsp), %rbp
movq %rbp, %rdi
callq 0x10c0
cmpq $0x20, %rax
movl $0x20, %edx
cmovbq %rax, %rdx
movq %r13, %rdi
movq %rbp, %rsi
callq 0x1060
movb $0x0, 0x6f(%r12)
jmp 0x299c
movl $0x1, %edi
movl $0x20, %esi
callq 0x1140
movq %rax, 0x8(%rbx)
movl $0x2, (%rbx)
movw $0x6f6e, (%rax)         # imm = 0x6F6E
xorl %r12d, %r12d
movb %r12b, 0x18(%rbx)
movq %r12, 0xe0(%rbx)
movq %r15, 0x10(%rbx)
leaq 0x19(%rbx), %r15
movq %r14, %rdi
callq 0x10c0
cmpq $0x40, %rax
movl $0x40, %edx
cmovbq %rax, %rdx
movq %r15, %rdi
movq %r14, %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