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

/* Variables and functions */
int /*<<< orphan*/ hd44780WriteByte(struct mcp23017 *, struct hd44780 *,
                                    int const, int);
int8_t hd44780LoadCustom(struct mcp23017 *mcp23017, struct hd44780 *hd44780,
                         const uint8_t newChar[8][8]) {
  hd44780WriteByte(mcp23017, hd44780, 0x40, 0);
  uint8_t i, j;
  for (i = 0; i < 8; i++)
    for (j = 0; j < 8; j++)
      hd44780WriteByte(mcp23017, hd44780, newChar[i][j], 1);
  hd44780WriteByte(mcp23017, hd44780, 0x80, 0);
  return 0;
}


x86 assembly (clang, -O0):
<hd44780LoadCustom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x40,%edx
xor    %ecx,%ecx
call   1030 <hd44780WriteByte@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x8,-0x1c(%rbp)
jge    11a3 <hd44780LoadCustom+0x93>
movl   $0x0,-0x20(%rbp)
cmpl   $0x8,-0x20(%rbp)
jge    1190 <hd44780LoadCustom+0x80>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
shl    $0x5,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    $0x1,%ecx
call   1030 <hd44780WriteByte@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1150 <hd44780LoadCustom+0x40>
jmp    1195 <hd44780LoadCustom+0x85>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113f <hd44780LoadCustom+0x2f>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x80,%edx
xor    %ecx,%ecx
call   1030 <hd44780WriteByte@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hd44780LoadCustom>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r12
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
mov    $0x40,%edx
xor    %ecx,%ecx
call   1030 <hd44780WriteByte@plt>
nop
mov    (%r12,%rbx,1),%edx
mov    %r15,%rdi
mov    %r14,%rsi
mov    $0x1,%ecx
call   1030 <hd44780WriteByte@plt>
mov    0x4(%r12,%rbx,1),%edx
mov    %r15,%rdi
mov    %r14,%rsi
mov    $0x1,%ecx
call   1030 <hd44780WriteByte@plt>
mov    0x8(%r12,%rbx,1),%edx
mov    %r15,%rdi
mov    %r14,%rsi
mov    $0x1,%ecx
call   1030 <hd44780WriteByte@plt>
mov    0xc(%r12,%rbx,1),%edx
mov    %r15,%rdi
mov    %r14,%rsi
mov    $0x1,%ecx
call   1030 <hd44780WriteByte@plt>
mov    0x10(%r12,%rbx,1),%edx
mov    %r15,%rdi
mov    %r14,%rsi
mov    $0x1,%ecx
call   1030 <hd44780WriteByte@plt>
mov    0x14(%r12,%rbx,1),%edx
mov    %r15,%rdi
mov    %r14,%rsi
mov    $0x1,%ecx
call   1030 <hd44780WriteByte@plt>
mov    0x18(%r12,%rbx,1),%edx
mov    %r15,%rdi
mov    %r14,%rsi
mov    $0x1,%ecx
call   1030 <hd44780WriteByte@plt>
mov    0x1c(%r12,%rbx,1),%edx
mov    %r15,%rdi
mov    %r14,%rsi
mov    $0x1,%ecx
call   1030 <hd44780WriteByte@plt>
add    $0x20,%rbx
cmp    $0x100,%rbx
jne    1130 <hd44780LoadCustom+0x20>
mov    %r15,%rdi
mov    %r14,%rsi
mov    $0x80,%edx
xor    %ecx,%ecx
call   1030 <hd44780WriteByte@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.mcp23017 = type { i32 }
%struct.hd44780 = type { i32 }
define i32 @hd44780LoadCustom(%struct.mcp23017* %0, %struct.hd44780* %1, [8 x i32]* %2) {
%4 = alloca %struct.mcp23017*
%5 = alloca %struct.hd44780*
%6 = alloca [8 x i32]*
%7 = alloca i32
%8 = alloca i32
store %struct.mcp23017* %0, %struct.mcp23017** %4
store %struct.hd44780* %1, %struct.hd44780** %5
store [8 x i32]* %2, [8 x i32]** %6
%9 = load %struct.mcp23017*, %struct.mcp23017** %4
%10 = load %struct.hd44780*, %struct.hd44780** %5
%11 = call i32 @hd44780WriteByte(%struct.mcp23017* %9, %struct.hd44780* %10, i32 64, i32 0)
store i32 0, i32* %7
br label %12
12: ; preds = %35, %3
%13 = load i32, i32* %7
%14 = icmp slt i32 %13, 8
br i1 %14, label %15, label %38
15: ; preds = %12
store i32 0, i32* %8
br label %16
16: ; preds = %31, %15
%17 = load i32, i32* %8
%18 = icmp slt i32 %17, 8
br i1 %18, label %19, label %34
19: ; preds = %16
%20 = load %struct.mcp23017*, %struct.mcp23017** %4
%21 = load %struct.hd44780*, %struct.hd44780** %5
%22 = load [8 x i32]*, [8 x i32]** %6
%23 = load i32, i32* %7
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [8 x i32], [8 x i32]* %22, i64 %24
%26 = load i32, i32* %8
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [8 x i32], [8 x i32]* %25, i64 0, i64 %27
%29 = load i32, i32* %28
%30 = call i32 @hd44780WriteByte(%struct.mcp23017* %20, %struct.hd44780* %21, i32 %29, i32 1)
br label %31
31: ; preds = %19
%32 = load i32, i32* %8
%33 = add nsw i32 %32, 1
store i32 %33, i32* %8
br label %16
34: ; preds = %16
br label %35
35: ; preds = %34
%36 = load i32, i32* %7
%37 = add nsw i32 %36, 1
store i32 %37, i32* %7
br label %12
38: ; preds = %12
%39 = load %struct.mcp23017*, %struct.mcp23017** %4
%40 = load %struct.hd44780*, %struct.hd44780** %5
%41 = call i32 @hd44780WriteByte(%struct.mcp23017* %39, %struct.hd44780* %40, i32 128, i32 0)
ret i32 0
}

