// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/src/tekmsc.c
// Function: tekprivatekeys
int
tekprivatekeys(void)
{
     if( activemenu != 0 ) {
          return(0);
     }

     // alt hot keys - non mappable
     /*
     if( (keystatus[56] != 0) && (keystatus[25] != 0) ) {
          keystatus[56]=0;
          keystatus[25]=0;
          cd_play();
     }
     if( (keystatus[56] != 0) && (keystatus[19] != 0) ) {
          keystatus[56]=0;
          keystatus[19]=0;
          cd_resetdisc();
     }
     if( (keystatus[56] != 0) && (keystatus[31] != 0) ) {
          keystatus[56]=0;
          keystatus[31]=0;
          cd_stopplay();
     }
     if( (keystatus[56] != 0) && (keystatus[33] != 0) ) {
          keystatus[56]=0;
          keystatus[33]=0;
          cd_advancetrack();
     }
     if( (keystatus[56] != 0) && (keystatus[48] != 0) ) {
          keystatus[56]=0;
          keystatus[48]=0;
          cd_retardtrack();
     }
     */
     if( (keystatus[56] != 0) && (keystatus[16] != 0) ) {
          keystatus[56]=0;
          keystatus[16]=0;
          gameover=1;
     }

     // cheat num lock keys
     if( (keystatus[56] != 0) && (keystatus[42] != 0) && (option[4] == 0) ) {
          if( keystatus[34] != 0 ) {
               toggles[TOGGLE_GODMODE]^=0x01;
               if( toggles[TOGGLE_GODMODE] ) {
                    holyon();
               }
               else {
                    holyoff();
               }
               keystatus[34]=0;
          }
          if( keystatus[35] != 0 ) {
               changehealth(screenpeek, 200);
               keystatus[35]=0;
          }
          if( keystatus[36] != 0 ) {
               symbols[0]=1;
               symbols[1]=1;
               symbols[2]=1;
               symbols[3]=1;
               symbols[4]=1;
               symbols[5]=1;
               symbols[6]=1;
               keystatus[36]=0;
          }
          if( keystatus[17] != 0 ) {
               ammo1[screenpeek]=MAXAMMO;
               ammo2[screenpeek]=MAXAMMO;
               ammo3[screenpeek]=MAXAMMO;
               ammo4[screenpeek]=MAXAMMO;
               ammo5[screenpeek]=MAXAMMO;
               ammo6[screenpeek]=MAXAMMO;
               ammo7[screenpeek]=MAXAMMO;
               ammo8[screenpeek]=MAXAMMO;
               invredcards[screenpeek]=1;
               invbluecards[screenpeek]=1;
               invaccutrak[screenpeek]=1;
               weapons[screenpeek] =(flags32[GUN1FLAG]|flags32[GUN2FLAG]|flags32[GUN3FLAG]|flags32[GUN4FLAG]);
               weapons[screenpeek]|=(flags32[GUN5FLAG]|flags32[GUN6FLAG]|flags32[GUN7FLAG]|flags32[GUN8FLAG]);
               keystatus[17]=0;
          }
          keystatus[69]=0;
     }

     // local game keys
     if( keystatus[keys[23]] != 0 ) {
          keystatus[keys[23]]=0;
          toggles[TOGGLE_RETICULE]^=0x01;
     }
     if( keystatus[keys[24]] != 0 ) {
          keystatus[keys[24]]=0;
          toggles[TOGGLE_TIME]^=0x01;
     }
     if( keystatus[keys[25]] != 0 ) {
          keystatus[keys[25]]=0;
          toggles[TOGGLE_SCORE]^=0x01;

     }
     if( keystatus[keys[20]] != 0 ) {
          keystatus[keys[20]]=0;
          toggles[TOGGLE_REARVIEW]^=0x01;
          playsound( S_REARMONITOR,0,0,0, ST_IMMEDIATE);
          rvmoving=1;
     }
     if( keystatus[keys[21]] != 0 ) {
          keystatus[keys[21]]=0;
          toggles[TOGGLE_UPRT]^=0x01;
          playsound(S_STATUS1+toggles[TOGGLE_UPRT],0,0,0, ST_IMMEDIATE);
          wpmoving=1;
     }
     if (keystatus[keys[22]] != 0) {
          keystatus[keys[22]]=0;
          toggles[TOGGLE_HEALTH]^=0x01;
          playsound( S_HEALTHMONITOR,0,0,0, ST_IMMEDIATE);
          hcmoving=1;
     }
     if( keystatus[keys[26]] != 0 ) {
          keystatus[keys[26]]=0;
          toggles[TOGGLE_INVENTORY]^=0x01;
     }

     // non mappable function keys
     if (keystatus[59] != 0) {
          activemenu=HELPSCREEN;
          menudirect=1;
     }
     else if (keystatus[60] != 0) {
          if( option[4] == 0 ) {
               activemenu=MENUSAVEGAME;
               menudirect=1;
          }
     }
     else if (keystatus[61] != 0) {
          if( option[4] == 0 ) {
               activemenu=MENULOADGAME;
               menudirect=1;
          }
     }
     else if (keystatus[62] != 0) {
          activemenu=MENUQUITGAME;
          menudirect=1;
     }
     else if (keystatus[64] != 0) {
          activemenu=MENUMOUSEADJ;
          menudirect=1;
          selopt=1;
     }
     else if (keystatus[66] != 0) {
          activemenu=MENUSOUNDMUS;
          menudirect=1;
          selopt=1;
     }
     if( keystatus[65] != 0 ) {
          keystatus[65]=0;
          toggles[TOGGLE_OVERSCAN]^=0x01;
     }

     // esc non mappable
     if( keystatus[1] != 0 ) {
          keystatus[1]=0;
          if( activemenu ) {
               activemenu=0;
          }
          else {
               activemenu=1;
               playsound(S_MENUSOUND1,0,0,0,ST_IMMEDIATE);
          }
     }

     return 0;
}

