#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*/ send_ctrl_cmd(int);
int /*<<< orphan*/ send_data_cmd(int);
void lcm_update(unsigned int x, unsigned int y, unsigned int width,
                unsigned int height) {
  short x0, y0, x1, y1;
  short h_X_start, l_X_start, h_X_end, l_X_end, h_Y_start, l_Y_start, h_Y_end,
      l_Y_end;
  x0 = (short)x;
  y0 = (short)y;
  x1 = (short)x + width - 1;
  y1 = (short)y + height - 1;
  h_X_start = ((x0 & 0x0300) >> 8);
  l_X_start = (x0 & 0x00FF);
  h_X_end = ((x1 & 0x0300) >> 8);
  l_X_end = (x1 & 0x00FF);
  h_Y_start = ((y0 & 0x0300) >> 8);
  l_Y_start = (y0 & 0x00FF);
  h_Y_end = ((y1 & 0x0300) >> 8);
  l_Y_end = (y1 & 0x00FF);
  send_ctrl_cmd(0x2A00);
  send_data_cmd(h_X_start);
  send_ctrl_cmd(0x2A01);
  send_data_cmd(l_X_start);
  send_ctrl_cmd(0x2A02);
  send_data_cmd(h_X_end);
  send_ctrl_cmd(0x2A03);
  send_data_cmd(l_X_end);
  send_ctrl_cmd(0x2B00);
  send_data_cmd(h_Y_start);
  send_ctrl_cmd(0x2B01);
  send_data_cmd(l_Y_start);
  send_ctrl_cmd(0x2B02);
  send_data_cmd(h_Y_end);
  send_ctrl_cmd(0x2B03);
  send_data_cmd(l_Y_end);
  send_ctrl_cmd(0x3601);
  send_data_cmd(0x01);
  send_ctrl_cmd(0x2C00);
}


