// File: /workspace/github_cpp_makefile_star2_O2/loadzero[P]geoloc/geoloc/locations.hpp
// Function: save_locations(BinaryFile&, std::vector<Location, std::allocator<Location>> const&)
inline void save_locations(BinaryFile &file, 
                           const std::vector<Location> &locations)
{
    unsigned maxid = 0;

    StringTable country;
    StringTable region;
    StringTable city;

    for (size_t i = 0; i < locations.size(); ++i)
    {
        const Location &loc = locations[i];

        maxid = std::max(loc.id, maxid);

        country.insert(loc.country);
        region.insert(loc.region);
        city.insert(loc.city);
    }

    save_string_table(file, country);
    save_string_table(file, region);
    save_string_table(file, city);

    std::vector<PackedLocation> packed;
    packed.resize(maxid + 1);

    for (size_t i = 0; i < locations.size(); ++i)
    {
        const Location &loc = locations[i];

        PackedLocation &ploc = packed[loc.id];

        ploc.id = loc.id;
        ploc.country = country.index_of(loc.country);
        ploc.region = region.index_of(loc.region);
        ploc.city = city.index_of(loc.city);
        ploc.lat = strtof(loc.lat.c_str(), 0);
        ploc.lon = strtof(loc.lon.c_str(), 0);
    }

    file.save_pod_vector(packed);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x178, %rsp            # imm = 0x178
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x118(%rsp), %rdi
callq 0x5b7c
leaq 0xb8(%rsp), %rdi
callq 0x5b7c
movq %rbx, 0x18(%rsp)
leaq 0x58(%rsp), %rdi
callq 0x5b7c
xorl %r15d, %r15d
pushq $0x28
popq %rbx
leaq 0x58(%rsp), %rbp
xorl %r12d, %r12d
movq (%r14), %r13
movq 0x8(%r14), %rax
subq %r13, %rax
cqto
movl $0xa8, %ecx
idivq %rcx
cmpq %rax, %r12
jae 0x53e6
leaq (%rbx,%r13), %rsi
addq $-0x20, %rsi
movl -0x8(%rsi), %eax
cmpl %r15d, %eax
cmoval %eax, %r15d
leaq 0x118(%rsp), %rdi
callq 0x5bb0
leaq (%rbx,%r13), %rsi
leaq 0xb8(%rsp), %rdi
callq 0x5bb0
leaq (%rbx,%r13), %rsi
addq $0x20, %rsi
movq %rbp, %rdi
callq 0x5bb0
incq %r12
addq $0xa8, %rbx
jmp 0x5381
leaq 0x118(%rsp), %rsi
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
callq 0x5c33
leaq 0xb8(%rsp), %rsi
movq %rbx, %rdi
callq 0x5c33
leaq 0x58(%rsp), %rsi
movq %rbx, %rdi
callq 0x5c33
xorps %xmm0, %xmm0
leaq 0x20(%rsp), %rdi
movaps %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
incl %r15d
movaps %xmm0, 0x40(%rsp)
andq $0x0, 0x50(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0x40(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r15, %rsi
callq 0x5c5c
pushq $0x48
popq %rbp
xorl %ebx, %ebx
movq (%r14), %r12
movq 0x8(%r14), %rax
subq %r12, %rax
cqto
movl $0xa8, %ecx
idivq %rcx
cmpq %rax, %rbx
jae 0x54fd
leaq (%r12,%rbp), %rsi
addq $-0x40, %rsi
movl -0x8(%rsi), %eax
movq 0x20(%rsp), %r15
imulq $0x18, %rax, %r13
movl %eax, (%r15,%r13)
leaq 0x118(%rsp), %rdi
callq 0x5ca0
addq %r13, %r15
movl %eax, 0x4(%r15)
leaq (%r12,%rbp), %rsi
addq $-0x20, %rsi
leaq 0xb8(%rsp), %rdi
callq 0x5ca0
movl %eax, 0x8(%r15)
leaq (%r12,%rbp), %rsi
leaq 0x58(%rsp), %rdi
callq 0x5ca0
movl %eax, 0xc(%r15)
movq 0x20(%r12,%rbp), %rdi
xorl %esi, %esi
callq 0x32c0
movss %xmm0, 0x10(%r15)
movq 0x40(%r12,%rbp), %rdi
xorl %esi, %esi
callq 0x32c0
movss %xmm0, 0x14(%r15)
incq %rbx
addq $0xa8, %rbp
jmp 0x5456
leaq 0x20(%rsp), %rsi
movq 0x18(%rsp), %rdi
callq 0x5cc2
leaq 0x20(%rsp), %rdi
callq 0x6c08
leaq 0x58(%rsp), %rdi
callq 0x5d5a
leaq 0xb8(%rsp), %rdi
callq 0x5d5a
leaq 0x118(%rsp), %rdi
callq 0x5d5a
addq $0x178, %rsp            # imm = 0x178
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x556b
jmp 0x555c
movq %rax, %rbx
jmp 0x5585
movq %rax, %rbx
jmp 0x5578
jmp 0x556b
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x6c08
jmp 0x556e
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x5d5a
leaq 0xb8(%rsp), %rdi
callq 0x5d5a
leaq 0x118(%rsp), %rdi
callq 0x5d5a
movq %rbx, %rdi
callq 0x3370
movq %rax, %rdi
callq 0x3e8f