// File: /workspace/github_c_makefile_star2_O1/hyc[P]trek73c/trekx.c
// Function: Detonate
void Detonate(I)
int I;
{
  int Hits, I0, I1, J, K, M;

  I0 = Objects[I]->ObTyp;
  M = I0 % 10;
  I0 /= 10;
  I1 = I0;
  if (I0 == 0) {
    sprintf(scrstr,"++%s++ Destruction", Snams[I]);
    for (K = 0; K < Phasers; K++)
      Objects[I]->Fuel += Ships[I]->PChrg[K];
    for (K = 0; K < Tubes; K++)
      Objects[I]->Fuel += Ships[I]->Tengy[K];
    Vessels--;
  } else if (I0 == 1)
    sprintf(scrstr,"##%s's Engineering##", Snams[M]);
  else if (I0 == 2)
    sprintf(scrstr,"** %d **", I);
  else
    sprintf(scrstr,":: %d ::", I);
  SEndln();
  for (J = 0; J < ObjCount; J++) {
    if (Objects[J] != NULL) {
      if (Objects[J]->Trgt == I+1)
	Objects[J]->Trgt = 0;
    }
    if (J != I && Objects[J] != NULL) {
      Hits = AMHits(I, J);
      I0 = Objects[J]->ObTyp;
      M = I0 % 10;
      I0 /= 10;
      if (Hits > 0) {
	if (I0 == 0)
	  Damage(I, J, Hits, 1);
	else if (I0 == 1)
	  sprintf(scrstr,"Hit on %s's jettisoned Engineering", Snams[M]);
	else if (I0 == 2)
	  sprintf(scrstr,"Hit on probe %d", J);
	if (I0 > 0) {
	  Objects[J]->Tim_Del = 9999.0;
	  if (I0 < 3)
	    SEndln();
	}
      }
    }
  }
  free(Objects[I]);
  Objects[I] = NULL;
  if (I1 != 0)
    return;
  free(Ships[I]);
  Ships[I] = NULL;
  Redo = true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edi, %ebx
movslq %edi, %r14
leaq 0xe0e5(%rip), %r12      # 0x135f0
movq (%r12,%r14,8), %rax
movswq 0x4a(%rax), %rax
leal 0x9(%rax), %edx
cmpl $0x12, %edx
movq %r14, 0x10(%rsp)
movl %edx, 0xc(%rsp)
ja 0x55d6
leaq 0xe400(%rip), %rax      # 0x13930
movq (%rax,%r14,8), %rdx
leaq 0xdf75(%rip), %rdi      # 0x134b0
leaq 0x8ad3(%rip), %rsi      # 0xe015
xorl %eax, %eax
callq 0x21a0
movzbl 0xdc70(%rip), %eax      # 0x131c0
testq %rax, %rax
je 0x5585
leaq 0xe434(%rip), %rcx      # 0x13990
movq (%rcx,%r14,8), %rcx
leaq 0xe089(%rip), %rdx      # 0x135f0
movq (%rdx,%r14,8), %rdx
movsd 0x20(%rdx), %xmm0
xorl %esi, %esi
addsd 0x20(%rcx,%rsi,8), %xmm0
movsd %xmm0, 0x20(%rdx)
incq %rsi
cmpq %rsi, %rax
jne 0x5572
movzbl 0xdc35(%rip), %eax      # 0x131c1
testq %rax, %rax
je 0x55ce
leaq 0xe3f8(%rip), %rcx      # 0x13990
movq (%rcx,%r14,8), %rcx
leaq 0xe04d(%rip), %rdx      # 0x135f0
movq (%rdx,%r14,8), %rdx
movsd 0x20(%rdx), %xmm0
xorl %esi, %esi
movswl 0xc6(%rcx,%rsi,2), %edi
xorps %xmm1, %xmm1
cvtsi2sd %edi, %xmm1
addsd %xmm1, %xmm0
incq %rsi
cmpq %rsi, %rax
jne 0x55ae
movsd %xmm0, 0x20(%rdx)
decb 0xe00d(%rip)            # 0x135e1
jmp 0x5645
leal -0xa(%rax), %ecx
cmpl $0x9, %ecx
ja 0x561d
imulq $0x66666667, %rax, %rcx # imm = 0x66666667
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x22, %rcx
addl %edx, %ecx
addl %ecx, %ecx
leal (%rcx,%rcx,4), %ecx
subl %ecx, %eax
movl %eax, %eax
leaq 0xe32e(%rip), %rcx      # 0x13930
movq (%rcx,%rax,8), %rdx
leaq 0xdea3(%rip), %rdi      # 0x134b0
leaq 0x8a14(%rip), %rsi      # 0xe028
xorl %eax, %eax
callq 0x21a0
jmp 0x5645
addl $-0x14, %eax
leaq 0xde89(%rip), %rdi      # 0x134b0
cmpl $0x9, %eax
ja 0x5635
leaq 0x8a0a(%rip), %rsi      # 0xe03d
jmp 0x563c
leaq 0x8a0a(%rip), %rsi      # 0xe046
movl %ebx, %edx
xorl %eax, %eax
callq 0x21a0
movq 0xe3ac(%rip), %rdi      # 0x139f8
leaq 0xde5d(%rip), %rsi      # 0x134b0
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
callq 0x3c58
cmpb $0x0, 0xdf79(%rip)      # 0x135e2
je 0x5799
movl %ebx, %r14d
leal 0x1(%rbx), %r15d
xorl %ebp, %ebp
movq (%r12), %rax
testq %rax, %rax
je 0x5690
movswl 0x48(%rax), %ecx
cmpl %ecx, %r15d
jne 0x5690
movw $0x0, 0x48(%rax)
testq %rax, %rax
sete %al
cmpq %rbp, %r14
sete %cl
orb %al, %cl
jne 0x5782
movl %r14d, %edi
movl %ebp, %esi
callq 0x542b
testl %eax, %eax
jle 0x5782
movq (%r12), %rcx
movswq 0x4a(%rcx), %r13
leal 0x9(%r13), %ecx
cmpl $0x12, %ecx
ja 0x56da
movl %ebx, %edi
movl %ebp, %esi
movl %eax, %edx
movl $0x1, %ecx
callq 0x44f7
jmp 0x5745
leal -0xa(%r13), %eax
cmpl $0x9, %eax
ja 0x5725
imulq $0x66666667, %r13, %rax # imm = 0x66666667
movq %rax, %rcx
shrq $0x3f, %rcx
sarq $0x22, %rax
addl %ecx, %eax
addl %eax, %eax
leal (%rax,%rax,4), %eax
movl %r13d, %ecx
subl %eax, %ecx
movl %ecx, %eax
leaq 0xe226(%rip), %rcx      # 0x13930
movq (%rcx,%rax,8), %rdx
leaq 0xdd9b(%rip), %rdi      # 0x134b0
leaq 0x8933(%rip), %rsi      # 0xe04f
xorl %eax, %eax
callq 0x21a0
jmp 0x5745
leal -0x14(%r13), %eax
cmpl $0x9, %eax
ja 0x5745
leaq 0xdd7b(%rip), %rdi      # 0x134b0
leaq 0x8888(%rip), %rsi      # 0xdfc4
movl %ebp, %edx
xorl %eax, %eax
callq 0x21a0
cmpw $0xa, %r13w
jl 0x5782
movq (%r12), %rax
movabsq $0x40c3878000000000, %rcx # imm = 0x40C3878000000000
movq %rcx, 0x30(%rax)
cmpw $0x1d, %r13w
jg 0x5782
movq 0xe28c(%rip), %rdi      # 0x139f8
leaq 0xdd3d(%rip), %rsi      # 0x134b0
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
callq 0x3c58
incq %rbp
movzbl 0xde56(%rip), %eax      # 0x135e2
addq $0x8, %r12
cmpq %rax, %rbp
jb 0x5678
leaq 0xde50(%rip), %rbx      # 0x135f0
movq 0x10(%rsp), %r14
movq (%rbx,%r14,8), %rdi
callq 0x2130
movq $0x0, (%rbx,%r14,8)
cmpl $0x12, 0xc(%rsp)
ja 0x57dc
leaq 0xe1cc(%rip), %rbx      # 0x13990
movq (%rbx,%r14,8), %rdi
callq 0x2130
movq $0x0, (%rbx,%r14,8)
movb $0x1, 0xe250(%rip)      # 0x13a2c
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq