#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_clear();
int /*<<< orphan*/ lcd_gotoxy(int, int);
int /*<<< orphan*/ lcd_send_byte(char);
void LCD_PUTC(char in_data) {
  char data;
  switch (in_data) {
  case '\f':
    lcd_clear();
    break;
  case '\1':
    lcd_gotoxy(1, 1);
    break;
  case '\2':
    lcd_gotoxy(1, 2);
    break;
  case '\3':
    lcd_gotoxy(1, 3);
    break;
  case '\4':
    lcd_gotoxy(1, 4);
    break;
  default:
    data = in_data & 0xF0;
    data = data | 0b00000001;
    lcd_send_byte(data);
    data = in_data & 0x0F;
    data = data << 4;
    data = data | 0b00000001;
    lcd_send_byte(data);
    break;
  }
}


x86 assembly (clang, -O0):
<LCD_PUTC>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0xb,%eax
ja     11c1 <LCD_PUTC+0x91>
mov    -0x10(%rbp),%rax
lea    0xea1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1040 <lcd_clear@plt>
jmp    1207 <LCD_PUTC+0xd7>
mov    $0x1,%esi
mov    %esi,%edi
call   1030 <lcd_gotoxy@plt>
jmp    1207 <LCD_PUTC+0xd7>
mov    $0x1,%edi
mov    $0x2,%esi
call   1030 <lcd_gotoxy@plt>
jmp    1207 <LCD_PUTC+0xd7>
mov    $0x1,%edi
mov    $0x3,%esi
call   1030 <lcd_gotoxy@plt>
jmp    1207 <LCD_PUTC+0xd7>
mov    $0x1,%edi
mov    $0x4,%esi
call   1030 <lcd_gotoxy@plt>
jmp    1207 <LCD_PUTC+0xd7>
movsbl -0x1(%rbp),%eax
and    $0xf0,%eax
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
or     $0x1,%eax
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%edi
call   1050 <lcd_send_byte@plt>
movsbl -0x1(%rbp),%eax
and    $0xf,%eax
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
shl    $0x4,%eax
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
or     $0x1,%eax
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%edi
call   1050 <lcd_send_byte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LCD_PUTC>:
push   %rbx
mov    %edi,%ebx
lea    -0x1(%rbx),%eax
cmp    $0xb,%eax
ja     118b <LCD_PUTC+0x5b>
lea    0xebe(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x1,%edi
mov    $0x1,%esi
pop    %rbx
jmp    1030 <lcd_gotoxy@plt>
mov    $0x1,%edi
mov    $0x2,%esi
pop    %rbx
jmp    1030 <lcd_gotoxy@plt>
mov    $0x1,%edi
mov    $0x3,%esi
pop    %rbx
jmp    1030 <lcd_gotoxy@plt>
mov    $0x1,%edi
mov    $0x4,%esi
pop    %rbx
jmp    1030 <lcd_gotoxy@plt>
mov    %ebx,%eax
and    $0xf0,%al
or     $0x1,%al
movsbl %al,%edi
call   1050 <lcd_send_byte@plt>
shl    $0x4,%bl
or     $0x1,%bl
movsbl %bl,%edi
pop    %rbx
jmp    1050 <lcd_send_byte@plt>
xor    %eax,%eax
pop    %rbx
jmp    1040 <lcd_clear@plt>

LLVM IR (-O0):
define void @LCD_PUTC(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %2
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
switch i32 %5, label %16 [
i32 12, label %6
i32 1, label %8
i32 2, label %10
i32 3, label %12
i32 4, label %14
]
6: ; preds = %1
%7 = call i32 (...) @lcd_clear()
br label %41
8: ; preds = %1
%9 = call i32 @lcd_gotoxy(i32 1, i32 1)
br label %41
10: ; preds = %1
%11 = call i32 @lcd_gotoxy(i32 1, i32 2)
br label %41
12: ; preds = %1
%13 = call i32 @lcd_gotoxy(i32 1, i32 3)
br label %41
14: ; preds = %1
%15 = call i32 @lcd_gotoxy(i32 1, i32 4)
br label %41
16: ; preds = %1
%17 = load i8, i8* %2
%18 = sext i8 %17 to i32
%19 = and i32 %18, 240
%20 = trunc i32 %19 to i8
store i8 %20, i8* %3
%21 = load i8, i8* %3
%22 = sext i8 %21 to i32
%23 = or i32 %22, 1
%24 = trunc i32 %23 to i8
store i8 %24, i8* %3
%25 = load i8, i8* %3
%26 = call i32 @lcd_send_byte(i8 signext %25)
%27 = load i8, i8* %2
%28 = sext i8 %27 to i32
%29 = and i32 %28, 15
%30 = trunc i32 %29 to i8
store i8 %30, i8* %3
%31 = load i8, i8* %3
%32 = sext i8 %31 to i32
%33 = shl i32 %32, 4
%34 = trunc i32 %33 to i8
store i8 %34, i8* %3
%35 = load i8, i8* %3
%36 = sext i8 %35 to i32
%37 = or i32 %36, 1
%38 = trunc i32 %37 to i8
store i8 %38, i8* %3
%39 = load i8, i8* %3
%40 = call i32 @lcd_send_byte(i8 signext %39)
br label %41
41: ; preds = %16, %14, %12, %10, %8, %6
ret void
}

LLVM IR (-O2):
define void @LCD_PUTC(i8 signext %0) {
%2 = sext i8 %0 to i32
switch i32 %2, label %13 [
i32 12, label %3
i32 1, label %5
i32 2, label %7
i32 3, label %9
i32 4, label %11
]
3: ; preds = %1
%4 = tail call i32 (...) @lcd_clear()
br label %20
5: ; preds = %1
%6 = tail call i32 @lcd_gotoxy(i32 1, i32 1)
br label %20
7: ; preds = %1
%8 = tail call i32 @lcd_gotoxy(i32 1, i32 2)
br label %20
9: ; preds = %1
%10 = tail call i32 @lcd_gotoxy(i32 1, i32 3)
br label %20
11: ; preds = %1
%12 = tail call i32 @lcd_gotoxy(i32 1, i32 4)
br label %20
13: ; preds = %1
%14 = and i8 %0, -16
%15 = or i8 %14, 1
%16 = tail call i32 @lcd_send_byte(i8 signext %15)
%17 = shl i8 %0, 4
%18 = or i8 %17, 1
%19 = tail call i32 @lcd_send_byte(i8 signext %18)
br label %20
20: ; preds = %13, %11, %9, %7, %5, %3
ret void
}