// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x80, %rsp
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movl %r9d, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
cmpl $0x0, -0xc(%rbp)
jne 0x2f43
movl $0x1, %edi
movl $0x20, %esi
callq 0x1100
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rax
movl $0x0, (%rax)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rdi
callq 0x1090
movq %rax, %rcx
movl $0x20, %eax
cmpq %rcx, %rax
jae 0x2f14
movl $0x20, %eax
movq %rax, -0x48(%rbp)
jmp 0x2f21
movq -0x18(%rbp), %rdi
callq 0x1090
movq %rax, -0x48(%rbp)
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rdi
movq -0x48(%rbp), %rdx
callq 0x1050
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movb $0x0, 0x1f(%rax)
jmp 0x3046
cmpl $0x1, -0xc(%rbp)
jne 0x2ff3
movl $0x1, %edi
movl $0x70, %esi
callq 0x1100
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rax
movl $0x1, (%rax)
movl -0x2c(%rbp), %ecx
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movl %ecx, (%rax)
movq -0x28(%rbp), %rcx
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rcx, 0x48(%rax)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
addq $0x50, %rax
movq %rax, -0x58(%rbp)
movq 0x10(%rbp), %rax
movq %rax, -0x50(%rbp)
movq 0x10(%rbp), %rdi
callq 0x1090
movq %rax, %rcx
movl $0x20, %eax
cmpq %rcx, %rax
jae 0x2fc7
movl $0x20, %eax
movq %rax, -0x60(%rbp)
jmp 0x2fd4
movq 0x10(%rbp), %rdi
callq 0x1090
movq %rax, -0x60(%rbp)
movq -0x50(%rbp), %rsi
movq -0x58(%rbp), %rdi
movq -0x60(%rbp), %rdx
callq 0x1050
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movb $0x0, 0x6f(%rax)
jmp 0x3044
cmpl $0x2, -0xc(%rbp)
jne 0x3042
movl $0x1, %edi
movl $0x20, %esi
callq 0x1100
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rax
movl $0x2, (%rax)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x7630(%rip), %rsi      # 0xa65c
movl $0x2, %edx
callq 0x1050
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movb $0x0, 0x1f(%rax)
jmp 0x3044
jmp 0x3046
movq -0x8(%rbp), %rax
movb $0x0, 0x18(%rax)
movq -0x8(%rbp), %rax
movq $0x0, 0xe0(%rax)
movq -0x20(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x8(%rbp), %rax
addq $0x19, %rax
movq %rax, -0x70(%rbp)
movq 0x18(%rbp), %rax
movq %rax, -0x68(%rbp)
movq 0x18(%rbp), %rdi
callq 0x1090
movq %rax, %rcx
movl $0x40, %eax
cmpq %rcx, %rax
jae 0x309e
movl $0x40, %eax
movq %rax, -0x78(%rbp)
jmp 0x30ab
movq 0x18(%rbp), %rdi
callq 0x1090
movq %rax, -0x78(%rbp)
movq -0x68(%rbp), %rsi
movq -0x70(%rbp), %rdi
movq -0x78(%rbp), %rdx
callq 0x1050
movq -0x8(%rbp), %rax
movb $0x0, 0x58(%rax)
movq -0x8(%rbp), %rax
movq $0x0, 0xe8(%rax)
cmpl $0x10, -0x30(%rbp)
jge 0x30f5
movq -0x8(%rbp), %rax
movslq -0x30(%rbp), %rcx
movq $0x0, 0x60(%rax,%rcx,8)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x30d3
movq -0x8(%rbp), %rax
movl $0xffffffff, 0xf0(%rax) # imm = 0xFFFFFFFF
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax)