// File: /workspace/github_c_makefile_star2_O1/ajpaulson[P]srogue11/state.c
// Function: rs_save_file
int rs_save_file(FILE *savef)
{
    int endian = 0x01020304;
    big_endian = ( *((char *)&endian) == 0x01 );

    rs_write_daemons(savef, d_list, MAXDAEMONS);
    rs_write_int(savef, between);
    rs_write_rooms(savef, rooms, MAXROOMS);
    rs_write_room_reference(savef, oldrp);
    rs_write_monster_list(savef, mlist);
    rs_write_thing(savef, &player);
    rs_write_stats(savef,&max_stats);                   
    rs_write_object_list(savef, lvl_obj);
    rs_write_object_reference(savef, player.t_pack, cur_weapon); 
    rs_write_object_reference(savef, player.t_pack, cur_armor);
    rs_write_object_reference(savef, player.t_pack, cur_ring[0]);
    rs_write_object_reference(savef, player.t_pack, cur_ring[1]);
    assert(him == &player.t_stats);
    rs_write_traps(savef, traps, MAXTRAPS);             
    rs_write_int(savef, level);
    rs_write_int(savef, levcount);
    rs_write_int(savef, levtype);
    rs_write_int(savef, trader);
    rs_write_int(savef, curprice);
    rs_write_int(savef, purse);
    rs_write_int(savef, ntraps);
    rs_write_int(savef, packvol);
    rs_write_int(savef, demoncnt);
    rs_write_int(savef, lastscore);
    rs_write_int(savef, no_food);
    rs_write_int(savef, seed);
    rs_write_int(savef, dnum);
    rs_write_int(savef, count);
    rs_write_int(savef, fung_hit);
    rs_write_int(savef, quiet);
    rs_write_int(savef, max_level);
    rs_write_int(savef, food_left);
    rs_write_int(savef, group);
    rs_write_int(savef, hungry_state);
    rs_write_int(savef, foodlev);
    rs_write_int(savef, ringfood);
    rs_write_char(savef, take);
    rs_write_char(savef, runch);
    rs_write(savef, curpurch, 15);

    rs_write(savef, prbuf, LINLEN);
    rs_write(savef, whoami, LINLEN);
    rs_write(savef, fruit, LINLEN);
    
    rs_write_boolean(savef, isfight); 
    rs_write_boolean(savef, nlmove);
    rs_write_boolean(savef, inpool);
    rs_write_boolean(savef, inwhgt);
    rs_write_boolean(savef, running);
    rs_write_boolean(savef, playing);
#ifdef WIZARD
    rs_write_boolean(savef, wizard);
#else 
    rs_write_boolean(savef, 0);
#endif
    rs_write_boolean(savef, after);
    rs_write_boolean(savef, door_stop);
    rs_write_boolean(savef, firstmove);
    rs_write_boolean(savef, waswizard);
    rs_write_boolean(savef, amulet);
    rs_write_boolean(savef, in_shell);
    rs_write_boolean(savef, nochange);
    
    rs_write_coord(savef, oldpos);
    rs_write_coord(savef, delta);
    rs_write_coord(savef, stairs);
    rs_write_coord(savef, rndspot);

    rs_write_monsters(savef, monsters, MAXMONS+1);
    rs_write_monster_references(savef, mtlev, MONRANGE);

    rs_write_scrolls(savef);
    rs_write_potions(savef);
    rs_write_rings(savef);
    rs_write_sticks(savef);

    rs_write_magic_items(savef, things, NUMTHINGS+1);
    rs_write_magic_items(savef, a_magic, MAXARMORS+1);
    rs_write_magic_items(savef, w_magic, MAXWEAPONS+1);
    rs_write_magic_items(savef, s_magic, MAXSCROLLS+1);
    rs_write_magic_items(savef, p_magic, MAXPOTIONS+1);
    rs_write_magic_items(savef, r_magic, MAXRINGS+1);
    rs_write_magic_items(savef, ws_magic, MAXSTICKS+1);

    rs_write_window(savef, cw);
    rs_write_window(savef, mw);
    rs_write_window(savef, stdscr);

    fflush(savef);

    return(WRITESTAT);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movl $0x0, 0x1aac7(%rip)     # 0x33490
leaq 0x14c30(%rip), %rsi     # 0x2d600
movl $0x14, %edx
callq 0x1673b
leaq 0x14dff(%rip), %rax     # 0x2d7e0
movl (%rax), %esi
movq %rbx, %rdi
callq 0x15842
leaq 0x14ebe(%rip), %r14     # 0x2d8b0
movq %rbx, %rdi
movq %r14, %rsi
movl $0x9, %edx
callq 0x16ada
leaq 0x1524f(%rip), %rax     # 0x2dc58
movq (%rax), %rax
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
cmpq %rax, %r14
cmovel %ecx, %esi
incq %rcx
addq $0x68, %r14
cmpq $0x9, %rcx
jne 0x18a13
movq %rbx, %rdi
callq 0x15842
leaq 0x14e0b(%rip), %rax     # 0x2d840
movq (%rax), %rsi
movq %rbx, %rdi
callq 0x18286
leaq 0x15219(%rip), %r14     # 0x2dc60
movq %rbx, %rdi
movq %r14, %rsi
callq 0x17ddf
leaq 0x1529f(%rip), %rsi     # 0x2dcf8
movq %rbx, %rdi
callq 0x17155
leaq 0x14de0(%rip), %rax     # 0x2d848
movq (%rax), %rsi
movq %rbx, %rdi
callq 0x179ea
movq 0x68(%r14), %rsi
leaq 0x14dd2(%rip), %rax     # 0x2d850
movq (%rax), %rdx
movq %rbx, %rdi
callq 0x183ec
movq 0x68(%r14), %rsi
leaq 0x14dc4(%rip), %rax     # 0x2d858
movq (%rax), %rdx
movq %rbx, %rdi
callq 0x183ec
movq 0x68(%r14), %rsi
leaq 0x152a6(%rip), %r15     # 0x2dd50
movq (%r15), %rdx
movq %rbx, %rdi
callq 0x183ec
movq 0x68(%r14), %rsi
movq 0x8(%r15), %rdx
movq %rbx, %rdi
callq 0x183ec
leaq 0x15294(%rip), %rax     # 0x2dd60
cmpq %r14, (%rax)
jne 0x1906c
leaq 0x15294(%rip), %rsi     # 0x2dd70
movq %rbx, %rdi
movl $0xa, %edx
callq 0x17a4b
leaq 0x11800(%rip), %rax     # 0x2a2f0
movl (%rax), %esi
movq %rbx, %rdi
callq 0x15842
leaq 0x14d5f(%rip), %rax     # 0x2d860
movl (%rax), %esi
movq %rbx, %rdi
callq 0x15842
leaq 0x14d52(%rip), %rax     # 0x2d864
movl (%rax), %esi
movq %rbx, %rdi
callq 0x15842
leaq 0x14d45(%rip), %rax     # 0x2d868
movl (%rax), %esi
movq %rbx, %rdi
callq 0x15842
leaq 0x117c0(%rip), %rax     # 0x2a2f4
movl (%rax), %esi
movq %rbx, %rdi
callq 0x15842
leaq 0x14d27(%rip), %rax     # 0x2d86c
movl (%rax), %esi
movq %rbx, %rdi
callq 0x15842
leaq 0x15312(%rip), %rax     # 0x2de68
movl (%rax), %esi
movq %rbx, %rdi
callq 0x15842
leaq 0x14d0d(%rip), %rax     # 0x2d874
movl (%rax), %esi
movq %rbx, %rdi
callq 0x15842
leaq 0x14d04(%rip), %rax     # 0x2d87c
movl (%rax), %esi
movq %rbx, %rdi
callq 0x15842
leaq 0x1176f(%rip), %rax     # 0x2a2f8
movl (%rax), %esi
movq %rbx, %rdi
callq 0x15842
leaq 0x14ce6(%rip), %rax     # 0x2d880
movl (%rax), %esi
movq %rbx, %rdi
callq 0x15842
leaq 0x152c1(%rip), %rax     # 0x2de6c
movl (%rax), %esi
movq %rbx, %rdi
callq 0x15842
leaq 0x152b4(%rip), %rax     # 0x2de70
movl (%rax), %esi
movq %rbx, %rdi
callq 0x15842
leaq 0x14cb7(%rip), %rax     # 0x2d884
movl (%rax), %esi
movq %rbx, %rdi
callq 0x15842
leaq 0x14caa(%rip), %rax     # 0x2d888
movl (%rax), %esi
movq %rbx, %rdi
callq 0x15842
leaq 0x14c9d(%rip), %rax     # 0x2d88c
movl (%rax), %esi
movq %rbx, %rdi
callq 0x15842
leaq 0x116fc(%rip), %rax     # 0x2a2fc
movl (%rax), %esi
movq %rbx, %rdi
callq 0x15842
leaq 0x116ef(%rip), %rax     # 0x2a300
movl (%rax), %esi
movq %rbx, %rdi
callq 0x15842
leaq 0x116e2(%rip), %rax     # 0x2a304
movl (%rax), %esi
movq %rbx, %rdi
callq 0x15842
leaq 0x14c5d(%rip), %rax     # 0x2d890
movl (%rax), %esi
movq %rbx, %rdi
callq 0x15842
leaq 0x116c4(%rip), %rax     # 0x2a308
movl (%rax), %esi
movq %rbx, %rdi
callq 0x15842
leaq 0x14c3f(%rip), %rax     # 0x2d894
movl (%rax), %esi
movq %rbx, %rdi
callq 0x15842
leaq 0x1520e(%rip), %rax     # 0x2de74
movb (%rax), %al
leaq 0xf(%rsp), %r14
movb %al, (%r14)
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x157b1
leaq 0x151ee(%rip), %rax     # 0x2de75
movb (%rax), %al
movb %al, (%r14)
leaq 0xf(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x157b1
leaq 0x151ce(%rip), %rsi     # 0x2de76
movq %rbx, %rdi
movl $0xf, %edx
callq 0x157b1
leaq 0x151d4(%rip), %rsi     # 0x2de90
movq %rbx, %rdi
movl $0x50, %edx
callq 0x157b1
leaq 0x15210(%rip), %rsi     # 0x2dee0
movq %rbx, %rdi
movl $0x50, %edx
callq 0x157b1
leaq 0x1524c(%rip), %rsi     # 0x2df30
movq %rbx, %rdi
movl $0x50, %edx
callq 0x157b1
leaq 0x14ba0(%rip), %rax     # 0x2d898
movb (%rax), %al
movb %al, (%r14)
leaq 0xf(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x157b1
leaq 0x14b80(%rip), %rax     # 0x2d899
movb (%rax), %al
movb %al, (%r14)
leaq 0xf(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x157b1
leaq 0x14b60(%rip), %rax     # 0x2d89a
movb (%rax), %al
movb %al, (%r14)
leaq 0xf(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x157b1
leaq 0x14b40(%rip), %rax     # 0x2d89b
movb (%rax), %al
movb %al, (%r14)
leaq 0xf(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x157b1
leaq 0x14b20(%rip), %rax     # 0x2d89c
movb (%rax), %al
movb %al, (%r14)
leaq 0xf(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x157b1
leaq 0x1156f(%rip), %rax     # 0x2a30c
movb (%rax), %al
movb %al, (%r14)
leaq 0xf(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x157b1
movb $0x0, (%r14)
leaq 0xf(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x157b1
leaq 0x11536(%rip), %rax     # 0x2a30d
movb (%rax), %al
movb %al, (%r14)
leaq 0xf(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x157b1
leaq 0x14aa6(%rip), %rax     # 0x2d89e
movb (%rax), %al
movb %al, (%r14)
leaq 0xf(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x157b1
leaq 0x14a86(%rip), %rax     # 0x2d89f
movb (%rax), %al
movb %al, (%r14)
leaq 0xf(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x157b1
leaq 0x14a66(%rip), %rax     # 0x2d8a0
movb (%rax), %al
movb %al, (%r14)
leaq 0xf(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x157b1
leaq 0x14a46(%rip), %rax     # 0x2d8a1
movb (%rax), %al
movb %al, (%r14)
leaq 0xf(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x157b1
leaq 0x14a26(%rip), %rax     # 0x2d8a2
movb (%rax), %al
movb %al, (%r14)
leaq 0xf(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x157b1
leaq 0x14a06(%rip), %rax     # 0x2d8a3
movb (%rax), %al
movb %al, (%r14)
leaq 0xf(%rsp), %rsi
movq %rbx, %rdi
movl $0x1, %edx
callq 0x157b1
leaq 0x175a1(%rip), %rax     # 0x3045c
movq (%rax), %rsi
movq %rsi, %r14
shrq $0x20, %r14
movq %rbx, %rdi
callq 0x15842
movq %rbx, %rdi
movl %r14d, %esi
callq 0x15842
leaq 0x17585(%rip), %rax     # 0x30464
movq (%rax), %rsi
movq %rsi, %r14
shrq $0x20, %r14
movq %rbx, %rdi
callq 0x15842
movq %rbx, %rdi
movl %r14d, %esi
callq 0x15842
leaq 0x17569(%rip), %rax     # 0x3046c
movq (%rax), %rsi
movq %rsi, %r14
shrq $0x20, %r14
movq %rbx, %rdi
callq 0x15842
movq %rbx, %rdi
movl %r14d, %esi
callq 0x15842
leaq 0x11489(%rip), %rax     # 0x2a3b0
movq (%rax), %rsi
movq %rsi, %r14
shrq $0x20, %r14
movq %rbx, %rdi
callq 0x15842
movq %rbx, %rdi
movl %r14d, %esi
callq 0x15842
leaq 0x11475(%rip), %rsi     # 0x2a3c0
movq %rbx, %rdi
movl $0x35, %edx
callq 0x17c12
leaq 0x17521(%rip), %rsi     # 0x30480
movq %rbx, %rdi
movl $0x14, %edx
callq 0x1731c
movq %rbx, %rdi
callq 0x184ff
movq %rbx, %rdi
callq 0x18618
movq %rbx, %rdi
callq 0x1873b
movq %rbx, %rdi
callq 0x187cb
leaq 0x12e3d(%rip), %rsi     # 0x2bdd0
movq %rbx, %rdi
movl $0x9, %edx
callq 0x16fa2
leaq 0x12eb9(%rip), %rsi     # 0x2be60
movq %rbx, %rdi
movl $0xb, %edx
callq 0x16fa2
leaq 0x12fd5(%rip), %rsi     # 0x2bf90
movq %rbx, %rdi
movl $0x13, %edx
callq 0x16fa2
leaq 0x13331(%rip), %rsi     # 0x2c300
movq %rbx, %rdi
movl $0x1b, %edx
callq 0x16fa2
leaq 0x134cd(%rip), %rsi     # 0x2c4b0
movq %rbx, %rdi
movl $0x16, %edx
callq 0x16fa2
leaq 0x13619(%rip), %rsi     # 0x2c610
movq %rbx, %rdi
movl $0x1b, %edx
callq 0x16fa2
leaq 0x137b5(%rip), %rsi     # 0x2c7c0
movq %rbx, %rdi
movl $0x1b, %edx
callq 0x16fa2
leaq 0x179c1(%rip), %rax     # 0x309e0
movq (%rax), %rsi
movq %rbx, %rdi
callq 0x16545
leaq 0x179bf(%rip), %rax     # 0x309f0
movq (%rax), %rsi
movq %rbx, %rdi
callq 0x16545
movq 0x10eed(%rip), %rax     # 0x29f30
movq (%rax), %rsi
movq %rbx, %rdi
callq 0x16545
movq %rbx, %rdi
callq 0x6350
xorl %eax, %eax
cmpl $0x0, 0x1a425(%rip)     # 0x33484
sete %al
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0xa10e(%rip), %rdi      # 0x23181
leaq 0x9c0f(%rip), %rsi      # 0x22c89
leaq 0xa117(%rip), %rcx      # 0x23198
movl $0x806, %edx            # imm = 0x806
callq 0x61e0