// File: DoubleString[P]RtConverter/src/Rtklib/rtkcmn.cpp
// Function: bamboo::antmodel(bamboo::pcv_t const*, double const*, double const*, int, double*)
extern void antmodel(const pcv_t *pcv, const double *del, const double *azel,
                     int opt, double *dant)
{
    double e[3],off[3],cosel=cos(azel[1]);
    int i,j;
    
    trace(4,"antmodel: azel=%6.1f %4.1f opt=%d\n",azel[0]*R2D,azel[1]*R2D,opt);
    
    e[0]=sin(azel[0])*cosel;
    e[1]=cos(azel[0])*cosel;
    e[2]=sin(azel[1]);
    
    for (i=0;i<NFREQ;i++) {
        for (j=0;j<3;j++) off[j]=pcv->off[i][j]+del[j];
        
        dant[i]=-rtk_dot(off,e,3)+(opt?interpvar(90.0-azel[1]*R2D,pcv->var[i]):0.0);
    }
    trace(5,"antmodel: dant=%6.3f %6.3f\n",dant[0],dant[1]);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq %r8, -0x28(%rbp)
movq -0x18(%rbp), %rax
movsd 0x8(%rax), %xmm0
callq 0x9e00
movsd %xmm0, -0x68(%rbp)
movq -0x18(%rbp), %rax
movsd 0x28843(%rip), %xmm0    # 0xc09f0
mulsd (%rax), %xmm0
movq -0x18(%rbp), %rax
movsd 0x28833(%rip), %xmm1    # 0xc09f0
mulsd 0x8(%rax), %xmm1
movl -0x1c(%rbp), %edx
movl $0x4, %edi
leaq 0x2fd86(%rip), %rsi     # 0xc7f57
movb $0x2, %al
callq 0x8b980
movq -0x18(%rbp), %rax
movsd (%rax), %xmm0
callq 0x91a0
mulsd -0x68(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
movq -0x18(%rbp), %rax
movsd (%rax), %xmm0
callq 0x9e00
mulsd -0x68(%rbp), %xmm0
movsd %xmm0, -0x38(%rbp)
movq -0x18(%rbp), %rax
movsd 0x8(%rax), %xmm0
callq 0x91a0
movsd %xmm0, -0x30(%rbp)
movl $0x0, -0x6c(%rbp)
cmpl $0x3, -0x6c(%rbp)
jge 0x9833b
movl $0x0, -0x70(%rbp)
cmpl $0x3, -0x70(%rbp)
jge 0x98277
movq -0x8(%rbp), %rax
addq $0xa8, %rax
movslq -0x6c(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movslq -0x70(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x10(%rbp), %rax
movslq -0x70(%rbp), %rcx
addsd (%rax,%rcx,8), %xmm0
movslq -0x70(%rbp), %rax
movsd %xmm0, -0x60(%rbp,%rax,8)
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x70(%rbp)
jmp 0x98231
leaq -0x60(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movl $0x3, %edx
callq 0x8c7c0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, -0x78(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x98308
movq -0x18(%rbp), %rax
movsd 0x8(%rax), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd 0x2871d(%rip), %xmm1    # 0xc09f0
mulsd %xmm1, %xmm0
movsd 0x24d19(%rip), %xmm1    # 0xbcff8
addsd %xmm1, %xmm0
movq -0x8(%rbp), %rdi
addq $0xf0, %rdi
movslq -0x6c(%rbp), %rax
imulq $0x98, %rax, %rax
addq %rax, %rdi
callq 0x98370
movsd %xmm0, -0x80(%rbp)
jmp 0x98312
xorps %xmm0, %xmm0
movsd %xmm0, -0x80(%rbp)
jmp 0x98312
movsd -0x78(%rbp), %xmm0
movsd -0x80(%rbp), %xmm1
addsd %xmm1, %xmm0
movq -0x28(%rbp), %rax
movslq -0x6c(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x98220
movq -0x28(%rbp), %rax
movsd (%rax), %xmm0
movq -0x28(%rbp), %rax
movsd 0x8(%rax), %xmm1
movl $0x5, %edi
leaq 0x2fc22(%rip), %rsi     # 0xc7f7a
movb $0x2, %al
callq 0x8b980
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax,%rax)