// File: 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
subq $0xd70, %rsp            # imm = 0xD70
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xd30(%rbp)
movl $0x0, -0x18(%rbp)
leaq -0x420(%rbp), %rdi
xorl %esi, %esi
movl $0x400, %edx            # imm = 0x400
callq 0x93d0
leaq -0x820(%rbp), %rdi
xorl %esi, %esi
movl $0x400, %edx            # imm = 0x400
callq 0x93d0
leaq -0xc20(%rbp), %rdi
xorl %esi, %esi
movl $0x400, %edx            # imm = 0x400
callq 0x93d0
leaq -0xc28(%rbp), %rdi
callq 0x4fff0
leaq -0xc30(%rbp), %rdi
callq 0x45100
leaq -0xc38(%rbp), %rdi
callq 0x50010
leaq -0xc40(%rbp), %rdi
callq 0xb03e0
leaq -0xc48(%rbp), %rdi
callq 0xb0400
leaq -0xc50(%rbp), %rdi
callq 0xb0420
movq -0xd30(%rbp), %rdi
addq $0x10, %rdi
addq $0x1c10, %rdi           # imm = 0x1C10
callq 0x500b0
movq %rax, -0xc58(%rbp)
movq -0xc58(%rbp), %rax
movq %rax, -0xc38(%rbp)
movq -0xd30(%rbp), %rdi
addq $0x10, %rdi
addq $0x1c10, %rdi           # imm = 0x1C10
callq 0x50110
movq %rax, -0xc60(%rbp)
leaq -0xc38(%rbp), %rdi
leaq -0xc60(%rbp), %rsi
callq 0x500e0
testb $0x1, %al
jne 0xaeab8
jmp 0xaeb59
leaq -0xc38(%rbp), %rdi
callq 0x50140
movq %rax, %rdi
addq $0x20, %rdi
callq 0x50160
movq %rax, -0xc68(%rbp)
movq -0xc68(%rbp), %rax
movq %rax, -0xc28(%rbp)
leaq -0xc38(%rbp), %rdi
callq 0x50140
movq %rax, %rdi
addq $0x20, %rdi
callq 0x47f20
movq %rax, -0xc70(%rbp)
leaq -0xc28(%rbp), %rdi
leaq -0xc70(%rbp), %rsi
callq 0x50190
testb $0x1, %al
jne 0xaeb1d
jmp 0xaeb46
leaq -0xc28(%rbp), %rdi
callq 0x501c0
movq -0xd30(%rbp), %rdi
movq %rax, %rsi
callq 0xaf050
leaq -0xc28(%rbp), %rdi
callq 0x501e0
jmp 0xaeae5
jmp 0xaeb48
leaq -0xc38(%rbp), %rdi
callq 0x510f0
jmp 0xaea7e
jmp 0xaeb5b
movq -0xd30(%rbp), %rax
testb $0x1, (%rax)
je 0xaeed3
movb $0x0, -0x11(%rbp)
leaq -0x10(%rbp), %rdi
callq 0x96e0
movq -0xd30(%rbp), %rcx
movq -0x10(%rbp), %rax
subq 0x8(%rcx), %rax
cmpq $0x5, %rax
jle 0xaeba5
movq -0xd30(%rbp), %rdi
movb $0x1, -0x11(%rbp)
movq -0x10(%rbp), %rax
movq %rax, 0x8(%rdi)
callq 0xaf160
movq -0xd30(%rbp), %rdi
addq $0x2068, %rdi           # imm = 0x2068
callq 0xb0440
movq %rax, -0xc78(%rbp)
movq -0xc78(%rbp), %rax
movq %rax, -0xc40(%rbp)
movq -0xd30(%rbp), %rdi
addq $0x2068, %rdi           # imm = 0x2068
callq 0xb04a0
movq %rax, -0xc80(%rbp)
leaq -0xc40(%rbp), %rdi
leaq -0xc80(%rbp), %rsi
callq 0xb0470
testb $0x1, %al
jne 0xaec03
jmp 0xaeec4
movq -0xd30(%rbp), %rax
addq $0x20c8, %rax           # imm = 0x20C8
movq %rax, -0xd38(%rbp)
leaq -0xc40(%rbp), %rdi
callq 0xb05b0
movq -0xd38(%rbp), %rdi
movq %rax, %rsi
callq 0xb04d0
cmpl $0x0, (%rax)
jne 0xaec9c
testb $0x1, -0x11(%rbp)
je 0xaec9c
leaq -0xc40(%rbp), %rdi
callq 0xb05b0
movq %rax, %rcx
movq -0xd30(%rbp), %rax
movq 0x20(%rcx), %rcx
movq %rcx, -0xd40(%rbp)
addq $0x20c8, %rax           # imm = 0x20C8
movq %rax, -0xd48(%rbp)
leaq -0xc40(%rbp), %rdi
callq 0xb05b0
movq -0xd48(%rbp), %rdi
movq %rax, %rsi
callq 0xb04d0
movq -0xd30(%rbp), %rdi
movq -0xd40(%rbp), %rsi
movq %rax, %rdx
callq 0xaf720
leaq -0xc40(%rbp), %rdi
callq 0xb05b0
movq 0x20(%rax), %rdi
leaq -0x820(%rbp), %rsi
movl $0x400, %edx            # imm = 0x400
callq 0x9f3d0
movl %eax, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0xaeeb1
movq -0xd30(%rbp), %rax
addq $0x2098, %rax           # imm = 0x2098
movq %rax, -0xd50(%rbp)
leaq -0xc40(%rbp), %rdi
callq 0xb05b0
movq -0xd50(%rbp), %rdi
movq %rax, %rsi
callq 0xb05d0
movq (%rax), %rdi
movslq -0x1c(%rbp), %rax
movzbl -0x820(%rbp,%rax), %esi
callq 0x6b280
cmpl $0x1, %eax
jne 0xaeea1
leaq -0xc40(%rbp), %rdi
movq %rdi, -0xd68(%rbp)
callq 0xb05b0
movq %rax, %rsi
leaq -0xce8(%rbp), %rdi
callq 0x92d0
movq -0xd30(%rbp), %rax
movq -0xd68(%rbp), %rdi
addq $0x2098, %rax           # imm = 0x2098
movq %rax, -0xd60(%rbp)
callq 0xb05b0
movq -0xd60(%rbp), %rdi
movq %rax, %rsi
callq 0xb05d0
movq %rax, -0xd58(%rbp)
jmp 0xaed79
movq -0xd30(%rbp), %rsi
movq -0xd58(%rbp), %rax
movq (%rax), %rcx
leaq -0xcc8(%rbp), %rdi
leaq -0xce8(%rbp), %rdx
callq 0xafaf0
jmp 0xaed9f
leaq -0xce8(%rbp), %rdi
callq 0x9480
leaq -0xcc8(%rbp), %rdi
addq $0x18, %rdi
callq 0x45600
cmpq $0x0, %rax
jbe 0xaee95
movq -0xd30(%rbp), %rdi
addq $0x2050, %rdi           # imm = 0x2050
callq 0x45530
movq %rax, -0xd00(%rbp)
movq -0xd00(%rbp), %rax
movq %rax, -0xc30(%rbp)
movq -0xd30(%rbp), %rdi
addq $0x2050, %rdi           # imm = 0x2050
callq 0x45590
movq %rax, -0xd08(%rbp)
leaq -0xc30(%rbp), %rdi
leaq -0xd08(%rbp), %rsi
callq 0x45560
testb $0x1, %al
jne 0xaee20
jmp 0xaee93
leaq -0xc30(%rbp), %rdi
callq 0x455c0
movq (%rax), %rdi
leaq -0xcc8(%rbp), %rsi
callq 0x51b20
jmp 0xaee3d
jmp 0xaee3f
leaq -0xc30(%rbp), %rdi
callq 0x4a050
jmp 0xaeded
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xcf0(%rbp)
movl %eax, -0xcf4(%rbp)
leaq -0xce8(%rbp), %rdi
callq 0x9480
jmp 0xaf03b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xcf0(%rbp)
movl %eax, -0xcf4(%rbp)
leaq -0xcc8(%rbp), %rdi
callq 0x456b0
jmp 0xaf03b
jmp 0xaee95
leaq -0xcc8(%rbp), %rdi
callq 0x456b0
jmp 0xaeea3
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xaecc7
jmp 0xaeeb3
leaq -0xc40(%rbp), %rdi
callq 0xb06b0
jmp 0xaebcd
movl $0x32, %edi
callq 0x8f910
jmp 0xaeb5b
movq -0xd30(%rbp), %rdi
addq $0x2068, %rdi           # imm = 0x2068
callq 0xb0440
movq %rax, -0xd10(%rbp)
movq -0xd10(%rbp), %rax
movq %rax, -0xc40(%rbp)
movq -0xd30(%rbp), %rdi
addq $0x2068, %rdi           # imm = 0x2068
callq 0xb04a0
movq %rax, -0xd18(%rbp)
leaq -0xc40(%rbp), %rdi
leaq -0xd18(%rbp), %rsi
callq 0xb0470
testb $0x1, %al
jne 0xaef2e
jmp 0xaef66
leaq -0xc40(%rbp), %rdi
callq 0xb05b0
movq 0x20(%rax), %rdi
callq 0x9ed20
leaq -0xc40(%rbp), %rdi
callq 0xb05b0
movq 0x20(%rax), %rdi
callq 0x9900
leaq -0xc40(%rbp), %rdi
callq 0xb06b0
jmp 0xaeefb
movq -0xd30(%rbp), %rdi
addq $0x2098, %rdi           # imm = 0x2098
callq 0xb06e0
movq %rax, -0xd20(%rbp)
movq -0xd20(%rbp), %rax
movq %rax, -0xc48(%rbp)
movq -0xd30(%rbp), %rdi
addq $0x2098, %rdi           # imm = 0x2098
callq 0xb0740
movq %rax, -0xd28(%rbp)
leaq -0xc48(%rbp), %rdi
leaq -0xd28(%rbp), %rsi
callq 0xb0710
testb $0x1, %al
jne 0xaefc1
jmp 0xaeff9
leaq -0xc48(%rbp), %rdi
callq 0xb0770
movq 0x20(%rax), %rdi
callq 0x6af80
leaq -0xc48(%rbp), %rdi
callq 0xb0770
movq 0x20(%rax), %rdi
callq 0x9900
leaq -0xc48(%rbp), %rdi
callq 0xb0790
jmp 0xaef8e
movq -0xd30(%rbp), %rdi
addq $0x2068, %rdi           # imm = 0x2068
callq 0xb07c0
movq -0xd30(%rbp), %rdi
addq $0x2098, %rdi           # imm = 0x2098
callq 0xb07e0
movq -0xd30(%rbp), %rdi
addq $0x20c8, %rdi           # imm = 0x20C8
callq 0xb0800
addq $0xd70, %rsp            # imm = 0xD70
popq %rbp
retq
movq -0xcf0(%rbp), %rdi
callq 0x9d20
nopw (%rax,%rax)