// File: /workspace/github_c_makefile_star2_O0/jonof[P]jftekwar/src/tektag.c
// Function: tekswitchtrigger
void
tekswitchtrigger(short snum)
{
     int       i,j;
     int      nexti;
     int      dax,day;

     j=sprite[neartagsprite].picnum;

     switch( j ) {
     case SWITCH2OFF:
          if( invredcards[snum] == 0 ) {
               showmessage("PASSAGE REQUIRES RED KEYCARD");
               return;
          }
          break;
     case SWITCH4OFF:
          if( invbluecards[snum] == 0 ) {
               showmessage("PASSAGE REQUIRES BLUE KEYCARD");
               return;
          }
          break;
     }

     switch( j ) {
     case SWITCH2ON:
     case SWITCH2OFF:
     case SWITCH3ON:
     case SWITCH3OFF:
     case SWITCH4ON:
     case SWITCH4OFF:
          dax = sprite[neartagsprite].x;
          day = sprite[neartagsprite].y;
          playsound(S_KEYCARDBLIP, dax,day,0, ST_UPDATE);
          break;
     default:
          break;
     }

     if (j == SWITCH2ON) sprite[neartagsprite].picnum = SWITCH2OFF;
     if (j == SWITCH2OFF) sprite[neartagsprite].picnum = SWITCH2ON;
     if (j == SWITCH3ON) sprite[neartagsprite].picnum = SWITCH3OFF;
     if (j == SWITCH3OFF) sprite[neartagsprite].picnum = SWITCH3ON;
     if (j == SWITCH4ON) sprite[neartagsprite].picnum = SWITCH4OFF;
     if (j == SWITCH4OFF) sprite[neartagsprite].picnum = SWITCH4ON;

     if (j == 3708) sprite[neartagsprite].picnum = 3709;
     if (j == 3709) sprite[neartagsprite].picnum = 3708;

     for(i=0;i<numsectors;i++)
          if (sector[i].hitag == sprite[neartagsprite].hitag)
               if (sector[i].lotag != 1)
                    operatesector(i);

     i = headspritestat[0];
     while (i != -1)
     {
          nexti = nextspritestat[i];
          if (sprite[i].hitag == sprite[neartagsprite].hitag)
               operatesprite(i);
          i = nexti;
     }


}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movw %di, %ax
movw %ax, -0x2(%rbp)
leaq 0xea9ee(%rip), %rax     # 0x12e8f4
movswq (%rax), %rax
imulq $0x2c, %rax, %rcx
leaq 0x432bcb(%rip), %rax    # 0x476ae0
movswl 0xe(%rax,%rcx), %eax
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x1c(%rbp)
subl $0x195, %eax            # imm = 0x195
je 0x43f38
jmp 0x43f2c
movl -0x1c(%rbp), %eax
subl $0x1b3, %eax            # imm = 0x1B3
je 0x43f5f
jmp 0x43f86
movswq -0x2(%rbp), %rcx
leaq 0x135dfc(%rip), %rax    # 0x179d40
cmpl $0x0, (%rax,%rcx,4)
jne 0x43f5d
leaq 0x96c46(%rip), %rdi     # 0xdab97
movb $0x0, %al
callq 0x1a150
jmp 0x44233
jmp 0x43f86
movswq -0x2(%rbp), %rcx
leaq 0x135e15(%rip), %rax    # 0x179d80
cmpl $0x0, (%rax,%rcx,4)
jne 0x43f84
leaq 0x96c3c(%rip), %rdi     # 0xdabb4
movb $0x0, %al
callq 0x1a150
jmp 0x44233
jmp 0x43f86
movl -0xc(%rbp), %eax
movl %eax, -0x20(%rbp)
addl $0xfffffe6c, %eax       # imm = 0xFFFFFE6C
subl $0x2, %eax
jb 0x43fa7
jmp 0x43f98
movl -0x20(%rbp), %eax
addl $0xfffffe4f, %eax       # imm = 0xFFFFFE4F
subl $0x3, %eax
ja 0x43ffe
jmp 0x43fa7
leaq 0xea946(%rip), %rax     # 0x12e8f4
movswq (%rax), %rcx
leaq 0x432b27(%rip), %rax    # 0x476ae0
imulq $0x2c, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, -0x14(%rbp)
leaq 0xea928(%rip), %rax     # 0x12e8f4
movswq (%rax), %rcx
leaq 0x432b09(%rip), %rax    # 0x476ae0
imulq $0x2c, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl %eax, -0x18(%rbp)
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
movl $0x6d, %edi
xorl %ecx, %ecx
movl $0x2, %r8d
callq 0x26af0
jmp 0x44000
jmp 0x44000
cmpl $0x194, -0xc(%rbp)      # imm = 0x194
jne 0x44028
leaq 0xea8e4(%rip), %rax     # 0x12e8f4
movswq (%rax), %rcx
leaq 0x432ac5(%rip), %rax    # 0x476ae0
imulq $0x2c, %rcx, %rcx
addq %rcx, %rax
movw $0x195, 0xe(%rax)       # imm = 0x195
cmpl $0x195, -0xc(%rbp)      # imm = 0x195
jne 0x44050
leaq 0xea8bc(%rip), %rax     # 0x12e8f4
movswq (%rax), %rcx
leaq 0x432a9d(%rip), %rax    # 0x476ae0
imulq $0x2c, %rcx, %rcx
addq %rcx, %rax
movw $0x194, 0xe(%rax)       # imm = 0x194
cmpl $0x1b2, -0xc(%rbp)      # imm = 0x1B2
jne 0x44078
leaq 0xea894(%rip), %rax     # 0x12e8f4
movswq (%rax), %rcx
leaq 0x432a75(%rip), %rax    # 0x476ae0
imulq $0x2c, %rcx, %rcx
addq %rcx, %rax
movw $0x1b1, 0xe(%rax)       # imm = 0x1B1
cmpl $0x1b1, -0xc(%rbp)      # imm = 0x1B1
jne 0x440a0
leaq 0xea86c(%rip), %rax     # 0x12e8f4
movswq (%rax), %rcx
leaq 0x432a4d(%rip), %rax    # 0x476ae0
imulq $0x2c, %rcx, %rcx
addq %rcx, %rax
movw $0x1b2, 0xe(%rax)       # imm = 0x1B2
cmpl $0x1b4, -0xc(%rbp)      # imm = 0x1B4
jne 0x440c8
leaq 0xea844(%rip), %rax     # 0x12e8f4
movswq (%rax), %rcx
leaq 0x432a25(%rip), %rax    # 0x476ae0
imulq $0x2c, %rcx, %rcx
addq %rcx, %rax
movw $0x1b3, 0xe(%rax)       # imm = 0x1B3
cmpl $0x1b3, -0xc(%rbp)      # imm = 0x1B3
jne 0x440f0
leaq 0xea81c(%rip), %rax     # 0x12e8f4
movswq (%rax), %rcx
leaq 0x4329fd(%rip), %rax    # 0x476ae0
imulq $0x2c, %rcx, %rcx
addq %rcx, %rax
movw $0x1b4, 0xe(%rax)       # imm = 0x1B4
cmpl $0xe7c, -0xc(%rbp)      # imm = 0xE7C
jne 0x44118
leaq 0xea7f4(%rip), %rax     # 0x12e8f4
movswq (%rax), %rcx
leaq 0x4329d5(%rip), %rax    # 0x476ae0
imulq $0x2c, %rcx, %rcx
addq %rcx, %rax
movw $0xe7d, 0xe(%rax)       # imm = 0xE7D
cmpl $0xe7d, -0xc(%rbp)      # imm = 0xE7D
jne 0x44140
leaq 0xea7cc(%rip), %rax     # 0x12e8f4
movswq (%rax), %rcx
leaq 0x4329ad(%rip), %rax    # 0x476ae0
imulq $0x2c, %rcx, %rcx
addq %rcx, %rax
movw $0xe7c, 0xe(%rax)       # imm = 0xE7C
movl $0x0, -0x8(%rbp)
movl -0x8(%rbp), %eax
leaq 0x585c3f(%rip), %rcx    # 0x5c9d90
movswl (%rcx), %ecx
cmpl %ecx, %eax
jge 0x441c4
movslq -0x8(%rbp), %rcx
leaq 0x3f972d(%rip), %rax    # 0x43d890
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movswl 0x24(%rax), %eax
leaq 0xea77f(%rip), %rcx     # 0x12e8f4
movswq (%rcx), %rdx
leaq 0x432960(%rip), %rcx    # 0x476ae0
imulq $0x2c, %rdx, %rdx
addq %rdx, %rcx
movswl 0x28(%rcx), %ecx
cmpl %ecx, %eax
jne 0x441b7
movslq -0x8(%rbp), %rcx
leaq 0x3f96f6(%rip), %rax    # 0x43d890
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movswl 0x22(%rax), %eax
cmpl $0x1, %eax
je 0x441b5
movl -0x8(%rbp), %eax
movswl %ax, %edi
callq 0x39e20
jmp 0x441b7
jmp 0x441b9
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x44147
leaq 0x574185(%rip), %rax    # 0x5b8350
movswl (%rax), %eax
movl %eax, -0x8(%rbp)
cmpl $-0x1, -0x8(%rbp)
je 0x44233
movslq -0x8(%rbp), %rcx
leaq 0x57c97e(%rip), %rax    # 0x5c0b60
movswl (%rax,%rcx,2), %eax
movl %eax, -0x10(%rbp)
movslq -0x8(%rbp), %rcx
leaq 0x4328ec(%rip), %rax    # 0x476ae0
imulq $0x2c, %rcx, %rcx
addq %rcx, %rax
movswl 0x28(%rax), %eax
leaq 0xea6ee(%rip), %rcx     # 0x12e8f4
movswq (%rcx), %rdx
leaq 0x4328cf(%rip), %rcx    # 0x476ae0
imulq $0x2c, %rdx, %rdx
addq %rdx, %rcx
movswl 0x28(%rcx), %ecx
cmpl %ecx, %eax
jne 0x4422b
movl -0x8(%rbp), %eax
movswl %ax, %edi
callq 0x2a350
movl -0x10(%rbp), %eax
movl %eax, -0x8(%rbp)
jmp 0x441d1
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)