#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*/ GLCD_GoTo(unsigned char, unsigned char);
int /*<<< orphan*/ GLCD_ReadByteFromROMMemory(int /*<<< orphan*/);
int /*<<< orphan*/ GLCD_WriteData(int /*<<< orphan*/);
void GLCD_Bitmap(char *bmp, unsigned char x, unsigned char y, unsigned char dx,
                 unsigned char dy) {
  unsigned char i, j;
  for (j = 0; j < dy / 8; j++) {
    GLCD_GoTo(x, y + j);
    for (i = 0; i < dx; i++)
      GLCD_WriteData(GLCD_ReadByteFromROMMemory(bmp++));
  }
}


x86 assembly (clang, -O0):
<GLCD_Bitmap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %r8b,%al
mov    %rdi,-0x8(%rbp)
mov    %sil,-0x9(%rbp)
mov    %dl,-0xa(%rbp)
mov    %cl,-0xb(%rbp)
mov    %al,-0xc(%rbp)
movb   $0x0,-0xe(%rbp)
movzbl -0xe(%rbp),%eax
mov    %eax,-0x14(%rbp)
movzbl -0xc(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
cmp    %ecx,%eax
jge    11d8 <GLCD_Bitmap+0xa8>
mov    -0x9(%rbp),%cl
movzbl -0xa(%rbp),%eax
movzbl -0xe(%rbp),%edx
add    %edx,%eax
movzbl %cl,%edi
movzbl %al,%esi
call   1030 <GLCD_GoTo@plt>
movb   $0x0,-0xd(%rbp)
movzbl -0xd(%rbp),%eax
movzbl -0xb(%rbp),%ecx
cmp    %ecx,%eax
jge    11c6 <GLCD_Bitmap+0x96>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    %eax,%edi
call   1040 <GLCD_ReadByteFromROMMemory@plt>
mov    %eax,%edi
call   1050 <GLCD_WriteData@plt>
mov    -0xd(%rbp),%al
add    $0x1,%al
mov    %al,-0xd(%rbp)
jmp    118c <GLCD_Bitmap+0x5c>
jmp    11cb <GLCD_Bitmap+0x9b>
mov    -0xe(%rbp),%al
add    $0x1,%al
mov    %al,-0xe(%rbp)
jmp    1150 <GLCD_Bitmap+0x20>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GLCD_Bitmap>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %ecx,0xc(%rsp)
mov    %rdx,0x10(%rsp)
mov    %r8d,0x8(%rsp)
cmp    $0x8,%r8b
jae    1161 <GLCD_Bitmap+0x31>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rdi,%rbp
mov    0x8(%rsp),%eax
shr    $0x3,%al
mov    %eax,0x8(%rsp)
mov    0xc(%rsp),%eax
neg    %al
movzbl %al,%r14d
xor    %r15d,%r15d
movzbl %sil,%r13d
jmp    119b <GLCD_Bitmap+0x6b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%r15b
cmp    0x8(%rsp),%r15b
je     1152 <GLCD_Bitmap+0x22>
mov    0x10(%rsp),%rax
add    %r15d,%eax
movzbl %al,%esi
mov    %r13d,%edi
call   1030 <GLCD_GoTo@plt>
cmpb   $0x0,0xc(%rsp)
je     1190 <GLCD_Bitmap+0x60>
mov    %ebp,%ebx
xor    %r12d,%r12d
nopw   0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1040 <GLCD_ReadByteFromROMMemory@plt>
mov    %eax,%edi
call   1050 <GLCD_WriteData@plt>
add    $0xffffffffffffffff,%r12
add    $0x1,%ebx
cmp    %r12b,%r14b
jne    11c0 <GLCD_Bitmap+0x90>
sub    %r12,%rbp
jmp    1190 <GLCD_Bitmap+0x60>

LLVM IR (-O0):
define void @GLCD_Bitmap(i8* %0, i8 zeroext %1, i8 zeroext %2, i8 zeroext %3, i8 zeroext %4) {
%6 = alloca i8*
%7 = alloca i8
%8 = alloca i8
%9 = alloca i8
%10 = alloca i8
%11 = alloca i8
%12 = alloca i8
store i8* %0, i8** %6
store i8 %1, i8* %7
store i8 %2, i8* %8
store i8 %3, i8* %9
store i8 %4, i8* %10
store i8 0, i8* %12
br label %13
13: ; preds = %45, %5
%14 = load i8, i8* %12
%15 = zext i8 %14 to i32
%16 = load i8, i8* %10
%17 = zext i8 %16 to i32
%18 = sdiv i32 %17, 8
%19 = icmp slt i32 %15, %18
br i1 %19, label %20, label %48
20: ; preds = %13
%21 = load i8, i8* %7
%22 = load i8, i8* %8
%23 = zext i8 %22 to i32
%24 = load i8, i8* %12
%25 = zext i8 %24 to i32
%26 = add nsw i32 %23, %25
%27 = trunc i32 %26 to i8
%28 = call i32 @GLCD_GoTo(i8 zeroext %21, i8 zeroext %27)
store i8 0, i8* %11
br label %29
29: ; preds = %41, %20
%30 = load i8, i8* %11
%31 = zext i8 %30 to i32
%32 = load i8, i8* %9
%33 = zext i8 %32 to i32
%34 = icmp slt i32 %31, %33
br i1 %34, label %35, label %44
35: ; preds = %29
%36 = load i8*, i8** %6
%37 = getelementptr inbounds i8, i8* %36, i32 1
store i8* %37, i8** %6
%38 = ptrtoint i8* %36 to i32
%39 = call i32 @GLCD_ReadByteFromROMMemory(i32 %38)
%40 = call i32 @GLCD_WriteData(i32 %39)
br label %41
41: ; preds = %35
%42 = load i8, i8* %11
%43 = add i8 %42, 1
store i8 %43, i8* %11
br label %29
44: ; preds = %29
br label %45
45: ; preds = %44
%46 = load i8, i8* %12
%47 = add i8 %46, 1
store i8 %47, i8* %12
br label %13
48: ; preds = %13
ret void
}

LLVM IR (-O2):
define void @GLCD_Bitmap(i8* %0, i8 zeroext %1, i8 zeroext %2, i8 zeroext %3, i8 zeroext %4) {
%6 = icmp ult i8 %4, 8
br i1 %6, label %29, label %7
7: ; preds = %5
%8 = lshr i8 %4, 3
%9 = icmp eq i8 %3, 0
br label %10
10: ; preds = %7, %25
%11 = phi i8 [ 0, %7 ], [ %27, %25 ]
%12 = phi i8* [ %0, %7 ], [ %26, %25 ]
%13 = add i8 %11, %2
%14 = tail call i32 @GLCD_GoTo(i8 zeroext %1, i8 zeroext %13)
br i1 %9, label %25, label %15
15: ; preds = %10, %15
%16 = phi i8 [ %23, %15 ], [ 0, %10 ]
%17 = phi i8* [ %18, %15 ], [ %12, %10 ]
%18 = getelementptr inbounds i8, i8* %17, i64 1
%19 = ptrtoint i8* %17 to i64
%20 = trunc i64 %19 to i32
%21 = tail call i32 @GLCD_ReadByteFromROMMemory(i32 %20)
%22 = tail call i32 @GLCD_WriteData(i32 %21)
%23 = add nuw i8 %16, 1
%24 = icmp eq i8 %23, %3
br i1 %24, label %25, label %15
25: ; preds = %15, %10
%26 = phi i8* [ %12, %10 ], [ %18, %15 ]
%27 = add nuw nsw i8 %11, 1
%28 = icmp eq i8 %27, %8
br i1 %28, label %29, label %10
29: ; preds = %25, %5
ret void
}