// File: /workspace/github_cpp_makefile_star2_O2/DoubleString[P]RtConverter/src/Rtklib/stream.cpp
// Function: bamboo::waitntrip(bamboo::ntrip_t*, char*)
static int waitntrip(ntrip_t *ntrip, char *msg)
	{
		int n;
		char *p;

		tracet(4, "waitntrip: state=%d nb=%d\n", ntrip->state, ntrip->nb);

		if (ntrip->state < 0) return 0; /* error */

		if (ntrip->tcp->svr.state < 2) ntrip->state = 0; /* tcp disconnected */

		if (ntrip->state == 0) { /* send request */
			if (!(ntrip->type == 0 ? reqntrip_s(ntrip, msg) : reqntrip_c(ntrip, msg))) {
				return 0;
			}
			tracet(2, "waitntrip: state=%d nb=%d\n", ntrip->state, ntrip->nb);
		}
		if (ntrip->state == 1) { /* read response */
			p = (char *)ntrip->buff + ntrip->nb;
			if ((n = readtcpcli(ntrip->tcp, (unsigned char *)p, NTRIP_MAXRSP - ntrip->nb - 1, msg)) == 0) {
				tracet(5, "waitntrip: readtcp n=%d\n", n);
				return 0;
			}
			ntrip->nb += n; ntrip->buff[ntrip->nb] = '\0';

			/* wait response */
			return ntrip->type == 0 ? rspntrip_s(ntrip, msg) : rspntrip_c(ntrip, msg);
		}
		return 1;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x608, %rsp            # imm = 0x608
movq %rsi, %r14
movq %rdi, %rbx
movl (%rdi), %edx
movl 0x8(%rdi), %ecx
leaq 0x189fc(%rip), %rsi     # 0x6c8b7
xorl %r15d, %r15d
pushq $0x4
popq %rdi
xorl %eax, %eax
callq 0x4acf2
movl (%rbx), %eax
testl %eax, %eax
js 0x5458b
movq 0x8510(%rbx), %rcx
cmpl $0x1, (%rcx)
jg 0x53ee3
andl $0x0, (%rbx)
jmp 0x53eeb
testl %eax, %eax
jne 0x54198
movq %r14, -0x30(%rbp)
cmpl $0x0, 0x4(%rbx)
je 0x53fdd
leaq 0x18a84(%rip), %rsi     # 0x6c984
pushq $0x3
popq %rdi
xorl %edx, %edx
xorl %eax, %eax
callq 0x4acf2
leaq 0xc(%rbx), %rdx
leaq 0x10c(%rbx), %rcx
leaq 0x18a7c(%rip), %rsi     # 0x6c99a
leaq -0x430(%rbp), %r13
movq %r13, %rdi
xorl %eax, %eax
callq 0x8110
cltq
leaq (%rax,%rbp), %r14
addq $-0x430, %r14           # imm = 0xFBD0
leaq 0x18a6c(%rip), %rsi     # 0x6c9af
leaq 0x189df(%rip), %rdx     # 0x6c929
movq %r14, %rdi
xorl %eax, %eax
callq 0x8110
movslq %eax, %r12
addq %r14, %r12
cmpb $0x0, 0x20c(%rbx)
je 0x540c8
leaq 0x20c(%rbx), %rdx
leaq 0x30c(%rbx), %rcx
leaq 0x18398(%rip), %rsi     # 0x6c314
leaq -0x630(%rbp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x8110
movabsq $0x20636973614220, %rax # imm = 0x20636973614220
movq %rax, 0xe(%r12)
movups 0x18a45(%rip), %xmm0    # 0x6c9e8
movups %xmm0, (%r12)
leaq 0x15(%r12), %r15
movq %r14, %rdi
callq 0x8290
movq %r15, %rdi
movq %r14, %rsi
movl %eax, %edx
callq 0x545a0
cltq
addq %rax, %r12
addq $0x17, %r12
movw $0xa0d, -0x2(%r12)      # imm = 0xA0D
movb $0x0, (%r12)
jmp 0x540ff
leaq 0x18907(%rip), %rsi     # 0x6c8eb
xorl %r15d, %r15d
pushq $0x3
popq %rdi
xorl %edx, %edx
xorl %eax, %eax
callq 0x4acf2
leaq 0x30c(%rbx), %rdx
leaq 0x10c(%rbx), %rcx
leaq 0x188f9(%rip), %rsi     # 0x6c901
leaq -0x430(%rbp), %r12
movq %r12, %rdi
xorl %eax, %eax
callq 0x8110
cltq
leaq (%rax,%rbp), %r13
addq $-0x430, %r13           # imm = 0xFBD0
leaq 0x188e3(%rip), %rsi     # 0x6c910
leaq 0x188f5(%rip), %rdx     # 0x6c929
movq %r13, %rdi
xorl %eax, %eax
callq 0x8110
movslq %eax, %r14
addq %r13, %r14
leaq 0x40c(%rbx), %rdx
leaq 0x188e4(%rip), %rsi     # 0x6c936
movq %r14, %rdi
xorl %eax, %eax
callq 0x8110
cltq
leaq (%rax,%r14), %r13
addq $0x2, %r13
movw $0xa0d, -0x2(%r13)      # imm = 0xA0D
movb $0x0, (%r13)
movq 0x8510(%rbx), %rdi
subq %r12, %r13
movq %r12, %rsi
movl %r13d, %edx
movq -0x30(%rbp), %r14
movq %r14, %rcx
callq 0x51a87
cltq
cmpq %rax, %r13
jne 0x54171
movl (%rbx), %edx
leaq 0x1889e(%rip), %rsi     # 0x6c940
pushq $0x2
popq %rdi
movq %r13, %rcx
xorl %eax, %eax
callq 0x4acf2
leaq 0x188b3(%rip), %rsi     # 0x6c969
pushq $0x5
popq %rdi
leaq -0x430(%rbp), %rcx
movq %r13, %rdx
jmp 0x54160
movabsq $0xa0d2a2f2a203a74, %rax # imm = 0xA0D2A2F2A203A74
movq %rax, 0x5(%r12)
movabsq $0x203a747065636341, %rax # imm = 0x203A747065636341
movq %rax, (%r12)
movups 0x188e8(%rip), %xmm0    # 0x6c9d4
movups %xmm0, 0xd(%r12)
movl $0xa0d65, 0x1d(%r12)    # imm = 0xA0D65
addq $0x20, %r12
movb $0x0, 0x2(%r12)
movw $0xa0d, (%r12)          # imm = 0xA0D
addq $0x2, %r12
movq 0x8510(%rbx), %rdi
subq %r13, %r12
movq %r13, %rsi
movl %r12d, %edx
movq -0x30(%rbp), %r14
movq %r14, %rcx
callq 0x51a87
cltq
xorl %r15d, %r15d
cmpq %rax, %r12
jne 0x54171
movl (%rbx), %edx
leaq 0x188bf(%rip), %rsi     # 0x6c9fe
pushq $0x2
popq %rdi
movq %r12, %rcx
xorl %eax, %eax
callq 0x4acf2
leaq 0x188d4(%rip), %rsi     # 0x6ca27
pushq $0x5
popq %rdi
leaq -0x430(%rbp), %rcx
movq %r12, %rdx
xorl %eax, %eax
callq 0x4acf2
movl $0x1, (%rbx)
pushq $0x1
popq %r15
testl %r15d, %r15d
movl $0x0, %r15d
je 0x5458b
movl (%rbx), %edx
movl 0x8(%rbx), %ecx
leaq 0x1872b(%rip), %rsi     # 0x6c8b7
pushq $0x2
popq %rdi
xorl %eax, %eax
callq 0x4acf2
movl (%rbx), %eax
pushq $0x1
popq %r15
cmpl $0x1, %eax
jne 0x5458b
movslq 0x8(%rbx), %rax
leaq (%rbx,%rax), %rsi
addq $0x50c, %rsi            # imm = 0x50C
movq 0x8510(%rbx), %rdi
movl $0x7fff, %edx           # imm = 0x7FFF
subl %eax, %edx
movq %r14, %rcx
callq 0x50d8f
testl %eax, %eax
je 0x54271
leaq 0x50c(%rbx), %r12
movslq 0x8(%rbx), %rcx
cltq
addq %rcx, %rax
movl %eax, 0x8(%rbx)
movb $0x0, 0x50c(%rbx,%rax)
cmpl $0x0, 0x4(%rbx)
movl (%rbx), %edx
movl 0x8(%rbx), %ecx
je 0x542bd
leaq 0x1892d(%rip), %rsi     # 0x6cb30
pushq $0x3
popq %rdi
xorl %eax, %eax
callq 0x4acf2
movslq 0x8(%rbx), %rax
movb $0x30, 0x50c(%rbx,%rax)
movl 0x8(%rbx), %edx
leaq 0x18929(%rip), %rsi     # 0x6cb4c
pushq $0x5
popq %rdi
movq %r12, %rcx
xorl %eax, %eax
callq 0x4acf2
leaq 0x18930(%rip), %rsi     # 0x6cb67
movq %r12, %rdi
callq 0x8170
testq %rax, %rax
je 0x54332
addq $0xc, %rax
subl %eax, %r12d
addl 0x8(%rbx), %r12d
movl %r12d, 0x8(%rbx)
xorl %ecx, %ecx
cmpl %r12d, %ecx
jge 0x54285
movb (%rax,%rcx), %dl
movb %dl, 0x50c(%rbx,%rcx)
movl 0x8(%rbx), %r12d
incq %rcx
jmp 0x54259
leaq 0x1865a(%rip), %rsi     # 0x6c8d2
xorl %r15d, %r15d
pushq $0x5
popq %rdi
xorl %edx, %edx
jmp 0x543bf
movl $0x2, (%rbx)
movq 0x8510(%rbx), %rdx
addq $0x4, %rdx
leaq 0x10c(%rbx), %rcx
leaq 0xd98a(%rip), %rsi      # 0x61c2e
movq %r14, %rdi
xorl %eax, %eax
callq 0x8110
movl 0x8(%rbx), %edx
leaq 0x188bc(%rip), %rsi     # 0x6cb74
jmp 0x543bc
leaq 0x187a2(%rip), %rsi     # 0x6ca66
pushq $0x3
popq %rdi
xorl %eax, %eax
callq 0x4acf2
movslq 0x8(%rbx), %rax
movb $0x30, 0x50c(%rbx,%rax)
movl 0x8(%rbx), %edx
leaq 0x1879e(%rip), %rsi     # 0x6ca82
pushq $0x5
popq %rdi
movq %r12, %rcx
xorl %eax, %eax
callq 0x4acf2
leaq 0x188ab(%rip), %rsi     # 0x6cba3
movq %r12, %rdi
callq 0x8170
testq %rax, %rax
je 0x543cb
addq $0x4, %rax
subl %eax, %r12d
addl 0x8(%rbx), %r12d
movl %r12d, 0x8(%rbx)
xorl %ecx, %ecx
cmpl %r12d, %ecx
jge 0x54389
movb (%rax,%rcx), %dl
movb %dl, 0x50c(%rbx,%rcx)
movl 0x8(%rbx), %r12d
incq %rcx
jmp 0x5431a
leaq 0x1885a(%rip), %rsi     # 0x6cb93
movq %r12, %rdi
callq 0x8170
testq %rax, %rax
je 0x54437
cmpb $0x0, 0x10c(%rbx)
je 0x5446e
movups 0x18888(%rip), %xmm0    # 0x6cbe6
movups %xmm0, (%r14)
movabsq $0x2e2e2e7463656e, %rax # imm = 0x2E2E2E7463656E
movq %rax, 0x10(%r14)
movl 0x8(%rbx), %edx
leaq 0x18884(%rip), %rsi     # 0x6cbfe
pushq $0x2
popq %rdi
xorl %eax, %eax
callq 0x4acf2
jmp 0x54552
movl $0x2, (%rbx)
movq 0x8510(%rbx), %rdx
addq $0x4, %rdx
leaq 0x10c(%rbx), %rcx
leaq 0xd886(%rip), %rsi      # 0x61c2e
movq %r14, %rdi
xorl %eax, %eax
callq 0x8110
movl 0x8(%rbx), %edx
leaq 0x186e1(%rip), %rsi     # 0x6ca9d
pushq $0x2
popq %rdi
xorl %eax, %eax
callq 0x4acf2
jmp 0x5458b
movq %r14, %r15
leaq 0x186e7(%rip), %rsi     # 0x6cabc
movq %r12, %rdi
callq 0x8170
movl 0x8(%rbx), %ecx
testq %rax, %rax
je 0x5449c
cmpl $0x20, %ecx
pushq $0x20
popq %rax
cmovll %ecx, %eax
movslq %eax, %r14
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x8360
movb $0x0, (%r15,%r14)
pushq $0xd
popq %rsi
movq %r15, %rdi
callq 0x8250
testq %rax, %rax
je 0x5441b
movb $0x0, (%rax)
movl 0x8(%rbx), %ecx
leaq 0x1869d(%rip), %rsi     # 0x6cac2
pushq $0x1
popq %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x4acf2
jmp 0x544ca
leaq 0x187e2(%rip), %rsi     # 0x6cc20
movq %r12, %rdi
callq 0x8170
testq %rax, %rax
je 0x544fb
movq %rax, %r15
pushq $0xd
popq %rsi
movq %rax, %rdi
callq 0x8250
testq %rax, %rax
je 0x54529
movb $0x0, (%rax)
jmp 0x54530
movl $0x2, (%rbx)
movups 0x1872d(%rip), %xmm0    # 0x6cba8
movups %xmm0, (%r14)
movabsq $0x64657669656365, %rax # imm = 0x64657669656365
movq %rax, 0xe(%r14)
movl 0x8(%rbx), %edx
leaq 0x18727(%rip), %rsi     # 0x6cbbe
jmp 0x543bc
cmpl $0x8000, %ecx           # imm = 0x8000
jl 0x544ed
movups 0x1862d(%rip), %xmm0    # 0x6cad8
movups %xmm0, (%r15)
movw $0x77, 0x10(%r15)
movl 0x8(%rbx), %edx
leaq 0x1862a(%rip), %rsi     # 0x6caea
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x4acf2
andl $0x0, 0x8(%rbx)
movb $0x0, 0x50c(%rbx)
andl $0x0, (%rbx)
movq 0x8510(%rbx), %rdi
movl 0x12c(%rdi), %esi
callq 0x53ac3
movl 0x8(%rbx), %ecx
movl (%rbx), %edx
leaq 0x18619(%rip), %rsi     # 0x6cb0f
jmp 0x5457e
movl 0x8(%rbx), %ecx
cmpl $0x8000, %ecx           # imm = 0x8000
jl 0x54575
movups 0x185cb(%rip), %xmm0    # 0x6cad8
movups %xmm0, (%r14)
movw $0x77, 0x10(%r14)
movl 0x8(%rbx), %edx
leaq 0x185c8(%rip), %rsi     # 0x6caea
pushq $0x1
jmp 0x5437c
movb $0x0, 0x58c(%rbx)
movq %r14, %rdi
movq %r15, %rsi
callq 0x85c0
movl 0x8(%rbx), %ecx
leaq 0x1857d(%rip), %rsi     # 0x6cac2
pushq $0x1
popq %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x4acf2
andl $0x0, 0x8(%rbx)
movb $0x0, 0x50c(%rbx)
andl $0x0, (%rbx)
movq 0x8510(%rbx), %rdi
movl 0x12c(%rdi), %esi
callq 0x53ac3
movl 0x8(%rbx), %ecx
movl (%rbx), %edx
leaq 0x186a8(%rip), %rsi     # 0x6cc26
xorl %r15d, %r15d
pushq $0x5
popq %rdi
xorl %eax, %eax
callq 0x4acf2
movl %r15d, %eax
addq $0x608, %rsp            # imm = 0x608
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq