#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_FontSelect(short);
int /*<<< orphan*/ LCD_command_2D(int, int);
int /*<<< orphan*/ LCD_setup();
int /*<<< orphan*/ gpio_setup();
void LCD_init(int textStart, int graphicStart, short fontSize) {
  gpio_setup();
  LCD_setup();
  LCD_FontSelect(fontSize);
  int lineGap = fontSize ? 0x1E : 0x28;
  LCD_command_2D(0x40, textStart);
  LCD_command_2D(0x41, lineGap);
  LCD_command_2D(0x42, graphicStart);
  LCD_command_2D(0x43, lineGap);
}


x86 assembly (clang, -O0):
<LCD_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dx,%ax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
mov    $0x0,%al
call   1050 <gpio_setup@plt>
mov    $0x0,%al
call   1040 <LCD_setup@plt>
movswl -0xa(%rbp),%edi
call   1060 <LCD_FontSelect@plt>
movswl -0xa(%rbp),%edx
mov    $0x28,%eax
mov    $0x1e,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%esi
mov    $0x40,%edi
call   1030 <LCD_command_2D@plt>
mov    -0x10(%rbp),%esi
mov    $0x41,%edi
call   1030 <LCD_command_2D@plt>
mov    -0x8(%rbp),%esi
mov    $0x42,%edi
call   1030 <LCD_command_2D@plt>
mov    -0x10(%rbp),%esi
mov    $0x43,%edi
call   1030 <LCD_command_2D@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LCD_init>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %esi,%r14d
mov    %edi,%ebx
xor    %eax,%eax
call   1050 <gpio_setup@plt>
xor    %eax,%eax
call   1040 <LCD_setup@plt>
mov    %ebp,%edi
call   1060 <LCD_FontSelect@plt>
test   %bp,%bp
mov    $0x28,%eax
mov    $0x1e,%ebp
cmove  %eax,%ebp
mov    $0x40,%edi
mov    %ebx,%esi
call   1030 <LCD_command_2D@plt>
mov    $0x41,%edi
mov    %ebp,%esi
call   1030 <LCD_command_2D@plt>
mov    $0x42,%edi
mov    %r14d,%esi
call   1030 <LCD_command_2D@plt>
mov    $0x43,%edi
mov    %ebp,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <LCD_command_2D@plt>

LLVM IR (-O0):
define void @LCD_init(i32 %0, i32 %1, i16 signext %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i16
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i16 %2, i16* %6
%8 = call i32 (...) @gpio_setup()
%9 = call i32 (...) @LCD_setup()
%10 = load i16, i16* %6
%11 = call i32 @LCD_FontSelect(i16 signext %10)
%12 = load i16, i16* %6
%13 = sext i16 %12 to i32
%14 = icmp ne i32 %13, 0
%15 = zext i1 %14 to i64
%16 = select i1 %14, i32 30, i32 40
store i32 %16, i32* %7
%17 = load i32, i32* %4
%18 = call i32 @LCD_command_2D(i32 64, i32 %17)
%19 = load i32, i32* %7
%20 = call i32 @LCD_command_2D(i32 65, i32 %19)
%21 = load i32, i32* %5
%22 = call i32 @LCD_command_2D(i32 66, i32 %21)
%23 = load i32, i32* %7
%24 = call i32 @LCD_command_2D(i32 67, i32 %23)
ret void
}

LLVM IR (-O2):
define void @LCD_init(i32 %0, i32 %1, i16 signext %2) {
%4 = tail call i32 (...) @gpio_setup()
%5 = tail call i32 (...) @LCD_setup()
%6 = tail call i32 @LCD_FontSelect(i16 signext %2)
%7 = icmp eq i16 %2, 0
%8 = select i1 %7, i32 40, i32 30
%9 = tail call i32 @LCD_command_2D(i32 64, i32 %0)
%10 = tail call i32 @LCD_command_2D(i32 65, i32 %8)
%11 = tail call i32 @LCD_command_2D(i32 66, i32 %1)
%12 = tail call i32 @LCD_command_2D(i32 67, i32 %8)
ret void
}