// File: /workspace/github_c_makefile_star2_O1/jonof[P]jftekwar/src/tektag.c
// Function: movefloordoor
void
movefloordoor(int d)
{
     int  j,s,tics;
     struct floordoor *dptr;

     tics=TICSPERFRAME<<2;
     dptr=floordoorptr[d];
     switch (dptr->state) {
     case DOOROPENING:
          if (dptr->dist1 > 0) {
               s=tics;
               dptr->dist1-=s;
               if (dptr->dist1 < 0) {
                    s+=dptr->dist1;
                    dptr->dist1=0;
               }
               switch (dptr->dir) {
               case 0:
                    j=dptr->wall1;
                    dragpoint(j,wallptr[j]->x,wallptr[j]->y-s);
                    j=wallptr[j]->point2;
                    dragpoint(j,wallptr[j]->x,wallptr[j]->y-s);
                    break;
               case 1:
                    j=dptr->wall1;
                    dragpoint(j,wallptr[j]->x+s,wallptr[j]->y);
                    j=wallptr[j]->point2;
                    dragpoint(j,wallptr[j]->x+s,wallptr[j]->y);
                    break;
               case 2:
                    j=dptr->wall1;
                    dragpoint(j,wallptr[j]->x,wallptr[j]->y+s);
                    j=wallptr[j]->point2;
                    dragpoint(j,wallptr[j]->x,wallptr[j]->y+s);
                    break;
               case 3:
                    j=dptr->wall1;
                    dragpoint(j,wallptr[j]->x-s,wallptr[j]->y);
                    j=wallptr[j]->point2;
                    dragpoint(j,wallptr[j]->x-s,wallptr[j]->y);
                    break;
               }
          }
          if (dptr->dist2 > 0) {
               s=tics;
               dptr->dist2-=s;
               if (dptr->dist2 < 0) {
                    s+=dptr->dist2;
                    dptr->dist2=0;
               }
               switch (dptr->dir) {
               case 0:
                    j=dptr->wall2;
                    dragpoint(j,wallptr[j]->x,wallptr[j]->y+s);
                    j=wallptr[j]->point2;
                    dragpoint(j,wallptr[j]->x,wallptr[j]->y+s);
                    break;
               case 1:
                    j=dptr->wall2;
                    dragpoint(j,wallptr[j]->x-s,wallptr[j]->y);
                    j=wallptr[j]->point2;
                    dragpoint(j,wallptr[j]->x-s,wallptr[j]->y);
                    break;
               case 2:
                    j=dptr->wall2;
                    dragpoint(j,wallptr[j]->x,wallptr[j]->y-s);
                    j=wallptr[j]->point2;
                    dragpoint(j,wallptr[j]->x,wallptr[j]->y-s);
                    break;
               case 3:
                    j=dptr->wall2;
                    dragpoint(j,wallptr[j]->x+s,wallptr[j]->y);
                    j=wallptr[j]->point2;
                    dragpoint(j,wallptr[j]->x+s,wallptr[j]->y);
                    break;
               }
          }
          if (dptr->dist1 <= 0 && dptr->dist2 <= 0) {
               dptr->state=DOOROPENED;
          }
          break;
     case DOORCLOSING:
     case DOOROPENED:
     case DOORCLOSED:
          break;
     }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movslq %edi, %rax
leaq 0x2eab92(%rip), %rcx    # 0x316c10
movq (%rcx,%rax,8), %r14
cmpl $0x1, (%r14)
jne 0x2c2e4
movl 0x10(%r14), %eax
testl %eax, %eax
jle 0x2c1ac
leal -0xc(%rax), %ecx
xorl %edx, %edx
cmpl $0xc, %eax
cmovgel %ecx, %edx
movl $0xc, %ebx
cmovll %eax, %ebx
movl %edx, 0x10(%r14)
movl 0x18(%r14), %eax
cmpq $0x3, %rax
ja 0x2c1ac
leaq 0x618dc(%rip), %rcx     # 0x8d9a0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movslq 0x8(%r14), %r15
leaq 0x1d2138(%rip), %r12    # 0x1fe210
movq (%r12,%r15,8), %rax
movl (%rax), %esi
movl 0x4(%rax), %edx
subl %ebx, %edx
movswl %r15w, %edi
callq 0x48e56
movq (%r12,%r15,8), %rax
movswl 0x8(%rax), %eax
movslq %eax, %rdi
movq (%r12,%rdi,8), %rax
movl (%rax), %esi
movl 0x4(%rax), %edx
subl %ebx, %edx
jmp 0x2c170
movslq 0x8(%r14), %r15
leaq 0x1d2101(%rip), %r12    # 0x1fe210
movq (%r12,%r15,8), %rax
movl (%rax), %esi
movl 0x4(%rax), %edx
addl %ebx, %edx
movswl %r15w, %edi
callq 0x48e56
movq (%r12,%r15,8), %rax
movswl 0x8(%rax), %eax
movslq %eax, %rdi
movq (%r12,%rdi,8), %rax
movl (%rax), %esi
addl 0x4(%rax), %ebx
movl %ebx, %edx
jmp 0x2c1a7
movslq 0x8(%r14), %r15
leaq 0x1d20ca(%rip), %r12    # 0x1fe210
movq (%r12,%r15,8), %rax
movl (%rax), %esi
movl 0x4(%rax), %edx
subl %ebx, %esi
movswl %r15w, %edi
callq 0x48e56
movq (%r12,%r15,8), %rax
movswl 0x8(%rax), %eax
movslq %eax, %rdi
movq (%r12,%rdi,8), %rax
movl (%rax), %esi
movl 0x4(%rax), %edx
subl %ebx, %esi
jmp 0x2c1a7
movslq 0x8(%r14), %r15
leaq 0x1d2093(%rip), %r12    # 0x1fe210
movq (%r12,%r15,8), %rax
movl (%rax), %esi
addl %ebx, %esi
movl 0x4(%rax), %edx
movswl %r15w, %edi
callq 0x48e56
movq (%r12,%r15,8), %rax
movswl 0x8(%rax), %eax
movslq %eax, %rdi
movq (%r12,%rdi,8), %rax
addl (%rax), %ebx
movl 0x4(%rax), %edx
movl %ebx, %esi
callq 0x48e56
movl 0x14(%r14), %eax
testl %eax, %eax
jle 0x2c2cf
leal -0xc(%rax), %ecx
xorl %edx, %edx
cmpl $0xc, %eax
cmovgel %ecx, %edx
movl $0xc, %ebx
cmovll %eax, %ebx
movl %edx, 0x14(%r14)
movl 0x18(%r14), %eax
cmpq $0x3, %rax
ja 0x2c2cf
leaq 0x617cc(%rip), %rcx     # 0x8d9b0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movslq 0xc(%r14), %r15
leaq 0x1d2018(%rip), %r12    # 0x1fe210
movq (%r12,%r15,8), %rax
movl (%rax), %esi
movl 0x4(%rax), %edx
addl %ebx, %edx
movswl %r15w, %edi
callq 0x48e56
movq (%r12,%r15,8), %rax
movswl 0x8(%rax), %eax
movslq %eax, %rdi
movq (%r12,%rdi,8), %rax
movl (%rax), %esi
addl 0x4(%rax), %ebx
movl %ebx, %edx
jmp 0x2c2ca
movslq 0xc(%r14), %r15
leaq 0x1d1fde(%rip), %r12    # 0x1fe210
movq (%r12,%r15,8), %rax
movl (%rax), %esi
movl 0x4(%rax), %edx
subl %ebx, %edx
movswl %r15w, %edi
callq 0x48e56
movq (%r12,%r15,8), %rax
movswl 0x8(%rax), %eax
movslq %eax, %rdi
movq (%r12,%rdi,8), %rax
movl (%rax), %esi
movl 0x4(%rax), %edx
subl %ebx, %edx
jmp 0x2c2ca
movslq 0xc(%r14), %r15
leaq 0x1d1fa7(%rip), %r12    # 0x1fe210
movq (%r12,%r15,8), %rax
movl (%rax), %esi
addl %ebx, %esi
movl 0x4(%rax), %edx
movswl %r15w, %edi
callq 0x48e56
movq (%r12,%r15,8), %rax
movswl 0x8(%rax), %eax
movslq %eax, %rdi
movq (%r12,%rdi,8), %rax
addl (%rax), %ebx
movl 0x4(%rax), %edx
movl %ebx, %esi
jmp 0x2c2ca
movslq 0xc(%r14), %r15
leaq 0x1d1f70(%rip), %r12    # 0x1fe210
movq (%r12,%r15,8), %rax
movl (%rax), %esi
movl 0x4(%rax), %edx
subl %ebx, %esi
movswl %r15w, %edi
callq 0x48e56
movq (%r12,%r15,8), %rax
movswl 0x8(%rax), %eax
movslq %eax, %rdi
movq (%r12,%rdi,8), %rax
movl (%rax), %esi
movl 0x4(%rax), %edx
subl %ebx, %esi
callq 0x48e56
cmpl $0x0, 0x10(%r14)
jg 0x2c2e4
cmpl $0x0, 0x14(%r14)
jg 0x2c2e4
movl $0x2, (%r14)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq