#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_write_byte(int);
void create_spin(int omega) {
  create_write_byte(137);
  create_write_byte(((omega & 0xFFFF) >> 8));
  create_write_byte((omega & 0xFF));
  if (omega < 0) {
    create_write_byte(255);
    create_write_byte(255);
  }
  if (omega > 0) {
    create_write_byte(0);
    create_write_byte(1);
  }
}


x86 assembly (clang, -O0):
<create_spin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x89,%edi
call   1030 <create_write_byte@plt>
mov    -0x4(%rbp),%edi
and    $0xffff,%edi
sar    $0x8,%edi
call   1030 <create_write_byte@plt>
mov    -0x4(%rbp),%edi
and    $0xff,%edi
call   1030 <create_write_byte@plt>
cmpl   $0x0,-0x4(%rbp)
jge    1162 <create_spin+0x52>
mov    $0xff,%edi
call   1030 <create_write_byte@plt>
mov    $0xff,%edi
call   1030 <create_write_byte@plt>
cmpl   $0x0,-0x4(%rbp)
jle    117d <create_spin+0x6d>
xor    %edi,%edi
call   1030 <create_write_byte@plt>
mov    $0x1,%edi
call   1030 <create_write_byte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_spin>:
push   %rbx
mov    %edi,%ebx
mov    $0x89,%edi
call   1030 <create_write_byte@plt>
movzbl %bh,%edi
call   1030 <create_write_byte@plt>
movzbl %bl,%edi
call   1030 <create_write_byte@plt>
test   %ebx,%ebx
js     113c <create_spin+0x2c>
je     1153 <create_spin+0x43>
mov    $0x1,%ebx
xor    %edi,%edi
jmp    1146 <create_spin+0x36>
mov    $0xff,%edi
mov    $0xff,%ebx
call   1030 <create_write_byte@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1030 <create_write_byte@plt>
pop    %rbx
ret

LLVM IR (-O0):
define void @create_spin(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @create_write_byte(i32 137)
%4 = load i32, i32* %2
%5 = and i32 %4, 65535
%6 = ashr i32 %5, 8
%7 = call i32 @create_write_byte(i32 %6)
%8 = load i32, i32* %2
%9 = and i32 %8, 255
%10 = call i32 @create_write_byte(i32 %9)
%11 = load i32, i32* %2
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %1
%14 = call i32 @create_write_byte(i32 255)
%15 = call i32 @create_write_byte(i32 255)
br label %16
16: ; preds = %13, %1
%17 = load i32, i32* %2
%18 = icmp sgt i32 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = call i32 @create_write_byte(i32 0)
%21 = call i32 @create_write_byte(i32 1)
br label %22
22: ; preds = %19, %16
ret void
}

LLVM IR (-O2):
define void @create_spin(i32 %0) {
%2 = tail call i32 @create_write_byte(i32 137)
%3 = lshr i32 %0, 8
%4 = and i32 %3, 255
%5 = tail call i32 @create_write_byte(i32 %4)
%6 = and i32 %0, 255
%7 = tail call i32 @create_write_byte(i32 %6)
%8 = icmp slt i32 %0, 0
br i1 %8, label %11, label %9
9: ; preds = %1
%10 = icmp eq i32 %0, 0
br i1 %10, label %16, label %11
11: ; preds = %9, %1
%12 = phi i32 [ 255, %1 ], [ 0, %9 ]
%13 = phi i32 [ 255, %1 ], [ 1, %9 ]
%14 = tail call i32 @create_write_byte(i32 %12)
%15 = tail call i32 @create_write_byte(i32 %13)
br label %16
16: ; preds = %11, %9
ret void
}