#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*/ HiveX_motor_setDutyCycle(int, float);
void setSpeed(int left, int right) {
  left = ((left) < (0) ? (0) : ((left) > (50) ? (50) : (left)));
  right = ((right) < (0) ? (0) : ((right) > (50) ? (50) : (right)));
  float leftNormalised = left / 255.0f;
  float rightNormalised = right / 255.0f;
  HiveX_motor_setDutyCycle(0, leftNormalised);
  HiveX_motor_setDutyCycle(1, rightNormalised);
}


x86 assembly (clang, -O0):
<setSpeed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1132 <setSpeed+0x22>
xor    %eax,%eax
mov    %eax,-0x14(%rbp)
jmp    1155 <setSpeed+0x45>
cmpl   $0x32,-0x4(%rbp)
jle    1149 <setSpeed+0x39>
mov    $0x32,%eax
mov    %eax,-0x18(%rbp)
jmp    114f <setSpeed+0x3f>
mov    -0x4(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    116f <setSpeed+0x5f>
xor    %eax,%eax
mov    %eax,-0x1c(%rbp)
jmp    1192 <setSpeed+0x82>
cmpl   $0x32,-0x8(%rbp)
jle    1186 <setSpeed+0x76>
mov    $0x32,%eax
mov    %eax,-0x20(%rbp)
jmp    118c <setSpeed+0x7c>
mov    -0x8(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x8(%rbp)
cvtsi2ssl -0x4(%rbp),%xmm0
movss  0xe5b(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
cvtsi2ssl -0x8(%rbp),%xmm0
movss  0xe45(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
xor    %edi,%edi
call   1030 <HiveX_motor_setDutyCycle@plt>
movss  -0x10(%rbp),%xmm0
mov    $0x1,%edi
call   1030 <HiveX_motor_setDutyCycle@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setSpeed>:
push   %rax
cmp    $0x32,%edi
mov    $0x32,%eax
cmovge %eax,%edi
xor    %ecx,%ecx
test   %edi,%edi
cmovs  %ecx,%edi
cmp    $0x32,%esi
cmovl  %esi,%eax
test   %eax,%eax
cvtsi2ss %edi,%xmm0
cmovs  %ecx,%eax
movss  0xec6(%rip),%xmm1
divss  %xmm1,%xmm0
cvtsi2ss %eax,%xmm2
divss  %xmm1,%xmm2
movss  %xmm2,0x4(%rsp)
xor    %edi,%edi
call   1030 <HiveX_motor_setDutyCycle@plt>
mov    $0x1,%edi
movss  0x4(%rsp),%xmm0
pop    %rax
jmp    1030 <HiveX_motor_setDutyCycle@plt>

LLVM IR (-O0):
define void @setSpeed(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca float
%6 = alloca float
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %2
br label %18
10: ; preds = %2
%11 = load i32, i32* %3
%12 = icmp sgt i32 %11, 50
br i1 %12, label %13, label %14
13: ; preds = %10
br label %16
14: ; preds = %10
%15 = load i32, i32* %3
br label %16
16: ; preds = %14, %13
%17 = phi i32 [ 50, %13 ], [ %15, %14 ]
br label %18
18: ; preds = %16, %9
%19 = phi i32 [ 0, %9 ], [ %17, %16 ]
store i32 %19, i32* %3
%20 = load i32, i32* %4
%21 = icmp slt i32 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %18
br label %31
23: ; preds = %18
%24 = load i32, i32* %4
%25 = icmp sgt i32 %24, 50
br i1 %25, label %26, label %27
26: ; preds = %23
br label %29
27: ; preds = %23
%28 = load i32, i32* %4
br label %29
29: ; preds = %27, %26
%30 = phi i32 [ 50, %26 ], [ %28, %27 ]
br label %31
31: ; preds = %29, %22
%32 = phi i32 [ 0, %22 ], [ %30, %29 ]
store i32 %32, i32* %4
%33 = load i32, i32* %3
%34 = sitofp i32 %33 to float
%35 = fdiv float %34, 2.550000e+02
store float %35, float* %5
%36 = load i32, i32* %4
%37 = sitofp i32 %36 to float
%38 = fdiv float %37, 2.550000e+02
store float %38, float* %6
%39 = load float, float* %5
%40 = call i32 @HiveX_motor_setDutyCycle(i32 0, float %39)
%41 = load float, float* %6
%42 = call i32 @HiveX_motor_setDutyCycle(i32 1, float %41)
ret void
}

LLVM IR (-O2):
define void @setSpeed(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, 50
%4 = select i1 %3, i32 %0, i32 50
%5 = icmp sgt i32 %4, 0
%6 = select i1 %5, i32 %4, i32 0
%7 = icmp slt i32 %1, 50
%8 = select i1 %7, i32 %1, i32 50
%9 = icmp sgt i32 %8, 0
%10 = select i1 %9, i32 %8, i32 0
%11 = sitofp i32 %6 to float
%12 = fdiv float %11, 2.550000e+02
%13 = sitofp i32 %10 to float
%14 = fdiv float %13, 2.550000e+02
%15 = tail call i32 @HiveX_motor_setDutyCycle(i32 0, float %12)
%16 = tail call i32 @HiveX_motor_setDutyCycle(i32 1, float %14)
ret void
}