#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*/ set_lcm_register(int, unsigned int);
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;
  set_lcm_register(0x46, x1);
  set_lcm_register(0x47, x0);
  set_lcm_register(0x48, y1);
  set_lcm_register(0x49, y0);
  send_ctrl_cmd(0x22);
}


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    -0x1c(%rbp),%esi
mov    $0x46,%edi
call   1030 <set_lcm_register@plt>
mov    -0x14(%rbp),%esi
mov    $0x47,%edi
call   1030 <set_lcm_register@plt>
mov    -0x20(%rbp),%esi
mov    $0x48,%edi
call   1030 <set_lcm_register@plt>
mov    -0x18(%rbp),%esi
mov    $0x49,%edi
call   1030 <set_lcm_register@plt>
mov    $0x22,%edi
call   1040 <send_ctrl_cmd@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcm_update>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %edi,%ebx
lea    (%rbx,%rdx,1),%esi
add    $0xffffffff,%esi
lea    (%r14,%rcx,1),%ebp
add    $0xffffffff,%ebp
mov    $0x46,%edi
call   1030 <set_lcm_register@plt>
mov    $0x47,%edi
mov    %ebx,%esi
call   1030 <set_lcm_register@plt>
mov    $0x48,%edi
mov    %ebp,%esi
call   1030 <set_lcm_register@plt>
mov    $0x49,%edi
mov    %r14d,%esi
call   1030 <set_lcm_register@plt>
mov    $0x22,%edi
pop    %rbx
pop    %r14
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 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 = load i32, i32* %11
%24 = call i32 @set_lcm_register(i32 70, i32 %23)
%25 = load i32, i32* %9
%26 = call i32 @set_lcm_register(i32 71, i32 %25)
%27 = load i32, i32* %12
%28 = call i32 @set_lcm_register(i32 72, i32 %27)
%29 = load i32, i32* %10
%30 = call i32 @set_lcm_register(i32 73, i32 %29)
%31 = call i32 @send_ctrl_cmd(i32 34)
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 @set_lcm_register(i32 70, i32 %6)
%10 = tail call i32 @set_lcm_register(i32 71, i32 %0)
%11 = tail call i32 @set_lcm_register(i32 72, i32 %8)
%12 = tail call i32 @set_lcm_register(i32 73, i32 %1)
%13 = tail call i32 @send_ctrl_cmd(i32 34)
ret void
}