// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/src/tekchng.c
// Function: tekchangefallz
void
tekchangefallz(short snum,int loz,int hiz)
{
     int  died=0;

     posz[snum]+=hvel[snum];

     fallz[snum]+=hvel[snum];
     if (posz[snum] > loz-(KENSPLAYERHEIGHT<<8)) {
          if (fallz[snum] < 0) {
               fallz[snum]=0;
          }
          if (posz[snum] > loz-(4<<8)) {
               posz[snum]=loz-(4<<8);
               hvel[snum]=0;
          }
          switch (fallz[snum]>>15) {
          case 0:
          case 1:
               break;
          case 2:
               tekchangestun(snum,-200);
               break;
          case 3:
               tekchangestun(snum,-400);
               died=changehealth(snum,-200);
               break;
          case 4:
               tekchangestun(snum,-800);
               died=changehealth(snum,-400);
               break;
          case 5:
               tekchangestun(snum,-1000);
               died=changehealth(snum,-1000);
               break;
          default:
               died=changehealth(snum,-9999);
               break;
          }
          fallz[snum]=0;
     }
     if (died && goreflag) {
          tekexplodebody(playersprite[snum]);
     }

     if (posz[snum] < hiz+(4<<8)) {
          posz[snum]=hiz+(4<<8);
          hvel[snum]=0;
     }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl %edx, %ebx
movslq %edi, %r14
leaq 0xdaf7f(%rip), %r15     # 0xe57a0
movl (%r15,%r14,4), %eax
leaq 0xd9d24(%rip), %r12     # 0xe4550
movl (%r12,%r14,4), %ecx
addl %eax, %ecx
leaq 0xd9bd7(%rip), %r13     # 0xe4410
addl (%r13,%r14,4), %eax
movl %ecx, (%r12,%r14,4)
movl %eax, (%r13,%r14,4)
leal -0x2200(%rsi), %edx
cmpl %edx, %ecx
jle 0xa9f4
testl %eax, %eax
jns 0xa864
movl $0x0, (%r13,%r14,4)
xorl %eax, %eax
addl $0xfffffc00, %esi       # imm = 0xFFFFFC00
cmpl %esi, %ecx
jle 0xa87a
movl %esi, (%r12,%r14,4)
movl $0x0, (%r15,%r14,4)
shrl $0xf, %eax
cmpw $0x5, %ax
ja 0xa969
movzwl %ax, %eax
leaq 0x844ff(%rip), %rcx     # 0x8ed90
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0xc71bf(%rip), %rax     # 0xd1a60
cmpl $0x0, 0x1c(%rax)
jne 0xa8e1
leaq 0x126776(%rip), %rax    # 0x131024
movl (%rax), %eax
cmpl $0x3, %eax
movl $0xfffffe70, %ecx       # imm = 0xFFFFFE70
movl $0xffffff38, %edx       # imm = 0xFFFFFF38
cmovel %ecx, %edx
cmpl $0x1, %eax
movl $0xffffff9c, %eax       # imm = 0xFFFFFF9C
cmovnel %edx, %eax
leaq 0xd9abe(%rip), %rcx     # 0xe4390
addl (%rcx,%r14,4), %eax
xorl %edx, %edx
testl %eax, %eax
cmovgl %eax, %edx
movl %edx, (%rcx,%r14,4)
movl $0x0, (%r13,%r14,4)
jmp 0xa9f4
leaq 0xc716a(%rip), %rcx     # 0xd1a60
movw $0xff38, %ax            # imm = 0xFF38
cmpl $0x0, 0x1c(%rcx)
jne 0xa9be
leaq 0x126719(%rip), %rax    # 0x131024
movl (%rax), %eax
cmpl $0x3, %eax
movl $0xfffffce0, %ecx       # imm = 0xFFFFFCE0
movl $0xfffffe70, %edx       # imm = 0xFFFFFE70
cmovel %ecx, %edx
cmpl $0x1, %eax
movl $0xffffff38, %ecx       # imm = 0xFFFFFF38
cmovnel %edx, %ecx
movw $0xff38, %ax            # imm = 0xFF38
jmp 0xa9a8
leaq 0xc712b(%rip), %rcx     # 0xd1a60
movw $0xfc18, %ax            # imm = 0xFC18
cmpl $0x0, 0x1c(%rcx)
jne 0xa9be
leaq 0x1266de(%rip), %rax    # 0x131024
movl (%rax), %eax
cmpl $0x3, %eax
movl $0xfffff830, %ecx       # imm = 0xFFFFF830
movl $0xfffffc18, %edx       # imm = 0xFFFFFC18
cmovel %ecx, %edx
cmpl $0x1, %eax
movl $0xfffffe0c, %ecx       # imm = 0xFFFFFE0C
cmovnel %edx, %ecx
movw $0xfc18, %ax            # imm = 0xFC18
jmp 0xa9a8
movw $0xd8f1, %ax            # imm = 0xD8F1
jmp 0xa9be
leaq 0xc70ea(%rip), %rcx     # 0xd1a60
movw $0xfe70, %ax            # imm = 0xFE70
cmpl $0x0, 0x1c(%rcx)
jne 0xa9be
leaq 0x12669d(%rip), %rax    # 0x131024
movl (%rax), %eax
cmpl $0x3, %eax
movl $0xfffff9c0, %ecx       # imm = 0xFFFFF9C0
movl $0xfffffce0, %edx       # imm = 0xFFFFFCE0
cmovel %ecx, %edx
cmpl $0x1, %eax
movl $0xfffffe70, %ecx       # imm = 0xFFFFFE70
cmovnel %edx, %ecx
movw $0xfe70, %ax            # imm = 0xFE70
leaq 0xd99e1(%rip), %rdx     # 0xe4390
addl (%rdx,%r14,4), %ecx
xorl %esi, %esi
testl %ecx, %ecx
cmovgl %ecx, %esi
movl %esi, (%rdx,%r14,4)
movswl %r14w, %edi
movswl %ax, %esi
callq 0xa5e8
movl $0x0, (%r13,%r14,4)
testl %eax, %eax
je 0xa9f4
leaq 0x124982(%rip), %rax    # 0x12f360
cmpl $0x0, (%rax)
je 0xa9f4
leaq 0xdad66(%rip), %rax     # 0xe5750
movswl (%rax,%r14,2), %edi
callq 0x108e2
addl $0x400, %ebx            # imm = 0x400
cmpl %ebx, (%r12,%r14,4)
jge 0xaa0c
movl %ebx, (%r12,%r14,4)
movl $0x0, (%r15,%r14,4)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop