// File: /workspace/github_cpp_makefile_star2_O1/MichaelXanth[P]RPG_Game/Market/Market.cpp
// Function: Market::AddPotions(int const&)
void Market::AddPotions(const int& num)
{
    string potionName;
    Potion* tmpPotion;

    for (int i = 0; i < num; i++)
    {
        unsigned int level;
        float posibility;

        if ( ((double)rand() / RAND_MAX) < 0.7 )
            level = rand() % 30 + 1;
        else
            level = rand() % 70 + 31;

        potionName = name.potionsNames[rand() % name.potionsNames.size()];

        if ((double)(posibility = rand() % 100) < 100.0 / 3)
            tmpPotion = new Potion(potionName , ((rand() % 2) + 2) * level , level , (unsigned int)(((rand() % 6) + 1.0) * (level / 10.0) + 1) , 0 , 0);
        else if ((double)posibility < 200.0 / 3)
            tmpPotion = new Potion(potionName , ((rand() % 2) + 2) * level , level , 0 , (unsigned int)(((rand() % 6) + 1.0) * (level / 10.0) + 1) , 0);
        else
            tmpPotion = new Potion(potionName , ((rand() % 2) + 2) * level , level , 0 , 0 , (float)(3.0 * ((level / 25.0) + 1)) / 100.0);

        potionsArray.push_back(tmpPotion);

        if (minItemPrice > tmpPotion->GetPrice())
            minItemPrice = tmpPotion->GetPrice();
    }

    if (mostItems < potionsArray.size())
        mostItems = potionsArray.size();

    if (minPrice > minItemPrice)
        minPrice = minItemPrice;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %rbx
leaq -0x58(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
cmpl $0x0, (%rsi)
jle 0x1a420
movq %rsi, %r14
leaq 0x108(%rbx), %rax
movq %rax, -0x70(%rbp)
movl $0x1e, %r12d
xorl %r15d, %r15d
callq 0x3060
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0xa149(%rip), %xmm0     # 0x24260
movsd %xmm0, -0x78(%rbp)
callq 0x3060
movsd 0x8ee7(%rip), %xmm0     # 0x23010
movsd -0x78(%rbp), %xmm1
ucomisd %xmm1, %xmm0
movl $0x46, %ecx
cmoval %r12d, %ecx
cltd
idivl %ecx
leal 0x1(%rdx), %eax
addl $0x1f, %edx
ucomisd %xmm1, %xmm0
cmoval %eax, %edx
movl %edx, -0x2c(%rbp)
callq 0x3060
cltq
movq 0x48(%rbx), %rsi
movq 0x50(%rbx), %rcx
subq %rsi, %rcx
sarq $0x5, %rcx
xorl %edx, %edx
divq %rcx
shlq $0x5, %rdx
addq %rdx, %rsi
leaq -0x68(%rbp), %rdi
callq 0x30c0
callq 0x3060
cltq
imulq $0x51eb851f, %rax, %rcx # imm = 0x51EB851F
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x25, %rcx
addl %edx, %ecx
imull $0x64, %ecx, %ecx
subl %ecx, %eax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0xcf54(%rip), %xmm1     # 0x27100
ucomisd %xmm0, %xmm1
jbe 0x1a265
movl $0x40, %edi
callq 0x31a0
movq %rax, %r13
callq 0x3060
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
andl $-0x2, %ecx
negl %ecx
addl %ecx, %eax
addl $0x2, %eax
imull -0x2c(%rbp), %eax
movl %eax, -0x3c(%rbp)
callq 0x3060
cltq
imulq $0x2aaaaaab, %rax, %rcx # imm = 0x2AAAAAAB
movq %rcx, %rdx
shrq $0x3f, %rdx
shrq $0x20, %rcx
addl %edx, %ecx
addl %ecx, %ecx
leal (%rcx,%rcx,2), %ecx
negl %ecx
addl %ecx, %eax
incl %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movl -0x2c(%rbp), %eax
xorps %xmm1, %xmm1
cvtsi2sd %rax, %xmm1
divsd 0xa0d0(%rip), %xmm1     # 0x242f0
mulsd %xmm0, %xmm1
addsd 0xceec(%rip), %xmm1     # 0x27118
cvttsd2si %xmm1, %rax
movl %eax, -0x38(%rbp)
xorl %eax, %eax
movl %eax, -0x34(%rbp)
movl %eax, -0x30(%rbp)
leaq -0x30(%rbp), %rax
movq %rax, (%rsp)
movq %r13, %rdi
leaq -0x68(%rbp), %rsi
leaq -0x3c(%rbp), %rdx
leaq -0x2c(%rbp), %rcx
leaq -0x38(%rbp), %r8
leaq -0x34(%rbp), %r9
callq 0x106b0
jmp 0x1a3bc
movsd 0xce9b(%rip), %xmm1     # 0x27108
ucomisd %xmm0, %xmm1
jbe 0x1a333
movl $0x40, %edi
callq 0x31a0
movq %rax, %r13
callq 0x3060
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
andl $-0x2, %ecx
negl %ecx
addl %ecx, %eax
addl $0x2, %eax
imull -0x2c(%rbp), %eax
movl %eax, -0x3c(%rbp)
xorl %r12d, %r12d
movl %r12d, -0x38(%rbp)
callq 0x3060
cltq
imulq $0x2aaaaaab, %rax, %rcx # imm = 0x2AAAAAAB
movq %rcx, %rdx
shrq $0x3f, %rdx
shrq $0x20, %rcx
addl %edx, %ecx
addl %ecx, %ecx
leal (%rcx,%rcx,2), %ecx
negl %ecx
addl %ecx, %eax
incl %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movl -0x2c(%rbp), %eax
xorps %xmm1, %xmm1
cvtsi2sd %rax, %xmm1
divsd 0xa008(%rip), %xmm1     # 0x242f0
mulsd %xmm0, %xmm1
addsd 0xce24(%rip), %xmm1     # 0x27118
cvttsd2si %xmm1, %rax
movl %eax, -0x34(%rbp)
movl %r12d, -0x30(%rbp)
leaq -0x30(%rbp), %rax
movq %rax, (%rsp)
movq %r13, %rdi
leaq -0x68(%rbp), %rsi
leaq -0x3c(%rbp), %rdx
leaq -0x2c(%rbp), %rcx
leaq -0x38(%rbp), %r8
leaq -0x34(%rbp), %r9
callq 0x106b0
movq %r13, -0x48(%rbp)
movl $0x1e, %r12d
jmp 0x1a3c0
movl $0x40, %edi
callq 0x31a0
movq %rax, %r13
callq 0x3060
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
andl $-0x2, %ecx
negl %ecx
addl %ecx, %eax
addl $0x2, %eax
movl -0x2c(%rbp), %ecx
xorps %xmm0, %xmm0
cvtsi2sd %rcx, %xmm0
imull %eax, %ecx
movl %ecx, -0x3c(%rbp)
xorl %eax, %eax
movl %eax, -0x38(%rbp)
movl %eax, -0x34(%rbp)
divsd 0xcd99(%rip), %xmm0     # 0x27110
addsd 0xcd99(%rip), %xmm0     # 0x27118
mulsd 0xcd99(%rip), %xmm0     # 0x27120
cvtsd2ss %xmm0, %xmm0
divss 0xcd95(%rip), %xmm0     # 0x27128
movss %xmm0, -0x30(%rbp)
leaq -0x30(%rbp), %rax
movq %rax, (%rsp)
movq %r13, %rdi
leaq -0x68(%rbp), %rsi
leaq -0x3c(%rbp), %rdx
leaq -0x2c(%rbp), %rcx
leaq -0x38(%rbp), %r8
leaq -0x34(%rbp), %r9
callq 0x106b0
movq %r13, -0x48(%rbp)
movq 0x110(%rbx), %rsi
cmpq 0x118(%rbx), %rsi
je 0x1a3e1
movq -0x48(%rbp), %rax
movq %rax, (%rsi)
addq $0x8, 0x110(%rbx)
jmp 0x1a3ee
movq -0x70(%rbp), %rdi
leaq -0x48(%rbp), %rdx
callq 0x180d4
movl 0x1e4(%rbx), %r13d
movq -0x48(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
cmpl %eax, %r13d
jbe 0x1a414
movq -0x48(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movl %eax, 0x1e4(%rbx)
incl %r15d
cmpl (%r14), %r15d
jl 0x1a103
movl 0x1ec(%rbx), %ecx
movq 0x110(%rbx), %rax
subq 0x108(%rbx), %rax
sarq $0x3, %rax
cmpq %rcx, %rax
jbe 0x1a443
movl %eax, 0x1ec(%rbx)
movl 0x1e4(%rbx), %eax
cmpl %eax, 0x1e8(%rbx)
jbe 0x1a457
movl %eax, 0x1e8(%rbx)
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x1a469
callq 0x3170
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1a47c
jmp 0x1a47c
movq %rax, %rbx
movq %r13, %rdi
callq 0x3170
jmp 0x1a48c
movq %rax, %rbx
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x1a49e
callq 0x3170
movq %rbx, %rdi
callq 0x32f0