// File: /workspace/github_cpp_makefile_star2_O3/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 0x7dd8(%rip), %rsi      # 0xf1e8
cmovneq %rax, %rsi
leaq -0x68(%rbp), %r12
leaq -0x29(%rbp), %rdx
movq %r12, %rdi
callq 0x8a02
movq $-0x1, %rbx
movq $-0x8, %r14
xorl %eax, %eax
leaq 0x40da(%rip), %r15      # 0xb515
movl $0xb, %ecx
movq %r12, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x2250
movl $0xb, %ecx
movq %r12, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x22d0
incq %rbx
addq $0x8, %r14
cmpq $-0x1, %rax
jne 0x743b
movq %r14, %rdi
callq 0x2030
movq %rax, %r14
testl %ebx, %ebx
je 0x7543
xorl %r15d, %r15d
movq %rbx, %r12
leaq -0x88(%rbp), %rbx
movq %r12, -0x38(%rbp)
movq %r14, -0x40(%rbp)
movl $0xb, %ecx
leaq -0x68(%rbp), %rdi
leaq 0x406f(%rip), %rsi      # 0xb515
movq %r15, %rdx
callq 0x2250
movq %rax, %r13
movl $0xc, %ecx
leaq -0x68(%rbp), %rdi
leaq 0x4053(%rip), %rsi      # 0xb514
movq %rax, %rdx
callq 0x22d0
movq %rax, %r15
movq %rax, %rcx
subq %r13, %rcx
movq %rbx, %rdi
leaq -0x68(%rbp), %rsi
movq %r13, %rdx
callq 0x21c0
movq %rbx, %rdi
xorl %esi, %esi
callq 0x5a62
movsd %xmm0, (%r14)
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x750c
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x21b0
addq $0x8, %r14
decq %r12
jne 0x7496
xorpd %xmm0, %xmm0
movq -0x38(%rbp), %rbx
testl %ebx, %ebx
movq -0x40(%rbp), %r14
xorpd %xmm1, %xmm1
je 0x754b
xorl %eax, %eax
addsd (%r14,%rax,8), %xmm1
addsd 0x8(%r14,%rax,8), %xmm0
addq $0x2, %rax
cmpq %rbx, %rax
jb 0x752b
jmp 0x754b
xorpd %xmm0, %xmm0
xorpd %xmm1, %xmm1
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 0x2290
movq %rax, %rbx
leaq 0x3cc2(%rip), %rsi      # 0xb24e
movl $0x1, %edx
movq %rax, %rdi
callq 0x21d0
movsd -0x40(%rbp), %xmm0
divsd -0x38(%rbp), %xmm0
movq %rbx, %rdi
callq 0x2290
leaq 0x3c9c(%rip), %rsi      # 0xb24e
movl $0x1, %edx
movq %rax, %rdi
callq 0x21d0
movq %r14, %rdi
callq 0x2200
leaq -0x58(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x75e0
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x21b0
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x75f1
movq %rax, %rbx
jmp 0x7615
movq %rax, %rbx
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x7615
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x21b0
leaq -0x58(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x762e
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x21b0
movq %rbx, %rdi
callq 0x2330