// File: grmauri[P]pmm/pmm.cpp
// Function: heuConAleGul(tSolucao&, int)
void heuConAleGul(Solucao &s, const int percentual)
{
    int tam, pos, aux;
    int vetAux[MAX_OBJ];
    memcpy(&vetAux, &vetIndObjOrd, sizeof(vetIndObjOrd));
    tam = MAX(1, (percentual / 100.0) * numObj);
    for(int j = 0; j < tam; j++)
    {
        pos = j + rand()%(numObj - j);
        aux = vetAux[pos];
        vetAux[pos] = vetAux[j];
        vetAux[j] = aux;
    }
    memset(&s.vetPesMoc, 0, sizeof(s.vetPesMoc));
    memset(&s.vetIdMocObj, -1, sizeof(s.vetIdMocObj));
    for(int j = 0; j < numObj; j++)
        for(int i = 0; i < numMoc; i++)
            if(s.vetPesMoc[i] + vetPesObj[vetAux[j]] <= vetCapMoc[i])
            {
                s.vetIdMocObj[vetAux[j]] = i;
                s.vetPesMoc[i] += vetPesObj[vetAux[j]];
                break;
            }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x810, %rsp            # imm = 0x810
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
leaq -0x7f0(%rbp), %rdi
leaq 0x6820(%rip), %rsi      # 0xb220
movl $0x7d0, %edx            # imm = 0x7D0
callq 0x2140
cvtsi2sdl -0xc(%rbp), %xmm1
movsd 0x2629(%rip), %xmm0     # 0x7040
divsd %xmm0, %xmm1
cvtsi2sdl 0x5781(%rip), %xmm0 # 0xa1a4
mulsd %xmm0, %xmm1
movsd 0x2609(%rip), %xmm0     # 0x7038
ucomisd %xmm1, %xmm0
jbe 0x4a47
movsd 0x25fb(%rip), %xmm0     # 0x7038
movsd %xmm0, -0x808(%rbp)
jmp 0x4a6c
cvtsi2sdl -0xc(%rbp), %xmm0
movsd 0x25ec(%rip), %xmm1     # 0x7040
divsd %xmm1, %xmm0
cvtsi2sdl 0x5744(%rip), %xmm1 # 0xa1a4
mulsd %xmm1, %xmm0
movsd %xmm0, -0x808(%rbp)
movsd -0x808(%rbp), %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x10(%rbp)
movl $0x0, -0x7f4(%rbp)
movl -0x7f4(%rbp), %eax
cmpl -0x10(%rbp), %eax
jge 0x4b04
movl -0x7f4(%rbp), %eax
movl %eax, -0x80c(%rbp)
callq 0x2070
movl 0x56fd(%rip), %ecx      # 0xa1a4
subl -0x7f4(%rbp), %ecx
cltd
idivl %ecx
movl -0x80c(%rbp), %eax
addl %edx, %eax
movl %eax, -0x14(%rbp)
movslq -0x14(%rbp), %rax
movl -0x7f0(%rbp,%rax,4), %eax
movl %eax, -0x18(%rbp)
movslq -0x7f4(%rbp), %rax
movl -0x7f0(%rbp,%rax,4), %ecx
movslq -0x14(%rbp), %rax
movl %ecx, -0x7f0(%rbp,%rax,4)
movl -0x18(%rbp), %ecx
movslq -0x7f4(%rbp), %rax
movl %ecx, -0x7f0(%rbp,%rax,4)
movl -0x7f4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7f4(%rbp)
jmp 0x4a85
movq -0x8(%rbp), %rdi
xorl %esi, %esi
movl $0xc8, %edx
callq 0x20d0
movq -0x8(%rbp), %rdi
addq $0xc8, %rdi
movl $0xff, %esi
movl $0x7d0, %edx            # imm = 0x7D0
callq 0x20d0
movl $0x0, -0x7f8(%rbp)
movl -0x7f8(%rbp), %eax
cmpl 0x5660(%rip), %eax      # 0xa1a4
jge 0x4c18
movl $0x0, -0x7fc(%rbp)
movl -0x7fc(%rbp), %eax
cmpl 0x5648(%rip), %eax      # 0xa1a8
jge 0x4c02
movq -0x8(%rbp), %rax
movslq -0x7fc(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movslq -0x7f8(%rbp), %rcx
movslq -0x7f0(%rbp,%rcx,4), %rdx
leaq 0x5df6(%rip), %rcx      # 0xa980
addl (%rcx,%rdx,4), %eax
movslq -0x7fc(%rbp), %rdx
leaq 0x65b5(%rip), %rcx      # 0xb150
cmpl (%rcx,%rdx,4), %eax
jg 0x4bec
movl -0x7fc(%rbp), %edx
movq -0x8(%rbp), %rax
movslq -0x7f8(%rbp), %rcx
movslq -0x7f0(%rbp,%rcx,4), %rcx
movl %edx, 0xc8(%rax,%rcx,4)
movslq -0x7f8(%rbp), %rax
movslq -0x7f0(%rbp,%rax,4), %rcx
leaq 0x5daa(%rip), %rax      # 0xa980
movl (%rax,%rcx,4), %edx
movq -0x8(%rbp), %rax
movslq -0x7fc(%rbp), %rcx
addl (%rax,%rcx,4), %edx
movl %edx, (%rax,%rcx,4)
jmp 0x4c02
jmp 0x4bee
movl -0x7fc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7fc(%rbp)
jmp 0x4b54
jmp 0x4c04
movl -0x7f8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7f8(%rbp)
jmp 0x4b38
addq $0x810, %rsp            # imm = 0x810
popq %rbp
retq
nopw %cs:(%rax,%rax)