// File: /workspace/github_c_makefile_star2_O2/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 0x22c0
testq %rax, %rax
je 0x4c90
movq %rax, %rbx
leaq 0x1afaa(%rip), %rax     # 0x1fa80
movq (%rax), %rcx
movslq %ebp, %rax
imulq $0x26a8, %rax, %rax     # imm = 0x26A8
cmpq $0x0, 0x27f0(%rcx,%rax)
jle 0x4be7
leaq 0x100(%r14), %rdi
leaq 0xd46f(%rip), %rsi      # 0x11f6f
callq 0xc187
testl %eax, %eax
je 0x4c7e
movl $0x190, %r15d           # imm = 0x190
addq 0x184c6(%rip), %r15     # 0x1cfe0
leaq 0xd483(%rip), %rsi      # 0x11fa4
pushq $0x5
popq %rdx
movq %r15, %rdi
callq 0x2200
testl %eax, %eax
je 0x4c24
leaq 0xd46e(%rip), %rsi      # 0x11fa9
pushq $0x5
popq %rdx
movq %r15, %rdi
callq 0x2200
testl %eax, %eax
je 0x4c3a
movl $0x190, %r15d           # imm = 0x190
addq 0x18485(%rip), %r15     # 0x1cfe0
leaq 0xd44c(%rip), %rsi      # 0x11fae
pushq $0x9
popq %rdx
movq %r15, %rdi
callq 0x2200
testl %eax, %eax
je 0x4c44
leaq 0xc920(%rip), %rsi      # 0x1149c
pushq $0x7
popq %rdx
movq %r15, %rdi
callq 0x2200
testl %eax, %eax
je 0x4c62
movl $0x190, %edi            # imm = 0x190
addq 0x18445(%rip), %rdi     # 0x1cfe0
leaq 0xd415(%rip), %rsi      # 0x11fb7
pushq $0x9
popq %rdx
callq 0x2200
testl %eax, %eax
jne 0x4c7e
leaq 0x19727(%rip), %r15     # 0x1e2e0
leaq 0x320(%r15), %rdi
callq 0x2370
movl %eax, %ebp
addq $0x4b0, %r15            # imm = 0x4B0
movq %r15, %rdi
callq 0x2370
movq %r14, %rdi
movl %ebp, %esi
movl %eax, %edx
callq 0xdbe3
jmp 0x4c7e
addq $0x100, %rcx            # imm = 0x100
leaq 0xd348(%rip), %rdx      # 0x11f3d
movl $0x190, %esi            # imm = 0x190
movq %rbx, %rdi
movq %r14, %r8
xorl %eax, %eax
callq 0x23a0
movq %rbx, %rdi
callq 0x20c0
movq %rbx, %rdi
movq %rax, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xbd04
movl $0x320, %esi            # imm = 0x320
addq 0x183b0(%rip), %rsi     # 0x1cfe0
movq %r14, %rdi
callq 0xd51c
jmp 0x4c7e
movq %r14, %rdi
callq 0xdc37
jmp 0x4c7e
movl $0x320, %edi            # imm = 0x320
addq 0x18390(%rip), %rdi     # 0x1cfe0
callq 0xbfd4
movq %r14, %rdi
movq %rax, %rsi
callq 0xd8f6
jmp 0x4c7e
movl $0x320, %edi            # imm = 0x320
addq 0x18372(%rip), %rdi     # 0x1cfe0
callq 0xbfd4
movq %r14, %rdi
movq %rax, %rsi
callq 0xd762
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x2250
leaq 0xd25b(%rip), %rdi      # 0x11ef2
callq 0x2190
pushq $0x1
popq %rdi
callq 0x2270