// File: /workspace/github_c_makefile_star2_O2/esheldon[P]xshear/src/lensum.c
// Function: lensum_write
void lensum_write(Lensum* self, FILE* stream) {
    int nbin = self->nbin;
    int i=0;

    fprintf(stream,"%lld %.16g %lld",
            self->index, self->weight, self->totpairs);

    for (i=0; i<nbin; i++) 
        fprintf(stream," %lld", self->npair[i]);

    for (i=0; i<nbin; i++) 
        fprintf(stream," %.16g", self->rsum[i]);
    for (i=0; i<nbin; i++) 
        fprintf(stream," %.16g", self->wsum[i]);

    if(self->shear_units==UNITS_BOTH) {
        for (i=0; i<nbin; i++) 
            fprintf(stream," %.16g", self->ssum[i]);
    }

    for (i=0; i<nbin; i++) 
        fprintf(stream," %.16g", self->dsum[i]);
    for (i=0; i<nbin; i++) 
        fprintf(stream," %.16g", self->osum[i]);

    if(self->shear_units==UNITS_BOTH || self->shear_style==SHEAR_STYLE_LENSFIT) {
        for (i=0; i<nbin; i++) 
            fprintf(stream," %.16g", self->dsensum_w[i]);
        for (i=0; i<nbin; i++) 
            fprintf(stream," %.16g", self->osensum_w[i]);
    }
    
    if(self->shear_units==UNITS_BOTH) {
        for (i=0; i<nbin; i++) 
            fprintf(stream," %.16g", self->dsensum_s[i]);
        for (i=0; i<nbin; i++) 
            fprintf(stream," %.16g", self->osensum_s[i]);
    }

    fprintf(stream,"\n");

}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movl 0x28(%rdi), %r12d
movq 0x10(%rdi), %rdx
movsd 0x18(%rdi), %xmm0
movq 0x20(%rdi), %rcx
leaq 0x5292(%rip), %rsi      # 0x94ca
movq %rbx, %rdi
movb $0x1, %al
callq 0x21a0
xorl %eax, %eax
testl %r12d, %r12d
cmovlel %eax, %r12d
leaq 0x5282(%rip), %r15      # 0x94d4
xorl %r13d, %r13d
cmpq %r13, %r12
je 0x4274
movq 0x30(%r14), %rax
movq (%rax,%r13,8), %rdx
movq %rbx, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x21a0
incq %r13
jmp 0x4255
xorl %r13d, %r13d
leaq 0x525c(%rip), %r15      # 0x94da
cmpq %r13, %r12
je 0x429f
movq 0x38(%r14), %rax
movsd (%rax,%r13,8), %xmm0
movq %rbx, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x21a0
incq %r13
jmp 0x427e
xorl %r13d, %r13d
leaq 0x5231(%rip), %r15      # 0x94da
cmpq %r13, %r12
je 0x42ca
movq 0x40(%r14), %rax
movsd (%rax,%r13,8), %xmm0
movq %rbx, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x21a0
incq %r13
jmp 0x42a9
cmpl $0x3, 0x4(%r14)
jne 0x42fc
xorl %r13d, %r13d
leaq 0x51ff(%rip), %r15      # 0x94da
cmpq %r13, %r12
je 0x42fc
movq 0x48(%r14), %rax
movsd (%rax,%r13,8), %xmm0
movq %rbx, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x21a0
incq %r13
jmp 0x42db
xorl %r13d, %r13d
leaq 0x51d4(%rip), %r15      # 0x94da
cmpq %r13, %r12
je 0x4327
movq 0x50(%r14), %rax
movsd (%rax,%r13,8), %xmm0
movq %rbx, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x21a0
incq %r13
jmp 0x4306
xorl %r13d, %r13d
leaq 0x51a9(%rip), %r15      # 0x94da
cmpq %r13, %r12
je 0x4352
movq 0x58(%r14), %rax
movsd (%rax,%r13,8), %xmm0
movq %rbx, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x21a0
incq %r13
jmp 0x4331
cmpl $0x3, 0x4(%r14)
je 0x4363
cmpl $0x2, (%r14)
jne 0x4416
xorl %r13d, %r13d
leaq 0x516d(%rip), %r15      # 0x94da
cmpq %r13, %r12
je 0x438e
movq 0x60(%r14), %rax
movsd (%rax,%r13,8), %xmm0
movq %rbx, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x21a0
incq %r13
jmp 0x436d
xorl %r13d, %r13d
leaq 0x5142(%rip), %r15      # 0x94da
cmpq %r13, %r12
je 0x43b9
movq 0x68(%r14), %rax
movsd (%rax,%r13,8), %xmm0
movq %rbx, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x21a0
incq %r13
jmp 0x4398
cmpl $0x3, 0x4(%r14)
jne 0x4416
xorl %r13d, %r13d
leaq 0x5110(%rip), %r15      # 0x94da
cmpq %r13, %r12
je 0x43eb
movq 0x70(%r14), %rax
movsd (%rax,%r13,8), %xmm0
movq %rbx, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x21a0
incq %r13
jmp 0x43ca
xorl %r13d, %r13d
leaq 0x50e5(%rip), %r15      # 0x94da
cmpq %r13, %r12
je 0x4416
movq 0x78(%r14), %rax
movsd (%rax,%r13,8), %xmm0
movq %rbx, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x21a0
incq %r13
jmp 0x43f5
pushq $0xa
popq %rdi
movq %rbx, %rsi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x2150