#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 */
float cosf(float);
float sinf(float);
void deadReckoning(float *Torientation, float *Xorientation,
                   float *Yorientation, float WheelSpR, float WheelSpL) {
  float X = *Xorientation;
  float Y = *Yorientation;
  float T = (*Torientation * 2 * (3.141592653589793)) / 360;
  float SumSp = WheelSpR + WheelSpL;
  float DifSp = WheelSpR - WheelSpL;
  float radiantsAngle = T;
  if ((WheelSpR > 0 && WheelSpL > 0) || (WheelSpR < 0 && WheelSpL < 0)) {
    *Xorientation = X + (30.159f / 2) * SumSp * cosf(T);
    *Yorientation = Y + (30.159f / 2) * SumSp * sinf(T);
  } else {
    radiantsAngle = T + (30.159f / 25.1f) * DifSp;
  }
  *Torientation = ((radiantsAngle * 360) / (2 * (3.141592653589793)));
}


x86 assembly (clang, -O0):
<deadReckoning>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movss  %xmm0,-0x1c(%rbp)
movss  %xmm1,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x24(%rbp)
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movss  0xeb4(%rip),%xmm0
mulss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe94(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe80(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x1c(%rbp),%xmm0
addss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x1c(%rbp),%xmm0
subss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x2c(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0x1c(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    11d7 <deadReckoning+0xb7>
movss  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
ja     11f1 <deadReckoning+0xd1>
xorps  %xmm0,%xmm0
ucomiss -0x1c(%rbp),%xmm0
jbe    127c <deadReckoning+0x15c>
xorps  %xmm0,%xmm0
ucomiss -0x20(%rbp),%xmm0
jbe    127c <deadReckoning+0x15c>
movss  -0x24(%rbp),%xmm0
movss  %xmm0,-0x48(%rbp)
movss  0xe1d(%rip),%xmm0
mulss  -0x30(%rbp),%xmm0
movss  %xmm0,-0x44(%rbp)
movss  -0x2c(%rbp),%xmm0
call   1040 <cosf@plt>
movss  -0x48(%rbp),%xmm1
movaps %xmm0,%xmm2
movss  -0x44(%rbp),%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x28(%rbp),%xmm0
movss  %xmm0,-0x40(%rbp)
movss  0xdda(%rip),%xmm0
mulss  -0x30(%rbp),%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  -0x2c(%rbp),%xmm0
call   1030 <sinf@plt>
movss  -0x40(%rbp),%xmm1
movaps %xmm0,%xmm2
movss  -0x3c(%rbp),%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
jmp    129b <deadReckoning+0x17b>
movss  -0x2c(%rbp),%xmm1
movss  -0x34(%rbp),%xmm0
movss  0xd8e(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x38(%rbp)
movss  0xd81(%rip),%xmm0
mulss  -0x38(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd5c(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<deadReckoning>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %rdi,%r14
movss  (%rsi),%xmm4
movss  (%rdi),%xmm2
addss  %xmm2,%xmm2
cvtss2sd %xmm2,%xmm2
mulsd  0xeb6(%rip),%xmm2
divsd  0xeb6(%rip),%xmm2
cvtsd2ss %xmm2,%xmm3
movss  (%rdx),%xmm5
xorps  %xmm2,%xmm2
ucomiss %xmm2,%xmm0
jbe    1167 <deadReckoning+0x47>
ucomiss %xmm2,%xmm1
ja     1174 <deadReckoning+0x54>
ucomiss %xmm0,%xmm2
jbe    11d1 <deadReckoning+0xb1>
xorps  %xmm2,%xmm2
ucomiss %xmm1,%xmm2
jbe    11d1 <deadReckoning+0xb1>
addss  %xmm1,%xmm0
mulss  0xe9c(%rip),%xmm0
movss  %xmm0,(%rsp)
movaps %xmm3,%xmm0
movss  %xmm3,0x4(%rsp)
movss  %xmm4,0x8(%rsp)
movss  %xmm5,0xc(%rsp)
call   1040 <cosf@plt>
mulss  (%rsp),%xmm0
addss  0x8(%rsp),%xmm0
movss  %xmm0,(%rbx)
movss  0x4(%rsp),%xmm0
call   1030 <sinf@plt>
movss  0x4(%rsp),%xmm3
mulss  (%rsp),%xmm0
addss  0xc(%rsp),%xmm0
movss  %xmm0,(%r15)
jmp    11e1 <deadReckoning+0xc1>
subss  %xmm1,%xmm0
mulss  0xe3b(%rip),%xmm0
addss  %xmm0,%xmm3
mulss  0xe37(%rip),%xmm3
xorps  %xmm0,%xmm0
cvtss2sd %xmm3,%xmm0
divsd  0xe18(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,(%r14)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @deadReckoning(float* %0, float* %1, float* %2, float %3, float %4) {
%6 = alloca float*
%7 = alloca float*
%8 = alloca float*
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca float
%15 = alloca float
%16 = alloca float
store float* %0, float** %6
store float* %1, float** %7
store float* %2, float** %8
store float %3, float* %9
store float %4, float* %10
%17 = load float*, float** %7
%18 = load float, float* %17
store float %18, float* %11
%19 = load float*, float** %8
%20 = load float, float* %19
store float %20, float* %12
%21 = load float*, float** %6
%22 = load float, float* %21
%23 = fmul float %22, 2.000000e+00
%24 = fpext float %23 to double
%25 = fmul double %24, 0x400921FB54442D18
%26 = fdiv double %25, 3.600000e+02
%27 = fptrunc double %26 to float
store float %27, float* %13
%28 = load float, float* %9
%29 = load float, float* %10
%30 = fadd float %28, %29
store float %30, float* %14
%31 = load float, float* %9
%32 = load float, float* %10
%33 = fsub float %31, %32
store float %33, float* %15
%34 = load float, float* %13
store float %34, float* %16
%35 = load float, float* %9
%36 = fcmp ogt float %35, 0.000000e+00
br i1 %36, label %37, label %40
37: ; preds = %5
%38 = load float, float* %10
%39 = fcmp ogt float %38, 0.000000e+00
br i1 %39, label %46, label %40
40: ; preds = %37, %5
%41 = load float, float* %9
%42 = fcmp olt float %41, 0.000000e+00
br i1 %42, label %43, label %61
43: ; preds = %40
%44 = load float, float* %10
%45 = fcmp olt float %44, 0.000000e+00
br i1 %45, label %46, label %61
46: ; preds = %43, %37
%47 = load float, float* %11
%48 = load float, float* %14
%49 = fmul float 0x402E28B440000000, %48
%50 = load float, float* %13
%51 = call float @cosf(float %50)
%52 = call float @llvm.fmuladd.f32(float %49, float %51, float %47)
%53 = load float*, float** %7
store float %52, float* %53
%54 = load float, float* %12
%55 = load float, float* %14
%56 = fmul float 0x402E28B440000000, %55
%57 = load float, float* %13
%58 = call float @sinf(float %57)
%59 = call float @llvm.fmuladd.f32(float %56, float %58, float %54)
%60 = load float*, float** %8
store float %59, float* %60
br label %65
61: ; preds = %43, %40
%62 = load float, float* %13
%63 = load float, float* %15
%64 = call float @llvm.fmuladd.f32(float 0x3FF3399080000000, float %63, float %62)
store float %64, float* %16
br label %65
65: ; preds = %61, %46
%66 = load float, float* %16
%67 = fmul float %66, 3.600000e+02
%68 = fpext float %67 to double
%69 = fdiv double %68, 0x401921FB54442D18
%70 = fptrunc double %69 to float
%71 = load float*, float** %6
store float %70, float* %71
ret void
}

LLVM IR (-O2):
define void @deadReckoning(float* nocapture %0, float* nocapture %1, float* nocapture %2, float %3, float %4) {
%6 = load float, float* %1
%7 = load float, float* %2
%8 = load float, float* %0
%9 = fmul float %8, 2.000000e+00
%10 = fpext float %9 to double
%11 = fmul double %10, 0x400921FB54442D18
%12 = fdiv double %11, 3.600000e+02
%13 = fptrunc double %12 to float
%14 = fadd float %3, %4
%15 = fsub float %3, %4
%16 = fcmp ogt float %3, 0.000000e+00
%17 = fcmp ogt float %4, 0.000000e+00
%18 = and i1 %16, %17
br i1 %18, label %23, label %19
19: ; preds = %5
%20 = fcmp olt float %3, 0.000000e+00
%21 = fcmp olt float %4, 0.000000e+00
%22 = and i1 %20, %21
br i1 %22, label %23, label %29
23: ; preds = %19, %5
%24 = fmul float %14, 0x402E28B440000000
%25 = tail call float @cosf(float %13)
%26 = tail call float @llvm.fmuladd.f32(float %24, float %25, float %6)
store float %26, float* %1
%27 = tail call float @sinf(float %13)
%28 = tail call float @llvm.fmuladd.f32(float %24, float %27, float %7)
store float %28, float* %2
br label %31
29: ; preds = %19
%30 = tail call float @llvm.fmuladd.f32(float %15, float 0x3FF3399080000000, float %13)
br label %31
31: ; preds = %29, %23
%32 = phi float [ %13, %23 ], [ %30, %29 ]
%33 = fmul float %32, 3.600000e+02
%34 = fpext float %33 to double
%35 = fdiv double %34, 0x401921FB54442D18
%36 = fptrunc double %35 to float
store float %36, float* %0
ret void
}