// File: 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
subq $0x10, %rsp
movl %edi, -0x8(%rbp)
leaq 0xa2e2e(%rip), %rax     # 0x1cfe60
movl $0x0, (%rax)
movl -0x8(%rbp), %edi
callq 0x12caa0
cmpl $0x0, %eax
je 0x12d05d
leaq 0xa2e14(%rip), %rax     # 0x1cfe60
movl $0x1, (%rax)
movl -0x8(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x12d275
movl -0x8(%rbp), %edi
callq 0x12cbe0
cmpl $0x0, %eax
je 0x12d0e2
movl -0x8(%rbp), %edi
callq 0x12cae0
movl %eax, -0x8(%rbp)
leaq 0xa2de4(%rip), %rax     # 0x1cfe60
movl $0x8000, (%rax)         # imm = 0x8000
movl $0x80000000, %ecx       # imm = 0x80000000
leaq 0x14aa22(%rip), %rax    # 0x277ab0
cmpq %rcx, (%rax)
jne 0x12d09f
movl $0x0, -0x4(%rbp)
jmp 0x12d275
leaq 0x14aa0a(%rip), %rax    # 0x277ab0
cmpq $0x800, (%rax)          # imm = 0x800
jne 0x12d0bb
movl $0x0, -0x4(%rbp)
jmp 0x12d275
leaq 0x14a9ee(%rip), %rax    # 0x277ab0
cmpq $0x80, (%rax)
jne 0x12d0d7
movl $0x0, -0x4(%rbp)
jmp 0x12d275
movl -0x8(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x12d275
movl -0x8(%rbp), %edi
callq 0x12ccb0
cmpl $0x0, %eax
je 0x12d148
movl -0x8(%rbp), %edi
callq 0x12cc20
movl %eax, -0x8(%rbp)
leaq 0xa2d5f(%rip), %rax     # 0x1cfe60
movl $0x2, (%rax)
movl $0x80000000, %ecx       # imm = 0x80000000
leaq 0x14a99d(%rip), %rax    # 0x277ab0
cmpq %rcx, (%rax)
jne 0x12d124
movl $0x0, -0x4(%rbp)
jmp 0x12d275
leaq 0x14a985(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0x12d13d
movl $0x0, -0x4(%rbp)
jmp 0x12d275
movl -0x8(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x12d275
movl -0x8(%rbp), %edi
callq 0x12cd70
cmpl $0x0, %eax
je 0x12d191
movl -0x8(%rbp), %edi
callq 0x12ccf0
movl %eax, -0x8(%rbp)
leaq 0xa2cf9(%rip), %rax     # 0x1cfe60
movl $0x4, (%rax)
leaq 0x14a93c(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0x12d186
movl $0x0, -0x4(%rbp)
jmp 0x12d275
movl -0x8(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x12d275
movl -0x8(%rbp), %edi
callq 0x12ce50
cmpl $0x0, %eax
je 0x12d1da
movl -0x8(%rbp), %edi
callq 0x12cdb0
movl %eax, -0x8(%rbp)
leaq 0xa2cb0(%rip), %rax     # 0x1cfe60
movl $0x8, (%rax)
leaq 0x14a8f3(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0x12d1cf
movl $0x0, -0x4(%rbp)
jmp 0x12d275
movl -0x8(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x12d275
movl -0x8(%rbp), %edi
callq 0x12cf50
cmpl $0x0, %eax
je 0x12d21e
movl -0x8(%rbp), %edi
callq 0x12ce90
movl %eax, -0x8(%rbp)
leaq 0xa2c67(%rip), %rax     # 0x1cfe60
movl $0x4000, (%rax)         # imm = 0x4000
leaq 0x14a8aa(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0x12d215
movl $0x0, -0x4(%rbp)
jmp 0x12d275
movl $0x0, -0x4(%rbp)
jmp 0x12d275
movl -0x8(%rbp), %edi
callq 0x12cfe0
cmpl $0x0, %eax
je 0x12d262
movl -0x8(%rbp), %edi
callq 0x12cf90
movl %eax, -0x8(%rbp)
leaq 0xa2c23(%rip), %rax     # 0x1cfe60
movl $0x10, (%rax)
leaq 0x14a866(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0x12d259
movl $0x0, -0x4(%rbp)
jmp 0x12d275
movl $0x0, -0x4(%rbp)
jmp 0x12d275
jmp 0x12d264
jmp 0x12d266
jmp 0x12d268
jmp 0x12d26a
jmp 0x12d26c
jmp 0x12d26e
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nop