#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_Chr_CP(char);
int /*<<< orphan*/ Lcd_Cmd(unsigned char);
void lcd_escreve2(unsigned char y, unsigned char x, char *buffer) {
  unsigned char data;
  switch (y) {
  case 1:
    data = 127 + x;
    break;
  case 2:
    data = 191 + x;
    break;
  case 3:
    data = 147 + x;
    break;
  case 4:
    data = 211 + x;
    break;
  default:
    break;
  }
  Lcd_Cmd(data);
  while (*buffer) {
    Lcd_Chr_CP(*buffer);
    buffer++;
  }
  return;
}


x86 assembly (clang, -O0):
<lcd_escreve2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
mov    %rdx,-0x10(%rbp)
movzbl -0x1(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x3,%eax
ja     11a4 <lcd_escreve2+0x84>
mov    -0x20(%rbp),%rax
lea    0xea7(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movzbl -0x2(%rbp),%eax
add    $0x7f,%eax
mov    %al,-0x11(%rbp)
jmp    11a9 <lcd_escreve2+0x89>
movzbl -0x2(%rbp),%eax
add    $0xbf,%eax
mov    %al,-0x11(%rbp)
jmp    11a9 <lcd_escreve2+0x89>
movzbl -0x2(%rbp),%eax
add    $0x93,%eax
mov    %al,-0x11(%rbp)
jmp    11a9 <lcd_escreve2+0x89>
movzbl -0x2(%rbp),%eax
add    $0xd3,%eax
mov    %al,-0x11(%rbp)
jmp    11a9 <lcd_escreve2+0x89>
jmp    11a9 <lcd_escreve2+0x89>
movzbl -0x11(%rbp),%edi
call   1030 <Lcd_Cmd@plt>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11dc <lcd_escreve2+0xbc>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1040 <Lcd_Chr_CP@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    11b2 <lcd_escreve2+0x92>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcd_escreve2>:
push   %rbx
add    $0xff,%dil
movzbl %dil,%ecx
shl    $0x3,%ecx
mov    $0xd393bf7f,%eax
shr    %cl,%eax
mov    %rdx,%rbx
add    %sil,%al
movzbl %al,%edi
call   1030 <Lcd_Cmd@plt>
mov    (%rbx),%al
test   %al,%al
je     1163 <lcd_escreve2+0x43>
add    $0x1,%rbx
nopl   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1040 <Lcd_Chr_CP@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1150 <lcd_escreve2+0x30>
pop    %rbx
ret

LLVM IR (-O0):
define void @lcd_escreve2(i8 zeroext %0, i8 zeroext %1, i8* %2) {
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8*
%7 = alloca i8
store i8 %0, i8* %4
store i8 %1, i8* %5
store i8* %2, i8** %6
%8 = load i8, i8* %4
%9 = zext i8 %8 to i32
switch i32 %9, label %30 [
i32 1, label %10
i32 2, label %15
i32 3, label %20
i32 4, label %25
]
10: ; preds = %3
%11 = load i8, i8* %5
%12 = zext i8 %11 to i32
%13 = add nsw i32 127, %12
%14 = trunc i32 %13 to i8
store i8 %14, i8* %7
br label %31
15: ; preds = %3
%16 = load i8, i8* %5
%17 = zext i8 %16 to i32
%18 = add nsw i32 191, %17
%19 = trunc i32 %18 to i8
store i8 %19, i8* %7
br label %31
20: ; preds = %3
%21 = load i8, i8* %5
%22 = zext i8 %21 to i32
%23 = add nsw i32 147, %22
%24 = trunc i32 %23 to i8
store i8 %24, i8* %7
br label %31
25: ; preds = %3
%26 = load i8, i8* %5
%27 = zext i8 %26 to i32
%28 = add nsw i32 211, %27
%29 = trunc i32 %28 to i8
store i8 %29, i8* %7
br label %31
30: ; preds = %3
br label %31
31: ; preds = %30, %25, %20, %15, %10
%32 = load i8, i8* %7
%33 = call i32 @Lcd_Cmd(i8 zeroext %32)
br label %34
34: ; preds = %38, %31
%35 = load i8*, i8** %6
%36 = load i8, i8* %35
%37 = icmp ne i8 %36, 0
br i1 %37, label %38, label %44
38: ; preds = %34
%39 = load i8*, i8** %6
%40 = load i8, i8* %39
%41 = call i32 @Lcd_Chr_CP(i8 signext %40)
%42 = load i8*, i8** %6
%43 = getelementptr inbounds i8, i8* %42, i32 1
store i8* %43, i8** %6
br label %34
44: ; preds = %34
ret void
}

LLVM IR (-O2):
define void @lcd_escreve2(i8 zeroext %0, i8 zeroext %1, i8* nocapture %2) {
%4 = add i8 %0, -1
%5 = zext i8 %4 to i32
%6 = shl nuw nsw i32 %5, 3
%7 = lshr i32 -745291905, %6
%8 = trunc i32 %7 to i8
%9 = add i8 %8, %1
%10 = tail call i32 @Lcd_Cmd(i8 zeroext %9)
%11 = load i8, i8* %2
%12 = icmp eq i8 %11, 0
br i1 %12, label %20, label %13
13: ; preds = %3, %13
%14 = phi i8 [ %18, %13 ], [ %11, %3 ]
%15 = phi i8* [ %17, %13 ], [ %2, %3 ]
%16 = tail call i32 @Lcd_Chr_CP(i8 signext %14)
%17 = getelementptr inbounds i8, i8* %15, i64 1
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 0
br i1 %19, label %20, label %13
20: ; preds = %13, %3
ret void
}