// File: /workspace/github_cpp_makefile_star2_O1/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 $0x4a8, %rsp            # imm = 0x4A8
movq %rdi, %r13
leaq -0x4d0(%rbp), %rdi
movl $0x400, %edx            # imm = 0x400
xorl %esi, %esi
callq 0x8390
movq 0x1c38(%r13), %rbx
leaq 0x1c28(%r13), %r14
cmpq %r14, %rbx
je 0x62fbb
leaq 0x40(%rbx), %r15
movq 0x40(%rbx), %r12
cmpq %r15, %r12
je 0x62fab
leaq 0x10(%r12), %rsi
movq %r13, %rdi
callq 0x63258
movq (%r12), %r12
jmp 0x62f93
movq %rbx, %rdi
callq 0x8460
movq %rax, %rbx
cmpq %r14, %rax
jne 0x62f8b
cmpb $0x1, (%r13)
jne 0x63183
leaq 0x2070(%r13), %rax
movq %rax, -0x38(%rbp)
leaq 0x20c8(%r13), %rax
movq %rax, -0x40(%rbp)
leaq 0x2098(%r13), %rbx
leaq 0x2050(%r13), %r12
movq %rbx, -0x50(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x85b0
movq -0x88(%rbp), %rax
movq %rax, %rcx
subq 0x8(%r13), %rcx
movq %rcx, -0x48(%rbp)
cmpq $0x6, %rcx
jl 0x6301e
movq %rax, 0x8(%r13)
movq %r13, %rdi
callq 0x6334a
movq 0x2080(%r13), %r15
cmpq -0x38(%rbp), %r15
je 0x6316e
leaq 0x20(%r15), %rsi
movq -0x40(%rbp), %rdi
movq %rsi, -0x30(%rbp)
callq 0x63fe2
cmpq $0x6, -0x48(%rbp)
jl 0x63068
cmpl $0x0, (%rax)
jne 0x63068
movq 0x40(%r15), %r14
movq -0x40(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x63fe2
movq %r14, %rsi
movq %rax, %rdx
callq 0x6372e
movq 0x40(%r15), %rdi
leaq -0x4d0(%rbp), %rsi
movl $0x400, %edx            # imm = 0x400
callq 0x59eea
testl %eax, %eax
jle 0x63159
movl %eax, %eax
movq %rax, -0x60(%rbp)
xorl %r14d, %r14d
movq %r15, -0x58(%rbp)
movq %rbx, %rdi
movq -0x30(%rbp), %rsi
callq 0x64062
movq (%rax), %rdi
movzbl -0x4d0(%rbp,%r14), %esi
callq 0x39491
cmpl $0x1, %eax
jne 0x6314c
leaq -0x70(%rbp), %rax
movq %rax, -0x80(%rbp)
movq 0x20(%r15), %rsi
movq 0x28(%r15), %rdx
addq %rsi, %rdx
movq %rbx, %r15
movq %r13, %rbx
leaq -0x80(%rbp), %rdi
callq 0x1143c
movq %r15, %rdi
leaq -0xd0(%rbp), %r15
movq -0x30(%rbp), %rsi
callq 0x64062
movq (%rax), %rcx
movq %r15, %rdi
movq %rbx, %rsi
leaq -0x80(%rbp), %rdx
callq 0x6391e
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x63111
callq 0x85d0
cmpq $0x0, -0x90(%rbp)
je 0x63135
movq %r12, %r13
movq (%r13), %r13
cmpq %r12, %r13
je 0x63135
movq 0x10(%r13), %rdi
movq %r15, %rsi
callq 0x2b9e0
jmp 0x6311e
leaq -0xb8(%rbp), %rdi
callq 0x28966
movq %rbx, %r13
movq -0x50(%rbp), %rbx
movq -0x58(%rbp), %r15
incq %r14
cmpq -0x60(%rbp), %r14
jne 0x63092
movq %r15, %rdi
callq 0x8460
movq %rax, %r15
cmpq -0x38(%rbp), %rax
jne 0x6302f
movl $0x32, %edi
callq 0x508e9
cmpb $0x0, (%r13)
jne 0x62fee
movq 0x2080(%r13), %rbx
leaq 0x2070(%r13), %r14
cmpq %r14, %rbx
je 0x631b8
movq 0x40(%rbx), %rdi
callq 0x59b29
movq 0x40(%rbx), %rdi
callq 0x87b0
movq %rbx, %rdi
callq 0x8460
movq %rax, %rbx
cmpq %r14, %rax
jne 0x63196
movq 0x20b0(%r13), %rbx
leaq 0x20a0(%r13), %r14
cmpq %r14, %rbx
je 0x631ed
movq 0x40(%rbx), %rdi
callq 0x392c1
movq 0x40(%rbx), %rdi
callq 0x87b0
movq %rbx, %rdi
callq 0x8460
movq %rax, %rbx
cmpq %r14, %rax
jne 0x631cb
leaq 0x2098(%r13), %rbx
leaq 0x2068(%r13), %rdi
callq 0x64b0e
movq %rbx, %rdi
callq 0x64b46
addq $0x20c8, %r13           # imm = 0x20C8
movq %r13, %rdi
callq 0x64b7e
addq $0x4a8, %rsp            # imm = 0x4A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x6324f
callq 0x85d0
jmp 0x6324f
movq %rax, %rbx
leaq -0xb8(%rbp), %rdi
callq 0x28966
movq %rbx, %rdi
callq 0x8b40
nop