// File: /workspace/github_c_makefile_star2_O3/PoulinV[P]AxiCLASS/build/../source/output.c
// Function: output_total_cl_at_l
int output_total_cl_at_l(
                         struct harmonic * phr,
                         struct lensing * ple,
                         struct output * pop,
                         int l,
                         double * cl
                         ){

  double ** cl_md_ic; /* array with argument
                         cl_md_ic[index_md][index_ic1_ic2*phr->ct_size+index_ct] */

  double ** cl_md;    /* array with argument
                         cl_md[index_md][index_ct] */

  int index_md;

  if (ple->has_lensed_cls == _TRUE_) {
    class_call(lensing_cl_at_l(ple,
                               l,
                               cl),
               ple->error_message,
               pop->error_message);
  }
  else {

    class_alloc(cl_md_ic,
                phr->md_size*sizeof(double *),
                pop->error_message);

    class_alloc(cl_md,
                phr->md_size*sizeof(double *),
                pop->error_message);

    for (index_md = 0; index_md < phr->md_size; index_md++) {

      if (phr->md_size > 1)

        class_alloc(cl_md[index_md],
                    phr->ct_size*sizeof(double),
                    ple->error_message);

      if (phr->ic_size[index_md] > 1)

        class_alloc(cl_md_ic[index_md],
                    phr->ic_ic_size[index_md]*phr->ct_size*sizeof(double),
                    ple->error_message);
    }

    class_call(harmonic_cl_at_l(phr,
                                (double)l,
                                cl,
                                cl_md,
                                cl_md_ic),
               phr->error_message,
               pop->error_message);

    for (index_md = 0; index_md < phr->md_size; index_md++) {

      if (phr->md_size > 1)
        free(cl_md[index_md]);

      if (phr->ic_size[index_md] > 1)
        free(cl_md_ic[index_md]);

    }

    free(cl_md_ic);
    free(cl_md);

  }

  return _SUCCESS_;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x828, %rsp            # imm = 0x828
movq %rdx, %r13
movq %rsi, %r14
cmpw $0x1, (%rsi)
jne 0xe6a38
movq %r14, %rdi
movl %ecx, %esi
movq %r8, %rdx
callq 0xb6850
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x1, %ecx
jne 0xe6bec
addq $0x92, %r14
leaq 0x79f3(%rip), %rsi      # 0xee3f0
leaq 0x47d51(%rip), %rdx     # 0x12e755
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30af0
addq $0x420, %r13            # imm = 0x420
leaq 0x7610(%rip), %rsi      # 0xee034
leaq 0x47d46(%rip), %rdx     # 0x12e771
movq %r13, %rdi
movl $0x27, %ecx
jmp 0xe6bdd
movq %rdi, %r15
movl %ecx, 0xc(%rsp)
movq %r8, 0x18(%rsp)
movslq 0x10(%rdi), %rbp
leaq (,%rbp,8), %rbx
movq %rbx, %rdi
callq 0x8460
testq %rax, %rax
je 0xe6b5d
movq %rax, %r12
movq %rbx, %rdi
callq 0x8460
movq %rax, (%rsp)
testq %rax, %rax
je 0xe6b9e
movq %r13, 0x10(%rsp)
testl %ebp, %ebp
jle 0xe6aef
xorl %r13d, %r13d
cmpl $0x1, %ebp
je 0xe6aaf
movslq 0x9c(%r15), %rbx
leaq (,%rbx,8), %rdi
callq 0x8460
movq (%rsp), %rcx
movq %rax, (%rcx,%r13,8)
testq %rax, %rax
je 0xe6c4e
movq 0x18(%r15), %rax
cmpl $0x2, (%rax,%r13,4)
jl 0xe6ae7
movq 0x20(%r15), %rax
movslq (%rax,%r13,4), %rax
movslq 0x9c(%r15), %rbx
imulq %rax, %rbx
leaq (,%rbx,8), %rdi
callq 0x8460
movq %rax, (%r12,%r13,8)
testq %rax, %rax
je 0xe6c8f
incq %r13
cmpq %r13, %rbp
jne 0xe6a85
cvtsi2sdl 0xc(%rsp), %xmm0
movq %r15, %rdi
movq 0x18(%rsp), %rsi
movq (%rsp), %rdx
movq %r12, %rcx
callq 0xb2958
cmpl $0x1, %eax
jne 0xe6bfe
addq $0xea, %r15
leaq 0x78d0(%rip), %rsi      # 0xee3f0
leaq 0x47c5f(%rip), %rdx     # 0x12e786
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x30af0
movq 0x10(%rsp), %rdi
addq $0x420, %rdi            # imm = 0x420
leaq 0x74e8(%rip), %rsi      # 0xee034
leaq 0x47c1e(%rip), %rdx     # 0x12e771
movl $0x48, %ecx
jmp 0xe6bdd
shll $0x3, %ebp
leaq 0x749d(%rip), %rsi      # 0xee004
leaq 0x3ecf8(%rip), %rdx     # 0x125866
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
movl %ebp, %ecx
xorl %eax, %eax
callq 0x30af0
addq $0x420, %r13            # imm = 0x420
leaq 0x74a7(%rip), %rsi      # 0xee034
leaq 0x47bdd(%rip), %rdx     # 0x12e771
movq %r13, %rdi
movl $0x2d, %ecx
jmp 0xe6bdd
shll $0x3, %ebp
leaq 0x745c(%rip), %rsi      # 0xee004
leaq 0x3ecc0(%rip), %rdx     # 0x12586f
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
movl %ebp, %ecx
xorl %eax, %eax
callq 0x30af0
addq $0x420, %r13            # imm = 0x420
leaq 0x7466(%rip), %rsi      # 0xee034
leaq 0x47b9c(%rip), %rdx     # 0x12e771
movq %r13, %rdi
movl $0x31, %ecx
movq %rbx, %r8
xorl %eax, %eax
callq 0x30af0
movl $0x1, %eax
addq $0x828, %rsp            # imm = 0x828
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0x10(%r15), %eax
testl %eax, %eax
jle 0xe6c39
xorl %ebx, %ebx
cmpl $0x2, %eax
jl 0xe6c1a
movq (%rsp), %rax
movq (%rax,%rbx,8), %rdi
callq 0x8410
movq 0x18(%r15), %rax
cmpl $0x2, (%rax,%rbx,4)
jl 0xe6c2d
movq (%r12,%rbx,8), %rdi
callq 0x8410
incq %rbx
movslq 0x10(%r15), %rax
cmpq %rax, %rbx
jl 0xe6c08
movq %r12, %rdi
callq 0x8410
movq (%rsp), %rdi
callq 0x8410
xorl %eax, %eax
jmp 0xe6bec
shll $0x3, %ebx
leaq 0x73ac(%rip), %rsi      # 0xee004
leaq 0x3ec16(%rip), %rdx     # 0x125875
leaq 0x20(%rsp), %r15
movq %r15, %rdi
movl %ebx, %ecx
xorl %eax, %eax
callq 0x30af0
addq $0x92, %r14
leaq 0x73b6(%rip), %rsi      # 0xee034
leaq 0x47aec(%rip), %rdx     # 0x12e771
movq %r14, %rdi
movl $0x39, %ecx
jmp 0xe6cce
shll $0x3, %ebx
leaq 0x736b(%rip), %rsi      # 0xee004
leaq 0x3ebe5(%rip), %rdx     # 0x125885
leaq 0x20(%rsp), %r15
movq %r15, %rdi
movl %ebx, %ecx
xorl %eax, %eax
callq 0x30af0
addq $0x92, %r14
leaq 0x7375(%rip), %rsi      # 0xee034
leaq 0x47aab(%rip), %rdx     # 0x12e771
movq %r14, %rdi
movl $0x3f, %ecx
movq %r15, %r8
jmp 0xe6be0