#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 M_PI;
double cos(double);
double pow(double, double);
double sin(double);
double trueWindSpeed(double boatSpeed, double apparentWindSpeed,
                     double apparentWindDirection) {
  double apparentWindDirectionRadian = apparentWindDirection * (M_PI / 180);
  return pow(
      pow(apparentWindSpeed * cos(apparentWindDirectionRadian) - boatSpeed, 2) +
          (pow(apparentWindSpeed * sin(apparentWindDirectionRadian), 2)),
      0.5);
}


x86 assembly (clang, -O0):
<trueWindSpeed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    0x2e95(%rip),%rax
mov    (%rax),%eax
mov    $0xb4,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm2
movsd  -0x38(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe56(%rip),%xmm1
call   1050 <pow@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe24(%rip),%xmm1
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  0xe03(%rip),%xmm1
call   1050 <pow@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trueWindSpeed>:
sub    $0x18,%rsp
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,(%rsp)
mov    0x2ea2(%rip),%rax
movslq (%rax),%rax
imul   $0xffffffffb60b60b7,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%eax
shr    $0x1f,%eax
sar    $0x7,%ecx
add    %eax,%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
mulsd  %xmm2,%xmm0
movsd  %xmm0,0x10(%rsp)
call   1040 <cos@plt>
mulsd  0x8(%rsp),%xmm0
subsd  (%rsp),%xmm0
mulsd  %xmm0,%xmm0
movsd  %xmm0,(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <sin@plt>
mulsd  0x8(%rsp),%xmm0
mulsd  %xmm0,%xmm0
addsd  (%rsp),%xmm0
movsd  0xe54(%rip),%xmm1
add    $0x18,%rsp
jmp    1050 <pow@plt>

LLVM IR (-O0):
@M_PI = global i32 0
define double @trueWindSpeed(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%8 = load double, double* %6
%9 = load i32, i32* @M_PI
%10 = sdiv i32 %9, 180
%11 = sitofp i32 %10 to double
%12 = fmul double %8, %11
store double %12, double* %7
%13 = load double, double* %5
%14 = load double, double* %7
%15 = call double @cos(double %14)
%16 = load double, double* %4
%17 = fneg double %16
%18 = call double @llvm.fmuladd.f64(double %13, double %15, double %17)
%19 = call double @pow(double %18, double 2.000000e+00)
%20 = load double, double* %5
%21 = load double, double* %7
%22 = call double @sin(double %21)
%23 = fmul double %20, %22
%24 = call double @pow(double %23, double 2.000000e+00)
%25 = fadd double %19, %24
%26 = call double @pow(double %25, double 5.000000e-01)
ret double %26
}

LLVM IR (-O2):
@M_PI = global i32 0
define double @trueWindSpeed(double %0, double %1, double %2) {
%4 = load i32, i32* @M_PI
%5 = sdiv i32 %4, 180
%6 = sitofp i32 %5 to double
%7 = fmul double %6, %2
%8 = tail call double @cos(double %7)
%9 = fneg double %0
%10 = tail call double @llvm.fmuladd.f64(double %1, double %8, double %9)
%11 = fmul double %10, %10
%12 = tail call double @sin(double %7)
%13 = fmul double %12, %1
%14 = fmul double %13, %13
%15 = fadd double %11, %14
%16 = tail call double @pow(double %15, double 5.000000e-01)
ret double %16
}