#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 hd44780DisplayMode(struct mcp23017 *mcp23017, struct hd44780 *hd44780,
                          bool display, bool cursor, bool blink) {
  hd44780WriteByte(mcp23017, hd44780,
                   0x08 | (display * 0x04) | (cursor * 0x02) | (blink * 0x01),
                   0);
  hd44780WriteByte(mcp23017, hd44780, 0x01, 0);
  return 0;
}


x86 assembly (clang, -O0):
<hd44780DisplayMode>:
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    %r8d,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
shl    $0x2,%edx
or     $0x8,%edx
mov    -0x18(%rbp),%eax
shl    $0x1,%eax
or     %eax,%edx
mov    -0x1c(%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):
<hd44780DisplayMode>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
shl    $0x2,%edx
lea    (%rcx,%rcx,1),%eax
or     %eax,%edx
or     %r8d,%edx
or     $0x8,%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 @hd44780DisplayMode(%struct.mcp23017* %0, %struct.hd44780* %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca %struct.mcp23017*
%7 = alloca %struct.hd44780*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store %struct.mcp23017* %0, %struct.mcp23017** %6
store %struct.hd44780* %1, %struct.hd44780** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load %struct.mcp23017*, %struct.mcp23017** %6
%12 = load %struct.hd44780*, %struct.hd44780** %7
%13 = load i32, i32* %8
%14 = mul nsw i32 %13, 4
%15 = or i32 8, %14
%16 = load i32, i32* %9
%17 = mul nsw i32 %16, 2
%18 = or i32 %15, %17
%19 = load i32, i32* %10
%20 = mul nsw i32 %19, 1
%21 = or i32 %18, %20
%22 = call i32 @hd44780WriteByte(%struct.mcp23017* %11, %struct.hd44780* %12, i32 %21, i32 0)
%23 = load %struct.mcp23017*, %struct.mcp23017** %6
%24 = load %struct.hd44780*, %struct.hd44780** %7
%25 = call i32 @hd44780WriteByte(%struct.mcp23017* %23, %struct.hd44780* %24, i32 1, i32 0)
ret i32 0
}

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