// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x190, %edi            # imm = 0x190
callq 0x22b0
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
jne 0x6399
leaq 0x15b70(%rip), %rdi     # 0x1befa
callq 0x2190
movl $0x1, %edi
callq 0x2260
leaq 0x226d0(%rip), %rax     # 0x28a70
movq (%rax), %rax
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0x4(%rbp), %rcx
imulq $0x26a8, %rcx, %rcx     # imm = 0x26A8
addq %rcx, %rax
cmpq $0x0, 0x2650(%rax)
jg 0x640f
movq -0x18(%rbp), %rdi
leaq 0x226a4(%rip), %rax     # 0x28a70
movq (%rax), %rcx
addq $0x100, %rcx            # imm = 0x100
movq -0x10(%rbp), %r8
movl $0x190, %esi            # imm = 0x190
leaq 0x15b5f(%rip), %rdx     # 0x1bf45
movb $0x0, %al
callq 0x2390
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
callq 0x20c0
movq -0x20(%rbp), %rdi
movq %rax, %rsi
callq 0x12840
jmp 0x659b
movq -0x10(%rbp), %rdi
addq $0x100, %rdi            # imm = 0x100
leaq 0x15b56(%rip), %rsi     # 0x1bf77
callq 0x13090
cmpl $0x0, %eax
je 0x6592
leaq 0x20e9a(%rip), %rdi     # 0x272d0
addq $0x190, %rdi            # imm = 0x190
leaq 0x15b68(%rip), %rsi     # 0x1bfac
callq 0x22d0
cmpl $0x0, %eax
jne 0x646a
movq -0x10(%rbp), %rdi
leaq 0x20e77(%rip), %rsi     # 0x272d0
addq $0x320, %rsi            # imm = 0x320
callq 0x15240
jmp 0x6590
leaq 0x20e5f(%rip), %rdi     # 0x272d0
addq $0x190, %rdi            # imm = 0x190
leaq 0x15b32(%rip), %rsi     # 0x1bfb1
callq 0x22d0
cmpl $0x0, %eax
jne 0x6497
movq -0x10(%rbp), %rdi
callq 0x160c0
jmp 0x658e
leaq 0x20e32(%rip), %rdi     # 0x272d0
addq $0x190, %rdi            # imm = 0x190
leaq 0x15b0a(%rip), %rsi     # 0x1bfb6
callq 0x22d0
cmpl $0x0, %eax
jne 0x64e2
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
leaq 0x20e0b(%rip), %rdi     # 0x272d0
addq $0x320, %rdi            # imm = 0x320
callq 0x12d60
movq -0x28(%rbp), %rdi
movq %rax, %rsi
callq 0x15a80
jmp 0x658c
leaq 0x20de7(%rip), %rdi     # 0x272d0
addq $0x190, %rdi            # imm = 0x190
leaq 0x14fa5(%rip), %rsi     # 0x1b49c
callq 0x22d0
cmpl $0x0, %eax
jne 0x652a
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
leaq 0x20dc0(%rip), %rdi     # 0x272d0
addq $0x320, %rdi            # imm = 0x320
callq 0x12d60
movq -0x30(%rbp), %rdi
movq %rax, %rsi
callq 0x156f0
jmp 0x658a
leaq 0x20d9f(%rip), %rdi     # 0x272d0
addq $0x190, %rdi            # imm = 0x190
leaq 0x15a80(%rip), %rsi     # 0x1bfbf
callq 0x22d0
cmpl $0x0, %eax
jne 0x6588
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
leaq 0x20d78(%rip), %rdi     # 0x272d0
addq $0x320, %rdi            # imm = 0x320
callq 0x2360
movl %eax, -0x34(%rbp)
leaq 0x20d62(%rip), %rdi     # 0x272d0
addq $0x4b0, %rdi            # imm = 0x4B0
callq 0x2360
movq -0x40(%rbp), %rdi
movl -0x34(%rbp), %esi
movl %eax, %edx
callq 0x16050
jmp 0x658a
jmp 0x658c
jmp 0x658e
jmp 0x6590
jmp 0x6592
movq -0x18(%rbp), %rdi
callq 0x2240
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)