// File: /workspace/github_c_makefile_star2_O0/beejjorgensen[P]conquest/conq1.c
// Function: EN2MY_attack
void EN2MY_attack(int starnum)
{
    int attack_factors, def_factors;
    float odds, best_score;
    struct stplanet *pplanet, *best_planet;
    int en_tf, i;
    boolean first[8];
    for (i = 1; i <= 7; i++)
        first[i] = true;
    en_tf = 1;
    while ((tf[ENEMY][en_tf].dest != starnum) ||
           (tf[ENEMY][en_tf].eta != 0))
        en_tf = en_tf + 1;
    do {
        attack_factors = tf[ENEMY][en_tf].c + 6 * tf[ENEMY][en_tf].b;
        best_planet = nil;
        best_score = 1000;
        pplanet = stars[starnum].first_planet;
        while (pplanet != nil) {
            if (pplanet->team == player) {
                def_factors = pplanet->esee_def;
                odds = (float) def_factors / attack_factors;
                if (pplanet->capacity > 30)
                    odds = (odds - 2) * pplanet->capacity;
                else
                    odds = (odds - 1.5) * pplanet->capacity;
                if (odds < best_score) {
                    best_score = odds;
                    best_planet = pplanet;
                };
            };
            pplanet = pplanet->next;
        };
        if (best_score < 0) {
            cle3r_left();
            point(1, 19);
            printw("Enemy attacks: %c%d", starnum + 'A' - 1,
                   best_planet->number);
            point(50, 1);
            pr5nt_star(starnum);
            clear_field();
            pause();
            fire_salvo(ENEMY, &tf[ENEMY][en_tf], 0, best_planet,
                       first[best_planet->number]);
            first[best_planet->number] = false;
            zero_tf(ENEMY, en_tf);
            best_planet->esee_def = best_planet->mb + 6 * best_planet->amb;
            pause();
        };
    }
    while (best_score < 0 && any_bc(ENEMY, starnum));
    revolt(starnum);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movl %edi, -0x4(%rbp)
movl $0x1, -0x30(%rbp)
cmpl $0x7, -0x30(%rbp)
jg 0x2bff
movslq -0x30(%rbp), %rax
movl $0x1, -0x50(%rbp,%rax,4)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x2be2
movl $0x1, -0x2c(%rbp)
movslq -0x2c(%rbp), %rcx
leaq 0x10d8f(%rip), %rax     # 0x139a0
imulq $0x34, %rcx, %rcx
addq %rcx, %rax
movl 0x20(%rax), %ecx
movb $0x1, %al
cmpl -0x4(%rbp), %ecx
movb %al, -0x51(%rbp)
jne 0x2c41
movslq -0x2c(%rbp), %rcx
leaq 0x10d70(%rip), %rax     # 0x139a0
imulq $0x34, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0x24(%rax)
setne %al
movb %al, -0x51(%rbp)
movb -0x51(%rbp), %al
testb $0x1, %al
jne 0x2c4a
jmp 0x2c55
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x2c06
jmp 0x2c57
movslq -0x2c(%rbp), %rcx
leaq 0x10d3e(%rip), %rax     # 0x139a0
imulq $0x34, %rcx, %rcx
addq %rcx, %rax
movl 0x18(%rax), %eax
movslq -0x2c(%rbp), %rdx
leaq 0x10d29(%rip), %rcx     # 0x139a0
imulq $0x34, %rdx, %rdx
addq %rdx, %rcx
imull $0x6, 0x1c(%rcx), %ecx
addl %ecx, %eax
movl %eax, -0x8(%rbp)
movq $0x0, -0x28(%rbp)
movss 0xb391(%rip), %xmm0     # 0xe028
movss %xmm0, -0x14(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0x117f9(%rip), %rax     # 0x144a0
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x2d7a
movq -0x20(%rbp), %rax
cmpl $0x1, 0xc(%rax)
jne 0x2d69
movq -0x20(%rbp), %rax
movl 0x2c(%rax), %eax
movl %eax, -0xc(%rbp)
cvtsi2ssl -0xc(%rbp), %xmm0
cvtsi2ssl -0x8(%rbp), %xmm1
divss %xmm1, %xmm0
movss %xmm0, -0x10(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x1e, 0x4(%rax)
jle 0x2d1b
movss -0x10(%rbp), %xmm0
movss 0xb329(%rip), %xmm1     # 0xe02c
subss %xmm1, %xmm0
movq -0x20(%rbp), %rax
cvtsi2ssl 0x4(%rax), %xmm1
mulss %xmm1, %xmm0
movss %xmm0, -0x10(%rbp)
jmp 0x2d46
movss -0x10(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0xb2f4(%rip), %xmm1     # 0xe020
subsd %xmm1, %xmm0
movq -0x20(%rbp), %rax
cvtsi2sdl 0x4(%rax), %xmm1
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x10(%rbp)
movss -0x10(%rbp), %xmm1
movss -0x14(%rbp), %xmm0
ucomiss %xmm1, %xmm0
jbe 0x2d67
movss -0x10(%rbp), %xmm0
movss %xmm0, -0x14(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x2d69
movq -0x20(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x2cb6
xorps %xmm0, %xmm0
ucomiss -0x14(%rbp), %xmm0
jbe 0x2e3a
callq 0xa720
movl $0x1, %edi
movl $0x13, %esi
callq 0x69f0
movl -0x4(%rbp), %esi
addl $0x41, %esi
subl $0x1, %esi
movq -0x28(%rbp), %rax
movl (%rax), %edx
leaq 0xb3a2(%rip), %rdi      # 0xe153
movb $0x0, %al
callq 0x2030
movl $0x32, %edi
movl $0x1, %esi
callq 0x69f0
movl -0x4(%rbp), %edi
callq 0xaeb0
callq 0xa6a0
callq 0xac60
movslq -0x2c(%rbp), %rax
leaq 0x10bbc(%rip), %rsi     # 0x139a0
imulq $0x34, %rax, %rax
addq %rax, %rsi
movq -0x28(%rbp), %rcx
movq -0x28(%rbp), %rax
movslq (%rax), %rax
movl -0x50(%rbp,%rax,4), %r8d
xorl %edx, %edx
movl %edx, %edi
callq 0x48a0
movq -0x28(%rbp), %rax
movslq (%rax), %rax
movl $0x0, -0x50(%rbp,%rax,4)
movl -0x2c(%rbp), %esi
xorl %edi, %edi
callq 0x4280
movq -0x28(%rbp), %rax
movl 0x18(%rax), %ecx
movq -0x28(%rbp), %rax
imull $0x6, 0x1c(%rax), %eax
addl %eax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x2c(%rax)
callq 0xac60
jmp 0x2e3c
xorl %eax, %eax
xorps %xmm0, %xmm0
ucomiss -0x14(%rbp), %xmm0
movb %al, -0x52(%rbp)
jbe 0x2e5d
movl -0x4(%rbp), %esi
xorl %edi, %edi
callq 0x2250
cmpl $0x0, %eax
setne %al
movb %al, -0x52(%rbp)
movb -0x52(%rbp), %al
testb $0x1, %al
jne 0x2c57
movl -0x4(%rbp), %edi
callq 0x5620
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)