// File: /workspace/github_c_makefile_star2_O3/Ziddykins[P]Dawn/src/commands.c
// Function: cmd_cast
void cmd_cast(int pindex, struct Message * msg) {
    char *out;
    CALLEXIT (!(out = malloc(MAX_MESSAGE_BUFFER)))
    if (dawn->players[pindex].health <= 0) {
        snprintf(out, MAX_MESSAGE_BUFFER, "PRIVMSG %s :%s, dead people can not cast spells\r\n",
                dawn->active_room, msg->sender_nick);
        add_msg(out, strlen(out));
        return;
    }
    if (matches_regex(msg->message, CMD_LIT" (\\w+)\\s?([a-zA-Z0-9]+)?\\s?([a-zA-Z0-9]+)?")) {
        if (strcmp(regex_group[1], "heal") == 0) {
            cast_heal(msg->sender_nick, regex_group[2]);
        } else if (strcmp(regex_group[1], "rain") == 0) {
            cast_rain(msg->sender_nick);
        } else if (strcmp(regex_group[1], "fireball") == 0) {
            cast_fireball(msg->sender_nick, to_lower(regex_group[2]));
        } else if (strcmp(regex_group[1], "revive") == 0) {
            cast_revive(msg->sender_nick, to_lower(regex_group[2]));
        } else if (strcmp(regex_group[1], "teleport") == 0) {
            cast_teleport(msg->sender_nick, atoi(regex_group[2]), atoi(regex_group[3]));
        }
    }
    free(out);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movl %edi, %ebp
movl $0x190, %edi            # imm = 0x190
callq 0x22b0
testq %rax, %rax
je 0x5acc
movq %rax, %rbx
leaq 0x1c165(%rip), %rax     # 0x21a80
movq (%rax), %rcx
movslq %ebp, %rax
imulq $0x26a8, %rax, %rax     # imm = 0x26A8
cmpq $0x0, 0x27f0(%rcx,%rax)
jle 0x5a23
leaq 0x100(%r14), %rdi
leaq 0xd662(%rip), %rsi      # 0x12fa7
callq 0xd3aa
testl %eax, %eax
je 0x5aba
leaq 0x1a987(%rip), %r15     # 0x202e0
movl $0x6c616568, %eax       # imm = 0x6C616568
xorl 0x190(%r15), %eax
movzbl 0x194(%r15), %ecx
orl %eax, %ecx
je 0x5a60
movl $0x6e696172, %eax       # imm = 0x6E696172
xorl 0x190(%r15), %eax
movzbl 0x194(%r15), %ecx
orl %eax, %ecx
je 0x5a76
movabsq $0x6c6c616265726966, %rax # imm = 0x6C6C616265726966
xorq 0x190(%r15), %rax
movzbl 0x198(%r15), %ecx
orq %rax, %rcx
je 0x5a80
movl $0x69766572, %eax       # imm = 0x69766572
xorl 0x190(%r15), %eax
movl $0x657669, %ecx         # imm = 0x657669
xorl 0x193(%r15), %ecx
orl %eax, %ecx
je 0x5a9e
movabsq $0x74726f70656c6574, %rax # imm = 0x74726F70656C6574
xorq 0x190(%r15), %rax
movzbl 0x198(%r15), %ecx
orq %rax, %rcx
jne 0x5aba
leaq 0x320(%r15), %rdi
callq 0x2360
movl %eax, %ebp
addq $0x4b0, %r15            # imm = 0x4B0
movq %r15, %rdi
callq 0x2360
movq %r14, %rdi
movl %ebp, %esi
movl %eax, %edx
callq 0xeeb4
jmp 0x5aba
addq $0x100, %rcx            # imm = 0x100
leaq 0xd544(%rip), %rdx      # 0x12f75
movl $0x190, %esi            # imm = 0x190
movq %rbx, %rdi
movq %r14, %r8
xorl %eax, %eax
callq 0x2390
movq %rbx, %rdi
callq 0x20c0
movq %rbx, %rdi
movq %rax, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xcefe
movl $0x320, %esi            # imm = 0x320
addq 0x19574(%rip), %rsi     # 0x1efe0
movq %r14, %rdi
callq 0xe7d4
jmp 0x5aba
movq %r14, %rdi
callq 0xef0a
jmp 0x5aba
movl $0x320, %edi            # imm = 0x320
addq 0x19554(%rip), %rdi     # 0x1efe0
callq 0xd1f8
movq %r14, %rdi
movq %rax, %rsi
callq 0xebbb
jmp 0x5aba
movl $0x320, %edi            # imm = 0x320
addq 0x19536(%rip), %rdi     # 0x1efe0
callq 0xd1f8
movq %r14, %rdi
movq %rax, %rsi
callq 0xea20
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x2240
callq 0x2711