// File: /workspace/github_c_makefile_star2_O1/jonof[P]jftekwar/src/tektag.c
// Function: teknewsector
void
teknewsector(short p)
{
     int           i,n,nexti,s;
     int           sn;
     struct    sectoreffect   *septr;

     s=cursectnum[p];
     septr=septrlist[s];

     #define NEWMAPLOTAG 25
     if( (sector[s].lotag == NEWMAPLOTAG) && (option[4] == 0) ) {
          newmap(sector[s].hitag);
          return;
     }

     if( sectptr[cursectnum[p]]->lotag == 4 ) {
          playsound(S_SPLASH,posx[p],posy[p],0,ST_UPDATE);
     }

     if( septr != NULL ) {
          if( septr->warpto >= 0 ) {
               sn=playersprite[p];
               tekwarp(&sprite[sn].x,&sprite[sn].y,&sprite[sn].z,( short *)&(septr->warpto));
               copybuf(&sprite[sn].x,&osprite[sn].x,3);
               changespritesect(sn,septr->warpto);
               posx[p] = sprite[playersprite[p]].x;
               posy[p] = sprite[playersprite[p]].y;
               posz[p] = sprite[playersprite[p]].z;
               ang[p] = sprite[playersprite[p]].ang;
               cursectnum[p] = sprite[playersprite[p]].sectnum;
               sprite[playersprite[p]].z += (KENSPLAYERHEIGHT<<8);
          }
     }

     for( n=connecthead; n >= 0; n=connectpoint2[n] ) {
          if( (sectptr[cursectnum[n]]->lotag == 1) || (sectptr[cursectnum[n]]->lotag == 2) ) {
               for( i=0; i < numsectors; i++ ) {
                    if( sectptr[i]->hitag == sectptr[cursectnum[n]]->hitag ) {
                         if( (sectptr[i]->lotag != 1) && (sectptr[i]->lotag != 2) ) {
                              operatesector(i);
                          }
                   }
               }
               i=headspritestat[0];
               while( i != -1 ) {
                    nexti=nextspritestat[i];
                    if( sprptr[i]->hitag == sectptr[cursectnum[n]]->hitag ) {
                         operatesprite(i);
                    }
               i=nexti;
               }
          }
     }

     checkmapsndfx(p);
     sectortriggersprites(p);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movslq %edi, %rbx
leaq 0xb7eb3(%rip), %r13     # 0xe2720
movswq (%r13,%rbx,2), %rax
leaq 0x2d2c66(%rip), %rcx    # 0x2fd4e0
movq (%rcx,%rax,8), %r14
leaq (%rax,%rax,4), %rcx
leaq 0x3c7037(%rip), %rdx    # 0x3f18c0
cmpw $0x19, 0x22(%rdx,%rcx,8)
jne 0x2a8b9
leaq 0xa40e0(%rip), %rsi     # 0xce978
cmpb $0x0, 0x4(%rsi)
jne 0x2a8b9
leaq (%rdx,%rcx,8), %rax
movswl 0x24(%rax), %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x170d9
movl %edi, 0x4(%rsp)
leaq 0x1cb94c(%rip), %rbp    # 0x1f6210
movq (%rbp,%rax,8), %rax
cmpw $0x4, 0x22(%rax)
jne 0x2a8f6
leaq 0xb6bf9(%rip), %rax     # 0xe14d0
movl (%rax,%rbx,4), %esi
leaq 0xb6c2f(%rip), %rax     # 0xe1510
movl (%rax,%rbx,4), %edx
movl $0xb, %edi
xorl %ecx, %ecx
movl $0x2, %r8d
callq 0x1c1f1
testq %r14, %r14
je 0x2a9d3
cmpl $0x0, 0x20(%r14)
js 0x2a9d3
addq $0x20, %r14
leaq 0xb7e3b(%rip), %rax     # 0xe2750
movswl (%rax,%rbx,2), %eax
movslq %eax, %r15
imulq $0x2c, %r15, %rax
leaq 0x4001e9(%rip), %rcx    # 0x42ab10
leaq (%rcx,%rax), %r12
leaq (%rcx,%rax), %rsi
addq $0x4, %rsi
leaq (%rcx,%rax), %rdx
addq $0x8, %rdx
movq %r12, %rdi
movq %r14, %rcx
callq 0x2a7ba
leaq (%r15,%r15,2), %rsi
shlq $0x2, %rsi
addq 0xa3663(%rip), %rsi     # 0xcdfb8
movq %r12, %rdi
movl $0x3, %edx
callq 0x5da55
movswl (%r14), %esi
movl %r15d, %edi
callq 0x46bb5
leaq 0xb7ddb(%rip), %rax     # 0xe2750
movswq (%rax,%rbx,2), %rax
imulq $0x2c, %rax, %rax
leaq 0x40018b(%rip), %rdi    # 0x42ab10
movl (%rdi,%rax), %ecx
leaq 0xb6b41(%rip), %rdx     # 0xe14d0
movl %ecx, (%rdx,%rbx,4)
movl 0x4(%rdi,%rax), %ecx
leaq 0xb6b73(%rip), %rdx     # 0xe1510
movl %ecx, (%rdx,%rbx,4)
movl 0x8(%rdi,%rax), %ecx
leaq 0xb6ba5(%rip), %rdx     # 0xe1550
movl %ecx, (%rdx,%rbx,4)
movzwl 0x1c(%rdi,%rax), %edx
leaq 0xb6af6(%rip), %rsi     # 0xe14b0
movw %dx, (%rsi,%rbx,2)
movzwl 0x18(%rdi,%rax), %edx
movw %dx, (%r13,%rbx,2)
addl $0x2200, %ecx           # imm = 0x2200
movl %ecx, 0x8(%rdi,%rax)
leaq 0x778136(%rip), %rax    # 0x7a2b10
movl (%rax), %eax
testl %eax, %eax
js 0x2aaae
leaq 0x5533d5(%rip), %r14    # 0x57ddc0
leaq 0x10381e(%rip), %r12    # 0x12e210
movl %eax, %r15d
movswq (%r13,%r15,2), %rax
movq (%rbp,%rax,8), %rax
movzwl 0x22(%rax), %eax
decl %eax
cmpw $0x1, %ax
ja 0x2aa9b
cmpw $0x0, (%r14)
jle 0x2aa53
xorl %ebx, %ebx
movq (%rbp,%rbx,8), %rax
movzwl 0x24(%rax), %ecx
movswq (%r13,%r15,2), %rdx
movq (%rbp,%rdx,8), %rdx
cmpw 0x24(%rdx), %cx
jne 0x2aa47
movzwl 0x22(%rax), %eax
decl %eax
cmpw $0x2, %ax
jb 0x2aa47
movswl %bx, %edi
callq 0x276ec
incq %rbx
movswq (%r14), %rax
cmpq %rax, %rbx
jl 0x2aa19
leaq 0x541926(%rip), %rax    # 0x56c380
movzwl (%rax), %eax
cmpw $-0x1, %ax
je 0x2aa9b
movswq %ax, %rcx
leaq 0x54a122(%rip), %rdx    # 0x574b90
movzwl (%rdx,%rcx,2), %ebx
movq (%r12,%rcx,8), %rcx
movzwl 0x28(%rcx), %ecx
movswq (%r13,%r15,2), %rdx
movq (%rbp,%rdx,8), %rdx
cmpw 0x24(%rdx), %cx
jne 0x2aa93
movswl %ax, %edi
callq 0x1e3e2
movl %ebx, %eax
cmpw $-0x1, %bx
jne 0x2aa63
leaq 0x77807e(%rip), %rax    # 0x7a2b20
movl (%rax,%r15,4), %eax
testl %eax, %eax
jns 0x2a9f2
movswl 0x4(%rsp), %ebx
movl %ebx, %edi
callq 0x2aacf
movl %ebx, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x20342