// File: DoubleString[P]RtConverter/src/Rtklib/rtkcmn.cpp
// Function: bamboo::uniqeph(bamboo::nav_t*)
static void uniqeph(nav_t *nav)
{
    eph_t *nav_eph;
    int i,j;
    
    trace(3,"uniqeph: n=%d\n",nav->n);
    
    if (nav->n<=0) return;
    
    qsort(nav->eph,nav->n,sizeof(eph_t),cmpeph);
    
    for (i=1,j=0;i<nav->n;i++) {
        if (nav->eph[i].sat!=nav->eph[j].sat||
            nav->eph[i].iode!=nav->eph[j].iode) {
            nav->eph[++j]=nav->eph[i];
        }
    }
    nav->n=j+1;
    
    if (!(nav_eph=(eph_t *)realloc(nav->eph,sizeof(eph_t)*nav->n))) {
        trace(1,"uniqeph malloc error n=%d\n",nav->n);
        free(nav->eph); nav->eph=NULL; nav->n=nav->nmax=0;
        return;
    }
    nav->eph=nav_eph;
    nav->nmax=nav->n;
    
    trace(4,"uniqeph: n=%d\n",nav->n);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %edx
movl $0x3, %edi
leaq 0x34f08(%rip), %rsi     # 0xc8216
movb $0x0, %al
callq 0x8b980
movq -0x8(%rbp), %rax
cmpl $0x0, (%rax)
jg 0x93323
jmp 0x934bf
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rdi
movq -0x8(%rbp), %rax
movslq (%rax), %rsi
movl $0x120, %edx            # imm = 0x120
leaq 0x6652(%rip), %rcx      # 0x99990
callq 0x9e40
movl $0x1, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movl -0x14(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x93413
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x14(%rbp), %rcx
imulq $0x120, %rcx, %rcx      # imm = 0x120
addq %rcx, %rax
movl (%rax), %eax
movq -0x8(%rbp), %rcx
movq 0x40(%rcx), %rcx
movslq -0x18(%rbp), %rdx
imulq $0x120, %rdx, %rdx      # imm = 0x120
addq %rdx, %rcx
cmpl (%rcx), %eax
jne 0x933c6
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x14(%rbp), %rcx
imulq $0x120, %rcx, %rcx      # imm = 0x120
addq %rcx, %rax
movl 0x4(%rax), %eax
movq -0x8(%rbp), %rcx
movq 0x40(%rcx), %rcx
movslq -0x18(%rbp), %rdx
imulq $0x120, %rdx, %rdx      # imm = 0x120
addq %rdx, %rcx
cmpl 0x4(%rcx), %eax
je 0x93403
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rsi
movslq -0x14(%rbp), %rax
imulq $0x120, %rax, %rax      # imm = 0x120
addq %rax, %rsi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rdi
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
cltq
imulq $0x120, %rax, %rax      # imm = 0x120
addq %rax, %rdi
movl $0x120, %edx            # imm = 0x120
callq 0x9610
jmp 0x93405
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x93351
movl -0x18(%rbp), %ecx
addl $0x1, %ecx
movq -0x8(%rbp), %rax
movl %ecx, (%rax)
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rdi
movq -0x8(%rbp), %rax
movslq (%rax), %rax
imulq $0x120, %rax, %rsi      # imm = 0x120
callq 0x9c30
movq %rax, -0x10(%rbp)
cmpq $0x0, %rax
jne 0x9348d
movq -0x8(%rbp), %rax
movl (%rax), %edx
movl $0x1, %edi
leaq 0x34dcf(%rip), %rsi     # 0xc8225
movb $0x0, %al
callq 0x8b980
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rdi
callq 0x9900
movq -0x8(%rbp), %rax
movq $0x0, 0x40(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x4(%rax)
movq -0x8(%rbp), %rax
movl $0x0, (%rax)
jmp 0x934bf
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x8(%rbp), %rax
movl (%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x8(%rbp), %rax
movl (%rax), %edx
movl $0x4, %edi
leaq 0x34d5e(%rip), %rsi     # 0xc8216
movb $0x0, %al
callq 0x8b980
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)