// File: /workspace/github_c_makefile_star2_O0/hyc[P]trek73c/trekx.c
// Function: Movem
void Movem(i)
int i;
{
  uchar Otp;
  double Accel, Crs1, Rate, Turn, Temp;
  reg Object *WITH;

  WITH = Objects[i];
  Otp = WITH->ObTyp / 10;
  if (!Otp) {
    if (Ships[i]->Crew == 0)
      WITH->Des_Spd = 0.0;
    if (Ships[i]->Dmge[(long)Comp])
      WITH->Trgt = 0;
    if (Ships[i]->Dmge[(long)Warp])
      Nowarp(i);
    if (fabs(WITH->Des_Spd) >= 1) {
      WITH->Fuel -= fabs(WITH->Des_Spd) * Ships[i]->Weff * Iter;
      if (WITH->Fuel <= 0) {
	WITH->Fuel = 0.0;
	WITH->Des_Spd = 0.0;
	Endln();
	sprintf(scrstr,"%s's warp drive shutting down.", Snams[i]);
	SEndln();
	Nowarp(i);
      }
    }
  }
  WITH = Objects[i];
  if (!Otp) {
    if (WITH->Trgt != 0) {
      WITH->Des_Crs = Bearing(i, abs(WITH->Trgt)-1);
      if (WITH->Trgt < 0)
	WITH->Des_Crs = RMod(WITH->Des_Crs + 180);
    }
    if (WITH->Des_Crs != WITH->Act_Crs) {
      Crs1 = RMod(WITH->Des_Crs - WITH->Act_Crs);
      if (Crs1 >= 180)
	Crs1 -= 360;
      Rate = 10.0;
      if (i > 0)
	Rate = 12.0;
      Turn = (Rate - fabs(WITH->Act_Spd)) * 5 * Iter;
      if (Ships[i]->Dmge[(long)Warp])
	Turn /= 2;
      Temp = fabs(Crs1);
      if (Temp > Turn)
	Temp = Turn;
      Temp = Sign(Crs1) * Temp;
      WITH->Act_Crs = RMod(WITH->Act_Crs + Temp);
    }
  }
  if (Otp < 2) {
    Accel = WITH->Des_Spd - WITH->Act_Spd;
    WITH->Act_Spd += Sign(Accel) * sqrt(fabs(Accel)) * Iter;
  } else if (Otp == 2) {
    if (WITH->Trgt > 0)
      WITH->Act_Crs = Bearing(i, WITH->Trgt-1);
  }
  WITH->Act_Crs = RMod(WITH->Act_Crs);
  Crs1 = Radians(WITH->Act_Crs);
  WITH->XPos += WITH->Act_Spd * cos(Crs1) * Iter * 100;
  WITH->YPos -= WITH->Act_Spd * sin(Crs1) * Iter * 100;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl %edi, -0x4(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0xef3a(%rip), %rax      # 0x155e0
movq (%rax,%rcx,8), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movswl 0x4a(%rax), %eax
movl $0xa, %ecx
cltd
idivl %ecx
movb %al, -0x5(%rbp)
cmpb $0x0, -0x5(%rbp)
jne 0x6814
movslq -0x4(%rbp), %rcx
leaq 0xf2aa(%rip), %rax      # 0x15980
movq (%rax,%rcx,8), %rax
movswl 0x1a(%rax), %eax
cmpl $0x0, %eax
jne 0x66ef
movq -0x38(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x8(%rax)
movslq -0x4(%rbp), %rcx
leaq 0xf286(%rip), %rax      # 0x15980
movq (%rax,%rcx,8), %rax
cmpb $0x0, 0xc0(%rax)
je 0x6711
movq -0x38(%rbp), %rax
movw $0x0, 0x48(%rax)
movslq -0x4(%rbp), %rcx
leaq 0xf264(%rip), %rax      # 0x15980
movq (%rax,%rcx,8), %rax
cmpb $0x0, 0xc3(%rax)
je 0x6731
movl -0x4(%rbp), %edi
callq 0x6b60
movq -0x38(%rbp), %rax
movsd 0x8(%rax), %xmm0
movaps 0x8c8f(%rip), %xmm1     # 0xf3d0
pand %xmm1, %xmm0
movsd 0x88c3(%rip), %xmm1     # 0xf010
ucomisd %xmm1, %xmm0
jb 0x6812
movq -0x38(%rbp), %rax
movsd 0x8(%rax), %xmm0
movaps 0x8c69(%rip), %xmm1     # 0xf3d0
pand %xmm1, %xmm0
movslq -0x4(%rbp), %rcx
leaq 0xf20a(%rip), %rax      # 0x15980
movq (%rax,%rcx,8), %rax
mulsd 0x8(%rax), %xmm0
movsd 0xea19(%rip), %xmm2     # 0x151a0
movq -0x38(%rbp), %rax
movsd 0x20(%rax), %xmm1
movq %xmm0, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rcx
movq %rcx, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x20(%rax)
movq -0x38(%rbp), %rax
xorps %xmm0, %xmm0
ucomisd 0x20(%rax), %xmm0
jb 0x6810
movq -0x38(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x20(%rax)
movq -0x38(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x8(%rax)
callq 0x42a0
movslq -0x4(%rbp), %rcx
leaq 0xf136(%rip), %rax      # 0x15920
movq (%rax,%rcx,8), %rdx
leaq 0xecab(%rip), %rdi      # 0x154a0
leaq 0x99b2(%rip), %rsi      # 0x101ae
movb $0x0, %al
callq 0x2190
callq 0x4320
movl -0x4(%rbp), %edi
callq 0x6b60
jmp 0x6812
jmp 0x6814
movslq -0x4(%rbp), %rcx
leaq 0xedc1(%rip), %rax      # 0x155e0
movq (%rax,%rcx,8), %rax
movq %rax, -0x38(%rbp)
cmpb $0x0, -0x5(%rbp)
jne 0x69d3
movq -0x38(%rbp), %rax
movswl 0x48(%rax), %eax
cmpl $0x0, %eax
je 0x688f
movl -0x4(%rbp), %edi
movq -0x38(%rbp), %rax
movswl 0x48(%rax), %esi
movl %esi, %eax
negl %eax
cmovnsl %eax, %esi
subl $0x1, %esi
callq 0x4430
movq -0x38(%rbp), %rax
movsd %xmm0, 0x18(%rax)
movq -0x38(%rbp), %rax
movswl 0x48(%rax), %eax
cmpl $0x0, %eax
jge 0x688d
movq -0x38(%rbp), %rax
movsd 0x87a6(%rip), %xmm0     # 0xf020
addsd 0x18(%rax), %xmm0
callq 0x4380
movq -0x38(%rbp), %rax
movsd %xmm0, 0x18(%rax)
jmp 0x688f
movq -0x38(%rbp), %rax
movsd 0x18(%rax), %xmm0
movq -0x38(%rbp), %rax
ucomisd 0x10(%rax), %xmm0
jne 0x68aa
jp 0x68aa
jmp 0x69d1
movq -0x38(%rbp), %rax
movsd 0x18(%rax), %xmm0
movq -0x38(%rbp), %rax
subsd 0x10(%rax), %xmm0
callq 0x4380
movsd %xmm0, -0x18(%rbp)
movsd -0x18(%rbp), %xmm0
movsd 0x874d(%rip), %xmm1     # 0xf020
ucomisd %xmm1, %xmm0
jb 0x68ef
movsd -0x18(%rbp), %xmm0
movsd 0x8792(%rip), %xmm1     # 0xf078
subsd %xmm1, %xmm0
movsd %xmm0, -0x18(%rbp)
movsd 0x8711(%rip), %xmm0     # 0xf008
movsd %xmm0, -0x20(%rbp)
cmpl $0x0, -0x4(%rbp)
jle 0x690f
movsd 0x87e6(%rip), %xmm0     # 0xf0f0
movsd %xmm0, -0x20(%rbp)
movsd -0x20(%rbp), %xmm0
movq -0x38(%rbp), %rax
movsd (%rax), %xmm1
movaps 0x8aad(%rip), %xmm2     # 0xf3d0
pand %xmm2, %xmm1
subsd %xmm1, %xmm0
movsd 0x87b5(%rip), %xmm1     # 0xf0e8
mulsd %xmm1, %xmm0
mulsd 0xe861(%rip), %xmm0     # 0x151a0
movsd %xmm0, -0x28(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0xf031(%rip), %rax      # 0x15980
movq (%rax,%rcx,8), %rax
cmpb $0x0, 0xc3(%rax)
je 0x6972
movsd -0x28(%rbp), %xmm0
movsd 0x8767(%rip), %xmm1     # 0xf0d0
divsd %xmm1, %xmm0
movsd %xmm0, -0x28(%rbp)
movsd -0x18(%rbp), %xmm0
movaps 0x8a52(%rip), %xmm1     # 0xf3d0
pand %xmm1, %xmm0
movsd %xmm0, -0x30(%rbp)
movsd -0x30(%rbp), %xmm0
ucomisd -0x28(%rbp), %xmm0
jbe 0x699d
movsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
movsd -0x18(%rbp), %xmm0
callq 0x4350
cvtsi2sd %eax, %xmm0
mulsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
movq -0x38(%rbp), %rax
movsd 0x10(%rax), %xmm0
addsd -0x30(%rbp), %xmm0
callq 0x4380
movq -0x38(%rbp), %rax
movsd %xmm0, 0x10(%rax)
jmp 0x69d3
movzbl -0x5(%rbp), %eax
cmpl $0x2, %eax
jge 0x6a44
movq -0x38(%rbp), %rax
movsd 0x8(%rax), %xmm0
movq -0x38(%rbp), %rax
subsd (%rax), %xmm0
movsd %xmm0, -0x10(%rbp)
movsd -0x10(%rbp), %xmm0
callq 0x4350
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x40(%rbp)
movsd -0x10(%rbp), %xmm0
movaps 0x89bf(%rip), %xmm1     # 0xf3d0
pand %xmm1, %xmm0
callq 0x22e0
movaps %xmm0, %xmm1
movsd -0x40(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd 0xe772(%rip), %xmm2     # 0x151a0
movq -0x38(%rbp), %rax
movsd (%rax), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax)
jmp 0x6a7a
movzbl -0x5(%rbp), %eax
cmpl $0x2, %eax
jne 0x6a78
movq -0x38(%rbp), %rax
movswl 0x48(%rax), %eax
cmpl $0x0, %eax
jle 0x6a76
movl -0x4(%rbp), %edi
movq -0x38(%rbp), %rax
movswl 0x48(%rax), %esi
subl $0x1, %esi
callq 0x4430
movq -0x38(%rbp), %rax
movsd %xmm0, 0x10(%rax)
jmp 0x6a78
jmp 0x6a7a
movq -0x38(%rbp), %rax
movsd 0x10(%rax), %xmm0
callq 0x4380
movq -0x38(%rbp), %rax
movsd %xmm0, 0x10(%rax)
movq -0x38(%rbp), %rax
movsd 0x10(%rax), %xmm0
callq 0x4600
movsd %xmm0, -0x18(%rbp)
movq -0x38(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x50(%rbp)
movsd -0x18(%rbp), %xmm0
callq 0x20f0
movaps %xmm0, %xmm1
movsd -0x50(%rbp), %xmm0
mulsd %xmm1, %xmm0
mulsd 0xe6d1(%rip), %xmm0     # 0x151a0
movq -0x38(%rbp), %rax
movsd 0x38(%rax), %xmm1
movsd 0x8588(%rip), %xmm2     # 0xf068
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x38(%rax)
movq -0x38(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x48(%rbp)
movsd -0x18(%rbp), %xmm0
callq 0x2300
movaps %xmm0, %xmm1
movsd -0x48(%rbp), %xmm0
mulsd %xmm1, %xmm0
mulsd 0xe688(%rip), %xmm0     # 0x151a0
movq -0x38(%rbp), %rax
movsd 0x40(%rax), %xmm1
movq %xmm0, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rcx
movq %rcx, %xmm0
movsd 0x8528(%rip), %xmm2     # 0xf068
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x40(%rax)
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)