// File: /workspace/github_c_makefile_star2_O2/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 $0x838, %rsp            # imm = 0x838
movq %rdx, %r14
movq %rsi, %r12
cmpw $0x1, (%rsi)
jne 0xde41a
movq %r12, %rdi
movl %ecx, %esi
movq %r8, %rdx
callq 0xb0984
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x1, %ecx
jne 0xde6a9
addq $0x92, %r12
leaq 0x700b(%rip), %rsi      # 0xe53f0
leaq 0x471d9(%rip), %rdx     # 0x1255c5
leaq 0x30(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rcx
xorl %eax, %eax
callq 0x2e014
addq $0x420, %r14            # imm = 0x420
leaq 0x6c28(%rip), %rsi      # 0xe5034
leaq 0x471ce(%rip), %rdx     # 0x1255e1
pushq $0x27
jmp 0xde55d
movq %rdi, %r15
movl %ecx, 0x14(%rsp)
movq %r8, 0x28(%rsp)
movq %r12, 0x18(%rsp)
movslq 0x10(%rdi), %rbx
movq %rbx, %r13
shlq $0x3, %r13
movq %r13, %rdi
callq 0x8490
testq %rax, %rax
je 0xde4e5
movq %rax, %r12
movq %r13, %rdi
callq 0x8490
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0xde522
movq %r14, 0x20(%rsp)
xorl %r14d, %r14d
testl %ebx, %ebx
movl $0x0, %r13d
cmovgl %ebx, %r13d
cmpq %r14, %r13
je 0xde566
cmpl $0x2, %ebx
jl 0xde4a8
movslq 0x9c(%r15), %rbp
leaq (,%rbp,8), %rdi
callq 0x8490
movq 0x8(%rsp), %rcx
movq %rax, (%rcx,%r14,8)
testq %rax, %rax
je 0xde61d
movq 0x18(%r15), %rax
cmpl $0x2, (%rax,%r14,4)
jl 0xde4e0
movq 0x20(%r15), %rax
movslq (%rax,%r14,4), %rax
movslq 0x9c(%r15), %rbp
imulq %rax, %rbp
leaq (,%rbp,8), %rdi
callq 0x8490
movq %rax, (%r12,%r14,8)
testq %rax, %rax
je 0xde65d
incq %r14
jmp 0xde474
leal (,%rbx,8), %ecx
leaq 0x6b11(%rip), %rsi      # 0xe5004
leaq 0x3e20c(%rip), %rdx     # 0x11c706
leaq 0x30(%rsp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2e014
addq $0x420, %r14            # imm = 0x420
leaq 0x6b1d(%rip), %rsi      # 0xe5034
leaq 0x470c3(%rip), %rdx     # 0x1255e1
pushq $0x2d
jmp 0xde55d
leal (,%rbx,8), %ecx
leaq 0x6ad4(%rip), %rsi      # 0xe5004
leaq 0x3e1d8(%rip), %rdx     # 0x11c70f
leaq 0x30(%rsp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2e014
addq $0x420, %r14            # imm = 0x420
leaq 0x6ae0(%rip), %rsi      # 0xe5034
leaq 0x47086(%rip), %rdx     # 0x1255e1
pushq $0x31
popq %rcx
movq %r14, %rdi
jmp 0xde69c
cvtsi2sdl 0x14(%rsp), %xmm0
movq %r15, %rdi
movq 0x28(%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r12, %rcx
callq 0xac730
cmpl $0x1, %eax
jne 0xde5ce
addq $0xea, %r15
leaq 0x6e5c(%rip), %rsi      # 0xe53f0
leaq 0x4705b(%rip), %rdx     # 0x1255f6
leaq 0x30(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x2e014
movq 0x20(%rsp), %rdi
addq $0x420, %rdi            # imm = 0x420
leaq 0x6a74(%rip), %rsi      # 0xe5034
leaq 0x4701a(%rip), %rdx     # 0x1255e1
pushq $0x48
jmp 0xde69b
xorl %ebx, %ebx
movslq 0x10(%r15), %rax
cmpq %rax, %rbx
jge 0xde604
cmpl $0x2, %eax
jl 0xde5ec
movq 0x8(%rsp), %rax
movq (%rax,%rbx,8), %rdi
callq 0x8430
movq 0x18(%r15), %rax
cmpl $0x2, (%rax,%rbx,4)
jl 0xde5ff
movq (%r12,%rbx,8), %rdi
callq 0x8430
incq %rbx
jmp 0xde5d0
movq %r12, %rdi
callq 0x8430
movq 0x8(%rsp), %rdi
callq 0x8430
xorl %eax, %eax
jmp 0xde6a9
shll $0x3, %ebp
leaq 0x69dd(%rip), %rsi      # 0xe5004
leaq 0x3e0e7(%rip), %rdx     # 0x11c715
leaq 0x30(%rsp), %rbx
movq %rbx, %rdi
movl %ebp, %ecx
xorl %eax, %eax
callq 0x2e014
movq 0x18(%rsp), %rdi
addq $0x92, %rdi
leaq 0x69e2(%rip), %rsi      # 0xe5034
leaq 0x46f88(%rip), %rdx     # 0x1255e1
pushq $0x39
jmp 0xde69b
shll $0x3, %ebp
leaq 0x699d(%rip), %rsi      # 0xe5004
leaq 0x3e0b7(%rip), %rdx     # 0x11c725
leaq 0x30(%rsp), %rbx
movq %rbx, %rdi
movl %ebp, %ecx
xorl %eax, %eax
callq 0x2e014
movq 0x18(%rsp), %rdi
addq $0x92, %rdi
leaq 0x69a2(%rip), %rsi      # 0xe5034
leaq 0x46f48(%rip), %rdx     # 0x1255e1
pushq $0x3f
popq %rcx
movq %rbx, %r8
xorl %eax, %eax
callq 0x2e014
pushq $0x1
popq %rax
addq $0x838, %rsp            # imm = 0x838
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq