// File: DoubleString[P]RtConverter/src/Rtklib/rtkcmn.cpp
// Function: bamboo::uniqgeph(bamboo::nav_t*)
static void uniqgeph(nav_t *nav)
{
    geph_t *nav_geph;
    int i,j;
    
    trace(3,"uniqgeph: ng=%d\n",nav->ng);
    
    if (nav->ng<=0) return;
    
    qsort(nav->geph,nav->ng,sizeof(geph_t),cmpgeph);
    
    for (i=j=0;i<nav->ng;i++) {
        if (nav->geph[i].sat!=nav->geph[j].sat||
            nav->geph[i].toe.time!=nav->geph[j].toe.time||
            nav->geph[i].svh!=nav->geph[j].svh) {
            nav->geph[++j]=nav->geph[i];
        }
    }
    nav->ng=j+1;
    
    if (!(nav_geph=(geph_t *)realloc(nav->geph,sizeof(geph_t)*nav->ng))) {
        trace(1,"uniqgeph malloc error ng=%d\n",nav->ng);
        free(nav->geph); nav->geph=NULL; nav->ng=nav->ngmax=0;
        return;
    }
    nav->geph=nav_geph;
    nav->ngmax=nav->ng;
    
    trace(4,"uniqgeph: ng=%d\n",nav->ng);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl 0x8(%rax), %edx
movl $0x3, %edi
leaq 0x34d51(%rip), %rsi     # 0xc8240
movb $0x0, %al
callq 0x8b980
movq -0x8(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jg 0x93505
jmp 0x936df
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x8(%rbp), %rax
movslq 0x8(%rax), %rsi
movl $0x98, %edx
leaq 0x64ff(%rip), %rcx      # 0x99a20
callq 0x9e40
movl $0x0, -0x18(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x9362d
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x14(%rbp), %rcx
imulq $0x98, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %eax
movq -0x8(%rbp), %rcx
movq 0x48(%rcx), %rcx
movslq -0x18(%rbp), %rdx
imulq $0x98, %rdx, %rdx
addq %rdx, %rcx
cmpl (%rcx), %eax
jne 0x935e0
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x14(%rbp), %rcx
imulq $0x98, %rcx, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x48(%rcx), %rcx
movslq -0x18(%rbp), %rdx
imulq $0x98, %rdx, %rdx
addq %rdx, %rcx
cmpq 0x18(%rcx), %rax
jne 0x935e0
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x14(%rbp), %rcx
imulq $0x98, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
movq -0x8(%rbp), %rcx
movq 0x48(%rcx), %rcx
movslq -0x18(%rbp), %rdx
imulq $0x98, %rdx, %rdx
addq %rdx, %rcx
cmpl 0xc(%rcx), %eax
je 0x9361d
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rsi
movslq -0x14(%rbp), %rax
imulq $0x98, %rax, %rax
addq %rax, %rsi
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
cltq
imulq $0x98, %rax, %rax
addq %rax, %rdi
movl $0x98, %edx
callq 0x9610
jmp 0x9361f
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x93534
movl -0x18(%rbp), %ecx
addl $0x1, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x8(%rbp), %rax
movslq 0x8(%rax), %rax
imulq $0x98, %rax, %rsi
callq 0x9c30
movq %rax, -0x10(%rbp)
cmpq $0x0, %rax
jne 0x936ab
movq -0x8(%rbp), %rax
movl 0x8(%rax), %edx
movl $0x1, %edi
leaq 0x34bde(%rip), %rsi     # 0xc8251
movb $0x0, %al
callq 0x8b980
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x9900
movq -0x8(%rbp), %rax
movq $0x0, 0x48(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0xc(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x8(%rax)
jmp 0x936df
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x8(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x8(%rbp), %rax
movl 0x8(%rax), %edx
movl $0x4, %edi
leaq 0x34b68(%rip), %rsi     # 0xc8240
movb $0x0, %al
callq 0x8b980
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)