x86 assembly (clang, -O0):
<lcm_update>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %ax,-0x12(%rbp)
mov    -0x8(%rbp),%eax
mov    %ax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
cwtl
add    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %ax,-0x16(%rbp)
mov    -0x8(%rbp),%eax
cwtl
add    -0x10(%rbp),%eax
sub    $0x1,%eax
mov    %ax,-0x18(%rbp)
movswl -0x12(%rbp),%eax
and    $0x300,%eax
sar    $0x8,%eax
mov    %ax,-0x1a(%rbp)
movswl -0x12(%rbp),%eax
and    $0xff,%eax
mov    %ax,-0x1c(%rbp)
movswl -0x16(%rbp),%eax
and    $0x300,%eax
sar    $0x8,%eax
mov    %ax,-0x1e(%rbp)
movswl -0x16(%rbp),%eax
and    $0xff,%eax
mov    %ax,-0x20(%rbp)
movswl -0x14(%rbp),%eax
and    $0x300,%eax
sar    $0x8,%eax
mov    %ax,-0x22(%rbp)
movswl -0x14(%rbp),%eax
and    $0xff,%eax
mov    %ax,-0x24(%rbp)
movswl -0x18(%rbp),%eax
and    $0x300,%eax
sar    $0x8,%eax
mov    %ax,-0x26(%rbp)
movswl -0x18(%rbp),%eax
and    $0xff,%eax
mov    %ax,-0x28(%rbp)
mov    $0x2a00,%edi
call   1040 <send_ctrl_cmd@plt>
movswl -0x1a(%rbp),%edi
call   1030 <send_data_cmd@plt>
mov    $0x2a01,%edi
call   1040 <send_ctrl_cmd@plt>
movswl -0x1c(%rbp),%edi
call   1030 <send_data_cmd@plt>
mov    $0x2a02,%edi
call   1040 <send_ctrl_cmd@plt>
movswl -0x1e(%rbp),%edi
call   1030 <send_data_cmd@plt>
mov    $0x2a03,%edi
call   1040 <send_ctrl_cmd@plt>
movswl -0x20(%rbp),%edi
call   1030 <send_data_cmd@plt>
mov    $0x2b00,%edi
call   1040 <send_ctrl_cmd@plt>
movswl -0x22(%rbp),%edi
call   1030 <send_data_cmd@plt>
mov    $0x2b01,%edi
call   1040 <send_ctrl_cmd@plt>
movswl -0x24(%rbp),%edi
call   1030 <send_data_cmd@plt>
mov    $0x2b02,%edi
call   1040 <send_ctrl_cmd@plt>
movswl -0x26(%rbp),%edi
call   1030 <send_data_cmd@plt>
mov    $0x2b03,%edi
call   1040 <send_ctrl_cmd@plt>
movswl -0x28(%rbp),%edi
call   1030 <send_data_cmd@plt>
mov    $0x3601,%edi
call   1040 <send_ctrl_cmd@plt>
mov    $0x1,%edi
call   1030 <send_data_cmd@plt>
mov    $0x2c00,%edi
call   1040 <send_ctrl_cmd@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcm_update>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movzbl %dil,%r13d
lea    (%rdx,%rdi,1),%eax
add    $0xffffffff,%eax
mov    %edi,%r15d
shr    $0x8,%r15d
and    $0x3,%r15d
movswl %ax,%r14d
movzbl %r14b,%r12d
shr    $0x8,%r14d
and    $0x3,%r14d
movzbl %sil,%eax
mov    %eax,(%rsp)
lea    (%rcx,%rsi,1),%eax
add    $0xffffffff,%eax
mov    %esi,%ebp
shr    $0x8,%ebp
and    $0x3,%ebp
movswl %ax,%ebx
movzbl %bl,%eax
mov    %eax,0x4(%rsp)
shr    $0x8,%ebx
and    $0x3,%ebx
mov    $0x2a00,%edi
call   1040 <send_ctrl_cmd@plt>
mov    %r15d,%edi
call   1030 <send_data_cmd@plt>
mov    $0x2a01,%edi
call   1040 <send_ctrl_cmd@plt>
mov    %r13d,%edi
call   1030 <send_data_cmd@plt>
mov    $0x2a02,%edi
call   1040 <send_ctrl_cmd@plt>
mov    %r14d,%edi
call   1030 <send_data_cmd@plt>
mov    $0x2a03,%edi
call   1040 <send_ctrl_cmd@plt>
mov    %r12d,%edi
call   1030 <send_data_cmd@plt>
mov    $0x2b00,%edi
call   1040 <send_ctrl_cmd@plt>
mov    %ebp,%edi
call   1030 <send_data_cmd@plt>
mov    $0x2b01,%edi
call   1040 <send_ctrl_cmd@plt>
mov    (%rsp),%edi
call   1030 <send_data_cmd@plt>
mov    $0x2b02,%edi
call   1040 <send_ctrl_cmd@plt>
mov    %ebx,%edi
call   1030 <send_data_cmd@plt>
mov    $0x2b03,%edi
call   1040 <send_ctrl_cmd@plt>
mov    0x4(%rsp),%edi
call   1030 <send_data_cmd@plt>
mov    $0x3601,%edi
call   1040 <send_ctrl_cmd@plt>
mov    $0x1,%edi
call   1030 <send_data_cmd@plt>
mov    $0x2c00,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <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 i16
%10 = alloca i16
%11 = alloca i16
%12 = alloca i16
%13 = alloca i16
%14 = alloca i16
%15 = alloca i16
%16 = alloca i16
%17 = alloca i16
%18 = alloca i16
%19 = alloca i16
%20 = alloca i16
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%21 = load i32, i32* %5
%22 = trunc i32 %21 to i16
store i16 %22, i16* %9
%23 = load i32, i32* %6
%24 = trunc i32 %23 to i16
store i16 %24, i16* %10
%25 = load i32, i32* %5
%26 = trunc i32 %25 to i16
%27 = sext i16 %26 to i32
%28 = load i32, i32* %7
%29 = add i32 %27, %28
%30 = sub i32 %29, 1
%31 = trunc i32 %30 to i16
store i16 %31, i16* %11
%32 = load i32, i32* %6
%33 = trunc i32 %32 to i16
%34 = sext i16 %33 to i32
%35 = load i32, i32* %8
%36 = add i32 %34, %35
%37 = sub i32 %36, 1
%38 = trunc i32 %37 to i16
store i16 %38, i16* %12
%39 = load i16, i16* %9
%40 = sext i16 %39 to i32
%41 = and i32 %40, 768
%42 = ashr i32 %41, 8
%43 = trunc i32 %42 to i16
store i16 %43, i16* %13
%44 = load i16, i16* %9
%45 = sext i16 %44 to i32
%46 = and i32 %45, 255
%47 = trunc i32 %46 to i16
store i16 %47, i16* %14
%48 = load i16, i16* %11
%49 = sext i16 %48 to i32
%50 = and i32 %49, 768
%51 = ashr i32 %50, 8
%52 = trunc i32 %51 to i16
store i16 %52, i16* %15
%53 = load i16, i16* %11
%54 = sext i16 %53 to i32
%55 = and i32 %54, 255
%56 = trunc i32 %55 to i16
store i16 %56, i16* %16
%57 = load i16, i16* %10
%58 = sext i16 %57 to i32
%59 = and i32 %58, 768
%60 = ashr i32 %59, 8
%61 = trunc i32 %60 to i16
store i16 %61, i16* %17
%62 = load i16, i16* %10
%63 = sext i16 %62 to i32
%64 = and i32 %63, 255
%65 = trunc i32 %64 to i16
store i16 %65, i16* %18
%66 = load i16, i16* %12
%67 = sext i16 %66 to i32
%68 = and i32 %67, 768
%69 = ashr i32 %68, 8
%70 = trunc i32 %69 to i16
store i16 %70, i16* %19
%71 = load i16, i16* %12
%72 = sext i16 %71 to i32
%73 = and i32 %72, 255
%74 = trunc i32 %73 to i16
store i16 %74, i16* %20
%75 = call i32 @send_ctrl_cmd(i32 10752)
%76 = load i16, i16* %13
%77 = sext i16 %76 to i32
%78 = call i32 @send_data_cmd(i32 %77)
%79 = call i32 @send_ctrl_cmd(i32 10753)
%80 = load i16, i16* %14
%81 = sext i16 %80 to i32
%82 = call i32 @send_data_cmd(i32 %81)
%83 = call i32 @send_ctrl_cmd(i32 10754)
%84 = load i16, i16* %15
%85 = sext i16 %84 to i32
%86 = call i32 @send_data_cmd(i32 %85)
%87 = call i32 @send_ctrl_cmd(i32 10755)
%88 = load i16, i16* %16
%89 = sext i16 %88 to i32
%90 = call i32 @send_data_cmd(i32 %89)
%91 = call i32 @send_ctrl_cmd(i32 11008)
%92 = load i16, i16* %17
%93 = sext i16 %92 to i32
%94 = call i32 @send_data_cmd(i32 %93)
%95 = call i32 @send_ctrl_cmd(i32 11009)
%96 = load i16, i16* %18
%97 = sext i16 %96 to i32
%98 = call i32 @send_data_cmd(i32 %97)
%99 = call i32 @send_ctrl_cmd(i32 11010)
%100 = load i16, i16* %19
%101 = sext i16 %100 to i32
%102 = call i32 @send_data_cmd(i32 %101)
%103 = call i32 @send_ctrl_cmd(i32 11011)
%104 = load i16, i16* %20
%105 = sext i16 %104 to i32
%106 = call i32 @send_data_cmd(i32 %105)
%107 = call i32 @send_ctrl_cmd(i32 13825)
%108 = call i32 @send_data_cmd(i32 1)
%109 = call i32 @send_ctrl_cmd(i32 11264)
ret void
}

