// File: /workspace/github_cpp_makefile_star2_O1/DoubleString[P]RtConverter/src/Rtklib/rt17.cpp
// Function: bamboo::DecodeGSOF(bamboo::raw_t*)
static int DecodeGSOF(raw_t *Raw)
{
    rt17_t *rt17 = (rt17_t*) Raw->rcv_data;
    int InputLength, Ret = 0;
    unsigned char RecordLength, RecordType, *p;
    char *RecordType_s = NULL;
 
   /*
    | Reassemble origional message by removing packet headers,
    | trailers and page framing.
    */
    UnwrapGenout(rt17);

    p = rt17->MessageBuffer;
    InputLength = rt17->MessageLength;

    while (InputLength)
    {
        RecordType = p[0];
        RecordLength = p[1];

        if (RecordType < (sizeof(GSOFTable) / sizeof(char*)))
            RecordType_s = (char*) GSOFTable[RecordType];

        if (!RecordType_s)
            RecordType_s = "Unknown";

        tracet(3, "RT17: Trimble packet type=0x40 (GENOUT), GSOF record type=%d (%s), Length=%d.\n", RecordType, RecordType_s, RecordLength);
      
        /* Process (or possibly ignore) the message */
        switch (RecordType)
        {
        case 1:
            Ret = DecodeGSOF1(Raw, p);
            break;
        case 3:
            Ret = DecodeGSOF3(Raw, p);
            break;
        case 15:
            Ret = DecodeGSOF15(Raw, p);
            break;
        case 16:
            Ret = DecodeGSOF16(Raw, p);
            break;
        case 26:
            Ret = DecodeGSOF26(Raw, p);
            break;
        case 41:
            Ret = DecodeGSOF41(Raw, p);
            break;
        default:
            tracet(3, "RT17: GSOF message not processed.\n");    
        }

        RecordLength += 2;
        p += RecordLength;
        InputLength -= RecordLength;
    }

    return Ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, -0x38(%rbp)
movq 0x82ba0(%rdi), %rax
movq %rax, -0x50(%rbp)
movl 0x20(%rax), %r13d
movl $0x0, -0x2c(%rbp)
movl $0x0, %ecx
testl %r13d, %r13d
je 0x38a75
movq -0x50(%rbp), %rax
movq (%rax), %r15
xorl %ecx, %ecx
movq %r15, %r14
movq %rcx, -0x48(%rbp)
movzbl 0x3(%r15), %ebx
leaq 0x6(%rbx), %rax
movq %rax, -0x40(%rbp)
leal -0x3(%rbx), %r12d
leaq 0x7(%r15), %rsi
movq %r14, %rdi
movq %r12, %rdx
callq 0x8a50
movq -0x48(%rbp), %rcx
addq %rbx, %r15
addq $0x6, %r15
addq %r12, %r14
addl %ebx, %ecx
addl $-0x3, %ecx
subl -0x40(%rbp), %r13d
jne 0x38a38
movq -0x50(%rbp), %rax
movl %ecx, 0x20(%rax)
movl %ecx, 0x1c(%rax)
testl %ecx, %ecx
je 0x38d2a
movq (%rax), %r14
movq -0x38(%rbp), %rax
leaq 0x70db8(%rax), %rdx
movq %rdx, -0x48(%rbp)
addq $0x70e20, %rax          # imm = 0x70E20
movq %rax, -0x40(%rbp)
xorl %r13d, %r13d
movl $0x0, -0x2c(%rbp)
movq %rcx, %rbx
movzbl (%r14), %r15d
cmpq $0x29, %r15
ja 0x38ac5
leaq 0x54a3f(%rip), %rax     # 0x8d500
movq (%rax,%r15,8), %r13
movzbl 0x1(%r14), %r12d
testq %r13, %r13
leaq 0x34b8e(%rip), %rax     # 0x6d662
cmoveq %rax, %r13
movl $0x3, %edi
leaq 0x34b86(%rip), %rsi     # 0x6d66a
movl %r15d, %edx
movq %r13, %rcx
movl %r12d, %r8d
xorl %eax, %eax
callq 0x53ec4
cmpl $0xf, %r15d
jg 0x38b3a
cmpl $0x1, %r15d
je 0x38b76
cmpl $0x3, %r15d
je 0x38bd4
cmpl $0xf, %r15d
jne 0x38bbc
movzbl 0x1(%r14), %edx
cmpl $0xe, %edx
ja 0x38ca3
movl $0x0, -0x2c(%rbp)
movl $0x2, %edi
leaq 0x34e9c(%rip), %rsi     # 0x6d9d1
jmp 0x38c17
cmpl $0x10, %r15d
je 0x38b99
cmpl $0x1a, %r15d
je 0x38bfa
cmpl $0x29, %r15d
jne 0x38bbc
movzbl 0x1(%r14), %edx
cmpl $0x5, %edx
ja 0x38c23
movl $0x0, -0x2c(%rbp)
movl $0x2, %edi
leaq 0x34f58(%rip), %rsi     # 0x6dac9
jmp 0x38c17
movzbl 0x1(%r14), %edx
cmpl $0x5, %edx
ja 0x38c23
movl $0x0, -0x2c(%rbp)
movl $0x2, %edi
leaq 0x34d2a(%rip), %rsi     # 0x6d8c1
jmp 0x38c17
movzbl 0x1(%r14), %edx
cmpl $0x8, %edx
ja 0x38c5f
movl $0x0, -0x2c(%rbp)
movl $0x2, %edi
leaq 0x34e6c(%rip), %rsi     # 0x6da26
jmp 0x38c17
movl $0x3, %edi
leaq 0x34af1(%rip), %rsi     # 0x6d6b9
xorl %eax, %eax
callq 0x53ec4
jmp 0x38d14
movzbl 0x1(%r14), %edx
cmpl $0x17, %edx
ja 0x38cc4
movl $0x2, %edi
leaq 0x34d9a(%rip), %rsi     # 0x6d988
xorl %eax, %eax
callq 0x53ec4
jmp 0x38d0d
movzbl 0x1(%r14), %edx
cmpl $0x5, %edx
ja 0x38c23
movl $0x0, -0x2c(%rbp)
movl $0x2, %edi
leaq 0x34e5e(%rip), %rsi     # 0x6da75
xorl %eax, %eax
callq 0x53ec4
jmp 0x38d14
movzbl 0x7(%r14), %eax
movzbl 0x6(%r14), %ecx
shll $0x8, %ecx
movswl %cx, %esi
orl %eax, %esi
movl 0x2(%r14), %eax
bswapl %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x3312e(%rip), %xmm0    # 0x6bd78
movq -0x38(%rbp), %rdi
callq 0x38d87
movl $0x0, -0x2c(%rbp)
jmp 0x38d14
movl $0x0, -0x2c(%rbp)
testb $0x1, 0xa(%r14)
je 0x38d14
movzbl 0x7(%r14), %eax
movzbl 0x6(%r14), %ecx
shll $0x8, %ecx
movswl %cx, %esi
orl %eax, %esi
movl 0x2(%r14), %eax
bswapl %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x330e0(%rip), %xmm0    # 0x6bd78
movq -0x38(%rbp), %rdi
callq 0x38d87
jmp 0x38d14
movl 0x2(%r14), %edx
bswapl %edx
movl $0x0, -0x2c(%rbp)
movq -0x48(%rbp), %rdi
leaq 0x34d68(%rip), %rsi     # 0x6da23
xorl %eax, %eax
callq 0x8120
jmp 0x38d14
movq 0x2(%r14), %rax
bswapq %rax
movq -0x38(%rbp), %rcx
movq %rax, 0x70e08(%rcx)
movq 0xa(%r14), %rax
bswapq %rax
movq %rax, 0x70e10(%rcx)
movq 0x12(%r14), %rax
bswapq %rax
movq %rax, 0x70e18(%rcx)
movl $0x0, 0x70e00(%rcx)
movq -0x40(%rbp), %rax
xorpd %xmm0, %xmm0
movupd %xmm0, 0x10(%rax)
movupd %xmm0, (%rax)
movl $0x5, -0x2c(%rbp)
movq %rbx, %rcx
addb $0x2, %r12b
movzbl %r12b, %eax
addq %rax, %r14
subl %eax, %ecx
jne 0x38aad
movl -0x2c(%rbp), %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq