#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*/ EnderecoCursor(unsigned char);
void PosicaoCursorLCD(unsigned char linha, unsigned char coluna) {
  unsigned char endereco = 0x00;
  coluna--;
  if (coluna >= 0) {
    switch (linha) {
    case 1:
      endereco = 0x00 + coluna;
      EnderecoCursor(endereco);
      break;
    case 2:
      endereco = 0x40 + coluna;
      EnderecoCursor(endereco);
      break;
    default:
      endereco = 0x00;
      break;
    }
  } else {
    endereco = 0x00;
  }
}


x86 assembly (clang, -O0):
<PosicaoCursorLCD>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movb   $0x0,-0x3(%rbp)
mov    -0x2(%rbp),%al
add    $0xff,%al
mov    %al,-0x2(%rbp)
movzbl -0x2(%rbp),%eax
cmp    $0x0,%eax
jl     119c <PosicaoCursorLCD+0x8c>
movzbl -0x1(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0x1,%eax
je     1163 <PosicaoCursorLCD+0x53>
jmp    1152 <PosicaoCursorLCD+0x42>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
je     117b <PosicaoCursorLCD+0x6b>
jmp    1193 <PosicaoCursorLCD+0x83>
movzbl -0x2(%rbp),%eax
add    $0x0,%eax
mov    %al,-0x3(%rbp)
movzbl -0x3(%rbp),%edi
call   1030 <EnderecoCursor@plt>
jmp    1197 <PosicaoCursorLCD+0x87>
movzbl -0x2(%rbp),%eax
add    $0x40,%eax
mov    %al,-0x3(%rbp)
movzbl -0x3(%rbp),%edi
call   1030 <EnderecoCursor@plt>
jmp    1197 <PosicaoCursorLCD+0x87>
movb   $0x0,-0x3(%rbp)
jmp    11a0 <PosicaoCursorLCD+0x90>
movb   $0x0,-0x3(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PosicaoCursorLCD>:
cmp    $0x1,%dil
je     1120 <PosicaoCursorLCD+0x10>
cmp    $0x2,%dil
jne    112e <PosicaoCursorLCD+0x1e>
mov    $0x3f,%al
jmp    1122 <PosicaoCursorLCD+0x12>
mov    $0xff,%al
add    %al,%sil
movzbl %sil,%edi
jmp    1030 <EnderecoCursor@plt>
ret

LLVM IR (-O0):
define void @PosicaoCursorLCD(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
store i8 0, i8* %5
%6 = load i8, i8* %4
%7 = add i8 %6, -1
store i8 %7, i8* %4
%8 = load i8, i8* %4
%9 = zext i8 %8 to i32
%10 = icmp sge i32 %9, 0
br i1 %10, label %11, label %30
11: ; preds = %2
%12 = load i8, i8* %3
%13 = zext i8 %12 to i32
switch i32 %13, label %28 [
i32 1, label %14
i32 2, label %21
]
14: ; preds = %11
%15 = load i8, i8* %4
%16 = zext i8 %15 to i32
%17 = add nsw i32 0, %16
%18 = trunc i32 %17 to i8
store i8 %18, i8* %5
%19 = load i8, i8* %5
%20 = call i32 @EnderecoCursor(i8 zeroext %19)
br label %29
21: ; preds = %11
%22 = load i8, i8* %4
%23 = zext i8 %22 to i32
%24 = add nsw i32 64, %23
%25 = trunc i32 %24 to i8
store i8 %25, i8* %5
%26 = load i8, i8* %5
%27 = call i32 @EnderecoCursor(i8 zeroext %26)
br label %29
28: ; preds = %11
store i8 0, i8* %5
br label %29
29: ; preds = %28, %21, %14
br label %31
30: ; preds = %2
store i8 0, i8* %5
br label %31
31: ; preds = %30, %29
ret void
}

LLVM IR (-O2):
define void @PosicaoCursorLCD(i8 zeroext %0, i8 zeroext %1) {
switch i8 %0, label %8 [
i8 1, label %4
i8 2, label %3
]
3: ; preds = %2
br label %4
4: ; preds = %2, %3
%5 = phi i8 [ 63, %3 ], [ -1, %2 ]
%6 = add i8 %5, %1
%7 = tail call i32 @EnderecoCursor(i8 zeroext %6)
br label %8
8: ; preds = %4, %2
ret void
}