// File: /workspace/github_c_makefile_star2_O2/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 0x4021(%rip), %rsi      # 0x106ae
movq %r14, %rdi
callq 0x22e0
testl %eax, %eax
jne 0xc6a1
movq %rbx, %rdi
callq 0xc91b
leaq 0x9eb3(%rip), %rsi      # 0x1655b
movq %r14, %rdi
callq 0xc187
testl %eax, %eax
je 0xc806
movq %rbx, %rdi
callq 0xc860
movl %eax, %ebp
leaq 0x9e99(%rip), %rsi      # 0x16562
movq %r14, %rdi
callq 0xc187
cmpl $-0x1, %ebp
je 0xc7b8
leaq 0x1339f(%rip), %r13     # 0x1fa80
movq (%r13), %r15
movslq %ebp, %rax
imulq $0x26a8, %rax, %r12     # imm = 0x26A8
cmpb $0x0, 0x2840(%r15,%r12)
je 0xc768
leaq (%r15,%r12), %rdi
addq $0x1a0, %rdi            # imm = 0x1A0
addq $0x40, %rdi
leaq 0x80(%rbx), %r14
movq %r14, %rsi
callq 0x22e0
testl %eax, %eax
je 0xc768
leaq 0xc0(%rbx), %rdx
leaq 0x9e42(%rip), %rsi      # 0x1656c
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 0xbd04
movq (%r13), %r15
leaq (%r15,%r12), %rdi
addq $0x1e0, %rdi            # imm = 0x1E0
leaq 0x80(%rbx), %rsi
callq 0x22e0
testl %eax, %eax
je 0xc796
leaq (%r15,%r12), %rax
addq $0x1a0, %rax            # imm = 0x1A0
cmpb $0x1, 0x26a0(%rax)
jne 0xc7d5
leaq 0x11cd3(%rip), %rdi     # 0x1e470
movl %ebp, %esi
callq 0xc5d8
testl %eax, %eax
jne 0xc806
addq $0xc0, %rbx
leaq 0x9e7c(%rip), %rsi      # 0x16632
jmp 0xc7c6
addq $0xc0, %rbx
leaq 0x3eed(%rip), %rsi      # 0x106b3
movq %rsp, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2050
jmp 0xc7f0
leaq 0xc0(%rbx), %rdx
leaq 0x9db6(%rip), %rsi      # 0x16599
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 0xbd04
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq