// File: DoubleString[P]RtConverter/src/Rtklib/rtkcmn.cpp
// Function: bamboo::sortobs(bamboo::obs_t*)
extern int sortobs(obs_t *obs)
{
    int i,j,n;
    
    trace(3,"sortobs: nobs=%d\n",obs->n);
    
    if (obs->n<=0) return 0;
    
    qsort(obs->data,obs->n,sizeof(obsd_t),cmpobs);
    
    /* delete duplicated data */
    for (i=j=0;i<obs->n;i++) {
        if (obs->data[i].sat!=obs->data[j].sat||
            obs->data[i].rcv!=obs->data[j].rcv||
            timediff(obs->data[i].time,obs->data[j].time)!=0.0) {
            obs->data[++j]=obs->data[i];
        }
    }
    obs->n=j+1;
    
    for (i=n=0;i<obs->n;i=j,n++) {
        for (j=i+1;j<obs->n;j++) {
            if (timediff(obs->data[j].time,obs->data[i].time)>DTTOL) break;
        }
    }
    return n;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %edx
movl $0x3, %edi
leaq 0x34034(%rip), %rsi     # 0xc7bc2
movb $0x0, %al
callq 0x8b980
movq -0x10(%rbp), %rax
cmpl $0x0, (%rax)
jg 0x93baa
movl $0x0, -0x4(%rbp)
jmp 0x93dd2
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rax
movslq (%rax), %rsi
movl $0x60, %edx
leaq 0x21b(%rip), %rcx       # 0x93de0
callq 0x9e40
movl $0x0, -0x18(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x93cfe
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x14(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movzbl 0x10(%rax), %eax
movq -0x10(%rbp), %rcx
movq 0x8(%rcx), %rcx
movslq -0x18(%rbp), %rdx
imulq $0x60, %rdx, %rdx
addq %rdx, %rcx
movzbl 0x10(%rcx), %ecx
cmpl %ecx, %eax
jne 0x93cb7
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x14(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movzbl 0x11(%rax), %eax
movq -0x10(%rbp), %rcx
movq 0x8(%rcx), %rcx
movslq -0x18(%rbp), %rdx
imulq $0x60, %rdx, %rdx
addq %rdx, %rcx
movzbl 0x11(%rcx), %ecx
cmpl %ecx, %eax
jne 0x93cb7
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x14(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0x30(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x18(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0x40(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rdi
movsd -0x28(%rbp), %xmm0
movq -0x40(%rbp), %rsi
movsd -0x38(%rbp), %xmm1
callq 0x8e8e0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x93cb7
jp 0x93cb7
jmp 0x93cee
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
movslq -0x14(%rbp), %rax
imulq $0x60, %rax, %rax
addq %rax, %rsi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
cltq
imulq $0x60, %rax, %rax
addq %rax, %rdi
movl $0x60, %edx
callq 0x9610
jmp 0x93cf0
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x93bd8
movl -0x18(%rbp), %ecx
addl $0x1, %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x93dcc
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x93db6
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x18(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0x50(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x14(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0x60(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x50(%rbp), %rdi
movsd -0x48(%rbp), %xmm0
movq -0x60(%rbp), %rsi
movsd -0x58(%rbp), %xmm1
callq 0x8e8e0
movsd 0x3377a(%rip), %xmm1    # 0xc7518
ucomisd %xmm1, %xmm0
jbe 0x93da6
jmp 0x93db6
jmp 0x93da8
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x93d30
jmp 0x93db8
movl -0x18(%rbp), %eax
movl %eax, -0x14(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x93d18
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax,%rax)