// File: /workspace/github_cpp_makefile_star2_O1/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 0x40c5e8
leaq 0x185ba0(%rip), %r13    # 0x58c194
xorl %r15d, %r15d
movq %r14, -0x48(%rbp)
leaq 0x185b80(%rip), %rdi    # 0x58c182
movl %r15d, %esi
xorl %eax, %eax
callq 0x4e21a0
movzbl %r15b, %edx
leaq -0x40(%rbp), %rdi
movq %r14, %rsi
callq 0x40cf88
movq -0x40(%rbp), %r12
movq -0x38(%rbp), %r14
cmpq %r14, %r12
je 0x406645
movzbl (%r12), %esi
movq %rbx, %rdi
callq 0x404e72
movq %r13, %rdi
xorl %eax, %eax
callq 0x4e21a0
incq %r12
jmp 0x406624
movl $0xa, %edi
callq 0x4e9e00
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x40665d
callq 0x410b90
incl %r15d
cmpl $0x9, %r15d
movq -0x48(%rbp), %r14
jne 0x4065fb
leaq 0x8(%rbx), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x40c87e
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 0x40c7e4
decl %r13d
jne 0x40667f
movq %r14, %rdi
movq %r15, %rsi
callq 0x40c93a
movq %r14, %rdi
movq %r15, %rsi
callq 0x40cc94
movq %r14, %rdi
movq %r15, %rsi
callq 0x40cbec
movq %r14, %rdi
callq 0x40cae2
leaq 0x185c67(%rip), %rdi    # 0x58c373
callq 0x4e96e0
leaq 0x185a7c(%rip), %r13    # 0x58c194
xorl %r15d, %r15d
leaq 0x185a60(%rip), %rdi    # 0x58c182
movl %r15d, %esi
xorl %eax, %eax
callq 0x4e21a0
movzbl %r15b, %edx
leaq -0x40(%rbp), %rdi
movq %r14, %rsi
callq 0x40cf88
movq -0x40(%rbp), %r12
movq -0x38(%rbp), %r14
cmpq %r14, %r12
je 0x406765
movzbl (%r12), %esi
movq %rbx, %rdi
callq 0x404e72
movq %r13, %rdi
xorl %eax, %eax
callq 0x4e21a0
incq %r12
jmp 0x406744
movl $0xa, %edi
callq 0x4e9e00
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x40677d
callq 0x410b90
incl %r15d
cmpl $0x9, %r15d
movq -0x48(%rbp), %r14
jne 0x40671b
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x40679b
movq %rax, %rbx
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x4067ac
callq 0x410b90
movq %rbx, %rdi
callq 0x4bb660