// File: /workspace/github_cpp_makefile_star2_O1/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 0x952ff(%rip), %r14     # 0x170c80
movl $0x0, (%r14)
leal -0x21(%rbx), %eax
cmpl $-0x20, %eax
jae 0xdb9d1
movl %ebx, %edi
callq 0xdb6b1
testl %eax, %eax
je 0xdb9e5
movl %eax, %ecx
movl $0x8000, (%r14)         # imm = 0x8000
leaq 0x13cf25(%rip), %rax    # 0x2188d0
movq (%rax), %rdx
xorl %eax, %eax
cmpq $0x80, %rdx
je 0xdb9da
cmpq $0x800, %rdx            # imm = 0x800
je 0xdb9da
movl $0x80000000, %esi       # imm = 0x80000000
cmpq %rsi, %rdx
je 0xdb9da
jmp 0xdba8d
movl $0x1, (%r14)
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x13cee4(%rip), %rax    # 0x2188d0
movq (%rax), %r15
xorl %eax, %eax
cmpq $0x200, %r15            # imm = 0x200
je 0xdbaa8
movl $0x80000000, %ecx       # imm = 0x80000000
cmpq %rcx, %r15
jne 0xdba36
leal -0x5d(%rbx), %ecx
cmpl $-0x1c, %ecx
jae 0xdba3e
cmpq $0x80, %r15
je 0xdba94
cmpq $0x4, %r15
jne 0xdbaa8
leal -0xd3(%rbx), %ecx
leal -0xd2(%rbx), %edx
xorl %eax, %eax
cmpl $0x24, %ecx
jmp 0xdbaa5
leal -0x61(%rbx), %ecx
cmpl $-0x20, %ecx
jb 0xdba10
xorl %eax, %eax
movl $0x0, %ecx
cmpq $0x200, %r15            # imm = 0x200
je 0xdba6e
movl $0x80000000, %ecx       # imm = 0x80000000
cmpq %rcx, %r15
jne 0xdbb19
leal -0x5d(%rbx), %edx
movl $0x0, %ecx
cmpl $-0x1c, %edx
jb 0xdba6e
addl $-0x40, %ebx
movl %ebx, %ecx
movl $0x2, (%r14)
cmpq $0x1, %r15
je 0xdb9da
movl $0x80000000, %edx       # imm = 0x80000000
cmpq %rdx, %r15
je 0xdb9da
movl %ecx, %eax
jmp 0xdb9da
leal -0x12d(%rbx), %ecx
leal -0x12c(%rbx), %edx
xorl %eax, %eax
cmpl $0x32, %ecx
cmovbl %edx, %eax
testl %eax, %eax
je 0xdbad0
cmpq $0x80, %r15
je 0xdbaf0
xorl %ecx, %ecx
cmpq $0x4, %r15
jne 0xdbb04
leal -0xd3(%rbx), %eax
addl $0xffffff2e, %ebx       # imm = 0xFFFFFF2E
xorl %ecx, %ecx
cmpl $0x24, %eax
jmp 0xdbb01
movl %ebx, %edi
callq 0xdb83a
testl %eax, %eax
je 0xdbb2f
movl $0x8, (%r14)
xorl %ecx, %ecx
cmpq $0x1, %r15
cmovel %ecx, %eax
jmp 0xdb9da
leal -0x12d(%rbx), %eax
addl $0xfffffed4, %ebx       # imm = 0xFFFFFED4
xorl %ecx, %ecx
cmpl $0x32, %eax
cmovbl %ebx, %ecx
movl $0x4, (%r14)
xorl %eax, %eax
cmpq $0x1, %r15
cmovnel %ecx, %eax
jmp 0xdb9da
leal -0x61(%rbx), %edx
movl $0x0, %ecx
cmpl $-0x20, %edx
jae 0xdba69
jmp 0xdba6e
movl %ebx, %edi
callq 0xdb8a6
testl %eax, %eax
je 0xdbb48
movl $0x4000, (%r14)         # imm = 0x4000
xorl %eax, %eax
jmp 0xdb9da
cmpq $0x80, %r15
setne %cl
addl $0xffffff01, %ebx       # imm = 0xFFFFFF01
cmpl $-0xe, %ebx
setb %dl
xorl %eax, %eax
orb %cl, %dl
jne 0xdb9da
movl $0x10, (%r14)
jmp 0xdb9da