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


x86 assembly (clang, -O0):
<create_spin_angle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x91,%edi
call   1040 <create_write_byte@plt>
cmpl   $0x0,-0x8(%rbp)
jge    118d <create_spin_angle+0x6d>
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>
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>
jmp    11d3 <create_spin_angle+0xb3>
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>
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>
mov    -0x8(%rbp),%edi
call   1030 <create_wait_theta@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_spin_angle>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %edi,%ebx
mov    $0x91,%edi
call   1040 <create_write_byte@plt>
test   %ebp,%ebp
js     114a <create_spin_angle+0x2a>
movzbl %bh,%edi
call   1040 <create_write_byte@plt>
movzbl %bl,%edi
call   1040 <create_write_byte@plt>
neg    %ebx
jmp    1162 <create_spin_angle+0x42>
mov    %ebx,%eax
neg    %eax
movzbl %ah,%edi
mov    %eax,%r14d
call   1040 <create_write_byte@plt>
movzbl %r14b,%edi
call   1040 <create_write_byte@plt>
movzbl %bh,%edi
call   1040 <create_write_byte@plt>
movzbl %bl,%edi
call   1040 <create_write_byte@plt>
mov    %ebp,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <create_wait_theta@plt>

LLVM IR (-O0):
define void @create_spin_angle(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 @create_write_byte(i32 145)
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %25
8: ; preds = %2
%9 = load i32, i32* %3
%10 = mul i32 -1, %9
%11 = and i32 %10, 65535
%12 = lshr i32 %11, 8
%13 = call i32 @create_write_byte(i32 %12)
%14 = load i32, i32* %3
%15 = mul i32 -1, %14
%16 = and i32 %15, 255
%17 = call i32 @create_write_byte(i32 %16)
%18 = load i32, i32* %3
%19 = and i32 %18, 65535
%20 = lshr i32 %19, 8
%21 = call i32 @create_write_byte(i32 %20)
%22 = load i32, i32* %3
%23 = and i32 %22, 255
%24 = call i32 @create_write_byte(i32 %23)
br label %42
25: ; preds = %2
%26 = load i32, i32* %3
%27 = and i32 %26, 65535
%28 = lshr i32 %27, 8
%29 = call i32 @create_write_byte(i32 %28)
%30 = load i32, i32* %3
%31 = and i32 %30, 255
%32 = call i32 @create_write_byte(i32 %31)
%33 = load i32, i32* %3
%34 = mul i32 -1, %33
%35 = and i32 %34, 65535
%36 = lshr i32 %35, 8
%37 = call i32 @create_write_byte(i32 %36)
%38 = load i32, i32* %3
%39 = mul i32 -1, %38
%40 = and i32 %39, 255
%41 = call i32 @create_write_byte(i32 %40)
br label %42
42: ; preds = %25, %8
%43 = load i32, i32* %4
%44 = call i32 @create_wait_theta(i32 %43)
ret void
}

LLVM IR (-O2):
define void @create_spin_angle(i32 %0, i32 %1) {
%3 = tail call i32 @create_write_byte(i32 145)
%4 = icmp slt i32 %1, 0
br i1 %4, label %5, label %12
5: ; preds = %2
%6 = sub i32 0, %0
%7 = lshr i32 %6, 8
%8 = and i32 %7, 255
%9 = tail call i32 @create_write_byte(i32 %8)
%10 = and i32 %6, 255
%11 = tail call i32 @create_write_byte(i32 %10)
br label %19
12: ; preds = %2
%13 = lshr i32 %0, 8
%14 = and i32 %13, 255
%15 = tail call i32 @create_write_byte(i32 %14)
%16 = and i32 %0, 255
%17 = tail call i32 @create_write_byte(i32 %16)
%18 = sub i32 0, %0
br label %19
19: ; preds = %12, %5
%20 = phi i32 [ %18, %12 ], [ %0, %5 ]
%21 = lshr i32 %20, 8
%22 = and i32 %21, 255
%23 = tail call i32 @create_write_byte(i32 %22)
%24 = and i32 %20, 255
%25 = tail call i32 @create_write_byte(i32 %24)
%26 = tail call i32 @create_wait_theta(i32 %1)
ret void
}