// File: /workspace/github_c_makefile_star2_O2/ajpaulson[P]srogue11/state.c
// Function: rs_restore_file
int rs_restore_file(int inf)
{
    bool junk;
    int endian = 0x01020304;
    big_endian = ( *((char *)&endian) == 0x01 );
    
    rs_read_daemons(inf, d_list, MAXDAEMONS);
    rs_read_int(inf, &between);
    rs_read_rooms(inf, rooms, MAXROOMS);
    rs_read_room_reference(inf, &oldrp);
    rs_read_monster_list(inf, &mlist);
    rs_read_thing(inf, &player);
    rs_read_stats(inf,&max_stats);                   
    rs_read_object_list(inf, &lvl_obj);
    rs_read_object_reference(inf, player.t_pack, &cur_weapon); 
    rs_read_object_reference(inf, player.t_pack, &cur_armor);
    rs_read_object_reference(inf, player.t_pack, &cur_ring[0]);
    rs_read_object_reference(inf, player.t_pack, &cur_ring[1]);
    him = &player.t_stats;
    rs_read_traps(inf, traps, MAXTRAPS);             

    rs_read_int(inf, &level);
    rs_read_int(inf, &levcount);
    rs_read_int(inf, &levtype);
    rs_read_int(inf, &trader);
    rs_read_int(inf, &curprice);
    rs_read_int(inf, &purse);
    rs_read_int(inf, &ntraps);
    rs_read_int(inf, &packvol);
    rs_read_int(inf, &demoncnt);
    rs_read_int(inf, &lastscore);
    rs_read_int(inf, &no_food);
    rs_read_int(inf, &seed);
    rs_read_int(inf, &dnum);
    rs_read_int(inf, &count);
    rs_read_int(inf, &fung_hit);
    rs_read_int(inf, &quiet);
    rs_read_int(inf, &max_level);
    rs_read_int(inf, &food_left);
    rs_read_int(inf, &group);
    rs_read_int(inf, &hungry_state);
    rs_read_int(inf, &foodlev);
    rs_read_int(inf, &ringfood);
    rs_read_char(inf, &take);
    rs_read_char(inf, &runch);
    rs_read(inf, curpurch, 15);

    rs_read(inf, prbuf, LINLEN);
    rs_read(inf, whoami, LINLEN);
    rs_read(inf, fruit, LINLEN);
    
    rs_read_boolean(inf, &isfight); 
    rs_read_boolean(inf, &nlmove);
    rs_read_boolean(inf, &inpool);
    rs_read_boolean(inf, &inwhgt);
    rs_read_boolean(inf, &running);
    rs_read_boolean(inf, &playing);
#ifdef WIZARD
    rs_read_boolean(inf, &wizard);
#else
    rs_read_boolean(inf, &junk);
#endif
    rs_read_boolean(inf, &after);
    rs_read_boolean(inf, &door_stop);
    rs_read_boolean(inf, &firstmove);
    rs_read_boolean(inf, &waswizard);
    rs_read_boolean(inf, &amulet);
    rs_read_boolean(inf, &in_shell);
    rs_read_boolean(inf, &nochange);
    
    rs_read_coord(inf, &oldpos);
    rs_read_coord(inf, &delta);
    rs_read_coord(inf, &stairs);
    rs_read_coord(inf, &rndspot);

    rs_read_monsters(inf, monsters, MAXMONS+1);
    rs_read_monster_references(inf, mtlev, MONRANGE);

    rs_read_scrolls(inf);
    rs_read_potions(inf);
    rs_read_rings(inf);
    rs_read_sticks(inf);

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

    rs_read_window(inf, cw);
    rs_read_window(inf, mw);
    rs_read_window(inf, stdscr);

    return(READSTAT);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %edi, %ebx
andl $0x0, 0x1bc3b(%rip)     # 0x33480
leaq 0x15da4(%rip), %rsi     # 0x2d5f0
pushq $0x14
popq %r14
movl %r14d, %edx
callq 0x15770
leaq 0x15f71(%rip), %rsi     # 0x2d7d0
movl %ebx, %edi
callq 0x14cb7
leaq 0x16033(%rip), %rsi     # 0x2d8a0
pushq $0x9
popq %rbp
movl %ebx, %edi
movl %ebp, %edx
callq 0x15a16
leaq 0x163c8(%rip), %rsi     # 0x2dc48
movl %ebx, %edi
callq 0x158d3
leaq 0x15fa2(%rip), %rsi     # 0x2d830
movl %ebx, %edi
callq 0x16cbf
leaq 0x163b4(%rip), %r15     # 0x2dc50
movl %ebx, %edi
movq %r15, %rsi
callq 0x16a84
leaq 0x1643b(%rip), %rsi     # 0x2dce8
movl %ebx, %edi
callq 0x15e4c
leaq 0x15f7d(%rip), %rsi     # 0x2d838
movl %ebx, %edi
callq 0x16490
movq 0x68(%r15), %rsi
leaq 0x15f73(%rip), %rdx     # 0x2d840
movl %ebx, %edi
callq 0x16dd9
movq 0x68(%r15), %rsi
leaq 0x15f69(%rip), %rdx     # 0x2d848
movl %ebx, %edi
callq 0x16dd9
movq 0x68(%r15), %rsi
leaq 0x1644f(%rip), %r12     # 0x2dd40
movl %ebx, %edi
movq %r12, %rdx
callq 0x16dd9
movq 0x68(%r15), %rsi
addq $0x8, %r12
movl %ebx, %edi
movq %r12, %rdx
callq 0x16dd9
leaq 0x1643c(%rip), %rax     # 0x2dd50
movq %r15, (%rax)
leaq 0x16442(%rip), %rsi     # 0x2dd60
pushq $0xa
popq %rdx
movl %ebx, %edi
callq 0x1664c
leaq 0x129b1(%rip), %rsi     # 0x2a2e0
movl %ebx, %edi
callq 0x14cb7
leaq 0x15f13(%rip), %rsi     # 0x2d850
movl %ebx, %edi
callq 0x14cb7
leaq 0x15f09(%rip), %rsi     # 0x2d854
movl %ebx, %edi
callq 0x14cb7
leaq 0x15eff(%rip), %rsi     # 0x2d858
movl %ebx, %edi
callq 0x14cb7
leaq 0x1297d(%rip), %rsi     # 0x2a2e4
movl %ebx, %edi
callq 0x14cb7
leaq 0x15ee7(%rip), %rsi     # 0x2d85c
movl %ebx, %edi
callq 0x14cb7
leaq 0x164d5(%rip), %rsi     # 0x2de58
movl %ebx, %edi
callq 0x14cb7
leaq 0x15ed3(%rip), %rsi     # 0x2d864
movl %ebx, %edi
callq 0x14cb7
leaq 0x15ecd(%rip), %rsi     # 0x2d86c
movl %ebx, %edi
callq 0x14cb7
leaq 0x1293b(%rip), %rsi     # 0x2a2e8
movl %ebx, %edi
callq 0x14cb7
leaq 0x15eb5(%rip), %rsi     # 0x2d870
movl %ebx, %edi
callq 0x14cb7
leaq 0x16493(%rip), %rsi     # 0x2de5c
movl %ebx, %edi
callq 0x14cb7
leaq 0x16489(%rip), %rsi     # 0x2de60
movl %ebx, %edi
callq 0x14cb7
leaq 0x15e8f(%rip), %rsi     # 0x2d874
movl %ebx, %edi
callq 0x14cb7
leaq 0x15e85(%rip), %rsi     # 0x2d878
movl %ebx, %edi
callq 0x14cb7
leaq 0x15e7b(%rip), %rsi     # 0x2d87c
movl %ebx, %edi
callq 0x14cb7
leaq 0x128dd(%rip), %rsi     # 0x2a2ec
movl %ebx, %edi
callq 0x14cb7
leaq 0x128d3(%rip), %rsi     # 0x2a2f0
movl %ebx, %edi
callq 0x14cb7
leaq 0x128c9(%rip), %rsi     # 0x2a2f4
movl %ebx, %edi
callq 0x14cb7
leaq 0x15e47(%rip), %rsi     # 0x2d880
movl %ebx, %edi
callq 0x14cb7
leaq 0x128b1(%rip), %rsi     # 0x2a2f8
movl %ebx, %edi
callq 0x14cb7
leaq 0x15e2f(%rip), %rsi     # 0x2d884
movl %ebx, %edi
callq 0x14cb7
leaq 0x16401(%rip), %rsi     # 0x2de64
movl %ebx, %edi
callq 0x14c64
leaq 0x163f4(%rip), %rsi     # 0x2de65
movl %ebx, %edi
callq 0x14c64
leaq 0x163e7(%rip), %rsi     # 0x2de66
pushq $0xf
popq %rdx
movl %ebx, %edi
callq 0x14be5
leaq 0x163f0(%rip), %rsi     # 0x2de80
pushq $0x50
popq %r15
movl %ebx, %edi
movl %r15d, %edx
callq 0x14be5
leaq 0x1642b(%rip), %rsi     # 0x2ded0
movl %ebx, %edi
movl %r15d, %edx
callq 0x14be5
leaq 0x1646a(%rip), %rsi     # 0x2df20
movl %ebx, %edi
movl %r15d, %edx
callq 0x14be5
leaq 0x15dc1(%rip), %rsi     # 0x2d888
movl %ebx, %edi
callq 0x14c80
leaq 0x15db4(%rip), %rsi     # 0x2d889
movl %ebx, %edi
callq 0x14c80
leaq 0x15da7(%rip), %rsi     # 0x2d88a
movl %ebx, %edi
callq 0x14c80
leaq 0x15d9a(%rip), %rsi     # 0x2d88b
movl %ebx, %edi
callq 0x14c80
leaq 0x15d8d(%rip), %rsi     # 0x2d88c
movl %ebx, %edi
callq 0x14c80
leaq 0x127ef(%rip), %rsi     # 0x2a2fc
movl %ebx, %edi
callq 0x14c80
leaq 0xf(%rsp), %rsi
movl %ebx, %edi
callq 0x14c80
leaq 0x127d6(%rip), %rsi     # 0x2a2fd
movl %ebx, %edi
callq 0x14c80
leaq 0x15d59(%rip), %rsi     # 0x2d88e
movl %ebx, %edi
callq 0x14c80
leaq 0x15d4c(%rip), %rsi     # 0x2d88f
movl %ebx, %edi
callq 0x14c80
leaq 0x15d3f(%rip), %rsi     # 0x2d890
movl %ebx, %edi
callq 0x14c80
leaq 0x15d32(%rip), %rsi     # 0x2d891
movl %ebx, %edi
callq 0x14c80
leaq 0x15d25(%rip), %rsi     # 0x2d892
movl %ebx, %edi
callq 0x14c80
leaq 0x15d18(%rip), %rsi     # 0x2d893
movl %ebx, %edi
callq 0x14c80
leaq 0x188c3(%rip), %rsi     # 0x3044c
movl %ebx, %edi
callq 0x153bb
leaq 0x188bd(%rip), %rsi     # 0x30454
movl %ebx, %edi
callq 0x153bb
leaq 0x188b7(%rip), %rsi     # 0x3045c
movl %ebx, %edi
callq 0x153bb
leaq 0x127ed(%rip), %rsi     # 0x2a3a0
movl %ebx, %edi
callq 0x153bb
leaq 0x127ef(%rip), %rsi     # 0x2a3b0
movl %ebx, %edi
callq 0x167a8
leaq 0x188a1(%rip), %rsi     # 0x30470
movl %ebx, %edi
movl %r14d, %edx
callq 0x15faf
movl %ebx, %edi
callq 0x16e1e
movl %ebx, %edi
callq 0x16efe
movl %ebx, %edi
callq 0x17005
movl %ebx, %edi
callq 0x171e8
leaq 0x141c4(%rip), %rsi     # 0x2bdc0
movl %ebx, %edi
movl %ebp, %edx
callq 0x15c4c
leaq 0x14244(%rip), %rsi     # 0x2be50
pushq $0xb
popq %rdx
movl %ebx, %edi
callq 0x15c4c
leaq 0x14363(%rip), %rsi     # 0x2bf80
pushq $0x13
popq %rdx
movl %ebx, %edi
callq 0x15c4c
leaq 0x146c2(%rip), %rsi     # 0x2c2f0
pushq $0x1b
popq %rbp
movl %ebx, %edi
movl %ebp, %edx
callq 0x15c4c
leaq 0x1485f(%rip), %rsi     # 0x2c4a0
pushq $0x16
popq %rdx
movl %ebx, %edi
callq 0x15c4c
leaq 0x149ae(%rip), %rsi     # 0x2c600
movl %ebx, %edi
movl %ebp, %edx
callq 0x15c4c
leaq 0x14b4e(%rip), %rsi     # 0x2c7b0
movl %ebx, %edi
movl %ebp, %edx
callq 0x15c4c
leaq 0x18d5e(%rip), %rax     # 0x309d0
movq (%rax), %rsi
movl %ebx, %edi
callq 0x154b2
leaq 0x18d5d(%rip), %rax     # 0x309e0
movq (%rax), %rsi
movl %ebx, %edi
callq 0x154b2
movq 0x122a4(%rip), %rax     # 0x29f38
movq (%rax), %rsi
movl %ebx, %edi
callq 0x154b2
movl 0x1b7cc(%rip), %ecx     # 0x33470
xorl %eax, %eax
orl 0x1b7cc(%rip), %ecx     # 0x33478
sete %al
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq