// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x4b8, %rsp            # imm = 0x4B8
movq %rdx, %r13
movq %rsi, -0x30(%rbp)
leaq -0x4c0(%rbp), %rdi
xorl %r12d, %r12d
movl $0x400, %edx            # imm = 0x400
xorl %esi, %esi
callq 0x8390
xorl %edi, %edi
callq 0x85b0
leaq -0xc0(%rbp), %rsi
xorps %xmm0, %xmm0
movq %rax, %rdi
callq 0x46fbf
addq $0x8, %r13
leaq -0x90(%rbp), %r15
movq %r13, %rdi
movq %r15, %rsi
callq 0x47dfd
movsd (%r15), %xmm0
andpd 0x6753(%rip), %xmm0     # 0x5f930
mulsd 0xb50b(%rip), %xmm0     # 0x646f0
leaq -0x70(%rbp), %rbx
pushq $0x7
popq %r14
movq %rbx, %rdi
movl %r14d, %esi
callq 0x47c8e
movsd 0x8(%r15), %xmm0
andpd 0x672a(%rip), %xmm0     # 0x5f930
mulsd 0xb4e2(%rip), %xmm0     # 0x646f0
leaq -0x50(%rbp), %r13
movq %r13, %rdi
movl %r14d, %esi
callq 0x47c8e
movsd 0x10(%r15), %xmm7
leaq -0xc0(%rbp), %rax
movsd 0x18(%rax), %xmm0
movsd 0x20(%rax), %xmm1
movsd 0x28(%rax), %xmm2
movsd 0x10(%rbx), %xmm4
movsd 0x7661(%rip), %xmm8     # 0x608a8
divsd %xmm8, %xmm4
addsd 0x8(%rbx), %xmm4
movsd (%rbx), %xmm3
movsd (%r15), %xmm5
xorpd %xmm10, %xmm10
ucomisd %xmm10, %xmm5
leaq 0x8621(%rip), %rax      # 0x6188c
leaq 0x1213f(%rip), %rdx     # 0x6b3b1
cmovaeq %rax, %rdx
movsd 0x8(%r15), %xmm9
movsd (%r13), %xmm5
movsd 0x10(%r13), %xmm6
divsd %xmm8, %xmm6
addsd 0x8(%r13), %xmm6
ucomisd %xmm10, %xmm9
leaq 0x12188(%rip), %rax     # 0x6b427
leaq 0x12116(%rip), %rcx     # 0x6b3bc
cmovaeq %rax, %rcx
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x10(%rsp)
movsd %xmm7, 0x8(%rsp)
subsd %xmm7, %xmm7
movsd %xmm7, (%rsp)
leaq 0x15fe9(%rip), %rsi     # 0x6f2b8
pushq $0x1
popq %r8
movsd 0x6645(%rip), %xmm7     # 0x5f920
leaq -0x4c0(%rbp), %rdi
xorl %r9d, %r9d
movb $0x8, %al
callq 0x8110
leaq -0x4bf(%rbp), %rcx
movl %r12d, %edx
movb (%rcx), %sil
movl %esi, %r12d
xorb %dl, %r12b
incq %rcx
testb %sil, %sil
jne 0x592f3
cltq
leaq (%rax,%rbp), %rbx
addq $-0x4c0, %rbx           # imm = 0xFB40
movsbl %dl, %edx
leaq 0x15ff7(%rip), %rsi     # 0x6f315
pushq $0xd
popq %rcx
pushq $0xa
popq %r8
movq %rbx, %rdi
xorl %eax, %eax
callq 0x8110
addl %eax, %ebx
leaq -0x4c0(%rbp), %rsi
subl %esi, %ebx
movq -0x30(%rbp), %rdi
movl %ebx, %edx
callq 0x51054
addq $0x4b8, %rsp            # imm = 0x4B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop