#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ acos(int);
int cos(double);
double deg2rad(double);
double rad2deg(int /*<<< orphan*/);
int sin(double);
double surface_incidence_angle(double zenith, double azimuth180,
                               float azm_rotation, float slope) {
  double zenith_rad = deg2rad(zenith);
  double slope_rad = deg2rad(slope);
  return rad2deg(acos(cos(zenith_rad) * cos(slope_rad) +
                      sin(slope_rad) * sin(zenith_rad) *
                          cos(deg2rad(azimuth180 - azm_rotation))));
}


x86 assembly (clang, -O0):
<surface_incidence_angle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movss  %xmm2,-0x14(%rbp)
movss  %xmm3,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <deg2rad@plt>
movsd  %xmm0,-0x20(%rbp)
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
call   1040 <deg2rad@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1070 <cos@plt>
mov    %eax,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1070 <cos@plt>
mov    %eax,%ecx
mov    -0x38(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1050 <sin@plt>
mov    %eax,-0x34(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1050 <sin@plt>
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x2c(%rbp)
movsd  -0x10(%rbp),%xmm0
movss  -0x14(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
subsd  %xmm1,%xmm0
call   1040 <deg2rad@plt>
call   1070 <cos@plt>
mov    -0x30(%rbp),%edi
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
imul   %ecx,%eax
add    %eax,%edi
call   1030 <acos@plt>
mov    %eax,%edi
call   1060 <rad2deg@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<surface_incidence_angle>:
push   %rbp
push   %rbx
sub    $0x28,%rsp
movss  %xmm3,0x8(%rsp)
movss  %xmm2,0x14(%rsp)
movsd  %xmm1,0x20(%rsp)
call   1040 <deg2rad@plt>
movsd  %xmm0,0x18(%rsp)
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
call   1040 <deg2rad@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
call   1070 <cos@plt>
mov    %eax,%ebx
movsd  0x8(%rsp),%xmm0
call   1070 <cos@plt>
imul   %eax,%ebx
movsd  0x8(%rsp),%xmm0
call   1050 <sin@plt>
mov    %eax,%ebp
movsd  0x18(%rsp),%xmm0
call   1050 <sin@plt>
imul   %eax,%ebp
movss  0x14(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
movsd  0x20(%rsp),%xmm0
subsd  %xmm1,%xmm0
call   1040 <deg2rad@plt>
call   1070 <cos@plt>
imul   %eax,%ebp
add    %ebx,%ebp
mov    %ebp,%edi
call   1030 <acos@plt>
mov    %eax,%edi
add    $0x28,%rsp
pop    %rbx
pop    %rbp
jmp    1060 <rad2deg@plt>

LLVM IR (-O0):
define double @surface_incidence_angle(double %0, double %1, float %2, float %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca float
%8 = alloca float
%9 = alloca double
%10 = alloca double
store double %0, double* %5
store double %1, double* %6
store float %2, float* %7
store float %3, float* %8
%11 = load double, double* %5
%12 = call double @deg2rad(double %11)
store double %12, double* %9
%13 = load float, float* %8
%14 = fpext float %13 to double
%15 = call double @deg2rad(double %14)
store double %15, double* %10
%16 = load double, double* %9
%17 = call i32 @cos(double %16)
%18 = load double, double* %10
%19 = call i32 @cos(double %18)
%20 = mul nsw i32 %17, %19
%21 = load double, double* %10
%22 = call i32 @sin(double %21)
%23 = load double, double* %9
%24 = call i32 @sin(double %23)
%25 = mul nsw i32 %22, %24
%26 = load double, double* %6
%27 = load float, float* %7
%28 = fpext float %27 to double
%29 = fsub double %26, %28
%30 = call double @deg2rad(double %29)
%31 = call i32 @cos(double %30)
%32 = mul nsw i32 %25, %31
%33 = add nsw i32 %20, %32
%34 = call i32 @acos(i32 %33)
%35 = call double @rad2deg(i32 %34)
ret double %35
}

LLVM IR (-O2):
define double @surface_incidence_angle(double %0, double %1, float %2, float %3) {
%5 = tail call double @deg2rad(double %0)
%6 = fpext float %3 to double
%7 = tail call double @deg2rad(double %6)
%8 = tail call i32 @cos(double %5)
%9 = tail call i32 @cos(double %7)
%10 = mul nsw i32 %9, %8
%11 = tail call i32 @sin(double %7)
%12 = tail call i32 @sin(double %5)
%13 = mul nsw i32 %12, %11
%14 = fpext float %2 to double
%15 = fsub double %1, %14
%16 = tail call double @deg2rad(double %15)
%17 = tail call i32 @cos(double %16)
%18 = mul nsw i32 %13, %17
%19 = add nsw i32 %18, %10
%20 = tail call i32 @acos(i32 %19)
%21 = tail call double @rad2deg(i32 %20)
ret double %21
}