// File: /workspace/github_c_makefile_star2_O0/Ziddykins[P]Dawn/src/events.c
// Function: random_punishment
static void random_punishment(char const *username) { //username -> MAX_NICK_LENGTH
    char out[MAX_MESSAGE_BUFFER];
    int index = get_pindex(username);
    int which = rand() % MAX_PUNISHMENT_TYPE;

    switch (which) {
        case 0:
        {
            int damage_taken = rand() % 25 + 1;
            struct Message temp;
            strncpy(temp.sender_nick, username, MAX_NICK_LENGTH);
            strncpy(temp.receiver, dawn->active_room, MAX_CHANNEL_LENGTH);
            dawn->players[index].health -= damage_taken;
            sprintf(out, "PRIVMSG %s :A pack of wolves corner %s and munch on them a little bit. HP -%d\r\n",
                    dawn->active_room, username, damage_taken);
            add_msg(out, strlen(out));
            check_alive(&temp);
            break;
        }
        case 1:
        {
            int damage_taken = rand() % 45 + 1;
            struct Message temp;
            strncpy(temp.sender_nick, username, MAX_NICK_LENGTH);
            strncpy(temp.receiver, dawn->active_room, MAX_CHANNEL_LENGTH);
            dawn->players[index].health -= damage_taken;
            sprintf(out, "PRIVMSG %s :While walking, %s was struck by lightning! HP -%d\r\n",
                    dawn->active_room, username, damage_taken);
            add_msg(out, strlen(out));
            check_alive(&temp);
            break;
        }
        case 2:
            dawn->players[index].fullness -= 5;
            sprintf(out, "PRIVMSG %s :%s comes across a vendor giving out free cheese samples. You decide to "
                    "try a wedge, and it is awful! You promptly vomit.  Fullness -5\r\n", dawn->active_room, username);
            add_msg(out, strlen(out));
            check_famine(index);
            break;
        default:
            PRINTERR("INVALID PUNISHMENT")
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x13d0, %rsp           # imm = 0x13D0
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x13ba0
movl %eax, -0x1a4(%rbp)
callq 0x2080
movslq %eax, %rcx
imulq $0x55555556, %rcx, %rdx # imm = 0x55555556
movq %rdx, %rcx
shrq $0x3f, %rcx
shrq $0x20, %rdx
addl %ecx, %edx
movl %edx, %ecx
leal (%rcx,%rcx,2), %ecx
subl %ecx, %eax
movl %eax, -0x1a8(%rbp)
movl -0x1a8(%rbp), %eax
movl %eax, -0x13b4(%rbp)
testl %eax, %eax
je 0x8d1e
jmp 0x8cf9
movl -0x13b4(%rbp), %eax
subl $0x1, %eax
je 0x8e22
jmp 0x8d0a
movl -0x13b4(%rbp), %eax
subl $0x2, %eax
je 0x8f26
jmp 0x8fb8
callq 0x2080
movl $0x19, %ecx
cltd
idivl %ecx
addl $0x1, %edx
movl %edx, -0x1ac(%rbp)
leaq -0xaac(%rbp), %rdi
movq -0x8(%rbp), %rsi
leaq 0x1d516(%rip), %rax     # 0x2625c
movl (%rax), %eax
movl %eax, %edx
callq 0x20e0
leaq -0xaac(%rbp), %rdi
addq $0xc0, %rdi
leaq 0x1fd0c(%rip), %rax     # 0x28a70
movq (%rax), %rsi
addq $0x100, %rsi            # imm = 0x100
leaq 0x1d4e3(%rip), %rax     # 0x26258
movl (%rax), %eax
movl %eax, %edx
callq 0x20e0
movslq -0x1ac(%rbp), %rdx
leaq 0x1fce4(%rip), %rax     # 0x28a70
movq (%rax), %rax
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0x1a4(%rbp), %rcx
imulq $0x26a8, %rcx, %rcx     # imm = 0x26A8
addq %rcx, %rax
movq 0x2650(%rax), %rcx
subq %rdx, %rcx
movq %rcx, 0x2650(%rax)
leaq -0x1a0(%rbp), %rdi
leaq 0x1fcab(%rip), %rax     # 0x28a70
movq (%rax), %rdx
addq $0x100, %rdx            # imm = 0x100
movq -0x8(%rbp), %rcx
movl -0x1ac(%rbp), %r8d
leaq 0x140df(%rip), %rsi     # 0x1cec0
movb $0x0, %al
callq 0x2050
leaq -0x1a0(%rbp), %rax
movq %rax, -0x13c0(%rbp)
leaq -0x1a0(%rbp), %rdi
callq 0x20c0
movq -0x13c0(%rbp), %rdi
movq %rax, %rsi
callq 0x12840
leaq -0xaac(%rbp), %rdi
callq 0x4590
jmp 0x8fc4
callq 0x2080
movl $0x2d, %ecx
cltd
idivl %ecx
addl $0x1, %edx
movl %edx, -0xab0(%rbp)
leaq -0x13b0(%rbp), %rdi
movq -0x8(%rbp), %rsi
leaq 0x1d412(%rip), %rax     # 0x2625c
movl (%rax), %eax
movl %eax, %edx
callq 0x20e0
leaq -0x13b0(%rbp), %rdi
addq $0xc0, %rdi
leaq 0x1fc08(%rip), %rax     # 0x28a70
movq (%rax), %rsi
addq $0x100, %rsi            # imm = 0x100
leaq 0x1d3df(%rip), %rax     # 0x26258
movl (%rax), %eax
movl %eax, %edx
callq 0x20e0
movslq -0xab0(%rbp), %rdx
leaq 0x1fbe0(%rip), %rax     # 0x28a70
movq (%rax), %rax
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0x1a4(%rbp), %rcx
imulq $0x26a8, %rcx, %rcx     # imm = 0x26A8
addq %rcx, %rax
movq 0x2650(%rax), %rcx
subq %rdx, %rcx
movq %rcx, 0x2650(%rax)
leaq -0x1a0(%rbp), %rdi
leaq 0x1fba7(%rip), %rax     # 0x28a70
movq (%rax), %rdx
addq $0x100, %rdx            # imm = 0x100
movq -0x8(%rbp), %rcx
movl -0xab0(%rbp), %r8d
leaq 0x1402b(%rip), %rsi     # 0x1cf10
movb $0x0, %al
callq 0x2050
leaq -0x1a0(%rbp), %rax
movq %rax, -0x13c8(%rbp)
leaq -0x1a0(%rbp), %rdi
callq 0x20c0
movq -0x13c8(%rbp), %rdi
movq %rax, %rsi
callq 0x12840
leaq -0x13b0(%rbp), %rdi
callq 0x4590
jmp 0x8fc4
leaq 0x1fb43(%rip), %rax     # 0x28a70
movq (%rax), %rax
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0x1a4(%rbp), %rcx
imulq $0x26a8, %rcx, %rcx     # imm = 0x26A8
addq %rcx, %rax
movswl 0x26a2(%rax), %ecx
subl $0x5, %ecx
movw %cx, 0x26a2(%rax)
leaq -0x1a0(%rbp), %rdi
leaq 0x1fb0a(%rip), %rax     # 0x28a70
movq (%rax), %rdx
addq $0x100, %rdx            # imm = 0x100
movq -0x8(%rbp), %rcx
leaq 0x13fd5(%rip), %rsi     # 0x1cf50
movb $0x0, %al
callq 0x2050
leaq -0x1a0(%rbp), %rax
movq %rax, -0x13d0(%rbp)
leaq -0x1a0(%rbp), %rdi
callq 0x20c0
movq -0x13d0(%rbp), %rdi
movq %rax, %rsi
callq 0x12840
movl -0x1a4(%rbp), %edi
callq 0x9550
jmp 0x8fc4
leaq 0x14025(%rip), %rdi     # 0x1cfe4
callq 0x2190
addq $0x13d0, %rsp           # imm = 0x13D0
popq %rbp
retq
nopl (%rax)