// File: /workspace/github_cpp_makefile_star2_O3/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
leaq 0x9d0(%rdi), %r14
movq %r14, %rdi
callq 0x40c606
leaq 0x185bee(%rip), %r13    # 0x58c194
xorl %r15d, %r15d
movq %r14, -0x48(%rbp)
leaq 0x185bce(%rip), %rdi    # 0x58c182
movl %r15d, %esi
xorl %eax, %eax
callq 0x4e21a0
movzbl %r15b, %edx
leaq -0x40(%rbp), %rdi
movq %r14, %rsi
callq 0x40cf22
movq -0x40(%rbp), %r12
movq -0x38(%rbp), %r14
cmpq %r14, %r12
je 0x4065f7
movzbl (%r12), %esi
movq %rbx, %rdi
callq 0x404e82
movq %r13, %rdi
xorl %eax, %eax
callq 0x4e21a0
incq %r12
jmp 0x4065d6
movl $0xa, %edi
callq 0x4e9e00
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x40660f
callq 0x410b90
incl %r15d
cmpl $0x9, %r15d
movq -0x48(%rbp), %r14
jne 0x4065ad
leaq 0x8(%rbx), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x40c814
movl $0x2710, %r13d          # imm = 0x2710
movq 0x9d8(%rbx), %rax
subq 0x9d0(%rbx), %rax
shrq $0x3, %rax
imull $0xcccccccd, %eax, %edx # imm = 0xCCCCCCCD
decl %edx
movq %r15, %rdi
xorl %esi, %esi
callq 0x41086c
movq 0x9d8(%rbx), %rcx
subq 0x9d0(%rbx), %rcx
movl %eax, %r12d
shrq $0x3, %rcx
imull $0xcccccccd, %ecx, %edx # imm = 0xCCCCCCCD
decl %edx
movq %r15, %rdi
xorl %esi, %esi
callq 0x41086c
movq %r14, %rdi
movl %r12d, %esi
movl %eax, %edx
callq 0x40c7aa
decl %r13d
jne 0x406631
movq %r14, %rdi
movq %r15, %rsi
callq 0x40c8cc
movq %r14, %rdi
movq %r15, %rsi
callq 0x40cc26
movq %r14, %rdi
movq %r15, %rsi
callq 0x40cb7e
movq %r14, %rdi
callq 0x40ca74
leaq 0x185cb5(%rip), %rdi    # 0x58c373
callq 0x4e96e0
leaq 0x185aca(%rip), %r13    # 0x58c194
xorl %r15d, %r15d
leaq 0x185aae(%rip), %rdi    # 0x58c182
movl %r15d, %esi
xorl %eax, %eax
callq 0x4e21a0
movzbl %r15b, %edx
leaq -0x40(%rbp), %rdi
movq %r14, %rsi
callq 0x40cf22
movq -0x40(%rbp), %r12
movq -0x38(%rbp), %r14
cmpq %r14, %r12
je 0x406717
movzbl (%r12), %esi
movq %rbx, %rdi
callq 0x404e82
movq %r13, %rdi
xorl %eax, %eax
callq 0x4e21a0
incq %r12
jmp 0x4066f6
movl $0xa, %edi
callq 0x4e9e00
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x40672f
callq 0x410b90
incl %r15d
cmpl $0x9, %r15d
movq -0x48(%rbp), %r14
jne 0x4066cd
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x40674d
movq %rax, %rbx
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x40675e
callq 0x410b90
movq %rbx, %rdi
callq 0x4bb660