// File: /workspace/github_c_makefile_star2_O1/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 0xd7f93(%rip), %r15     # 0xe27a0
movl (%r15,%r14,4), %ecx
leaq 0xd6d38(%rip), %r12     # 0xe1550
movl (%r12,%r14,4), %eax
addl %ecx, %eax
leaq 0xd6beb(%rip), %r13     # 0xe1410
addl (%r13,%r14,4), %ecx
movl %eax, (%r12,%r14,4)
movl %ecx, (%r13,%r14,4)
leal -0x2200(%rsi), %edx
cmpl %edx, %eax
jle 0xa8d7
testl %ecx, %ecx
jns 0xa84e
movl $0x0, (%r13,%r14,4)
addl $0xfffffc00, %esi       # imm = 0xFFFFFC00
cmpl %esi, %eax
jle 0xa864
movl %esi, (%r12,%r14,4)
movl $0x0, (%r15,%r14,4)
movl (%r13,%r14,4), %ecx
sarl $0xf, %ecx
cmpl $0x5, %ecx
ja 0xa985
xorl %eax, %eax
leaq 0x81512(%rip), %rdx     # 0x8bd90
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
leaq 0xc41d2(%rip), %rcx     # 0xcea60
cmpl $0x0, 0x1c(%rcx)
jne 0xa9e5
leaq 0x123765(%rip), %rax    # 0x12e004
movl (%rax), %eax
cmpl $0x3, %eax
movl $0xfffffe70, %ecx       # imm = 0xFFFFFE70
movl $0xffffff38, %edx       # imm = 0xFFFFFF38
cmovel %ecx, %edx
cmpl $0x1, %eax
movl $0xffffff9c, %ecx       # imm = 0xFFFFFF9C
cmovnel %edx, %ecx
leaq 0xd6acd(%rip), %rdx     # 0xe1390
addl (%rdx,%r14,4), %ecx
xorl %eax, %eax
testl %ecx, %ecx
cmovlel %eax, %ecx
movl %ecx, (%rdx,%r14,4)
jmp 0xa9e5
xorl %eax, %eax
jmp 0xa9f3
leaq 0xc417b(%rip), %rax     # 0xcea60
cmpl $0x0, 0x1c(%rax)
jne 0xa925
leaq 0x123712(%rip), %rax    # 0x12e004
movl (%rax), %eax
cmpl $0x3, %eax
movl $0xfffffce0, %ecx       # imm = 0xFFFFFCE0
movl $0xfffffe70, %edx       # imm = 0xFFFFFE70
cmovel %ecx, %edx
cmpl $0x1, %eax
movl $0xffffff38, %eax       # imm = 0xFFFFFF38
cmovnel %edx, %eax
leaq 0xd6a7a(%rip), %rcx     # 0xe1390
addl (%rcx,%r14,4), %eax
xorl %edx, %edx
testl %eax, %eax
cmovgl %eax, %edx
movl %edx, (%rcx,%r14,4)
movswl %r14w, %edi
movl $0xffffff38, %esi       # imm = 0xFFFFFF38
jmp 0xa9e0
leaq 0xc4126(%rip), %rax     # 0xcea60
cmpl $0x0, 0x1c(%rax)
jne 0xa97a
leaq 0x1236bd(%rip), %rax    # 0x12e004
movl (%rax), %eax
cmpl $0x3, %eax
movl $0xfffff830, %ecx       # imm = 0xFFFFF830
movl $0xfffffc18, %edx       # imm = 0xFFFFFC18
cmovel %ecx, %edx
cmpl $0x1, %eax
movl $0xfffffe0c, %eax       # imm = 0xFFFFFE0C
cmovnel %edx, %eax
leaq 0xd6a25(%rip), %rcx     # 0xe1390
addl (%rcx,%r14,4), %eax
xorl %edx, %edx
testl %eax, %eax
cmovgl %eax, %edx
movl %edx, (%rcx,%r14,4)
movswl %r14w, %edi
movl $0xfffffc18, %esi       # imm = 0xFFFFFC18
jmp 0xa9e0
movswl %r14w, %edi
movl $0xffffd8f1, %esi       # imm = 0xFFFFD8F1
jmp 0xa9e0
leaq 0xc40c9(%rip), %rax     # 0xcea60
cmpl $0x0, 0x1c(%rax)
jne 0xa9d7
leaq 0x123660(%rip), %rax    # 0x12e004
movl (%rax), %eax
cmpl $0x3, %eax
movl $0xfffff9c0, %ecx       # imm = 0xFFFFF9C0
movl $0xfffffce0, %edx       # imm = 0xFFFFFCE0
cmovel %ecx, %edx
cmpl $0x1, %eax
movl $0xfffffe70, %eax       # imm = 0xFFFFFE70
cmovnel %edx, %eax
leaq 0xd69c8(%rip), %rcx     # 0xe1390
addl (%rcx,%r14,4), %eax
xorl %edx, %edx
testl %eax, %eax
cmovgl %eax, %edx
movl %edx, (%rcx,%r14,4)
movswl %r14w, %edi
movl $0xfffffe70, %esi       # imm = 0xFFFFFE70
callq 0xa5d8
movl $0x0, (%r13,%r14,4)
testl %eax, %eax
setne %al
testb %al, %al
je 0xaa14
leaq 0x121962(%rip), %rax    # 0x12c360
cmpl $0x0, (%rax)
je 0xaa14
leaq 0xd7d46(%rip), %rax     # 0xe2750
movswl (%rax,%r14,2), %edi
callq 0x1088a
addl $0x400, %ebx            # imm = 0x400
cmpl %ebx, (%r12,%r14,4)
jge 0xaa2c
movl %ebx, (%r12,%r14,4)
movl $0x0, (%r15,%r14,4)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop