// File: /workspace/github_c_makefile_star2_O1/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 0xe9e5c
movq %r14, %rdi
movl %ecx, %esi
movq %r8, %rdx
callq 0xb9be0
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x1, %ecx
jne 0xea010
addq $0x92, %r14
leaq 0x75cf(%rip), %rsi      # 0xf13f0
leaq 0x478fd(%rip), %rdx     # 0x131725
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30c2c
addq $0x420, %r13            # imm = 0x420
leaq 0x71ec(%rip), %rsi      # 0xf1034
leaq 0x478f2(%rip), %rdx     # 0x131741
movq %r13, %rdi
movl $0x27, %ecx
jmp 0xea001
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 0xe9f81
movq %rax, %r12
movq %rbx, %rdi
callq 0x8460
movq %rax, (%rsp)
testq %rax, %rax
je 0xe9fc2
movq %r13, 0x10(%rsp)
testl %ebp, %ebp
jle 0xe9f13
xorl %r13d, %r13d
cmpl $0x1, %ebp
je 0xe9ed3
movslq 0x9c(%r15), %rbx
leaq (,%rbx,8), %rdi
callq 0x8460
movq (%rsp), %rcx
movq %rax, (%rcx,%r13,8)
testq %rax, %rax
je 0xea072
movq 0x18(%r15), %rax
cmpl $0x2, (%rax,%r13,4)
jl 0xe9f0b
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 0xea0b3
incq %r13
cmpq %r13, %rbp
jne 0xe9ea9
cvtsi2sdl 0xc(%rsp), %xmm0
movq %r15, %rdi
movq 0x18(%rsp), %rsi
movq (%rsp), %rdx
movq %r12, %rcx
callq 0xb5afc
cmpl $0x1, %eax
jne 0xea022
addq $0xea, %r15
leaq 0x74ac(%rip), %rsi      # 0xf13f0
leaq 0x4780b(%rip), %rdx     # 0x131756
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x30c2c
movq 0x10(%rsp), %rdi
addq $0x420, %rdi            # imm = 0x420
leaq 0x70c4(%rip), %rsi      # 0xf1034
leaq 0x477ca(%rip), %rdx     # 0x131741
movl $0x48, %ecx
jmp 0xea001
shll $0x3, %ebp
leaq 0x7079(%rip), %rsi      # 0xf1004
leaq 0x3e8a4(%rip), %rdx     # 0x128836
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
movl %ebp, %ecx
xorl %eax, %eax
callq 0x30c2c
addq $0x420, %r13            # imm = 0x420
leaq 0x7083(%rip), %rsi      # 0xf1034
leaq 0x47789(%rip), %rdx     # 0x131741
movq %r13, %rdi
movl $0x2d, %ecx
jmp 0xea001
shll $0x3, %ebp
leaq 0x7038(%rip), %rsi      # 0xf1004
leaq 0x3e86c(%rip), %rdx     # 0x12883f
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
movl %ebp, %ecx
xorl %eax, %eax
callq 0x30c2c
addq $0x420, %r13            # imm = 0x420
leaq 0x7042(%rip), %rsi      # 0xf1034
leaq 0x47748(%rip), %rdx     # 0x131741
movq %r13, %rdi
movl $0x31, %ecx
movq %rbx, %r8
xorl %eax, %eax
callq 0x30c2c
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 0xea05d
xorl %ebx, %ebx
cmpl $0x2, %eax
jl 0xea03e
movq (%rsp), %rax
movq (%rax,%rbx,8), %rdi
callq 0x8410
movq 0x18(%r15), %rax
cmpl $0x2, (%rax,%rbx,4)
jl 0xea051
movq (%r12,%rbx,8), %rdi
callq 0x8410
incq %rbx
movslq 0x10(%r15), %rax
cmpq %rax, %rbx
jl 0xea02c
movq %r12, %rdi
callq 0x8410
movq (%rsp), %rdi
callq 0x8410
xorl %eax, %eax
jmp 0xea010
shll $0x3, %ebx
leaq 0x6f88(%rip), %rsi      # 0xf1004
leaq 0x3e7c2(%rip), %rdx     # 0x128845
leaq 0x20(%rsp), %r15
movq %r15, %rdi
movl %ebx, %ecx
xorl %eax, %eax
callq 0x30c2c
addq $0x92, %r14
leaq 0x6f92(%rip), %rsi      # 0xf1034
leaq 0x47698(%rip), %rdx     # 0x131741
movq %r14, %rdi
movl $0x39, %ecx
jmp 0xea0f2
shll $0x3, %ebx
leaq 0x6f47(%rip), %rsi      # 0xf1004
leaq 0x3e791(%rip), %rdx     # 0x128855
leaq 0x20(%rsp), %r15
movq %r15, %rdi
movl %ebx, %ecx
xorl %eax, %eax
callq 0x30c2c
addq $0x92, %r14
leaq 0x6f51(%rip), %rsi      # 0xf1034
leaq 0x47657(%rip), %rdx     # 0x131741
movq %r14, %rdi
movl $0x3f, %ecx
movq %r15, %r8
jmp 0xea004