double sphere_h(l, m, t, f, ic)
int l, m, ic;
double t, f;
{
  double plgndr_a(), sphere_hamonics;
  sphere_hamonics = 0.0;
  if (ic == 0)
    sphere_hamonics = cos(m * f) * plgndr_a(l, m, t);
  else if (m)
    sphere_hamonics = sin(m * f) * plgndr_a(l, m, t);
  return sphere_hamonics;
}


x86 assembly (clang, -O0):
<sphere_h>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    1199 <sphere_h+0x69>
cvtsi2sdl -0x8(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0x30(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
movsd  -0x10(%rbp),%xmm0
mov    $0x1,%al
call   1030 <plgndr_a@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    11df <sphere_h+0xaf>
cmpl   $0x0,-0x8(%rbp)
je     11da <sphere_h+0xaa>
cvtsi2sdl -0x8(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x38(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
movsd  -0x10(%rbp),%xmm0
mov    $0x1,%al
call   1030 <plgndr_a@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    11df <sphere_h+0xaf>
movsd  -0x28(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sphere_h>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %esi,%ebx
mov    %edi,%ebp
test   %edx,%edx
je     115a <sphere_h+0x2a>
test   %ebx,%ebx
je     118f <sphere_h+0x5f>
movsd  %xmm0,0x8(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
mulsd  %xmm1,%xmm0
call   1040 <sin@plt>
jmp    1170 <sphere_h+0x40>
movsd  %xmm0,0x8(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
mulsd  %xmm1,%xmm0
call   1050 <cos@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
mov    %ebp,%edi
mov    %ebx,%esi
mov    $0x1,%al
call   1030 <plgndr_a@plt>
mulsd  0x10(%rsp),%xmm0
jmp    1193 <sphere_h+0x63>
xorpd  %xmm0,%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define double @sphere_h(i32 %0, i32 %1, double %2, double %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca double
%9 = alloca double
%10 = alloca i32
%11 = alloca double
store i32 %0, i32* %6
store i32 %1, i32* %7
store double %2, double* %8
store double %3, double* %9
store i32 %4, i32* %10
store double 0.000000e+00, double* %11
%12 = load i32, i32* %10
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %25
14: ; preds = %5
%15 = load i32, i32* %7
%16 = sitofp i32 %15 to double
%17 = load double, double* %9
%18 = fmul double %16, %17
%19 = call double @cos(double %18)
%20 = load i32, i32* %6
%21 = load i32, i32* %7
%22 = load double, double* %8
%23 = call double (i32, i32, double, ...) bitcast (double (...)* @plgndr_a to double (i32, i32, double, ...)*)(i32 %20, i32 %21, double %22)
%24 = fmul double %19, %23
store double %24, double* %11
br label %40
25: ; preds = %5
%26 = load i32, i32* %7
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %39
28: ; preds = %25
%29 = load i32, i32* %7
%30 = sitofp i32 %29 to double
%31 = load double, double* %9
%32 = fmul double %30, %31
%33 = call double @sin(double %32)
%34 = load i32, i32* %6
%35 = load i32, i32* %7
%36 = load double, double* %8
%37 = call double (i32, i32, double, ...) bitcast (double (...)* @plgndr_a to double (i32, i32, double, ...)*)(i32 %34, i32 %35, double %36)
%38 = fmul double %33, %37
store double %38, double* %11
br label %39
39: ; preds = %28, %25
br label %40
40: ; preds = %39, %14
%41 = load double, double* %11
ret double %41
}

LLVM IR (-O2):
define double @sphere_h(i32 %0, i32 %1, double %2, double %3, i32 %4) {
%6 = icmp eq i32 %4, 0
br i1 %6, label %7, label %11
7: ; preds = %5
%8 = sitofp i32 %1 to double
%9 = fmul double %8, %3
%10 = tail call double @cos(double %9)
br label %17
11: ; preds = %5
%12 = icmp eq i32 %1, 0
br i1 %12, label %21, label %13
13: ; preds = %11
%14 = sitofp i32 %1 to double
%15 = fmul double %14, %3
%16 = tail call double @sin(double %15)
br label %17
17: ; preds = %7, %13
%18 = phi double [ %16, %13 ], [ %10, %7 ]
%19 = tail call double (i32, i32, double, ...) bitcast (double (...)* @plgndr_a to double (i32, i32, double, ...)*)(i32 %0, i32 %1, double %2)
%20 = fmul double %18, %19
br label %21
21: ; preds = %17, %11
%22 = phi double [ 0.000000e+00, %11 ], [ %20, %17 ]
ret double %22
}