#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*/ delay_ms(int);
int /*<<< orphan*/ lcd_gotoxy(int, int);
int /*<<< orphan*/ lcd_send_byte(int, char);
void lcd_putc(char c) {
  switch (c) {
  case '\f':
    lcd_send_byte(0, 1);
    delay_ms(2);
    break;
  case '\n':
    lcd_gotoxy(1, 2);
    break;
  case '\b':
    lcd_send_byte(0, 0x10);
    break;
  default:
    lcd_send_byte(1, c);
    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
mov    %eax,-0x8(%rbp)
sub    $0x8,%eax
je     11a4 <lcd_putc+0x74>
jmp    1153 <lcd_putc+0x23>
mov    -0x8(%rbp),%eax
sub    $0xa,%eax
je     1190 <lcd_putc+0x60>
jmp    1164 <lcd_putc+0x34>
mov    -0x8(%rbp),%eax
sub    $0xc,%eax
jne    11b5 <lcd_putc+0x85>
jmp    1175 <lcd_putc+0x45>
xor    %edi,%edi
mov    $0x1,%esi
call   1050 <lcd_send_byte@plt>
mov    $0x2,%edi
call   1040 <delay_ms@plt>
jmp    11c3 <lcd_putc+0x93>
mov    $0x1,%edi
mov    $0x2,%esi
call   1030 <lcd_gotoxy@plt>
jmp    11c3 <lcd_putc+0x93>
xor    %edi,%edi
mov    $0x10,%esi
call   1050 <lcd_send_byte@plt>
jmp    11c3 <lcd_putc+0x93>
mov    $0x1,%edi
movsbl -0x1(%rbp),%esi
call   1050 <lcd_send_byte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcd_putc>:
cmp    $0x8,%edi
je     1157 <lcd_putc+0x27>
cmp    $0xa,%edi
je     1163 <lcd_putc+0x33>
cmp    $0xc,%edi
jne    1172 <lcd_putc+0x42>
push   %rax
xor    %edi,%edi
mov    $0x1,%esi
call   1050 <lcd_send_byte@plt>
mov    $0x2,%edi
pop    %rax
jmp    1040 <delay_ms@plt>
xor    %edi,%edi
mov    $0x10,%esi
jmp    1050 <lcd_send_byte@plt>
mov    $0x1,%edi
mov    $0x2,%esi
jmp    1030 <lcd_gotoxy@plt>
movsbl %dil,%esi
mov    $0x1,%edi
jmp    1050 <lcd_send_byte@plt>

LLVM IR (-O0):
define void @lcd_putc(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
switch i32 %4, label %12 [
i32 12, label %5
i32 10, label %8
i32 8, label %10
]
5: ; preds = %1
%6 = call i32 @lcd_send_byte(i32 0, i8 signext 1)
%7 = call i32 @delay_ms(i32 2)
br label %15
8: ; preds = %1
%9 = call i32 @lcd_gotoxy(i32 1, i32 2)
br label %15
10: ; preds = %1
%11 = call i32 @lcd_send_byte(i32 0, i8 signext 16)
br label %15
12: ; preds = %1
%13 = load i8, i8* %2
%14 = call i32 @lcd_send_byte(i32 1, i8 signext %13)
br label %15
15: ; preds = %12, %10, %8, %5
ret void
}

LLVM IR (-O2):
define void @lcd_putc(i8 signext %0) {
%2 = sext i8 %0 to i32
switch i32 %2, label %10 [
i32 12, label %3
i32 10, label %6
i32 8, label %8
]
3: ; preds = %1
%4 = tail call i32 @lcd_send_byte(i32 0, i8 signext 1)
%5 = tail call i32 @delay_ms(i32 2)
br label %12
6: ; preds = %1
%7 = tail call i32 @lcd_gotoxy(i32 1, i32 2)
br label %12
8: ; preds = %1
%9 = tail call i32 @lcd_send_byte(i32 0, i8 signext 16)
br label %12
10: ; preds = %1
%11 = tail call i32 @lcd_send_byte(i32 1, i8 signext %0)
br label %12
12: ; preds = %10, %8, %6, %3
ret void
}