// File: /workspace/github_c_makefile_star2_O0/jonof[P]jftekwar/src/tekmsc.c
// Function: newmap
void
newmap(int mapno)
{
     int       sn,p;
     int       savhealth;
     int       savestun;
     int       savereds;
     int       saveblues;
     int       saveaccutrk;
     int       newmap;

     if( option[4] != 0 ) {
          return;
     }
     if( mapno >= TOTALMAPS ) {
          return;
     }

     switch( mapno ) {
     case 0:
     case 1:
     case 2:
     case 3:
          newmap=mapreturn(currentmapno);
          if( newmap != mapno ) {
               crashgame("bad return map");
          }
          break;
     }

     drawscreen(screenpeek,0);
     printext((xdim>>1)-44,(ydim>>1)-32,"LOADING MAP",ALPHABET2,255);
     nextpage();

     initpaletteshifts();
     p=screenpeek;

    #if 0
     switch( currentmapno ) {
     case 0:
     case 1:
     case 2:
     case 3:
          warpretx=posx[p];
          warprety=posy[p];
          warpretz=posz[p];
          warpretang=ang[p];
          warpretsect=cursectnum[p];
          break;
     default:
          break;
     }
    #endif

     savhealth=health[p];
     savestun=stun[p];
     savereds=invredcards[p];
     saveblues=invbluecards[p];
     saveaccutrk=invaccutrak[p];

     newgame(mapnames[mapno]);

     health[p]=savhealth;
     stun[p]=savestun;
     invredcards[p]=savereds;
     invbluecards[p]=saveblues;
     invaccutrak[p]=saveaccutrk;

    #if 0
     switch( mapno ) {
     case 0:
     case 1:
     case 2:
     case 3:
          sn=playersprite[p];
          sprite[sn].x=warpretx;
          sprite[sn].y=warprety;
          sprite[sn].z=warpretz;
          changespritesect(sn,warpretsect);
          posx[p]=sprite[sn].x;
          posy[p]=sprite[sn].y;
          posz[p]=sprite[sn].z;
          ang[p]=((warpretang+1024)&2047);
          cursectnum[p]=sprite[sn].sectnum;
          updatesector(posx[p],posy[p],cursectnum[p]);
          break;
     default:
          break;
     }
    #endif

     switch( mapno ) {
     case 0:
     case 1:
     case 2:
     case 3:
          sn=playersprite[p];

          sprite[sn].x=warpretx;
          sprite[sn].y=warprety;
          sprite[sn].ang=warpretang;
          copybuf(&sprite[sn].x,&osprite[sn].x,3);
          changespritesect(sn,warpretsect);

          posx[p]=sprite[sn].x;
          posy[p]=sprite[sn].y;
          ang[p]=sprite[sn].ang;
          cursectnum[p]=sprite[sn].sectnum;

          //updatesector(posx[p],posy[p],cursectnum[p]);
          //pushmove(&posx[p],&posy[p],&posz[p],&cursectnum[p],128L,4<<8,4<<8,CLIPMASK0);
          break;
     default:
          break;
     }

     vel=0;
     svel=0;
     angvel=0;

     currentmapno=mapno;
     strcpy(tektempbuf, mapnames[mapno]);
     showmessage(Bstrupr(tektempbuf));

     musicfade();
     if( mapno <= 3 ) {
          menusong(1);
     }
     else {
          startmusic(mission);
     }

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movl %edi, -0x4(%rbp)
leaq 0xfc256(%rip), %rax     # 0x119f18
movzbl 0x4(%rax), %eax
cmpl $0x0, %eax
je 0x1dcd0
jmp 0x1dfff
cmpl $0x20, -0x4(%rbp)
jl 0x1dcdb
jmp 0x1dfff
movl -0x4(%rbp), %eax
subl $0x3, %eax
ja 0x1dd0b
jmp 0x1dce5
movl 0x15a7e1(%rip), %edi    # 0x1784cc
callq 0x1d930
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x4(%rbp), %eax
je 0x1dd09
leaq 0xbbd9a(%rip), %rdi     # 0xd9a9c
movb $0x0, %al
callq 0x44240
jmp 0x1dd0b
leaq 0x10facc(%rip), %rax    # 0x12d7de
movq %rax, -0x58(%rbp)
movswl (%rax), %edi
xorl %esi, %esi
callq 0xb170
leaq 0x5e22f5(%rip), %rax    # 0x60001c
movl (%rax), %edi
sarl %edi
addl $-0x2c, %edi
leaq 0x5e22eb(%rip), %rax    # 0x600020
movl (%rax), %esi
sarl %esi
addl $-0x20, %esi
leaq 0xbbd68(%rip), %rdx     # 0xd9aab
movl $0x15d, %ecx            # imm = 0x15D
movl $0xff, %r8d
callq 0x9580
callq 0x67810
callq 0x19830
movq -0x58(%rbp), %rax
movswl (%rax), %eax
movl %eax, -0xc(%rbp)
movslq -0xc(%rbp), %rcx
leaq 0x10fb9e(%rip), %rax    # 0x12d910
movq %rax, -0x50(%rbp)
movl (%rax,%rcx,4), %eax
movl %eax, -0x10(%rbp)
movslq -0xc(%rbp), %rcx
leaq 0x10f989(%rip), %rax    # 0x12d710
movq %rax, -0x48(%rbp)
movl (%rax,%rcx,4), %eax
movl %eax, -0x14(%rbp)
movslq -0xc(%rbp), %rcx
leaq 0x15bfa4(%rip), %rax    # 0x179d40
movq %rax, -0x40(%rbp)
movl (%rax,%rcx,4), %eax
movl %eax, -0x18(%rbp)
movslq -0xc(%rbp), %rcx
leaq 0x15bfcf(%rip), %rax    # 0x179d80
movq %rax, -0x38(%rbp)
movl (%rax,%rcx,4), %eax
movl %eax, -0x1c(%rbp)
movslq -0xc(%rbp), %rcx
leaq 0x15bffa(%rip), %rax    # 0x179dc0
movq %rax, -0x30(%rbp)
movl (%rax,%rcx,4), %eax
movl %eax, -0x20(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0xfcdd5(%rip), %rax     # 0x11abb0
movq (%rax,%rcx,8), %rdi
callq 0x1d7e0
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq -0x38(%rbp), %rcx
movq -0x30(%rbp), %rax
movl -0x10(%rbp), %r9d
movslq -0xc(%rbp), %r8
movl %r9d, (%rdi,%r8,4)
movl -0x14(%rbp), %r8d
movslq -0xc(%rbp), %rdi
movl %r8d, (%rsi,%rdi,4)
movl -0x18(%rbp), %edi
movslq -0xc(%rbp), %rsi
movl %edi, (%rdx,%rsi,4)
movl -0x1c(%rbp), %esi
movslq -0xc(%rbp), %rdx
movl %esi, (%rcx,%rdx,4)
movl -0x20(%rbp), %edx
movslq -0xc(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x4(%rbp), %eax
subl $0x3, %eax
ja 0x1df78
jmp 0x1de3c
movslq -0xc(%rbp), %rcx
leaq 0x1108c9(%rip), %rax    # 0x12e710
movswl (%rax,%rcx,2), %eax
movl %eax, -0x8(%rbp)
movl 0x15c0fc(%rip), %ecx    # 0x179f50
movslq -0x8(%rbp), %rdx
leaq 0x458c81(%rip), %rax    # 0x476ae0
imulq $0x2c, %rdx, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movl 0x15c0e6(%rip), %ecx    # 0x179f54
movslq -0x8(%rbp), %rdx
leaq 0x458c67(%rip), %rax    # 0x476ae0
imulq $0x2c, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x4(%rax)
movl 0x15c0cf(%rip), %eax    # 0x179f58
movw %ax, %cx
movslq -0x8(%rbp), %rdx
leaq 0x458c49(%rip), %rax    # 0x476ae0
imulq $0x2c, %rdx, %rdx
addq %rdx, %rax
movw %cx, 0x1c(%rax)
movslq -0x8(%rbp), %rax
leaq 0x458c33(%rip), %rdi    # 0x476ae0
imulq $0x2c, %rax, %rax
addq %rax, %rdi
movslq -0x8(%rbp), %rax
leaq 0x117d61(%rip), %rsi    # 0x135c20
imulq $0xc, %rax, %rax
addq %rax, %rsi
movl $0x3, %edx
callq 0x8c070
movl -0x8(%rbp), %eax
movw %ax, %cx
movl 0x15c080(%rip), %eax    # 0x179f5c
movswl %cx, %edi
movswl %ax, %esi
callq 0x69bd0
movslq -0x8(%rbp), %rcx
leaq 0x458bee(%rip), %rax    # 0x476ae0
imulq $0x2c, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %edx
movslq -0xc(%rbp), %rcx
leaq 0x10f94a(%rip), %rax    # 0x12d850
movl %edx, (%rax,%rcx,4)
movslq -0x8(%rbp), %rcx
leaq 0x458bcc(%rip), %rax    # 0x476ae0
imulq $0x2c, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %edx
movslq -0xc(%rbp), %rcx
leaq 0x10f967(%rip), %rax    # 0x12d890
movl %edx, (%rax,%rcx,4)
movslq -0x8(%rbp), %rcx
leaq 0x458ba9(%rip), %rax    # 0x476ae0
imulq $0x2c, %rcx, %rcx
addq %rcx, %rax
movw 0x1c(%rax), %dx
movslq -0xc(%rbp), %rcx
leaq 0x10f8e3(%rip), %rax    # 0x12d830
movw %dx, (%rax,%rcx,2)
movslq -0x8(%rbp), %rcx
leaq 0x458b84(%rip), %rax    # 0x476ae0
imulq $0x2c, %rcx, %rcx
addq %rcx, %rax
movw 0x18(%rax), %dx
movslq -0xc(%rbp), %rcx
leaq 0x11076e(%rip), %rax    # 0x12e6e0
movw %dx, (%rax,%rcx,2)
jmp 0x1df7a
jmp 0x1df7a
leaq 0x11081f(%rip), %rax    # 0x12e7a0
movl $0x0, (%rax)
leaq 0x110816(%rip), %rax    # 0x12e7a4
movl $0x0, (%rax)
leaq 0x11080d(%rip), %rax    # 0x12e7a8
movl $0x0, (%rax)
movl -0x4(%rbp), %eax
movl %eax, 0x15a522(%rip)    # 0x1784cc
movslq -0x4(%rbp), %rcx
leaq 0xfcbfb(%rip), %rax     # 0x11abb0
movq (%rax,%rcx,8), %rsi
leaq 0x15be60(%rip), %rdi    # 0x179e20
callq 0x8550
leaq 0x15be54(%rip), %rdi    # 0x179e20
callq 0x4fbf0
movq %rax, %rdi
movb $0x0, %al
callq 0x1a150
movb $0x0, %al
callq 0x280d0
cmpl $0x3, -0x4(%rbp)
jg 0x1dff4
movl $0x1, %edi
callq 0x280f0
jmp 0x1dfff
movl 0x15a4d6(%rip), %edi    # 0x1784d0
callq 0x281b0
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)