// File: /workspace/github_cpp_makefile_star2_O3/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 0x1982e(%rip), %rsi     # 0x76877
xorl %r15d, %r15d
movl $0x4, %edi
xorl %eax, %eax
callq 0x5342c
movl (%rbx), %eax
testl %eax, %eax
js 0x5d74d
movq 0x8510(%rbx), %rcx
cmpl $0x1, (%rcx)
jg 0x5d076
movl $0x0, (%rbx)
jmp 0x5d07e
testl %eax, %eax
jne 0x5d33b
movq %r14, -0x30(%rbp)
cmpl $0x0, 0x4(%rbx)
je 0x5d172
leaq 0x198b1(%rip), %rsi     # 0x76944
movl $0x3, %edi
xorl %edx, %edx
xorl %eax, %eax
callq 0x5342c
leaq 0xc(%rbx), %rdx
leaq 0x10c(%rbx), %rcx
leaq 0x198a7(%rip), %rsi     # 0x7695a
leaq -0x430(%rbp), %r13
movq %r13, %rdi
xorl %eax, %eax
callq 0x8120
cltq
leaq (%rax,%rbp), %r14
addq $-0x430, %r14           # imm = 0xFBD0
leaq 0x19897(%rip), %rsi     # 0x7696f
leaq 0x1980a(%rip), %rdx     # 0x768e9
movq %r14, %rdi
xorl %eax, %eax
callq 0x8120
movslq %eax, %r12
addq %r14, %r12
cmpb $0x0, 0x20c(%rbx)
je 0x5d263
leaq 0x20c(%rbx), %rdx
leaq 0x30c(%rbx), %rcx
leaq 0x191c3(%rip), %rsi     # 0x762d4
leaq -0x630(%rbp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x8120
movabsq $0x20636973614220, %rax # imm = 0x20636973614220
movq %rax, 0xe(%r12)
movups 0x19870(%rip), %xmm0    # 0x769a8
movups %xmm0, (%r12)
leaq 0x15(%r12), %r15
movq %r14, %rdi
callq 0x8290
movq %r15, %rdi
movq %r14, %rsi
movl %eax, %edx
callq 0x5d762
cltq
addq %rax, %r12
addq $0x17, %r12
movw $0xa0d, -0x2(%r12)      # imm = 0xA0D
movb $0x0, (%r12)
jmp 0x5d29a
leaq 0x19732(%rip), %rsi     # 0x768ab
xorl %r15d, %r15d
movl $0x3, %edi
xorl %edx, %edx
xorl %eax, %eax
callq 0x5342c
leaq 0x30c(%rbx), %rdx
leaq 0x10c(%rbx), %rcx
leaq 0x19722(%rip), %rsi     # 0x768c1
leaq -0x430(%rbp), %r12
movq %r12, %rdi
xorl %eax, %eax
callq 0x8120
cltq
leaq (%rax,%rbp), %r13
addq $-0x430, %r13           # imm = 0xFBD0
leaq 0x1970c(%rip), %rsi     # 0x768d0
leaq 0x1971e(%rip), %rdx     # 0x768e9
movq %r13, %rdi
xorl %eax, %eax
callq 0x8120
movslq %eax, %r14
addq %r13, %r14
leaq 0x40c(%rbx), %rdx
leaq 0x1970d(%rip), %rsi     # 0x768f6
movq %r14, %rdi
xorl %eax, %eax
callq 0x8120
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 0x5aa8b
cltq
cmpq %rax, %r13
jne 0x5d312
movl (%rbx), %edx
leaq 0x196c7(%rip), %rsi     # 0x76900
movl $0x2, %edi
movq %r13, %rcx
xorl %eax, %eax
callq 0x5342c
leaq 0x196da(%rip), %rsi     # 0x76929
leaq -0x430(%rbp), %rcx
movl $0x5, %edi
movq %r13, %rdx
jmp 0x5d2ff
movabsq $0xa0d2a2f2a203a74, %rax # imm = 0xA0D2A2F2A203A74
movq %rax, 0x5(%r12)
movabsq $0x203a747065636341, %rax # imm = 0x203A747065636341
movq %rax, (%r12)
movups 0x1970d(%rip), %xmm0    # 0x76994
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 0x5aa8b
cltq
xorl %r15d, %r15d
cmpq %rax, %r12
jne 0x5d312
movl (%rbx), %edx
leaq 0x196e4(%rip), %rsi     # 0x769be
movl $0x2, %edi
movq %r12, %rcx
xorl %eax, %eax
callq 0x5342c
leaq 0x196f7(%rip), %rsi     # 0x769e7
leaq -0x430(%rbp), %rcx
movl $0x5, %edi
movq %r12, %rdx
xorl %eax, %eax
callq 0x5342c
movl $0x1, (%rbx)
movl $0x1, %r15d
testl %r15d, %r15d
movl $0x0, %r15d
je 0x5d74d
movl (%rbx), %edx
movl 0x8(%rbx), %ecx
leaq 0x1954a(%rip), %rsi     # 0x76877
movl $0x2, %edi
xorl %eax, %eax
callq 0x5342c
movl (%rbx), %eax
movl $0x1, %r15d
cmpl $0x1, %eax
jne 0x5d74d
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 0x59cb7
testl %eax, %eax
je 0x5d451
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 0x5d467
leaq 0x19748(%rip), %rsi     # 0x76af0
movl $0x3, %edi
xorl %eax, %eax
callq 0x5342c
movslq 0x8(%rbx), %rax
movb $0x30, 0x50c(%rbx,%rax)
movl 0x8(%rbx), %edx
leaq 0x19742(%rip), %rsi     # 0x76b0c
movl $0x5, %edi
movq %r12, %rcx
xorl %eax, %eax
callq 0x5342c
leaq 0x19747(%rip), %rsi     # 0x76b27
movq %r12, %rdi
callq 0x8160
testq %rax, %rax
je 0x5d523
addq $0xc, %rax
subl %eax, %r12d
addl 0x8(%rbx), %r12d
movl %r12d, 0x8(%rbx)
testl %r12d, %r12d
jle 0x5d419
xorl %ecx, %ecx
movb (%rax,%rcx), %dl
movb %dl, 0x50c(%rbx,%rcx)
incq %rcx
cmpl 0x8(%rbx), %ecx
jl 0x5d407
movl $0x2, (%rbx)
movq 0x8510(%rbx), %rdx
addq $0x4, %rdx
leaq 0x10c(%rbx), %rcx
leaq 0xe7ef(%rip), %rsi      # 0x6bc27
movq %r14, %rdi
xorl %eax, %eax
callq 0x8120
movl 0x8(%rbx), %edx
leaq 0x196e8(%rip), %rsi     # 0x76b34
jmp 0x5d512
leaq 0x1943a(%rip), %rsi     # 0x76892
xorl %r15d, %r15d
movl $0x5, %edi
xorl %edx, %edx
jmp 0x5d517
leaq 0x195b8(%rip), %rsi     # 0x76a26
movl $0x3, %edi
xorl %eax, %eax
callq 0x5342c
movslq 0x8(%rbx), %rax
movb $0x30, 0x50c(%rbx,%rax)
movl 0x8(%rbx), %edx
leaq 0x195b2(%rip), %rsi     # 0x76a42
movl $0x5, %edi
movq %r12, %rcx
xorl %eax, %eax
callq 0x5342c
leaq 0x196bd(%rip), %rsi     # 0x76b63
movq %r12, %rdi
callq 0x8160
testq %rax, %rax
je 0x5d57c
addq $0x4, %rax
subl %eax, %r12d
addl 0x8(%rbx), %r12d
movl %r12d, 0x8(%rbx)
testl %r12d, %r12d
jle 0x5d4df
xorl %ecx, %ecx
movb (%rax,%rcx), %dl
movb %dl, 0x50c(%rbx,%rcx)
incq %rcx
cmpl 0x8(%rbx), %ecx
jl 0x5d4cd
movl $0x2, (%rbx)
movq 0x8510(%rbx), %rdx
addq $0x4, %rdx
leaq 0x10c(%rbx), %rcx
leaq 0xe729(%rip), %rsi      # 0x6bc27
movq %r14, %rdi
xorl %eax, %eax
callq 0x8120
movl 0x8(%rbx), %edx
leaq 0x1954b(%rip), %rsi     # 0x76a5d
movl $0x2, %edi
xorl %eax, %eax
callq 0x5342c
jmp 0x5d74d
leaq 0x19629(%rip), %rsi     # 0x76b53
movq %r12, %rdi
callq 0x8160
testq %rax, %rax
je 0x5d5ee
cmpb $0x0, 0x10c(%rbx)
je 0x5d627
movups 0x19657(%rip), %xmm0    # 0x76ba6
movups %xmm0, (%r14)
movabsq $0x2e2e2e7463656e, %rax # imm = 0x2E2E2E7463656E
movq %rax, 0x10(%r14)
movl 0x8(%rbx), %edx
leaq 0x19653(%rip), %rsi     # 0x76bbe
movl $0x2, %edi
xorl %eax, %eax
callq 0x5342c
jmp 0x5d712
movq %r14, %r15
leaq 0x194f6(%rip), %rsi     # 0x76a7c
movq %r12, %rdi
callq 0x8160
movl 0x8(%rbx), %ecx
testq %rax, %rax
je 0x5d655
cmpl $0x20, %ecx
movl $0x20, %eax
cmovll %ecx, %eax
movslq %eax, %r14
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x8350
movb $0x0, (%r15,%r14)
movq %r15, %rdi
movl $0xd, %esi
callq 0x8250
testq %rax, %rax
je 0x5d5d0
movb $0x0, (%rax)
movl 0x8(%rbx), %ecx
leaq 0x194a8(%rip), %rsi     # 0x76a82
movl $0x1, %edi
movq %r15, %rdx
xorl %eax, %eax
callq 0x5342c
jmp 0x5d685
leaq 0x195eb(%rip), %rsi     # 0x76be0
movq %r12, %rdi
callq 0x8160
testq %rax, %rax
je 0x5d6b6
movq %rax, %r15
movq %rax, %rdi
movl $0xd, %esi
callq 0x8250
testq %rax, %rax
je 0x5d6e7
movb $0x0, (%rax)
jmp 0x5d6ee
movl $0x2, (%rbx)
movups 0x19534(%rip), %xmm0    # 0x76b68
movups %xmm0, (%r14)
movabsq $0x64657669656365, %rax # imm = 0x64657669656365
movq %rax, 0xe(%r14)
movl 0x8(%rbx), %edx
leaq 0x1952e(%rip), %rsi     # 0x76b7e
jmp 0x5d512
cmpl $0x8000, %ecx           # imm = 0x8000
jl 0x5d6a8
movups 0x19434(%rip), %xmm0    # 0x76a98
movups %xmm0, (%r15)
movw $0x77, 0x10(%r15)
movl 0x8(%rbx), %edx
leaq 0x19431(%rip), %rsi     # 0x76aaa
movl $0x1, %edi
xorl %eax, %eax
callq 0x5342c
xorl %eax, %eax
movl %eax, 0x8(%rbx)
movb $0x0, 0x50c(%rbx)
movl %eax, (%rbx)
movq 0x8510(%rbx), %rdi
movl 0x12c(%rdi), %esi
callq 0x5cc1d
movl 0x8(%rbx), %ecx
movl (%rbx), %edx
leaq 0x1941e(%rip), %rsi     # 0x76acf
jmp 0x5d73e
movl 0x8(%rbx), %ecx
cmpl $0x8000, %ecx           # imm = 0x8000
jl 0x5d735
movups 0x193d0(%rip), %xmm0    # 0x76a98
movups %xmm0, (%r14)
movw $0x77, 0x10(%r14)
movl 0x8(%rbx), %edx
leaq 0x193cd(%rip), %rsi     # 0x76aaa
movl $0x1, %edi
jmp 0x5d570
movb $0x0, 0x58c(%rbx)
movq %r14, %rdi
movq %r15, %rsi
callq 0x85c0
movl 0x8(%rbx), %ecx
leaq 0x1937f(%rip), %rsi     # 0x76a82
movl $0x1, %edi
movq %r14, %rdx
xorl %eax, %eax
callq 0x5342c
xorl %eax, %eax
movl %eax, 0x8(%rbx)
movb $0x0, 0x50c(%rbx)
movl %eax, (%rbx)
movq 0x8510(%rbx), %rdi
movl 0x12c(%rdi), %esi
callq 0x5cc1d
movl 0x8(%rbx), %ecx
movl (%rbx), %edx
leaq 0x194a8(%rip), %rsi     # 0x76be6
xorl %r15d, %r15d
movl $0x5, %edi
xorl %eax, %eax
callq 0x5342c
movl %r15d, %eax
addq $0x608, %rsp            # imm = 0x608
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq