#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 */
double cos(double);
double sin(double);
void calc_XY_from_deg_val(int deg, int val, int *x, int *y) {
  double ddeg;
  ddeg = ((double)deg) * 3.14159265 / 1800.0;
  *x = (int)(cos(ddeg) * (double)val);
  *y = (int)(sin(ddeg) * (double)val);
}


x86 assembly (clang, -O0):
<calc_XY_from_deg_val>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xec5(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xeb1(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1040 <cos@plt>
cvtsi2sdl -0x8(%rbp),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movsd  -0x20(%rbp),%xmm0
call   1030 <sin@plt>
cvtsi2sdl -0x8(%rbp),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_XY_from_deg_val>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %esi,%ebp
cvtsi2sd %edi,%xmm0
mulsd  0xec4(%rip),%xmm0
divsd  0xec4(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
call   1040 <cos@plt>
cvtsi2sd %ebp,%xmm1
movsd  %xmm1,(%rsp)
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,(%rbx)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
mulsd  (%rsp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,(%r14)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @calc_XY_from_deg_val(i32 %0, i32 %1, i32* %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca double
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%10 = load i32, i32* %5
%11 = sitofp i32 %10 to double
%12 = fmul double %11, 0x400921FB53C8D4F1
%13 = fdiv double %12, 1.800000e+03
store double %13, double* %9
%14 = load double, double* %9
%15 = call double @cos(double %14)
%16 = load i32, i32* %6
%17 = sitofp i32 %16 to double
%18 = fmul double %15, %17
%19 = fptosi double %18 to i32
%20 = load i32*, i32** %7
store i32 %19, i32* %20
%21 = load double, double* %9
%22 = call double @sin(double %21)
%23 = load i32, i32* %6
%24 = sitofp i32 %23 to double
%25 = fmul double %22, %24
%26 = fptosi double %25 to i32
%27 = load i32*, i32** %8
store i32 %26, i32* %27
ret void
}

LLVM IR (-O2):
define void @calc_XY_from_deg_val(i32 %0, i32 %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3) {
%5 = sitofp i32 %0 to double
%6 = fmul double %5, 0x400921FB53C8D4F1
%7 = fdiv double %6, 1.800000e+03
%8 = tail call double @cos(double %7)
%9 = sitofp i32 %1 to double
%10 = fmul double %8, %9
%11 = fptosi double %10 to i32
store i32 %11, i32* %2
%12 = tail call double @sin(double %7)
%13 = fmul double %12, %9
%14 = fptosi double %13 to i32
store i32 %14, i32* %3
ret void
}