// File: FakePsyho[P]halite2/hlt/hlt_in.hpp
// Function: hlt::in::parse_map(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, int, int)
static Map parse_map(const std::string& input, const int map_width, const int map_height) {
            std::stringstream iss(input);

            int num_players;
            iss >> num_players;

            Map map = Map(map_width, map_height);

            for (int i = 0; i < num_players; ++i) {
                PlayerId player_id;
                int player_id_int;
                iss >> player_id_int;

                player_id = static_cast<PlayerId>(player_id_int);

                unsigned int num_ships;
                iss >> num_ships;

                std::vector<Ship>& ship_vec = map.ships[player_id];
                entity_map<unsigned int>& ship_map = map.ship_map[player_id];

                ship_vec.reserve(num_ships);
                for (unsigned int j = 0; j < num_ships; ++j) {
                    const auto& ship_pair = parse_ship(iss, player_id);
                    ship_vec.push_back(ship_pair.second);
                    ship_map[ship_pair.first] = j;
                }
            }

            unsigned int num_planets;
            iss >> num_planets;

            map.planets.reserve(num_planets);
            for (unsigned int i = 0; i < num_planets; ++i) {
                const auto& planet_pair = parse_planet(iss);
                map.planets.push_back(planet_pair.second);
                map.planet_map[planet_pair.first] = i;
            }

            return map;
        }

// Assembly:
subq $0x388, %rsp            # imm = 0x388
movq %rdi, 0x38(%rsp)
movq %rdi, %rax
movq %rax, 0x40(%rsp)
movq %rdi, 0x380(%rsp)
movq %rsi, 0x378(%rsp)
movl %edx, 0x374(%rsp)
movl %ecx, 0x370(%rsp)
movq 0x378(%rsp), %rax
movq %rax, 0x48(%rsp)
movl $0x10, %edi
movl $0x8, %esi
callq 0x1b350
movq 0x48(%rsp), %rsi
movl %eax, %edx
leaq 0x1e8(%rsp), %rdi
movq %rdi, 0x50(%rsp)
callq 0x33b0
movq 0x50(%rsp), %rdi
leaq 0x1e4(%rsp), %rsi
callq 0x3170
jmp 0x391ab
movq 0x38(%rsp), %rdi
movb $0x0, 0x1d3(%rsp)
movl 0x374(%rsp), %esi
movl 0x370(%rsp), %edx
callq 0x3a660
jmp 0x391cd
movl $0x0, 0x1cc(%rsp)
movl 0x1cc(%rsp), %eax
cmpl 0x1e4(%rsp), %eax
jge 0x3938e
leaq 0x1e8(%rsp), %rdi
leaq 0x1c4(%rsp), %rsi
callq 0x3170
jmp 0x39203
movl 0x1c4(%rsp), %eax
movl %eax, 0x1c8(%rsp)
leaq 0x1e8(%rsp), %rdi
leaq 0x1c0(%rsp), %rsi
callq 0x3060
jmp 0x39228
movq 0x38(%rsp), %rdi
addq $0x10, %rdi
leaq 0x1c8(%rsp), %rsi
callq 0x12bc0
movq %rax, 0x30(%rsp)
jmp 0x39245
movq 0x38(%rsp), %rdi
movq 0x30(%rsp), %rax
movq %rax, 0x1b8(%rsp)
addq $0x48, %rdi
leaq 0x1c8(%rsp), %rsi
callq 0x209f0
movq %rax, 0x28(%rsp)
jmp 0x3926f
movq 0x28(%rsp), %rax
movq %rax, 0x1b0(%rsp)
movq 0x1b8(%rsp), %rdi
movl 0x1c0(%rsp), %eax
movl %eax, %esi
callq 0x39850
jmp 0x39294
movl $0x0, 0x1ac(%rsp)
movl 0x1ac(%rsp), %eax
cmpl 0x1c0(%rsp), %eax
jae 0x39376
movl 0x1c8(%rsp), %edx
leaq 0x110(%rsp), %rdi
leaq 0x1e8(%rsp), %rsi
callq 0x394f0
jmp 0x392d1
leaq 0x110(%rsp), %rax
movq %rax, 0x1a0(%rsp)
movq 0x1b8(%rsp), %rdi
movq 0x1a0(%rsp), %rsi
addq $0x8, %rsi
callq 0x15d00
jmp 0x392fc
movl 0x1ac(%rsp), %eax
movl %eax, 0x1c(%rsp)
movq 0x1b0(%rsp), %rdi
movq 0x1a0(%rsp), %rsi
callq 0x20a20
movq %rax, 0x20(%rsp)
jmp 0x39323
movq 0x20(%rsp), %rax
movl 0x1c(%rsp), %ecx
movl %ecx, (%rax)
movl 0x1ac(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1ac(%rsp)
jmp 0x3929f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1d8(%rsp)
movl %eax, 0x1d4(%rsp)
jmp 0x394d0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1d8(%rsp)
movl %eax, 0x1d4(%rsp)
jmp 0x394c6
jmp 0x39378
movl 0x1cc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1cc(%rsp)
jmp 0x391d8
leaq 0x1e8(%rsp), %rdi
leaq 0x10c(%rsp), %rsi
callq 0x3060
jmp 0x393a5
movq 0x38(%rsp), %rdi
subq $-0x80, %rdi
movl 0x10c(%rsp), %eax
movl %eax, %esi
callq 0x39960
jmp 0x393be
movl $0x0, 0x108(%rsp)
movl 0x108(%rsp), %eax
cmpl 0x10c(%rsp), %eax
jae 0x39490
leaq 0x58(%rsp), %rdi
leaq 0x1e8(%rsp), %rsi
callq 0x39640
jmp 0x393f1
movq 0x38(%rsp), %rdi
leaq 0x58(%rsp), %rax
movq %rax, 0x100(%rsp)
subq $-0x80, %rdi
movq 0x100(%rsp), %rsi
addq $0x8, %rsi
callq 0x39a70
jmp 0x3941a
movq 0x38(%rsp), %rdi
movl 0x108(%rsp), %eax
movl %eax, 0xc(%rsp)
addq $0x98, %rdi
movq 0x100(%rsp), %rsi
callq 0x20a20
movq %rax, 0x10(%rsp)
jmp 0x39445
movq 0x10(%rsp), %rax
movl 0xc(%rsp), %ecx
movl %ecx, (%rax)
leaq 0x58(%rsp), %rdi
callq 0x39af0
movl 0x108(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x108(%rsp)
jmp 0x393c9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1d8(%rsp)
movl %eax, 0x1d4(%rsp)
leaq 0x58(%rsp), %rdi
callq 0x39af0
jmp 0x394c6
movb $0x1, 0x1d3(%rsp)
testb $0x1, 0x1d3(%rsp)
jne 0x394ac
movq 0x38(%rsp), %rdi
callq 0x12830
leaq 0x1e8(%rsp), %rdi
callq 0x31e0
movq 0x40(%rsp), %rax
addq $0x388, %rsp            # imm = 0x388
retq
movq 0x38(%rsp), %rdi
callq 0x12830
leaq 0x1e8(%rsp), %rdi
callq 0x31e0
movq 0x1d8(%rsp), %rdi
callq 0x3440
nopw (%rax,%rax)