#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*/ lcdsend(int, int /*<<< orphan*/, int);
int lcdsetcurpos(int fd, int x, int y) {
  if (y < 0 || y > 1)
    return -1;
  if (x < 0 || x > 15)
    return -1;
  if (y == 0)
    lcdsend(fd, 0, 0x80 + 0x00 + x);
  else
    lcdsend(fd, 0, 0x80 + 0x40 + x);
  return 0;
}


x86 assembly (clang, -O0):
<lcdsetcurpos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jl     1135 <lcdsetcurpos+0x25>
cmpl   $0x1,-0x10(%rbp)
jle    1141 <lcdsetcurpos+0x31>
movl   $0xffffffff,-0x4(%rbp)
jmp    119d <lcdsetcurpos+0x8d>
cmpl   $0x0,-0xc(%rbp)
jl     1155 <lcdsetcurpos+0x45>
cmpl   $0xf,-0xc(%rbp)
jle    1161 <lcdsetcurpos+0x51>
movl   $0xffffffff,-0x4(%rbp)
jmp    119d <lcdsetcurpos+0x8d>
cmpl   $0x0,-0x10(%rbp)
jne    1183 <lcdsetcurpos+0x73>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%edx
add    $0x80,%edx
xor    %esi,%esi
call   1030 <lcdsend@plt>
jmp    1196 <lcdsetcurpos+0x86>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%edx
add    $0xc0,%edx
xor    %esi,%esi
call   1030 <lcdsend@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcdsetcurpos>:
push   %rbx
mov    $0xffffffff,%ebx
cmp    $0xf,%esi
ja     113c <lcdsetcurpos+0x2c>
cmp    $0x1,%edx
ja     113c <lcdsetcurpos+0x2c>
xor    %eax,%eax
test   %edx,%edx
setne  %al
shl    $0x6,%eax
lea    (%rax,%rsi,1),%edx
add    $0x80,%edx
xor    %ebx,%ebx
xor    %esi,%esi
call   1030 <lcdsend@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @lcdsetcurpos(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%8 = load i32, i32* %7
%9 = icmp slt i32 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %3
%11 = load i32, i32* %7
%12 = icmp sgt i32 %11, 1
br i1 %12, label %13, label %14
13: ; preds = %10, %3
store i32 -1, i32* %4
br label %35
14: ; preds = %10
%15 = load i32, i32* %6
%16 = icmp slt i32 %15, 0
br i1 %16, label %20, label %17
17: ; preds = %14
%18 = load i32, i32* %6
%19 = icmp sgt i32 %18, 15
br i1 %19, label %20, label %21
20: ; preds = %17, %14
store i32 -1, i32* %4
br label %35
21: ; preds = %17
%22 = load i32, i32* %7
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %29
24: ; preds = %21
%25 = load i32, i32* %5
%26 = load i32, i32* %6
%27 = add nsw i32 128, %26
%28 = call i32 @lcdsend(i32 %25, i32 0, i32 %27)
br label %34
29: ; preds = %21
%30 = load i32, i32* %5
%31 = load i32, i32* %6
%32 = add nsw i32 192, %31
%33 = call i32 @lcdsend(i32 %30, i32 0, i32 %32)
br label %34
34: ; preds = %29, %24
store i32 0, i32* %4
br label %35
35: ; preds = %34, %20, %13
%36 = load i32, i32* %4
ret i32 %36
}

LLVM IR (-O2):
define i32 @lcdsetcurpos(i32 %0, i32 %1, i32 %2) {
%4 = icmp ugt i32 %2, 1
%5 = icmp ugt i32 %1, 15
%6 = or i1 %5, %4
br i1 %6, label %12, label %7
7: ; preds = %3
%8 = icmp eq i32 %2, 0
%9 = select i1 %8, i32 128, i32 192
%10 = add nuw nsw i32 %9, %1
%11 = tail call i32 @lcdsend(i32 %0, i32 0, i32 %10)
br label %12
12: ; preds = %7, %3
%13 = phi i32 [ -1, %3 ], [ 0, %7 ]
ret i32 %13
}