// File: /workspace/github_c_makefile_star2_O3/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, %ebp
movq %rsi, %rbx
movq %rdi, %r14
movl $0xabcd000e, %esi       # imm = 0xABCD000E
callq 0x156d6
movq %r14, %rdi
movl %ebp, %esi
callq 0x156d6
testl %ebp, %ebp
jle 0x16745
movl %ebp, %eax
shlq $0x3, %rax
leaq (%rax,%rax,2), %r15
xorl %r12d, %r12d
leaq -0xd7b8(%rip), %r13     # 0x8dff
movq 0x8(%rbx,%r12), %rax
cmpq %r13, %rax
je 0x1669a
cmpq 0x139d4(%rip), %rax     # 0x29fa0
je 0x166a1
cmpq 0x1393f(%rip), %rax     # 0x29f18
je 0x166a8
cmpq 0x13982(%rip), %rax     # 0x29f68
je 0x166af
cmpq 0x139fd(%rip), %rax     # 0x29ff0
je 0x166b6
cmpq 0x13938(%rip), %rax     # 0x29f38
je 0x166bd
cmpq 0x1391b(%rip), %rax     # 0x29f28
je 0x166c4
cmpq 0x139b6(%rip), %rax     # 0x29fd0
je 0x166cb
cmpq 0x13981(%rip), %rax     # 0x29fa8
je 0x166d2
cmpq 0x1390c(%rip), %rax     # 0x29f40
je 0x166d9
cmpq 0x1390f(%rip), %rax     # 0x29f50
je 0x166e0
cmpq 0x138fa(%rip), %rax     # 0x29f48
je 0x166e7
cmpq 0x13905(%rip), %rax     # 0x29f60
je 0x166ee
cmpq 0x138a0(%rip), %rax     # 0x29f08
je 0x166f5
cmpq 0x13913(%rip), %rax     # 0x29f88
je 0x166fc
cmpq 0x13856(%rip), %rax     # 0x29ed8
je 0x16703
cmpq 0x138f5(%rip), %rax     # 0x29f80
movl $0x0, %ebp
movl $0x11, %eax
cmovel %eax, %ebp
jmp 0x16708
movl $0x1, %ebp
jmp 0x16708
movl $0x2, %ebp
jmp 0x16708
movl $0x3, %ebp
jmp 0x16708
movl $0x4, %ebp
jmp 0x16708
movl $0x5, %ebp
jmp 0x16708
movl $0x6, %ebp
jmp 0x16708
movl $0x7, %ebp
jmp 0x16708
movl $0x8, %ebp
jmp 0x16708
movl $0x9, %ebp
jmp 0x16708
movl $0xa, %ebp
jmp 0x16708
movl $0xb, %ebp
jmp 0x16708
movl $0xc, %ebp
jmp 0x16708
movl $0xd, %ebp
jmp 0x16708
movl $0xe, %ebp
jmp 0x16708
movl $0xf, %ebp
jmp 0x16708
movl $0x10, %ebp
movl (%rbx,%r12), %esi
movq %r14, %rdi
callq 0x156d6
movq %r14, %rdi
movl %ebp, %esi
callq 0x156d6
movl 0x10(%rbx,%r12), %esi
movq %r14, %rdi
callq 0x156d6
movl 0x14(%rbx,%r12), %esi
movq %r14, %rdi
callq 0x156d6
addq $0x18, %r12
cmpq %r12, %r15
jne 0x165b7
xorl %eax, %eax
cmpl $0x0, 0x1cd36(%rip)     # 0x33484
sete %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq