// File: /workspace/github_c_makefile_star2_O2/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, 0x111c10(%rip)    # 0x1254f4
jne 0x13c12
pushq %r15
pushq %r14
pushq %rbx
leaq 0x31182a(%rip), %rbx    # 0x325120
movb 0x38(%rbx), %al
testb %al, %al
je 0x13912
cmpb $0x0, 0x10(%rbx)
je 0x13912
xorl %eax, %eax
movb %al, 0x38(%rbx)
movb %al, 0x10(%rbx)
movb $0x1, 0x111be7(%rip)    # 0x1254f9
leaq 0xb405f(%rip), %r14     # 0xc7978
testb %al, %al
je 0x13a7c
cmpb $0x0, 0x2a(%rbx)
je 0x13a7c
cmpb $0x0, 0x4(%r14)
jne 0x13a7c
cmpb $0x0, 0x22(%rbx)
je 0x13963
leaq 0xb411d(%rip), %rax     # 0xc7a60
movl 0x1c(%rax), %ecx
movl %ecx, %edx
xorl $0x1, %edx
movl %edx, 0x1c(%rax)
cmpl $0x1, %ecx
jne 0x1395a
callq 0x13ccb
jmp 0x1395f
callq 0x13c94
movb $0x0, 0x22(%rbx)
cmpb $0x0, 0x23(%rbx)
je 0x13981
leaq 0xc6aee(%rip), %rax     # 0xda45e
movswl (%rax), %edi
movl $0xc8, %esi
callq 0x99a8
movb $0x0, 0x23(%rbx)
cmpb $0x0, 0x24(%rbx)
je 0x139af
movabsq $0x1000100010001, %rax  # imm = 0x1000100010001
movq %rax, 0x1133e0(%rip)    # 0x126d78
movl $0x10001, 0x1133de(%rip) # imm = 0x10001
movw $0x1, 0x1133d9(%rip)    # 0x126d84
movb $0x0, 0x24(%rbx)
cmpb $0x0, 0x11(%rbx)
je 0x13a78
pushq $0x1
popq %rcx
leaq 0xc6a9b(%rip), %rax     # 0xda45e
movswq (%rax), %rax
leaq 0x111812(%rip), %rdx    # 0x1251e0
movw $0x64, %si
movw %si, (%rdx,%rax,2)
leaq 0x111823(%rip), %rdx    # 0x125200
movw %si, (%rdx,%rax,2)
leaq 0x111838(%rip), %rdx    # 0x125220
movw %si, (%rdx,%rax,2)
leaq 0x11184d(%rip), %rdx    # 0x125240
movw %si, (%rdx,%rax,2)
leaq 0x111862(%rip), %rdx    # 0x125260
movw %si, (%rdx,%rax,2)
leaq 0x111877(%rip), %rdx    # 0x125280
movw %si, (%rdx,%rax,2)
leaq 0x11188c(%rip), %rdx    # 0x1252a0
movw %si, (%rdx,%rax,2)
leaq 0x1118a1(%rip), %rdx    # 0x1252c0
movw %si, (%rdx,%rax,2)
leaq 0x113366(%rip), %rdx    # 0x126d90
movl %ecx, (%rdx,%rax,4)
leaq 0x11339c(%rip), %rdx    # 0x126dd0
movl %ecx, (%rdx,%rax,4)
leaq 0x1133d2(%rip), %rdx    # 0x126e10
movl %ecx, (%rdx,%rax,4)
leaq 0x111a38(%rip), %rcx    # 0x125480
leaq 0xb4ea1(%rip), %rdx     # 0xc88f0
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 0xb3efd(%rip), %r15     # 0xc7980
movslq 0x5c(%r15), %rax
cmpb $0x0, (%rbx,%rax)
je 0x13a9b
movb $0x0, (%rbx,%rax)
leaq 0xb3fc8(%rip), %rax     # 0xc7a60
xorb $0x1, (%rax)
movslq 0x60(%r15), %rax
cmpb $0x0, (%rbx,%rax)
je 0x13ab4
movb $0x0, (%rbx,%rax)
leaq 0xb3fb0(%rip), %rax     # 0xc7a60
xorb $0x1, 0x4(%rax)
movslq 0x64(%r15), %rax
cmpb $0x0, (%rbx,%rax)
je 0x13acd
movb $0x0, (%rbx,%rax)
leaq 0xb3f97(%rip), %rax     # 0xc7a60
xorb $0x1, 0x8(%rax)
movslq 0x50(%r15), %rax
cmpb $0x0, (%rbx,%rax)
je 0x13b02
movb $0x0, (%rbx,%rax)
leaq 0xb3f7e(%rip), %rax     # 0xc7a60
xorb $0x1, 0x14(%rax)
pushq $0x33
popq %rdi
pushq $0x1
popq %r8
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x1ab2a
movl $0x1, 0x11334e(%rip)    # 0x126e50
movslq 0x54(%r15), %rax
cmpb $0x0, (%rbx,%rax)
je 0x13b3c
movb $0x0, (%rbx,%rax)
leaq 0xb3f49(%rip), %rax     # 0xc7a60
movl 0x18(%rax), %edi
xorl $0x1, %edi
movl %edi, 0x18(%rax)
addl $0x30, %edi
pushq $0x1
popq %r8
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x1ab2a
movl $0x1, 0x113318(%rip)    # 0x126e54
movslq 0x58(%r15), %rax
cmpb $0x0, (%rbx,%rax)
je 0x13b71
movb $0x0, (%rbx,%rax)
leaq 0xb3f0f(%rip), %rax     # 0xc7a60
xorb $0x1, 0x20(%rax)
pushq $0x32
popq %rdi
pushq $0x1
popq %r8
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x1ab2a
movl $0x1, 0x1132e7(%rip)    # 0x126e58
movslq 0x68(%r15), %rax
cmpb $0x0, (%rbx,%rax)
je 0x13b8a
movb $0x0, (%rbx,%rax)
leaq 0xb3eda(%rip), %rax     # 0xc7a60
xorb $0x1, 0x28(%rax)
cmpb $0x0, 0x3b(%rbx)
je 0x13bd8
movl $0x63, 0x11195a(%rip)   # 0x1254f4
leaq 0x1132bb(%rip), %rax    # 0x126e5c
movl $0x1, (%rax)
cmpb $0x0, 0x41(%rbx)
je 0x13bbc
movb $0x0, 0x41(%rbx)
leaq 0xb3ea8(%rip), %rax     # 0xc7a60
xorb $0x1, 0x24(%rax)
cmpb $0x0, 0x1(%rbx)
je 0x13c0d
movb $0x0, 0x1(%rbx)
cmpl $0x0, 0x111927(%rip)    # 0x1254f4
je 0x13bf1
andl $0x0, 0x11191e(%rip)    # 0x1254f4
jmp 0x13c0d
cmpb $0x0, 0x3c(%rbx)
je 0x13c15
cmpb $0x0, 0x4(%r14)
jne 0x13ba7
movl $0x7, 0x111905(%rip)    # 0x1254f4
jmp 0x13b9a
movl $0x1, 0x1118f9(%rip)    # 0x1254f4
pushq $0x34
popq %rdi
pushq $0x1
popq %r8
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x1ab2a
popq %rbx
popq %r14
popq %r15
xorl %eax, %eax
retq
cmpb $0x0, 0x3d(%rbx)
je 0x13c31
cmpb $0x0, 0x4(%r14)
jne 0x13ba7
movl $0x6, 0x1118c8(%rip)    # 0x1254f4
jmp 0x13b9a
cmpb $0x0, 0x3e(%rbx)
je 0x13c46
movl $0x4, 0x1118b3(%rip)    # 0x1254f4
jmp 0x13b9a
cmpb $0x0, 0x40(%rbx)
je 0x13c58
movl $0x9, 0x11189e(%rip)    # 0x1254f4
jmp 0x13c6c
cmpb $0x0, 0x42(%rbx)
je 0x13ba7
movl $0x8, 0x111888(%rip)    # 0x1254f4
movl $0x1, 0x1131e6(%rip)    # 0x126e5c
leaq 0xb4977(%rip), %rax     # 0xc85f4
jmp 0x13ba1