LLVM IR (-O2):
%struct.mcp23017 = type { i32 }
%struct.hd44780 = type { i32 }
define i32 @hd44780LoadCustom(%struct.mcp23017* %0, %struct.hd44780* %1, [8 x i32]* nocapture %2) {
%4 = tail call i32 @hd44780WriteByte(%struct.mcp23017* %0, %struct.hd44780* %1, i32 64, i32 0)
br label %5
5: ; preds = %3, %5
%6 = phi i64 [ 0, %3 ], [ %31, %5 ]
%7 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 %6, i64 0
%8 = load i32, i32* %7
%9 = tail call i32 @hd44780WriteByte(%struct.mcp23017* %0, %struct.hd44780* %1, i32 %8, i32 1)
%10 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 %6, i64 1
%11 = load i32, i32* %10
%12 = tail call i32 @hd44780WriteByte(%struct.mcp23017* %0, %struct.hd44780* %1, i32 %11, i32 1)
%13 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 %6, i64 2
%14 = load i32, i32* %13
%15 = tail call i32 @hd44780WriteByte(%struct.mcp23017* %0, %struct.hd44780* %1, i32 %14, i32 1)
%16 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 %6, i64 3
%17 = load i32, i32* %16
%18 = tail call i32 @hd44780WriteByte(%struct.mcp23017* %0, %struct.hd44780* %1, i32 %17, i32 1)
%19 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 %6, i64 4
%20 = load i32, i32* %19
%21 = tail call i32 @hd44780WriteByte(%struct.mcp23017* %0, %struct.hd44780* %1, i32 %20, i32 1)
%22 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 %6, i64 5
%23 = load i32, i32* %22
%24 = tail call i32 @hd44780WriteByte(%struct.mcp23017* %0, %struct.hd44780* %1, i32 %23, i32 1)
%25 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 %6, i64 6
%26 = load i32, i32* %25
%27 = tail call i32 @hd44780WriteByte(%struct.mcp23017* %0, %struct.hd44780* %1, i32 %26, i32 1)
%28 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 %6, i64 7
%29 = load i32, i32* %28
%30 = tail call i32 @hd44780WriteByte(%struct.mcp23017* %0, %struct.hd44780* %1, i32 %29, i32 1)
%31 = add nuw nsw i64 %6, 1
%32 = icmp eq i64 %31, 8
br i1 %32, label %33, label %5
33: ; preds = %5
%34 = tail call i32 @hd44780WriteByte(%struct.mcp23017* %0, %struct.hd44780* %1, i32 128, i32 0)
ret i32 0
}