// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/src/tektag.c
// Function: movevehicles
void
movevehicles(int v)
{
     short     a,ato,curang,i,n,p,rotang,s,sto,stoptrack,track;
     int      distx,disty,px,py,x,y;
     int      xvect,xvect2,yvect,yvect2;
     int      lox,loy,hix,hiy;
     short     onveh[MAXPLAYERS];
     struct    sectorvehicle  *vptr;

     vptr=sectvehptr[v];

     if( vptr->soundindex == -1 ) {

          for( i=0; i<32; i++) {        //find mapno using names array
               if( !(Bstrcasecmp(boardfilename,mapnames[i]) ) )
                    break;
          }
          switch( v ) {
          case 0:
               switch( i ) {
                    case 4:   //level1.map
                         vptr->soundindex=playsound(S_TRAMBUSLOOP,vptr->pivotx,vptr->pivoty,-1,ST_VEHUPDATE);
                         break;
                    case 8:   //city1.map
                         vptr->soundindex=playsound(S_TRUCKLOOP,vptr->pivotx,vptr->pivoty,-1,ST_VEHUPDATE);
                         break;
                    case 11:  //beach1.map
                         vptr->soundindex=playsound(S_FORKLIFTLOOP,vptr->pivotx,vptr->pivoty,-1,ST_VEHUPDATE);
                         break;
                    case 17:  //mid3.map
                         vptr->soundindex=playsound(S_TRAMBUSLOOP,vptr->pivotx,vptr->pivoty,-1,ST_VEHUPDATE);
                         break;
                    case 19:  //sewer2.map
                         vptr->soundindex=playsound(S_FORKLIFTLOOP,vptr->pivotx,vptr->pivoty,-1,ST_VEHUPDATE);
                         break;
                    case 20:   //inds1.map
                         vptr->soundindex=playsound(S_FORKLIFTLOOP,vptr->pivotx,vptr->pivoty,-1,ST_VEHUPDATE);
                         break;
                    case 25:  //ware1.map
                         vptr->soundindex=playsound(S_FORKLIFTLOOP,vptr->pivotx,vptr->pivoty,-1,ST_VEHUPDATE);
                         break;
                    case 26:   //ware2.map
                         vptr->soundindex=playsound(S_TRUCKLOOP,vptr->pivotx,vptr->pivoty,-1,ST_VEHUPDATE);
                         break;
                    default:
                         break;
               }
               break;
          case 1:
               switch( i ) {
                    case 4:   //level1.map
                         vptr->soundindex=playsound(S_TRAMBUSLOOP,vptr->pivotx,vptr->pivoty,-1,ST_VEHUPDATE);
                         break;
                    case 11:   //beach1.map
                         vptr->soundindex=playsound(S_BOATLOOP,vptr->pivotx,vptr->pivoty,-1,ST_VEHUPDATE);
                         break;
                    case 26:   //ware2.map
                         vptr->soundindex=playsound(S_CARTLOOP,vptr->pivotx,vptr->pivoty,-1,ST_VEHUPDATE);
                         break;
                    default:
                         break;
               }
               break;
          default:
               break;
          }
     }

     if( vptr->waittics > 0 ) {
          vptr->waittics-=TICSPERFRAME;
          if( vptr->soundindex != -1 ) {
               updatevehiclesnds(vptr->soundindex, vptr->pivotx, vptr->pivoty);
          }
          return;
     }

     px=vptr->pivotx;
     py=vptr->pivoty;

     track=vptr->track;
     distx=vptr->distx;
     disty=vptr->disty;
     stoptrack=vptr->stoptrack;
     if( vptr->stop[track] && (x=distx+disty) > 0L && x < 8192L ) {
          vptr->accelto=2;
          vptr->speedto=32;
     }
     else if( vptr->accelto != 8 ) {
          vptr->accelto=8;
          vptr->speedto=vptr->movespeed;
     }
     if( distx == 0L && disty == 0L ) {
          if( vptr->stop[stoptrack] ) {
               for( i=0 ; i < vptr->numsectors ; i++ ) {
                    s=vptr->sector[i];
                    if( sectptr[s]->lotag != 0 ) {
                         operatesector(s);
                    }
               }
               vptr->waittics=vptr->waitdelay;
               vptr->acceleration=0;
               vptr->speed=0;

          }
          distx=vptr->trackx[track]-px;
          disty=vptr->tracky[track]-py;
          vptr->angleto=getangle(distx,disty);
          vptr->accelto=8;
          vptr->distx=abs(distx);
          vptr->disty=abs(disty);
          distx=vptr->distx;
          disty=vptr->disty;
     }
     a=vptr->acceleration;
     ato=vptr->accelto;
     if( a < ato ) {
          a+=TICSPERFRAME;
          if( a > ato ) {
               a=ato;
          }
          vptr->acceleration=a;
     }
     else if( a > ato ) {
          a-=TICSPERFRAME;
          if( a < ato ) {
               a=ato;
          }
          vptr->acceleration=a;
     }
     s=vptr->speed;
     sto=vptr->speedto;
     if( s > sto ) {
          s-=a;
          if( s <= sto ) {
               s=sto;
          }
          vptr->speed=s;
     }
     else if( s < sto ) {
          s+=a;
          if( s > sto ) {
               s=sto;
          }
          vptr->speed=s;
     }
     rotang=curang=vptr->angle;
     if( curang != vptr->angleto ) {
          vptr->angle=vptr->angleto;
          curang=vptr->angle;
     }
     xvect=(s*(int)TICSPERFRAME*(int)sintable[((curang+2560)&2047)])>>3;
     xvect2=xvect>>13;
     yvect=(s*(int)TICSPERFRAME*(int)sintable[((curang+2048)&2047)])>>3;
     yvect2=yvect>>13;
     distx-=labs(xvect2);
     if( distx < 0L ) {
          if( xvect2 < 0L ) {
               xvect2-=distx;
          }
          else {
               xvect2+=distx;
          }
          distx=0L;
          vptr->angleto=getangle(vptr->trackx[track]-px,vptr->tracky[track]-py);
     }
     disty-=labs(yvect2);
     if( disty < 0L ) {
          if( yvect2 < 0L ) {
               yvect2-=disty;
          }
          else {
               yvect2+=disty;
          }
          disty=0L;
          vptr->angleto=getangle(vptr->trackx[track]-px,vptr->tracky[track]-py);
     }
     if( distx == 0L && disty == 0L ) {
          vptr->stoptrack=track;
          track=(track+1)%vptr->tracknum;
          vptr->track=track;
          switch( v ) {
          //jsa vehicles
          case 0:
               if( !(Bstrcasecmp(boardfilename,"CITY1.MAP")) || !(Bstrcasecmp(boardfilename,"WARE2.MAP")))
                    playsound(S_TRUCKSTOP,vptr->pivotx,vptr->pivoty,0,ST_AMBUPDATE);
               break;
          default:
               break;
          }
     }
     vptr->distx=distx;
     vptr->disty=disty;
     px+=xvect2;
     py+=yvect2;
     n=vptr->numpoints;
     for( i=0 ; i < n ; i++ ) {
          p=vptr->point[i];
          x=vptr->pointx[i];
          y=vptr->pointy[i];
          rotatepoint(px,py,px-x,py-y,curang,&x,&y);
          dragpoint(p,x,y);
     }
     vptr->pivotx=px;
     vptr->pivoty=py;
     rotang=((curang-rotang)+2048)&2047;
     n=vptr->numsectors;
     lox=loy=0x7FFFFFFF;
     hix=hiy=-(0x7FFFFFFF);
     for( i=0 ; i < 4 ; i++ ) {
          a=vptr->killw[i];
          if( wallptr[a]->x < lox ) {
               lox=wallptr[a]->x;
          }
          else if( wallptr[a]->x > hix ) {
               hix=wallptr[a]->x;
          }
          if( wallptr[a]->y < loy ) {
               loy=wallptr[a]->y;
          }
          else if (wallptr[a]->y > hiy) {
               hiy=wallptr[a]->y;
          }
     }
     memset(onveh,0,sizeof(short)*MAXPLAYERS);
     for( i=0 ; i < n ; i++ ) {
          p=headspritesect[vptr->sector[i]];
          while (p >= 0) {
               s=nextspritesect[p];
               x=sprptr[p]->x;
               y=sprptr[p]->y;
               x+=xvect2;
               y+=yvect2;
               rotatepoint(px,py,x,y,rotang,&sprptr[p]->x,&sprptr[p]->y);
               sprptr[p]->ang+=rotang;
               p=s;
          }
          for( p=connecthead ; p >= 0 ; p=connectpoint2[p] ) {
               x=posx[p];
               y=posy[p];
               if( cursectnum[p] == vptr->sector[i] ) {
                    x+=xvect2;
                    y+=yvect2;
                    rotatepoint(px,py,x,y,rotang,&posx[p],&posy[p]);
                    ang[p]+=rotang;
                    onveh[p]=1;
               }
          }
     }
     for( p=connecthead ; p >= 0 ; p=connectpoint2[p] ) {
          if( onveh[p] ) {
               continue;
          }
          x=posx[p];
          y=posy[p];
          if( x > lox && x < hix && y > loy && y < hiy ) {
               if( (health[p] > 0) &&  (posz[p] > VEHICLEHEIGHT) ) {
                    changehealth(p,-9999);
                    changescore(p,-100);
                    if( goreflag ) {
                         tekexplodebody(playersprite[p]);
                    }
               }
          }
     }
     if( vptr->soundindex != -1 ) {
          updatevehiclesnds(vptr->soundindex, vptr->pivotx, vptr->pivoty);
     }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %edi, %ebp
movslq %edi, %rax
leaq 0x2eeac7(%rip), %rcx    # 0x3183c0
movq (%rcx,%rax,8), %r15
movl 0xa10(%r15), %edi
cmpl $-0x1, %edi
movq %r15, 0x18(%rsp)
jne 0x299cc
xorl %r14d, %r14d
leaq 0x9ecf4(%rip), %r15     # 0xc8610
leaq 0xb1eed(%rip), %rbx     # 0xdb810
cmpq $0x20, %r14
je 0x2993e
movq (%r15,%r14,8), %rsi
movq %rbx, %rdi
callq 0x8bc0
testl %eax, %eax
je 0x29943
incq %r14
jmp 0x29923
movw $0x20, %r14w
pushq $-0x1
popq %rdi
movzwl %r14w, %ecx
pushq $0x51
popq %rax
cmpl $0x1, %ebp
movq 0x18(%rsp), %r15
je 0x2997c
testl %ebp, %ebp
jne 0x299cc
leal -0x11(%rcx), %r8d
pushq $0x4e
popq %rdx
pushq $0x54
popq %rsi
cmpl $0x9, %r8d
ja 0x29991
leaq 0x590e6(%rip), %rcx     # 0x82a58
movslq (%rcx,%r8,4), %r8
addq %rcx, %r8
jmpq *%r8
cmpw $0x4, %r14w
je 0x299ab
cmpl $0x1a, %ecx
je 0x299a8
cmpl $0xb, %ecx
jne 0x299cc
pushq $0x52
jmp 0x299aa
cmpl $0x4, %ecx
je 0x299ab
cmpl $0xb, %ecx
je 0x299a4
cmpl $0x8, %ecx
jne 0x299cc
movl %edx, %eax
jmp 0x299ab
movl %esi, %eax
jmp 0x299ab
pushq $0x53
popq %rax
movl 0x10(%r15), %esi
movl 0x14(%r15), %edx
pushq $-0x1
popq %rcx
movl %eax, %edi
movl $0x80, %r8d
callq 0x1ab2a
movl %eax, %edi
movl %eax, 0xa10(%r15)
movl 0x9fc(%r15), %eax
testl %eax, %eax
jle 0x29a05
addl $-0x3, %eax
movl %eax, 0x9fc(%r15)
cmpl $-0x1, %edi
je 0x2a094
movl 0x10(%r15), %esi
movl 0x14(%r15), %edx
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1add3
movzwl 0x7ec(%r15), %r13d
movl 0x9b4(%r15), %r8d
movl 0x9b8(%r15), %r14d
movswq %r13w, %rax
movq %rax, 0x20(%rsp)
cmpb $0x0, 0x980(%r15,%rax)
je 0x29a55
leal (%r14,%r8), %eax
movl %eax, 0x10(%rsp)
leal (%r14,%r8), %eax
decl %eax
cmpl $0x1ffe, %eax           # imm = 0x1FFE
ja 0x29a55
movw $0x2, 0x2(%r15)
movw $0x2, %ax
movw $0x20, %cx
jmp 0x29a71
movw $0x8, %ax
cmpw $0x8, 0x2(%r15)
je 0x29a76
movw $0x8, 0x2(%r15)
movzwl 0x8(%r15), %ecx
movw $0x8, %ax
movw %cx, 0x6(%r15)
movl 0x10(%r15), %ecx
movl %ecx, 0xc(%rsp)
movl 0x14(%r15), %ecx
movl %ecx, 0x8(%rsp)
movl %r8d, %ecx
orl %r14d, %ecx
jne 0x29b64
movswq 0xa04(%r15), %rax
cmpb $0x0, 0x980(%r15,%rax)
je 0x29af5
xorl %ebx, %ebx
leaq 0x1c5782(%rip), %r14    # 0x1ef230
movswq 0x9f8(%r15), %rax
cmpq %rax, %rbx
jge 0x29adc
movswq 0x9bc(%r15,%rbx,2), %rax
movq (%r14,%rax,8), %rcx
cmpw $0x0, 0x22(%rcx)
je 0x29ad7
movswl %ax, %edi
callq 0x253e8
incq %rbx
jmp 0x29aae
movl 0xa00(%r15), %eax
movl %eax, 0x9fc(%r15)
andw $0x0, (%r15)
andw $0x0, 0x4(%r15)
movq 0x18(%rsp), %rax
movq 0x20(%rsp), %rcx
movl 0x7f0(%rax,%rcx,4), %r15d
movq 0x18(%rsp), %rax
movl 0x8b8(%rax,%rcx,4), %r12d
subl 0xc(%rsp), %r15d
subl 0x8(%rsp), %r12d
movl %r15d, %edi
movl %r12d, %esi
callq 0x43e64
movq 0x18(%rsp), %rcx
movw %ax, 0xc(%rcx)
movl %r15d, %r8d
negl %r8d
cmovsl %r15d, %r8d
movq 0x18(%rsp), %r15
movw $0x8, 0x2(%r15)
movl %r8d, 0x9b4(%r15)
movl %r12d, %r14d
negl %r14d
cmovsl %r12d, %r14d
movl %r14d, 0x9b8(%r15)
movw $0x8, %ax
movzwl (%r15), %ecx
cmpw %ax, %cx
jge 0x29b78
addl $0x3, %ecx
cmpw %ax, %cx
cmovgel %eax, %ecx
jmp 0x29b83
jbe 0x29b87
addl $-0x3, %ecx
cmpw %ax, %cx
cmovbel %eax, %ecx
movw %cx, (%r15)
movzwl 0x4(%r15), %eax
movzwl 0x6(%r15), %edx
cmpw %dx, %ax
jle 0x29ba0
subl %ecx, %eax
cmpw %dx, %ax
cmovlel %edx, %eax
jmp 0x29baa
jge 0x29baf
addl %ecx, %eax
cmpw %dx, %ax
cmovgel %edx, %eax
movw %ax, 0x4(%r15)
movzwl 0xa(%r15), %esi
movzwl 0xc(%r15), %ecx
movl %esi, %edx
movl %esi, 0x28(%rsp)
cmpw %cx, %si
je 0x29bcb
movw %cx, 0xa(%r15)
movl %ecx, %edx
cwtl
leal (%rax,%rax,2), %eax
movl %edx, 0x30(%rsp)
movzwl %dx, %ecx
leal 0x200(%rcx), %edx
movl $0x7ff, %esi            # imm = 0x7FF
andl %esi, %edx
leaq 0x54bfe6(%rip), %rdi    # 0x575bd0
movswl (%rdi,%rdx,2), %ebx
imull %eax, %ebx
sarl $0x10, %ebx
andl %esi, %ecx
movswl (%rdi,%rcx,2), %r12d
imull %eax, %r12d
sarl $0x10, %r12d
movl %ebx, %eax
negl %eax
cmovsl %ebx, %eax
subl %eax, %r8d
jns 0x29c46
movl %r8d, %eax
negl %eax
testl %ebx, %ebx
cmovnsl %r8d, %eax
addl %eax, %ebx
movq 0x20(%rsp), %rax
movl 0x7f0(%r15,%rax,4), %edi
movl 0x8b8(%r15,%rax,4), %esi
subl 0xc(%rsp), %edi
subl 0x8(%rsp), %esi
callq 0x43e64
movw %ax, 0xc(%r15)
xorl %r8d, %r8d
movl %r12d, %eax
negl %eax
cmovsl %r12d, %eax
subl %eax, %r14d
jns 0x29c93
movl %r14d, %eax
negl %eax
testl %r12d, %r12d
cmovnsl %r14d, %eax
addl %eax, %r12d
movq 0x20(%rsp), %rax
movl 0x7f0(%r15,%rax,4), %edi
movl 0x8b8(%r15,%rax,4), %esi
subl 0xc(%rsp), %edi
subl 0x8(%rsp), %esi
movq %r8, %r14
callq 0x43e64
movq %r14, %r8
movw %ax, 0xc(%r15)
xorl %r14d, %r14d
movl %r12d, 0x20(%rsp)
movl %r14d, %eax
orl %r8d, %eax
jne 0x29d12
movswl %r13w, %eax
movw %r13w, 0xa04(%r15)
incl %eax
movswl 0x7ee(%r15), %ecx
cltd
idivl %ecx
movw %dx, 0x7ec(%r15)
testl %ebp, %ebp
jne 0x29d12
leaq 0xb1b44(%rip), %rdi     # 0xdb810
leaq 0x58ebd(%rip), %rsi     # 0x82b90
movq %r8, %r12
callq 0x8bc0
testl %eax, %eax
je 0x29cf9
leaq 0xb1b2a(%rip), %rdi     # 0xdb810
leaq 0x58ead(%rip), %rsi     # 0x82b9a
callq 0x8bc0
movq %r12, %r8
testl %eax, %eax
jne 0x29d12
movl 0x10(%r15), %esi
movl 0x14(%r15), %edx
pushq $0x50
popq %rdi
pushq $0x60
popq %r8
xorl %ecx, %ecx
callq 0x1ab2a
movq %r12, %r8
movl %r8d, 0x9b4(%r15)
movl %r14d, 0x9b8(%r15)
movl %ebx, %r13d
addl %ebx, 0xc(%rsp)
movl 0x20(%rsp), %eax
addl %eax, 0x8(%rsp)
movl 0x18(%r15), %eax
xorl %ebx, %ebx
testw %ax, %ax
cmovlel %ebx, %eax
movzwl %ax, %ebp
movswl 0x30(%rsp), %r14d
cmpq %rbx, %rbp
je 0x29da4
movswl 0x1a(%r15,%rbx,2), %r12d
movl 0x1ac(%r15,%rbx,4), %eax
movl %eax, 0x10(%rsp)
movl 0x4cc(%r15,%rbx,4), %r8d
movl %r8d, 0x14(%rsp)
movl 0xc(%rsp), %edi
movl %edi, %edx
subl %eax, %edx
movl 0x8(%rsp), %esi
movl %esi, %ecx
subl %r8d, %ecx
leaq 0x14(%rsp), %rax
movq %rax, (%rsp)
movl %r14d, %r8d
leaq 0x10(%rsp), %r9
callq 0x4838e
movl 0x10(%rsp), %esi
movl 0x14(%rsp), %edx
movl %r12d, %edi
callq 0x45ffc
incq %rbx
jmp 0x29d44
movl 0xc(%rsp), %eax
movl %eax, 0x10(%r15)
movl 0x8(%rsp), %eax
movl %eax, 0x14(%r15)
movl 0x30(%rsp), %r9d
subl 0x28(%rsp), %r9d
movzwl 0x9f8(%r15), %eax
movl $0x80000001, %r10d      # imm = 0x80000001
movl $0x7fffffff, %r11d      # imm = 0x7FFFFFFF
xorl %ecx, %ecx
leaq 0x1cd455(%rip), %rdx    # 0x1f7230
movl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
movl $0x80000001, %ebp       # imm = 0x80000001
cmpq $0x4, %rcx
je 0x29e26
movswq 0xa06(%r15,%rcx,2), %rsi
movq (%rdx,%rsi,8), %rsi
movl (%rsi), %edi
movl 0x4(%rsi), %esi
cmpl %r10d, %edi
movl %r10d, %r8d
cmovgl %edi, %r8d
cmpl %r11d, %edi
cmovll %edi, %r11d
cmovgel %r8d, %r10d
cmpl %ebp, %esi
movl %ebp, %edi
cmovgl %esi, %edi
cmpl %ebx, %esi
cmovll %esi, %ebx
cmovgel %edi, %ebp
incq %rcx
jmp 0x29de5
movl %ebp, 0x38(%rsp)
movl %ebx, 0x3c(%rsp)
movl %r11d, 0x28(%rsp)
movl %r10d, 0x2c(%rsp)
andl $0x7ff, %r9d            # imm = 0x7FF
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
xorl %ebp, %ebp
testw %ax, %ax
movl $0x0, %ecx
cmovgl %eax, %ecx
movaps %xmm0, 0x40(%rsp)
movzwl %cx, %eax
movq %rax, 0x30(%rsp)
leaq 0xfd3c8(%rip), %rbx     # 0x127230
movzwl %r9w, %r14d
cmpq 0x30(%rsp), %rbp
je 0x29fa1
movswq 0x9bc(%r15,%rbp,2), %rax
leaq 0x529509(%rip), %rcx    # 0x553390
movzwl (%rcx,%rax,2), %r12d
testw %r12w, %r12w
js 0x29ee4
movzwl %r12w, %r15d
leaq 0x533503(%rip), %rax    # 0x55d3a0
movzwl (%rax,%r15,2), %r12d
movq (%rbx,%r15,8), %r9
leaq 0x4(%r9), %rax
movl (%r9), %edx
addl %r13d, %edx
movl 0x4(%r9), %ecx
addl 0x20(%rsp), %ecx
movl %edx, 0x10(%rsp)
movl %ecx, 0x14(%rsp)
movq %rax, (%rsp)
movl 0xc(%rsp), %edi
movl 0x8(%rsp), %esi
movl %r14d, %r8d
callq 0x4838e
movq (%rbx,%r15,8), %rax
movq 0x18(%rsp), %r15
addw %r14w, 0x1c(%rax)
jmp 0x29e8c
leaq 0x771c45(%rip), %r12    # 0x79bb30
movl (%r12), %r12d
testw %r12w, %r12w
js 0x29f99
andl $0x7fff, %r12d          # imm = 0x7FFF
leal (,%r12,4), %eax
leaq 0xb05c1(%rip), %rcx     # 0xda4d0
movl (%rcx,%rax), %edx
movl %edx, 0x10(%rsp)
leaq 0xb05f3(%rip), %rcx     # 0xda510
movl (%rcx,%rax), %ecx
movl %ecx, 0x14(%rsp)
movl %r12d, %esi
leaq 0xb17f2(%rip), %rdi     # 0xdb720
movzwl (%rdi,%rsi,2), %esi
cmpw 0x9bc(%r15,%rbp,2), %si
jne 0x29f89
leaq 0xb058c(%rip), %rsi     # 0xda4d0
leaq (%rsi,%rax), %r9
addq 0x9d099(%rip), %rax     # 0xc6fe8
addl %r13d, %edx
movl %edx, 0x10(%rsp)
addl 0x20(%rsp), %ecx
movl %ecx, 0x14(%rsp)
movq %rax, (%rsp)
movl 0xc(%rsp), %edi
movl 0x8(%rsp), %esi
movl %r14d, %r8d
callq 0x4838e
leal (%r12,%r12), %eax
leaq 0xb0533(%rip), %rcx     # 0xda4b0
addw %r14w, (%rcx,%rax)
movw $0x1, 0x40(%rsp,%rax)
shll $0x2, %r12d
addq 0x9d04c(%rip), %r12     # 0xc6fe0
jmp 0x29eeb
incq %rbp
jmp 0x29e6c
leaq 0x771b88(%rip), %r13    # 0x79bb30
leaq 0xb05e1(%rip), %rbx     # 0xda590
leaq 0xb059a(%rip), %r15     # 0xda550
pushq $-0x64
popq %r14
leaq 0xfb39f(%rip), %r12     # 0x125360
movl 0x2c(%rsp), %ebp
movl (%r13), %eax
testw %ax, %ax
js 0x2a079
movl %eax, %r13d
andl $0x7fff, %r13d          # imm = 0x7FFF
movl %r13d, %ecx
cmpw $0x0, 0x40(%rsp,%rcx,2)
je 0x29ff4
shll $0x2, %r13d
addq 0x9cfee(%rip), %r13     # 0xc6fe0
jmp 0x29fc5
leal (,%r13,4), %ecx
leaq 0xb04cd(%rip), %rdx     # 0xda4d0
movl (%rdx,%rcx), %edx
movl %edx, 0x10(%rsp)
leaq 0xb04ff(%rip), %rsi     # 0xda510
movl (%rsi,%rcx), %ecx
movl %ecx, 0x14(%rsp)
cmpl 0x28(%rsp), %edx
jle 0x29fe7
cmpl %ebp, %edx
jge 0x29fe7
cmpl 0x3c(%rsp), %ecx
jle 0x29fe7
cmpl 0x38(%rsp), %ecx
jge 0x29fe7
cmpl $0x0, (%rbx,%r13,4)
jle 0x29fe7
cmpl $0xffffcc01, (%r15,%r13,4) # imm = 0xFFFFCC01
jl 0x29fe7
movswl %ax, %ebp
movl %ebp, %edi
movl $0xffffd8f1, %esi       # imm = 0xFFFFD8F1
callq 0x99a8
movl %ebp, %edi
movl 0x2c(%rsp), %ebp
movl %r14d, %esi
callq 0x9adc
cmpl $0x0, (%r12)
je 0x29fe7
leaq 0xb16e6(%rip), %rax     # 0xdb750
movswl (%rax,%r13,2), %edi
callq 0xf8a2
jmp 0x29fe7
movq 0x18(%rsp), %rax
movl 0xa10(%rax), %edi
cmpl $-0x1, %edi
je 0x2a094
movl 0x10(%rax), %esi
movl 0x14(%rax), %edx
callq 0x1add3
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq