#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*/ HIGH_BYTE(unsigned int);
int /*<<< orphan*/ LOW_BYTE(unsigned int);
int /*<<< orphan*/ send_ctrl_cmd(int);
int /*<<< orphan*/ send_data_cmd(int /*<<< orphan*/);
void lcm_update(unsigned int x, unsigned int y, unsigned int width,
                unsigned int height) {
  unsigned int x0 = x;
  unsigned int y0 = y;
  unsigned int x1 = x0 + width - 1;
  unsigned int y1 = y0 + height - 1;
  send_ctrl_cmd(0x2A);
  send_data_cmd(HIGH_BYTE(x0));
  send_data_cmd(LOW_BYTE(x0));
  send_data_cmd(HIGH_BYTE(x1));
  send_data_cmd(LOW_BYTE(x1));
  send_ctrl_cmd(0x2B);
  send_data_cmd(HIGH_BYTE(y0));
  send_data_cmd(LOW_BYTE(y0));
  send_data_cmd(HIGH_BYTE(y1));
  send_data_cmd(LOW_BYTE(y1));
  send_ctrl_cmd(0x2C);
}


x86 assembly (clang, -O0):
<lcm_update>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
add    -0x10(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    $0x2a,%edi
call   1060 <send_ctrl_cmd@plt>
mov    -0x14(%rbp),%edi
call   1050 <HIGH_BYTE@plt>
mov    %eax,%edi
call   1030 <send_data_cmd@plt>
mov    -0x14(%rbp),%edi
call   1040 <LOW_BYTE@plt>
mov    %eax,%edi
call   1030 <send_data_cmd@plt>
mov    -0x1c(%rbp),%edi
call   1050 <HIGH_BYTE@plt>
mov    %eax,%edi
call   1030 <send_data_cmd@plt>
mov    -0x1c(%rbp),%edi
call   1040 <LOW_BYTE@plt>
mov    %eax,%edi
call   1030 <send_data_cmd@plt>
mov    $0x2b,%edi
call   1060 <send_ctrl_cmd@plt>
mov    -0x18(%rbp),%edi
call   1050 <HIGH_BYTE@plt>
mov    %eax,%edi
call   1030 <send_data_cmd@plt>
mov    -0x18(%rbp),%edi
call   1040 <LOW_BYTE@plt>
mov    %eax,%edi
call   1030 <send_data_cmd@plt>
mov    -0x20(%rbp),%edi
call   1050 <HIGH_BYTE@plt>
mov    %eax,%edi
call   1030 <send_data_cmd@plt>
mov    -0x20(%rbp),%edi
call   1040 <LOW_BYTE@plt>
mov    %eax,%edi
call   1030 <send_data_cmd@plt>
mov    $0x2c,%edi
call   1060 <send_ctrl_cmd@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcm_update>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%r15d
mov    %edi,%ebx
lea    (%rbx,%rdx,1),%ebp
add    $0xffffffff,%ebp
lea    (%r15,%rcx,1),%r14d
add    $0xffffffff,%r14d
mov    $0x2a,%edi
call   1060 <send_ctrl_cmd@plt>
mov    %ebx,%edi
call   1050 <HIGH_BYTE@plt>
mov    %eax,%edi
call   1030 <send_data_cmd@plt>
mov    %ebx,%edi
call   1040 <LOW_BYTE@plt>
mov    %eax,%edi
call   1030 <send_data_cmd@plt>
mov    %ebp,%edi
call   1050 <HIGH_BYTE@plt>
mov    %eax,%edi
call   1030 <send_data_cmd@plt>
mov    %ebp,%edi
call   1040 <LOW_BYTE@plt>
mov    %eax,%edi
call   1030 <send_data_cmd@plt>
mov    $0x2b,%edi
call   1060 <send_ctrl_cmd@plt>
mov    %r15d,%edi
call   1050 <HIGH_BYTE@plt>
mov    %eax,%edi
call   1030 <send_data_cmd@plt>
mov    %r15d,%edi
call   1040 <LOW_BYTE@plt>
mov    %eax,%edi
call   1030 <send_data_cmd@plt>
mov    %r14d,%edi
call   1050 <HIGH_BYTE@plt>
mov    %eax,%edi
call   1030 <send_data_cmd@plt>
mov    %r14d,%edi
call   1040 <LOW_BYTE@plt>
mov    %eax,%edi
call   1030 <send_data_cmd@plt>
mov    $0x2c,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <send_ctrl_cmd@plt>

LLVM IR (-O0):
define void @lcm_update(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%13 = load i32, i32* %5
store i32 %13, i32* %9
%14 = load i32, i32* %6
store i32 %14, i32* %10
%15 = load i32, i32* %9
%16 = load i32, i32* %7
%17 = add i32 %15, %16
%18 = sub i32 %17, 1
store i32 %18, i32* %11
%19 = load i32, i32* %10
%20 = load i32, i32* %8
%21 = add i32 %19, %20
%22 = sub i32 %21, 1
store i32 %22, i32* %12
%23 = call i32 @send_ctrl_cmd(i32 42)
%24 = load i32, i32* %9
%25 = call i32 @HIGH_BYTE(i32 %24)
%26 = call i32 @send_data_cmd(i32 %25)
%27 = load i32, i32* %9
%28 = call i32 @LOW_BYTE(i32 %27)
%29 = call i32 @send_data_cmd(i32 %28)
%30 = load i32, i32* %11
%31 = call i32 @HIGH_BYTE(i32 %30)
%32 = call i32 @send_data_cmd(i32 %31)
%33 = load i32, i32* %11
%34 = call i32 @LOW_BYTE(i32 %33)
%35 = call i32 @send_data_cmd(i32 %34)
%36 = call i32 @send_ctrl_cmd(i32 43)
%37 = load i32, i32* %10
%38 = call i32 @HIGH_BYTE(i32 %37)
%39 = call i32 @send_data_cmd(i32 %38)
%40 = load i32, i32* %10
%41 = call i32 @LOW_BYTE(i32 %40)
%42 = call i32 @send_data_cmd(i32 %41)
%43 = load i32, i32* %12
%44 = call i32 @HIGH_BYTE(i32 %43)
%45 = call i32 @send_data_cmd(i32 %44)
%46 = load i32, i32* %12
%47 = call i32 @LOW_BYTE(i32 %46)
%48 = call i32 @send_data_cmd(i32 %47)
%49 = call i32 @send_ctrl_cmd(i32 44)
ret void
}

LLVM IR (-O2):
define void @lcm_update(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = add i32 %0, -1
%6 = add i32 %5, %2
%7 = add i32 %1, -1
%8 = add i32 %7, %3
%9 = tail call i32 @send_ctrl_cmd(i32 42)
%10 = tail call i32 @HIGH_BYTE(i32 %0)
%11 = tail call i32 @send_data_cmd(i32 %10)
%12 = tail call i32 @LOW_BYTE(i32 %0)
%13 = tail call i32 @send_data_cmd(i32 %12)
%14 = tail call i32 @HIGH_BYTE(i32 %6)
%15 = tail call i32 @send_data_cmd(i32 %14)
%16 = tail call i32 @LOW_BYTE(i32 %6)
%17 = tail call i32 @send_data_cmd(i32 %16)
%18 = tail call i32 @send_ctrl_cmd(i32 43)
%19 = tail call i32 @HIGH_BYTE(i32 %1)
%20 = tail call i32 @send_data_cmd(i32 %19)
%21 = tail call i32 @LOW_BYTE(i32 %1)
%22 = tail call i32 @send_data_cmd(i32 %21)
%23 = tail call i32 @HIGH_BYTE(i32 %8)
%24 = tail call i32 @send_data_cmd(i32 %23)
%25 = tail call i32 @LOW_BYTE(i32 %8)
%26 = tail call i32 @send_data_cmd(i32 %25)
%27 = tail call i32 @send_ctrl_cmd(i32 44)
ret void
}