// File: /workspace/github_cpp_makefile_star2_O1/DoubleString[P]RtConverter/src/Rtklib/stream.cpp
// Function: bamboo::strsendcmd(bamboo::stream_t*, char const*)
extern void strsendcmd(stream_t *str, const char *cmd)
	{
		unsigned char buff[1024];
		const char *p = cmd, *q;
		char msg[1024], cmdend[] = "\r\n";
		int n, m, ms, brate;

		tracet(3, "strsendcmd: cmd=%s\n", cmd);

		for (;;) {
			for (q = p;; q++) if (*q == '\r' || *q == '\n' || *q == '\0') break;
			n = (int)(q - p); strncpy(msg, p, n); msg[n] = '\0';

			if (!*msg || *msg == '#') { /* null or comment */
				;
			}
			else if (*msg == '!') { /* binary escape */

				if (!strncmp(msg + 1, "WAIT", 4)) { /* wait */
					if (sscanf(msg + 5, "%d", &ms) < 1) ms = 100;
					if (ms > 3000) ms = 3000; /* max 3 s */
					sleepms(ms);
				}
				else if (!strncmp(msg + 1, "BRATE", 5)) { /* set bitrate */
					if (sscanf(msg + 6, "%d", &brate) < 1) brate = 9600;
					set_brate(str, brate);
					sleepms(500);
				}
				//            else if (!strncmp(msg+1,"UBX",3)) { /* ublox */
				//                if ((m=gen_ubx(msg+4,buff))>0) strwrite(str,buff,m);
				//            }
				//            else if (!strncmp(msg+1,"STQ",3)) { /* skytraq */
				//                if ((m=gen_stq(msg+4,buff))>0) strwrite(str,buff,m);
				//            }
				//            else if (!strncmp(msg+1,"NVS",3)) { /* nvs */
				//                if ((m=gen_nvs(msg+4,buff))>0) strwrite(str,buff,m);
				//            }
				else if (!strncmp(msg + 1, "LEXR", 4)) { /* lex receiver */
					if ((m = gen_lexr(msg + 5, buff)) > 0) strwrite(str, buff, m);
				}
				else if (!strncmp(msg + 1, "HEX", 3)) { /* general hex message */
					if ((m = gen_hex(msg + 4, buff)) > 0) strwrite(str, buff, m);
				}
			}
			else {
				strcat(msg, cmdend);
				strwrite(str, (unsigned char *)msg, n + 2);
			}
			if (*q == '\0') break; else p = q + 1;
		}
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1428, %rsp           # imm = 0x1428
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x19895(%rip), %rsi     # 0x75f6b
movl $0x3, %edi
movq %r14, %rdx
xorl %eax, %eax
callq 0x53ec4
movq %rbx, -0x38(%rbp)
leaq 0x60(%rbx), %rax
movq %rax, -0x50(%rbp)
movabsq $0x100000000, %rbx      # imm = 0x100000000
movl $0x2401, %ecx           # imm = 0x2401
leaq -0x1050(%rbp), %r13
movq %r14, %rsi
incq %r14
movl $0x2, %r15d
xorl %r12d, %r12d
movzbl -0x1(%r14), %eax
cmpl $0xd, %eax
ja 0x5c725
btl %eax, %ecx
jb 0x5c730
incq %r14
addq %rbx, %r12
incl %r15d
jmp 0x5c716
sarq $0x20, %r12
leaq -0x450(%rbp), %rdi
movq %r12, %rdx
callq 0x8350
movb $0x0, -0x450(%rbp,%r12)
movzbl -0x450(%rbp), %eax
testl %eax, %eax
je 0x5ca5e
cmpl $0x23, %eax
je 0x5ca5e
cmpl $0x21, %eax
jne 0x5c8bc
cmpl $0x54494157, -0x44f(%rbp) # imm = 0x54494157
je 0x5c8f1
movl -0x44f(%rbp), %eax
movl $0x54415242, %ecx       # imm = 0x54415242
xorl %ecx, %eax
movzbl -0x44b(%rbp), %ecx
xorl $0x45, %ecx
orl %eax, %ecx
je 0x5c92d
cmpl $0x5258454c, -0x44f(%rbp) # imm = 0x5258454C
je 0x5c9e8
movzwl -0x44f(%rbp), %eax
xorl $0x4548, %eax           # imm = 0x4548
movzbl -0x44d(%rbp), %ecx
xorl $0x58, %ecx
orw %ax, %cx
jne 0x5ca5e
xorl %r12d, %r12d
movl $0x400, %edx            # imm = 0x400
leaq -0x1450(%rbp), %r13
movq %r13, %rdi
xorl %esi, %esi
callq 0x8390
movl $0x4, %edi
leaq 0x1ae6b(%rip), %rsi     # 0x7765b
leaq -0x44c(%rbp), %r15
movq %r15, %rdx
xorl %eax, %eax
callq 0x4ded0
movl $0x3ff, %edx            # imm = 0x3FF
movq %r13, %rdi
movq %r15, %rsi
callq 0x8350
movq %r13, %rdi
leaq 0x18cda(%rip), %r13     # 0x754f5
movq %r13, %rsi
callq 0x89c0
testq %rax, %rax
je 0x5c851
xorl %r12d, %r12d
movq %r12, %r15
incq %r12
movq %rax, -0x1050(%rbp,%r15,8)
xorl %edi, %edi
movq %r13, %rsi
callq 0x89c0
cmpq $0xfe, %r15
ja 0x5c851
testq %rax, %rax
jne 0x5c82b
leaq -0x850(%rbp), %r15
testl %r12d, %r12d
je 0x5c892
movl %r12d, %r12d
xorl %r13d, %r13d
movq -0x1050(%rbp,%r13,8), %rdi
leaq 0x1adfa(%rip), %rsi     # 0x7766c
leaq -0x44(%rbp), %rdx
xorl %eax, %eax
callq 0x8610
testl %eax, %eax
je 0x5c88a
movb -0x44(%rbp), %al
movb %al, (%r15)
incq %r15
incq %r13
cmpq %r13, %r12
jne 0x5c863
leaq -0x850(%rbp), %rax
subl %eax, %r15d
testl %r15d, %r15d
leaq -0x1050(%rbp), %r13
jle 0x5ca5e
movq -0x38(%rbp), %rdi
leaq -0x850(%rbp), %rsi
movl %r15d, %edx
jmp 0x5c8e7
leaq -0x450(%rbp), %r12
movq %r12, %rdi
callq 0x8290
movw $0xa0d, -0x450(%rbp,%rax) # imm = 0xA0D
movb $0x0, -0x44e(%rbp,%rax)
movq -0x38(%rbp), %rdi
movq %r12, %rsi
movl %r15d, %edx
callq 0x5abb7
jmp 0x5ca5e
leaq -0x44b(%rbp), %rdi
leaq 0x198a7(%rip), %rsi     # 0x761a6
leaq -0x2c(%rbp), %rdx
xorl %eax, %eax
callq 0x8610
testl %eax, %eax
jg 0x5c915
movl $0x64, -0x2c(%rbp)
cmpl $0xbb9, -0x2c(%rbp)     # imm = 0xBB9
jl 0x5c925
movl $0xbb8, -0x2c(%rbp)     # imm = 0xBB8
movl -0x2c(%rbp), %edi
jmp 0x5ca59
leaq -0x44a(%rbp), %rdi
leaq 0x1986b(%rip), %rsi     # 0x761a6
leaq -0x3c(%rbp), %rdx
xorl %eax, %eax
callq 0x8610
testl %eax, %eax
jg 0x5c951
movl $0x2580, -0x3c(%rbp)    # imm = 0x2580
movl -0x3c(%rbp), %r15d
movl $0x400, %edx            # imm = 0x400
leaq -0x1450(%rbp), %rdi
xorl %esi, %esi
callq 0x8390
movq -0x38(%rbp), %rax
cmpl $0x1, (%rax)
jne 0x5ca54
movq -0x38(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x40(%rbp)
movq %r13, %rdi
movq -0x50(%rbp), %rsi
callq 0x85c0
movq %r13, %rdi
movl $0x3a, %esi
callq 0x8250
testq %rax, %rax
je 0x5ca11
movq %rax, %r12
movl %r15d, %r13d
leaq 0x1(%rax), %rdi
movl $0x3a, %esi
callq 0x8250
testq %rax, %rax
leaq -0x1450(%rbp), %r15
je 0x5c9c8
movq %r15, %rdi
movq %rax, %rsi
callq 0x85c0
movq %r12, %rdi
leaq 0x1ac83(%rip), %rsi     # 0x77655
movl %r13d, %edx
movq %r15, %rcx
xorl %eax, %eax
callq 0x8120
leaq -0x1050(%rbp), %r13
jmp 0x5ca35
leaq -0x44b(%rbp), %rdi
leaq -0x850(%rbp), %rsi
callq 0x567b4
testl %eax, %eax
jle 0x5ca5e
movq -0x38(%rbp), %rdi
leaq -0x850(%rbp), %rsi
movl %eax, %edx
jmp 0x5c8e7
movq %r13, %rdi
callq 0x8290
leaq (%rax,%rbp), %rdi
addq $-0x1050, %rdi          # imm = 0xEFB0
leaq 0xf25d(%rip), %rsi      # 0x6bc88
movl %r15d, %edx
xorl %eax, %eax
callq 0x8120
movq -0x38(%rbp), %r15
movq %r15, %rdi
callq 0x59b29
movq %r15, %rdi
movl $0x1, %esi
movl -0x40(%rbp), %edx
movq %r13, %rcx
callq 0x589a3
movl $0x1f4, %edi            # imm = 0x1F4
callq 0x508e9
cmpb $0x0, -0x1(%r14)
movl $0x2401, %ecx           # imm = 0x2401
jne 0x5c707
addq $0x1428, %rsp           # imm = 0x1428
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq