// File: DoubleString[P]RtConverter/src/VrsObs/VrsNtripClient.cpp
// Function: bamboo::VrsNtripClient::m_sendGGAReq(bamboo::stream_t*, bamboo::VrsStaItem&)
void VrsNtripClient::m_sendGGAReq(stream_t* stream, VrsStaItem& item) {
	char buff[1024] = { 0 };
	gtime_t gtime = { 0 };
	double h, ep[6], pos[3], dms1[3], dms2[3], dop = 1.0;
	int solq = 1,nsend;
	char *p = (char *)buff, *q, sum;
	gtime.time = time(NULL);
	time2epoch(gtime, ep);
	ecef2pos(item.x, pos);
	deg2dms(fabs(pos[0])*R2D, dms1, 7);
	deg2dms(fabs(pos[1])*R2D, dms2, 7);
	h = pos[2];
	p += sprintf(p, "$GPGGA,%02.0f%02.0f%05.2f,%02.0f%010.7f,%s,%03.0f%010.7f,%s,%d,%02d,%.1f,%.3f,M,%.3f,M,%.1f,",
		ep[3], ep[4], ep[5], dms1[0], dms1[1] + dms1[2] / 60.0, pos[0] >= 0 ? "N" : "S",
		dms2[0], dms2[1] + dms2[2] / 60.0, pos[1] >= 0 ? "E" : "W", solq,
		0, dop, pos[2] - h, h, 1.0);

	for (q = (char *)buff + 1, sum = 0; *q; q++) sum ^= *q; /* check-sum */
	p += sprintf(p, "*%02X%c%c", sum, 0x0D, 0x0A);
	nsend =  p - (char *)buff;
	strwrite(stream, (unsigned char*)buff, nsend);
	return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x580, %rsp            # imm = 0x580
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
leaq -0x420(%rbp), %rdi
xorl %esi, %esi
movl $0x400, %edx            # imm = 0x400
callq 0x93d0
leaq -0x430(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x93d0
movsd 0xc6fb(%rip), %xmm0     # 0xbbe60
movsd %xmm0, -0x4d8(%rbp)
movl $0x1, -0x4dc(%rbp)
leaq -0x420(%rbp), %rax
movq %rax, -0x4e8(%rbp)
xorl %eax, %eax
movl %eax, %edi
callq 0x96e0
movq %rax, -0x430(%rbp)
movq -0x430(%rbp), %rax
movq %rax, -0x508(%rbp)
movq -0x428(%rbp), %rax
movq %rax, -0x500(%rbp)
leaq -0x470(%rbp), %rsi
movq -0x508(%rbp), %rdi
movsd -0x500(%rbp), %xmm0
callq 0x8e2f0
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
leaq -0x490(%rbp), %rsi
callq 0x8fb80
movsd -0x490(%rbp), %xmm0
movaps 0xda31(%rip), %xmm1     # 0xbd220
pand %xmm1, %xmm0
movsd 0x111f5(%rip), %xmm1    # 0xc09f0
mulsd %xmm1, %xmm0
leaq -0x4b0(%rbp), %rdi
movl $0x7, %esi
callq 0x8f960
movsd -0x488(%rbp), %xmm0
movaps 0xda01(%rip), %xmm1     # 0xbd220
pand %xmm1, %xmm0
movsd 0x111c5(%rip), %xmm1    # 0xc09f0
mulsd %xmm1, %xmm0
leaq -0x4d0(%rbp), %rdi
movl $0x7, %esi
callq 0x8f960
movsd -0x480(%rbp), %xmm0
movsd %xmm0, -0x438(%rbp)
movq -0x4e8(%rbp), %rax
movq %rax, -0x538(%rbp)
movsd -0x458(%rbp), %xmm0
movsd %xmm0, -0x530(%rbp)
movsd -0x450(%rbp), %xmm0
movsd %xmm0, -0x528(%rbp)
movsd -0x448(%rbp), %xmm0
movsd %xmm0, -0x520(%rbp)
movsd -0x4b0(%rbp), %xmm0
movsd %xmm0, -0x518(%rbp)
movsd -0x4a8(%rbp), %xmm0
movsd -0x4a0(%rbp), %xmm1
movsd 0xd562(%rip), %xmm2     # 0xbce18
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, -0x510(%rbp)
movsd -0x490(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0xaf8e7
leaq 0xdf7e(%rip), %rax      # 0xbd85c
movq %rax, -0x540(%rbp)
jmp 0xaf8f7
leaq 0x185e0(%rip), %rax     # 0xc7ece
movq %rax, -0x540(%rbp)
jmp 0xaf8f7
movq -0x540(%rbp), %rax
movq %rax, -0x558(%rbp)
movsd -0x4d0(%rbp), %xmm0
movsd %xmm0, -0x550(%rbp)
movsd -0x4c8(%rbp), %xmm0
movsd -0x4c0(%rbp), %xmm1
movsd 0xd4eb(%rip), %xmm2     # 0xbce18
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, -0x548(%rbp)
movsd -0x488(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0xaf95e
leaq 0x1873d(%rip), %rax     # 0xc8092
movq %rax, -0x560(%rbp)
jmp 0xaf96e
leaq 0x18574(%rip), %rax     # 0xc7ed9
movq %rax, -0x560(%rbp)
jmp 0xaf96e
movsd -0x548(%rbp), %xmm6
movsd -0x550(%rbp), %xmm5
movq -0x558(%rbp), %rdx
movsd -0x510(%rbp), %xmm4
movsd -0x518(%rbp), %xmm3
movsd -0x520(%rbp), %xmm2
movsd -0x528(%rbp), %xmm1
movsd -0x530(%rbp), %xmm0
movq -0x538(%rbp), %rdi
movq -0x560(%rbp), %rcx
movl -0x4dc(%rbp), %r8d
movsd -0x4d8(%rbp), %xmm7
movsd -0x480(%rbp), %xmm10
subsd -0x438(%rbp), %xmm10
movsd -0x438(%rbp), %xmm9
leaq 0x1c64e(%rip), %rsi     # 0xcc03a
xorl %r9d, %r9d
movsd 0xc468(%rip), %xmm8     # 0xbbe60
movsd %xmm10, (%rsp)
movsd %xmm9, 0x8(%rsp)
movsd %xmm8, 0x10(%rsp)
movb $0x8, %al
callq 0x9150
movl %eax, %ecx
movq -0x4e8(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x4e8(%rbp)
leaq -0x420(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x4f0(%rbp)
movb $0x0, -0x4f1(%rbp)
movq -0x4f0(%rbp), %rax
cmpb $0x0, (%rax)
je 0xafa7b
movq -0x4f0(%rbp), %rax
movsbl (%rax), %ecx
movsbl -0x4f1(%rbp), %eax
xorl %ecx, %eax
movb %al, -0x4f1(%rbp)
movq -0x4f0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x4f0(%rbp)
jmp 0xafa42
movq -0x4e8(%rbp), %rdi
movsbl -0x4f1(%rbp), %edx
leaq 0x1c607(%rip), %rsi     # 0xcc097
movl $0xd, %ecx
movl $0xa, %r8d
movb $0x0, %al
callq 0x9150
movl %eax, %ecx
movq -0x4e8(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x4e8(%rbp)
movq -0x4e8(%rbp), %rax
leaq -0x420(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x4e0(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x420(%rbp), %rsi
movl -0x4e0(%rbp), %edx
callq 0xa09c0
addq $0x580, %rsp            # imm = 0x580
popq %rbp
retq
nop