// File: /workspace/github_c_makefile_star2_O1/sachinites[P]CommandParser/testapp.c
// Function: main
int
main(int argc, char **argv){
    
    init_libcli();
    /*Level 0*/

    param_t *show   = libcli_get_show_hook();
    //param_t *debug  = libcli_get_debug_hook();
    param_t *config = libcli_get_config_hook();

    static param_t cmsh;
    init_param(&cmsh, CMD, "cmsh", 0, 0, INVALID, 0, "cmsh hidden commands");
    libcli_register_param(0, &cmsh);

    /*Level 1*/
    static param_t ip;
    init_param(&ip, CMD, "ip", 0, 0, INVALID, 0, "Internet Protocol(IP)");
    libcli_register_param(show, &ip);

    static param_t ipv6;
    init_param(&ipv6, CMD, "ipv6", 0, 0, INVALID, 0, "Internet Protocol(IPV6)");
    libcli_register_param(show, &ipv6);

    static param_t config_router;
    init_param(&config_router, CMD, "router", 0, 0, INVALID, 0, "Configuration Router");
    libcli_register_param(config, &config_router);

    /*Level 2*/
    static param_t config_router_name;
    init_param(&config_router_name, CMD, "name", 0, 0, INVALID, 0, "configure router name");
    libcli_register_param(&config_router, &config_router_name);

    static param_t igmp;
    init_param(&igmp, CMD, "igmp", 0, 0, INVALID, 0, "IGMP Protocol");
    libcli_register_param(&ip, &igmp);
    
    static param_t igmp_config;
    init_param(&igmp_config, CMD, "configuration", show_ip_igmp_groups_handler, 0, INVALID, 0, "IGMP Protocol Configuration");
    libcli_register_param(&igmp, &igmp_config);

    /*Level 3*/
    static param_t config_router_name_name;
    init_param(&config_router_name_name, LEAF, 0, config_router_name_handler, 0,  
                                              STRING, "cons-name", "Name of Console");
    libcli_register_param(&config_router_name, &config_router_name_name);
    
    static param_t show_ip_igmp_groups;
    init_param(&show_ip_igmp_groups, CMD, "groups", show_ip_igmp_groups_handler, 0, INVALID, 0, "Ipv4 Group Address");
    libcli_register_param(&igmp, &show_ip_igmp_groups);

    static param_t show_ip_igmp_groups_vlan;
    init_param(&show_ip_igmp_groups_vlan, CMD, "vlan", 0, 0, INVALID, 0, "vlan");
    libcli_register_param(&show_ip_igmp_groups, &show_ip_igmp_groups_vlan);
    libcli_register_display_callback(&show_ip_igmp_groups_vlan, list_vlans);

    static param_t show_ip_igmp_groups_vlan_vlan;
    init_param(&show_ip_igmp_groups_vlan_vlan, LEAF, 0, show_ip_igmp_groups_handler, user_vlan_validation_callback,
        INT, "vlan-id", "Vlan id(1-4095)");
    libcli_register_param(&show_ip_igmp_groups_vlan, &show_ip_igmp_groups_vlan_vlan);

    /*Level 5*/
    static param_t  show_ip_igmp_groups_group_ip;
    init_param(&show_ip_igmp_groups_group_ip, LEAF, 0, show_ip_igmp_groups_handler, 0, IPV4, 
                "group-ip" ,"Multicast Group Address");
    libcli_register_param(&show_ip_igmp_groups, &show_ip_igmp_groups_group_ip);

    /*level 6*/
    static param_t show_ip_igmp_groups_group_ip_vlan;
    init_param(&show_ip_igmp_groups_group_ip_vlan, CMD, "vlan", 0, 0, INVALID, 0, "Vlan");
    libcli_register_param(&show_ip_igmp_groups_group_ip, &show_ip_igmp_groups_group_ip_vlan);

    /*level 7*/
    static param_t show_ip_igmp_groups_group_ip_vlan_vlan_id;
    init_param(&show_ip_igmp_groups_group_ip_vlan_vlan_id, LEAF, 0, show_ip_igmp_groups_handler, 
                                    user_vlan_validation_callback, INT, "vlan-id" ,"Vlan id(1-4095)");
    libcli_register_param(&show_ip_igmp_groups_group_ip_vlan, &show_ip_igmp_groups_group_ip_vlan_vlan_id);

    /*mtrace command implementation*/
    static param_t mtrace;
    init_param(&mtrace, CMD, "mtrace", 0, 0, INVALID, 0, "mtrace command");
    libcli_register_param(config, &mtrace);

    static param_t source;
    init_param(&source, CMD, "source", 0, 0, INVALID, 0, "source command");
    libcli_register_param(&mtrace, &source);

    static param_t source_ip;
    init_param(&source_ip, LEAF, 0, mtrace_handler, 0, IPV4, "source-ip", "Source Ipv4 address");
    libcli_register_param(&source, &source_ip);
    set_param_cmd_code(&source_ip, MTRACE_SOURCE);

    /*mtrace source <source ip> destination <dest-ip>*/

    static param_t destination;
    init_param(&destination, CMD, "destination", 0, 0, INVALID, 0, "destination command");
    libcli_register_param(&source_ip, &destination);

    static param_t dest_ip;
    init_param(&dest_ip, LEAF, 0, mtrace_handler, 0, IPV4, "destination-ip", "Destination Ipv4 address");
    libcli_register_param(&destination, &dest_ip);
    set_param_cmd_code(&dest_ip, MTRACE_SOURCE_DEST);

    /*mtrace source <source ip> group <group-ip>*/

    static param_t group;
    init_param(&group, CMD, "group", 0, 0, INVALID, 0, "group command");
    libcli_register_param(&source_ip, &group);

    static param_t group_ip;
    init_param(&group_ip, LEAF, 0, mtrace_handler, 0, IPV4, "group-ip", "Multicast Group Ipv4 address");
    libcli_register_param(&group, &group_ip);
    set_param_cmd_code(&group_ip, MTRACE_SOURCE_GROUP);

    /*mtrace source <source ip> destination <dest-ip> group <group_ip>*/

    static param_t group2;
    init_param(&group2, CMD, "group", 0, 0, INVALID, 0, "group command");
    libcli_register_param(&dest_ip, &group2);

    static param_t group_ip2;
    init_param(&group_ip2, LEAF, 0, mtrace_handler, 0, IPV4, "group-ip", "Multicast Group Ipv4 address");
    libcli_register_param(&group2, &group_ip2);
    set_param_cmd_code(&group_ip2, MTRACE_SOURCE_DEST_GROUP);

    support_cmd_negation(config);

    start_shell();
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
xorl %r12d, %r12d
xorl %eax, %eax
callq 0x1e4e
callq 0x1b4c
movq %rax, %r15
callq 0x1b64
movq %rax, %rbx
movq %rax, (%rsp)
leaq 0x6b20(%rip), %rax      # 0x8011
leaq 0xbc80(%rip), %r14      # 0xd178
leaq 0x6b0d(%rip), %rdx      # 0x800c
movq %r14, %rdi
xorl %esi, %esi
xorl %ecx, %ecx
xorl %r8d, %r8d
movl $0x6, %r9d
pushq %rax
pushq %r12
xorl %r12d, %r12d
callq 0x28c3
addq $0x10, %rsp
xorl %edi, %edi
movq %r14, %rsi
callq 0x1bbf
leaq 0x6af7(%rip), %rax      # 0x8026
leaq 0xbd3a(%rip), %r14      # 0xd270
leaq 0x6c35(%rip), %rdx      # 0x8172
movq %r14, %rdi
xorl %esi, %esi
xorl %ecx, %ecx
xorl %r8d, %r8d
movl $0x6, %r9d
pushq %rax
pushq %r12
xorl %r13d, %r13d
callq 0x28c3
addq $0x10, %rsp
movq %r15, %rdi
movq %r14, %rsi
callq 0x1bbf
leaq 0x6ad3(%rip), %rax      # 0x8041
leaq 0xbdf3(%rip), %r12      # 0xd368
leaq 0x6ac0(%rip), %rdx      # 0x803c
movq %r12, %rdi
xorl %esi, %esi
xorl %ecx, %ecx
xorl %r8d, %r8d
movl $0x6, %r9d
pushq %rax
pushq %r13
xorl %r13d, %r13d
callq 0x28c3
addq $0x10, %rsp
movq %r15, %rdi
movq %r12, %rsi
callq 0x1bbf
leaq 0x6ab3(%rip), %rax      # 0x8060
leaq 0xbeac(%rip), %r12      # 0xd460
leaq 0x6a9e(%rip), %rdx      # 0x8059
movq %r12, %rdi
xorl %esi, %esi
xorl %ecx, %ecx
xorl %r8d, %r8d
movl $0x6, %r9d
pushq %rax
pushq %r13
xorl %r13d, %r13d
callq 0x28c3
addq $0x10, %rsp
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1bbf
leaq 0x6a89(%rip), %rax      # 0x8075
leaq 0xbf65(%rip), %r15      # 0xd558
leaq 0x7f0a(%rip), %rdx      # 0x9504
movq %r15, %rdi
xorl %esi, %esi
xorl %ecx, %ecx
xorl %r8d, %r8d
movl $0x6, %r9d
pushq %rax
pushq %r13
xorl %ebx, %ebx
callq 0x28c3
addq $0x10, %rsp
movq %r12, %rdi
movq %r15, %rsi
callq 0x1bbf
leaq 0x6a66(%rip), %rax      # 0x8090
leaq 0xc01f(%rip), %r12      # 0xd650
leaq 0x6a53(%rip), %rdx      # 0x808b
movq %r12, %rdi
xorl %esi, %esi
xorl %ecx, %ecx
xorl %r8d, %r8d
movl $0x6, %r9d
pushq %rax
pushq %rbx
xorl %ebx, %ebx
callq 0x28c3
addq $0x10, %rsp
movq %r14, %rdi
movq %r12, %rsi
callq 0x1bbf
leaq 0x6a45(%rip), %rax      # 0x80ac
leaq 0xc0da(%rip), %r13      # 0xd748
leaq 0x6a29(%rip), %rdx      # 0x809e
leaq -0x2e0(%rip), %r14      # 0x139c
movq %r13, %rdi
xorl %esi, %esi
movq %r14, %rcx
xorl %r8d, %r8d
movl $0x6, %r9d
pushq %rax
pushq %rbx
xorl %ebx, %ebx
callq 0x28c3
addq $0x10, %rsp
movq %r12, %rdi
movq %r13, %rsi
callq 0x1bbf
leaq 0x6a26(%rip), %rax      # 0x80d2
leaq 0x6a15(%rip), %r10      # 0x80c8
leaq 0xc186(%rip), %r13      # 0xd840
leaq -0x238(%rip), %rcx      # 0x1489
movq %r13, %rdi
movl $0x1, %esi
xorl %edx, %edx
xorl %r8d, %r8d
movl $0x1, %r9d
pushq %rax
pushq %r10
callq 0x28c3
addq $0x10, %rsp
movq %r15, %rdi
movq %r13, %rsi
callq 0x1bbf
leaq 0x69f7(%rip), %rax      # 0x80e9
leaq 0xc23f(%rip), %r15      # 0xd938
leaq 0x69e2(%rip), %rdx      # 0x80e2
movq %r15, %rdi
xorl %esi, %esi
movq %r14, %rcx
xorl %r8d, %r8d
movl $0x6, %r9d
pushq %rax
pushq %rbx
callq 0x28c3
addq $0x10, %rsp
movq %r12, %rdi
movq %r15, %rsi
callq 0x1bbf
leaq 0x69ce(%rip), %r12      # 0x80fc
leaq 0xc2fb(%rip), %rbp      # 0xda30
movq %rbp, %rdi
xorl %esi, %esi
movq %r12, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
movl $0x6, %r9d
pushq %r12
pushq %rbx
callq 0x28c3
addq $0x10, %rsp
movq %r15, %rdi
movq %rbp, %rsi
callq 0x1bbf
leaq 0x391(%rip), %rsi       # 0x1af7
movq %rbp, %rdi
callq 0x1cd0
leaq 0x6994(%rip), %r10      # 0x8109
leaq 0x6985(%rip), %rax      # 0x8101
leaq 0xc3a5(%rip), %rbx      # 0xdb28
leaq -0x2f0(%rip), %r13      # 0x149a
movq %rbx, %rdi
movl $0x1, %esi
xorl %edx, %edx
movq %r14, %rcx
movq %r13, %r8
xorl %r9d, %r9d
pushq %r10
pushq %rax
callq 0x28c3
addq $0x10, %rsp
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x1bbf
leaq 0x6967(%rip), %rax      # 0x8122
leaq 0x6957(%rip), %r10      # 0x8119
leaq 0xc457(%rip), %rbp      # 0xdc20
movq %rbp, %rdi
movl $0x1, %esi
xorl %edx, %edx
movq %r14, %rcx
xorl %r8d, %r8d
movl $0x2, %r9d
pushq %rax
pushq %r10
callq 0x28c3
addq $0x10, %rsp
movq %r15, %rdi
movq %rbp, %rsi
callq 0x1bbf
leaq 0x693d(%rip), %rax      # 0x813a
leaq 0xc514(%rip), %r15      # 0xdd18
movq %r15, %rdi
xorl %esi, %esi
movq %r12, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
movl $0x6, %r9d
pushq %rax
xorl %eax, %eax
pushq %rax
callq 0x28c3
addq $0x10, %rsp
movq %rbp, %rdi
movq %r15, %rsi
callq 0x1bbf
leaq 0xc5da(%rip), %rbx      # 0xde10
movq %rbx, %rdi
movl $0x1, %esi
xorl %edx, %edx
movq %r14, %rcx
movq %r13, %r8
xorl %r9d, %r9d
leaq 0x68b9(%rip), %rax      # 0x8109
pushq %rax
leaq 0x68a9(%rip), %rax      # 0x8101
pushq %rax
callq 0x28c3
addq $0x10, %rsp
movq %r15, %rdi
movq %rbx, %rsi
callq 0x1bbf
leaq 0x68d2(%rip), %rax      # 0x8146
leaq 0xc68d(%rip), %r14      # 0xdf08
leaq 0x68bd(%rip), %rdx      # 0x813f
movq %r14, %rdi
xorl %esi, %esi
xorl %ecx, %ecx
xorl %r8d, %r8d
movl $0x6, %r9d
pushq %rax
xorl %ebx, %ebx
pushq %rbx
callq 0x28c3
addq $0x10, %rsp
movq (%rsp), %rdi
movq %r14, %rsi
callq 0x1bbf
leaq 0x68aa(%rip), %rax      # 0x815c
leaq 0xc747(%rip), %r12      # 0xe000
leaq 0x6895(%rip), %rdx      # 0x8155
movq %r12, %rdi
xorl %esi, %esi
xorl %ecx, %ecx
xorl %r8d, %r8d
movl $0x6, %r9d
pushq %rax
pushq %rbx
callq 0x28c3
addq $0x10, %rsp
movq %r14, %rdi
movq %r12, %rsi
callq 0x1bbf
leaq 0x6888(%rip), %rax      # 0x8175
leaq 0x6877(%rip), %r10      # 0x816b
leaq 0xc7fd(%rip), %r15      # 0xe0f8
leaq -0x486(%rip), %r14      # 0x147c
movq %r15, %rdi
movl $0x1, %esi
xorl %edx, %edx
movq %r14, %rcx
xorl %r8d, %r8d
movl $0x2, %r9d
pushq %rax
pushq %r10
callq 0x28c3
addq $0x10, %rsp
movq %r12, %rdi
movq %r15, %rsi
callq 0x1bbf
movq %r15, %rdi
movl $0x1, %esi
callq 0x2af9
leaq 0x6852(%rip), %rax      # 0x8195
leaq 0xc8a6(%rip), %r13      # 0xe1f0
leaq 0x6838(%rip), %rdx      # 0x8189
movq %r13, %rdi
xorl %esi, %esi
xorl %ecx, %ecx
xorl %r8d, %r8d
movl $0x6, %r9d
pushq %rax
pushq %rbx
callq 0x28c3
addq $0x10, %rsp
movq %r15, %rdi
movq %r13, %rsi
callq 0x1bbf
leaq 0x683a(%rip), %rax      # 0x81b8
leaq 0x6824(%rip), %r10      # 0x81a9
leaq 0xc95c(%rip), %r12      # 0xe2e8
movq %r12, %rdi
movl $0x1, %esi
xorl %edx, %edx
movq %r14, %rcx
xorl %r8d, %r8d
movl $0x2, %r9d
pushq %rax
pushq %r10
callq 0x28c3
addq $0x10, %rsp
movq %r13, %rdi
movq %r12, %rsi
callq 0x1bbf
movq %r12, %rdi
movl $0x2, %esi
callq 0x2af9
leaq 0x680a(%rip), %rax      # 0x81d7
leaq 0xca0c(%rip), %rbp      # 0xe3e0
leaq 0x67f6(%rip), %r13      # 0x81d1
movq %rbp, %rdi
xorl %esi, %esi
movq %r13, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
movl $0x6, %r9d
pushq %rax
pushq %rbx
callq 0x28c3
addq $0x10, %rsp
movq %r15, %rdi
movq %rbp, %rsi
callq 0x1bbf
leaq 0x67da(%rip), %rax      # 0x81e5
leaq 0xcac6(%rip), %rbx      # 0xe4d8
movq %rbx, %rdi
movl $0x1, %esi
xorl %edx, %edx
movq %r14, %rcx
xorl %r8d, %r8d
movl $0x2, %r9d
pushq %rax
leaq 0x66e9(%rip), %r14      # 0x8119
pushq %r14
callq 0x28c3
addq $0x10, %rsp
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x1bbf
movq %rbx, %rdi
movl $0x4, %esi
callq 0x2af9
leaq 0xcb76(%rip), %r15      # 0xe5d0
movq %r15, %rdi
xorl %esi, %esi
movq %r13, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
movl $0x6, %r9d
leaq 0x6763(%rip), %rax      # 0x81d7
pushq %rax
xorl %eax, %eax
pushq %rax
callq 0x28c3
addq $0x10, %rsp
movq %r12, %rdi
movq %r15, %rsi
callq 0x1bbf
leaq 0xcc35(%rip), %rbx      # 0xe6c8
movq %rbx, %rdi
movl $0x1, %esi
xorl %edx, %edx
leaq -0x628(%rip), %rcx      # 0x147c
xorl %r8d, %r8d
movl $0x2, %r9d
leaq 0x6731(%rip), %rax      # 0x81e5
pushq %rax
pushq %r14
callq 0x28c3
addq $0x10, %rsp
movq %r15, %rdi
movq %rbx, %rsi
callq 0x1bbf
movq %rbx, %rdi
movl $0x3, %esi
callq 0x2af9
movq (%rsp), %rdi
callq 0x2b56
callq 0x2de5
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq