// File: /workspace/github_c_makefile_star2_O0/jonof[P]jftekwar/src/tektag.c
// Function: tekoperatesector
void
tekoperatesector(short dasector)
{
     short          s;
     int            datag,i;

     s=dasector;
     datag=sectptr[s]->lotag;

     switch (datag) {
     case BOXELEVTAG:
     case PLATFORMELEVTAG:
     case BOXDELAYTAG:
     case PLATFORMDELAYTAG:
     case DOORUPTAG:          // a door that opens up
     case DOORDOWNTAG:
     case DOORSPLITHOR:
     case DOORSPLITVER:
     case PLATFORMDROPTAG:
          i=doorxref[s];
          if (i == -1) {
               crashgame("operatesector: invalid door reference for sector %d",s);
          }
          switch (doorptr[i]->state) {
          case D_NOTHING:
          case D_CLOSING:
          case D_CLOSEDOOR:
          case D_SHUTSOUND:
               doorptr[i]->state=D_OPENDOOR;
               break;
          default:
               if (datag != PLATFORMDROPTAG) {
                    doorptr[i]->state=D_CLOSEDOOR;
               }
               break;
          }
          break;
     case DOORFLOORTAG:
          floordoorptr[fdxref[s]]->state=DOOROPENING;
          playsound(S_FLOOROPEN,0,0,0,ST_IMMEDIATE);
          break;
     }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movw %di, %ax
movw %ax, -0x2(%rbp)
movw -0x2(%rbp), %ax
movw %ax, -0x4(%rbp)
movswq -0x4(%rbp), %rcx
leaq 0x2078ed(%rip), %rax    # 0x2421e0
movq (%rax,%rcx,8), %rax
movswl 0x22(%rax), %eax
movl %eax, -0x8(%rbp)
movl -0x8(%rbp), %eax
movl %eax, -0x10(%rbp)
addl $-0x6, %eax
subl $0x4, %eax
jb 0x3a949
jmp 0x3a90e
movl -0x10(%rbp), %eax
subl $0x3e8, %eax            # imm = 0x3E8
je 0x3a949
jmp 0x3a91a
movl -0x10(%rbp), %eax
addl $0xfffffc15, %eax       # imm = 0xFFFFFC15
subl $0x3, %eax
jb 0x3a949
jmp 0x3a929
movl -0x10(%rbp), %eax
subl $0x3ee, %eax            # imm = 0x3EE
je 0x3a9e7
jmp 0x3a939
movl -0x10(%rbp), %eax
subl $0x3ef, %eax            # imm = 0x3EF
jne 0x3aa1e
jmp 0x3a949
movswq -0x4(%rbp), %rcx
leaq 0x338a7b(%rip), %rax    # 0x3733d0
movl (%rax,%rcx,4), %eax
movl %eax, -0xc(%rbp)
cmpl $-0x1, -0xc(%rbp)
jne 0x3a973
movswl -0x4(%rbp), %esi
leaq 0xa01a4(%rip), %rdi     # 0xdab10
movb $0x0, %al
callq 0x44240
movslq -0xc(%rbp), %rcx
leaq 0x323952(%rip), %rax    # 0x35e2d0
movq (%rax,%rcx,8), %rax
movl 0x4(%rax), %eax
movl %eax, -0x14(%rbp)
testl %eax, %eax
je 0x3a9ac
jmp 0x3a98e
movl -0x14(%rbp), %eax
subl $0x2, %eax
je 0x3a9ac
jmp 0x3a998
movl -0x14(%rbp), %eax
subl $0x4, %eax
je 0x3a9ac
jmp 0x3a9a2
movl -0x14(%rbp), %eax
subl $0x6, %eax
jne 0x3a9c4
jmp 0x3a9ac
movslq -0xc(%rbp), %rcx
leaq 0x323919(%rip), %rax    # 0x35e2d0
movq (%rax,%rcx,8), %rax
movl $0x1, 0x4(%rax)
jmp 0x3a9e5
cmpl $0x3ef, -0x8(%rbp)      # imm = 0x3EF
je 0x3a9e3
movslq -0xc(%rbp), %rcx
leaq 0x3238f8(%rip), %rax    # 0x35e2d0
movq (%rax,%rcx,8), %rax
movl $0x2, 0x4(%rax)
jmp 0x3a9e5
jmp 0x3aa1e
movswq -0x4(%rbp), %rcx
leaq 0x323f2d(%rip), %rax    # 0x35e920
movslq (%rax,%rcx,4), %rcx
leaq 0x3281e2(%rip), %rax    # 0x362be0
movq (%rax,%rcx,8), %rax
movl $0x1, (%rax)
movl $0x3f, %edi
xorl %ecx, %ecx
movl $0x1, %r8d
movl %ecx, %esi
movl %ecx, %edx
callq 0x26af0
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)