// File: /workspace/github_c_makefile_star2_O1/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 0x5a63
movq %rax, %rbx
leaq 0x1c1ce(%rip), %rax     # 0x21a80
movq (%rax), %rcx
movslq %ebp, %rax
imulq $0x26a8, %rax, %rax     # imm = 0x26A8
cmpq $0x0, 0x27f0(%rcx,%rax)
jle 0x59ba
leaq 0x100(%r14), %rdi
leaq 0xd693(%rip), %rsi      # 0x12f6f
callq 0xd1ba
testl %eax, %eax
je 0x5a51
leaq 0x1a9f0(%rip), %r15     # 0x202e0
movl $0x6c616568, %eax       # imm = 0x6C616568
xorl 0x190(%r15), %eax
movzbl 0x194(%r15), %ecx
orl %eax, %ecx
je 0x59f7
movl $0x6e696172, %eax       # imm = 0x6E696172
xorl 0x190(%r15), %eax
movzbl 0x194(%r15), %ecx
orl %eax, %ecx
je 0x5a0d
movabsq $0x6c6c616265726966, %rax # imm = 0x6C6C616265726966
xorq 0x190(%r15), %rax
movzbl 0x198(%r15), %ecx
orq %rax, %rcx
je 0x5a17
movl $0x69766572, %eax       # imm = 0x69766572
xorl 0x190(%r15), %eax
movl $0x657669, %ecx         # imm = 0x657669
xorl 0x193(%r15), %ecx
orl %eax, %ecx
je 0x5a35
movabsq $0x74726f70656c6574, %rax # imm = 0x74726F70656C6574
xorq 0x190(%r15), %rax
movzbl 0x198(%r15), %ecx
orq %rax, %rcx
jne 0x5a51
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 0xebd4
jmp 0x5a51
addq $0x100, %rcx            # imm = 0x100
leaq 0xd575(%rip), %rdx      # 0x12f3d
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 0xcd1c
movl $0x320, %esi            # imm = 0x320
addq 0x195dd(%rip), %rsi     # 0x1efe0
movq %r14, %rdi
callq 0xe4f4
jmp 0x5a51
movq %r14, %rdi
callq 0xec2a
jmp 0x5a51
movl $0x320, %edi            # imm = 0x320
addq 0x195bd(%rip), %rdi     # 0x1efe0
callq 0xd008
movq %r14, %rdi
movq %rax, %rsi
callq 0xe8db
jmp 0x5a51
movl $0x320, %edi            # imm = 0x320
addq 0x1959f(%rip), %rdi     # 0x1efe0
callq 0xd008
movq %r14, %rdi
movq %rax, %rsi
callq 0xe740
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x2240
callq 0x2711