// File: /workspace/github_cpp_makefile_star2_O1/essarrdee[P]mutantaliens/mutantaliens.cpp
// Function: calculate_score()
int calculate_score()
{
	int score = 0;
	score += died ? -1000 : 1000;
	score += left_ship ? 50 : -50;
	score += ran ? 75 : -75;
	score += entered_building_destroyed_transmitter ? 100 : -100;
	score += destroyed_transmitter ? 200 : -200;
	score += returned_to_ship ? 400 : -400;
	score += closed_doors ? 600 : -600;
	score += left_planet ? 800 : -800;

	score += count_inv_devices(LOW_EXPLOSIVE)*100;
	score += count_inv_devices(HIGH_EXPLOSIVE)*400;
	score += count_inv_devices(HOLOGRAM_PROJECTOR)*50;
	score += count_inv_devices(NOISE_GENERATOR)*50;
	score += count_inv_devices(SCENT_GENERATOR)*50;
	score += count_inv_devices(BRAIN_SLICE)*50;

	score += ammo[PISTOL]*5;
	score += ammo[RIFLE]*3;
	score += ammo[CANNON]*25;
	score -= turn_count;
	score *= difficulty;
	return score;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movb 0x1031f(%rip), %al      # 0x21330
movb 0x10319(%rip), %r10b    # 0x21331
movb 0x10313(%rip), %r9b     # 0x21332
movb 0x1030d(%rip), %r8b     # 0x21333
movb 0x10307(%rip), %dil     # 0x21334
movb 0x10301(%rip), %sil     # 0x21335
movb 0x102fc(%rip), %cl      # 0x21336
movb %cl, -0x2(%rsp)
movb 0x102f3(%rip), %cl      # 0x21337
movb %cl, -0x1(%rsp)
movq 0xb5401(%rip), %r14     # 0xc6450
movq (%r14), %rbx
xorl %r11d, %r11d
movl $0x8, %r15d
movq (%rbx,%r15), %rcx
subq -0x8(%rbx,%r15), %rcx
shrq $0x3, %rcx
addl %ecx, %r11d
addq $0x18, %r15
cmpq $0x50, %r15
jne 0x1105b
movq 0x18(%r14), %r15
xorl %ebx, %ebx
movl $0x8, %r12d
movq (%r15,%r12), %rcx
subq -0x8(%r15,%r12), %rcx
shrq $0x3, %rcx
addl %ecx, %ebx
addq $0x18, %r12
cmpq $0x50, %r12
jne 0x11081
movq 0x30(%r14), %r15
xorl %ebp, %ebp
movl $0x8, %r12d
movq (%r15,%r12), %rcx
subq -0x8(%r15,%r12), %rcx
shrq $0x3, %rcx
addl %ecx, %ebp
addq $0x18, %r12
cmpq $0x50, %r12
jne 0x110a6
movq 0x48(%r14), %r12
xorl %r15d, %r15d
movl $0x8, %r13d
movq (%r12,%r13), %rcx
subq -0x8(%r12,%r13), %rcx
shrq $0x3, %rcx
addl %ecx, %r15d
addq $0x18, %r13
cmpq $0x50, %r13
jne 0x110cc
movq 0x60(%r14), %r13
xorl %r12d, %r12d
movl $0x8, %ecx
movq (%r13,%rcx), %rdx
subq -0x8(%r13,%rcx), %rdx
shrq $0x3, %rdx
addl %edx, %r12d
addq $0x18, %rcx
cmpq $0x50, %rcx
jne 0x110f2
movq 0x78(%r14), %r14
xorl %r13d, %r13d
movl $0x8, %ecx
movq (%r14,%rcx), %rdx
subq -0x8(%r14,%rcx), %rdx
shrq $0x3, %rdx
addl %edx, %r13d
addq $0x18, %rcx
cmpq $0x50, %rcx
jne 0x11119
testb %al, %al
movl $0xfffffc18, %eax       # imm = 0xFFFFFC18
movl $0x3e8, %r14d           # imm = 0x3E8
cmovnel %eax, %r14d
imull $0x64, %r11d, %r11d
imull $0x190, %ebx, %eax      # imm = 0x190
addl %ebp, %r15d
addl %r12d, %r15d
addl %r13d, %r15d
imull $0x32, %r15d, %ebx
leal -0x32(%r14), %ecx
addl $0x32, %r14d
testb %r10b, %r10b
cmovel %ecx, %r14d
leal -0x4b(%r14), %ecx
addl $0x4b, %r14d
testb %r9b, %r9b
cmovel %ecx, %r14d
leal -0x64(%r14), %ecx
addl $0x64, %r14d
testb %r8b, %r8b
cmovel %ecx, %r14d
leal -0xc8(%r14), %ecx
addl $0xc8, %r14d
testb %dil, %dil
cmovel %ecx, %r14d
leal 0x190(%r14), %ecx
addl $0xfffffe70, %r14d      # imm = 0xFFFFFE70
testb %sil, %sil
cmovnel %ecx, %r14d
leal -0x258(%r14), %ecx
addl $0x258, %r14d           # imm = 0x258
cmpb $0x0, -0x2(%rsp)
cmovel %ecx, %r14d
leal -0x320(%r14), %ecx
addl $0x320, %r14d           # imm = 0x320
cmpb $0x0, -0x1(%rsp)
movl 0x5d016(%rip), %edx     # 0x6e1f8
leal (%rdx,%rdx,4), %edx
movl 0x5d011(%rip), %esi     # 0x6e1fc
leal (%rsi,%rsi,2), %esi
movl 0x5d00c(%rip), %edi     # 0x6e200
leal (%rdi,%rdi,4), %edi
leal (%rdi,%rdi,4), %edi
cmovel %ecx, %r14d
addl %r11d, %eax
addl %ebx, %eax
addl %edx, %eax
addl %esi, %eax
addl %edi, %eax
addl %r14d, %eax
subl 0x10112(%rip), %eax     # 0x21324
imull 0x10103(%rip), %eax     # 0x2131c
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq