// File: /workspace/github_c_makefile_star2_O0/hyc[P]trek73c/trekx.c
// Function: Distrib
Void Distrib(V, X)
int V;
double X;
{
  double H, H1, Q;
  reg int I;
  reg Srec *WITH;

  H = Objects[V]->Fuel + Ships[V]->Regen * X;
  WITH = Ships[V];
  for (I = 0; I < Phasers; I++) {
    if (WITH->Pstat[I] >= 0 && WITH->PCrts[I] < 0) {
      Q = -WITH->PCrts[I] * X;
      if (Q > WITH->PChrg[I])
	Q = WITH->PChrg[I];
      if (Q < 0)
	Q = 0.0;
      WITH->PChrg[I] -= Q;
      H += Q;
    }
  }
  for (I = 0; I <= 3; I++) {
    if (WITH->Seff[I] > 0) {
      H1 = WITH->Sdrns[I] * X;
      if (H1 > H)
	H1 = H;
      H -= H1;
      WITH->Sdrns[I] = H1 / X;
    }
  }
  if (H > 0) {
    for (I = 0; I < Phasers; I++) {
      if (WITH->PChrg[I] < 10 && WITH->Pstat[I] >= 0 && WITH->PCrts[I] >= 0) {
	H1 = H;
	if (H1 > 10 - WITH->PChrg[I])
	  H1 = 10 - WITH->PChrg[I];
	if (H1 > WITH->PCrts[I] * X)
	  H1 = WITH->PCrts[I] * X;
	H -= H1;
	WITH->PChrg[I] += H1;
      }
    }
  }
  Objects[V]->Fuel = H;
  if (Objects[V]->Fuel > WITH->Fcap)
    Objects[V]->Fuel = WITH->Fcap;
  H -= Objects[V]->Fuel;
  if (H <= 0)
    return;
  for (I = 0; I < Phasers; I++) {
    if (H > 0 && WITH->Pstat[I] >= 0) {
      H1 = 10 - WITH->PChrg[I];
      if (H1 > H)
	H1 = H;
      WITH->PChrg[I] += H1;
      H -= H1;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, -0x4(%rbp)
movsd %xmm0, -0x10(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0x10a99(%rip), %rax     # 0x155e0
movq (%rax,%rcx,8), %rax
movsd 0x20(%rax), %xmm1
movslq -0x4(%rbp), %rcx
leaq 0x10e25(%rip), %rax     # 0x15980
movq (%rax,%rcx,8), %rax
movsd (%rax), %xmm0
movsd -0x10(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x18(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0x10e00(%rip), %rax     # 0x15980
movq (%rax,%rcx,8), %rax
movq %rax, -0x38(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movzbl 0x10617(%rip), %ecx     # 0x151b0
cmpl %ecx, %eax
jge 0x4c76
movq -0x38(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movswl 0xd2(%rax,%rcx,2), %eax
cmpl $0x0, %eax
jl 0x4c66
movq -0x38(%rbp), %rax
movslq -0x2c(%rbp), %rcx
xorps %xmm0, %xmm0
ucomisd 0x40(%rax,%rcx,8), %xmm0
jbe 0x4c66
movq -0x38(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movsd 0x40(%rax,%rcx,8), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x28(%rbp)
movsd -0x28(%rbp), %xmm0
movq -0x38(%rbp), %rax
movslq -0x2c(%rbp), %rcx
ucomisd 0x20(%rax,%rcx,8), %xmm0
jbe 0x4c28
movq -0x38(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movsd 0x20(%rax,%rcx,8), %xmm0
movsd %xmm0, -0x28(%rbp)
xorps %xmm0, %xmm0
ucomisd -0x28(%rbp), %xmm0
jbe 0x4c3a
xorps %xmm0, %xmm0
movsd %xmm0, -0x28(%rbp)
movsd -0x28(%rbp), %xmm1
movq -0x38(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movsd 0x20(%rax,%rcx,8), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, 0x20(%rax,%rcx,8)
movsd -0x28(%rbp), %xmm0
addsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x18(%rbp)
jmp 0x4c68
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x4b8f
movl $0x0, -0x2c(%rbp)
cmpl $0x3, -0x2c(%rbp)
jg 0x4d10
movq -0x38(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movsd 0xa0(%rax,%rcx,8), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x4d00
movq -0x38(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movsd 0x80(%rax,%rcx,8), %xmm0
mulsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x20(%rbp)
movsd -0x20(%rbp), %xmm0
ucomisd -0x18(%rbp), %xmm0
jbe 0x4cd2
movsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x20(%rbp)
movsd -0x20(%rbp), %xmm1
movsd -0x18(%rbp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, -0x18(%rbp)
movsd -0x20(%rbp), %xmm0
divsd -0x10(%rbp), %xmm0
movq -0x38(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movsd %xmm0, 0x80(%rax,%rcx,8)
jmp 0x4d02
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x4c7d
movsd -0x18(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x4e45
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movzbl 0x1047d(%rip), %ecx     # 0x151b0
cmpl %ecx, %eax
jge 0x4e43
movq -0x38(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movsd 0xa2bd(%rip), %xmm0     # 0xf008
ucomisd 0x20(%rax,%rcx,8), %xmm0
jbe 0x4e33
movq -0x38(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movswl 0xd2(%rax,%rcx,2), %eax
cmpl $0x0, %eax
jl 0x4e33
movq -0x38(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movsd 0x40(%rax,%rcx,8), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x4e33
movsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x20(%rbp)
movsd -0x20(%rbp), %xmm0
movq -0x38(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movsd 0xa25e(%rip), %xmm1     # 0xf008
subsd 0x20(%rax,%rcx,8), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x4dd1
movq -0x38(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movsd 0xa242(%rip), %xmm0     # 0xf008
subsd 0x20(%rax,%rcx,8), %xmm0
movsd %xmm0, -0x20(%rbp)
movsd -0x20(%rbp), %xmm0
movq -0x38(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movsd 0x40(%rax,%rcx,8), %xmm1
mulsd -0x10(%rbp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x4e07
movq -0x38(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movsd 0x40(%rax,%rcx,8), %xmm0
mulsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x20(%rbp)
movsd -0x20(%rbp), %xmm1
movsd -0x18(%rbp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, -0x18(%rbp)
movsd -0x20(%rbp), %xmm0
movq -0x38(%rbp), %rax
movslq -0x2c(%rbp), %rcx
addsd 0x20(%rax,%rcx,8), %xmm0
movsd %xmm0, 0x20(%rax,%rcx,8)
jmp 0x4e35
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x4d29
jmp 0x4e45
movsd -0x18(%rbp), %xmm0
movslq -0x4(%rbp), %rcx
leaq 0x1078b(%rip), %rax     # 0x155e0
movq (%rax,%rcx,8), %rax
movsd %xmm0, 0x20(%rax)
movslq -0x4(%rbp), %rcx
leaq 0x10777(%rip), %rax     # 0x155e0
movq (%rax,%rcx,8), %rax
movsd 0x20(%rax), %xmm0
movq -0x38(%rbp), %rax
movzbl 0x18(%rax), %eax
cvtsi2sd %eax, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x4ea4
movq -0x38(%rbp), %rax
movzbl 0x18(%rax), %eax
cvtsi2sd %eax, %xmm0
movslq -0x4(%rbp), %rcx
leaq 0x10745(%rip), %rax     # 0x155e0
movq (%rax,%rcx,8), %rax
movsd %xmm0, 0x20(%rax)
movslq -0x4(%rbp), %rcx
leaq 0x10731(%rip), %rax     # 0x155e0
movq (%rax,%rcx,8), %rax
movsd 0x20(%rax), %xmm1
movsd -0x18(%rbp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, -0x18(%rbp)
xorps %xmm0, %xmm0
ucomisd -0x18(%rbp), %xmm0
jb 0x4ed5
jmp 0x4f7e
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movzbl 0x102ca(%rip), %ecx     # 0x151b0
cmpl %ecx, %eax
jge 0x4f7e
movsd -0x18(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x4f6e
movq -0x38(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movswl 0xd2(%rax,%rcx,2), %eax
cmpl $0x0, %eax
jl 0x4f6e
movq -0x38(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movsd 0xa0e7(%rip), %xmm0     # 0xf008
subsd 0x20(%rax,%rcx,8), %xmm0
movsd %xmm0, -0x20(%rbp)
movsd -0x20(%rbp), %xmm0
ucomisd -0x18(%rbp), %xmm0
jbe 0x4f42
movsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x20(%rbp)
movsd -0x20(%rbp), %xmm0
movq -0x38(%rbp), %rax
movslq -0x2c(%rbp), %rcx
addsd 0x20(%rax,%rcx,8), %xmm0
movsd %xmm0, 0x20(%rax,%rcx,8)
movsd -0x20(%rbp), %xmm1
movsd -0x18(%rbp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, -0x18(%rbp)
jmp 0x4f70
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x4edc
popq %rbp
retq