// File: /workspace/github_cpp_makefile_star2_O2/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 %r14
pushq %rbx
leaq 0x908c8(%rip), %r14     # 0x15ac80
andl $0x0, (%r14)
movl %edi, %ebx
leal -0x21(%rbx), %eax
cmpl $-0x20, %eax
jae 0xca3ff
movl %ebx, %edi
callq 0xca1bd
testl %eax, %eax
je 0xca40d
movl %ebx, %edi
callq 0xca168
movl $0x8000, (%r14)         # imm = 0x8000
leaq 0x1384ea(%rip), %rcx    # 0x2028d0
movq (%rcx), %rcx
xorl %ebx, %ebx
cmpq $0x80, %rcx
je 0xca406
cmpq $0x800, %rcx            # imm = 0x800
jne 0xca438
jmp 0xca406
movl $0x1, (%r14)
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
movl %ebx, %edi
callq 0xca20c
testl %eax, %eax
je 0xca446
movl %ebx, %edi
callq 0xca1d0
movl $0x2, (%r14)
leaq 0x1384a3(%rip), %rcx    # 0x2028d0
movq (%rcx), %rcx
xorl %ebx, %ebx
cmpq $0x1, %rcx
je 0xca406
movl $0x80000000, %edx       # imm = 0x80000000
cmpq %rdx, %rcx
je 0xca406
movl %eax, %ebx
jmp 0xca406
movl %ebx, %edi
callq 0xca267
testl %eax, %eax
je 0xca461
movl %ebx, %edi
callq 0xca21f
movl $0x4, (%r14)
jmp 0xca47a
movl %ebx, %edi
callq 0xca2d1
testl %eax, %eax
je 0xca48f
movl %ebx, %edi
callq 0xca27a
movl $0x8, (%r14)
leaq 0x13844f(%rip), %rcx    # 0x2028d0
xorl %ebx, %ebx
cmpq $0x1, (%rcx)
cmovnel %eax, %ebx
jmp 0xca406
movl %ebx, %edi
callq 0xca343
testl %eax, %eax
je 0xca4a8
movl $0x4000, (%r14)         # imm = 0x4000
xorl %ebx, %ebx
jmp 0xca406
movl %ebx, %eax
addl $0xffffff01, %eax       # imm = 0xFFFFFF01
xorl %ebx, %ebx
cmpl $-0xe, %eax
jb 0xca406
leaq 0x13840f(%rip), %rax    # 0x2028d0
cmpq $0x80, (%rax)
jne 0xca406
movl $0x10, (%r14)
jmp 0xca406