// File: /workspace/github_c_makefile_star2_O0/beejjorgensen[P]conquest/conqin.c
// Function: assign_planets
void assign_planets(tstar *Ustar0, int starnum)
{
    int i1, nplanets;
    tplanet *pplanet;
    tstar ustar;

    ustar = *Ustar0;
    nplanets = rnd(4) - 2;
    if (nplanets < 0)
        nplanets = 1;
    if (nplanets == 0)
        ustar.first_planet = nil;
    else {
        new(pplanet);
        ustar.first_planet = pplanet;
        for (i1 = 1; i1 <= nplanets; i1++) {
            pplanet->number = rnd(2) + (2 * i1) - 2;
            if (rnd(4) > 2)
                pplanet->capacity = 10 * (rnd(4) + 2);
            else
                pplanet->capacity = 5 * rnd(3);
            pplanet->psee_capacity = pplanet->capacity;
            pplanet->team = none;
            pplanet->inhabitants = 0;
            pplanet->iu = 0;
            pplanet->mb = 0;
            pplanet->amb = 0;
            pplanet->conquered = false;
            pplanet->under_attack = false;
            pplanet->esee_team = none;
            pplanet->esee_def = 1;
            pplanet->pstar = starnum;
            if (i1 == nplanets)
                pplanet->next = nil;
            else {
                new(pplanet->next);
                pplanet = pplanet->next;
            }
        }
    };
    *Ustar0 = ustar;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rcx
movq %rcx, -0x38(%rbp)
movq 0x8(%rax), %rcx
movq %rcx, -0x30(%rbp)
movq 0x10(%rax), %rax
movq %rax, -0x28(%rbp)
movl $0x4, %edi
callq 0x6a70
subl $0x2, %eax
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jge 0x5837
movl $0x1, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jne 0x584a
movq $0x0, -0x30(%rbp)
jmp 0x598f
movl $0x40, %edi
callq 0x2080
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
movl $0x1, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0x14(%rbp), %eax
jg 0x598d
movl $0x2, %edi
callq 0x6a70
movl %eax, %ecx
movl -0x10(%rbp), %eax
shll %eax
addl %eax, %ecx
subl $0x2, %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movl $0x4, %edi
callq 0x6a70
cmpl $0x2, %eax
jle 0x58b7
movl $0x4, %edi
callq 0x6a70
addl $0x2, %eax
imull $0xa, %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x4(%rax)
jmp 0x58cb
movl $0x3, %edi
callq 0x6a70
imull $0x5, %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x20(%rbp), %rax
movl 0x4(%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x20(%rbp), %rax
movl $0x2, 0xc(%rax)
movq -0x20(%rbp), %rax
movl $0x0, 0x10(%rax)
movq -0x20(%rbp), %rax
movl $0x0, 0x14(%rax)
movq -0x20(%rbp), %rax
movl $0x0, 0x18(%rax)
movq -0x20(%rbp), %rax
movl $0x0, 0x1c(%rax)
movq -0x20(%rbp), %rax
movl $0x0, 0x20(%rax)
movq -0x20(%rbp), %rax
movl $0x0, 0x24(%rax)
movq -0x20(%rbp), %rax
movl $0x2, 0x28(%rax)
movq -0x20(%rbp), %rax
movl $0x1, 0x2c(%rax)
movl -0xc(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x30(%rax)
movl -0x10(%rbp), %eax
cmpl -0x14(%rbp), %eax
jne 0x595c
movq -0x20(%rbp), %rax
movq $0x0, 0x38(%rax)
jmp 0x597d
movl $0x40, %edi
callq 0x2080
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x20(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x597f
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x5867
jmp 0x598f
movq -0x8(%rbp), %rax
movq -0x38(%rbp), %rcx
movq %rcx, (%rax)
movq -0x30(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x28(%rbp), %rcx
movq %rcx, 0x10(%rax)
addq $0x40, %rsp
popq %rbp
retq