// File: /workspace/github_cpp_makefile_star2_O2/DoubleString[P]RtConverter/src/VrsObs/VrsNtripClient.cpp
// Function: bamboo::VrsNtripClient::m_routine()
void VrsNtripClient::m_routine() {
	time_t tt;
	bool lcheck;
	int nread = 0, i;
	char cmd[1024] = { 0 }, buff[1024] = { 0 }, strbuf[1024] = { 0 };
	list<VrsStaItem>::iterator staItr;
	list<RtConverter*>::iterator rtItr;
	map<string, list<VrsStaItem>>::iterator mapItr;
	map<string, stream_t*>::iterator streamItr;
	map<string, rtcm_t*>::iterator rtcmItr;
	map<string, VrsStaItem>::iterator vrsItr;
	for (mapItr = configs_sav.rt_mounts.begin(); mapItr != configs_sav.rt_mounts.end(); ++mapItr) {
		for (staItr = (*mapItr).second.begin(); staItr != (*mapItr).second.end(); ++staItr) {
			m_newConnection((*staItr));
		}
	}
	while (lcont) {
		lcheck = false;
		time(&tt);
		if (tt - lastCheck > 5) {
			lcheck = true;
			lastCheck = tt;
			m_adaptConfigures();
		}
		for (streamItr = m_streams.begin(); streamItr != m_streams.end(); ++streamItr) {
			if (m_stas[(*streamItr).first].type == VrsStaItem::stream_type::vrs && lcheck) {
				//// sending GGA here
				m_sendGGAReq((*streamItr).second, m_stas[(*streamItr).first]);
			}
			nread = strread((*streamItr).second, (unsigned char*)buff, 1024);
			for (i = 0; i < nread; i++) {
				if (input_rtcm3(m_rtcms[(*streamItr).first], buff[i]) == 1) {
					RtConvItem curitem = m_makeupItems((*streamItr).first, m_rtcms[(*streamItr).first]);
					if (curitem.obslist.size() > 0) {
						for (rtItr = m_svrs.begin(); rtItr != m_svrs.end(); ++rtItr) {
							(*rtItr)->inputObs(curitem);
						}
					}
				}
			}
		}
		sleepms(50);
	}
	/// will delete memory here
	for (streamItr = m_streams.begin(); streamItr != m_streams.end(); ++streamItr) {
		strclose((*streamItr).second);
		free((*streamItr).second);
	}
	for (rtcmItr = m_rtcms.begin(); rtcmItr != m_rtcms.end(); ++rtcmItr) {
		free_rtcm((*rtcmItr).second);
		free((*rtcmItr).second);
	}
	m_streams.clear();
	m_rtcms.clear();
	m_stas.clear();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x4b8, %rsp            # imm = 0x4B8
movq %rdi, %r13
leaq -0x4e0(%rbp), %rdi
movl $0x400, %edx            # imm = 0x400
xorl %esi, %esi
callq 0x8390
movq 0x1c38(%r13), %rbx
leaq 0x1c28(%r13), %r14
cmpq %r14, %rbx
je 0x58c17
leaq 0x40(%rbx), %r15
movq %r15, %r12
movq (%r12), %r12
cmpq %r15, %r12
je 0x58c0a
leaq 0x10(%r12), %rsi
movq %r13, %rdi
callq 0x58e88
jmp 0x58bf2
movq %rbx, %rdi
callq 0x8460
movq %rax, %rbx
jmp 0x58be6
leaq 0x2070(%r13), %rax
movq %rax, -0x48(%rbp)
leaq 0x20c8(%r13), %rax
movq %rax, -0x30(%rbp)
leaq 0x2098(%r13), %r12
leaq 0x2050(%r13), %rbx
movq %r12, -0x58(%rbp)
cmpb $0x1, (%r13)
jne 0x58dd0
leaq -0x70(%rbp), %rdi
callq 0x85b0
movq -0x70(%rbp), %rax
movq %rax, %rcx
subq 0x8(%r13), %rcx
movq %rcx, -0x50(%rbp)
cmpq $0x6, %rcx
jl 0x58c74
movq %rax, 0x8(%r13)
movq %r13, %rdi
callq 0x58f48
movq 0x2080(%r13), %rax
cmpq -0x48(%rbp), %rax
je 0x58dc3
movq %rax, -0x38(%rbp)
leaq 0x20(%rax), %rsi
movq -0x30(%rbp), %rdi
movq %rsi, -0x40(%rbp)
callq 0x597fc
cmpq $0x6, -0x50(%rbp)
jl 0x58cc6
cmpl $0x0, (%rax)
jne 0x58cc6
movq -0x38(%rbp), %rax
movq 0x40(%rax), %r15
movq -0x30(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x597fc
movq %r15, %rsi
movq %rax, %rdx
callq 0x59170
movq -0x38(%rbp), %rax
movq 0x40(%rax), %rdi
leaq -0x4e0(%rbp), %rsi
movl $0x400, %edx            # imm = 0x400
callq 0x50440
movl %eax, %r14d
testl %eax, %eax
movl $0x0, %eax
cmovlel %eax, %r14d
xorl %r15d, %r15d
movq %r14, -0x60(%rbp)
cmpq %r14, %r15
je 0x58db5
movq %r12, %rdi
movq -0x40(%rbp), %rsi
callq 0x59866
movq (%rax), %rdi
movzbl -0x4e0(%rbp,%r15), %esi
callq 0x32cf6
cmpl $0x1, %eax
jne 0x58dad
movq %r15, -0x68(%rbp)
movq %r12, %r14
movq %r13, %r12
leaq -0x90(%rbp), %r13
movq %r13, %rdi
movq -0x40(%rbp), %r15
movq %r15, %rsi
callq 0x8870
movq %r14, %rdi
leaq -0xd8(%rbp), %r14
movq %r15, %rsi
callq 0x59866
movq (%rax), %rcx
movq %r14, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x59358
movq %r13, %rdi
callq 0x82c0
cmpq $0x0, -0x98(%rbp)
movq -0x68(%rbp), %r15
je 0x58d96
movq %rbx, %r13
movq (%r13), %r13
cmpq %rbx, %r13
je 0x58d96
movq 0x10(%r13), %rdi
movq %r14, %rsi
callq 0x26a60
jmp 0x58d7f
leaq -0xc0(%rbp), %rdi
callq 0x23a3a
movq %r12, %r13
movq -0x58(%rbp), %r12
movq -0x60(%rbp), %r14
incq %r15
jmp 0x58cf4
movq -0x38(%rbp), %rdi
callq 0x8460
jmp 0x58c7b
pushq $0x32
popq %rdi
callq 0x47c59
jmp 0x58c3f
movq 0x2080(%r13), %rbx
cmpq -0x48(%rbp), %rbx
je 0x58dfc
movq 0x40(%rbx), %rdi
callq 0x5009c
movq 0x40(%rbx), %rdi
callq 0x8780
movq %rbx, %rdi
callq 0x8460
movq %rax, %rbx
jmp 0x58dd7
movq 0x20b0(%r13), %rbx
leaq 0x20a0(%r13), %r14
cmpq %r14, %rbx
je 0x58e2e
movq 0x40(%rbx), %rdi
callq 0x32b2a
movq 0x40(%rbx), %rdi
callq 0x8780
movq %rbx, %rdi
callq 0x8460
movq %rax, %rbx
jmp 0x58e0a
addq $0x2068, %r13           # imm = 0x2068
movq %r13, %rdi
callq 0x5a3da
movq %r12, %rdi
callq 0x5a412
movq -0x30(%rbp), %rdi
callq 0x5a44a
addq $0x4b8, %rsp            # imm = 0x4B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x90(%rbp), %rdi
callq 0x82c0
jmp 0x58e80
movq %rax, %rbx
leaq -0xc0(%rbp), %rdi
callq 0x23a3a
movq %rbx, %rdi
callq 0x8b30