// File: /workspace/github_cpp_makefile_star2_O1/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, %r13
movq %rdi, %rbx
movl (%rdi), %edx
movl 0x8(%rdi), %ecx
leaq 0x18d4d(%rip), %rsi     # 0x768f2
xorl %r15d, %r15d
movl $0x4, %edi
xorl %eax, %eax
callq 0x53ec4
cmpl $0x0, (%rbx)
js 0x5e2b4
movq 0x8510(%rbx), %rax
cmpl $0x1, (%rax)
jg 0x5dbcf
movl $0x0, (%rbx)
movl (%rbx), %edx
testl %edx, %edx
jne 0x5dea2
movq %r13, -0x30(%rbp)
cmpl $0x0, 0x4(%rbx)
je 0x5dcd2
leaq 0x18dd1(%rip), %rsi     # 0x769bf
movl $0x3, %edi
xorl %eax, %eax
callq 0x53ec4
leaq 0xc(%rbx), %rdx
leaq 0x10c(%rbx), %rcx
leaq 0x18dc9(%rip), %rsi     # 0x769d5
leaq -0x430(%rbp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x8120
cltq
leaq (%rax,%rbp), %r13
addq $-0x430, %r13           # imm = 0xFBD0
leaq 0x18db9(%rip), %rsi     # 0x769ea
leaq 0x18d2c(%rip), %rdx     # 0x76964
movq %r13, %rdi
xorl %eax, %eax
callq 0x8120
movslq %eax, %r12
addq %r13, %r12
cmpb $0x0, 0x20c(%rbx)
je 0x5ddd2
leaq 0x20c(%rbx), %rdx
leaq 0x30c(%rbx), %rcx
leaq 0x186e5(%rip), %rsi     # 0x7634f
leaq -0x630(%rbp), %r13
movq %r13, %rdi
xorl %eax, %eax
callq 0x8120
movabsq $0x20636973614220, %rax # imm = 0x20636973614220
movq %rax, 0xe(%r12)
movups 0x18d92(%rip), %xmm0    # 0x76a23
movups %xmm0, (%r12)
leaq 0x15(%r12), %r14
movq %r13, %rdi
callq 0x8290
movq %r14, %rdi
leaq -0x430(%rbp), %r14
movq %r13, %rsi
movl %eax, %edx
callq 0x5e2c9
cltq
addq %rax, %r12
addq $0x17, %r12
movw $0xa0d, -0x2(%r12)      # imm = 0xA0D
movb $0x0, (%r12)
jmp 0x5de09
leaq 0x18c4d(%rip), %rsi     # 0x76926
xorl %r14d, %r14d
movl $0x3, %edi
xorl %eax, %eax
callq 0x53ec4
leaq 0x30c(%rbx), %rdx
leaq 0x10c(%rbx), %rcx
leaq 0x18c3f(%rip), %rsi     # 0x7693c
leaq -0x430(%rbp), %rdi
xorl %eax, %eax
callq 0x8120
cltq
leaq (%rax,%rbp), %r13
addq $-0x430, %r13           # imm = 0xFBD0
leaq 0x18c2c(%rip), %rsi     # 0x7694b
leaq 0x18c3e(%rip), %rdx     # 0x76964
movq %r13, %rdi
xorl %eax, %eax
callq 0x8120
movslq %eax, %r12
addq %r13, %r12
leaq 0x40c(%rbx), %rdx
leaq 0x18c2d(%rip), %rsi     # 0x76971
movq %r12, %rdi
xorl %eax, %eax
callq 0x8120
cltq
leaq (%rax,%r12), %r13
addq $0x2, %r13
movw $0xa0d, -0x2(%r13)      # imm = 0xA0D
movb $0x0, (%r13)
movq 0x8510(%rbx), %rdi
leaq -0x430(%rbp), %rsi
subq %rsi, %r13
movl %r13d, %edx
movq -0x30(%rbp), %rcx
callq 0x5b63d
cltq
cmpq %rax, %r13
jne 0x5ddc9
movl (%rbx), %edx
leaq 0x18bea(%rip), %rsi     # 0x7697b
movl $0x2, %edi
movq %r13, %rcx
xorl %eax, %eax
callq 0x53ec4
leaq 0x18bfd(%rip), %rsi     # 0x769a4
leaq -0x430(%rbp), %rcx
movl $0x5, %edi
movq %r13, %rdx
xorl %eax, %eax
callq 0x53ec4
movl $0x1, (%rbx)
movl $0x1, %r14d
movq -0x30(%rbp), %r13
jmp 0x5de81
movabsq $0xa0d2a2f2a203a, %rax  # imm = 0xA0D2A2F2A203A
movq %rax, 0x6(%r12)
movabsq $0x203a747065636341, %rax # imm = 0x203A747065636341
movq %rax, (%r12)
movups 0x18c19(%rip), %xmm0    # 0x76a0f
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 %r14, %r12
movq %r14, %rsi
movl %r12d, %edx
movq -0x30(%rbp), %r13
movq %r13, %rcx
callq 0x5b63d
cltq
xorl %r14d, %r14d
cmpq %rax, %r12
jne 0x5de81
movl (%rbx), %edx
leaq 0x18bf0(%rip), %rsi     # 0x76a39
movl $0x2, %edi
movq %r12, %rcx
xorl %eax, %eax
callq 0x53ec4
leaq 0x18c03(%rip), %rsi     # 0x76a62
leaq -0x430(%rbp), %rcx
movl $0x5, %edi
movq %r12, %rdx
xorl %eax, %eax
callq 0x53ec4
movl $0x1, (%rbx)
movl $0x1, %r14d
testl %r14d, %r14d
je 0x5e2b4
movl (%rbx), %edx
movl 0x8(%rbx), %ecx
leaq 0x18a5c(%rip), %rsi     # 0x768f2
movl $0x2, %edi
xorl %eax, %eax
callq 0x53ec4
movl $0x1, %r15d
cmpl $0x1, (%rbx)
jne 0x5e2b4
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 %r13, %rcx
callq 0x5a8d5
testl %eax, %eax
je 0x5dfb8
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 0x5dfce
leaq 0x18c5c(%rip), %rsi     # 0x76b6b
movl $0x3, %edi
xorl %eax, %eax
callq 0x53ec4
movslq 0x8(%rbx), %rax
movb $0x30, 0x50c(%rbx,%rax)
movl 0x8(%rbx), %edx
leaq 0x18c56(%rip), %rsi     # 0x76b87
movl $0x5, %edi
movq %r12, %rcx
xorl %eax, %eax
callq 0x53ec4
leaq 0x18c5b(%rip), %rsi     # 0x76ba2
movq %r12, %rdi
callq 0x8160
testq %rax, %rax
je 0x5e08a
addq $0xc, %rax
subl %eax, %r12d
addl 0x8(%rbx), %r12d
movl %r12d, 0x8(%rbx)
testl %r12d, %r12d
jle 0x5df80
xorl %ecx, %ecx
movb (%rax,%rcx), %dl
movb %dl, 0x50c(%rbx,%rcx)
incq %rcx
cmpl 0x8(%rbx), %ecx
jl 0x5df6e
movl $0x2, (%rbx)
movq 0x8510(%rbx), %rdx
addq $0x4, %rdx
leaq 0x10c(%rbx), %rcx
leaq 0xdc8b(%rip), %rsi      # 0x6bc2a
movq %r13, %rdi
xorl %eax, %eax
callq 0x8120
movl 0x8(%rbx), %edx
leaq 0x18bfc(%rip), %rsi     # 0x76baf
jmp 0x5e079
leaq 0x1894e(%rip), %rsi     # 0x7690d
xorl %r15d, %r15d
movl $0x5, %edi
xorl %edx, %edx
jmp 0x5e07e
leaq 0x18acc(%rip), %rsi     # 0x76aa1
movl $0x3, %edi
xorl %eax, %eax
callq 0x53ec4
movslq 0x8(%rbx), %rax
movb $0x30, 0x50c(%rbx,%rax)
movl 0x8(%rbx), %edx
leaq 0x18ac6(%rip), %rsi     # 0x76abd
movl $0x5, %edi
movq %r12, %rcx
xorl %eax, %eax
callq 0x53ec4
leaq 0x18bd1(%rip), %rsi     # 0x76bde
movq %r12, %rdi
callq 0x8160
testq %rax, %rax
je 0x5e0e4
addq $0x4, %rax
subl %eax, %r12d
addl 0x8(%rbx), %r12d
movl %r12d, 0x8(%rbx)
testl %r12d, %r12d
jle 0x5e046
xorl %ecx, %ecx
movb (%rax,%rcx), %dl
movb %dl, 0x50c(%rbx,%rcx)
incq %rcx
cmpl 0x8(%rbx), %ecx
jl 0x5e034
movl $0x2, (%rbx)
movq 0x8510(%rbx), %rdx
addq $0x4, %rdx
leaq 0x10c(%rbx), %rcx
leaq 0xdbc5(%rip), %rsi      # 0x6bc2a
movq %r13, %rdi
xorl %eax, %eax
callq 0x8120
movl 0x8(%rbx), %edx
leaq 0x18a5f(%rip), %rsi     # 0x76ad8
movl $0x2, %edi
xorl %eax, %eax
callq 0x53ec4
jmp 0x5e2b4
leaq 0x18b3d(%rip), %rsi     # 0x76bce
movq %r12, %rdi
callq 0x8160
testq %rax, %rax
je 0x5e154
cmpb $0x0, 0x10c(%rbx)
je 0x5e18d
movups 0x18b6b(%rip), %xmm0    # 0x76c21
movups %xmm0, (%r13)
movabsq $0x2e2e2e7463656e, %rax # imm = 0x2E2E2E7463656E
movq %rax, 0x10(%r13)
movl 0x8(%rbx), %edx
leaq 0x18b66(%rip), %rsi     # 0x76c39
movl $0x2, %edi
xorl %eax, %eax
callq 0x53ec4
jmp 0x5e279
leaq 0x18a0c(%rip), %rsi     # 0x76af7
movq %r12, %rdi
callq 0x8160
movl 0x8(%rbx), %ecx
testq %rax, %rax
je 0x5e1bc
cmpl $0x20, %ecx
movl $0x20, %eax
cmovll %ecx, %eax
movslq %eax, %r14
movq %r13, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x8350
movb $0x0, (%r13,%r14)
movq %r13, %rdi
movl $0xd, %esi
callq 0x8250
testq %rax, %rax
je 0x5e136
movb $0x0, (%rax)
movl 0x8(%rbx), %ecx
leaq 0x189bd(%rip), %rsi     # 0x76afd
movl $0x1, %edi
movq %r13, %rdx
xorl %eax, %eax
callq 0x53ec4
jmp 0x5e1ed
leaq 0x18b00(%rip), %rsi     # 0x76c5b
movq %r12, %rdi
callq 0x8160
testq %rax, %rax
je 0x5e21e
movq %rax, %r15
movq %rax, %rdi
movl $0xd, %esi
callq 0x8250
testq %rax, %rax
je 0x5e24e
movb $0x0, (%rax)
jmp 0x5e255
movl $0x2, (%rbx)
movups 0x18a49(%rip), %xmm0    # 0x76be3
movups %xmm0, (%r13)
movabsq $0x64657669656365, %rax # imm = 0x64657669656365
movq %rax, 0xe(%r13)
movl 0x8(%rbx), %edx
leaq 0x18a42(%rip), %rsi     # 0x76bf9
jmp 0x5e079
cmpl $0x8000, %ecx           # imm = 0x8000
jl 0x5e20d
movups 0x18948(%rip), %xmm0    # 0x76b13
movups %xmm0, (%r13)
movw $0x77, 0x10(%r13)
movl 0x8(%rbx), %edx
leaq 0x18944(%rip), %rsi     # 0x76b25
movl $0x1, %edi
xorl %eax, %eax
callq 0x53ec4
xorl %eax, %eax
movl %eax, 0x8(%rbx)
movb $0x0, 0x50c(%rbx)
movl %eax, (%rbx)
movq 0x8510(%rbx), %rdi
movl 0x12c(%rdi), %esi
callq 0x5d761
movl (%rbx), %edx
movl 0x8(%rbx), %ecx
leaq 0x18931(%rip), %rsi     # 0x76b4a
jmp 0x5e2a5
cmpl $0x8000, 0x8(%rbx)      # imm = 0x8000
jl 0x5e299
movups 0x188e5(%rip), %xmm0    # 0x76b13
movups %xmm0, (%r13)
movw $0x77, 0x10(%r13)
movl 0x8(%rbx), %edx
leaq 0x188e1(%rip), %rsi     # 0x76b25
movl $0x1, %edi
jmp 0x5e0d8
movb $0x0, 0x58c(%rbx)
movq %r13, %rdi
movq %r15, %rsi
callq 0x85c0
movl 0x8(%rbx), %ecx
leaq 0x18893(%rip), %rsi     # 0x76afd
movl $0x1, %edi
movq %r13, %rdx
xorl %eax, %eax
callq 0x53ec4
xorl %eax, %eax
movl %eax, 0x8(%rbx)
movb $0x0, 0x50c(%rbx)
movl %eax, (%rbx)
movq 0x8510(%rbx), %rdi
movl 0x12c(%rdi), %esi
callq 0x5d761
movl (%rbx), %edx
movl 0x8(%rbx), %ecx
leaq 0x189bc(%rip), %rsi     # 0x76c61
xorl %r15d, %r15d
movl $0x5, %edi
xorl %eax, %eax
callq 0x53ec4
movl %r15d, %eax
addq $0x608, %rsp            # imm = 0x608
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq