// File: /workspace/github_cpp_makefile_star2_O3/essarrdee[P]mutantaliens/mutantaliens.cpp
// Function: do_explosion(explosion)
void do_explosion(explosion ex)
{
	make_noise(ex.x,ex.y,&(ex.radius <3?LE_noise:HE_noise));
	add_message("BOOM!");
	int dam = 0;
	for(int i = -ex.radius; i<= ex.radius; i++)
	{
		for(int j = -ex.radius; j<= ex.radius; j++)
		{
			if(!on_map(ex.x+i,ex.y+j)) continue;
			int d = d22(0,0,i,j);
			dam = (d <= squarei(ex.radius)+1) ? (int)ceil((float)ex.centre_damage/(d+1)) : 0;
			if(dam)
			{
				if(map_items[ex.x+i][ex.y+j] != NULL)
				{
					if(map_items[ex.x+i][ex.y+j]->name == "radio transmitter")
					{
						transmitter_destroyed = true;
						map_items[ex.x+i][ex.y+j] = NULL;
						target_x = -500; target_y = -500;
						add_message("Perhaps the ship will stop pretending to be docked now!");
						destroyed_transmitter = true;

					}
				}
				if(map_occupants[ex.x+i][ex.y+j] != NULL)
				{
					if(map_occupants[ex.x+i][ex.y+j]->is_player)
					{
						add_message("You are hit by the explosion!");
					}
					hurt_actor(map_occupants[ex.x+i][ex.y+j],dam);
				}
			}
			switch(map_terrain[ex.x+i][ex.y+j])
			{
				case WALL:
					if(dam >= 7)
						map_terrain[ex.x+i][ex.y+j] = FLOOR; break;
				case BTREE:
					if(dam >= 11)
						map_terrain[ex.x+i][ex.y+j] = DIRT; break;
				case STREE:
					if(dam >= 3)
						map_terrain[ex.x+i][ex.y+j] = DIRT; break;
				case TWINDOW:
					if(dam >= 5)
						map_terrain[ex.x+i][ex.y+j] = FLOOR; break;
			}
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rsi, %rax
movq %rdi, %r14
movq %rdi, %rsi
shrq $0x20, %rsi
movq %rax, %rbx
cmpl $0x3, %eax
leaq 0x5d29c(%rip), %rax     # 0x6e270
leaq 0x5d2c5(%rip), %rdx     # 0x6e2a0
cmovlq %rax, %rdx
callq 0xb2bd
leaq 0x98(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x8342(%rip), %rsi      # 0x1933a
leaq 0x8340(%rip), %rdx      # 0x1933f
leaq 0x88(%rsp), %r15
movq %r15, %rdi
callq 0x15b1a
movq %r15, %rdi
callq 0x5f0e
movq 0x88(%rsp), %rdi
cmpq %r12, %rdi
je 0x11029
callq 0x5230
movq %rbx, %rsi
testl %esi, %esi
js 0x112cf
movq %rsi, %rax
shrq $0x20, %rax
movl %esi, %ecx
imull %esi, %ecx
incl %ecx
movl %ecx, 0x24(%rsp)
cvtsi2ss %eax, %xmm0
movss %xmm0, 0x20(%rsp)
movl %esi, %eax
negl %eax
movslq %eax, %rdi
movq %r14, %rax
sarq $0x20, %rax
leal 0x1(%rsi), %ecx
movl %ecx, 0x1c(%rsp)
movslq %r14d, %r8
leaq (%rdi,%rax), %r12
imulq $0x25c, %rdi, %rcx      # imm = 0x25C
imulq $0x258, %r8, %rdx       # imm = 0x258
addq %rcx, %rdx
leaq (%rdx,%rax,4), %rcx
leaq 0x102b8(%rip), %rdx     # 0x21340
addq %rcx, %rdx
movq %rdx, 0x10(%rsp)
imulq $0x4b8, %rdi, %rcx      # imm = 0x4B8
movq %r8, 0x28(%rsp)
imulq $0x4b0, %r8, %rdx       # imm = 0x4B0
addq %rcx, %rdx
leaq (%rdx,%rax,8), %rax
leaq 0x8940f(%rip), %rcx     # 0x9a4c0
addq %rax, %rcx
movq %rcx, (%rsp)
leaq 0x5d431(%rip), %rcx     # 0x6e4f0
addq %rax, %rcx
movq %rcx, 0x8(%rsp)
notl %esi
addq %rdi, %rsi
movq %rdi, 0x38(%rsp)
movq 0x28(%rsp), %rax
leaq (%rdi,%rax), %r15
movq %rdi, 0x30(%rsp)
imulq %rdi, %rdi
movq %rdi, 0x40(%rsp)
xorl %ebp, %ebp
leaq (%r12,%rbp), %rax
movl %eax, %ecx
orl %r15d, %ecx
js 0x11299
cmpq $0x95, %r15
jg 0x11299
cmpq $0x95, %rax
jg 0x11299
movq 0x38(%rsp), %rax
addq %rbp, %rax
imulq %rax, %rax
addq 0x40(%rsp), %rax
xorl %r14d, %r14d
cmpl %eax, 0x24(%rsp)
jb 0x11246
incl %eax
xorps %xmm1, %xmm1
cvtsi2ss %eax, %xmm1
movss 0x20(%rsp), %xmm0
divss %xmm1, %xmm0
movq %rsi, %r13
callq 0x5190
movq %r13, %rsi
cvttss2si %xmm0, %ebx
testl %ebx, %ebx
je 0x11246
movq (%rsp), %rax
movq (%rax,%rbp,8), %rdi
testq %rdi, %rdi
leaq 0x78(%rsp), %r14
je 0x111e1
addq $0x10, %rdi
leaq 0x7de5(%rip), %rsi      # 0x18f5c
callq 0x5090
testl %eax, %eax
jne 0x111e1
movb $0x1, 0x10189(%rip)     # 0x21310
movq (%rsp), %rax
movq $0x0, (%rax,%rbp,8)
movl $0xfffffe0c, %eax       # imm = 0xFFFFFE0C
movl %eax, 0x5d056(%rip)     # 0x6e1f4
movl %eax, 0x5d054(%rip)     # 0x6e1f8
movq %r14, 0x68(%rsp)
leaq 0x68(%rsp), %rdi
leaq 0x818b(%rip), %rsi      # 0x19340
leaq 0x81bb(%rip), %rdx      # 0x19377
callq 0x15b1a
leaq 0x68(%rsp), %rdi
callq 0x5f0e
movq 0x68(%rsp), %rdi
cmpq %r14, %rdi
je 0x111da
callq 0x5230
movb $0x1, 0x10143(%rip)     # 0x21324
movq 0x8(%rsp), %rax
movq (%rax,%rbp,8), %rax
testq %rax, %rax
je 0x11240
cmpb $0x1, 0x8(%rax)
jne 0x11230
leaq 0x58(%rsp), %r14
movq %r14, 0x48(%rsp)
leaq 0x48(%rsp), %rdi
leaq 0x816d(%rip), %rsi      # 0x19378
leaq 0x8183(%rip), %rdx      # 0x19395
callq 0x15b1a
leaq 0x48(%rsp), %rdi
callq 0x5f0e
movq 0x48(%rsp), %rdi
cmpq %r14, %rdi
je 0x11230
callq 0x5230
movq 0x8(%rsp), %rax
movq (%rax,%rbp,8), %rdi
movl %ebx, %esi
callq 0x10f8c
movl %ebx, %r14d
movq %r13, %rsi
movq 0x10(%rsp), %rax
movl (%rax,%rbp,4), %eax
cmpl $0x3, %eax
jg 0x11265
cmpl $0x1, %eax
je 0x1127c
cmpl $0x2, %eax
jne 0x11299
cmpl $0xa, %r14d
jg 0x11282
jmp 0x11299
cmpl $0xc, %eax
je 0x11286
cmpl $0x4, %eax
jne 0x11299
movl $0x3, %eax
cmpl $0x6, %r14d
jg 0x11291
jmp 0x11299
cmpl $0x2, %r14d
jle 0x11299
xorl %eax, %eax
jmp 0x11291
movl $0x3, %eax
cmpl $0x5, %r14d
jl 0x11299
movq 0x10(%rsp), %rcx
movl %eax, (%rcx,%rbp,4)
incq %rbp
movl %esi, %eax
addl %ebp, %eax
jne 0x110ea
movq 0x30(%rsp), %rdi
incq %rdi
addq $0x258, 0x10(%rsp)      # imm = 0x258
movl $0x4b0, %eax            # imm = 0x4B0
addq %rax, (%rsp)
addq %rax, 0x8(%rsp)
cmpl %edi, 0x1c(%rsp)
jne 0x110d1
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x88(%rsp), %rdi
cmpq %r12, %rdi
jne 0x1130a
jmp 0x1130f
movq %rax, %rbx
movq 0x68(%rsp), %rdi
jmp 0x11305
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r14, %rdi
je 0x1130f
callq 0x5230
movq %rbx, %rdi
callq 0x53d0