#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 cos(double);
float fabs(float);
float helpFindMaxAbsFloat(float, float);
float helpFindMinAbsFloat(float, float);
float helpFindSign(float);
int helpRoundFloat(float);
int /*<<< orphan*/ printf(char *, int);
void drive(int angle, float powerRatio, float rotationRatio) {
  float maxPowFLBR = cos((45.0 - (float)angle) * 3.141592654 / 180.0);
  float maxPowFRBL = cos((45.0 + (float)angle) * 3.141592654 / 180.0);
  float powFL = (powerRatio * maxPowFLBR) + (rotationRatio * fabs(maxPowFLBR));
  float powBL = (powerRatio * maxPowFRBL) + (rotationRatio * fabs(maxPowFRBL));
  float powFR = (powerRatio * maxPowFRBL) - (rotationRatio * fabs(maxPowFRBL));
  float powBR = (powerRatio * maxPowFLBR) - (rotationRatio * fabs(maxPowFLBR));
  powFL = helpFindSign(powFL) * helpFindMinAbsFloat(powFL, maxPowFLBR);
  powBL = helpFindSign(powBL) * helpFindMinAbsFloat(powBL, maxPowFRBL);
  powFR = helpFindSign(powFR) * helpFindMinAbsFloat(powFR, maxPowFRBL);
  powBR = helpFindSign(powBR) * helpFindMinAbsFloat(powBR, maxPowFLBR);
  float maxRefPow = 100.0;
  float absHighestPow = helpFindMaxAbsFloat(maxPowFLBR, maxPowFRBL);
  float multiplier = maxRefPow / absHighestPow;
  float scaledPowFL = powFL * multiplier;
  float scaledPowBL = powBL * multiplier;
  float scaledPowFR = powFR * multiplier;
  float scaledPowBR = powBR * multiplier;
  printf("Scaled Power FL: %d\n", helpRoundFloat(scaledPowFL));
  printf("Scaled Power BL: %d\n", helpRoundFloat(scaledPowBL));
  printf("Scaled Power FR: %d\n", helpRoundFloat(scaledPowFR));
  printf("Scaled Power BR: %d\n", helpRoundFloat(scaledPowBR));
}


