// File: /workspace/github_cpp_makefile_star2_O2/Thilotilo[P]DoaERando/Randomizer.cpp
// Function: DoaERando::Randomizer::ImproveMap()
void Randomizer::ImproveMap()
{
    // Add Bridge under ZGL's house
    myRom->WriteByte(0x160C3, 0x2A);
    myRom->WriteByte(0x160F2, 0xF1);
    // Add Bridge from Chang Sha to Po Yang
    myRom->WriteByte(0x1802C, 0xC8);
    myRom->WriteByte(0x18031, 0x22);
    myRom->WriteByte(0x18032, 0x22);
    myRom->WriteByte(0x18033, 0x22);
    myRom->WriteByte(0x18034, 0x28);
    myRom->WriteByte(0x18035, 0x4A);
    myRom->WriteByte(0x18036, 0xDC);
    myRom->WriteByte(0x18037, 0xDC);
    myRom->WriteByte(0x18053, 0xF7);
    myRom->WriteByte(0x18054, 0x07);
    myRom->WriteByte(0x18618, 0x27);
    // Add Bridge from Xu Zhou to Ji Zhou
    myRom->WriteByte(0x18838, 0xFE);
    myRom->WriteByte(0x18839, 0x4A);
    myRom->WriteByte(0x1883A, 0xDC);
    myRom->WriteByte(0x1883B, 0xDC);
    myRom->WriteByte(0x1883C, 0xDC);
    myRom->WriteByte(0x1883D, 0xDC);
    myRom->WriteByte(0x1883E, 0xCF);
    myRom->WriteByte(0x1883F, 0x60);
    myRom->WriteByte(0x18878, 0x7C);
    myRom->WriteByte(0x188BF, 0xA7);
    myRom->WriteByte(0x188C7, 0x41);
    myRom->WriteByte(0x189EE, 0xCD);
    myRom->WriteByte(0x189EF, 0xFE);
    myRom->WriteByte(0x189DE, 0xCD);
    // Add Hills in Ji Zhou
    myRom->WriteByte(0x1889A, 0x87);
    // Add Hills in Zone 2
    myRom->WriteByte(0x1842C, 0x87);
    // Enable all story-trigger bridges
    myRom->WriteByte(0x34781, 0x01);    // Automatically enable the bridge in the Qing Zhou cave
    myRom->WriteByte(0x34782, 0x01);    // Automatically enable the bridge from Luo Yang to Chin
    myRom->WriteByte(0x34784, 0x01);    // Automatically enable the bridge from Nan Yang to Ji Zhou
    myRom->WriteByte(0x34788, 0x01);    // Automatically enable the bridge from Gui Yang to Wu
    // Fix Luo Yang lookup.
    // Right now, the version of Luo Yang we get is based upon the status of the Chin bridge.  Since
    // we've permanently enabled it, that means we only get the restored Luo Yang castle, which means
    // that we can't fight the original Luo Yang, nor can we recruit the general in it, nor can we
    // use the Gold Key.  To fix this, we just want to change it to use the new Luo Yang gates to
    // determine which version we want to load.
    myRom->WriteByte(0x3BCF9, 0x77);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
pushq $0x2a
popq %rdx
movl $0x160c3, %esi          # imm = 0x160C3
callq 0x404a00
movq (%rbx), %rdi
movl $0x160f2, %esi          # imm = 0x160F2
movl $0xf1, %edx
callq 0x404a00
movq (%rbx), %rdi
movl $0x1802c, %esi          # imm = 0x1802C
movl $0xc8, %edx
callq 0x404a00
movq (%rbx), %rdi
pushq $0x22
popq %r14
movl $0x18031, %esi          # imm = 0x18031
movl %r14d, %edx
callq 0x404a00
movq (%rbx), %rdi
movl $0x18032, %esi          # imm = 0x18032
movl %r14d, %edx
callq 0x404a00
movq (%rbx), %rdi
movl $0x18033, %esi          # imm = 0x18033
movl %r14d, %edx
callq 0x404a00
movq (%rbx), %rdi
pushq $0x28
popq %rdx
movl $0x18034, %esi          # imm = 0x18034
callq 0x404a00
movq (%rbx), %rdi
pushq $0x4a
popq %r14
movl $0x18035, %esi          # imm = 0x18035
movl %r14d, %edx
callq 0x404a00
movq (%rbx), %rdi
movl $0x18036, %esi          # imm = 0x18036
movl $0xdc, %edx
callq 0x404a00
movq (%rbx), %rdi
movl $0x18037, %esi          # imm = 0x18037
movl $0xdc, %edx
callq 0x404a00
movq (%rbx), %rdi
movl $0x18053, %esi          # imm = 0x18053
movl $0xf7, %edx
callq 0x404a00
movq (%rbx), %rdi
pushq $0x7
popq %rdx
movl $0x18054, %esi          # imm = 0x18054
callq 0x404a00
movq (%rbx), %rdi
pushq $0x27
popq %rdx
movl $0x18618, %esi          # imm = 0x18618
callq 0x404a00
movq (%rbx), %rdi
movl $0x18838, %esi          # imm = 0x18838
movl $0xfe, %edx
callq 0x404a00
movq (%rbx), %rdi
movl $0x18839, %esi          # imm = 0x18839
movl %r14d, %edx
callq 0x404a00
movq (%rbx), %rdi
movl $0x1883a, %esi          # imm = 0x1883A
movl $0xdc, %edx
callq 0x404a00
movq (%rbx), %rdi
movl $0x1883b, %esi          # imm = 0x1883B
movl $0xdc, %edx
callq 0x404a00
movq (%rbx), %rdi
movl $0x1883c, %esi          # imm = 0x1883C
movl $0xdc, %edx
callq 0x404a00
movq (%rbx), %rdi
movl $0x1883d, %esi          # imm = 0x1883D
movl $0xdc, %edx
callq 0x404a00
movq (%rbx), %rdi
movl $0x1883e, %esi          # imm = 0x1883E
movl $0xcf, %edx
callq 0x404a00
movq (%rbx), %rdi
pushq $0x60
popq %rdx
movl $0x1883f, %esi          # imm = 0x1883F
callq 0x404a00
movq (%rbx), %rdi
pushq $0x7c
popq %rdx
movl $0x18878, %esi          # imm = 0x18878
callq 0x404a00
movq (%rbx), %rdi
movl $0x188bf, %esi          # imm = 0x188BF
movl $0xa7, %edx
callq 0x404a00
movq (%rbx), %rdi
pushq $0x41
popq %rdx
movl $0x188c7, %esi          # imm = 0x188C7
callq 0x404a00
movq (%rbx), %rdi
movl $0x189ee, %esi          # imm = 0x189EE
movl $0xcd, %edx
callq 0x404a00
movq (%rbx), %rdi
movl $0x189ef, %esi          # imm = 0x189EF
movl $0xfe, %edx
callq 0x404a00
movq (%rbx), %rdi
movl $0x189de, %esi          # imm = 0x189DE
movl $0xcd, %edx
callq 0x404a00
movq (%rbx), %rdi
movl $0x1889a, %esi          # imm = 0x1889A
movl $0x87, %edx
callq 0x404a00
movq (%rbx), %rdi
movl $0x1842c, %esi          # imm = 0x1842C
movl $0x87, %edx
callq 0x404a00
movq (%rbx), %rdi
pushq $0x1
popq %r14
movl $0x34781, %esi          # imm = 0x34781
movl %r14d, %edx
callq 0x404a00
movq (%rbx), %rdi
movl $0x34782, %esi          # imm = 0x34782
movl %r14d, %edx
callq 0x404a00
movq (%rbx), %rdi
movl $0x34784, %esi          # imm = 0x34784
movl %r14d, %edx
callq 0x404a00
movq (%rbx), %rdi
movl $0x34788, %esi          # imm = 0x34788
movl %r14d, %edx
callq 0x404a00
movq (%rbx), %rdi
pushq $0x77
popq %rdx
movl $0x3bcf9, %esi          # imm = 0x3BCF9
popq %rbx
popq %r14
popq %rbp
jmp 0x404a00