#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*/ create_wait_theta(float);
int /*<<< orphan*/ create_write_byte(int);
void create_drive_arc(unsigned int speed, int radius, float angle) {
  ;
  create_write_byte(137);
  if ((radius * angle) < 0) {
    create_write_byte(((-1 * speed & 0xFFFF) >> 8));
    create_write_byte((-1 * speed & 0xFF));
  } else {
    create_write_byte(((speed & 0xFFFF) >> 8));
    create_write_byte((speed & 0xFF));
  }
  create_write_byte(((radius & 0xFFFF) >> 8));
  create_write_byte((radius & 0xFF));
  ;
  create_wait_theta(angle);
}


x86 assembly (clang, -O0):
<create_drive_arc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    $0x89,%edi
call   1040 <create_write_byte@plt>
cvtsi2ssl -0x8(%rbp),%xmm1
mulss  -0xc(%rbp),%xmm1
xorps  %xmm0,%xmm0
ucomiss %xmm1,%xmm0
jbe    117f <create_drive_arc+0x5f>
imul   $0xffffffff,-0x4(%rbp),%edi
and    $0xffff,%edi
shr    $0x8,%edi
call   1040 <create_write_byte@plt>
imul   $0xffffffff,-0x4(%rbp),%edi
and    $0xff,%edi
call   1040 <create_write_byte@plt>
jmp    119e <create_drive_arc+0x7e>
mov    -0x4(%rbp),%edi
and    $0xffff,%edi
shr    $0x8,%edi
call   1040 <create_write_byte@plt>
mov    -0x4(%rbp),%edi
and    $0xff,%edi
call   1040 <create_write_byte@plt>
mov    -0x8(%rbp),%edi
and    $0xffff,%edi
sar    $0x8,%edi
call   1040 <create_write_byte@plt>
mov    -0x8(%rbp),%edi
and    $0xff,%edi
call   1040 <create_write_byte@plt>
movss  -0xc(%rbp),%xmm0
call   1030 <create_wait_theta@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_drive_arc>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
movss  %xmm0,0xc(%rsp)
mov    %esi,%r14d
mov    %edi,%ebp
mov    $0x89,%edi
call   1040 <create_write_byte@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %r14d,%xmm0
mulss  0xc(%rsp),%xmm0
mov    %ebp,%ebx
neg    %ebx
xorps  %xmm1,%xmm1
ucomiss %xmm0,%xmm1
cmovbe %ebp,%ebx
movzbl %bh,%edi
call   1040 <create_write_byte@plt>
movzbl %bl,%edi
call   1040 <create_write_byte@plt>
mov    %r14d,%ebx
movzbl %bh,%edi
call   1040 <create_write_byte@plt>
movzbl %bl,%edi
call   1040 <create_write_byte@plt>
movss  0xc(%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <create_wait_theta@plt>

LLVM IR (-O0):
define void @create_drive_arc(i32 %0, i32 %1, float %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca float
store i32 %0, i32* %4
store i32 %1, i32* %5
store float %2, float* %6
%7 = call i32 @create_write_byte(i32 137)
%8 = load i32, i32* %5
%9 = sitofp i32 %8 to float
%10 = load float, float* %6
%11 = fmul float %9, %10
%12 = fcmp olt float %11, 0.000000e+00
br i1 %12, label %13, label %23
13: ; preds = %3
%14 = load i32, i32* %4
%15 = mul i32 -1, %14
%16 = and i32 %15, 65535
%17 = lshr i32 %16, 8
%18 = call i32 @create_write_byte(i32 %17)
%19 = load i32, i32* %4
%20 = mul i32 -1, %19
%21 = and i32 %20, 255
%22 = call i32 @create_write_byte(i32 %21)
br label %31
23: ; preds = %3
%24 = load i32, i32* %4
%25 = and i32 %24, 65535
%26 = lshr i32 %25, 8
%27 = call i32 @create_write_byte(i32 %26)
%28 = load i32, i32* %4
%29 = and i32 %28, 255
%30 = call i32 @create_write_byte(i32 %29)
br label %31
31: ; preds = %23, %13
%32 = load i32, i32* %5
%33 = and i32 %32, 65535
%34 = ashr i32 %33, 8
%35 = call i32 @create_write_byte(i32 %34)
%36 = load i32, i32* %5
%37 = and i32 %36, 255
%38 = call i32 @create_write_byte(i32 %37)
%39 = load float, float* %6
%40 = call i32 @create_wait_theta(float %39)
ret void
}

LLVM IR (-O2):
define void @create_drive_arc(i32 %0, i32 %1, float %2) {
%4 = tail call i32 @create_write_byte(i32 137)
%5 = sitofp i32 %1 to float
%6 = fmul float %5, %2
%7 = fcmp olt float %6, 0.000000e+00
%8 = sub i32 0, %0
%9 = select i1 %7, i32 %8, i32 %0
%10 = lshr i32 %9, 8
%11 = and i32 %10, 255
%12 = tail call i32 @create_write_byte(i32 %11)
%13 = and i32 %9, 255
%14 = tail call i32 @create_write_byte(i32 %13)
%15 = lshr i32 %1, 8
%16 = and i32 %15, 255
%17 = tail call i32 @create_write_byte(i32 %16)
%18 = and i32 %1, 255
%19 = tail call i32 @create_write_byte(i32 %18)
%20 = tail call i32 @create_wait_theta(float %2)
ret void
}