// File: /workspace/github_cpp_makefile_star2_O1/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 $0xb8, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq %rdi, %rsi
shrq $0x20, %rsi
cmpl $0x3, %ebx
leaq 0x5ccba(%rip), %rax     # 0x6e280
leaq 0x5cce3(%rip), %rdx     # 0x6e2b0
cmovlq %rax, %rdx
callq 0xb650
leaq 0xa8(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x7ce0(%rip), %rsi      # 0x192ca
leaq 0x7cde(%rip), %rdx      # 0x192cf
leaq 0x98(%rsp), %r15
movq %r15, %rdi
callq 0x16274
movq %r15, %rdi
callq 0x5eae
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0x1161b
callq 0x5230
testl %ebx, %ebx
js 0x118dc
movq %rbx, %rax
shrq $0x20, %rax
movl %ebx, %ecx
imull %ebx, %ecx
incl %ecx
movl %ecx, 0x1c(%rsp)
cvtsi2ss %eax, %xmm0
movss %xmm0, 0x18(%rsp)
movl %ebx, %eax
negl %eax
movslq %eax, %rdi
movq %r14, %rax
sarq $0x20, %rax
movslq %r14d, %rsi
leal 0x1(%rbx), %ecx
movl %ecx, 0x14(%rsp)
leaq (%rdi,%rax), %r13
imulq $0x25c, %rdi, %rcx      # imm = 0x25C
imulq $0x258, %rsi, %rdx      # imm = 0x258
addq %rcx, %rdx
leaq (%rdx,%rax,4), %rcx
leaq 0xfcd9(%rip), %r15      # 0x21350
addq %rcx, %r15
imulq $0x4b8, %rdi, %rcx      # imm = 0x4B8
movq %rsi, 0x28(%rsp)
imulq $0x4b0, %rsi, %rdx      # imm = 0x4B0
addq %rcx, %rdx
leaq (%rdx,%rax,8), %rax
leaq 0x88e35(%rip), %rcx     # 0x9a4d0
addq %rax, %rcx
movq %rcx, (%rsp)
leaq 0x5ce57(%rip), %rcx     # 0x6e500
addq %rax, %rcx
movq %rcx, 0x8(%rsp)
notl %ebx
addq %rdi, %rbx
movq %rdi, 0x48(%rsp)
movq %rbx, 0x38(%rsp)
movq 0x28(%rsp), %rax
leaq (%rdi,%rax), %r12
movq %rdi, 0x30(%rsp)
imulq %rdi, %rdi
movq %rdi, 0x50(%rsp)
xorl %ebp, %ebp
movq %r12, 0x20(%rsp)
movq %r15, 0x40(%rsp)
movq %r13, %rax
addq %rbp, %rax
movl %eax, %ecx
orl %r12d, %ecx
js 0x118a8
cmpq $0x95, %r12
jg 0x118a8
cmpq $0x95, %rax
jg 0x118a8
movq 0x48(%rsp), %rax
addq %rbp, %rax
imulq %rax, %rax
addq 0x50(%rsp), %rax
xorl %r14d, %r14d
cmpl %eax, 0x1c(%rsp)
jb 0x11744
incl %eax
xorps %xmm1, %xmm1
cvtsi2ss %eax, %xmm1
movss 0x18(%rsp), %xmm0
divss %xmm1, %xmm0
callq 0x5190
cvttss2si %xmm0, %r14d
testl %r14d, %r14d
je 0x1185d
movq (%rsp), %rax
movq (%rax,%rbp,8), %rdi
testq %rdi, %rdi
je 0x117e6
addq $0x10, %rdi
leaq 0x7783(%rip), %rsi      # 0x18eec
callq 0x5090
testl %eax, %eax
jne 0x117e6
movb $0x1, 0xfba7(%rip)      # 0x21320
movq (%rsp), %rax
movq $0x0, (%rax,%rbp,8)
movl $0xfffffe0c, %eax       # imm = 0xFFFFFE0C
movl %eax, 0x5ca74(%rip)     # 0x6e204
movl %eax, 0x5ca72(%rip)     # 0x6e208
leaq 0x88(%rsp), %rbx
movq %rbx, 0x78(%rsp)
leaq 0x78(%rsp), %r12
movq %r12, %rdi
leaq 0x7b1e(%rip), %rsi      # 0x192d0
leaq 0x7b4e(%rip), %rdx      # 0x19307
callq 0x16274
movq %r12, %rdi
callq 0x5eae
movq 0x78(%rsp), %rdi
cmpq %rbx, %rdi
je 0x117d5
callq 0x5230
movb $0x1, 0xfb58(%rip)      # 0x21334
movq 0x38(%rsp), %rbx
movq 0x20(%rsp), %r12
movq 0x8(%rsp), %rax
movq (%rax,%rbp,8), %rax
testq %rax, %rax
je 0x1185d
cmpb $0x1, 0x8(%rax)
jne 0x1184c
movq %r13, %r15
movq %rbx, %r13
leaq 0x68(%rsp), %r12
movq %r12, 0x58(%rsp)
leaq 0x58(%rsp), %rbx
movq %rbx, %rdi
leaq 0x7aef(%rip), %rsi      # 0x19308
leaq 0x7b05(%rip), %rdx      # 0x19325
callq 0x16274
movq %rbx, %rdi
callq 0x5eae
movq 0x58(%rsp), %rdi
cmpq %r12, %rdi
movq %r13, %rbx
movq %r15, %r13
movq 0x40(%rsp), %r15
movq 0x20(%rsp), %r12
je 0x1184c
callq 0x5230
movq 0x8(%rsp), %rax
movq (%rax,%rbp,8), %rdi
movl %r14d, %esi
callq 0x11581
movl (%r15,%rbp,4), %eax
cmpl $0x3, %eax
jg 0x11878
cmpl $0x1, %eax
je 0x1188f
cmpl $0x2, %eax
jne 0x118a8
cmpl $0xa, %r14d
jg 0x11895
jmp 0x118a8
cmpl $0xc, %eax
je 0x11899
cmpl $0x4, %eax
jne 0x118a8
movl $0x3, %eax
cmpl $0x6, %r14d
jg 0x118a4
jmp 0x118a8
cmpl $0x2, %r14d
jle 0x118a8
xorl %eax, %eax
jmp 0x118a4
movl $0x3, %eax
cmpl $0x5, %r14d
jl 0x118a8
movl %eax, (%r15,%rbp,4)
incq %rbp
movl %ebx, %eax
addl %ebp, %eax
jne 0x116e3
movq 0x30(%rsp), %rdi
incq %rdi
addq $0x258, %r15            # imm = 0x258
movl $0x4b0, %eax            # imm = 0x4B0
addq %rax, (%rsp)
addq %rax, 0x8(%rsp)
cmpl %edi, 0x14(%rsp)
jne 0x116c0
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq 0x98(%rsp), %rdi
jmp 0x11912
movq %rax, %r14
movq 0x78(%rsp), %rdi
cmpq %rbx, %rdi
jne 0x11917
jmp 0x1191c
movq %rax, %r14
movq 0x58(%rsp), %rdi
cmpq %r12, %rdi
je 0x1191c
callq 0x5230
movq %r14, %rdi
callq 0x53d0