// File: /workspace/github_c_makefile_star2_O3/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
movq %rdi, 0x8(%rsp)
movslq %edi, %r13
leaq 0xe03e(%rip), %r12      # 0x135f0
movq (%r12,%r13,8), %rax
movswl 0x4a(%rax), %eax
leal 0x9(%rax), %edx
cmpl $0x12, %edx
movl %edx, 0x14(%rsp)
ja 0x5677
leaq 0xe35f(%rip), %rax      # 0x13930
movq (%rax,%r13,8), %rdx
leaq 0xded4(%rip), %rdi      # 0x134b0
leaq 0x8aea(%rip), %rsi      # 0xe0cd
xorl %eax, %eax
callq 0x21a0
movzbl 0xdbcf(%rip), %eax      # 0x131c0
testq %rax, %rax
je 0x5626
leaq 0xe393(%rip), %rcx      # 0x13990
movq (%rcx,%r13,8), %rcx
leaq 0xdfe8(%rip), %rdx      # 0x135f0
movq (%rdx,%r13,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 0x5613
movzbl 0xdb94(%rip), %eax      # 0x131c1
testq %rax, %rax
je 0x566f
leaq 0xe357(%rip), %rcx      # 0x13990
movq (%rcx,%r13,8), %rcx
leaq 0xdfac(%rip), %rdx      # 0x135f0
movq (%rdx,%r13,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 0x564f
movsd %xmm0, 0x20(%rdx)
decb 0xdf6c(%rip)            # 0x135e1
jmp 0x56e9
leal -0xa(%rax), %ecx
cmpl $0x9, %ecx
ja 0x56be
imull $0x6667, %eax, %ecx     # imm = 0x6667
movl %ecx, %edx
shrl $0x1f, %edx
sarl $0x12, %ecx
addl %edx, %ecx
addl %ecx, %ecx
leal (%rcx,%rcx,4), %ecx
subl %ecx, %eax
movswq %ax, %rax
movl %eax, %eax
leaq 0xe28d(%rip), %rcx      # 0x13930
movq (%rcx,%rax,8), %rdx
leaq 0xde02(%rip), %rdi      # 0x134b0
leaq 0x8a2b(%rip), %rsi      # 0xe0e0
xorl %eax, %eax
callq 0x21a0
jmp 0x56e9
addl $-0x14, %eax
leaq 0xdde8(%rip), %rdi      # 0x134b0
cmpl $0x9, %eax
ja 0x56d6
leaq 0x8a21(%rip), %rsi      # 0xe0f5
jmp 0x56dd
leaq 0x8a21(%rip), %rsi      # 0xe0fe
movq 0x8(%rsp), %rdx
xorl %eax, %eax
callq 0x21a0
movq 0xe308(%rip), %rdi      # 0x139f8
leaq 0xddb9(%rip), %rsi      # 0x134b0
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
callq 0x3d76
cmpb $0x0, 0xded5(%rip)      # 0x135e2
je 0x5837
movq 0x8(%rsp), %rax
movl %eax, %r14d
leal 0x1(%rax), %r15d
xorl %ebp, %ebp
movq (%r12), %rax
testq %rax, %rax
je 0x5820
movswl 0x48(%rax), %ecx
cmpl %ecx, %r15d
jne 0x573d
movw $0x0, 0x48(%rax)
cmpq %rbp, %r14
je 0x5820
movl %r14d, %edi
movl %ebp, %esi
callq 0x54eb
testl %eax, %eax
jle 0x5820
movq (%r12), %rcx
movswl 0x4a(%rcx), %ebx
leal 0x9(%rbx), %ecx
cmpl $0x12, %ecx
ja 0x577d
movq 0x8(%rsp), %rdi
movl %ebp, %esi
movl %eax, %edx
movl $0x1, %ecx
callq 0x4604
jmp 0x57e5
leal -0xa(%rbx), %eax
cmpl $0x9, %eax
ja 0x57c6
imull $0x6667, %ebx, %eax     # imm = 0x6667
movl %eax, %ecx
shrl $0x1f, %ecx
sarl $0x12, %eax
addl %ecx, %eax
addl %eax, %eax
leal (%rax,%rax,4), %eax
movl %ebx, %ecx
subl %eax, %ecx
movswq %cx, %rax
movl %eax, %eax
leaq 0xe185(%rip), %rcx      # 0x13930
movq (%rcx,%rax,8), %rdx
leaq 0xdcfa(%rip), %rdi      # 0x134b0
leaq 0x894a(%rip), %rsi      # 0xe107
xorl %eax, %eax
callq 0x21a0
jmp 0x57e5
leal -0x14(%rbx), %eax
cmpl $0x9, %eax
ja 0x57e5
leaq 0xdcdb(%rip), %rdi      # 0x134b0
leaq 0x88a0(%rip), %rsi      # 0xe07c
movl %ebp, %edx
xorl %eax, %eax
callq 0x21a0
cmpw $0xa, %bx
jl 0x5820
movq (%r12), %rax
movabsq $0x40c3878000000000, %rcx # imm = 0x40C3878000000000
movq %rcx, 0x30(%rax)
cmpw $0x1d, %bx
ja 0x5820
movq 0xe1ee(%rip), %rdi      # 0x139f8
leaq 0xdc9f(%rip), %rsi      # 0x134b0
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
callq 0x3d76
incq %rbp
movzbl 0xddb8(%rip), %eax      # 0x135e2
addq $0x8, %r12
cmpq %rax, %rbp
jb 0x5721
leaq 0xddb2(%rip), %rbx      # 0x135f0
movq (%rbx,%r13,8), %rdi
callq 0x2130
movq $0x0, (%rbx,%r13,8)
cmpl $0x12, 0x14(%rsp)
ja 0x5875
leaq 0xe133(%rip), %rbx      # 0x13990
movq (%rbx,%r13,8), %rdi
callq 0x2130
movq $0x0, (%rbx,%r13,8)
movb $0x1, 0xe1b7(%rip)      # 0x13a2c
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq