// File: /workspace/github_c_makefile_star2_O0/Ziddykins[P]Dawn/src/status.c
// Function: event_handler
void event_handler(int sig) {
    assert(sig == SIGALRM);
    struct event * e;
    do {
        e = retr_event(); //handle event
        switch (e->event) {
            case MSGSEND:
            {
                pop_hist_msg();
                process_messages();
                break;
            }
            case HEALING:
            {
                int j;
                for (j=0; j < dawn->player_count; j++) {
                    if ((dawn->players[j].health + 5) <= dawn->players[j].max_health) {
                        dawn->players[j].health += 5;
                    } else {
                        dawn->players[j].health = dawn->players[j].max_health;
                    }
                }
                add_event(HEALING, 0, HEALING_INTERVAL, NORMAL);
                break;
            }
            case SAVING:
            {
                persistent_save();
                add_event(SAVING, 0, SAVING_INTERVAL, NORMAL);
                break;
            }
            case HOURLY:
            {
                hourly_events();
                add_event(HOURLY, 0, 3600, NORMAL);
                break;
            }
            case TRAVEL:
            {
                if(dawn->players[e->data].travel_timer.active) {
                    char out[MAX_MESSAGE_BUFFER];
                    dawn->players[e->data].pos_x = dawn->players[e->data].travel_timer.pos.x;
                    dawn->players[e->data].pos_y = dawn->players[e->data].travel_timer.pos.y;
                    sprintf(out, "PRIVMSG %s :%s has arrived at %d,%d\r\n", dawn->active_room, dawn->players[e->data].username,
                            dawn->players[e->data].pos_x, dawn->players[e->data].pos_y);
                    add_msg(out, strlen(out));
                    dawn->players[e->data].travel_timer.active = 0;
                    //check_special_location(dawn, e->data); DEPRECATED
                }
                break;
            }
            case LOTTERY_COLLECT:
            {
                lottery_collect();
                add_event(LOTTERY_COLLECT, 0, LOTTERY_COLLECT_INTERVAL, NORMAL);
                break;
            }
            case LOTTERY_REWARD:
            {
                lottery_reward();
                add_event(LOTTERY_REWARD, 0, LOTTERY_REWARD_INTERVAL, NORMAL);
                break;
            }
            case BOUNTY_RESET:
            {
                dawn->gbounty.amount = 0;
                gen_global_bounty();
                add_event(BOUNTY_RESET, 0, BOUNTY_RESET_INTERVAL, NORMAL);
                break;
            }
            case BOUNTY_INIT:
            {

                memset(&dawn->gbounty, 0, sizeof(dawn->gbounty));
                gen_global_bounty();
                break;
            }
        }
        free(e);
    } while(is_next_due());
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1c0, %rsp            # imm = 0x1C0
movl %edi, -0x4(%rbp)
cmpl $0xe, -0x4(%rbp)
jne 0x16a86
jmp 0x16aa5
leaq 0xa97f(%rip), %rdi      # 0x2140c
leaq 0xa987(%rip), %rsi      # 0x2141b
movl $0xe8, %edx
leaq 0xa988(%rip), %rcx      # 0x21428
callq 0x2100
jmp 0x16aa7
callq 0x17790
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
movq %rax, -0x1b8(%rbp)
subq $0x8, %rax
ja 0x16e4b
movq -0x1b8(%rbp), %rax
leaq 0xa747(%rip), %rcx      # 0x2121c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
callq 0x12a90
callq 0x12980
jmp 0x16e4b
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq 0x11f72(%rip), %rcx     # 0x28a70
cmpl 0x148(%rcx), %eax
jge 0x16bdb
movq 0x11f5f(%rip), %rax     # 0x28a70
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0x14(%rbp), %rcx
imulq $0x26a8, %rcx, %rcx     # imm = 0x26A8
addq %rcx, %rax
movq 0x2650(%rax), %rax
addq $0x5, %rax
movq 0x11f39(%rip), %rcx     # 0x28a70
addq $0x1a0, %rcx            # imm = 0x1A0
movslq -0x14(%rbp), %rdx
imulq $0x26a8, %rdx, %rdx     # imm = 0x26A8
addq %rdx, %rcx
movslq 0x2670(%rcx), %rcx
cmpq %rcx, %rax
jg 0x16b87
movq 0x11f11(%rip), %rax     # 0x28a70
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0x14(%rbp), %rcx
imulq $0x26a8, %rcx, %rcx     # imm = 0x26A8
addq %rcx, %rax
movq 0x2650(%rax), %rcx
addq $0x5, %rcx
movq %rcx, 0x2650(%rax)
jmp 0x16bcb
movq 0x11ee2(%rip), %rax     # 0x28a70
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0x14(%rbp), %rcx
imulq $0x26a8, %rcx, %rcx     # imm = 0x26A8
addq %rcx, %rax
movslq 0x2670(%rax), %rcx
movq 0x11ec0(%rip), %rax     # 0x28a70
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0x14(%rbp), %rdx
imulq $0x26a8, %rdx, %rdx     # imm = 0x26A8
addq %rdx, %rax
movq %rcx, 0x2650(%rax)
jmp 0x16bcd
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x16af4
xorl %ecx, %ecx
movl $0x708, %edx            # imm = 0x708
movl %ecx, %edi
movl %ecx, %esi
callq 0x17280
jmp 0x16e4b
callq 0x13b40
movl $0x1, %edi
xorl %ecx, %ecx
movl $0x384, %edx            # imm = 0x384
movl %ecx, %esi
callq 0x17280
jmp 0x16e4b
callq 0x87d0
movl $0x2, %edi
xorl %ecx, %ecx
movl $0xe10, %edx            # imm = 0xE10
movl %ecx, %esi
callq 0x17280
jmp 0x16e4b
movq 0x11e3f(%rip), %rax     # 0x28a70
addq $0x1a0, %rax            # imm = 0x1A0
movq -0x10(%rbp), %rcx
movslq 0x4(%rcx), %rcx
imulq $0x26a8, %rcx, %rcx     # imm = 0x26A8
addq %rcx, %rax
cmpl $0x0, 0x114c(%rax)
je 0x16dcb
movq 0x11e13(%rip), %rax     # 0x28a70
addq $0x1a0, %rax            # imm = 0x1A0
movq -0x10(%rbp), %rcx
movslq 0x4(%rcx), %rcx
imulq $0x26a8, %rcx, %rcx     # imm = 0x26A8
addq %rcx, %rax
movl 0x1144(%rax), %ecx
movq 0x11dee(%rip), %rax     # 0x28a70
addq $0x1a0, %rax            # imm = 0x1A0
movq -0x10(%rbp), %rdx
movslq 0x4(%rdx), %rdx
imulq $0x26a8, %rdx, %rdx     # imm = 0x26A8
addq %rdx, %rax
movl %ecx, 0x25ec(%rax)
movq 0x11dc9(%rip), %rax     # 0x28a70
addq $0x1a0, %rax            # imm = 0x1A0
movq -0x10(%rbp), %rcx
movslq 0x4(%rcx), %rcx
imulq $0x26a8, %rcx, %rcx     # imm = 0x26A8
addq %rcx, %rax
movl 0x1148(%rax), %ecx
movq 0x11da4(%rip), %rax     # 0x28a70
addq $0x1a0, %rax            # imm = 0x1A0
movq -0x10(%rbp), %rdx
movslq 0x4(%rdx), %rdx
imulq $0x26a8, %rdx, %rdx     # imm = 0x26A8
addq %rdx, %rax
movl %ecx, 0x25f0(%rax)
leaq -0x1b0(%rbp), %rdi
movq 0x11d78(%rip), %rdx     # 0x28a70
addq $0x100, %rdx            # imm = 0x100
movq 0x11d6a(%rip), %rcx     # 0x28a70
addq $0x1a0, %rcx            # imm = 0x1A0
movq -0x10(%rbp), %rax
movslq 0x4(%rax), %rax
imulq $0x26a8, %rax, %rax     # imm = 0x26A8
addq %rax, %rcx
movq 0x11d4a(%rip), %rax     # 0x28a70
addq $0x1a0, %rax            # imm = 0x1A0
movq -0x10(%rbp), %rsi
movslq 0x4(%rsi), %rsi
imulq $0x26a8, %rsi, %rsi     # imm = 0x26A8
addq %rsi, %rax
movl 0x25ec(%rax), %r8d
movq 0x11d24(%rip), %rax     # 0x28a70
addq $0x1a0, %rax            # imm = 0x1A0
movq -0x10(%rbp), %rsi
movslq 0x4(%rsi), %rsi
imulq $0x26a8, %rsi, %rsi     # imm = 0x26A8
addq %rsi, %rax
movl 0x25f0(%rax), %r9d
leaq 0xa6ce(%rip), %rsi      # 0x21440
movb $0x0, %al
callq 0x2050
leaq -0x1b0(%rbp), %rax
movq %rax, -0x1c0(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0x20c0
movq -0x1c0(%rbp), %rdi
movq %rax, %rsi
callq 0x12840
movq 0x11cc7(%rip), %rax     # 0x28a70
addq $0x1a0, %rax            # imm = 0x1A0
movq -0x10(%rbp), %rcx
movslq 0x4(%rcx), %rcx
imulq $0x26a8, %rcx, %rcx     # imm = 0x26A8
addq %rcx, %rax
movl $0x0, 0x114c(%rax)
jmp 0x16e4b
callq 0x96a0
movl $0x5, %edi
xorl %ecx, %ecx
movl $0x708, %edx            # imm = 0x708
movl %ecx, %esi
callq 0x17280
jmp 0x16e4b
callq 0x9730
movl $0x6, %edi
xorl %ecx, %ecx
movl $0xa8c0, %edx           # imm = 0xA8C0
movl %ecx, %esi
callq 0x17280
jmp 0x16e4b
movq 0x11c68(%rip), %rax     # 0x28a70
movl $0x0, 0x198(%rax)
callq 0x2e60
movl $0x7, %edi
xorl %ecx, %ecx
movl $0x15180, %edx          # imm = 0x15180
movl %ecx, %esi
callq 0x17280
jmp 0x16e4b
movq 0x11c3d(%rip), %rdi     # 0x28a70
addq $0x158, %rdi            # imm = 0x158
xorl %esi, %esi
movl $0x48, %edx
callq 0x20f0
callq 0x2e60
movq -0x10(%rbp), %rdi
callq 0x2240
callq 0x17830
cmpl $0x0, %eax
jne 0x16aa7
addq $0x1c0, %rsp            # imm = 0x1C0
popq %rbp
retq
nopl (%rax,%rax)