// File: /workspace/github_c_makefile_star2_O0/jonof[P]jftekwar/src/tekspr.c
// Function: flymovesprite
short
flymovesprite(short spritenum, int dx, int dy, int dz, int ceildist, int flordist, char cliptype)
{
     int           daz;
     short          retval, dasectnum, tempshort;
    unsigned int dcliptype;
     spritetype *spr;

     (void)dz;

    #ifdef PLRSPRDEBUG
     if( isaplayersprite(spritenum) ) {
          crashgame("messing w plrsprite at 20");
     }
    #endif

     switch (cliptype) {
          case NORMALCLIP: dcliptype = CLIPMASK0; break;
          case PROJECTILECLIP: dcliptype = CLIPMASK1; break;
          case CLIFFCLIP: dcliptype = CLIPMASK0; break;
     }

     spr = &sprite[spritenum];

     dasectnum = spr->sectnum;
     retval = clipmove(&spr->x,&spr->y,&spr->z,&dasectnum,dx,dy,
                                   ((int)spr->clipdist)<<2,ceildist,flordist,dcliptype);

     if ((dasectnum != spr->sectnum) && (dasectnum >= 0))
          changespritesect(spritenum,dasectnum);

     if( spr->statnum != PINBALL ) {
          tempshort = spr->cstat; spr->cstat &= ~1;
          getzrange(spr->x,spr->y,spr->z-1,spr->sectnum,
                          &globhiz,&globhihit,&globloz,&globlohit,
                          ((int)spr->clipdist)<<2,dcliptype);
          spr->cstat = tempshort;
          daz=(globloz+globhiz);
          spr->z=(daz>>1);
     }

     return(retval);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x58, %rsp
movw %di, %ax
movb 0x10(%rbp), %dil
movw %ax, -0xa(%rbp)
movl %esi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movl %r8d, -0x1c(%rbp)
movl %r9d, -0x20(%rbp)
movsbl 0x10(%rbp), %eax
movl %eax, -0x3c(%rbp)
testl %eax, %eax
je 0x28ab6
jmp 0x28aa2
movl -0x3c(%rbp), %eax
subl $0x1, %eax
je 0x28abf
jmp 0x28aac
movl -0x3c(%rbp), %eax
subl $0x2, %eax
je 0x28ac8
jmp 0x28acf
movl $0x10001, -0x30(%rbp)   # imm = 0x10001
jmp 0x28acf
movl $0x1000040, -0x30(%rbp) # imm = 0x1000040
jmp 0x28acf
movl $0x10001, -0x30(%rbp)   # imm = 0x10001
movswq -0xa(%rbp), %rcx
leaq 0x44e005(%rip), %rax    # 0x476ae0
imulq $0x2c, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movw 0x18(%rax), %ax
movw %ax, -0x28(%rbp)
movq -0x38(%rbp), %rdi
movq -0x38(%rbp), %rsi
addq $0x4, %rsi
movq -0x38(%rbp), %rdx
addq $0x8, %rdx
movl -0x10(%rbp), %r8d
movl -0x14(%rbp), %r9d
movq -0x38(%rbp), %rax
movzbl 0x12(%rax), %ebx
shll $0x2, %ebx
movl -0x1c(%rbp), %r11d
movl -0x20(%rbp), %r10d
movl -0x30(%rbp), %eax
leaq -0x28(%rbp), %rcx
movl %ebx, (%rsp)
movl %r11d, 0x8(%rsp)
movl %r10d, 0x10(%rsp)
movl %eax, 0x18(%rsp)
callq 0x6d430
movw %ax, -0x26(%rbp)
movswl -0x28(%rbp), %eax
movq -0x38(%rbp), %rcx
movswl 0x18(%rcx), %ecx
cmpl %ecx, %eax
je 0x28b6b
movswl -0x28(%rbp), %eax
cmpl $0x0, %eax
jl 0x28b6b
movw -0xa(%rbp), %ax
movswl %ax, %edi
movswl -0x28(%rbp), %esi
callq 0x69bd0
movq -0x38(%rbp), %rax
movswl 0x1a(%rax), %eax
cmpl $0x193, %eax            # imm = 0x193
je 0x28c2b
movq -0x38(%rbp), %rax
movw 0xc(%rax), %ax
movw %ax, -0x2a(%rbp)
movq -0x38(%rbp), %rax
movswl 0xc(%rax), %ecx
andl $-0x2, %ecx
movw %cx, 0xc(%rax)
movq -0x38(%rbp), %rax
movl (%rax), %edi
movq -0x38(%rbp), %rax
movl 0x4(%rax), %esi
movq -0x38(%rbp), %rax
movl 0x8(%rax), %edx
subl $0x1, %edx
movq -0x38(%rbp), %rax
movw 0x18(%rax), %cx
movq -0x38(%rbp), %rax
movzbl 0x12(%rax), %r10d
shll $0x2, %r10d
movl -0x30(%rbp), %eax
leaq 0x105b61(%rip), %r8     # 0x12e730
leaq 0x105b5e(%rip), %r9     # 0x12e734
leaq 0x105b5b(%rip), %rbx    # 0x12e738
leaq 0x105b58(%rip), %r11    # 0x12e73c
movswl %cx, %ecx
movq %rbx, (%rsp)
movq %r11, 0x8(%rsp)
movl %r10d, 0x10(%rsp)
movl %eax, 0x18(%rsp)
callq 0x70760
movw -0x2a(%rbp), %cx
movq -0x38(%rbp), %rax
movw %cx, 0xc(%rax)
leaq 0x105b27(%rip), %rax    # 0x12e738
movl (%rax), %eax
leaq 0x105b16(%rip), %rcx    # 0x12e730
addl (%rcx), %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %ecx
sarl %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x8(%rax)
movw -0x26(%rbp), %ax
addq $0x58, %rsp
popq %rbx
popq %rbp
retq
nopw %cs:(%rax,%rax)