// File: /workspace/github_c_makefile_star2_O0/ajpaulson[P]srogue11/state.c
// Function: rs_read_daemons
int rs_read_daemons(int inf, struct delayed_action *d_list, int count)
{
    int i = 0;
    int func = 0;
    int value = 0;
    int id = 0;
    
    if (d_list == NULL)
        printf("HELP THERE ARE NO DAEMONS\n");
    
    if (rs_read_int(inf, &id) != 0)
    {
        if (id != RSID_DAEMONS)
        {
            printf("Invalid id. %x != %x(RSID_DAEMONS)\n", id, RSID_DAEMONS);
            printf("Sorry, invalid save game format");
            format_error = TRUE;
        }
        else if (rs_read_int(inf, &value) != 0)
        {
            if (value > count)
            {
                printf("Incorrect number of daemons in block. %d > %d.",
                    value, count);
                printf("Sorry, invalid save game format");
                format_error = TRUE;
            }
            else
            {
                for(i=0; i < value; i++)
                {
                    func = 0;
                    rs_read_int(inf, &d_list[i].d_type);
                    rs_read_int(inf, &func);
                    rs_read_int(inf, &d_list[i].d_arg);
                    rs_read_int(inf, &d_list[i].d_time);
                    
                    switch(func)
                    {
                        case 1: d_list[i].d_func = rollwand;
                                break;
                        case 2: d_list[i].d_func = doctor;
                                break;
                        case 3: d_list[i].d_func = stomach;
                                break;
                        case 4: d_list[i].d_func = runners;
                                break;
                        case 5: d_list[i].d_func = swander;
                                break;
                        case 6: d_list[i].d_func = nohaste;
                                break;
                        case 7: d_list[i].d_func = unconfuse;
                                break;
                        case 8: d_list[i].d_func = unsee;
                                break;
                        case 9: d_list[i].d_func = sight;
                                break;
                        case 10: d_list[i].d_func = noteth;
                                break;
                        case 11: d_list[i].d_func = sapem;
                                break;
                        case 12: d_list[i].d_func = notslow;
                                break;
                        case 13: d_list[i].d_func = notregen;
                                break;
                        case 14: d_list[i].d_func = notinvinc;
                                break;
                        case 15: d_list[i].d_func = rchg_str;
                                break;
                        case 16: d_list[i].d_func = wghtchk;
                                break;
                        case 17: d_list[i].d_func = status;
                                break;
                        default: d_list[i].d_func = NULL;
                                break;
                    }   
                }
            }
        }
    }
    
    return(READSTAT);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x1da63
leaq 0xfa97(%rip), %rdi      # 0x2d4f3
movb $0x0, %al
callq 0x61b0
movl -0x4(%rbp), %edi
leaq -0x24(%rbp), %rsi
callq 0x1c810
cmpl $0x0, %eax
je 0x1ddcc
cmpl $0xabcd000e, -0x24(%rbp) # imm = 0xABCD000E
je 0x1dab4
movl -0x24(%rbp), %esi
leaq 0xfa83(%rip), %rdi      # 0x2d50e
movl $0xabcd000e, %edx       # imm = 0xABCD000E
movb $0x0, %al
callq 0x61b0
leaq 0xf9da(%rip), %rdi      # 0x2d478
movb $0x0, %al
callq 0x61b0
movl $0x1, 0x1ee49(%rip)     # 0x3c8f8
jmp 0x1ddca
movl -0x4(%rbp), %edi
leaq -0x20(%rbp), %rsi
callq 0x1c810
cmpl $0x0, %eax
je 0x1ddc8
movl -0x20(%rbp), %eax
cmpl -0x14(%rbp), %eax
jle 0x1db02
movl -0x20(%rbp), %esi
movl -0x14(%rbp), %edx
leaq 0xfa54(%rip), %rdi      # 0x2d532
movb $0x0, %al
callq 0x61b0
leaq 0xf98c(%rip), %rdi      # 0x2d478
movb $0x0, %al
callq 0x61b0
movl $0x1, 0x1edfb(%rip)     # 0x3c8f8
jmp 0x1ddc6
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x1ddc4
movl $0x0, -0x1c(%rbp)
movl -0x4(%rbp), %edi
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %rsi
callq 0x1c810
movl -0x4(%rbp), %edi
leaq -0x1c(%rbp), %rsi
callq 0x1c810
movl -0x4(%rbp), %edi
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
leaq (%rcx,%rcx,2), %rcx
leaq 0x10(%rax,%rcx,8), %rsi
callq 0x1c810
movl -0x4(%rbp), %edi
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
leaq (%rcx,%rcx,2), %rcx
leaq 0x14(%rax,%rcx,8), %rsi
callq 0x1c810
movl -0x1c(%rbp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x30(%rbp)
subl $0x10, %eax
ja 0x1dd9d
movq -0x30(%rbp), %rax
leaq 0xf72b(%rip), %rcx      # 0x2d2bc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq -0x13bf0(%rip), %rcx    # 0x9fc0
movq %rcx, 0x8(%rax)
jmp 0x1ddb4
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq -0x13dcf(%rip), %rcx    # 0x9e00
movq %rcx, 0x8(%rax)
jmp 0x1ddb4
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq -0x13a7e(%rip), %rcx    # 0xa170
movq %rcx, 0x8(%rax)
jmp 0x1ddb4
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq -0x1725d(%rip), %rcx    # 0x69b0
movq %rcx, 0x8(%rax)
jmp 0x1ddb4
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq -0x13c9c(%rip), %rcx    # 0x9f90
movq %rcx, 0x8(%rax)
jmp 0x1ddb4
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq -0x13b2b(%rip), %rcx    # 0xa120
movq %rcx, 0x8(%rax)
jmp 0x1ddb4
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq -0x13c2a(%rip), %rcx    # 0xa040
movq %rcx, 0x8(%rax)
jmp 0x1ddb4
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq -0x13bf9(%rip), %rcx    # 0xa090
movq %rcx, 0x8(%rax)
jmp 0x1ddb4
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq -0x13be8(%rip), %rcx    # 0xa0c0
movq %rcx, 0x8(%rax)
jmp 0x1ddb4
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq -0x13947(%rip), %rcx    # 0xa380
movq %rcx, 0x8(%rax)
jmp 0x1ddb4
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq -0x138b6(%rip), %rcx    # 0xa430
movq %rcx, 0x8(%rax)
jmp 0x1ddb4
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq -0x13875(%rip), %rcx    # 0xa490
movq %rcx, 0x8(%rax)
jmp 0x1ddb4
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq -0x13844(%rip), %rcx    # 0xa4e0
movq %rcx, 0x8(%rax)
jmp 0x1ddb4
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq -0x13813(%rip), %rcx    # 0xa530
movq %rcx, 0x8(%rax)
jmp 0x1ddb4
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq -0x747f(%rip), %rcx     # 0x168e0
movq %rcx, 0x8(%rax)
jmp 0x1ddb4
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq -0x12c9b(%rip), %rcx    # 0xb0e0
movq %rcx, 0x8(%rax)
jmp 0x1ddb4
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq -0x10087(%rip), %rcx    # 0xdd10
movq %rcx, 0x8(%rax)
jmp 0x1ddb4
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq $0x0, 0x8(%rax)
jmp 0x1ddb6
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x1db09
jmp 0x1ddc6
jmp 0x1ddc8
jmp 0x1ddca
jmp 0x1ddcc
xorl %eax, %eax
cmpl $0x0, 0x1eb23(%rip)     # 0x3c8f8
movb %al, -0x31(%rbp)
jne 0x1dde7
cmpl $0x0, 0x1eb0f(%rip)     # 0x3c8f0
sete %al
movb %al, -0x31(%rbp)
movb -0x31(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)