x86 assembly (clang, -O0):
<drive>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %edi,-0x4(%rbp)
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
cvtsi2ssl -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe7f(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  0xe6b(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe57(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1070 <cos@plt>
movss  %xmm0,-0x10(%rbp)
cvtsi2ssl -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe48(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  0xe34(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe20(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1070 <cos@plt>
movss  %xmm0,-0x14(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x78(%rbp)
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x7c(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x80(%rbp)
movss  -0x10(%rbp),%xmm0
call   1060 <fabs@plt>
movss  -0x80(%rbp),%xmm1
movss  -0x7c(%rbp),%xmm2
movaps %xmm0,%xmm3
movss  -0x78(%rbp),%xmm0
mulss  %xmm3,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x6c(%rbp)
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x70(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x74(%rbp)
movss  -0x14(%rbp),%xmm0
call   1060 <fabs@plt>
movss  -0x74(%rbp),%xmm1
movss  -0x70(%rbp),%xmm2
movaps %xmm0,%xmm3
movss  -0x6c(%rbp),%xmm0
mulss  %xmm3,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x60(%rbp)
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x64(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x68(%rbp)
movss  -0x14(%rbp),%xmm0
call   1060 <fabs@plt>
movss  -0x68(%rbp),%xmm1
movss  -0x64(%rbp),%xmm2
movaps %xmm0,%xmm3
movss  -0x60(%rbp),%xmm0
mulss  %xmm3,%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x54(%rbp)
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x58(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x5c(%rbp)
movss  -0x10(%rbp),%xmm0
call   1060 <fabs@plt>
movss  -0x5c(%rbp),%xmm1
movss  -0x58(%rbp),%xmm2
movaps %xmm0,%xmm3
movss  -0x54(%rbp),%xmm0
mulss  %xmm3,%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x18(%rbp),%xmm0
call   1040 <helpFindSign@plt>
movss  %xmm0,-0x50(%rbp)
movss  -0x18(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
call   1090 <helpFindMinAbsFloat@plt>
movaps %xmm0,%xmm1
movss  -0x50(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x1c(%rbp),%xmm0
call   1040 <helpFindSign@plt>
movss  %xmm0,-0x4c(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  -0x14(%rbp),%xmm1
call   1090 <helpFindMinAbsFloat@plt>
movaps %xmm0,%xmm1
movss  -0x4c(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x20(%rbp),%xmm0
call   1040 <helpFindSign@plt>
movss  %xmm0,-0x48(%rbp)
movss  -0x20(%rbp),%xmm0
movss  -0x14(%rbp),%xmm1
call   1090 <helpFindMinAbsFloat@plt>
movaps %xmm0,%xmm1
movss  -0x48(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x24(%rbp),%xmm0
call   1040 <helpFindSign@plt>
movss  %xmm0,-0x44(%rbp)
movss  -0x24(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
call   1090 <helpFindMinAbsFloat@plt>
movaps %xmm0,%xmm1
movss  -0x44(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  0xc00(%rip),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x10(%rbp),%xmm0
movss  -0x14(%rbp),%xmm1
call   1080 <helpFindMaxAbsFloat@plt>
movss  %xmm0,-0x2c(%rbp)
movss  -0x28(%rbp),%xmm0
divss  -0x2c(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x18(%rbp),%xmm0
mulss  -0x30(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x1c(%rbp),%xmm0
mulss  -0x30(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0x20(%rbp),%xmm0
mulss  -0x30(%rbp),%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  -0x24(%rbp),%xmm0
mulss  -0x30(%rbp),%xmm0
movss  %xmm0,-0x40(%rbp)
movss  -0x34(%rbp),%xmm0
call   1050 <helpRoundFloat@plt>
mov    %eax,%esi
lea    0xba9(%rip),%rdi
call   1030 <printf@plt>
movss  -0x38(%rbp),%xmm0
call   1050 <helpRoundFloat@plt>
mov    %eax,%esi
lea    0xba6(%rip),%rdi
call   1030 <printf@plt>
movss  -0x3c(%rbp),%xmm0
call   1050 <helpRoundFloat@plt>
mov    %eax,%esi
lea    0xba3(%rip),%rdi
call   1030 <printf@plt>
movss  -0x40(%rbp),%xmm0
call   1050 <helpRoundFloat@plt>
mov    %eax,%esi
lea    0xba0(%rip),%rdi
call   1030 <printf@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drive>:
sub    $0x48,%rsp
cvtsi2ss %edi,%xmm2
movss  %xmm1,0xc(%rsp)
movss  %xmm0,0x10(%rsp)
xorps  %xmm1,%xmm1
cvtss2sd %xmm2,%xmm1
movsd  %xmm1,0x30(%rsp)
movsd  0xe77(%rip),%xmm0
subsd  %xmm1,%xmm0
mulsd  0xe73(%rip),%xmm0
divsd  0xe73(%rip),%xmm0
call   1060 <cos@plt>
movapd %xmm0,0x20(%rsp)
movsd  0x30(%rsp),%xmm0
addsd  0xe4a(%rip),%xmm0
mulsd  0xe4a(%rip),%xmm0
divsd  0xe4a(%rip),%xmm0
call   1060 <cos@plt>
movapd %xmm0,0x30(%rsp)
movaps 0xe48(%rip),%xmm3
movaps 0x20(%rsp),%xmm2
movaps %xmm2,%xmm1
andps  %xmm3,%xmm1
movss  0xc(%rsp),%xmm6
mulss  %xmm6,%xmm1
movss  0x10(%rsp),%xmm5
movaps %xmm5,%xmm4
mulss  %xmm2,%xmm4
movaps %xmm4,%xmm7
addss  %xmm1,%xmm7
movss  %xmm7,0x14(%rsp)
andps  %xmm0,%xmm3
mulss  %xmm6,%xmm3
movaps %xmm5,%xmm2
mulss  %xmm0,%xmm2
movaps %xmm2,%xmm0
addss  %xmm3,%xmm0
movss  %xmm0,0xc(%rsp)
subss  %xmm3,%xmm2
movss  %xmm2,0x10(%rsp)
subss  %xmm1,%xmm4
movss  %xmm4,0x18(%rsp)
movaps %xmm7,%xmm0
call   1040 <helpFindSign@plt>
movss  %xmm0,0x1c(%rsp)
movss  0x14(%rsp),%xmm0
movaps 0x20(%rsp),%xmm1
call   1080 <helpFindMinAbsFloat@plt>
mulss  0x1c(%rsp),%xmm0
movss  %xmm0,0x1c(%rsp)
movss  0xc(%rsp),%xmm0
call   1040 <helpFindSign@plt>
movss  %xmm0,0x14(%rsp)
movss  0xc(%rsp),%xmm0
movaps 0x30(%rsp),%xmm1
call   1080 <helpFindMinAbsFloat@plt>
mulss  0x14(%rsp),%xmm0
movss  %xmm0,0xc(%rsp)
movss  0x10(%rsp),%xmm0
call   1040 <helpFindSign@plt>
movss  %xmm0,0x14(%rsp)
movss  0x10(%rsp),%xmm0
movaps 0x30(%rsp),%xmm1
call   1080 <helpFindMinAbsFloat@plt>
mulss  0x14(%rsp),%xmm0
movss  %xmm0,0x10(%rsp)
movss  0x18(%rsp),%xmm0
call   1040 <helpFindSign@plt>
movss  %xmm0,0x14(%rsp)
movss  0x18(%rsp),%xmm0
movaps 0x20(%rsp),%xmm1
call   1080 <helpFindMinAbsFloat@plt>
mulss  0x14(%rsp),%xmm0
movss  %xmm0,0x18(%rsp)
movaps 0x20(%rsp),%xmm0
movaps 0x30(%rsp),%xmm1
call   1070 <helpFindMaxAbsFloat@plt>
movss  0xd32(%rip),%xmm2
divss  %xmm0,%xmm2
movss  0x1c(%rsp),%xmm0
mulss  %xmm2,%xmm0
movss  0xc(%rsp),%xmm1
mulss  %xmm2,%xmm1
movss  %xmm1,0xc(%rsp)
movss  0x10(%rsp),%xmm1
mulss  %xmm2,%xmm1
movss  %xmm1,0x10(%rsp)
mulss  0x18(%rsp),%xmm2
movss  %xmm2,0x20(%rsp)
call   1050 <helpRoundFloat@plt>
lea    0xcf0(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
movss  0xc(%rsp),%xmm0
call   1050 <helpRoundFloat@plt>
lea    0xcec(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
movss  0x10(%rsp),%xmm0
call   1050 <helpRoundFloat@plt>
lea    0xce8(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
movss  0x20(%rsp),%xmm0
call   1050 <helpRoundFloat@plt>
lea    0xce4(%rip),%rdi
mov    %eax,%esi
add    $0x48,%rsp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"Scaled Power FL: %d\0A\00"
@.str.1 = [21 x i8] c"Scaled Power BL: %d\0A\00"
@.str.2 = [21 x i8] c"Scaled Power FR: %d\0A\00"
@.str.3 = [21 x i8] c"Scaled Power BR: %d\0A\00"
define void @drive(i32 %0, float %1, float %2) {
%4 = alloca i32
%5 = alloca float
%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
%17 = alloca float
%18 = alloca float
%19 = alloca float
store i32 %0, i32* %4
store float %1, float* %5
store float %2, float* %6
%20 = load i32, i32* %4
%21 = sitofp i32 %20 to float
%22 = fpext float %21 to double
%23 = fsub double 4.500000e+01, %22
%24 = fmul double %23, 0x400921FB54524550
%25 = fdiv double %24, 1.800000e+02
%26 = call float @cos(double %25)
store float %26, float* %7
%27 = load i32, i32* %4
%28 = sitofp i32 %27 to float
%29 = fpext float %28 to double
%30 = fadd double 4.500000e+01, %29
%31 = fmul double %30, 0x400921FB54524550
%32 = fdiv double %31, 1.800000e+02
%33 = call float @cos(double %32)
store float %33, float* %8
%34 = load float, float* %5
%35 = load float, float* %7
%36 = load float, float* %6
%37 = load float, float* %7
%38 = call float @fabs(float %37)
%39 = fmul float %36, %38
%40 = call float @llvm.fmuladd.f32(float %34, float %35, float %39)
store float %40, float* %9
%41 = load float, float* %5
%42 = load float, float* %8
%43 = load float, float* %6
%44 = load float, float* %8
%45 = call float @fabs(float %44)
%46 = fmul float %43, %45
%47 = call float @llvm.fmuladd.f32(float %41, float %42, float %46)
store float %47, float* %10
%48 = load float, float* %5
%49 = load float, float* %8
%50 = load float, float* %6
%51 = load float, float* %8
%52 = call float @fabs(float %51)
%53 = fmul float %50, %52
%54 = fneg float %53
%55 = call float @llvm.fmuladd.f32(float %48, float %49, float %54)
store float %55, float* %11
%56 = load float, float* %5
%57 = load float, float* %7
%58 = load float, float* %6
%59 = load float, float* %7
%60 = call float @fabs(float %59)
%61 = fmul float %58, %60
%62 = fneg float %61
%63 = call float @llvm.fmuladd.f32(float %56, float %57, float %62)
store float %63, float* %12
%64 = load float, float* %9
%65 = call float @helpFindSign(float %64)
%66 = load float, float* %9
%67 = load float, float* %7
%68 = call float @helpFindMinAbsFloat(float %66, float %67)
%69 = fmul float %65, %68
store float %69, float* %9
%70 = load float, float* %10
%71 = call float @helpFindSign(float %70)
%72 = load float, float* %10
%73 = load float, float* %8
%74 = call float @helpFindMinAbsFloat(float %72, float %73)
%75 = fmul float %71, %74
store float %75, float* %10
%76 = load float, float* %11
%77 = call float @helpFindSign(float %76)
%78 = load float, float* %11
%79 = load float, float* %8
%80 = call float @helpFindMinAbsFloat(float %78, float %79)
%81 = fmul float %77, %80
store float %81, float* %11
%82 = load float, float* %12
%83 = call float @helpFindSign(float %82)
%84 = load float, float* %12
%85 = load float, float* %7
%86 = call float @helpFindMinAbsFloat(float %84, float %85)
%87 = fmul float %83, %86
store float %87, float* %12
store float 1.000000e+02, float* %13
%88 = load float, float* %7
%89 = load float, float* %8
%90 = call float @helpFindMaxAbsFloat(float %88, float %89)
store float %90, float* %14
%91 = load float, float* %13
%92 = load float, float* %14
%93 = fdiv float %91, %92
store float %93, float* %15
%94 = load float, float* %9
%95 = load float, float* %15
%96 = fmul float %94, %95
store float %96, float* %16
%97 = load float, float* %10
%98 = load float, float* %15
%99 = fmul float %97, %98
store float %99, float* %17
%100 = load float, float* %11
%101 = load float, float* %15
%102 = fmul float %100, %101
store float %102, float* %18
%103 = load float, float* %12
%104 = load float, float* %15
%105 = fmul float %103, %104
store float %105, float* %19
%106 = load float, float* %16
%107 = call i32 @helpRoundFloat(float %106)
%108 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %107)
%109 = load float, float* %17
%110 = call i32 @helpRoundFloat(float %109)
%111 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %110)
%112 = load float, float* %18
%113 = call i32 @helpRoundFloat(float %112)
%114 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %113)
%115 = load float, float* %19
%116 = call i32 @helpRoundFloat(float %115)
%117 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %116)
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"Scaled Power FL: %d\0A\00"
@.str.1 = [21 x i8] c"Scaled Power BL: %d\0A\00"
@.str.2 = [21 x i8] c"Scaled Power FR: %d\0A\00"
@.str.3 = [21 x i8] c"Scaled Power BR: %d\0A\00"
define void @drive(i32 %0, float %1, float %2) {
%4 = sitofp i32 %0 to float
%5 = fpext float %4 to double
%6 = fsub double 4.500000e+01, %5
%7 = fmul double %6, 0x400921FB54524550
%8 = fdiv double %7, 1.800000e+02
%9 = tail call float @cos(double %8)
%10 = fadd double %5, 4.500000e+01
%11 = fmul double %10, 0x400921FB54524550
%12 = fdiv double %11, 1.800000e+02
%13 = tail call float @cos(double %12)
%14 = tail call float @llvm.fabs.f32(float %9)
%15 = fmul float %14, %2
%16 = tail call float @llvm.fmuladd.f32(float %1, float %9, float %15)
%17 = tail call float @llvm.fabs.f32(float %13)
%18 = fmul float %17, %2
%19 = tail call float @llvm.fmuladd.f32(float %1, float %13, float %18)
%20 = fneg float %17
%21 = fmul float %20, %2
%22 = tail call float @llvm.fmuladd.f32(float %1, float %13, float %21)
%23 = fneg float %14
%24 = fmul float %23, %2
%25 = tail call float @llvm.fmuladd.f32(float %1, float %9, float %24)
%26 = tail call float @helpFindSign(float %16)
%27 = tail call float @helpFindMinAbsFloat(float %16, float %9)
%28 = fmul float %26, %27
%29 = tail call float @helpFindSign(float %19)
%30 = tail call float @helpFindMinAbsFloat(float %19, float %13)
%31 = fmul float %29, %30
%32 = tail call float @helpFindSign(float %22)
%33 = tail call float @helpFindMinAbsFloat(float %22, float %13)
%34 = fmul float %32, %33
%35 = tail call float @helpFindSign(float %25)
%36 = tail call float @helpFindMinAbsFloat(float %25, float %9)
%37 = fmul float %35, %36
%38 = tail call float @helpFindMaxAbsFloat(float %9, float %13)
%39 = fdiv float 1.000000e+02, %38
%40 = fmul float %28, %39
%41 = fmul float %31, %39
%42 = fmul float %34, %39
%43 = fmul float %37, %39
%44 = tail call i32 @helpRoundFloat(float %40)
%45 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %44)
%46 = tail call i32 @helpRoundFloat(float %41)
%47 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %46)
%48 = tail call i32 @helpRoundFloat(float %42)
%49 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %48)
%50 = tail call i32 @helpRoundFloat(float %43)
%51 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %50)
ret void
}