#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 */
struct mcp23017 {
  int dummy;
};
struct hd44780 {
  int dummy;
};
typedef int /*<<< orphan*/ int8_t;

/* Variables and functions */
int /*<<< orphan*/ hd44780WriteByte(struct mcp23017 *, struct hd44780 *, int,
                                    int /*<<< orphan*/);
int8_t hd44780EntryMode(struct mcp23017 *mcp23017, struct hd44780 *hd44780,
                        bool counter, bool shift) {
  hd44780WriteByte(mcp23017, hd44780, 0x04 | (counter * 0x02) | (shift * 0x01),
                   0);
  hd44780WriteByte(mcp23017, hd44780, 0x01, 0);
  return 0;
}


x86 assembly (clang, -O0):
<hd44780EntryMode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
shl    $0x1,%edx
or     $0x4,%edx
mov    -0x18(%rbp),%eax
shl    $0x0,%eax
or     %eax,%edx
xor    %ecx,%ecx
call   1030 <hd44780WriteByte@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1030 <hd44780WriteByte@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hd44780EntryMode>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
add    %edx,%edx
or     %ecx,%edx
or     $0x4,%edx
xor    %ecx,%ecx
call   1030 <hd44780WriteByte@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1030 <hd44780WriteByte@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.mcp23017 = type { i32 }
%struct.hd44780 = type { i32 }
define i32 @hd44780EntryMode(%struct.mcp23017* %0, %struct.hd44780* %1, i32 %2, i32 %3) {
%5 = alloca %struct.mcp23017*
%6 = alloca %struct.hd44780*
%7 = alloca i32
%8 = alloca i32
store %struct.mcp23017* %0, %struct.mcp23017** %5
store %struct.hd44780* %1, %struct.hd44780** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load %struct.mcp23017*, %struct.mcp23017** %5
%10 = load %struct.hd44780*, %struct.hd44780** %6
%11 = load i32, i32* %7
%12 = mul nsw i32 %11, 2
%13 = or i32 4, %12
%14 = load i32, i32* %8
%15 = mul nsw i32 %14, 1
%16 = or i32 %13, %15
%17 = call i32 @hd44780WriteByte(%struct.mcp23017* %9, %struct.hd44780* %10, i32 %16, i32 0)
%18 = load %struct.mcp23017*, %struct.mcp23017** %5
%19 = load %struct.hd44780*, %struct.hd44780** %6
%20 = call i32 @hd44780WriteByte(%struct.mcp23017* %18, %struct.hd44780* %19, i32 1, i32 0)
ret i32 0
}

LLVM IR (-O2):
%struct.mcp23017 = type { i32 }
%struct.hd44780 = type { i32 }
define i32 @hd44780EntryMode(%struct.mcp23017* %0, %struct.hd44780* %1, i32 %2, i32 %3) {
%5 = shl nsw i32 %2, 1
%6 = or i32 %5, %3
%7 = or i32 %6, 4
%8 = tail call i32 @hd44780WriteByte(%struct.mcp23017* %0, %struct.hd44780* %1, i32 %7, i32 0)
%9 = tail call i32 @hd44780WriteByte(%struct.mcp23017* %0, %struct.hd44780* %1, i32 1, i32 0)
ret i32 0
}