// File: DoubleString[P]RtConverter/src/Rtklib/rtkcmn.cpp
// Function: bamboo::satno(int, int)
extern int satno(int sys, int prn)
{
    if (prn<=0) return 0;
    switch (sys) {
        case SYS_GPS:
            if (prn<MINPRNGPS||MAXPRNGPS<prn) return 0;
            return prn-MINPRNGPS+1;
        case SYS_GLO:
            if (prn<MINPRNGLO||MAXPRNGLO<prn) return 0;
            return NSATGPS+prn-MINPRNGLO+1;
        case SYS_GAL:
            if (prn<MINPRNGAL||MAXPRNGAL<prn) return 0;
            return NSATGPS+NSATGLO+prn-MINPRNGAL+1;
        case SYS_QZS:
            if (prn<MINPRNQZS||MAXPRNQZS<prn) return 0;
            return NSATGPS+NSATGLO+NSATGAL+prn-MINPRNQZS+1;
        case SYS_CMP:
            if (prn<MINPRNCMP||MAXPRNCMP<prn) return 0;
            return NSATGPS+NSATGLO+NSATGAL+NSATQZS+prn-MINPRNCMP+1;
        case SYS_IRN:
            if (prn<MINPRNIRN||MAXPRNIRN<prn) return 0;
            return NSATGPS+NSATGLO+NSATGAL+NSATQZS+NSATCMP+prn-MINPRNIRN+1;
        case SYS_LEO:
            if (prn<MINPRNLEO||MAXPRNLEO<prn) return 0;
            return NSATGPS+NSATGLO+NSATGAL+NSATQZS+NSATCMP+NSATIRN+
                   prn-MINPRNLEO+1;
        case SYS_SBS:
            if (prn<MINPRNSBS||MAXPRNSBS<prn) return 0;
            return NSATGPS+NSATGLO+NSATGAL+NSATQZS+NSATCMP+NSATIRN+NSATLEO+
                   prn-MINPRNSBS+1;
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
jg 0x8b1cc
movl $0x0, -0x4(%rbp)
jmp 0x8b3ab
movl -0x8(%rbp), %eax
movl %eax, -0x10(%rbp)
subl $0x1, %eax
je 0x8b23c
jmp 0x8b1d9
movl -0x10(%rbp), %eax
subl $0x2, %eax
je 0x8b378
jmp 0x8b1e7
movl -0x10(%rbp), %eax
subl $0x4, %eax
je 0x8b269
jmp 0x8b1f1
movl -0x10(%rbp), %eax
subl $0x8, %eax
je 0x8b299
jmp 0x8b1ff
movl -0x10(%rbp), %eax
subl $0x10, %eax
je 0x8b2c9
jmp 0x8b20d
movl -0x10(%rbp), %eax
subl $0x20, %eax
je 0x8b2f6
jmp 0x8b21b
movl -0x10(%rbp), %eax
subl $0x40, %eax
je 0x8b326
jmp 0x8b229
movl -0x10(%rbp), %eax
subl $0x80, %eax
je 0x8b34f
jmp 0x8b3a4
cmpl $0x1, -0xc(%rbp)
jl 0x8b24c
movl $0x20, %eax
cmpl -0xc(%rbp), %eax
jge 0x8b258
movl $0x0, -0x4(%rbp)
jmp 0x8b3ab
movl -0xc(%rbp), %eax
subl $0x1, %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x8b3ab
cmpl $0x1, -0xc(%rbp)
jl 0x8b279
movl $0x1b, %eax
cmpl -0xc(%rbp), %eax
jge 0x8b285
movl $0x0, -0x4(%rbp)
jmp 0x8b3ab
movl -0xc(%rbp), %eax
addl $0x20, %eax
subl $0x1, %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x8b3ab
cmpl $0x1, -0xc(%rbp)
jl 0x8b2a9
movl $0x24, %eax
cmpl -0xc(%rbp), %eax
jge 0x8b2b5
movl $0x0, -0x4(%rbp)
jmp 0x8b3ab
movl -0xc(%rbp), %eax
addl $0x3b, %eax
subl $0x1, %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x8b3ab
cmpl $0x0, -0xc(%rbp)
jl 0x8b2d6
xorl %eax, %eax
cmpl -0xc(%rbp), %eax
jge 0x8b2e2
movl $0x0, -0x4(%rbp)
jmp 0x8b3ab
movl -0xc(%rbp), %eax
addl $0x5f, %eax
subl $0x0, %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x8b3ab
cmpl $0x1, -0xc(%rbp)
jl 0x8b306
movl $0x25, %eax
cmpl -0xc(%rbp), %eax
jge 0x8b312
movl $0x0, -0x4(%rbp)
jmp 0x8b3ab
movl -0xc(%rbp), %eax
addl $0x5f, %eax
subl $0x1, %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x8b3ab
cmpl $0x0, -0xc(%rbp)
jl 0x8b333
xorl %eax, %eax
cmpl -0xc(%rbp), %eax
jge 0x8b33c
movl $0x0, -0x4(%rbp)
jmp 0x8b3ab
movl -0xc(%rbp), %eax
addl $0x84, %eax
subl $0x0, %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x8b3ab
cmpl $0x0, -0xc(%rbp)
jl 0x8b35c
xorl %eax, %eax
cmpl -0xc(%rbp), %eax
jge 0x8b365
movl $0x0, -0x4(%rbp)
jmp 0x8b3ab
movl -0xc(%rbp), %eax
addl $0x84, %eax
subl $0x0, %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x8b3ab
cmpl $0x78, -0xc(%rbp)
jl 0x8b388
movl $0x8e, %eax
cmpl -0xc(%rbp), %eax
jge 0x8b391
movl $0x0, -0x4(%rbp)
jmp 0x8b3ab
movl -0xc(%rbp), %eax
addl $0x84, %eax
subl $0x78, %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x8b3ab
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq