// File: DoubleString[P]RtConverter/src/Rtklib/stream.cpp
// Function: bamboo::strstat(bamboo::stream_t*, char*)
extern int strstat(stream_t *stream, char *msg)
	{
		int state;

		tracet(4, "strstat:\n");

		strlock(stream);
		if (msg) {
			strncpy(msg, stream->msg, MAXSTRMSG - 1); msg[MAXSTRMSG - 1] = '\0';
		}
		if (!stream->port) {
			strunlock(stream);
			return stream->state;
		}
		switch (stream->type) {
		case STR_SERIAL: state = stateserial((serial_t *)stream->port); break;
		case STR_FILE: state = statefile((file_t   *)stream->port); break;
		case STR_TCPSVR: state = statetcpsvr((tcpsvr_t *)stream->port); break;
		case STR_TCPCLI: state = statetcpcli((tcpcli_t *)stream->port); break;
		case STR_NTRIPSVR:
		case STR_NTRIPCLI: state = statentrip((ntrip_t  *)stream->port); break;
		case STR_NTRIPC_C:
		case STR_NTRIPC_S: state = statentripc((ntripc_t *)stream->port); break;
		case STR_UDPSVR: state = stateudpsvr((udp_t    *)stream->port); break;
		case STR_UDPCLI: state = stateudpcli((udp_t    *)stream->port); break;
		case STR_MEMBUF: state = statemembuf((membuf_t *)stream->port); break;
		case STR_FTP: state = stateftp((ftp_t    *)stream->port); break;
		case STR_HTTP: state = stateftp((ftp_t    *)stream->port); break;
		default:
			strunlock(stream);
			return 0;
		}
		if (state == 2 && (int)(tickget() - stream->tact) <= TINTACT) state = 3;
		strunlock(stream);
		return state;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x4, %edi
leaq 0x2707a(%rip), %rsi     # 0xc8bd6
movb $0x0, %al
callq 0x95890
movq -0x10(%rbp), %rdi
callq 0x9ef00
cmpq $0x0, -0x18(%rbp)
je 0xa1b97
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x460, %rsi            # imm = 0x460
movl $0x3ff, %edx            # imm = 0x3FF
callq 0x93b0
movq -0x18(%rbp), %rax
movb $0x0, 0x3ff(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x58(%rax)
jne 0xa1bba
movq -0x10(%rbp), %rdi
callq 0x9f2f0
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0xa1cf8
movq -0x10(%rbp), %rax
movl (%rax), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x28(%rbp)
subl $0xd, %eax
ja 0xa1cb7
movq -0x28(%rbp), %rax
leaq 0x26e74(%rip), %rcx     # 0xc8a50
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rdi
callq 0xa1d10
movl %eax, -0x1c(%rbp)
jmp 0xa1cc9
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rdi
callq 0xa1d50
movl %eax, -0x1c(%rbp)
jmp 0xa1cc9
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rdi
callq 0xa1d70
movl %eax, -0x1c(%rbp)
jmp 0xa1cc9
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rdi
callq 0xa1da0
movl %eax, -0x1c(%rbp)
jmp 0xa1cc9
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rdi
callq 0xa1dd0
movl %eax, -0x1c(%rbp)
jmp 0xa1cc9
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rdi
callq 0xa1e20
movl %eax, -0x1c(%rbp)
jmp 0xa1cc9
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rdi
callq 0xa1e50
movl %eax, -0x1c(%rbp)
jmp 0xa1cc9
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rdi
callq 0xa1e80
movl %eax, -0x1c(%rbp)
jmp 0xa1cc9
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rdi
callq 0xa1eb0
movl %eax, -0x1c(%rbp)
jmp 0xa1cc9
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rdi
callq 0xa1ee0
movl %eax, -0x1c(%rbp)
jmp 0xa1cc9
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rdi
callq 0xa1ee0
movl %eax, -0x1c(%rbp)
jmp 0xa1cc9
movq -0x10(%rbp), %rdi
callq 0x9f2f0
movl $0x0, -0x4(%rbp)
jmp 0xa1cf8
cmpl $0x2, -0x1c(%rbp)
jne 0xa1ce9
callq 0x8f860
movq -0x10(%rbp), %rcx
subl 0x24(%rcx), %eax
cmpl $0xc8, %eax
jg 0xa1ce9
movl $0x3, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
callq 0x9f2f0
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)