// File: /workspace/github_c_makefile_star2_O1/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, 0x1177e0(%rip)    # 0x12c4f4
jne 0x1504e
pushq %r15
pushq %r14
pushq %rbx
leaq 0x3173da(%rip), %rbx    # 0x32c100
cmpb $0x0, 0x38(%rbx)
je 0x14d41
cmpb $0x0, 0x10(%rbx)
je 0x14d41
xorl %eax, %eax
movb %al, 0x38(%rbx)
movb %al, 0x10(%rbx)
movb $0x1, 0x1177b8(%rip)    # 0x12c4f9
cmpb $0x0, 0x38(%rbx)
leaq 0xb9c2c(%rip), %r14     # 0xce978
je 0x14ea7
cmpb $0x0, 0x2a(%rbx)
je 0x14ea7
cmpb $0x0, 0x4(%r14)
jne 0x14ea7
cmpb $0x0, 0x22(%rbx)
je 0x14d94
leaq 0xb9cec(%rip), %rax     # 0xcea60
movl 0x1c(%rax), %ecx
movl %ecx, %edx
xorl $0x1, %edx
movl %edx, 0x1c(%rax)
cmpl $0x1, %ecx
jne 0x14d8b
callq 0x1510d
jmp 0x14d90
callq 0x150d4
movb $0x0, 0x22(%rbx)
cmpb $0x0, 0x23(%rbx)
je 0x14db2
leaq 0xcc6bd(%rip), %rax     # 0xe145e
movswl (%rax), %edi
movl $0xc8, %esi
callq 0xa5d8
movb $0x0, 0x23(%rbx)
cmpb $0x0, 0x24(%rbx)
je 0x14de0
movabsq $0x1000100010001, %rax  # imm = 0x1000100010001
movq %rax, 0x118fa9(%rip)    # 0x12dd72
movl $0x10001, 0x118fa7(%rip) # imm = 0x10001
movw $0x1, 0x118fa2(%rip)    # 0x12dd7e
movb $0x0, 0x24(%rbx)
cmpb $0x0, 0x11(%rbx)
je 0x14ea3
leaq 0xcc66d(%rip), %rax     # 0xe145e
movswq (%rax), %rax
leaq 0x1173e4(%rip), %rcx    # 0x12c1e0
movw $0x64, %dx
movw %dx, (%rcx,%rax,2)
leaq 0x1173f5(%rip), %rcx    # 0x12c200
movw %dx, (%rcx,%rax,2)
leaq 0x11740a(%rip), %rcx    # 0x12c220
movw %dx, (%rcx,%rax,2)
leaq 0x11741f(%rip), %rcx    # 0x12c240
movw %dx, (%rcx,%rax,2)
leaq 0x117434(%rip), %rcx    # 0x12c260
movw %dx, (%rcx,%rax,2)
leaq 0x117449(%rip), %rcx    # 0x12c280
movw %dx, (%rcx,%rax,2)
leaq 0x11745e(%rip), %rcx    # 0x12c2a0
movw %dx, (%rcx,%rax,2)
leaq 0x117473(%rip), %rcx    # 0x12c2c0
movw %dx, (%rcx,%rax,2)
leaq 0x118f28(%rip), %rcx    # 0x12dd80
movl $0x1, %edx
movl %edx, (%rcx,%rax,4)
leaq 0x118f59(%rip), %rcx    # 0x12ddc0
movl %edx, (%rcx,%rax,4)
leaq 0x118f8f(%rip), %rcx    # 0x12de00
movl %edx, (%rcx,%rax,4)
leaq 0xbaa75(%rip), %rcx     # 0xcf8f0
movl 0x8(%rcx), %edx
movl 0x14(%rcx), %esi
orl 0x4(%rcx), %edx
orl 0xc(%rcx), %edx
orl 0x10(%rcx), %edx
orl 0x18(%rcx), %esi
orl 0x1c(%rcx), %esi
orl 0x20(%rcx), %esi
leaq 0x1175e6(%rip), %rcx    # 0x12c480
orl %edx, %esi
movl %esi, (%rcx,%rax,4)
movb $0x0, 0x11(%rbx)
movb $0x0, 0x45(%rbx)
leaq 0xb9ad2(%rip), %r15     # 0xce980
movslq 0x5c(%r15), %rax
cmpb $0x0, (%rbx,%rax)
je 0x14ec6
movb $0x0, (%rbx,%rax)
leaq 0xb9b9d(%rip), %rax     # 0xcea60
xorb $0x1, (%rax)
movslq 0x60(%r15), %rax
cmpb $0x0, (%rbx,%rax)
je 0x14edf
movb $0x0, (%rbx,%rax)
leaq 0xb9b85(%rip), %rax     # 0xcea60
xorb $0x1, 0x4(%rax)
movslq 0x64(%r15), %rax
cmpb $0x0, (%rbx,%rax)
je 0x14ef8
movb $0x0, (%rbx,%rax)
leaq 0xb9b6c(%rip), %rax     # 0xcea60
xorb $0x1, 0x8(%rax)
movslq 0x50(%r15), %rax
cmpb $0x0, (%rbx,%rax)
je 0x14f31
movb $0x0, (%rbx,%rax)
leaq 0xb9b53(%rip), %rax     # 0xcea60
xorb $0x1, 0x14(%rax)
movl $0x33, %edi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
movl $0x1, %r8d
callq 0x1c1f1
movl $0x1, 0x118f0f(%rip)    # 0x12de40
movslq 0x54(%r15), %rax
cmpb $0x0, (%rbx,%rax)
je 0x14f6d
movb $0x0, (%rbx,%rax)
leaq 0xb9b1a(%rip), %rax     # 0xcea60
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 0x1c1f1
movl $0x1, 0x118ed7(%rip)    # 0x12de44
movslq 0x58(%r15), %rax
cmpb $0x0, (%rbx,%rax)
je 0x14fa6
movb $0x0, (%rbx,%rax)
leaq 0xb9ade(%rip), %rax     # 0xcea60
xorb $0x1, 0x20(%rax)
movl $0x32, %edi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
movl $0x1, %r8d
callq 0x1c1f1
movl $0x1, 0x118ea2(%rip)    # 0x12de48
movslq 0x68(%r15), %rax
cmpb $0x0, (%rbx,%rax)
je 0x14fbf
movb $0x0, (%rbx,%rax)
leaq 0xb9aa5(%rip), %rax     # 0xcea60
xorb $0x1, 0x28(%rax)
cmpb $0x0, 0x3b(%rbx)
je 0x15010
movl $0x63, 0x117525(%rip)   # 0x12c4f4
leaq 0x118e76(%rip), %rax    # 0x12de4c
movl $0x1, (%rax)
cmpb $0x0, 0x41(%rbx)
je 0x14ff1
movb $0x0, 0x41(%rbx)
leaq 0xb9a73(%rip), %rax     # 0xcea60
xorb $0x1, 0x24(%rax)
cmpb $0x0, 0x1(%rbx)
je 0x15049
movb $0x0, 0x1(%rbx)
cmpl $0x0, 0x1174f2(%rip)    # 0x12c4f4
je 0x15029
movl $0x0, 0x1174e6(%rip)    # 0x12c4f4
jmp 0x15049
cmpb $0x0, 0x3c(%rbx)
je 0x15051
cmpb $0x0, 0x4(%r14)
jne 0x14fdc
movl $0x7, 0x1174cd(%rip)    # 0x12c4f4
jmp 0x14fcf
movl $0x1, 0x1174c1(%rip)    # 0x12c4f4
movl $0x34, %edi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
movl $0x1, %r8d
callq 0x1c1f1
popq %rbx
popq %r14
popq %r15
xorl %eax, %eax
retq
cmpb $0x0, 0x3d(%rbx)
je 0x15071
cmpb $0x0, 0x4(%r14)
jne 0x14fdc
movl $0x6, 0x117488(%rip)    # 0x12c4f4
jmp 0x14fcf
cmpb $0x0, 0x3e(%rbx)
je 0x15086
movl $0x4, 0x117473(%rip)    # 0x12c4f4
jmp 0x14fcf
cmpb $0x0, 0x40(%rbx)
je 0x15098
movl $0x9, 0x11745e(%rip)    # 0x12c4f4
jmp 0x150ac
cmpb $0x0, 0x42(%rbx)
je 0x14fdc
movl $0x8, 0x117448(%rip)    # 0x12c4f4
movl $0x1, 0x118d96(%rip)    # 0x12de4c
leaq 0xba537(%rip), %rax     # 0xcf5f4
jmp 0x14fd6