// File: /workspace/github_c_makefile_star2_O1/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 %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %edi, %ebx
movl $0x0, 0x1a3f0(%rip)     # 0x33490
leaq 0x14559(%rip), %rsi     # 0x2d600
movl $0x14, %edx
callq 0x16927
leaq 0x14728(%rip), %rsi     # 0x2d7e0
movl %ebx, %edi
callq 0x15d65
leaq 0x147ea(%rip), %r14     # 0x2d8b0
movl %ebx, %edi
movq %r14, %rsi
movl $0x9, %edx
callq 0x16ce3
leaq 0xc(%rsp), %r15
movl %ebx, %edi
movq %r15, %rsi
callq 0x15d65
movslq (%r15), %rax
imulq $0x68, %rax, %rax
addq %r14, %rax
leaq 0x14b63(%rip), %rcx     # 0x2dc58
movq %rax, (%rcx)
leaq 0x14741(%rip), %rsi     # 0x2d840
movl %ebx, %edi
callq 0x182f3
leaq 0x14b53(%rip), %r14     # 0x2dc60
movl %ebx, %edi
movq %r14, %rsi
callq 0x1802d
leaq 0x14bda(%rip), %rsi     # 0x2dcf8
movl %ebx, %edi
callq 0x171fe
leaq 0x1471c(%rip), %rsi     # 0x2d848
movl %ebx, %edi
callq 0x1790d
movq 0x68(%r14), %rsi
leaq 0x14712(%rip), %rdx     # 0x2d850
movl %ebx, %edi
callq 0x18423
movq 0x68(%r14), %rsi
leaq 0x14708(%rip), %rdx     # 0x2d858
movl %ebx, %edi
callq 0x18423
movq 0x68(%r14), %rsi
leaq 0x14bee(%rip), %r15     # 0x2dd50
movl %ebx, %edi
movq %r15, %rdx
callq 0x18423
movq 0x68(%r14), %rsi
addq $0x8, %r15
movl %ebx, %edi
movq %r15, %rdx
callq 0x18423
leaq 0x14bdb(%rip), %rax     # 0x2dd60
movq %r14, (%rax)
leaq 0x14be1(%rip), %rsi     # 0x2dd70
movl %ebx, %edi
movl $0xa, %edx
callq 0x17b0c
leaq 0x1114e(%rip), %rsi     # 0x2a2f0
movl %ebx, %edi
callq 0x15d65
leaq 0x146b0(%rip), %rsi     # 0x2d860
movl %ebx, %edi
callq 0x15d65
leaq 0x146a6(%rip), %rsi     # 0x2d864
movl %ebx, %edi
callq 0x15d65
leaq 0x1469c(%rip), %rsi     # 0x2d868
movl %ebx, %edi
callq 0x15d65
leaq 0x1111a(%rip), %rsi     # 0x2a2f4
movl %ebx, %edi
callq 0x15d65
leaq 0x14684(%rip), %rsi     # 0x2d86c
movl %ebx, %edi
callq 0x15d65
leaq 0x14c72(%rip), %rsi     # 0x2de68
movl %ebx, %edi
callq 0x15d65
leaq 0x14670(%rip), %rsi     # 0x2d874
movl %ebx, %edi
callq 0x15d65
leaq 0x1466a(%rip), %rsi     # 0x2d87c
movl %ebx, %edi
callq 0x15d65
leaq 0x110d8(%rip), %rsi     # 0x2a2f8
movl %ebx, %edi
callq 0x15d65
leaq 0x14652(%rip), %rsi     # 0x2d880
movl %ebx, %edi
callq 0x15d65
leaq 0x14c30(%rip), %rsi     # 0x2de6c
movl %ebx, %edi
callq 0x15d65
leaq 0x14c26(%rip), %rsi     # 0x2de70
movl %ebx, %edi
callq 0x15d65
leaq 0x1462c(%rip), %rsi     # 0x2d884
movl %ebx, %edi
callq 0x15d65
leaq 0x14622(%rip), %rsi     # 0x2d888
movl %ebx, %edi
callq 0x15d65
leaq 0x14618(%rip), %rsi     # 0x2d88c
movl %ebx, %edi
callq 0x15d65
leaq 0x1107a(%rip), %rsi     # 0x2a2fc
movl %ebx, %edi
callq 0x15d65
leaq 0x11070(%rip), %rsi     # 0x2a300
movl %ebx, %edi
callq 0x15d65
leaq 0x11066(%rip), %rsi     # 0x2a304
movl %ebx, %edi
callq 0x15d65
leaq 0x145e4(%rip), %rsi     # 0x2d890
movl %ebx, %edi
callq 0x15d65
leaq 0x1104e(%rip), %rsi     # 0x2a308
movl %ebx, %edi
callq 0x15d65
leaq 0x145cc(%rip), %rsi     # 0x2d894
movl %ebx, %edi
callq 0x15d65
leaq 0x14b9e(%rip), %rsi     # 0x2de74
movl %ebx, %edi
movl $0x1, %edx
callq 0x15c8d
leaq 0x14b8c(%rip), %rsi     # 0x2de75
movl %ebx, %edi
movl $0x1, %edx
callq 0x15c8d
leaq 0x14b7a(%rip), %rsi     # 0x2de76
movl %ebx, %edi
movl $0xf, %edx
callq 0x15c8d
leaq 0x14b81(%rip), %rsi     # 0x2de90
movl %ebx, %edi
movl $0x50, %edx
callq 0x15c8d
leaq 0x14bbe(%rip), %rsi     # 0x2dee0
movl %ebx, %edi
movl $0x50, %edx
callq 0x15c8d
leaq 0x14bfb(%rip), %rsi     # 0x2df30
movl %ebx, %edi
movl $0x50, %edx
callq 0x15c8d
leaq 0xc(%rsp), %r14
movl %ebx, %edi
movq %r14, %rsi
movl $0x1, %edx
callq 0x15c8d
cmpb $0x0, (%r14)
leaq 0x14538(%rip), %rax     # 0x2d898
setne (%rax)
leaq 0xc(%rsp), %r14
movl %ebx, %edi
movq %r14, %rsi
movl $0x1, %edx
callq 0x15c8d
cmpb $0x0, (%r14)
leaq 0x14517(%rip), %rax     # 0x2d899
setne (%rax)
leaq 0xc(%rsp), %r14
movl %ebx, %edi
movq %r14, %rsi
movl $0x1, %edx
callq 0x15c8d
cmpb $0x0, (%r14)
leaq 0x144f6(%rip), %rax     # 0x2d89a
setne (%rax)
leaq 0xc(%rsp), %r14
movl %ebx, %edi
movq %r14, %rsi
movl $0x1, %edx
callq 0x15c8d
cmpb $0x0, (%r14)
leaq 0x144d5(%rip), %rax     # 0x2d89b
setne (%rax)
leaq 0xc(%rsp), %r14
movl %ebx, %edi
movq %r14, %rsi
movl $0x1, %edx
callq 0x15c8d
cmpb $0x0, (%r14)
leaq 0x144b4(%rip), %rax     # 0x2d89c
setne (%rax)
leaq 0xc(%rsp), %r14
movl %ebx, %edi
movq %r14, %rsi
movl $0x1, %edx
callq 0x15c8d
cmpb $0x0, (%r14)
leaq 0x10f02(%rip), %rax     # 0x2a30c
setne (%rax)
leaq 0xc(%rsp), %rsi
movl %ebx, %edi
movl $0x1, %edx
callq 0x15c8d
leaq 0xc(%rsp), %r14
movl %ebx, %edi
movq %r14, %rsi
movl $0x1, %edx
callq 0x15c8d
cmpb $0x0, (%r14)
leaq 0x10ed0(%rip), %rax     # 0x2a30d
setne (%rax)
leaq 0xc(%rsp), %r14
movl %ebx, %edi
movq %r14, %rsi
movl $0x1, %edx
callq 0x15c8d
cmpb $0x0, (%r14)
leaq 0x1443f(%rip), %rax     # 0x2d89e
setne (%rax)
leaq 0xc(%rsp), %r14
movl %ebx, %edi
movq %r14, %rsi
movl $0x1, %edx
callq 0x15c8d
cmpb $0x0, (%r14)
leaq 0x1441e(%rip), %rax     # 0x2d89f
setne (%rax)
leaq 0xc(%rsp), %r14
movl %ebx, %edi
movq %r14, %rsi
movl $0x1, %edx
callq 0x15c8d
cmpb $0x0, (%r14)
leaq 0x143fd(%rip), %rax     # 0x2d8a0
setne (%rax)
leaq 0xc(%rsp), %r14
movl %ebx, %edi
movq %r14, %rsi
movl $0x1, %edx
callq 0x15c8d
cmpb $0x0, (%r14)
leaq 0x143dc(%rip), %rax     # 0x2d8a1
setne (%rax)
leaq 0xc(%rsp), %r14
movl %ebx, %edi
movq %r14, %rsi
movl $0x1, %edx
callq 0x15c8d
cmpb $0x0, (%r14)
leaq 0x143bb(%rip), %rax     # 0x2d8a2
setne (%rax)
leaq 0xc(%rsp), %r14
movl %ebx, %edi
movq %r14, %rsi
movl $0x1, %edx
callq 0x15c8d
cmpb $0x0, (%r14)
leaq 0x1439a(%rip), %rax     # 0x2d8a3
setne (%rax)
leaq 0x16f49(%rip), %r14     # 0x3045c
movl %ebx, %edi
movq %r14, %rsi
callq 0x15d65
addq $0x4, %r14
movl %ebx, %edi
movq %r14, %rsi
callq 0x15d65
leaq 0x16f32(%rip), %r14     # 0x30464
movl %ebx, %edi
movq %r14, %rsi
callq 0x15d65
addq $0x4, %r14
movl %ebx, %edi
movq %r14, %rsi
callq 0x15d65
leaq 0x16f1b(%rip), %r14     # 0x3046c
movl %ebx, %edi
movq %r14, %rsi
callq 0x15d65
addq $0x4, %r14
movl %ebx, %edi
movq %r14, %rsi
callq 0x15d65
leaq 0x10e40(%rip), %r14     # 0x2a3b0
movl %ebx, %edi
movq %r14, %rsi
callq 0x15d65
addq $0x4, %r14
movl %ebx, %edi
movq %r14, %rsi
callq 0x15d65
leaq 0x10e31(%rip), %rsi     # 0x2a3c0
movl %ebx, %edi
callq 0x17c7a
leaq 0x16ee3(%rip), %rsi     # 0x30480
movl %ebx, %edi
movl $0x14, %edx
callq 0x17383
movl %ebx, %edi
callq 0x18476
movl %ebx, %edi
callq 0x18585
movl %ebx, %edi
callq 0x186a8
movl %ebx, %edi
callq 0x188b6
leaq 0x12804(%rip), %rsi     # 0x2bdd0
movl %ebx, %edi
movl $0x9, %edx
callq 0x16fff
leaq 0x12881(%rip), %rsi     # 0x2be60
movl %ebx, %edi
movl $0xb, %edx
callq 0x16fff
leaq 0x1299e(%rip), %rsi     # 0x2bf90
movl %ebx, %edi
movl $0x13, %edx
callq 0x16fff
leaq 0x12cfb(%rip), %rsi     # 0x2c300
movl %ebx, %edi
movl $0x1b, %edx
callq 0x16fff
leaq 0x12e98(%rip), %rsi     # 0x2c4b0
movl %ebx, %edi
movl $0x16, %edx
callq 0x16fff
leaq 0x12fe5(%rip), %rsi     # 0x2c610
movl %ebx, %edi
movl $0x1b, %edx
callq 0x16fff
leaq 0x13182(%rip), %rsi     # 0x2c7c0
movl %ebx, %edi
movl $0x1b, %edx
callq 0x16fff
leaq 0x1738f(%rip), %rax     # 0x309e0
movq (%rax), %rsi
movl %ebx, %edi
callq 0x16601
leaq 0x1738e(%rip), %rax     # 0x309f0
movq (%rax), %rsi
movl %ebx, %edi
callq 0x16601
movq 0x108bd(%rip), %rax     # 0x29f30
movq (%rax), %rsi
movl %ebx, %edi
callq 0x16601
movl 0x19dfd(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x19dfd(%rip), %ecx     # 0x33488
sete %al
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq