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

    switch (which) {
        case 0:
            dawn->players[index].health = dawn->players[index].max_health;
            dawn->players[index].mana = dawn->players[index].max_mana;
            sprintf(out, "PRIVMSG %s :%s has come across a spring! %s hops in and relaxes. HP/MP replenished!\r\n",
                    dawn->active_room, username, username);
            add_msg(out, strlen(out));
            break;
        case 1:
        {
            int health_gain = 15;
            dawn->players[index].health += health_gain;
            if (dawn->players[index].health >= dawn->players[index].max_health) {
                dawn->players[index].health = dawn->players[index].max_health;
            }
            sprintf(out, "PRIVMSG %s :%s has come across a spring! %s hops in and relaxes... A bit too much. %s"
                            " has peed in the spring! HP +%d\r\n", dawn->active_room, username, username, username,
                    health_gain);
            add_msg(out, strlen(out));
            break;
        }
        case 2:
        {
            int experience_gain = rand() % (dawn->players[index].level * 10) + 1;
            struct Message temp;
            strncpy(temp.sender_nick, username, MAX_NICK_LENGTH);
            strncpy(temp.receiver, dawn->active_room, MAX_CHANNEL_LENGTH);
            dawn->players[index].experience += (unsigned long long) experience_gain;
            check_levelup(&temp);
            sprintf(out, "PRIVMSG %s :%s has come across a spring! They notice etchings all around the spring."
                    " Taking the time to understand the etchings makes them feel more experienced! Exp +%d\r\n",
                    temp.receiver, username, experience_gain);
            add_msg(out, strlen(out));
            break;
        }
        default:
            PRINTERR("INVALID SHRINE")
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xae0, %rsp            # imm = 0xAE0
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, -0xab4(%rbp)
testl %eax, %eax
je 0x904e
jmp 0x9029
movl -0xab4(%rbp), %eax
subl $0x1, %eax
je 0x9148
jmp 0x903a
movl -0xab4(%rbp), %eax
subl $0x2, %eax
je 0x9297
jmp 0x93b6
leaq 0x1fa1b(%rip), %rax     # 0x28a70
movq (%rax), %rax
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0x1a4(%rbp), %rcx
imulq $0x26a8, %rcx, %rcx     # imm = 0x26A8
addq %rcx, %rax
movslq 0x2670(%rax), %rcx
leaq 0x1f9f3(%rip), %rax     # 0x28a70
movq (%rax), %rax
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0x1a4(%rbp), %rdx
imulq $0x26a8, %rdx, %rdx     # imm = 0x26A8
addq %rdx, %rax
movq %rcx, 0x2650(%rax)
leaq 0x1f9cb(%rip), %rax     # 0x28a70
movq (%rax), %rax
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0x1a4(%rbp), %rcx
imulq $0x26a8, %rcx, %rcx     # imm = 0x26A8
addq %rcx, %rax
movl 0x2674(%rax), %ecx
leaq 0x1f9a4(%rip), %rax     # 0x28a70
movq (%rax), %rax
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0x1a4(%rbp), %rdx
imulq $0x26a8, %rdx, %rdx     # imm = 0x26A8
addq %rdx, %rax
movl %ecx, 0x2680(%rax)
leaq -0x1a0(%rbp), %rdi
leaq 0x1f976(%rip), %rax     # 0x28a70
movq (%rax), %rdx
addq $0x100, %rdx            # imm = 0x100
movq -0x8(%rbp), %rcx
movq -0x8(%rbp), %r8
leaq 0x13f09(%rip), %rsi     # 0x1d01c
movb $0x0, %al
callq 0x2050
leaq -0x1a0(%rbp), %rax
movq %rax, -0xac0(%rbp)
leaq -0x1a0(%rbp), %rdi
callq 0x20c0
movq -0xac0(%rbp), %rdi
movq %rax, %rsi
callq 0x12840
jmp 0x93c2
movl $0xf, -0x1ac(%rbp)
movslq -0x1ac(%rbp), %rcx
leaq 0x1f910(%rip), %rax     # 0x28a70
movq (%rax), %rax
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0x1a4(%rbp), %rdx
imulq $0x26a8, %rdx, %rdx     # imm = 0x26A8
addq %rdx, %rax
addq 0x2650(%rax), %rcx
movq %rcx, 0x2650(%rax)
leaq 0x1f8e1(%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), %rax
leaq 0x1f8b9(%rip), %rcx     # 0x28a70
movq (%rcx), %rcx
addq $0x1a0, %rcx            # imm = 0x1A0
movslq -0x1a4(%rbp), %rdx
imulq $0x26a8, %rdx, %rdx     # imm = 0x26A8
addq %rdx, %rcx
movslq 0x2670(%rcx), %rcx
cmpq %rcx, %rax
jl 0x922e
leaq 0x1f88b(%rip), %rax     # 0x28a70
movq (%rax), %rax
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0x1a4(%rbp), %rcx
imulq $0x26a8, %rcx, %rcx     # imm = 0x26A8
addq %rcx, %rax
movslq 0x2670(%rax), %rcx
leaq 0x1f863(%rip), %rax     # 0x28a70
movq (%rax), %rax
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0x1a4(%rbp), %rdx
imulq $0x26a8, %rdx, %rdx     # imm = 0x26A8
addq %rdx, %rax
movq %rcx, 0x2650(%rax)
leaq -0x1a0(%rbp), %rdi
leaq 0x1f834(%rip), %rax     # 0x28a70
movq (%rax), %rdx
addq $0x100, %rdx            # imm = 0x100
movq -0x8(%rbp), %rcx
movq -0x8(%rbp), %r8
movq -0x8(%rbp), %r9
movl -0x1ac(%rbp), %eax
leaq 0x13e13(%rip), %rsi     # 0x1d072
movl %eax, (%rsp)
movb $0x0, %al
callq 0x2050
leaq -0x1a0(%rbp), %rax
movq %rax, -0xac8(%rbp)
leaq -0x1a0(%rbp), %rdi
callq 0x20c0
movq -0xac8(%rbp), %rdi
movq %rax, %rsi
callq 0x12840
jmp 0x93c2
callq 0x2080
leaq 0x1f7cd(%rip), %rcx     # 0x28a70
movq (%rcx), %rcx
addq $0x1a0, %rcx            # imm = 0x1A0
movslq -0x1a4(%rbp), %rdx
imulq $0x26a8, %rdx, %rdx     # imm = 0x26A8
addq %rdx, %rcx
imull $0xa, 0x2668(%rcx), %ecx
cltd
idivl %ecx
addl $0x1, %edx
movl %edx, -0x1b0(%rbp)
leaq -0xab0(%rbp), %rdi
movq -0x8(%rbp), %rsi
leaq 0x1cf79(%rip), %rax     # 0x2625c
movl (%rax), %eax
movl %eax, %edx
callq 0x20e0
leaq -0xab0(%rbp), %rdi
addq $0xc0, %rdi
leaq 0x1f76f(%rip), %rax     # 0x28a70
movq (%rax), %rsi
addq $0x100, %rsi            # imm = 0x100
leaq 0x1cf46(%rip), %rax     # 0x26258
movl (%rax), %eax
movl %eax, %edx
callq 0x20e0
movslq -0x1b0(%rbp), %rcx
leaq 0x1f747(%rip), %rax     # 0x28a70
movq (%rax), %rax
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0x1a4(%rbp), %rdx
imulq $0x26a8, %rdx, %rdx     # imm = 0x26A8
addq %rdx, %rax
addq 0x2658(%rax), %rcx
movq %rcx, 0x2658(%rax)
leaq -0xab0(%rbp), %rdi
callq 0x14950
leaq -0x1a0(%rbp), %rdi
leaq -0xab0(%rbp), %rdx
addq $0xc0, %rdx
movq -0x8(%rbp), %rcx
movl -0x1b0(%rbp), %r8d
leaq 0x13d65(%rip), %rsi     # 0x1d0e9
movb $0x0, %al
callq 0x2050
leaq -0x1a0(%rbp), %rax
movq %rax, -0xad0(%rbp)
leaq -0x1a0(%rbp), %rdi
callq 0x20c0
movq -0xad0(%rbp), %rdi
movq %rax, %rsi
callq 0x12840
jmp 0x93c2
leaq 0x13dd8(%rip), %rdi     # 0x1d195
callq 0x2190
addq $0xae0, %rsp            # imm = 0xAE0
popq %rbp
retq
nopl (%rax,%rax)