// File: /workspace/github_c_makefile_star2_O0/Ziddykins[P]Dawn/src/commands.c
// Function: cmd_help
void cmd_help(int pindex, struct Message * msg) {
    extern CmdSys commands;
    struct cmd_sys * ccs = commands;
    assert(ccs);

    if(matches_regex(msg->message, CMD_LIT"\\s*([;\\s]"CMD_MATCH")")) {
        regex_group[1][0] = PREFIX_C;
        invoke_cmd(0, pindex, regex_group[1], msg, CMD_HELP);
    } else {
        char * out;
        CALLEXIT(!(out = malloc(MAX_MESSAGE_BUFFER)))
        int len = snprintf(out, MAX_MESSAGE_BUFFER, "PRIVMSG %s :", msg->receiver);
        for(size_t i = 0; i < ccs->len; i++) { //print each command to the string
            if(ccs->auth_levels[i] <= dawn->players[pindex].auth_level) {
                len += snprintf(out+len, (size_t)(MAX_MESSAGE_BUFFER-len), "%s ", ccs->cmds[i]);
            }
        }
        len += snprintf(out+len, (size_t)(MAX_MESSAGE_BUFFER-len), "\r\n");
        add_msg(out, (size_t)(len));
        free(out);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
leaq 0x20432(%rip), %rax     # 0x26268
movq (%rax), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x5e46
jmp 0x5e65
leaq 0x14493(%rip), %rdi     # 0x1a2e0
leaq 0x159e7(%rip), %rsi     # 0x1b83b
movl $0x55, %edx
leaq 0x159ea(%rip), %rcx     # 0x1b84a
callq 0x2100
movq -0x10(%rbp), %rdi
addq $0x100, %rdi            # imm = 0x100
leaq 0x159f8(%rip), %rsi     # 0x1b86f
callq 0x13090
cmpl $0x0, %eax
je 0x5eb8
leaq 0x21448(%rip), %rax     # 0x272d0
movb $0x3b, 0x190(%rax)
movl -0x4(%rbp), %esi
movq -0x10(%rbp), %rcx
xorl %eax, %eax
movl %eax, %edi
leaq 0x2142f(%rip), %rdx     # 0x272d0
addq $0x190, %rdx            # imm = 0x190
movl $0x1, %r8d
callq 0x40c0
jmp 0x5fe6
movl $0x190, %edi            # imm = 0x190
callq 0x22b0
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
jne 0x5ee2
leaq 0x159b9(%rip), %rdi     # 0x1b88c
callq 0x2190
movl $0x1, %edi
callq 0x2260
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rcx
addq $0xc0, %rcx
movl $0x190, %esi            # imm = 0x190
leaq 0x159d9(%rip), %rdx     # 0x1b8d6
movb $0x0, %al
callq 0x2390
movl %eax, -0x24(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x5fa6
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x30(%rbp), %rcx
movl (%rax,%rcx,4), %eax
leaq 0x22b3a(%rip), %rcx     # 0x28a70
movq (%rcx), %rcx
addq $0x1a0, %rcx            # imm = 0x1A0
movslq -0x4(%rbp), %rdx
imulq $0x26a8, %rdx, %rdx     # imm = 0x26A8
addq %rdx, %rcx
movzbl 0x26a0(%rcx), %ecx
cmpl %ecx, %eax
jg 0x5f93
movq -0x20(%rbp), %rdi
movslq -0x24(%rbp), %rax
addq %rax, %rdi
movl $0x190, %eax            # imm = 0x190
subl -0x24(%rbp), %eax
movslq %eax, %rsi
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
leaq 0x17253(%rip), %rdx     # 0x1d1d9
movb $0x0, %al
callq 0x2390
addl -0x24(%rbp), %eax
movl %eax, -0x24(%rbp)
jmp 0x5f95
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x5f0f
movq -0x20(%rbp), %rdi
movslq -0x24(%rbp), %rax
addq %rax, %rdi
movl $0x190, %eax            # imm = 0x190
subl -0x24(%rbp), %eax
movslq %eax, %rsi
leaq 0x16cc3(%rip), %rdx     # 0x1cc86
movb $0x0, %al
callq 0x2390
addl -0x24(%rbp), %eax
movl %eax, -0x24(%rbp)
movq -0x20(%rbp), %rdi
movslq -0x24(%rbp), %rsi
callq 0x12840
movq -0x20(%rbp), %rdi
callq 0x2240
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)