// File: Thilotilo[P]DoaERando/General.cpp
// Function: DoaERando::General::ScaleAllySoldiersForAnotherZone(int, DoaERando::RandomNumberGenerator&)
void General::ScaleAllySoldiersForAnotherZone(int zone, RNG& rng)
{
    // Zone 9 is tiger leveling
    const std::vector<BYTE> MIN_SOLDIERS = {1,   10,  24, 33, 48, 53, 64, 82,  99,  128};
    const std::vector<BYTE> MAX_SOLDIERS = {121, 27,  32, 47, 61, 60, 79, 111, 121, 148};

    BYTE randomizedSoldiers = rng.GetRandomByte(MIN_SOLDIERS[zone], MAX_SOLDIERS[zone]);
    if (allySoldierExponent & 0x80)
    {
        printf("Tiger detected, not modifying ally soldiers\n");
    }
    else
    {
        printf("Changing %s's ally soldier exponent from %d to %d\n", name,
                                                                      allySoldierExponent,
                                                                      randomizedSoldiers);
        allySoldierExponent = randomizedSoldiers;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xa8(%rbp)
movb $0x1, -0x4a(%rbp)
movb $0xa, -0x49(%rbp)
movb $0x18, -0x48(%rbp)
movb $0x21, -0x47(%rbp)
movb $0x30, -0x46(%rbp)
movb $0x35, -0x45(%rbp)
movb $0x40, -0x44(%rbp)
movb $0x52, -0x43(%rbp)
movb $0x63, -0x42(%rbp)
movb $-0x80, -0x41(%rbp)
leaq -0x4a(%rbp), %rax
movq %rax, -0x40(%rbp)
movq $0xa, -0x38(%rbp)
leaq -0x4b(%rbp), %rdi
movq %rdi, -0xa0(%rbp)
callq 0x404e70
movq -0xa0(%rbp), %rcx
movq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
leaq -0x30(%rbp), %rdi
callq 0x40fb50
jmp 0x414e23
leaq -0x4b(%rbp), %rdi
callq 0x404fb0
movb $0x79, -0x92(%rbp)
movb $0x1b, -0x91(%rbp)
movb $0x20, -0x90(%rbp)
movb $0x2f, -0x8f(%rbp)
movb $0x3d, -0x8e(%rbp)
movb $0x3c, -0x8d(%rbp)
movb $0x4f, -0x8c(%rbp)
movb $0x6f, -0x8b(%rbp)
movb $0x79, -0x8a(%rbp)
movb $-0x6c, -0x89(%rbp)
leaq -0x92(%rbp), %rax
movq %rax, -0x88(%rbp)
movq $0xa, -0x80(%rbp)
leaq -0x93(%rbp), %rdi
movq %rdi, -0xb0(%rbp)
callq 0x404e70
movq -0xb0(%rbp), %rcx
movq -0x88(%rbp), %rsi
movq -0x80(%rbp), %rdx
leaq -0x78(%rbp), %rdi
callq 0x40fb50
jmp 0x414eb8
leaq -0x93(%rbp), %rdi
callq 0x404fb0
movq -0x18(%rbp), %rax
movq %rax, -0xc0(%rbp)
movslq -0xc(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x415470
movzbl (%rax), %eax
movl %eax, -0xb8(%rbp)
movslq -0xc(%rbp), %rsi
leaq -0x78(%rbp), %rdi
callq 0x415470
movq -0xc0(%rbp), %rdi
movl -0xb8(%rbp), %esi
movzbl (%rax), %edx
callq 0x41db50
movb %al, -0xb1(%rbp)
jmp 0x414f0f
movq -0xa8(%rbp), %rax
movb -0xb1(%rbp), %cl
movb %cl, -0x94(%rbp)
movzbl 0xc(%rax), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x414f90
leaq 0x18672e(%rip), %rdi    # 0x59b665
xorl %eax, %eax
callq 0x4f06e0
jmp 0x414f40
jmp 0x414fc9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x4b(%rbp), %rdi
callq 0x404fb0
jmp 0x414fed
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x93(%rbp), %rdi
callq 0x404fb0
jmp 0x414fe4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x404f50
jmp 0x414fe4
movq -0xa8(%rbp), %rax
movq %rax, %rsi
addq $0xf, %rsi
movzbl 0xc(%rax), %edx
movzbl -0x94(%rbp), %ecx
leaq 0x1866e2(%rip), %rdi    # 0x59b692
xorl %eax, %eax
callq 0x4f06e0
jmp 0x414fb9
movq -0xa8(%rbp), %rax
movb -0x94(%rbp), %cl
movb %cl, 0xc(%rax)
leaq -0x78(%rbp), %rdi
callq 0x404f50
leaq -0x30(%rbp), %rdi
callq 0x404f50
addq $0xc0, %rsp
popq %rbp
retq
leaq -0x30(%rbp), %rdi
callq 0x404f50
movq -0x58(%rbp), %rdi
callq 0x4c9ba0
nopw %cs:(%rax,%rax)