// File: /workspace/github_c_makefile_star2_O0/esheldon[P]xshear/src/lensum.c
// Function: lensum_new
Lensum* lensum_new(size_t nbin, int shear_style, int scstyle, int shear_units) {
    Lensum* lensum=calloc(1,sizeof(Lensum));
    if (lensum == NULL) {
        wlog("failed to allocate lensum\n");
        exit(EXIT_FAILURE);
    }

    lensum->shear_style=shear_style;
    lensum->scstyle=scstyle;
    lensum->shear_units=shear_units;

    lensum->nbin = nbin;

    lensum->npair = calloc(nbin, sizeof(int64));
    lensum->rsum  = calloc(nbin, sizeof(double));
    lensum->wsum  = calloc(nbin, sizeof(double));
    lensum->ssum  = calloc(nbin, sizeof(double));
    lensum->dsum  = calloc(nbin, sizeof(double));
    lensum->osum  = calloc(nbin, sizeof(double));

    lensum->dsensum_w  = calloc(nbin, sizeof(double));
    lensum->osensum_w  = calloc(nbin, sizeof(double));
    lensum->dsensum_s  = calloc(nbin, sizeof(double));
    lensum->osensum_s  = calloc(nbin, sizeof(double));


    if (lensum->npair==NULL
            || lensum->wsum==NULL
            || lensum->ssum==NULL
            || lensum->dsum==NULL
            || lensum->osum==NULL
            || lensum->rsum==NULL
            || lensum->dsensum_w==NULL
            || lensum->osensum_w==NULL
            || lensum->dsensum_s==NULL
            || lensum->osensum_s==NULL
            ) {

        wlog("failed to allocate lensum\n");
        exit(EXIT_FAILURE);
    }

    return lensum;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movl $0x1, %edi
movl $0x80, %esi
callq 0x2140
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x5c01
movq 0xc412(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
leaq 0x889a(%rip), %rsi      # 0xe48a
movb $0x0, %al
callq 0x2170
movl $0x1, %edi
callq 0x2250
movl -0xc(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movl -0x10(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x8(%rax)
movl -0x14(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x8(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x8(%rbp), %rdi
movl $0x8, %esi
callq 0x2140
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x8(%rbp), %rdi
movl $0x8, %esi
callq 0x2140
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x8(%rbp), %rdi
movl $0x8, %esi
callq 0x2140
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x8(%rbp), %rdi
movl $0x8, %esi
callq 0x2140
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x8(%rbp), %rdi
movl $0x8, %esi
callq 0x2140
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x8(%rbp), %rdi
movl $0x8, %esi
callq 0x2140
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x58(%rax)
movq -0x8(%rbp), %rdi
movl $0x8, %esi
callq 0x2140
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x60(%rax)
movq -0x8(%rbp), %rdi
movl $0x8, %esi
callq 0x2140
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x68(%rax)
movq -0x8(%rbp), %rdi
movl $0x8, %esi
callq 0x2140
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x70(%rax)
movq -0x8(%rbp), %rdi
movl $0x8, %esi
callq 0x2140
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x78(%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0x5d92
movq -0x20(%rbp), %rax
cmpq $0x0, 0x40(%rax)
je 0x5d92
movq -0x20(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x5d92
movq -0x20(%rbp), %rax
cmpq $0x0, 0x50(%rax)
je 0x5d92
movq -0x20(%rbp), %rax
cmpq $0x0, 0x58(%rax)
je 0x5d92
movq -0x20(%rbp), %rax
cmpq $0x0, 0x38(%rax)
je 0x5d92
movq -0x20(%rbp), %rax
cmpq $0x0, 0x60(%rax)
je 0x5d92
movq -0x20(%rbp), %rax
cmpq $0x0, 0x68(%rax)
je 0x5d92
movq -0x20(%rbp), %rax
cmpq $0x0, 0x70(%rax)
je 0x5d92
movq -0x20(%rbp), %rax
cmpq $0x0, 0x78(%rax)
jne 0x5db4
movq 0xc25f(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
leaq 0x86e7(%rip), %rsi      # 0xe48a
movb $0x0, %al
callq 0x2170
movl $0x1, %edi
callq 0x2250
movq -0x20(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nop