#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 */

/* Variables and functions */
int /*<<< orphan*/ LCDdriver_WriteCom(int);
int /*<<< orphan*/ LCDdriver_WriteData(int);
void LCD_WriteBitMap8x15(int x, int y, int height, int width,
                         unsigned char *pBitMap, int color) {
  int xmax = x + width - 1;
  int ymax = y + height - 1;
  int iRow, iCol;
  unsigned char ucRowData;
  LCDdriver_WriteCom(0x2a);
  LCDdriver_WriteData(x);
  LCDdriver_WriteData(xmax);
  LCDdriver_WriteCom(0x2b);
  LCDdriver_WriteData(y);
  LCDdriver_WriteData(ymax);
  LCDdriver_WriteCom(0x2c);
  for (iRow = 0; iRow < height; iRow++) {
    ucRowData = *pBitMap++;
    for (iCol = 0; iCol < width; iCol++) {
      if (ucRowData & 0x80) {
        LCDdriver_WriteData(color >> 8);
        LCDdriver_WriteData(color);
      } else {
        LCDdriver_WriteData(0x00);
        LCDdriver_WriteData(0x00);
      }
      ucRowData = ucRowData << 1;
    }
  }
}


x86 assembly (clang, -O0):
<LCD_WriteBitMap8x15>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
mov    -0x4(%rbp),%eax
add    -0x10(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    $0x2a,%edi
call   1040 <LCDdriver_WriteCom@plt>
mov    -0x4(%rbp),%edi
call   1030 <LCDdriver_WriteData@plt>
mov    -0x20(%rbp),%edi
call   1030 <LCDdriver_WriteData@plt>
mov    $0x2b,%edi
call   1040 <LCDdriver_WriteCom@plt>
mov    -0x8(%rbp),%edi
call   1030 <LCDdriver_WriteData@plt>
mov    -0x24(%rbp),%edi
call   1030 <LCDdriver_WriteData@plt>
mov    $0x2c,%edi
call   1040 <LCDdriver_WriteCom@plt>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    122f <LCD_WriteBitMap8x15+0x10f>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
mov    (%rax),%al
mov    %al,-0x2d(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    121c <LCD_WriteBitMap8x15+0xfc>
movzbl -0x2d(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     11f6 <LCD_WriteBitMap8x15+0xd6>
mov    -0x1c(%rbp),%edi
sar    $0x8,%edi
call   1030 <LCDdriver_WriteData@plt>
mov    -0x1c(%rbp),%edi
call   1030 <LCDdriver_WriteData@plt>
jmp    1204 <LCD_WriteBitMap8x15+0xe4>
xor    %edi,%edi
call   1030 <LCDdriver_WriteData@plt>
xor    %edi,%edi
call   1030 <LCDdriver_WriteData@plt>
movzbl -0x2d(%rbp),%eax
shl    $0x1,%eax
mov    %al,-0x2d(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11c0 <LCD_WriteBitMap8x15+0xa0>
jmp    1221 <LCD_WriteBitMap8x15+0x101>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1199 <LCD_WriteBitMap8x15+0x79>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LCD_WriteBitMap8x15>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r9d,%r13d
mov    %r8,0x18(%rsp)
mov    %edx,%ebx
mov    %esi,%r14d
mov    %edi,%ebp
mov    %rcx,0x10(%rsp)
lea    (%rcx,%rbp,1),%r12d
add    $0xffffffff,%r12d
lea    (%r14,%rbx,1),%r15d
add    $0xffffffff,%r15d
mov    $0x2a,%edi
call   1040 <LCDdriver_WriteCom@plt>
mov    %ebp,%edi
call   1030 <LCDdriver_WriteData@plt>
mov    %r12d,%edi
call   1030 <LCDdriver_WriteData@plt>
mov    $0x2b,%edi
call   1040 <LCDdriver_WriteCom@plt>
mov    %r14d,%edi
call   1030 <LCDdriver_WriteData@plt>
mov    %r15d,%edi
call   1030 <LCDdriver_WriteData@plt>
mov    $0x2c,%edi
call   1040 <LCDdriver_WriteCom@plt>
mov    %rbx,0x20(%rsp)
test   %ebx,%ebx
jle    1207 <LCD_WriteBitMap8x15+0xe7>
mov    %r13d,%ebx
sar    $0x8,%ebx
xor    %r12d,%r12d
xor    %eax,%eax
jmp    11c3 <LCD_WriteBitMap8x15+0xa3>
cs nopw 0x0(%rax,%rax,1)
nop
addq   $0x1,0x18(%rsp)
mov    0xc(%rsp),%eax
add    $0x1,%eax
cmp    0x20(%rsp),%eax
je     1207 <LCD_WriteBitMap8x15+0xe7>
mov    %eax,0xc(%rsp)
cmpl   $0x0,0x10(%rsp)
jle    11b0 <LCD_WriteBitMap8x15+0x90>
mov    0x18(%rsp),%rax
mov    (%rax),%r14b
mov    0x10(%rsp),%rax
mov    %eax,%r15d
xchg   %ax,%ax
test   %r14b,%r14b
mov    %ebx,%edi
cmovns %r12d,%edi
mov    %r13d,%ebp
cmovns %r12d,%ebp
call   1030 <LCDdriver_WriteData@plt>
mov    %ebp,%edi
call   1030 <LCDdriver_WriteData@plt>
add    %r14b,%r14b
add    $0xffffffff,%r15d
jne    11e0 <LCD_WriteBitMap8x15+0xc0>
jmp    11b0 <LCD_WriteBitMap8x15+0x90>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @LCD_WriteBitMap8x15(i32 %0, i32 %1, i32 %2, i32 %3, i8* %4, i32 %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i8
store i32 %0, i32* %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i8* %4, i8** %11
store i32 %5, i32* %12
%18 = load i32, i32* %7
%19 = load i32, i32* %10
%20 = add nsw i32 %18, %19
%21 = sub nsw i32 %20, 1
store i32 %21, i32* %13
%22 = load i32, i32* %8
%23 = load i32, i32* %9
%24 = add nsw i32 %22, %23
%25 = sub nsw i32 %24, 1
store i32 %25, i32* %14
%26 = call i32 @LCDdriver_WriteCom(i32 42)
%27 = load i32, i32* %7
%28 = call i32 @LCDdriver_WriteData(i32 %27)
%29 = load i32, i32* %13
%30 = call i32 @LCDdriver_WriteData(i32 %29)
%31 = call i32 @LCDdriver_WriteCom(i32 43)
%32 = load i32, i32* %8
%33 = call i32 @LCDdriver_WriteData(i32 %32)
%34 = load i32, i32* %14
%35 = call i32 @LCDdriver_WriteData(i32 %34)
%36 = call i32 @LCDdriver_WriteCom(i32 44)
store i32 0, i32* %15
br label %37
37: ; preds = %72, %6
%38 = load i32, i32* %15
%39 = load i32, i32* %9
%40 = icmp slt i32 %38, %39
br i1 %40, label %41, label %75
41: ; preds = %37
%42 = load i8*, i8** %11
%43 = getelementptr inbounds i8, i8* %42, i32 1
store i8* %43, i8** %11
%44 = load i8, i8* %42
store i8 %44, i8* %17
store i32 0, i32* %16
br label %45
45: ; preds = %68, %41
%46 = load i32, i32* %16
%47 = load i32, i32* %10
%48 = icmp slt i32 %46, %47
br i1 %48, label %49, label %71
49: ; preds = %45
%50 = load i8, i8* %17
%51 = zext i8 %50 to i32
%52 = and i32 %51, 128
%53 = icmp ne i32 %52, 0
br i1 %53, label %54, label %60
54: ; preds = %49
%55 = load i32, i32* %12
%56 = ashr i32 %55, 8
%57 = call i32 @LCDdriver_WriteData(i32 %56)
%58 = load i32, i32* %12
%59 = call i32 @LCDdriver_WriteData(i32 %58)
br label %63
60: ; preds = %49
%61 = call i32 @LCDdriver_WriteData(i32 0)
%62 = call i32 @LCDdriver_WriteData(i32 0)
br label %63
63: ; preds = %60, %54
%64 = load i8, i8* %17
%65 = zext i8 %64 to i32
%66 = shl i32 %65, 1
%67 = trunc i32 %66 to i8
store i8 %67, i8* %17
br label %68
68: ; preds = %63
%69 = load i32, i32* %16
%70 = add nsw i32 %69, 1
store i32 %70, i32* %16
br label %45
71: ; preds = %45
br label %72
72: ; preds = %71
%73 = load i32, i32* %15
%74 = add nsw i32 %73, 1
store i32 %74, i32* %15
br label %37
75: ; preds = %37
ret void
}

LLVM IR (-O2):
define void @LCD_WriteBitMap8x15(i32 %0, i32 %1, i32 %2, i32 %3, i8* nocapture %4, i32 %5) {
%7 = add i32 %0, -1
%8 = add i32 %7, %3
%9 = add i32 %1, -1
%10 = add i32 %9, %2
%11 = tail call i32 @LCDdriver_WriteCom(i32 42)
%12 = tail call i32 @LCDdriver_WriteData(i32 %0)
%13 = tail call i32 @LCDdriver_WriteData(i32 %8)
%14 = tail call i32 @LCDdriver_WriteCom(i32 43)
%15 = tail call i32 @LCDdriver_WriteData(i32 %1)
%16 = tail call i32 @LCDdriver_WriteData(i32 %10)
%17 = tail call i32 @LCDdriver_WriteCom(i32 44)
%18 = icmp sgt i32 %2, 0
br i1 %18, label %19, label %42
19: ; preds = %6
%20 = icmp sgt i32 %3, 0
%21 = ashr i32 %5, 8
br label %22
22: ; preds = %19, %39
%23 = phi i32 [ 0, %19 ], [ %40, %39 ]
%24 = phi i8* [ %4, %19 ], [ %25, %39 ]
%25 = getelementptr inbounds i8, i8* %24, i64 1
br i1 %20, label %26, label %39
26: ; preds = %22
%27 = load i8, i8* %24
br label %28
28: ; preds = %26, %28
%29 = phi i8 [ %36, %28 ], [ %27, %26 ]
%30 = phi i32 [ %37, %28 ], [ 0, %26 ]
%31 = icmp sgt i8 %29, -1
%32 = select i1 %31, i32 0, i32 %21
%33 = select i1 %31, i32 0, i32 %5
%34 = tail call i32 @LCDdriver_WriteData(i32 %32)
%35 = tail call i32 @LCDdriver_WriteData(i32 %33)
%36 = shl i8 %29, 1
%37 = add nuw nsw i32 %30, 1
%38 = icmp eq i32 %37, %3
br i1 %38, label %39, label %28
39: ; preds = %28, %22
%40 = add nuw nsw i32 %23, 1
%41 = icmp eq i32 %40, %2
br i1 %41, label %42, label %22
42: ; preds = %39, %6
ret void
}