// File: /workspace/github_cpp_makefile_star2_O1/openflightmaps[P]ofm2xplane/main.cpp
// Function: write_center(rapidxml::xml_node<char>*, std::basic_ofstream<char, std::char_traits<char>>&)
void write_center(xml_node <> *source, ofstream &out)
{
    // Extracting coordinates 
    string s(source->value());
    size_t l=0,r=-1;
    int c=0;
    double x=0.0, y=0.0;
    
    while(true)
    {
        l=s.find_first_of("1234567890.",r+1);
        r=s.find_first_not_of("1234567890.",l)-1;
        c++;
        if(r==s.npos-1)
            break;
    }
    c--;

    double *coor=new double[c];
    l=0;
    r=-1;
    
    // Saving the numbers in double array
    for(int i=0;i<c;i++)
    {
        l=s.find_first_of("1234567890.",r+1);
        r=s.find_first_not_of("11234567890.",l)-1;
        coor[i]=my_stod(s.substr(l,r-l+1));
    }
    
    for(int i=0;i<c;i=i+2)
    {
        x+=coor[i];
        y+=coor[i+1];
    }
    c=c/2;
    x=x/c;
    y=y/c;
    out << fixed << y << " " << x << " ";
    delete [] coor;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, -0x48(%rbp)
movq 0x8(%rdi), %rax
testq %rax, %rax
leaq 0x7df7(%rip), %rsi      # 0xf1f0
cmovneq %rax, %rsi
leaq -0x88(%rbp), %r12
leaq -0x29(%rbp), %rdx
movq %r12, %rdi
callq 0x8a4c
movq $-0x1, %rbx
movq $-0x8, %r14
xorl %eax, %eax
leaq 0x40ee(%rip), %r15      # 0xb515
movl $0xb, %ecx
movq %r12, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x2260
movl $0xb, %ecx
movq %r12, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x22e0
incq %rbx
addq $0x8, %r14
cmpq $-0x1, %rax
jne 0x7427
movq %r14, %rdi
callq 0x2030
movq %rax, %r14
testl %ebx, %ebx
je 0x7534
xorl %r13d, %r13d
leaq -0x68(%rbp), %r15
movq %rbx, -0x38(%rbp)
movq %rbx, %r12
movq %r14, -0x40(%rbp)
movl $0xb, %ecx
leaq -0x88(%rbp), %rbx
movq %rbx, %rdi
leaq 0x4080(%rip), %rsi      # 0xb515
movq %r13, %rdx
callq 0x2260
movq %rax, %r13
movl $0xc, %ecx
movq %rbx, %rdi
leaq 0x4065(%rip), %rsi      # 0xb514
movq %rax, %rdx
callq 0x22e0
movq %rax, %rbx
movq %rax, %rcx
subq %r13, %rcx
movq %r15, %rdi
leaq -0x88(%rbp), %rsi
movq %r13, %rdx
callq 0x21c0
movq %r15, %rdi
xorl %esi, %esi
callq 0x5a83
movsd %xmm0, (%r14)
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
movq %rbx, %r13
je 0x74fd
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x21b0
addq $0x8, %r14
decq %r12
jne 0x747f
xorpd %xmm0, %xmm0
xorl %eax, %eax
xorpd %xmm1, %xmm1
movq -0x40(%rbp), %r14
movq -0x38(%rbp), %rbx
addsd (%r14,%rax,8), %xmm1
addsd 0x8(%r14,%rax,8), %xmm0
addq $0x2, %rax
cmpq %rbx, %rax
jb 0x751c
jmp 0x753c
xorpd %xmm1, %xmm1
xorpd %xmm0, %xmm0
movsd %xmm1, -0x40(%rbp)
shrl %ebx
xorps %xmm1, %xmm1
cvtsi2sd %ebx, %xmm1
movq -0x48(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
movl $0xfffffefb, %ecx       # imm = 0xFFFFFEFB
andl 0x18(%rdi,%rax), %ecx
orl $0x4, %ecx
movl %ecx, 0x18(%rdi,%rax)
movsd %xmm1, -0x38(%rbp)
divsd %xmm1, %xmm0
callq 0x22a0
movq %rax, %rbx
leaq 0x3cd1(%rip), %rsi      # 0xb24e
movl $0x1, %edx
movq %rax, %rdi
callq 0x21d0
movsd -0x40(%rbp), %xmm0
divsd -0x38(%rbp), %xmm0
movq %rbx, %rdi
callq 0x22a0
leaq 0x3cab(%rip), %rsi      # 0xb24e
movl $0x1, %edx
movq %rax, %rdi
callq 0x21d0
movq %r14, %rdi
callq 0x2200
leaq -0x78(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x75d1
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x21b0
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x75e2
movq %rax, %rbx
jmp 0x7603
movq %rax, %rbx
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x7603
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x21b0
leaq -0x78(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x761c
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x21b0
movq %rbx, %rdi
callq 0x2340