#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);
int /*<<< orphan*/ printf(char *, int, int);
void create_direct(int rspeed, int lspeed) {
  if (lspeed > 500 || lspeed < -500 || rspeed > 500 || rspeed < -500) {
    printf("Invalid Create Speed, create_direct(%d, %d)\n", rspeed, lspeed);
  };
  create_write_byte(145);
  create_write_byte(((rspeed & 0xFFFF) >> 8));
  create_write_byte((rspeed & 0xFF));
  create_write_byte(((lspeed & 0xFFFF) >> 8));
  create_write_byte((lspeed & 0xFF));
  ;
}


x86 assembly (clang, -O0):
<create_direct>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x1f4,-0x8(%rbp)
jg     1162 <create_direct+0x42>
cmpl   $0xfffffe0c,-0x8(%rbp)
jl     1162 <create_direct+0x42>
cmpl   $0x1f4,-0x4(%rbp)
jg     1162 <create_direct+0x42>
cmpl   $0xfffffe0c,-0x4(%rbp)
jge    1174 <create_direct+0x54>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
mov    $0x91,%edi
call   1040 <create_write_byte@plt>
mov    -0x4(%rbp),%edi
and    $0xffff,%edi
sar    $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>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_direct>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %edi,%ebx
lea    -0x1f5(%rbx),%eax
cmp    $0xfffffc17,%eax
jb     1144 <create_direct+0x24>
lea    -0x1f5(%r14),%eax
cmp    $0xfffffc16,%eax
ja     1155 <create_direct+0x35>
lea    0xeb5(%rip),%rdi
mov    %ebx,%esi
mov    %r14d,%edx
call   1030 <printf@plt>
mov    $0x91,%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    %r14,%rbx
movzbl %bh,%edi
call   1040 <create_write_byte@plt>
movzbl %bl,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <create_write_byte@plt>

LLVM IR (-O0):
@.str = [45 x i8] c"Invalid Create Speed, create_direct(%d, %d)\0A\00"
define void @create_direct(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp sgt i32 %5, 500
br i1 %6, label %16, label %7
7: ; preds = %2
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, -500
br i1 %9, label %16, label %10
10: ; preds = %7
%11 = load i32, i32* %3
%12 = icmp sgt i32 %11, 500
br i1 %12, label %16, label %13
13: ; preds = %10
%14 = load i32, i32* %3
%15 = icmp slt i32 %14, -500
br i1 %15, label %16, label %20
16: ; preds = %13, %10, %7, %2
%17 = load i32, i32* %3
%18 = load i32, i32* %4
%19 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %17, i32 %18)
br label %20
20: ; preds = %16, %13
%21 = call i32 @create_write_byte(i32 145)
%22 = load i32, i32* %3
%23 = and i32 %22, 65535
%24 = ashr i32 %23, 8
%25 = call i32 @create_write_byte(i32 %24)
%26 = load i32, i32* %3
%27 = and i32 %26, 255
%28 = call i32 @create_write_byte(i32 %27)
%29 = load i32, i32* %4
%30 = and i32 %29, 65535
%31 = ashr i32 %30, 8
%32 = call i32 @create_write_byte(i32 %31)
%33 = load i32, i32* %4
%34 = and i32 %33, 255
%35 = call i32 @create_write_byte(i32 %34)
ret void
}

LLVM IR (-O2):
@.str = [45 x i8] c"Invalid Create Speed, create_direct(%d, %d)\0A\00"
define void @create_direct(i32 %0, i32 %1) {
%3 = add i32 %1, -501
%4 = icmp ult i32 %3, -1001
%5 = add i32 %0, -501
%6 = icmp ult i32 %5, -1001
%7 = or i1 %6, %4
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = tail call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
br label %10
10: ; preds = %2, %8
%11 = tail call i32 @create_write_byte(i32 145)
%12 = lshr i32 %0, 8
%13 = and i32 %12, 255
%14 = tail call i32 @create_write_byte(i32 %13)
%15 = and i32 %0, 255
%16 = tail call i32 @create_write_byte(i32 %15)
%17 = lshr i32 %1, 8
%18 = and i32 %17, 255
%19 = tail call i32 @create_write_byte(i32 %18)
%20 = and i32 %1, 255
%21 = tail call i32 @create_write_byte(i32 %20)
ret void
}