#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 */
typedef int int32_t;

/* Variables and functions */
int /*<<< orphan*/ LCDPort_ClearCE();
int /*<<< orphan*/ LCDPort_ClearRW();
int /*<<< orphan*/ LCDPort_Out4(int);
int /*<<< orphan*/ LCDPort_SetCE();
int /*<<< orphan*/ LCDPort_SetDirection_Input4();
int /*<<< orphan*/ LCDPort_SetDirection_Output4();
int /*<<< orphan*/ LCDPort_SetRS();
int /*<<< orphan*/ LCDPort_SetRW();
void writeData_4BitIntf(int32_t data) {
  LCDPort_SetRS();
  LCDPort_ClearRW();
  LCDPort_SetCE();
  LCDPort_Out4(((data >> 4) & 0x0F));
  LCDPort_SetDirection_Output4();
  LCDPort_ClearCE();
  LCDPort_SetCE();
  LCDPort_Out4((data & 0x0F));
  LCDPort_ClearCE();
  LCDPort_SetDirection_Input4();
  LCDPort_SetRW();
}


x86 assembly (clang, -O0):
<writeData_4BitIntf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1090 <LCDPort_SetRS@plt>
mov    $0x0,%al
call   1050 <LCDPort_ClearRW@plt>
mov    $0x0,%al
call   1060 <LCDPort_SetCE@plt>
mov    -0x4(%rbp),%edi
sar    $0x4,%edi
and    $0xf,%edi
call   1040 <LCDPort_Out4@plt>
mov    $0x0,%al
call   1070 <LCDPort_SetDirection_Output4@plt>
mov    $0x0,%al
call   1030 <LCDPort_ClearCE@plt>
mov    $0x0,%al
call   1060 <LCDPort_SetCE@plt>
mov    -0x4(%rbp),%edi
and    $0xf,%edi
call   1040 <LCDPort_Out4@plt>
mov    $0x0,%al
call   1030 <LCDPort_ClearCE@plt>
mov    $0x0,%al
call   1080 <LCDPort_SetDirection_Input4@plt>
mov    $0x0,%al
call   10a0 <LCDPort_SetRW@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeData_4BitIntf>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1090 <LCDPort_SetRS@plt>
xor    %eax,%eax
call   1050 <LCDPort_ClearRW@plt>
xor    %eax,%eax
call   1060 <LCDPort_SetCE@plt>
mov    %ebx,%edi
shr    $0x4,%edi
and    $0xf,%edi
call   1040 <LCDPort_Out4@plt>
xor    %eax,%eax
call   1070 <LCDPort_SetDirection_Output4@plt>
xor    %eax,%eax
call   1030 <LCDPort_ClearCE@plt>
xor    %eax,%eax
call   1060 <LCDPort_SetCE@plt>
and    $0xf,%ebx
mov    %ebx,%edi
call   1040 <LCDPort_Out4@plt>
xor    %eax,%eax
call   1030 <LCDPort_ClearCE@plt>
xor    %eax,%eax
call   1080 <LCDPort_SetDirection_Input4@plt>
xor    %eax,%eax
pop    %rbx
jmp    10a0 <LCDPort_SetRW@plt>

LLVM IR (-O0):
define void @writeData_4BitIntf(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @LCDPort_SetRS()
%4 = call i32 (...) @LCDPort_ClearRW()
%5 = call i32 (...) @LCDPort_SetCE()
%6 = load i32, i32* %2
%7 = ashr i32 %6, 4
%8 = and i32 %7, 15
%9 = call i32 @LCDPort_Out4(i32 %8)
%10 = call i32 (...) @LCDPort_SetDirection_Output4()
%11 = call i32 (...) @LCDPort_ClearCE()
%12 = call i32 (...) @LCDPort_SetCE()
%13 = load i32, i32* %2
%14 = and i32 %13, 15
%15 = call i32 @LCDPort_Out4(i32 %14)
%16 = call i32 (...) @LCDPort_ClearCE()
%17 = call i32 (...) @LCDPort_SetDirection_Input4()
%18 = call i32 (...) @LCDPort_SetRW()
ret void
}

LLVM IR (-O2):
define void @writeData_4BitIntf(i32 %0) {
%2 = tail call i32 (...) @LCDPort_SetRS()
%3 = tail call i32 (...) @LCDPort_ClearRW()
%4 = tail call i32 (...) @LCDPort_SetCE()
%5 = lshr i32 %0, 4
%6 = and i32 %5, 15
%7 = tail call i32 @LCDPort_Out4(i32 %6)
%8 = tail call i32 (...) @LCDPort_SetDirection_Output4()
%9 = tail call i32 (...) @LCDPort_ClearCE()
%10 = tail call i32 (...) @LCDPort_SetCE()
%11 = and i32 %0, 15
%12 = tail call i32 @LCDPort_Out4(i32 %11)
%13 = tail call i32 (...) @LCDPort_ClearCE()
%14 = tail call i32 (...) @LCDPort_SetDirection_Input4()
%15 = tail call i32 (...) @LCDPort_SetRW()
ret void
}