#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*/ Lcd_Cmd(char);
void Lcd_Set_Cursor(char a, char b) {
  char temp, z, y;
  if (a == 1) {
    temp = 0x80 + b - 1;
    z = temp >> 4;
    y = temp & 0x0F;
    Lcd_Cmd(z);
    Lcd_Cmd(y);
  } else if (a == 2) {
    temp = 0xC0 + b - 1;
    z = temp >> 4;
    y = temp & 0x0F;
    Lcd_Cmd(z);
    Lcd_Cmd(y);
  }
}


x86 assembly (clang, -O0):
<Lcd_Set_Cursor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x1,%eax
jne    116b <Lcd_Set_Cursor+0x5b>
movsbl -0x2(%rbp),%eax
add    $0x80,%eax
sub    $0x1,%eax
mov    %al,-0x3(%rbp)
movsbl -0x3(%rbp),%eax
sar    $0x4,%eax
mov    %al,-0x4(%rbp)
movsbl -0x3(%rbp),%eax
and    $0xf,%eax
mov    %al,-0x5(%rbp)
movsbl -0x4(%rbp),%edi
call   1030 <Lcd_Cmd@plt>
movsbl -0x5(%rbp),%edi
call   1030 <Lcd_Cmd@plt>
jmp    11b2 <Lcd_Set_Cursor+0xa2>
movsbl -0x1(%rbp),%eax
cmp    $0x2,%eax
jne    11ad <Lcd_Set_Cursor+0x9d>
movsbl -0x2(%rbp),%eax
add    $0xc0,%eax
sub    $0x1,%eax
mov    %al,-0x3(%rbp)
movsbl -0x3(%rbp),%eax
sar    $0x4,%eax
mov    %al,-0x4(%rbp)
movsbl -0x3(%rbp),%eax
and    $0xf,%eax
mov    %al,-0x5(%rbp)
movsbl -0x4(%rbp),%edi
call   1030 <Lcd_Cmd@plt>
movsbl -0x5(%rbp),%edi
call   1030 <Lcd_Cmd@plt>
jmp    11b2 <Lcd_Set_Cursor+0xa2>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Lcd_Set_Cursor>:
push   %rbx
mov    %esi,%ebx
cmp    $0x1,%dil
je     1123 <Lcd_Set_Cursor+0x13>
cmp    $0x2,%dil
jne    1140 <Lcd_Set_Cursor+0x30>
mov    $0xbf,%al
jmp    1125 <Lcd_Set_Cursor+0x15>
mov    $0x7f,%al
add    %al,%bl
mov    %ebx,%eax
sar    $0x4,%al
and    $0xf,%bl
movsbl %al,%edi
call   1030 <Lcd_Cmd@plt>
movzbl %bl,%edi
pop    %rbx
jmp    1030 <Lcd_Cmd@plt>
pop    %rbx
ret

LLVM IR (-O0):
define void @Lcd_Set_Cursor(i8 signext %0, i8 signext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %29
11: ; preds = %2
%12 = load i8, i8* %4
%13 = sext i8 %12 to i32
%14 = add nsw i32 128, %13
%15 = sub nsw i32 %14, 1
%16 = trunc i32 %15 to i8
store i8 %16, i8* %5
%17 = load i8, i8* %5
%18 = sext i8 %17 to i32
%19 = ashr i32 %18, 4
%20 = trunc i32 %19 to i8
store i8 %20, i8* %6
%21 = load i8, i8* %5
%22 = sext i8 %21 to i32
%23 = and i32 %22, 15
%24 = trunc i32 %23 to i8
store i8 %24, i8* %7
%25 = load i8, i8* %6
%26 = call i32 @Lcd_Cmd(i8 signext %25)
%27 = load i8, i8* %7
%28 = call i32 @Lcd_Cmd(i8 signext %27)
br label %52
29: ; preds = %2
%30 = load i8, i8* %3
%31 = sext i8 %30 to i32
%32 = icmp eq i32 %31, 2
br i1 %32, label %33, label %51
33: ; preds = %29
%34 = load i8, i8* %4
%35 = sext i8 %34 to i32
%36 = add nsw i32 192, %35
%37 = sub nsw i32 %36, 1
%38 = trunc i32 %37 to i8
store i8 %38, i8* %5
%39 = load i8, i8* %5
%40 = sext i8 %39 to i32
%41 = ashr i32 %40, 4
%42 = trunc i32 %41 to i8
store i8 %42, i8* %6
%43 = load i8, i8* %5
%44 = sext i8 %43 to i32
%45 = and i32 %44, 15
%46 = trunc i32 %45 to i8
store i8 %46, i8* %7
%47 = load i8, i8* %6
%48 = call i32 @Lcd_Cmd(i8 signext %47)
%49 = load i8, i8* %7
%50 = call i32 @Lcd_Cmd(i8 signext %49)
br label %51
51: ; preds = %33, %29
br label %52
52: ; preds = %51, %11
ret void
}

LLVM IR (-O2):
define void @Lcd_Set_Cursor(i8 signext %0, i8 signext %1) {
switch i8 %0, label %11 [
i8 1, label %4
i8 2, label %3
]
3: ; preds = %2
br label %4
4: ; preds = %2, %3
%5 = phi i8 [ -65, %3 ], [ 127, %2 ]
%6 = add i8 %5, %1
%7 = ashr i8 %6, 4
%8 = and i8 %6, 15
%9 = tail call i32 @Lcd_Cmd(i8 signext %7)
%10 = tail call i32 @Lcd_Cmd(i8 signext %8)
br label %11
11: ; preds = %4, %2
ret void
}