// File: /workspace/github_cpp_makefile_star2_O3/essarrdee[P]mutantaliens/mutantaliens.cpp
// Function: add_device(int, int, int, bool)
item* add_device(int type,int x,int y,bool in_inv)
{
	item* dev = new item();
	if(type == HOLOGRAM_PROJECTOR)
	{
		dev->projection = add_actor(zoo[0],false,-500,-500,true);
	}
	dev->device_type = type;
	dev->colour = COLOR_RED;
	dev->wavelength = -1;
	dev->time_remaining = -1;
	dev->species_stored = -1;
	dev->current_action = NULL_STIMULUS;
	dev->next_action = NULL_STIMULUS;
	dev->configuration = UNCONFIGURED;
	dev->power_remaining = 100;
	dev->player_has = false;
	switch (type)
	{
	case 0:
		dev->name = "low explosive";
		dev->ch = 'A';
		dev->description = "Inflicts damage on creatures and walls within a 3x3 area. Including you.";
		break;
	case 1:
		dev->name = "high explosive";
		dev->ch = 'B';
		dev->description = "Inflicts great damage on creatures and walls within a 5x5 area. Including you.";
		break;
	case 2:
		dev->name = "hologram projector";
		dev->description = "Projects holograms that confuse creatures that rely on sight. Such as you.";
		dev->ch = 'C';
		break;
	case 3:
		dev->name = "noise generator";
		dev->description = "Confuses or deafens creatures that rely on hearing. Like you.";
		dev->ch = 'D';
		break;
	case 4:
		dev->name = "scent generator";
		dev->ch = 'E';
		dev->description = "Confuses creatures with a sense of smell. For instance... your dog.";
		break;
	case 5:
		dev->name = "brain slice";
		dev->description = "Confuses creatures with a psychic sense. Like that guy from the infotainment datalinks.";
		dev->ch = 'F';
		break;
	default:
		delete dev;
		return NULL;
	}
	dev->base_description = dev->description;
	if (in_inv)
	{
		dev->x = p_ptr->x;
		dev->y = p_ptr->y;
		device_to_inventory(dev);
	}
	else
	{
		item_to_location(dev,x,y);
	}
	return dev;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %r15d
movl %edx, 0x4(%rsp)
movl %esi, (%rsp)
movl %edi, %ebp
movl $0xa0, %edi
callq 0x5250
movq %rax, %rbx
xorl %r14d, %r14d
movl $0xa0, %edx
movq %rax, %rdi
xorl %esi, %esi
callq 0x5180
leaq 0x10(%rbx), %r13
leaq 0x20(%rbx), %rax
movq %rax, 0x10(%rbx)
movb %r14b, 0x20(%rbx)
leaq 0x30(%rbx), %r12
leaq 0x40(%rbx), %rax
movq %rax, 0x30(%rbx)
movb %r14b, 0x40(%rbx)
leaq 0x60(%rbx), %rax
movq %rax, 0x50(%rbx)
movb %r14b, 0x60(%rbx)
cmpl $0x2, %ebp
jne 0xd843
movq 0x60c31(%rip), %rax     # 0x6e3f0
movq (%rax), %rdi
xorl %esi, %esi
movl $0xfffffe0c, %edx       # imm = 0xFFFFFE0C
movl $0xfffffe0c, %ecx       # imm = 0xFFFFFE0C
movl $0x1, %r8d
callq 0xb8a5
movq %rax, (%rbx)
movl $0x1, 0x8(%rbx)
movss 0xa8a5(%rip), %xmm0     # 0x18090
movups %xmm0, 0x80(%rbx)
movaps 0xa9d7(%rip), %xmm0     # 0x181d0
movups %xmm0, 0x70(%rbx)
movb $0x0, 0x98(%rbx)
movq 0x18(%rbx), %rdx
leaq 0xb4fb(%rip), %rcx      # 0x18d0a
movl $0x12, %r8d
movq %r13, %rdi
xorl %esi, %esi
callq 0x5380
movq 0x38(%rbx), %rdx
leaq 0xb4f3(%rip), %rcx      # 0x18d1d
movl $0x4a, %r8d
movq %r12, %rdi
xorl %esi, %esi
callq 0x5380
movb $0x43, 0xc(%rbx)
jmp 0xd9ac
movl %ebp, 0x70(%rbx)
movl $0x1, 0x8(%rbx)
movq $0x0, 0x84(%rbx)
movl $0x0, 0x8c(%rbx)
movaps 0xa947(%rip), %xmm0     # 0x181b0
movups %xmm0, 0x74(%rbx)
movb $0x0, 0x98(%rbx)
cmpl $0x5, %ebp
ja 0xd8be
movl %ebp, %eax
leaq 0xa95e(%rip), %rcx      # 0x181e0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0xb3c3(%rip), %rcx      # 0x18c55
movl $0xd, %r8d
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x5380
movb $0x41, 0xc(%rbx)
movq 0x38(%rbx), %rdx
leaq 0xb3b0(%rip), %rcx      # 0x18c63
movl $0x48, %r8d
jmp 0xd968
movq %rbx, %rdi
callq 0x5230
xorl %ebx, %ebx
jmp 0xd9eb
leaq 0xb494(%rip), %rcx      # 0x18d68
movl $0xf, %r8d
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x5380
movq 0x38(%rbx), %rdx
leaq 0xb487(%rip), %rcx      # 0x18d78
movl $0x3d, %r8d
movq %r12, %rdi
xorl %esi, %esi
callq 0x5380
movb $0x44, 0xc(%rbx)
jmp 0xd9ac
leaq 0xb39b(%rip), %rcx      # 0x18cac
movl $0xe, %r8d
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x5380
movb $0x42, 0xc(%rbx)
movq 0x38(%rbx), %rdx
leaq 0xb389(%rip), %rcx      # 0x18cbb
movl $0x4e, %r8d
jmp 0xd968
leaq 0xb475(%rip), %rcx      # 0x18db6
movl $0xf, %r8d
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x5380
movb $0x45, 0xc(%rbx)
movq 0x38(%rbx), %rdx
leaq 0xb464(%rip), %rcx      # 0x18dc6
movl $0x43, %r8d
movq %r12, %rdi
xorl %esi, %esi
callq 0x5380
jmp 0xd9ac
leaq 0xb48f(%rip), %rcx      # 0x18e0a
movl $0xb, %r8d
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x5380
movq 0x38(%rbx), %rdx
leaq 0xb47e(%rip), %rcx      # 0x18e16
movl $0x57, %r8d
movq %r12, %rdi
xorl %esi, %esi
callq 0x5380
movb $0x46, 0xc(%rbx)
movq %rbx, %rdi
addq $0x50, %rdi
movq %r12, %rsi
callq 0x5170
testb %r15b, %r15b
je 0xd9dc
movq 0x60b19(%rip), %rax     # 0x6e4e0
movq 0x20(%rax), %rax
movq %rax, 0x90(%rbx)
movq %rbx, %rdi
callq 0xb712
jmp 0xd9eb
movq %rbx, %rdi
movl (%rsp), %esi
movl 0x4(%rsp), %edx
callq 0xb5ec
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq