#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*/ lcdWriteCmd(unsigned char);
void lcdSetPos(unsigned char x, unsigned char y) {
  unsigned char p;
  switch (y) {
  case 0:
    p = x;
    break;
  case 1:
    p = 64 + x;
    break;
  case 2:
    p = 20 + x;
    break;
  case 3:
    p = 84 + x;
    break;
  }
  p |= 0x80;
  lcdWriteCmd(p);
}


x86 assembly (clang, -O0):
<lcdSetPos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movzbl -0x2(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x3,%rax
ja     117d <lcdSetPos+0x6d>
mov    -0x10(%rbp),%rax
lea    0xebf(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x1(%rbp),%al
mov    %al,-0x3(%rbp)
jmp    117d <lcdSetPos+0x6d>
movzbl -0x1(%rbp),%eax
add    $0x40,%eax
mov    %al,-0x3(%rbp)
jmp    117d <lcdSetPos+0x6d>
movzbl -0x1(%rbp),%eax
add    $0x14,%eax
mov    %al,-0x3(%rbp)
jmp    117d <lcdSetPos+0x6d>
movzbl -0x1(%rbp),%eax
add    $0x54,%eax
mov    %al,-0x3(%rbp)
movzbl -0x3(%rbp),%eax
or     $0x80,%eax
mov    %al,-0x3(%rbp)
movzbl -0x3(%rbp),%edi
call   1030 <lcdWriteCmd@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcdSetPos>:
cmp    $0x3,%sil
je     1128 <lcdSetPos+0x18>
cmp    $0x2,%sil
je     112e <lcdSetPos+0x1e>
cmp    $0x1,%sil
jne    1132 <lcdSetPos+0x22>
add    $0x40,%dil
jmp    1132 <lcdSetPos+0x22>
add    $0x54,%dil
jmp    1132 <lcdSetPos+0x22>
add    $0x14,%dil
or     $0x80,%dil
movzbl %dil,%edi
jmp    1030 <lcdWriteCmd@plt>

LLVM IR (-O0):
define void @lcdSetPos(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%6 = load i8, i8* %4
%7 = zext i8 %6 to i32
switch i32 %7, label %25 [
i32 0, label %8
i32 1, label %10
i32 2, label %15
i32 3, label %20
]
8: ; preds = %2
%9 = load i8, i8* %3
store i8 %9, i8* %5
br label %25
10: ; preds = %2
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
%13 = add nsw i32 64, %12
%14 = trunc i32 %13 to i8
store i8 %14, i8* %5
br label %25
15: ; preds = %2
%16 = load i8, i8* %3
%17 = zext i8 %16 to i32
%18 = add nsw i32 20, %17
%19 = trunc i32 %18 to i8
store i8 %19, i8* %5
br label %25
20: ; preds = %2
%21 = load i8, i8* %3
%22 = zext i8 %21 to i32
%23 = add nsw i32 84, %22
%24 = trunc i32 %23 to i8
store i8 %24, i8* %5
br label %25
25: ; preds = %2, %20, %15, %10, %8
%26 = load i8, i8* %5
%27 = zext i8 %26 to i32
%28 = or i32 %27, 128
%29 = trunc i32 %28 to i8
store i8 %29, i8* %5
%30 = load i8, i8* %5
%31 = call i32 @lcdWriteCmd(i8 zeroext %30)
ret void
}

LLVM IR (-O2):
define void @lcdSetPos(i8 zeroext %0, i8 zeroext %1) {
switch i8 %1, label %9 [
i8 3, label %7
i8 1, label %3
i8 2, label %5
]
3: ; preds = %2
%4 = add i8 %0, 64
br label %9
5: ; preds = %2
%6 = add i8 %0, 20
br label %9
7: ; preds = %2
%8 = add i8 %0, 84
br label %9
9: ; preds = %2, %7, %5, %3
%10 = phi i8 [ %8, %7 ], [ %6, %5 ], [ %4, %3 ], [ %0, %2 ]
%11 = or i8 %10, -128
%12 = tail call i32 @lcdWriteCmd(i8 zeroext %11)
ret void
}