// File: /workspace/github_c_makefile_star2_O1/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq 0x28(%rdi), %r12
movq 0x10(%rdi), %rdx
movsd 0x18(%rdi), %xmm0
movq 0x20(%rdi), %rcx
leaq 0x4003(%rip), %rsi      # 0x94ca
movq %rbx, %rdi
movb $0x1, %al
callq 0x21a0
testl %r12d, %r12d
jle 0x5506
movl %r12d, %r13d
andl $0x7fffffff, %r13d      # imm = 0x7FFFFFFF
leaq 0x3fed(%rip), %r15      # 0x94d4
xorl %ebp, %ebp
movq 0x30(%r14), %rax
movq (%rax,%rbp,8), %rdx
movq %rbx, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x21a0
incq %rbp
cmpq %rbp, %r13
jne 0x54e9
testl %r12d, %r12d
jle 0x553c
movl %r12d, %r13d
andl $0x7fffffff, %r13d      # imm = 0x7FFFFFFF
xorl %ebp, %ebp
leaq 0x3fbc(%rip), %r15      # 0x94da
movq 0x38(%r14), %rax
movsd (%rax,%rbp,8), %xmm0
movq %rbx, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x21a0
incq %rbp
cmpq %rbp, %r13
jne 0x551e
testl %r12d, %r12d
jle 0x5572
movl %r12d, %r13d
andl $0x7fffffff, %r13d      # imm = 0x7FFFFFFF
xorl %ebp, %ebp
leaq 0x3f86(%rip), %r15      # 0x94da
movq 0x40(%r14), %rax
movsd (%rax,%rbp,8), %xmm0
movq %rbx, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x21a0
incq %rbp
cmpq %rbp, %r13
jne 0x5554
cmpl $0x3, 0x4(%r14)
sete %al
testl %r12d, %r12d
setg %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x55b8
movl %r12d, %r13d
andl $0x7fffffff, %r13d      # imm = 0x7FFFFFFF
xorl %ebp, %ebp
leaq 0x3f40(%rip), %r15      # 0x94da
movq 0x48(%r14), %rax
movsd (%rax,%rbp,8), %xmm0
movq %rbx, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x21a0
incq %rbp
cmpq %rbp, %r13
jne 0x559a
testl %r12d, %r12d
jle 0x55ee
movl %r12d, %r13d
andl $0x7fffffff, %r13d      # imm = 0x7FFFFFFF
xorl %ebp, %ebp
leaq 0x3f0a(%rip), %r15      # 0x94da
movq 0x50(%r14), %rax
movsd (%rax,%rbp,8), %xmm0
movq %rbx, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x21a0
incq %rbp
cmpq %rbp, %r13
jne 0x55d0
testl %r12d, %r12d
jle 0x5624
movl %r12d, %r13d
andl $0x7fffffff, %r13d      # imm = 0x7FFFFFFF
xorl %ebp, %ebp
leaq 0x3ed4(%rip), %r15      # 0x94da
movq 0x58(%r14), %rax
movsd (%rax,%rbp,8), %xmm0
movq %rbx, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x21a0
incq %rbp
cmpq %rbp, %r13
jne 0x5606
cmpl $0x3, 0x4(%r14)
je 0x5631
cmpl $0x2, (%r14)
jne 0x569d
testl %r12d, %r12d
jle 0x5667
movl %r12d, %r13d
andl $0x7fffffff, %r13d      # imm = 0x7FFFFFFF
xorl %ebp, %ebp
leaq 0x3e91(%rip), %r15      # 0x94da
movq 0x60(%r14), %rax
movsd (%rax,%rbp,8), %xmm0
movq %rbx, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x21a0
incq %rbp
cmpq %rbp, %r13
jne 0x5649
testl %r12d, %r12d
jle 0x569d
movl %r12d, %r13d
andl $0x7fffffff, %r13d      # imm = 0x7FFFFFFF
xorl %ebp, %ebp
leaq 0x3e5b(%rip), %r15      # 0x94da
movq 0x68(%r14), %rax
movsd (%rax,%rbp,8), %xmm0
movq %rbx, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x21a0
incq %rbp
cmpq %rbp, %r13
jne 0x567f
cmpl $0x3, 0x4(%r14)
jne 0x570f
testl %r12d, %r12d
jle 0x56da
movl %r12d, %r13d
andl $0x7fffffff, %r13d      # imm = 0x7FFFFFFF
xorl %ebp, %ebp
leaq 0x3e1e(%rip), %r15      # 0x94da
movq 0x70(%r14), %rax
movsd (%rax,%rbp,8), %xmm0
movq %rbx, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x21a0
incq %rbp
cmpq %rbp, %r13
jne 0x56bc
testl %r12d, %r12d
jle 0x570f
andl $0x7fffffff, %r12d      # imm = 0x7FFFFFFF
xorl %r13d, %r13d
leaq 0x3dea(%rip), %r15      # 0x94da
movq 0x78(%r14), %rax
movsd (%rax,%r13,8), %xmm0
movq %rbx, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x21a0
incq %r13
cmpq %r13, %r12
jne 0x56f0
movl $0xa, %edi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2150