// File: /workspace/github_cpp_makefile_star2_O2/Thilotilo[P]DoaERando/Randomizer.cpp
// Function: DoaERando::Randomizer::RandomizeGenerals()
void Randomizer::RandomizeGenerals()
{
    myGenerals.AdjustZone1Generals();
    for (int i = 0; i < 9; ++i)
    {
        printf("Zone %d Generals: \n\t", i);
        auto zoneGenerals = myGenerals.GetGeneralIdsFromZone(i);
        for (auto& general : zoneGenerals)
        {
            PrintName(general);
            printf("\n\t");
        }
        printf("\n");
    }

    myGenerals.SetZonesForZone0(myRNG);
    for (int i = 0; i < 10000; ++i)
    {
        myGenerals.SwapZones(
            myRNG.GetRandomInt(0, myGenerals.size() - 1),
            myRNG.GetRandomInt(0, myGenerals.size() - 1));
    }
    myGenerals.ScaleForZone(myRNG);
    myGenerals.RandomizeCaoCaoAndSunCe(myRNG);
    myGenerals.ScaleSpecialGenerals(myRNG);
    myGenerals.UpdateGenerals();

    printf("After Randomization:\n");
    for (int i = 0; i < 9; ++i)
    {
        printf("Zone %d Generals: \n\t", i);
        auto zoneGenerals = myGenerals.GetGeneralIdsFromZone(i);
        for (auto& general : zoneGenerals)
        {
            PrintName(general);
            printf("\n\t");
        }
        printf("\n");
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
addq $0x9d0, %rdi            # imm = 0x9D0
movq %rdi, -0x30(%rbp)
callq 0x40b624
leaq -0x48(%rbp), %r14
leaq 0x184e7b(%rip), %r15    # 0x58b194
xorl %r13d, %r13d
cmpl $0x9, %r13d
je 0x406384
leaq 0x184e59(%rip), %rdi    # 0x58b182
movl %r13d, %esi
xorl %eax, %eax
callq 0x4e1140
movzbl %r13b, %edx
movq %r14, %rdi
movq -0x30(%rbp), %rsi
callq 0x40be82
movq -0x48(%rbp), %r14
movq -0x40(%rbp), %r12
cmpq %r12, %r14
je 0x40636b
movzbl (%r14), %esi
movq %rbx, %rdi
callq 0x404eae
movq %r15, %rdi
xorl %eax, %eax
callq 0x4e1140
incq %r14
jmp 0x40634b
pushq $0xa
popq %rdi
callq 0x4e8da0
leaq -0x48(%rbp), %r14
movq %r14, %rdi
callq 0x404baa
incl %r13d
jmp 0x40631c
leaq 0x8(%rbx), %r15
movq -0x30(%rbp), %rdi
movq %r15, %rsi
callq 0x40b7f2
movl $0x2710, %r13d          # imm = 0x2710
pushq $0x28
popq %r14
subl $0x1, %r13d
jb 0x4063f7
movq 0x9d8(%rbx), %rax
subq 0x9d0(%rbx), %rax
cqto
idivq %r14
leal -0x1(%rax), %edx
movq %r15, %rdi
xorl %esi, %esi
callq 0x40ed8e
movl %eax, %r12d
movq 0x9d8(%rbx), %rax
subq 0x9d0(%rbx), %rax
cqto
idivq %r14
leal -0x1(%rax), %edx
movq %r15, %rdi
xorl %esi, %esi
callq 0x40ed8e
movq -0x30(%rbp), %rdi
movl %r12d, %esi
movl %eax, %edx
callq 0x40b794
jmp 0x40639e
movq -0x30(%rbp), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x40b8a4
movq %r14, %rdi
movq %r15, %rsi
callq 0x40bbd6
movq %r14, %rdi
movq %r15, %rsi
callq 0x40bb2e
movq %r14, %rdi
callq 0x40ba40
leaq 0x184f48(%rip), %rdi    # 0x58b373
callq 0x4e8680
leaq -0x48(%rbp), %r14
leaq 0x184d59(%rip), %r15    # 0x58b194
xorl %r13d, %r13d
cmpl $0x9, %r13d
je 0x4064a6
leaq 0x184d37(%rip), %rdi    # 0x58b182
movl %r13d, %esi
xorl %eax, %eax
callq 0x4e1140
movzbl %r13b, %edx
movq %r14, %rdi
movq -0x30(%rbp), %rsi
callq 0x40be82
movq -0x48(%rbp), %r14
movq -0x40(%rbp), %r12
cmpq %r12, %r14
je 0x40648d
movzbl (%r14), %esi
movq %rbx, %rdi
callq 0x404eae
movq %r15, %rdi
xorl %eax, %eax
callq 0x4e1140
incq %r14
jmp 0x40646d
pushq $0xa
popq %rdi
callq 0x4e8da0
leaq -0x48(%rbp), %r14
movq %r14, %rdi
callq 0x404baa
incl %r13d
jmp 0x40643e
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4064b7
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x404baa
movq %rbx, %rdi
callq 0x4ba600
nop