// File: /workspace/github_c_makefile_star2_O1/Ziddykins[P]Dawn/src/spells.c
// Function: check_learn_spells
void check_learn_spells(const char *username) {
    int pindex = get_pindex(username);
    int plevel = dawn->players[pindex].level;
    char out[MAX_MESSAGE_BUFFER];
    char spell[20];

    switch (plevel) {
        case 3:
            dawn->players[pindex].spellbook.heal.learned = 1;
            dawn->players[pindex].spellbook.heal.level = 1;
            strcpy(spell, "Heal");
            break;
        case 5:
            dawn->players[pindex].spellbook.frost.learned = 1;
            dawn->players[pindex].spellbook.frost.level = 1;
            dawn->players[pindex].spellbook.frost.element = ICE;
            strcpy(spell, "Frost");
            break;
        case 8:
            dawn->players[pindex].spellbook.rain.learned = 1;
            dawn->players[pindex].spellbook.rain.level = 1;
            strcpy(spell, "Rain");
            break;
        case 10:
            dawn->players[pindex].spellbook.revive.learned = 1;
            dawn->players[pindex].spellbook.revive.level = 1;
            strcpy(spell, "Revive");
            break;
        case 17:
            dawn->players[pindex].spellbook.fireball.learned = 1;
            dawn->players[pindex].spellbook.fireball.level = 1;
            strcpy(spell, "Fireball");
            break;
        case 21:
            dawn->players[pindex].spellbook.teleport.learned = 1;
            dawn->players[pindex].spellbook.teleport.level = 1;
            strcpy(spell, "Teleport");
            break;
        default:
            return;
    }
    snprintf(out, MAX_MESSAGE_BUFFER, "PRIVMSG %s :%s has learned the spell %s!\r\n",
             dawn->active_room, username, spell);
    add_msg(out, strlen(out));
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x1b8, %rsp            # imm = 0x1B8
movq %rdi, %rbx
callq 0xd89c
leaq 0x12cff(%rip), %rcx     # 0x21a80
movq (%rcx), %rcx
leaq 0x1a0(%rcx), %rdx
cltq
imulq $0x26a8, %rax, %rax     # imm = 0x26A8
movl 0x2808(%rcx,%rax), %esi
leal -0x3(%rsi), %edi
cmpl $0x7, %edi
ja 0xedd7
leaq 0x8f8e(%rip), %rsi      # 0x17d38
movslq (%rsi,%rdi,4), %rdi
addq %rsi, %rdi
jmpq *%rdi
movl $0x1, %esi
movl %esi, 0x1158(%rdx,%rax)
movl %esi, 0x1150(%rdx,%rax)
movb $0x0, 0x4(%rsp)
movl $0x6c616548, (%rsp)     # imm = 0x6C616548
jmp 0xeea3
cmpl $0x11, %esi
je 0xee7d
cmpl $0x15, %esi
jne 0xeede
movl $0x1, %esi
movl %esi, 0x1198(%rdx,%rax)
movl %esi, 0x1190(%rdx,%rax)
movabsq $0x74726f70656c6554, %rax # imm = 0x74726F70656C6554
jmp 0xee9a
movl $0x1, %esi
movl %esi, 0x118c(%rdx,%rax)
movl %esi, 0x1184(%rdx,%rax)
movl $0x657669, 0x3(%rsp)    # imm = 0x657669
movl $0x69766552, (%rsp)     # imm = 0x69766552
jmp 0xeea3
movabsq $0x100000001, %rsi      # imm = 0x100000001
movq %rsi, 0x1170(%rdx,%rax)
movl $0x1, 0x1168(%rdx,%rax)
movw $0x74, 0x4(%rsp)
movl $0x736f7246, (%rsp)     # imm = 0x736F7246
jmp 0xeea3
movl $0x1, %esi
movl %esi, 0x1164(%rdx,%rax)
movl %esi, 0x115c(%rdx,%rax)
movb $0x0, 0x4(%rsp)
movl $0x6e696152, (%rsp)     # imm = 0x6E696152
jmp 0xeea3
movl $0x1, %esi
movl %esi, 0x1180(%rdx,%rax)
movl %esi, 0x1178(%rdx,%rax)
movabsq $0x6c6c616265726946, %rax # imm = 0x6C6C616265726946
movq %rax, (%rsp)
movb $0x0, 0x8(%rsp)
addq $0x100, %rcx            # imm = 0x100
leaq 0x9328(%rip), %rdx      # 0x181d9
leaq 0x20(%rsp), %r14
movq %rsp, %r9
movl $0x190, %esi            # imm = 0x190
movq %r14, %rdi
movq %rbx, %r8
xorl %eax, %eax
callq 0x2390
movq %r14, %rdi
callq 0x20c0
movq %r14, %rdi
movq %rax, %rsi
callq 0xcd1c
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r14
retq
nopl (%rax)