// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rsi, %r14
movl %edi, %ebp
xorps %xmm0, %xmm0
movups %xmm0, 0x9(%rsp)
movaps %xmm0, (%rsp)
movl $0x190, %edi            # imm = 0x190
callq 0x22b0
testq %rax, %rax
je 0x67e0
movq %rax, %rbx
leaq 0xc0(%r14), %rdx
leaq 0xc458(%rip), %rsi      # 0x12a5f
movq %rax, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x2050
leaq 0x1b465(%rip), %r12     # 0x21a80
movq (%r12), %rax
movslq %ebp, %rcx
imulq $0x26a8, %rcx, %r15     # imm = 0x26A8
cmpl $0x0, 0x12f8(%rax,%r15)
je 0x6657
addq %r15, %rax
addq $0x12f0, %rax           # imm = 0x12F0
movl (%rax), %ecx
leaq 0xc437(%rip), %rdx      # 0x12a7d
movq %rsp, %rdi
movl $0x19, %esi
xorl %eax, %eax
callq 0x2390
jmp 0x6665
movabsq $0x5d7974706d455b, %rax # imm = 0x5D7974706D455B
movq %rax, (%rsp)
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x2410
movq (%r12), %rax
cmpl $0x0, 0x1310(%rax,%r15)
je 0x66ae
addq %r15, %rax
addq $0x1308, %rax           # imm = 0x1308
movl (%rax), %ecx
leaq 0xc3fb(%rip), %rdx      # 0x12a8c
movq %rsp, %r14
movl $0x19, %esi
movq %r14, %rdi
xorl %eax, %eax
callq 0x2390
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2410
movq (%r12), %rax
cmpl $0x0, 0x1304(%rax,%r15)
je 0x66ec
addq %r15, %rax
addq $0x12fc, %rax           # imm = 0x12FC
movl (%rax), %ecx
leaq 0xc3cd(%rip), %rdx      # 0x12a9c
movq %rsp, %r14
movl $0x19, %esi
movq %r14, %rdi
xorl %eax, %eax
callq 0x2390
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2410
movq (%r12), %rax
cmpl $0x0, 0x132c(%rax,%r15)
je 0x672a
addq %r15, %rax
addq $0x1324, %rax           # imm = 0x1324
movl (%rax), %ecx
leaq 0xc39e(%rip), %rdx      # 0x12aab
movq %rsp, %r14
movl $0x19, %esi
movq %r14, %rdi
xorl %eax, %eax
callq 0x2390
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2410
movq (%r12), %rax
cmpl $0x0, 0x1320(%rax,%r15)
je 0x6768
addq %r15, %rax
addq $0x1318, %rax           # imm = 0x1318
movl (%rax), %ecx
leaq 0xc371(%rip), %rdx      # 0x12abc
movq %rsp, %r14
movl $0x19, %esi
movq %r14, %rdi
xorl %eax, %eax
callq 0x2390
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2410
movq (%r12), %rax
cmpl $0x0, 0x1338(%rax,%r15)
je 0x67a6
addq %r15, %rax
addq $0x1330, %rax           # imm = 0x1330
movl (%rax), %ecx
leaq 0xc346(%rip), %rdx      # 0x12acf
movq %rsp, %r14
movl $0x19, %esi
movq %r14, %rdi
xorl %eax, %eax
callq 0x2390
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2410
movq %rbx, %rdi
callq 0x20c0
movw $0xa0d, (%rbx,%rax)     # imm = 0xA0D
movb $0x0, 0x2(%rbx,%rax)
movq %rbx, %rdi
callq 0x20c0
movq %rbx, %rdi
movq %rax, %rsi
callq 0xcd1c
movq %rbx, %rdi
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x2240
callq 0x27b9