LLVM IR (-O2):
define void @lcm_update(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = add i32 %2, %0
%6 = add i32 %3, %1
%7 = lshr i32 %0, 8
%8 = and i32 %7, 3
%9 = and i32 %0, 255
%10 = shl i32 %5, 16
%11 = add i32 %10, -65536
%12 = ashr exact i32 %11, 16
%13 = lshr i32 %12, 8
%14 = and i32 %13, 3
%15 = and i32 %12, 255
%16 = lshr i32 %1, 8
%17 = and i32 %16, 3
%18 = and i32 %1, 255
%19 = shl i32 %6, 16
%20 = add i32 %19, -65536
%21 = ashr exact i32 %20, 16
%22 = lshr i32 %21, 8
%23 = and i32 %22, 3
%24 = and i32 %21, 255
%25 = tail call i32 @send_ctrl_cmd(i32 10752)
%26 = tail call i32 @send_data_cmd(i32 %8)
%27 = tail call i32 @send_ctrl_cmd(i32 10753)
%28 = tail call i32 @send_data_cmd(i32 %9)
%29 = tail call i32 @send_ctrl_cmd(i32 10754)
%30 = tail call i32 @send_data_cmd(i32 %14)
%31 = tail call i32 @send_ctrl_cmd(i32 10755)
%32 = tail call i32 @send_data_cmd(i32 %15)
%33 = tail call i32 @send_ctrl_cmd(i32 11008)
%34 = tail call i32 @send_data_cmd(i32 %17)
%35 = tail call i32 @send_ctrl_cmd(i32 11009)
%36 = tail call i32 @send_data_cmd(i32 %18)
%37 = tail call i32 @send_ctrl_cmd(i32 11010)
%38 = tail call i32 @send_data_cmd(i32 %23)
%39 = tail call i32 @send_ctrl_cmd(i32 11011)
%40 = tail call i32 @send_data_cmd(i32 %24)
%41 = tail call i32 @send_ctrl_cmd(i32 13825)
%42 = tail call i32 @send_data_cmd(i32 1)
%43 = tail call i32 @send_ctrl_cmd(i32 11264)
ret void
}