// Assembly:
cmpl $0x0, 0x11a75a(%rip)    # 0x12f4f4
jne 0x150db
pushq %r15
pushq %r14
pushq %rbx
leaq 0x31a374(%rip), %rbx    # 0x32f120
movb 0x38(%rbx), %al
testb %al, %al
je 0x14dc8
cmpb $0x0, 0x10(%rbx)
je 0x14dc8
xorl %eax, %eax
movb %al, 0x38(%rbx)
movb %al, 0x10(%rbx)
movb $0x1, 0x11a731(%rip)    # 0x12f4f9
leaq 0xbcba9(%rip), %r14     # 0xd1978
testb %al, %al
je 0x14f34
cmpb $0x0, 0x2a(%rbx)
je 0x14f34
cmpb $0x0, 0x4(%r14)
jne 0x14f34
cmpb $0x0, 0x22(%rbx)
je 0x14e19
leaq 0xbcc67(%rip), %rax     # 0xd1a60
movl 0x1c(%rax), %ecx
movl %ecx, %edx
xorl $0x1, %edx
movl %edx, 0x1c(%rax)
cmpl $0x1, %ecx
jne 0x14e10
callq 0x1519a
jmp 0x14e15
callq 0x15161
movb $0x0, 0x22(%rbx)
cmpb $0x0, 0x23(%rbx)
je 0x14e37
leaq 0xcf638(%rip), %rax     # 0xe445e
movswl (%rax), %edi
movl $0xc8, %esi
callq 0xa5e8
movb $0x0, 0x23(%rbx)
cmpb $0x0, 0x24(%rbx)
je 0x14e65
movabsq $0x1000100010001, %rax  # imm = 0x1000100010001
movq %rax, 0x11bf2a(%rip)    # 0x130d78
movl $0x10001, 0x11bf28(%rip) # imm = 0x10001
movw $0x1, 0x11bf23(%rip)    # 0x130d84
movb $0x0, 0x24(%rbx)
cmpb $0x0, 0x11(%rbx)
je 0x14f30
leaq 0xcf5e8(%rip), %rax     # 0xe445e
movswq (%rax), %rax
leaq 0x11a35f(%rip), %rcx    # 0x12f1e0
movw $0x64, %dx
movw %dx, (%rcx,%rax,2)
leaq 0x11a370(%rip), %rcx    # 0x12f200
movw %dx, (%rcx,%rax,2)
leaq 0x11a385(%rip), %rcx    # 0x12f220
movw %dx, (%rcx,%rax,2)
leaq 0x11a39a(%rip), %rcx    # 0x12f240
movw %dx, (%rcx,%rax,2)
leaq 0x11a3af(%rip), %rcx    # 0x12f260
movw %dx, (%rcx,%rax,2)
leaq 0x11a3c4(%rip), %rcx    # 0x12f280
movw %dx, (%rcx,%rax,2)
leaq 0x11a3d9(%rip), %rcx    # 0x12f2a0
movw %dx, (%rcx,%rax,2)
leaq 0x11a3ee(%rip), %rcx    # 0x12f2c0
movw %dx, (%rcx,%rax,2)
leaq 0x11beb3(%rip), %rcx    # 0x130d90
movl $0x1, %edx
movl %edx, (%rcx,%rax,4)
leaq 0x11bee4(%rip), %rcx    # 0x130dd0
movl %edx, (%rcx,%rax,4)
leaq 0x11bf1a(%rip), %rcx    # 0x130e10
movl %edx, (%rcx,%rax,4)
leaq 0x11a580(%rip), %rcx    # 0x12f480
leaq 0xbd9e9(%rip), %rdx     # 0xd28f0
movdqu 0x4(%rdx), %xmm0
movdqu 0x14(%rdx), %xmm1
por %xmm0, %xmm1
pshufd $0xee, %xmm1, %xmm0     # xmm0 = xmm1[2,3,2,3]
por %xmm1, %xmm0
pshufd $0x55, %xmm0, %xmm1     # xmm1 = xmm0[1,1,1,1]
por %xmm0, %xmm1
movd %xmm1, (%rcx,%rax,4)
movb $0x0, 0x11(%rbx)
movb $0x0, 0x45(%rbx)
leaq 0xbca45(%rip), %r15     # 0xd1980
movslq 0x5c(%r15), %rax
cmpb $0x0, (%rbx,%rax)
je 0x14f53
movb $0x0, (%rbx,%rax)
leaq 0xbcb10(%rip), %rax     # 0xd1a60
xorb $0x1, (%rax)
movslq 0x60(%r15), %rax
cmpb $0x0, (%rbx,%rax)
je 0x14f6c
movb $0x0, (%rbx,%rax)
leaq 0xbcaf8(%rip), %rax     # 0xd1a60
xorb $0x1, 0x4(%rax)
movslq 0x64(%r15), %rax
cmpb $0x0, (%rbx,%rax)
je 0x14f85
movb $0x0, (%rbx,%rax)
leaq 0xbcadf(%rip), %rax     # 0xd1a60
xorb $0x1, 0x8(%rax)
movslq 0x50(%r15), %rax
cmpb $0x0, (%rbx,%rax)
je 0x14fbe
movb $0x0, (%rbx,%rax)
leaq 0xbcac6(%rip), %rax     # 0xd1a60
xorb $0x1, 0x14(%rax)
movl $0x33, %edi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
movl $0x1, %r8d
callq 0x1c370
movl $0x1, 0x11be92(%rip)    # 0x130e50
movslq 0x54(%r15), %rax
cmpb $0x0, (%rbx,%rax)
je 0x14ffa
movb $0x0, (%rbx,%rax)
leaq 0xbca8d(%rip), %rax     # 0xd1a60
movl 0x18(%rax), %edi
xorl $0x1, %edi
movl %edi, 0x18(%rax)
addl $0x30, %edi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
movl $0x1, %r8d
callq 0x1c370
movl $0x1, 0x11be5a(%rip)    # 0x130e54
movslq 0x58(%r15), %rax
cmpb $0x0, (%rbx,%rax)
je 0x15033
movb $0x0, (%rbx,%rax)
leaq 0xbca51(%rip), %rax     # 0xd1a60
xorb $0x1, 0x20(%rax)
movl $0x32, %edi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
movl $0x1, %r8d
callq 0x1c370
movl $0x1, 0x11be25(%rip)    # 0x130e58
movslq 0x68(%r15), %rax
cmpb $0x0, (%rbx,%rax)
je 0x1504c
movb $0x0, (%rbx,%rax)
leaq 0xbca18(%rip), %rax     # 0xd1a60
xorb $0x1, 0x28(%rax)
cmpb $0x0, 0x3b(%rbx)
je 0x1509d
movl $0x63, 0x11a498(%rip)   # 0x12f4f4
leaq 0x11bdf9(%rip), %rax    # 0x130e5c
movl $0x1, (%rax)
cmpb $0x0, 0x41(%rbx)
je 0x1507e
movb $0x0, 0x41(%rbx)
leaq 0xbc9e6(%rip), %rax     # 0xd1a60
xorb $0x1, 0x24(%rax)
cmpb $0x0, 0x1(%rbx)
je 0x150d6
movb $0x0, 0x1(%rbx)
cmpl $0x0, 0x11a465(%rip)    # 0x12f4f4
je 0x150b6
movl $0x0, 0x11a459(%rip)    # 0x12f4f4
jmp 0x150d6
cmpb $0x0, 0x3c(%rbx)
je 0x150de
cmpb $0x0, 0x4(%r14)
jne 0x15069
movl $0x7, 0x11a440(%rip)    # 0x12f4f4
jmp 0x1505c
movl $0x1, 0x11a434(%rip)    # 0x12f4f4
movl $0x34, %edi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
movl $0x1, %r8d
callq 0x1c370
popq %rbx
popq %r14
popq %r15
xorl %eax, %eax
retq
cmpb $0x0, 0x3d(%rbx)
je 0x150fe
cmpb $0x0, 0x4(%r14)
jne 0x15069
movl $0x6, 0x11a3fb(%rip)    # 0x12f4f4
jmp 0x1505c
cmpb $0x0, 0x3e(%rbx)
je 0x15113
movl $0x4, 0x11a3e6(%rip)    # 0x12f4f4
jmp 0x1505c
cmpb $0x0, 0x40(%rbx)
je 0x15125
movl $0x9, 0x11a3d1(%rip)    # 0x12f4f4
jmp 0x15139
cmpb $0x0, 0x42(%rbx)
je 0x15069
movl $0x8, 0x11a3bb(%rip)    # 0x12f4f4
movl $0x1, 0x11bd19(%rip)    # 0x130e5c
leaq 0xbd4aa(%rip), %rax     # 0xd25f4
jmp 0x15063