// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/state.c
// Function: rs_write_rooms
int rs_write_rooms(FILE *savef, struct room r[], int count)
{
    int n = 0;

    rs_write_int(savef, count);
    
    for(n=0; n<count; n++)
    {
        rs_write_coord(savef, r[n].r_pos);
        rs_write_coord(savef, r[n].r_max);
        rs_write_coord(savef, r[n].r_gold);
        rs_write_coord(savef, r[n].r_exit[0]);
        rs_write_coord(savef, r[n].r_exit[1]);
        rs_write_coord(savef, r[n].r_exit[2]);
        rs_write_coord(savef, r[n].r_exit[3]);
        rs_write_room_reference(savef,r[n].r_ptr[0]);
        rs_write_room_reference(savef,r[n].r_ptr[1]);
        rs_write_room_reference(savef,r[n].r_ptr[2]);
        rs_write_room_reference(savef,r[n].r_ptr[3]);
        rs_write_int(savef, r[n].r_goldval);
        rs_write_int(savef, r[n].r_flags);
        rs_write_int(savef, r[n].r_nexits);
    }
    
    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 %edx, %esi
callq 0x156d6
testl %ebp, %ebp
jle 0x16afa
movl %ebp, %eax
movq %rax, (%rsp)
xorl %r13d, %r13d
imulq $0x68, %r13, %rbp
leaq (%rbx,%rbp), %r12
movq (%rbx,%rbp), %rsi
movq %rsi, %r15
shrq $0x20, %r15
movq %r14, %rdi
callq 0x156d6
movq %r14, %rdi
movl %r15d, %esi
callq 0x156d6
movq 0x8(%rbx,%rbp), %rsi
movq %rsi, %r15
shrq $0x20, %r15
movq %r14, %rdi
callq 0x156d6
movq %r14, %rdi
movl %r15d, %esi
callq 0x156d6
movq 0x10(%rbx,%rbp), %rsi
movq %rsi, %r15
shrq $0x20, %r15
movq %r14, %rdi
callq 0x156d6
movq %r14, %rdi
movl %r15d, %esi
callq 0x156d6
movq 0x18(%rbx,%rbp), %rsi
movq %rsi, %r15
shrq $0x20, %r15
movq %r14, %rdi
callq 0x156d6
movq %r14, %rdi
movl %r15d, %esi
callq 0x156d6
movq 0x20(%rbx,%rbp), %rsi
movq %rsi, %r15
shrq $0x20, %r15
movq %r14, %rdi
callq 0x156d6
movq %r14, %rdi
movl %r15d, %esi
callq 0x156d6
movq 0x28(%rbx,%rbp), %rsi
movq %rsi, %r15
shrq $0x20, %r15
movq %r14, %rdi
callq 0x156d6
movq %r14, %rdi
movl %r15d, %esi
callq 0x156d6
movq 0x30(%rbx,%rbp), %rsi
movq %rsi, %r15
shrq $0x20, %r15
movq %r14, %rdi
callq 0x156d6
movq %r14, %rdi
movl %r15d, %esi
callq 0x156d6
movq 0x38(%rbx,%rbp), %rax
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
leaq 0x16e88(%rip), %r15     # 0x2d8b0
movq %r15, %rcx
xorl %edx, %edx
cmpq %rax, %rcx
cmovel %edx, %esi
incq %rdx
addq $0x68, %rcx
cmpq $0x9, %rdx
jne 0x16a2d
movq %r14, %rdi
callq 0x156d6
movq 0x40(%r12), %rax
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq %r15, %rcx
xorl %edx, %edx
cmpq %rax, %rcx
cmovel %edx, %esi
incq %rdx
addq $0x68, %rcx
cmpq $0x9, %rdx
jne 0x16a57
movq %r14, %rdi
callq 0x156d6
movq 0x48(%r12), %rax
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq %r15, %rcx
xorl %edx, %edx
cmpq %rax, %rcx
cmovel %edx, %esi
incq %rdx
addq $0x68, %rcx
cmpq $0x9, %rdx
jne 0x16a81
movq %r14, %rdi
callq 0x156d6
movq 0x50(%r12), %rax
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq %r15, %rcx
xorl %edx, %edx
cmpq %rax, %rcx
cmovel %edx, %esi
incq %rdx
addq $0x68, %rcx
cmpq $0x9, %rdx
jne 0x16aab
movq %r14, %rdi
callq 0x156d6
movl 0x58(%r12), %esi
movq %r14, %rdi
callq 0x156d6
movl 0x5c(%r12), %esi
movq %r14, %rdi
callq 0x156d6
movl 0x60(%r12), %esi
movq %r14, %rdi
callq 0x156d6
incq %r13
cmpq (%rsp), %r13
jne 0x16937
xorl %eax, %eax
cmpl $0x0, 0x1c981(%rip)     # 0x33484
sete %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq