#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;

/* Variables and functions */
int /*<<< orphan*/ pifacecad_lcd_send_command(int);
int /*<<< orphan*/ pifacecad_lcd_send_data(int);
void pifacecad_lcd_store_custom_bitmap(uint8_t location, uint8_t bitmap[]) {
  location &= 0x7;
  pifacecad_lcd_send_command(0x40 | (location << 3));
  int i;
  for (i = 0; i < 8; i++) {
    pifacecad_lcd_send_data(bitmap[i]);
  }
}


x86 assembly (clang, -O0):
<pifacecad_lcd_store_custom_bitmap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
and    $0x7,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
shl    $0x3,%edi
or     $0x40,%edi
call   1040 <pifacecad_lcd_send_command@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x8,-0x14(%rbp)
jge    1175 <pifacecad_lcd_store_custom_bitmap+0x55>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1030 <pifacecad_lcd_send_data@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114d <pifacecad_lcd_store_custom_bitmap+0x2d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pifacecad_lcd_store_custom_bitmap>:
push   %rbx
mov    %rsi,%rbx
and    $0x7,%edi
lea    0x40(,%rdi,8),%edi
call   1040 <pifacecad_lcd_send_command@plt>
mov    (%rbx),%edi
call   1030 <pifacecad_lcd_send_data@plt>
mov    0x4(%rbx),%edi
call   1030 <pifacecad_lcd_send_data@plt>
mov    0x8(%rbx),%edi
call   1030 <pifacecad_lcd_send_data@plt>
mov    0xc(%rbx),%edi
call   1030 <pifacecad_lcd_send_data@plt>
mov    0x10(%rbx),%edi
call   1030 <pifacecad_lcd_send_data@plt>
mov    0x14(%rbx),%edi
call   1030 <pifacecad_lcd_send_data@plt>
mov    0x18(%rbx),%edi
call   1030 <pifacecad_lcd_send_data@plt>
mov    0x1c(%rbx),%edi
pop    %rbx
jmp    1030 <pifacecad_lcd_send_data@plt>

LLVM IR (-O0):
define void @pifacecad_lcd_store_custom_bitmap(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
store i32 %0, i32* %3
store i32* %1, i32** %4
%6 = load i32, i32* %3
%7 = and i32 %6, 7
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = shl i32 %8, 3
%10 = or i32 64, %9
%11 = call i32 @pifacecad_lcd_send_command(i32 %10)
store i32 0, i32* %5
br label %12
12: ; preds = %22, %2
%13 = load i32, i32* %5
%14 = icmp slt i32 %13, 8
br i1 %14, label %15, label %25
15: ; preds = %12
%16 = load i32*, i32** %4
%17 = load i32, i32* %5
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i32, i32* %16, i64 %18
%20 = load i32, i32* %19
%21 = call i32 @pifacecad_lcd_send_data(i32 %20)
br label %22
22: ; preds = %15
%23 = load i32, i32* %5
%24 = add nsw i32 %23, 1
store i32 %24, i32* %5
br label %12
25: ; preds = %12
ret void
}

LLVM IR (-O2):
define void @pifacecad_lcd_store_custom_bitmap(i32 %0, i32* nocapture %1) {
%3 = shl i32 %0, 3
%4 = and i32 %3, 56
%5 = or i32 %4, 64
%6 = tail call i32 @pifacecad_lcd_send_command(i32 %5)
%7 = load i32, i32* %1
%8 = tail call i32 @pifacecad_lcd_send_data(i32 %7)
%9 = getelementptr inbounds i32, i32* %1, i64 1
%10 = load i32, i32* %9
%11 = tail call i32 @pifacecad_lcd_send_data(i32 %10)
%12 = getelementptr inbounds i32, i32* %1, i64 2
%13 = load i32, i32* %12
%14 = tail call i32 @pifacecad_lcd_send_data(i32 %13)
%15 = getelementptr inbounds i32, i32* %1, i64 3
%16 = load i32, i32* %15
%17 = tail call i32 @pifacecad_lcd_send_data(i32 %16)
%18 = getelementptr inbounds i32, i32* %1, i64 4
%19 = load i32, i32* %18
%20 = tail call i32 @pifacecad_lcd_send_data(i32 %19)
%21 = getelementptr inbounds i32, i32* %1, i64 5
%22 = load i32, i32* %21
%23 = tail call i32 @pifacecad_lcd_send_data(i32 %22)
%24 = getelementptr inbounds i32, i32* %1, i64 6
%25 = load i32, i32* %24
%26 = tail call i32 @pifacecad_lcd_send_data(i32 %25)
%27 = getelementptr inbounds i32, i32* %1, i64 7
%28 = load i32, i32* %27
%29 = tail call i32 @pifacecad_lcd_send_data(i32 %28)
ret void
}