// File: /workspace/github_c_makefile_star2_O1/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 0x3fe7(%rip), %rsi      # 0x116ae
movq %r14, %rdi
callq 0x22d0
testl %eax, %eax
jne 0xd6db
movq %rbx, %rdi
callq 0xd958
leaq 0x9e4f(%rip), %rsi      # 0x17531
movq %r14, %rdi
callq 0xd1ba
testl %eax, %eax
je 0xd840
movq %rbx, %rdi
callq 0xd89c
movl %eax, %ebp
leaq 0x9e35(%rip), %rsi      # 0x17538
movq %r14, %rdi
callq 0xd1ba
cmpl $-0x1, %ebp
je 0xd7f2
leaq 0x14365(%rip), %r13     # 0x21a80
movq (%r13), %rax
movslq %ebp, %rcx
imulq $0x26a8, %rcx, %r12     # imm = 0x26A8
cmpb $0x0, 0x2840(%rax,%r12)
je 0xd79e
leaq (%rax,%r12), %rdi
addq $0x1a0, %rdi            # imm = 0x1A0
addq $0x40, %rdi
leaq 0x80(%rbx), %r14
movq %r14, %rsi
callq 0x22d0
testl %eax, %eax
je 0xd79e
leaq 0xc0(%rbx), %rdx
leaq 0x9dde(%rip), %rsi      # 0x17542
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 0xcd1c
movq (%r13), %r14
leaq (%r14,%r12), %rdi
addq $0x1e0, %rdi            # imm = 0x1E0
leaq 0x80(%rbx), %rsi
callq 0x22d0
testl %eax, %eax
je 0xd7d0
leaq (%r14,%r12), %rax
addq $0x1a0, %rax            # imm = 0x1A0
cmpb $0x1, 0x26a0(%rax)
jne 0xd80f
leaq 0x12c99(%rip), %rdi     # 0x20470
movl %ebp, %esi
callq 0xd5e2
testl %eax, %eax
jne 0xd840
addq $0xc0, %rbx
leaq 0x9e18(%rip), %rsi      # 0x17608
jmp 0xd800
addq $0xc0, %rbx
leaq 0x3eb3(%rip), %rsi      # 0x116b3
movq %rsp, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2050
jmp 0xd82a
leaq 0xc0(%rbx), %rdx
leaq 0x9d52(%rip), %rsi      # 0x1756f
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 0xcd1c
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop