// File: /workspace/github_c_makefile_star2_O2/ajpaulson[P]srogue11/state.c
// Function: rs_write_daemons
int rs_write_daemons(FILE *savef, struct delayed_action *d_list, int count)
{
    int i = 0;
    int func = 0;
        
    rs_write_int(savef, RSID_DAEMONS);
    rs_write_int(savef, count);
        
    for(i = 0; i < count; i++)
    {
        if (d_list[i].d_func == rollwand)
            func = 1;
        else if (d_list[i].d_func == doctor)
            func = 2;
        else if (d_list[i].d_func == stomach)
            func = 3;
        else if (d_list[i].d_func == runners)
            func = 4;
        else if (d_list[i].d_func == swander)
            func = 5;
        else if (d_list[i].d_func == nohaste)
            func = 6;
        else if (d_list[i].d_func == unconfuse)
            func = 7;
        else if (d_list[i].d_func == unsee)
            func = 8;
        else if (d_list[i].d_func == sight)
            func = 9;
        else if (d_list[i].d_func == noteth)
            func = 10;
        else if (d_list[i].d_func == sapem)
            func = 11;
        else if (d_list[i].d_func == notslow)
            func = 12;
        else if (d_list[i].d_func == notregen)
            func = 13;
        else if (d_list[i].d_func == notinvinc)
            func = 14;
        else if (d_list[i].d_func == rchg_str)
            func = 15;
        else if (d_list[i].d_func == wghtchk)
            func = 16;
        else if (d_list[i].d_func == status)
            func = 17;
        else
            func = 0;

        rs_write_int(savef, d_list[i].d_type);
        rs_write_int(savef, func);
        rs_write_int(savef, d_list[i].d_arg);
        rs_write_int(savef, d_list[i].d_time);
    }
    
    return(WRITESTAT);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %r15d
movq %rsi, %rbx
movq %rdi, %r14
movl $0xabcd000e, %esi       # imm = 0xABCD000E
callq 0x14801
movq %r14, %rdi
movl %r15d, %esi
callq 0x14801
xorl %r12d, %r12d
testl %r15d, %r15d
cmovlel %r12d, %r15d
imulq $0x18, %r15, %r15
pushq $0x1
popq %r13
cmpq %r12, %r15
je 0x15755
movq 0x8(%rbx,%r12), %rax
movl %r13d, %ebp
cmpq 0x14974(%rip), %rax     # 0x29fb0
je 0x1571c
pushq $0x2
popq %rbp
cmpq 0x1495c(%rip), %rax     # 0x29fa8
je 0x1571c
pushq $0x3
popq %rbp
cmpq 0x148c4(%rip), %rax     # 0x29f20
je 0x1571c
pushq $0x4
popq %rbp
cmpq 0x14904(%rip), %rax     # 0x29f70
je 0x1571c
pushq $0x5
popq %rbp
cmpq 0x14974(%rip), %rax     # 0x29ff0
je 0x1571c
pushq $0x6
popq %rbp
cmpq 0x148b4(%rip), %rax     # 0x29f40
je 0x1571c
pushq $0x7
popq %rbp
cmpq 0x14894(%rip), %rax     # 0x29f30
je 0x1571c
pushq $0x8
popq %rbp
cmpq 0x14928(%rip), %rax     # 0x29fd0
je 0x1571c
pushq $0x9
popq %rbp
cmpq 0x14904(%rip), %rax     # 0x29fb8
je 0x1571c
pushq $0xa
popq %rbp
cmpq 0x14888(%rip), %rax     # 0x29f48
je 0x1571c
pushq $0xb
popq %rbp
cmpq 0x1488c(%rip), %rax     # 0x29f58
je 0x1571c
pushq $0xc
popq %rbp
cmpq 0x14878(%rip), %rax     # 0x29f50
je 0x1571c
pushq $0xd
popq %rbp
cmpq 0x14884(%rip), %rax     # 0x29f68
je 0x1571c
pushq $0xe
popq %rbp
cmpq 0x14818(%rip), %rax     # 0x29f08
je 0x1571c
pushq $0xf
popq %rbp
cmpq 0x14894(%rip), %rax     # 0x29f90
je 0x1571c
pushq $0x10
popq %rbp
cmpq 0x147d0(%rip), %rax     # 0x29ed8
je 0x1571c
cmpq 0x14877(%rip), %rax     # 0x29f88
movl $0x0, %ebp
pushq $0x11
popq %rax
cmovel %eax, %ebp
movl (%rbx,%r12), %esi
movq %r14, %rdi
callq 0x14801
movq %r14, %rdi
movl %ebp, %esi
callq 0x14801
movl 0x10(%rbx,%r12), %esi
movq %r14, %rdi
callq 0x14801
movl 0x14(%rbx,%r12), %esi
movq %r14, %rdi
callq 0x14801
addq $0x18, %r12
jmp 0x15624
xorl %eax, %eax
cmpl $0x0, 0x1dd16(%rip)     # 0x33474
sete %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq