// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathmsc.cpp
// Function: rinex_prn(int)
int rinex_prn(int prn) 
{
   // convert Heather's PRN to the RINEX standard PRN and set gnss_sat to
   // Heather's GNSS id flag for the PRN
   gnss_sat = 0;
   if(gps_sat(prn)) {
      gnss_sat = GPS;
      return prn;
   }
   else if(sbas_sat(prn)) {     // sat is an SBAS satellite
      prn = sbas_prn(prn); // convert GPS SBAS prn to RINEX SBAS prn value
      gnss_sat = SBAS;
      if(rcvr_type == ESIP_RCVR) return 0;  // does not do SBAS raw measurements
      if(rcvr_type == NVS_RCVR) return 0;   // does not do SBAS raw measurements
      if(rcvr_type == VENUS_RCVR) return 0; // does not do SBAS raw measurements
      return prn;
   }
   else if(glonass_sat(prn)) {
      prn = glonass_prn(prn);
      gnss_sat = GLONASS;
      if(rcvr_type == ESIP_RCVR) return 0;  // does not do GLONASS raw measurements 
      if(rcvr_type == TSIP_RCVR) return 0;
      return prn;
   }
   else if(galileo_sat(prn)) {
      prn = galileo_prn(prn);
      gnss_sat = GALILEO;
      if(rcvr_type == TSIP_RCVR) return 0;
      return prn;
   }
   else if(beidou_sat(prn)) {
      prn = beidou_prn(prn);
      gnss_sat = BEIDOU;
      if(rcvr_type == TSIP_RCVR) return 0;
      return prn;
   }
   else if(qzss_sat(prn)) {
      prn = qzss_prn(prn);
      gnss_sat = QZSS;
      if(rcvr_type == TSIP_RCVR) return 0;
      return 0; //  return prn;  // we don't do IRNSS raw data yet
   }
   else if(irnss_sat(prn)) {
      prn = irnss_prn(prn);
      gnss_sat = IRNSS;
      if(rcvr_type == TSIP_RCVR) return 0;
      return 0; //  return prn;  // we don't do IRNSS raw data yet
   }

   return 0;  // default for GPS
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edi, %ebx
leaq 0x94c4e(%rip), %r14     # 0x170c80
movl $0x0, (%r14)
leal -0x21(%rbx), %eax
cmpl $-0x20, %eax
jae 0xdc08c
movl %ebx, %edi
callq 0xdbd6e
testl %eax, %eax
je 0xdc098
movl $0x8000, (%r14)         # imm = 0x8000
leaq 0x13c876(%rip), %rcx    # 0x2188d0
movq (%rcx), %rcx
xorl %ebx, %ebx
cmpq $0x80, %rcx
je 0xdc18e
cmpq $0x800, %rcx            # imm = 0x800
je 0xdc18e
movl $0x80000000, %edx       # imm = 0x80000000
cmpq %rdx, %rcx
je 0xdc18e
jmp 0xdc176
movl $0x1, (%r14)
jmp 0xdc18e
leaq 0x13c831(%rip), %rax    # 0x2188d0
movq (%rax), %r15
cmpq $0x200, %r15            # imm = 0x200
je 0xdc15b
movl $0x80000000, %eax       # imm = 0x80000000
cmpq %rax, %r15
jne 0xdc0c6
leal -0x5d(%rbx), %eax
cmpl $-0x1c, %eax
jae 0xdc0f9
jmp 0xdc15b
leal -0x61(%rbx), %eax
cmpl $-0x20, %eax
jae 0xdc0f0
cmpq $0x80, %r15
je 0xdc11a
cmpq $0x4, %r15
jne 0xdc15b
leal -0xd3(%rbx), %eax
cmpl $0x24, %eax
jae 0xdc15b
leal -0xd2(%rbx), %eax
jmp 0xdc12b
cmpq $0x200, %r15            # imm = 0x200
jne 0xdc105
movl $0x2, (%r14)
jmp 0xdc18c
addl $-0x40, %ebx
movl $0x2, (%r14)
xorl %eax, %eax
cmpq $0x1, %r15
cmovnel %ebx, %eax
jmp 0xdc176
leal -0x12d(%rbx), %eax
cmpl $0x31, %eax
ja 0xdc15b
leal -0x12c(%rbx), %eax
testl %eax, %eax
je 0xdc15b
cmpq $0x80, %r15
je 0xdc1c0
xorl %eax, %eax
cmpq $0x4, %r15
jne 0xdc1d4
leal -0xd3(%rbx), %ecx
addl $0xffffff2e, %ebx       # imm = 0xFFFFFF2E
xorl %eax, %eax
cmpl $0x24, %ecx
jmp 0xdc1d1
movl %ebx, %edi
callq 0xdbeeb
testl %eax, %eax
je 0xdc17a
movl $0x8, (%r14)
xorl %ecx, %ecx
cmpq $0x1, %r15
cmovel %ecx, %eax
movl %eax, %ebx
jmp 0xdc18e
movl %ebx, %edi
callq 0xdbf57
testl %eax, %eax
je 0xdc19b
movl $0x4000, (%r14)         # imm = 0x4000
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
cmpq $0x80, %r15
setne %al
addl $0xffffff01, %ebx       # imm = 0xFFFFFF01
cmpl $-0xe, %ebx
setb %cl
xorl %ebx, %ebx
orb %al, %cl
jne 0xdc18e
movl $0x10, (%r14)
jmp 0xdc18e
leal -0x12d(%rbx), %ecx
addl $0xfffffed4, %ebx       # imm = 0xFFFFFED4
xorl %eax, %eax
cmpl $0x32, %ecx
cmovbl %ebx, %eax
movl $0x4, (%r14)
jmp 0xdc176