// File: MichaelXanth[P]RPG_Game/Market/Market.cpp
// Function: Market::AddArmors(int const&)
void Market::AddArmors(const int& num)
{
    string armorName;
    Armor* tmpArmor;

    for (int i = 0; i < num; i++)
    {
        unsigned int level;

        if ( ((double)rand() / RAND_MAX) < 0.7 )
            level = rand() % 30 + 1;
        else
            level = rand() % 70 + 31;

        armorName = name.armorsNames[rand() % name.armorsNames.size()];

        tmpArmor = new Armor(armorName , ((rand() % 2) + 3) * level , level , (unsigned int)(level * (4.0 / 2.0)));

        armorsArray.push_back(tmpArmor);

        if (minItemPrice > tmpArmor->GetPrice())
            minItemPrice = tmpArmor->GetPrice();
    }

    if (mostItems < armorsArray.size())
        mostItems = armorsArray.size();

    if (minPrice > minItemPrice)
        minPrice = minItemPrice;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x60(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x4380
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x30b79
callq 0x40a0
cvtsi2sd %eax, %xmm1
movsd 0xc875(%rip), %xmm0     # 0x3d260
divsd %xmm0, %xmm1
movsd 0xb619(%rip), %xmm0     # 0x3c010
ucomisd %xmm1, %xmm0
jbe 0x30a12
callq 0x40a0
movl $0x1e, %ecx
cltd
idivl %ecx
addl $0x1, %edx
movl %edx, -0x40(%rbp)
jmp 0x30a25
callq 0x40a0
movl $0x46, %ecx
cltd
idivl %ecx
addl $0x1f, %edx
movl %edx, -0x40(%rbp)
movq -0x60(%rbp), %rax
addq $0x30, %rax
movq %rax, -0x70(%rbp)
callq 0x40a0
movq -0x70(%rbp), %rdi
cltq
movq %rax, -0x68(%rbp)
callq 0x5010
movq -0x70(%rbp), %rdi
movq %rax, %rcx
movq -0x68(%rbp), %rax
xorl %edx, %edx
divq %rcx
movq %rdx, %rsi
callq 0x4ff0
movq %rax, %rsi
leaq -0x30(%rbp), %rdi
callq 0x4050
jmp 0x30a6b
movl $0x38, %edi
callq 0x4270
movq %rax, -0x78(%rbp)
jmp 0x30a7b
callq 0x40a0
movq -0x78(%rbp), %rdi
movl %eax, %ecx
movl %ecx, %eax
shrl $0x1f, %eax
movl %ecx, %edx
addl %eax, %edx
andl $-0x2, %edx
movl %ecx, %eax
negl %edx
movl %edx, %ecx
leal 0x3(%rax,%rcx), %eax
movl -0x40(%rbp), %ecx
imull %ecx, %eax
movl %eax, -0x50(%rbp)
movl -0x40(%rbp), %eax
cvtsi2sd %rax, %xmm0
addsd %xmm0, %xmm0
cvttsd2si %xmm0, %rax
movl %eax, -0x54(%rbp)
leaq -0x30(%rbp), %rsi
leaq -0x50(%rbp), %rdx
leaq -0x40(%rbp), %rcx
leaq -0x54(%rbp), %r8
callq 0x1e620
jmp 0x30ad0
movq -0x60(%rbp), %rdi
movq -0x78(%rbp), %rax
movq %rax, -0x38(%rbp)
addq $0x120, %rdi            # imm = 0x120
leaq -0x38(%rbp), %rsi
callq 0x270a0
jmp 0x30aee
movq -0x60(%rbp), %rax
movl 0x1e4(%rax), %eax
movl %eax, -0x80(%rbp)
movq -0x38(%rbp), %rdi
movq (%rdi), %rax
movq 0x8(%rax), %rax
callq *%rax
movl %eax, -0x7c(%rbp)
jmp 0x30b0d
movl -0x80(%rbp), %eax
movl -0x7c(%rbp), %ecx
cmpl %ecx, %eax
jbe 0x30b69
movq -0x38(%rbp), %rdi
movq (%rdi), %rax
movq 0x8(%rax), %rax
callq *%rax
movl %eax, -0x84(%rbp)
jmp 0x30b2c
movq -0x60(%rbp), %rax
movl -0x84(%rbp), %ecx
movl %ecx, 0x1e4(%rax)
jmp 0x30b69
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x30bf6
movq -0x78(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
callq 0x4240
jmp 0x30bf6
jmp 0x30b6b
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x309cb
movq -0x60(%rbp), %rdi
movl 0x1ec(%rdi), %eax
movq %rax, -0x90(%rbp)
addq $0x120, %rdi            # imm = 0x120
callq 0x26ec0
movq %rax, %rcx
movq -0x90(%rbp), %rax
cmpq %rcx, %rax
jae 0x30bc2
movq -0x60(%rbp), %rdi
addq $0x120, %rdi            # imm = 0x120
callq 0x26ec0
movq %rax, %rcx
movq -0x60(%rbp), %rax
movl %ecx, 0x1ec(%rax)
movq -0x60(%rbp), %rcx
movl 0x1e8(%rcx), %eax
cmpl 0x1e4(%rcx), %eax
jbe 0x30be4
movq -0x60(%rbp), %rax
movl 0x1e4(%rax), %ecx
movl %ecx, 0x1e8(%rax)
leaq -0x30(%rbp), %rdi
callq 0x4160
addq $0x90, %rsp
popq %rbp
retq
leaq -0x30(%rbp), %rdi
callq 0x4160
movq -0x48(%rbp), %rdi
callq 0x4440
nopl (%rax,%rax)