// File: /workspace/github_c_makefile_star2_O3/Ziddykins[P]Dawn/src/parse.c
// Function: parse_room_message
void parse_room_message(struct Message *message) {
    char out[MAX_MESSAGE_BUFFER];
    if (strcmp(message->message, ";new") == 0) {
        init_new_character(message);
    }

    //Check if a user has an account and is logged in from the correct host
    if (matches_regex(message->message, "^;(.*)")) {
        int pindex = get_pindex(message->sender_nick);

        //store command to check if user can execute it in current state
        matches_regex(message->message, "^;(.*?)\\s");

        if (pindex == -1) {
            sprintf(out, "PRIVMSG %s :Please create a new account by issuing ';new'\r\n", message->receiver);
            add_msg(out, strlen(out));
            return;
        }

        if (dawn->players[pindex].auth_level &&
                strcmp(dawn->players[pindex].hostmask, message->sender_hostmask) != 0) {
            sprintf(out, "PRIVMSG %s :%s, I've updated your hostmask\r\n", message->receiver, message->sender_nick);
            strcpy(dawn->players[pindex].hostmask, message->sender_hostmask);
            add_msg(out, strlen(out));
        }

        if (strcmp(dawn->players[pindex].hostmask, message->sender_hostmask) != 0
            && dawn->players[pindex].auth_level != 1) {
            sprintf(out, "PRIVMSG %s :%s, I seem to recall you connecting from a different host. Please login "
                    "by sending me a private message containing: ;login <your_password>\r\n",
                    message->receiver, message->sender_nick);
            add_msg(out, strlen(out));
            return;
        }

        if (!command_allowed(regex_group[1], pindex)) {
            sprintf(out, "PRIVMSG %s :This command cannot be used at this time\r\n",  message->receiver);
            add_msg(out, strlen(out));
            return;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
movq %rdi, %rbx
leaq 0x100(%rdi), %r14
leaq 0x3e4a(%rip), %rsi      # 0x116e2
movq %r14, %rdi
callq 0x22d0
testl %eax, %eax
jne 0xd8ac
movq %rbx, %rdi
callq 0xdb28
leaq 0x9cde(%rip), %rsi      # 0x17591
movq %r14, %rdi
callq 0xd3aa
testl %eax, %eax
je 0xda11
movq %rbx, %rdi
callq 0xda6c
movl %eax, %ebp
leaq 0x9cc4(%rip), %rsi      # 0x17598
movq %r14, %rdi
callq 0xd3aa
cmpl $-0x1, %ebp
je 0xd9c3
leaq 0x14194(%rip), %r13     # 0x21a80
movq (%r13), %r15
movslq %ebp, %rax
imulq $0x26a8, %rax, %r12     # imm = 0x26A8
cmpb $0x0, 0x2840(%r15,%r12)
je 0xd973
leaq (%r15,%r12), %rdi
addq $0x1a0, %rdi            # imm = 0x1A0
addq $0x40, %rdi
leaq 0x80(%rbx), %r14
movq %r14, %rsi
callq 0x22d0
testl %eax, %eax
je 0xd973
leaq 0xc0(%rbx), %rdx
leaq 0x9c6d(%rip), %rsi      # 0x175a2
movq %rsp, %r15
movq %r15, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2050
movq (%r13), %rax
leaq (%rax,%r12), %rdi
addq $0x1e0, %rdi            # imm = 0x1E0
movq %r14, %rsi
callq 0x21c0
movq %r15, %rdi
callq 0x20c0
movq %r15, %rdi
movq %rax, %rsi
callq 0xcefe
movq (%r13), %r15
leaq (%r15,%r12), %rdi
addq $0x1e0, %rdi            # imm = 0x1E0
leaq 0x80(%rbx), %rsi
callq 0x22d0
testl %eax, %eax
je 0xd9a1
leaq (%r15,%r12), %rax
addq $0x1a0, %rax            # imm = 0x1A0
cmpb $0x1, 0x26a0(%rax)
jne 0xd9e0
leaq 0x12ac8(%rip), %rdi     # 0x20470
movl %ebp, %esi
callq 0xd7d6
testl %eax, %eax
jne 0xda11
addq $0xc0, %rbx
leaq 0x9ca7(%rip), %rsi      # 0x17668
jmp 0xd9d1
addq $0xc0, %rbx
leaq 0x3d16(%rip), %rsi      # 0x116e7
movq %rsp, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2050
jmp 0xd9fb
leaq 0xc0(%rbx), %rdx
leaq 0x9be1(%rip), %rsi      # 0x175cf
movq %rsp, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2050
movq %rsp, %rbx
movq %rbx, %rdi
callq 0x20c0
movq %rbx, %rdi
movq %rax, %rsi
callq 0xcefe
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop