// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x1d0, %rsp            # imm = 0x1D0
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x13ba0
movl %eax, -0xc(%rbp)
leaq 0x126be(%rip), %rax     # 0x28a70
movq (%rax), %rax
movslq -0xc(%rbp), %rcx
imulq $0x26a8, %rcx, %rcx     # imm = 0x26A8
movl 0x2808(%rax,%rcx), %eax
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %eax
addl $-0x3, %eax
movl %eax, %ecx
movq %rcx, -0x1c8(%rbp)
subl $0x12, %eax
ja 0x1668b
movq -0x1c8(%rbp), %rax
leaq 0xa934(%rip), %rcx      # 0x20d24
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x12670(%rip), %rax     # 0x28a70
movq (%rax), %rax
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0xc(%rbp), %rcx
imulq $0x26a8, %rcx, %rcx     # imm = 0x26A8
addq %rcx, %rax
movl $0x1, 0x1158(%rax)
leaq 0x12648(%rip), %rax     # 0x28a70
movq (%rax), %rax
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0xc(%rbp), %rcx
imulq $0x26a8, %rcx, %rcx     # imm = 0x26A8
addq %rcx, %rax
movl $0x1, 0x1150(%rax)
leaq -0x1c0(%rbp), %rdi
leaq 0xad71(%rip), %rsi      # 0x211c8
callq 0x21c0
jmp 0x1668d
leaq 0x12608(%rip), %rax     # 0x28a70
movq (%rax), %rax
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0xc(%rbp), %rcx
imulq $0x26a8, %rcx, %rcx     # imm = 0x26A8
addq %rcx, %rax
movl $0x1, 0x1170(%rax)
leaq 0x125e0(%rip), %rax     # 0x28a70
movq (%rax), %rax
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0xc(%rbp), %rcx
imulq $0x26a8, %rcx, %rcx     # imm = 0x26A8
addq %rcx, %rax
movl $0x1, 0x1168(%rax)
leaq 0x125b8(%rip), %rax     # 0x28a70
movq (%rax), %rax
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0xc(%rbp), %rcx
imulq $0x26a8, %rcx, %rcx     # imm = 0x26A8
addq %rcx, %rax
movl $0x1, 0x1174(%rax)
leaq -0x1c0(%rbp), %rdi
leaq 0xace6(%rip), %rsi      # 0x211cd
callq 0x21c0
jmp 0x1668d
leaq 0x12578(%rip), %rax     # 0x28a70
movq (%rax), %rax
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0xc(%rbp), %rcx
imulq $0x26a8, %rcx, %rcx     # imm = 0x26A8
addq %rcx, %rax
movl $0x1, 0x1164(%rax)
leaq 0x12550(%rip), %rax     # 0x28a70
movq (%rax), %rax
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0xc(%rbp), %rcx
imulq $0x26a8, %rcx, %rcx     # imm = 0x26A8
addq %rcx, %rax
movl $0x1, 0x115c(%rax)
leaq -0x1c0(%rbp), %rdi
leaq 0xac84(%rip), %rsi      # 0x211d3
callq 0x21c0
jmp 0x1668d
leaq 0x12510(%rip), %rax     # 0x28a70
movq (%rax), %rax
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0xc(%rbp), %rcx
imulq $0x26a8, %rcx, %rcx     # imm = 0x26A8
addq %rcx, %rax
movl $0x1, 0x118c(%rax)
leaq 0x124e8(%rip), %rax     # 0x28a70
movq (%rax), %rax
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0xc(%rbp), %rcx
imulq $0x26a8, %rcx, %rcx     # imm = 0x26A8
addq %rcx, %rax
movl $0x1, 0x1184(%rax)
leaq -0x1c0(%rbp), %rdi
leaq 0xac21(%rip), %rsi      # 0x211d8
callq 0x21c0
jmp 0x1668d
leaq 0x124a8(%rip), %rax     # 0x28a70
movq (%rax), %rax
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0xc(%rbp), %rcx
imulq $0x26a8, %rcx, %rcx     # imm = 0x26A8
addq %rcx, %rax
movl $0x1, 0x1180(%rax)
leaq 0x12480(%rip), %rax     # 0x28a70
movq (%rax), %rax
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0xc(%rbp), %rcx
imulq $0x26a8, %rcx, %rcx     # imm = 0x26A8
addq %rcx, %rax
movl $0x1, 0x1178(%rax)
leaq -0x1c0(%rbp), %rdi
leaq 0xabc0(%rip), %rsi      # 0x211df
callq 0x21c0
jmp 0x1668d
leaq 0x12443(%rip), %rax     # 0x28a70
movq (%rax), %rax
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0xc(%rbp), %rcx
imulq $0x26a8, %rcx, %rcx     # imm = 0x26A8
addq %rcx, %rax
movl $0x1, 0x1198(%rax)
leaq 0x1241b(%rip), %rax     # 0x28a70
movq (%rax), %rax
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0xc(%rbp), %rcx
imulq $0x26a8, %rcx, %rcx     # imm = 0x26A8
addq %rcx, %rax
movl $0x1, 0x1190(%rax)
leaq -0x1c0(%rbp), %rdi
leaq 0xab64(%rip), %rsi      # 0x211e8
callq 0x21c0
jmp 0x1668d
jmp 0x166ec
leaq -0x1a0(%rbp), %rdi
leaq 0x123d5(%rip), %rax     # 0x28a70
movq (%rax), %rcx
addq $0x100, %rcx            # imm = 0x100
movq -0x8(%rbp), %r8
leaq -0x1c0(%rbp), %r9
movl $0x190, %esi            # imm = 0x190
leaq 0xab35(%rip), %rdx      # 0x211f1
movb $0x0, %al
callq 0x2390
leaq -0x1a0(%rbp), %rax
movq %rax, -0x1d0(%rbp)
leaq -0x1a0(%rbp), %rdi
callq 0x20c0
movq -0x1d0(%rbp), %rdi
movq %rax, %rsi
callq 0x12840
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop