// File: 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
subq $0xc0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0xa0(%rbp)
addq $0x9d0, %rdi            # imm = 0x9D0
callq 0x415880
movl $0x0, -0xc(%rbp)
cmpl $0x9, -0xc(%rbp)
jge 0x408dea
movl -0xc(%rbp), %esi
leaq 0x192516(%rip), %rdi    # 0x59b227
movb $0x0, %al
callq 0x4f06e0
movq -0xa0(%rbp), %rsi
addq $0x9d0, %rsi            # imm = 0x9D0
movl -0xc(%rbp), %eax
leaq -0x28(%rbp), %rdi
movzbl %al, %edx
callq 0x416810
leaq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0x405780
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rdi
callq 0x405610
movq %rax, -0x40(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x40ffd0
testb $0x1, %al
jne 0x408d6a
jmp 0x408dc3
leaq -0x38(%rbp), %rdi
callq 0x410010
movq -0xa0(%rbp), %rdi
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movzbl (%rax), %esi
callq 0x4060e0
jmp 0x408d8c
leaq 0x1924a6(%rip), %rdi    # 0x59b239
xorl %eax, %eax
callq 0x4f06e0
jmp 0x408d9c
jmp 0x408d9e
leaq -0x38(%rbp), %rdi
callq 0x410030
jmp 0x408d57
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x404f50
jmp 0x409039
leaq 0x199ca0(%rip), %rdi    # 0x5a2a6a
xorl %eax, %eax
callq 0x4f06e0
jmp 0x408dd3
leaq -0x28(%rbp), %rdi
callq 0x404f50
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x408cfd
movq -0xa0(%rbp), %rsi
movq %rsi, %rdi
addq $0x9d0, %rdi            # imm = 0x9D0
addq $0x8, %rsi
callq 0x415c60
movl $0x0, -0x58(%rbp)
cmpl $0x2710, -0x58(%rbp)    # imm = 0x2710
jge 0x408eb8
movq -0xa0(%rbp), %rdi
movq %rdi, %rax
addq $0x9d0, %rax            # imm = 0x9D0
movq %rax, -0xb0(%rbp)
movq %rdi, %rax
addq $0x8, %rax
movq %rax, -0xc0(%rbp)
addq $0x9d0, %rdi            # imm = 0x9D0
callq 0x410050
movq -0xc0(%rbp), %rdi
movl %eax, %edx
subl $0x1, %edx
xorl %esi, %esi
callq 0x41dba0
movq -0xa0(%rbp), %rdi
movl %eax, -0xa4(%rbp)
movq %rdi, %rax
addq $0x8, %rax
movq %rax, -0xb8(%rbp)
addq $0x9d0, %rdi            # imm = 0x9D0
callq 0x410050
movq -0xb8(%rbp), %rdi
movl %eax, %edx
subl $0x1, %edx
xorl %esi, %esi
callq 0x41dba0
movq -0xb0(%rbp), %rdi
movl -0xa4(%rbp), %esi
movl %eax, %edx
callq 0x415bb0
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x408e0b
movq -0xa0(%rbp), %rsi
movq %rsi, %rdi
addq $0x9d0, %rdi            # imm = 0x9D0
addq $0x8, %rsi
callq 0x415e60
movq -0xa0(%rbp), %rsi
movq %rsi, %rdi
addq $0x9d0, %rdi            # imm = 0x9D0
addq $0x8, %rsi
callq 0x416420
movq -0xa0(%rbp), %rsi
movq %rsi, %rdi
addq $0x9d0, %rdi            # imm = 0x9D0
addq $0x8, %rsi
callq 0x416350
movq -0xa0(%rbp), %rdi
addq $0x9d0, %rdi            # imm = 0x9D0
callq 0x416190
leaq 0x19231c(%rip), %rdi    # 0x59b23c
movb $0x0, %al
callq 0x4f06e0
movl $0x0, -0x5c(%rbp)
cmpl $0x9, -0x5c(%rbp)
jge 0x409030
movl -0x5c(%rbp), %esi
leaq 0x1922e5(%rip), %rdi    # 0x59b227
movb $0x0, %al
callq 0x4f06e0
movq -0xa0(%rbp), %rsi
addq $0x9d0, %rsi            # imm = 0x9D0
movl -0x5c(%rbp), %eax
leaq -0x78(%rbp), %rdi
movzbl %al, %edx
callq 0x416810
leaq -0x78(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rdi
callq 0x405780
movq %rax, -0x88(%rbp)
movq -0x80(%rbp), %rdi
callq 0x405610
movq %rax, -0x90(%rbp)
leaq -0x88(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x40ffd0
testb $0x1, %al
jne 0x408fa7
jmp 0x409009
leaq -0x88(%rbp), %rdi
callq 0x410010
movq -0xa0(%rbp), %rdi
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rax
movzbl (%rax), %esi
callq 0x4060e0
jmp 0x408fd2
leaq 0x192260(%rip), %rdi    # 0x59b239
xorl %eax, %eax
callq 0x4f06e0
jmp 0x408fe2
jmp 0x408fe4
leaq -0x88(%rbp), %rdi
callq 0x410030
jmp 0x408f8e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x404f50
jmp 0x409039
leaq 0x199a5a(%rip), %rdi    # 0x5a2a6a
xorl %eax, %eax
callq 0x4f06e0
jmp 0x409019
leaq -0x78(%rbp), %rdi
callq 0x404f50
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x408f2e
addq $0xc0, %rsp
popq %rbp
retq
movq -0x50(%rbp), %rdi
callq 0x4c9ba0
nopw %cs:(%rax,%rax)