// File: DoubleString[P]RtConverter/src/Rtklib/rtkcmn.cpp
// Function: bamboo::uniqseph(bamboo::nav_t*)
static void uniqseph(nav_t *nav)
{
    seph_t *nav_seph;
    int i,j;
    
    trace(3,"uniqseph: ns=%d\n",nav->ns);
    
    if (nav->ns<=0) return;
    
    qsort(nav->seph,nav->ns,sizeof(seph_t),cmpseph);
    
    for (i=j=0;i<nav->ns;i++) {
        if (nav->seph[i].sat!=nav->seph[j].sat||
            nav->seph[i].t0.time!=nav->seph[j].t0.time) {
            nav->seph[++j]=nav->seph[i];
        }
    }
    nav->ns=j+1;
    
    if (!(nav_seph=(seph_t *)realloc(nav->seph,sizeof(seph_t)*nav->ns))) {
        trace(1,"uniqseph malloc error ns=%d\n",nav->ns);
        free(nav->seph); nav->seph=NULL; nav->ns=nav->nsmax=0;
        return;
    }
    nav->seph=nav_seph;
    nav->nsmax=nav->ns;
    
    trace(4,"uniqseph: ns=%d\n",nav->ns);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl 0x10(%rax), %edx
movl $0x3, %edi
leaq 0x34b5f(%rip), %rsi     # 0xc826e
movb $0x0, %al
callq 0x8b980
movq -0x8(%rbp), %rax
cmpl $0x0, 0x10(%rax)
jg 0x93725
jmp 0x938cb
movq -0x8(%rbp), %rax
movq 0x50(%rax), %rdi
movq -0x8(%rbp), %rax
movslq 0x10(%rax), %rsi
movl $0x88, %edx
leaq 0x636f(%rip), %rcx      # 0x99ab0
callq 0x9e40
movl $0x0, -0x18(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jge 0x93819
movq -0x8(%rbp), %rax
movq 0x50(%rax), %rax
movslq -0x14(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %eax
movq -0x8(%rbp), %rcx
movq 0x50(%rcx), %rcx
movslq -0x18(%rbp), %rdx
imulq $0x88, %rdx, %rdx
addq %rdx, %rcx
cmpl (%rcx), %eax
jne 0x937cc
movq -0x8(%rbp), %rax
movq 0x50(%rax), %rax
movslq -0x14(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x50(%rcx), %rcx
movslq -0x18(%rbp), %rdx
imulq $0x88, %rdx, %rdx
addq %rdx, %rcx
cmpq 0x8(%rcx), %rax
je 0x93809
movq -0x8(%rbp), %rax
movq 0x50(%rax), %rsi
movslq -0x14(%rbp), %rax
imulq $0x88, %rax, %rax
addq %rax, %rsi
movq -0x8(%rbp), %rax
movq 0x50(%rax), %rdi
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
cltq
imulq $0x88, %rax, %rax
addq %rax, %rdi
movl $0x88, %edx
callq 0x9610
jmp 0x9380b
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x93754
movl -0x18(%rbp), %ecx
addl $0x1, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x8(%rbp), %rax
movq 0x50(%rax), %rdi
movq -0x8(%rbp), %rax
movslq 0x10(%rax), %rax
imulq $0x88, %rax, %rsi
callq 0x9c30
movq %rax, -0x10(%rbp)
cmpq $0x0, %rax
jne 0x93897
movq -0x8(%rbp), %rax
movl 0x10(%rax), %edx
movl $0x1, %edi
leaq 0x34a20(%rip), %rsi     # 0xc827f
movb $0x0, %al
callq 0x8b980
movq -0x8(%rbp), %rax
movq 0x50(%rax), %rdi
callq 0x9900
movq -0x8(%rbp), %rax
movq $0x0, 0x50(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x14(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x10(%rax)
jmp 0x938cb
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x8(%rbp), %rax
movl 0x10(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x8(%rbp), %rax
movl 0x10(%rax), %edx
movl $0x4, %edi
leaq 0x349aa(%rip), %rsi     # 0xc826e
movb $0x0, %al
callq 0x8b980
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)