// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
movl $0xabcd000e, %esi       # imm = 0xABCD000E
callq 0x1bf60
movq -0x8(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x1bf60
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x1da0b
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq -0x13734(%rip), %rcx    # 0x9fc0
cmpq %rcx, 0x8(%rax)
jne 0x1d706
movl $0x1, -0x1c(%rbp)
jmp 0x1d9a1
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq -0x1391c(%rip), %rcx    # 0x9e00
cmpq %rcx, 0x8(%rax)
jne 0x1d72e
movl $0x2, -0x1c(%rbp)
jmp 0x1d99f
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq -0x135d4(%rip), %rcx    # 0xa170
cmpq %rcx, 0x8(%rax)
jne 0x1d756
movl $0x3, -0x1c(%rbp)
jmp 0x1d99d
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq -0x16dbc(%rip), %rcx    # 0x69b0
cmpq %rcx, 0x8(%rax)
jne 0x1d77e
movl $0x4, -0x1c(%rbp)
jmp 0x1d99b
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq -0x13804(%rip), %rcx    # 0x9f90
cmpq %rcx, 0x8(%rax)
jne 0x1d7a6
movl $0x5, -0x1c(%rbp)
jmp 0x1d999
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq -0x1369c(%rip), %rcx    # 0xa120
cmpq %rcx, 0x8(%rax)
jne 0x1d7ce
movl $0x6, -0x1c(%rbp)
jmp 0x1d997
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq -0x137a4(%rip), %rcx    # 0xa040
cmpq %rcx, 0x8(%rax)
jne 0x1d7f6
movl $0x7, -0x1c(%rbp)
jmp 0x1d995
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq -0x1377c(%rip), %rcx    # 0xa090
cmpq %rcx, 0x8(%rax)
jne 0x1d81e
movl $0x8, -0x1c(%rbp)
jmp 0x1d993
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq -0x13774(%rip), %rcx    # 0xa0c0
cmpq %rcx, 0x8(%rax)
jne 0x1d846
movl $0x9, -0x1c(%rbp)
jmp 0x1d991
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq -0x134dc(%rip), %rcx    # 0xa380
cmpq %rcx, 0x8(%rax)
jne 0x1d86e
movl $0xa, -0x1c(%rbp)
jmp 0x1d98f
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq -0x13454(%rip), %rcx    # 0xa430
cmpq %rcx, 0x8(%rax)
jne 0x1d896
movl $0xb, -0x1c(%rbp)
jmp 0x1d98d
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq -0x1341c(%rip), %rcx    # 0xa490
cmpq %rcx, 0x8(%rax)
jne 0x1d8be
movl $0xc, -0x1c(%rbp)
jmp 0x1d98b
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq -0x133f4(%rip), %rcx    # 0xa4e0
cmpq %rcx, 0x8(%rax)
jne 0x1d8e6
movl $0xd, -0x1c(%rbp)
jmp 0x1d989
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq -0x133cc(%rip), %rcx    # 0xa530
cmpq %rcx, 0x8(%rax)
jne 0x1d90b
movl $0xe, -0x1c(%rbp)
jmp 0x1d987
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq -0x7041(%rip), %rcx     # 0x168e0
cmpq %rcx, 0x8(%rax)
jne 0x1d930
movl $0xf, -0x1c(%rbp)
jmp 0x1d985
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq -0x12866(%rip), %rcx    # 0xb0e0
cmpq %rcx, 0x8(%rax)
jne 0x1d955
movl $0x10, -0x1c(%rbp)
jmp 0x1d983
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq -0xfc5b(%rip), %rcx     # 0xdd10
cmpq %rcx, 0x8(%rax)
jne 0x1d97a
movl $0x11, -0x1c(%rbp)
jmp 0x1d981
movl $0x0, -0x1c(%rbp)
jmp 0x1d983
jmp 0x1d985
jmp 0x1d987
jmp 0x1d989
jmp 0x1d98b
jmp 0x1d98d
jmp 0x1d98f
jmp 0x1d991
jmp 0x1d993
jmp 0x1d995
jmp 0x1d997
jmp 0x1d999
jmp 0x1d99b
jmp 0x1d99d
jmp 0x1d99f
jmp 0x1d9a1
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %esi
callq 0x1bf60
movq -0x8(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x1bf60
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %esi
callq 0x1bf60
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x14(%rax), %esi
callq 0x1bf60
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x1d6d2
cmpl $0x0, 0x1eee2(%rip)     # 0x3c8f4
sete %al
andb $0x1, %al
movzbl %al, %eax
addq $0x20, %rsp
popq %rbp
retq