// File: /workspace/github_c_makefile_star2_O0/Ziddykins[P]Dawn/src/commands.c
// Function: cmd_spellbook
void cmd_spellbook(int pindex, struct Message * msg) {
    char *out;
    char append[25] = {0};

    CALLEXIT(!(out = malloc(MAX_MESSAGE_BUFFER)))
    sprintf(out, "PRIVMSG %s :[%s's spellbook] ", msg->receiver, msg->sender_nick);
    if (dawn->players[pindex].spellbook.heal.learned) {
        snprintf(append, 25, "[Heal: Lv %d] ", dawn->players[pindex].spellbook.heal.level);
        strcat(out, append);
    } else {
        snprintf(append, 25, "[Empty]");
        strcat(out, append);
    }
    if (dawn->players[pindex].spellbook.frost.learned) {
        snprintf(append, 25, "[Frost: Lv %d] ", dawn->players[pindex].spellbook.frost.level);
        strcat(out, append);
    }
    if (dawn->players[pindex].spellbook.rain.learned) {
        snprintf(append, 25, "[Rain: Lv %d] ", dawn->players[pindex].spellbook.rain.level);
        strcat(out, append);
    }
    if (dawn->players[pindex].spellbook.revive.learned) {
        snprintf(append, 25, "[Revive: Lv %d] ", dawn->players[pindex].spellbook.revive.level);
        strcat(out, append);
    }
    if (dawn->players[pindex].spellbook.fireball.learned) {
        snprintf(append, 25, "[Fireball: Lv %d] ", dawn->players[pindex].spellbook.fireball.level);
        strcat(out, append);
    }
    if (dawn->players[pindex].spellbook.teleport.learned) {
        snprintf(append, 25, "[Teleport: Lv %d] ", dawn->players[pindex].spellbook.teleport.level);
        strcat(out, append);
    }
    strcat(out, "\r\n\0");
    add_msg(out, strlen(out));
    free(out);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x40(%rbp), %rdi
xorl %esi, %esi
movl $0x19, %edx
callq 0x20f0
movl $0x190, %edi            # imm = 0x190
callq 0x22b0
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
jne 0x77e9
leaq 0x1423a(%rip), %rdi     # 0x1ba14
callq 0x2190
movl $0x1, %edi
callq 0x2260
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rdx
addq $0xc0, %rdx
movq -0x10(%rbp), %rcx
leaq 0x1425c(%rip), %rsi     # 0x1ba5f
movb $0x0, %al
callq 0x2050
leaq 0x2125f(%rip), %rax     # 0x28a70
movq (%rax), %rax
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0x4(%rbp), %rcx
imulq $0x26a8, %rcx, %rcx     # imm = 0x26A8
addq %rcx, %rax
cmpl $0x0, 0x1158(%rax)
je 0x787b
leaq -0x40(%rbp), %rdi
leaq 0x21234(%rip), %rax     # 0x28a70
movq (%rax), %rax
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0x4(%rbp), %rcx
imulq $0x26a8, %rcx, %rcx     # imm = 0x26A8
addq %rcx, %rax
movl 0x1150(%rax), %ecx
movl $0x19, %esi
leaq 0x14218(%rip), %rdx     # 0x1ba7d
movb $0x0, %al
callq 0x2390
movq -0x18(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x2400
jmp 0x789f
leaq -0x40(%rbp), %rdi
movl $0x19, %esi
leaq 0x14201(%rip), %rdx     # 0x1ba8c
movb $0x0, %al
callq 0x2390
movq -0x18(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x2400
leaq 0x211ca(%rip), %rax     # 0x28a70
movq (%rax), %rax
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0x4(%rbp), %rcx
imulq $0x26a8, %rcx, %rcx     # imm = 0x26A8
addq %rcx, %rax
cmpl $0x0, 0x1170(%rax)
je 0x790e
leaq -0x40(%rbp), %rdi
leaq 0x2119f(%rip), %rax     # 0x28a70
movq (%rax), %rax
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0x4(%rbp), %rcx
imulq $0x26a8, %rcx, %rcx     # imm = 0x26A8
addq %rcx, %rax
movl 0x1168(%rax), %ecx
movl $0x19, %esi
leaq 0x1419a(%rip), %rdx     # 0x1ba94
movb $0x0, %al
callq 0x2390
movq -0x18(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x2400
leaq 0x2115b(%rip), %rax     # 0x28a70
movq (%rax), %rax
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0x4(%rbp), %rcx
imulq $0x26a8, %rcx, %rcx     # imm = 0x26A8
addq %rcx, %rax
cmpl $0x0, 0x1164(%rax)
je 0x797d
leaq -0x40(%rbp), %rdi
leaq 0x21130(%rip), %rax     # 0x28a70
movq (%rax), %rax
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0x4(%rbp), %rcx
imulq $0x26a8, %rcx, %rcx     # imm = 0x26A8
addq %rcx, %rax
movl 0x115c(%rax), %ecx
movl $0x19, %esi
leaq 0x1413b(%rip), %rdx     # 0x1baa4
movb $0x0, %al
callq 0x2390
movq -0x18(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x2400
leaq 0x210ec(%rip), %rax     # 0x28a70
movq (%rax), %rax
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0x4(%rbp), %rcx
imulq $0x26a8, %rcx, %rcx     # imm = 0x26A8
addq %rcx, %rax
cmpl $0x0, 0x118c(%rax)
je 0x79ec
leaq -0x40(%rbp), %rdi
leaq 0x210c1(%rip), %rax     # 0x28a70
movq (%rax), %rax
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0x4(%rbp), %rcx
imulq $0x26a8, %rcx, %rcx     # imm = 0x26A8
addq %rcx, %rax
movl 0x1184(%rax), %ecx
movl $0x19, %esi
leaq 0x140db(%rip), %rdx     # 0x1bab3
movb $0x0, %al
callq 0x2390
movq -0x18(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x2400
leaq 0x2107d(%rip), %rax     # 0x28a70
movq (%rax), %rax
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0x4(%rbp), %rcx
imulq $0x26a8, %rcx, %rcx     # imm = 0x26A8
addq %rcx, %rax
cmpl $0x0, 0x1180(%rax)
je 0x7a5b
leaq -0x40(%rbp), %rdi
leaq 0x21052(%rip), %rax     # 0x28a70
movq (%rax), %rax
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0x4(%rbp), %rcx
imulq $0x26a8, %rcx, %rcx     # imm = 0x26A8
addq %rcx, %rax
movl 0x1178(%rax), %ecx
movl $0x19, %esi
leaq 0x1407d(%rip), %rdx     # 0x1bac4
movb $0x0, %al
callq 0x2390
movq -0x18(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x2400
leaq 0x2100e(%rip), %rax     # 0x28a70
movq (%rax), %rax
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0x4(%rbp), %rcx
imulq $0x26a8, %rcx, %rcx     # imm = 0x26A8
addq %rcx, %rax
cmpl $0x0, 0x1198(%rax)
je 0x7aca
leaq -0x40(%rbp), %rdi
leaq 0x20fe3(%rip), %rax     # 0x28a70
movq (%rax), %rax
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0x4(%rbp), %rcx
imulq $0x26a8, %rcx, %rcx     # imm = 0x26A8
addq %rcx, %rax
movl 0x1190(%rax), %ecx
movl $0x19, %esi
leaq 0x14021(%rip), %rdx     # 0x1bad7
movb $0x0, %al
callq 0x2390
movq -0x18(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x2400
movq -0x18(%rbp), %rdi
leaq 0x14fd1(%rip), %rsi     # 0x1caa6
callq 0x2400
movq -0x18(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rdi
callq 0x20c0
movq -0x48(%rbp), %rdi
movq %rax, %rsi
callq 0x12840
movq -0x18(%rbp), %rdi
callq 0x2240
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)