// File: DoubleString[P]RtConverter/src/Rtklib/rtkcmn.cpp
// Function: bamboo::savenav(char const*, bamboo::nav_t const*)
extern int savenav(const char *file, const nav_t *nav)
{
    FILE *fp;
    int i;
    char id[32];
    
    trace(3,"savenav: file=%s\n",file);
    
    if (!(fp=fopen(file,"w"))) return 0;
    
    for (i=0;i<MAXRTKSAT;i++) {
        if (nav->eph[i].ttr.time==0) continue;
        satno2id(nav->eph[i].sat,id);
        fprintf(fp,"%s,%d,%d,%d,%d,%d,%d,%d,%.14E,%.14E,%.14E,%.14E,%.14E,%.14E,"
                   "%.14E,%.14E,%.14E,%.14E,%.14E,%.14E,%.14E,%.14E,%.14E,%.14E,"
                   "%.14E,%.14E,%.14E,%.14E,%.14E,%d,%d\n",
                id,nav->eph[i].iode,nav->eph[i].iodc,nav->eph[i].sva ,
                nav->eph[i].svh ,(int)nav->eph[i].toe.time,
                (int)nav->eph[i].toc.time,(int)nav->eph[i].ttr.time,
                nav->eph[i].A   ,nav->eph[i].e  ,nav->eph[i].i0  ,nav->eph[i].OMG0,
                nav->eph[i].omg ,nav->eph[i].M0 ,nav->eph[i].deln,nav->eph[i].OMGd,
                nav->eph[i].idot,nav->eph[i].crc,nav->eph[i].crs ,nav->eph[i].cuc ,
                nav->eph[i].cus ,nav->eph[i].cic,nav->eph[i].cis ,nav->eph[i].toes,
                nav->eph[i].fit ,nav->eph[i].f0 ,nav->eph[i].f1  ,nav->eph[i].f2  ,
                nav->eph[i].tgd[0],nav->eph[i].code,nav->eph[i].flag);
    }
    for (i=0;i<MAXPRNGLO;i++) {
        if (nav->geph[i].tof.time==0) continue;
        satno2id(nav->geph[i].sat,id);
        fprintf(fp,"%s,%d,%d,%d,%d,%d,%d,%d,%.14E,%.14E,%.14E,%.14E,%.14E,%.14E,"
                   "%.14E,%.14E,%.14E,%.14E,%.14E,%.14E\n",
                id,nav->geph[i].iode,nav->geph[i].frq,nav->geph[i].svh,
                nav->geph[i].sva,nav->geph[i].age,(int)nav->geph[i].toe.time,
                (int)nav->geph[i].tof.time,
                nav->geph[i].pos[0],nav->geph[i].pos[1],nav->geph[i].pos[2],
                nav->geph[i].vel[0],nav->geph[i].vel[1],nav->geph[i].vel[2],
                nav->geph[i].acc[0],nav->geph[i].acc[1],nav->geph[i].acc[2],
                nav->geph[i].taun,nav->geph[i].gamn,nav->geph[i].dtaun);
    }
    fprintf(fp,"IONUTC,%.14E,%.14E,%.14E,%.14E,%.14E,%.14E,%.14E,%.14E,%.14E,"
               "%.14E,%.14E,%.14E,%d",
            nav->ion_gps[0],nav->ion_gps[1],nav->ion_gps[2],nav->ion_gps[3],
            nav->ion_gps[4],nav->ion_gps[5],nav->ion_gps[6],nav->ion_gps[7],
            nav->utc_gps[0],nav->utc_gps[1],nav->utc_gps[2],nav->utc_gps[3],
            nav->leaps);
    
    fclose(fp);
    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rdi, -0x28(%rbp)
movq %rsi, -0x30(%rbp)
movq -0x28(%rbp), %rdx
movl $0x3, %edi
leaq 0x32f28(%rip), %rsi     # 0xc7ce0
movb $0x0, %al
callq 0x8b980
movq -0x28(%rbp), %rdi
leaq 0x34ab9(%rip), %rsi     # 0xc9883
callq 0x98d0
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
jne 0x94de5
movl $0x0, -0x1c(%rbp)
jmp 0x95610
movl $0x0, -0x3c(%rbp)
cmpl $0x9b, -0x3c(%rbp)
jge 0x95288
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x3c(%rbp), %rcx
imulq $0x120, %rcx, %rcx      # imm = 0x120
addq %rcx, %rax
cmpq $0x0, 0x40(%rax)
jne 0x94e1b
jmp 0x9527a
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x3c(%rbp), %rcx
imulq $0x120, %rcx, %rcx      # imm = 0x120
addq %rcx, %rax
movl (%rax), %edi
leaq -0x60(%rbp), %rsi
callq 0x8b6b0
movq -0x38(%rbp), %rdi
leaq -0x60(%rbp), %rdx
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x3c(%rbp), %rcx
imulq $0x120, %rcx, %rcx      # imm = 0x120
addq %rcx, %rax
movl 0x4(%rax), %ecx
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x3c(%rbp), %rsi
imulq $0x120, %rsi, %rsi      # imm = 0x120
addq %rsi, %rax
movl 0x8(%rax), %r8d
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x3c(%rbp), %rsi
imulq $0x120, %rsi, %rsi      # imm = 0x120
addq %rsi, %rax
movl 0xc(%rax), %r9d
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x3c(%rbp), %rsi
imulq $0x120, %rsi, %rsi      # imm = 0x120
addq %rsi, %rax
movl 0x10(%rax), %r15d
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x3c(%rbp), %rsi
imulq $0x120, %rsi, %rsi      # imm = 0x120
addq %rsi, %rax
movq 0x20(%rax), %rax
movl %eax, %r14d
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x3c(%rbp), %rsi
imulq $0x120, %rsi, %rsi      # imm = 0x120
addq %rsi, %rax
movq 0x30(%rax), %rax
movl %eax, %ebx
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x3c(%rbp), %rsi
imulq $0x120, %rsi, %rsi      # imm = 0x120
addq %rsi, %rax
movq 0x40(%rax), %rax
movl %eax, %r11d
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x3c(%rbp), %rsi
imulq $0x120, %rsi, %rsi      # imm = 0x120
addq %rsi, %rax
movsd 0x50(%rax), %xmm0
movsd %xmm0, -0x90(%rbp)
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x3c(%rbp), %rsi
imulq $0x120, %rsi, %rsi      # imm = 0x120
addq %rsi, %rax
movsd 0x58(%rax), %xmm1
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x3c(%rbp), %rsi
imulq $0x120, %rsi, %rsi      # imm = 0x120
addq %rsi, %rax
movsd 0x60(%rax), %xmm2
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x3c(%rbp), %rsi
imulq $0x120, %rsi, %rsi      # imm = 0x120
addq %rsi, %rax
movsd 0x68(%rax), %xmm3
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x3c(%rbp), %rsi
imulq $0x120, %rsi, %rsi      # imm = 0x120
addq %rsi, %rax
movsd 0x70(%rax), %xmm4
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x3c(%rbp), %rsi
imulq $0x120, %rsi, %rsi      # imm = 0x120
addq %rsi, %rax
movsd 0x78(%rax), %xmm5
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x3c(%rbp), %rsi
imulq $0x120, %rsi, %rsi      # imm = 0x120
addq %rsi, %rax
movsd 0x80(%rax), %xmm6
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x3c(%rbp), %rsi
imulq $0x120, %rsi, %rsi      # imm = 0x120
addq %rsi, %rax
movsd 0x88(%rax), %xmm7
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x3c(%rbp), %rsi
imulq $0x120, %rsi, %rsi      # imm = 0x120
addq %rsi, %rax
movsd 0x90(%rax), %xmm8
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x3c(%rbp), %rsi
imulq $0x120, %rsi, %rsi      # imm = 0x120
addq %rsi, %rax
movsd 0x98(%rax), %xmm0
movsd %xmm0, -0x88(%rbp)
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x3c(%rbp), %rsi
imulq $0x120, %rsi, %rsi      # imm = 0x120
addq %rsi, %rax
movsd 0xa0(%rax), %xmm0
movsd %xmm0, -0x80(%rbp)
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x3c(%rbp), %rsi
imulq $0x120, %rsi, %rsi      # imm = 0x120
addq %rsi, %rax
movsd 0xa8(%rax), %xmm0
movsd %xmm0, -0x78(%rbp)
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x3c(%rbp), %rsi
imulq $0x120, %rsi, %rsi      # imm = 0x120
addq %rsi, %rax
movsd 0xb0(%rax), %xmm0
movsd %xmm0, -0x70(%rbp)
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x3c(%rbp), %rsi
imulq $0x120, %rsi, %rsi      # imm = 0x120
addq %rsi, %rax
movsd 0xb8(%rax), %xmm15
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x3c(%rbp), %rsi
imulq $0x120, %rsi, %rsi      # imm = 0x120
addq %rsi, %rax
movsd 0xc0(%rax), %xmm14
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x3c(%rbp), %rsi
imulq $0x120, %rsi, %rsi      # imm = 0x120
addq %rsi, %rax
movsd 0xc8(%rax), %xmm13
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x3c(%rbp), %rsi
imulq $0x120, %rsi, %rsi      # imm = 0x120
addq %rsi, %rax
movsd 0xd0(%rax), %xmm12
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x3c(%rbp), %rsi
imulq $0x120, %rsi, %rsi      # imm = 0x120
addq %rsi, %rax
movsd 0xd8(%rax), %xmm11
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x3c(%rbp), %rsi
imulq $0x120, %rsi, %rsi      # imm = 0x120
addq %rsi, %rax
movsd 0xe0(%rax), %xmm10
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x3c(%rbp), %rsi
imulq $0x120, %rsi, %rsi      # imm = 0x120
addq %rsi, %rax
movsd 0xe8(%rax), %xmm9
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x3c(%rbp), %rsi
imulq $0x120, %rsi, %rsi      # imm = 0x120
addq %rsi, %rax
movsd 0xf0(%rax), %xmm0
movsd %xmm0, -0x68(%rbp)
movsd -0x90(%rbp), %xmm0
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x3c(%rbp), %rsi
imulq $0x120, %rsi, %rsi      # imm = 0x120
addq %rsi, %rax
movl 0x18(%rax), %r10d
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x3c(%rbp), %rsi
imulq $0x120, %rsi, %rsi      # imm = 0x120
addq %rsi, %rax
movl 0x1c(%rax), %eax
leaq 0x32b1f(%rip), %rsi     # 0xc7cf2
movl %r15d, (%rsp)
movl %r14d, 0x8(%rsp)
movl %ebx, 0x10(%rsp)
movl %r11d, 0x18(%rsp)
movsd %xmm8, 0x20(%rsp)
movsd -0x88(%rbp), %xmm8
movsd %xmm8, 0x28(%rsp)
movsd -0x80(%rbp), %xmm8
movsd %xmm8, 0x30(%rsp)
movsd -0x78(%rbp), %xmm8
movsd %xmm8, 0x38(%rsp)
movsd -0x70(%rbp), %xmm8
movsd %xmm8, 0x40(%rsp)
movsd -0x68(%rbp), %xmm8
movsd %xmm15, 0x48(%rsp)
movsd %xmm14, 0x50(%rsp)
movsd %xmm13, 0x58(%rsp)
movsd %xmm12, 0x60(%rsp)
movsd %xmm11, 0x68(%rsp)
movsd %xmm10, 0x70(%rsp)
movsd %xmm9, 0x78(%rsp)
movsd %xmm8, 0x80(%rsp)
movl %r10d, 0x88(%rsp)
movl %eax, 0x90(%rsp)
movb $0x8, %al
callq 0x9a90
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x94dec
movl $0x0, -0x3c(%rbp)
cmpl $0x1b, -0x3c(%rbp)
jge 0x95535
movq -0x30(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x3c(%rbp), %rcx
imulq $0x98, %rcx, %rcx
addq %rcx, %rax
cmpq $0x0, 0x28(%rax)
jne 0x952bb
jmp 0x95527
movq -0x30(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x3c(%rbp), %rcx
imulq $0x98, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %edi
leaq -0x60(%rbp), %rsi
callq 0x8b6b0
movq -0x38(%rbp), %rdi
leaq -0x60(%rbp), %rdx
movq -0x30(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x3c(%rbp), %rcx
imulq $0x98, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %ecx
movq -0x30(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x3c(%rbp), %rsi
imulq $0x98, %rsi, %rsi
addq %rsi, %rax
movl 0x8(%rax), %r8d
movq -0x30(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x3c(%rbp), %rsi
imulq $0x98, %rsi, %rsi
addq %rsi, %rax
movl 0xc(%rax), %r9d
movq -0x30(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x3c(%rbp), %rsi
imulq $0x98, %rsi, %rsi
addq %rsi, %rax
movl 0x10(%rax), %ebx
movq -0x30(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x3c(%rbp), %rsi
imulq $0x98, %rsi, %rsi
addq %rsi, %rax
movl 0x14(%rax), %r11d
movq -0x30(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x3c(%rbp), %rsi
imulq $0x98, %rsi, %rsi
addq %rsi, %rax
movq 0x18(%rax), %rax
movl %eax, %r10d
movq -0x30(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x3c(%rbp), %rsi
imulq $0x98, %rsi, %rsi
addq %rsi, %rax
movq 0x28(%rax), %rax
movq -0x30(%rbp), %rsi
movq 0x48(%rsi), %rsi
movslq -0x3c(%rbp), %r14
imulq $0x98, %r14, %r14
addq %r14, %rsi
movsd 0x38(%rsi), %xmm0
movq -0x30(%rbp), %rsi
movq 0x48(%rsi), %rsi
movslq -0x3c(%rbp), %r14
imulq $0x98, %r14, %r14
addq %r14, %rsi
movsd 0x40(%rsi), %xmm1
movq -0x30(%rbp), %rsi
movq 0x48(%rsi), %rsi
movslq -0x3c(%rbp), %r14
imulq $0x98, %r14, %r14
addq %r14, %rsi
movsd 0x48(%rsi), %xmm2
movq -0x30(%rbp), %rsi
movq 0x48(%rsi), %rsi
movslq -0x3c(%rbp), %r14
imulq $0x98, %r14, %r14
addq %r14, %rsi
movsd 0x50(%rsi), %xmm3
movq -0x30(%rbp), %rsi
movq 0x48(%rsi), %rsi
movslq -0x3c(%rbp), %r14
imulq $0x98, %r14, %r14
addq %r14, %rsi
movsd 0x58(%rsi), %xmm4
movq -0x30(%rbp), %rsi
movq 0x48(%rsi), %rsi
movslq -0x3c(%rbp), %r14
imulq $0x98, %r14, %r14
addq %r14, %rsi
movsd 0x60(%rsi), %xmm5
movq -0x30(%rbp), %rsi
movq 0x48(%rsi), %rsi
movslq -0x3c(%rbp), %r14
imulq $0x98, %r14, %r14
addq %r14, %rsi
movsd 0x68(%rsi), %xmm6
movq -0x30(%rbp), %rsi
movq 0x48(%rsi), %rsi
movslq -0x3c(%rbp), %r14
imulq $0x98, %r14, %r14
addq %r14, %rsi
movsd 0x70(%rsi), %xmm7
movq -0x30(%rbp), %rsi
movq 0x48(%rsi), %rsi
movslq -0x3c(%rbp), %r14
imulq $0x98, %r14, %r14
addq %r14, %rsi
movsd 0x78(%rsi), %xmm11
movq -0x30(%rbp), %rsi
movq 0x48(%rsi), %rsi
movslq -0x3c(%rbp), %r14
imulq $0x98, %r14, %r14
addq %r14, %rsi
movsd 0x80(%rsi), %xmm10
movq -0x30(%rbp), %rsi
movq 0x48(%rsi), %rsi
movslq -0x3c(%rbp), %r14
imulq $0x98, %r14, %r14
addq %r14, %rsi
movsd 0x88(%rsi), %xmm9
movq -0x30(%rbp), %rsi
movq 0x48(%rsi), %rsi
movslq -0x3c(%rbp), %r14
imulq $0x98, %r14, %r14
addq %r14, %rsi
movsd 0x90(%rsi), %xmm8
leaq 0x3289c(%rip), %rsi     # 0xc7d8f
movl %ebx, (%rsp)
movl %r11d, 0x8(%rsp)
movl %r10d, 0x10(%rsp)
movl %eax, 0x18(%rsp)
movsd %xmm11, 0x20(%rsp)
movsd %xmm10, 0x28(%rsp)
movsd %xmm9, 0x30(%rsp)
movsd %xmm8, 0x38(%rsp)
movb $0x8, %al
callq 0x9a90
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x9528f
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rax
movsd 0x170(%rax), %xmm0
movq -0x30(%rbp), %rax
movsd 0x178(%rax), %xmm1
movq -0x30(%rbp), %rax
movsd 0x180(%rax), %xmm2
movq -0x30(%rbp), %rax
movsd 0x188(%rax), %xmm3
movq -0x30(%rbp), %rax
movsd 0x190(%rax), %xmm4
movq -0x30(%rbp), %rax
movsd 0x198(%rax), %xmm5
movq -0x30(%rbp), %rax
movsd 0x1a0(%rax), %xmm6
movq -0x30(%rbp), %rax
movsd 0x1a8(%rax), %xmm7
movq -0x30(%rbp), %rax
movsd 0x90(%rax), %xmm11
movq -0x30(%rbp), %rax
movsd 0x98(%rax), %xmm10
movq -0x30(%rbp), %rax
movsd 0xa0(%rax), %xmm9
movq -0x30(%rbp), %rax
movsd 0xa8(%rax), %xmm8
movq -0x30(%rbp), %rax
movl 0x290(%rax), %edx
leaq 0x32812(%rip), %rsi     # 0xc7df0
movsd %xmm11, (%rsp)
movsd %xmm10, 0x8(%rsp)
movsd %xmm9, 0x10(%rsp)
movsd %xmm8, 0x18(%rsp)
movb $0x8, %al
callq 0x9a90
movq -0x38(%rbp), %rdi
callq 0x9770
movl $0x1, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nopw %cs:(%rax,%rax)