// File: /workspace/github_cpp_makefile_star2_O3/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 %r14d, %r14d
movl $0x400, %edx            # imm = 0x400
xorl %esi, %esi
callq 0x8390
xorl %edi, %edi
callq 0x85b0
leaq -0xc0(%rbp), %r12
xorps %xmm0, %xmm0
movq %rax, %rdi
movq %r12, %rsi
callq 0x4f104
addq $0x8, %r13
leaq -0x90(%rbp), %r15
movq %r13, %rdi
movq %r15, %rsi
callq 0x500e2
movsd (%r15), %xmm0
andpd 0x6d9e(%rip), %xmm0     # 0x69930
mulsd 0xc29e(%rip), %xmm0     # 0x6ee38
leaq -0x70(%rbp), %rbx
movq %rbx, %rdi
movl $0x7, %esi
callq 0x4ff6a
movsd 0x8(%r15), %xmm0
andpd 0x6d77(%rip), %xmm0     # 0x69930
mulsd 0xc277(%rip), %xmm0     # 0x6ee38
leaq -0x50(%rbp), %r13
movq %r13, %rdi
movl $0x7, %esi
callq 0x4ff6a
movsd 0x10(%r15), %xmm7
movsd 0x18(%r12), %xmm0
movsd 0x20(%r12), %xmm1
movsd 0x28(%r12), %xmm2
movsd 0x10(%rbx), %xmm4
movsd 0x7cbd(%rip), %xmm8     # 0x6a8b8
divsd %xmm8, %xmm4
addsd 0x8(%rbx), %xmm4
movsd (%rbx), %xmm3
movsd (%r15), %xmm5
xorpd %xmm10, %xmm10
ucomisd %xmm10, %xmm5
leaq 0x8c7d(%rip), %rax      # 0x6b89c
leaq 0x12775(%rip), %rdx     # 0x7539b
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 0x127be(%rip), %rax     # 0x75411
leaq 0x1274c(%rip), %rcx     # 0x753a6
cmovaeq %rax, %rcx
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x10(%rsp)
movsd %xmm7, 0x8(%rsp)
subsd %xmm7, %xmm7
movsd %xmm7, (%rsp)
leaq 0x16665(%rip), %rsi     # 0x792e8
movsd 0x6c95(%rip), %xmm7     # 0x69920
leaq -0x4c0(%rbp), %rdi
movl $0x1, %r8d
xorl %r9d, %r9d
movb $0x8, %al
callq 0x8120
leaq -0x4bf(%rbp), %rcx
movl %r14d, %edx
movb (%rcx), %sil
movl %esi, %r14d
xorb %dl, %r14b
incq %rcx
testb %sil, %sil
jne 0x62ca9
cltq
leaq (%rax,%rbp), %rbx
addq $-0x4c0, %rbx           # imm = 0xFB40
movsbl %dl, %edx
leaq 0x16671(%rip), %rsi     # 0x79345
movq %rbx, %rdi
movl $0xd, %ecx
movl $0xa, %r8d
xorl %eax, %eax
callq 0x8120
addl %eax, %ebx
leaq -0x4c0(%rbp), %rsi
subl %esi, %ebx
movq -0x30(%rbp), %rdi
movl %ebx, %edx
callq 0x59f9f
addq $0x4b8, %rsp            # imm = 0x4B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop