// File: /workspace/github_cpp_makefile_star2_O2/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 %rsi, %r14
movq %rdi, %rbx
leaq -0x68(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x108(%rdi), %rax
movq %rax, -0x50(%rbp)
xorl %r15d, %r15d
leaq -0x78(%rbp), %r12
cmpl (%r14), %r15d
jge 0x13ae2
callq 0x3060
cvtsi2sd %eax, %xmm0
divsd 0x79d7(%rip), %xmm0     # 0x1b260
movsd %xmm0, -0x58(%rbp)
callq 0x3060
movsd 0x6775(%rip), %xmm0     # 0x1a010
movsd -0x58(%rbp), %xmm1
ucomisd %xmm1, %xmm0
pushq $0x46
popq %rcx
pushq $0x1e
popq %rdx
cmoval %edx, %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
movq %r12, %rdi
callq 0x30f0
callq 0x3060
cltd
pushq $0x64
popq %rcx
idivl %ecx
cvtsi2ss %edx, %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0xa82b(%rip), %xmm1     # 0x1e130
ucomisd %xmm0, %xmm1
jbe 0x13994
pushq $0x40
popq %rdi
callq 0x31e0
movq %rax, %r13
callq 0x3060
cltd
pushq $0x2
popq %rcx
idivl %ecx
addl $0x2, %edx
imull -0x2c(%rbp), %edx
movl %edx, -0x3c(%rbp)
callq 0x3060
cltd
pushq $0x6
popq %rcx
idivl %ecx
incl %edx
cvtsi2sd %edx, %xmm0
movl -0x2c(%rbp), %eax
cvtsi2sd %rax, %xmm1
divsd 0x79a0(%rip), %xmm1     # 0x1b2f0
mulsd %xmm0, %xmm1
addsd 0xa7ec(%rip), %xmm1     # 0x1e148
cvttsd2si %xmm1, %rax
andl $0x0, -0x34(%rbp)
movl %eax, -0x38(%rbp)
andl $0x0, -0x30(%rbp)
leaq -0x30(%rbp), %rax
movq %rax, (%rsp)
movq %r13, %rdi
movq %r12, %rsi
leaq -0x3c(%rbp), %rdx
leaq -0x2c(%rbp), %rcx
leaq -0x38(%rbp), %r8
leaq -0x34(%rbp), %r9
callq 0xcd00
jmp 0x13aa3
movsd 0xa79c(%rip), %xmm1     # 0x1e138
ucomisd %xmm0, %xmm1
jbe 0x13a28
pushq $0x40
popq %rdi
callq 0x31e0
movq %rax, %r13
callq 0x3060
cltd
pushq $0x2
popq %rcx
idivl %ecx
addl $0x2, %edx
imull -0x2c(%rbp), %edx
movl %edx, -0x3c(%rbp)
andl $0x0, -0x38(%rbp)
callq 0x3060
cltd
pushq $0x6
popq %rcx
idivl %ecx
incl %edx
cvtsi2sd %edx, %xmm0
movl -0x2c(%rbp), %eax
cvtsi2sd %rax, %xmm1
divsd 0x7905(%rip), %xmm1     # 0x1b2f0
mulsd %xmm0, %xmm1
addsd 0xa751(%rip), %xmm1     # 0x1e148
cvttsd2si %xmm1, %rax
movl %eax, -0x34(%rbp)
andl $0x0, -0x30(%rbp)
leaq -0x30(%rbp), %rax
movq %rax, (%rsp)
movq %r13, %rdi
movq %r12, %rsi
leaq -0x3c(%rbp), %rdx
leaq -0x2c(%rbp), %rcx
leaq -0x38(%rbp), %r8
leaq -0x34(%rbp), %r9
callq 0xcd00
jmp 0x13aa3
pushq $0x40
popq %rdi
callq 0x31e0
movq %rax, %r13
callq 0x3060
cltd
pushq $0x2
popq %rcx
idivl %ecx
addl $0x2, %edx
movl -0x2c(%rbp), %eax
cvtsi2sd %rax, %xmm0
andl $0x0, -0x38(%rbp)
imull %edx, %eax
andl $0x0, -0x34(%rbp)
movl %eax, -0x3c(%rbp)
divsd 0xa6e1(%rip), %xmm0     # 0x1e140
addsd 0xa6e1(%rip), %xmm0     # 0x1e148
mulsd 0xa6e1(%rip), %xmm0     # 0x1e150
cvtsd2ss %xmm0, %xmm0
divss 0xa6dd(%rip), %xmm0     # 0x1e158
movss %xmm0, -0x30(%rbp)
leaq -0x30(%rbp), %rax
movq %rax, (%rsp)
movq %r13, %rdi
movq %r12, %rsi
leaq -0x3c(%rbp), %rdx
leaq -0x2c(%rbp), %rcx
leaq -0x38(%rbp), %r8
leaq -0x34(%rbp), %r9
callq 0xcd00
movq %r13, -0x48(%rbp)
movq -0x50(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x11446
movl 0x1e4(%rbx), %r13d
movq -0x48(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
cmpl %eax, %r13d
jbe 0x13ada
movq -0x48(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movl %eax, 0x1e4(%rbx)
incl %r15d
jmp 0x1386f
movl 0x1ec(%rbx), %ecx
movq 0x110(%rbx), %rax
subq 0x108(%rbx), %rax
sarq $0x3, %rax
cmpq %rcx, %rax
jbe 0x13b05
movl %eax, 0x1ec(%rbx)
movl 0x1e4(%rbx), %eax
cmpl %eax, 0x1e8(%rbx)
jbe 0x13b19
movl %eax, 0x1e8(%rbx)
leaq -0x78(%rbp), %rdi
callq 0x30c0
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x13b35
jmp 0x13b35
movq %rax, %rbx
movq %r13, %rdi
callq 0x31b0
jmp 0x13b45
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x30c0
movq %rbx, %rdi
callq 0x3330