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

/* Variables and functions */
int /*<<< orphan*/ WriteCommand(int);
int /*<<< orphan*/ WriteData(unsigned long);
void Formike128x128x16PixelDrawMultiple(void *pvDisplayData, long lX, long lY,
                                        long lX0, long lCount, long lBPP,
                                        const unsigned char *pucData,
                                        const unsigned char *pucPalette) {
  unsigned long ulByte;
  WriteCommand(0x2a);
  WriteData(lX);
  WriteData(lX + lCount - 1);
  WriteCommand(0x2b);
  WriteData(lY + 1);
  WriteData(lY + 1);
  WriteCommand(0x2c);
  switch (lBPP) {
  case 1: {
    while (lCount) {
      ulByte = *pucData++;
      for (; (lX0 < 8) && lCount; lX0++, lCount--) {
        lBPP = ((unsigned long *)pucPalette)[(ulByte >> (7 - lX0)) & 1];
        WriteData(lBPP >> 8);
        WriteData(lBPP);
      }
      lX0 = 0;
    }
    break;
  }
  case 4: {
    switch (lX0 & 1) {
    case 0:
      while (lCount) {
        ulByte = (*pucData >> 4) * 3;
        ulByte = (*(unsigned long *)(pucPalette + ulByte) & 0x00ffffff);
        ulByte = ((((ulByte)&0x00ff0000) >> 19) |
                  ((((ulByte)&0x0000ff00) >> 5) & 0x000007e0) |
                  ((((ulByte)&0x000000ff) << 8) & 0x0000f800));
        WriteData(ulByte >> 8);
        WriteData(ulByte);
        lCount--;
        if (lCount) {
        case 1:
          ulByte = (*pucData++ & 15) * 3;
          ulByte = (*(unsigned long *)(pucPalette + ulByte) & 0x00ffffff);
          ulByte = ((((ulByte)&0x00ff0000) >> 19) |
                    ((((ulByte)&0x0000ff00) >> 5) & 0x000007e0) |
                    ((((ulByte)&0x000000ff) << 8) & 0x0000f800));
          WriteData(ulByte >> 8);
          WriteData(ulByte);
          lCount--;
        }
      }
    }
    break;
  }
  case 8: {
    while (lCount--) {
      ulByte = *pucData++ * 3;
      ulByte = *(unsigned long *)(pucPalette + ulByte) & 0x00ffffff;
      ulByte = ((((ulByte)&0x00ff0000) >> 19) |
                ((((ulByte)&0x0000ff00) >> 5) & 0x000007e0) |
                ((((ulByte)&0x000000ff) << 8) & 0x0000f800));
      WriteData(ulByte >> 8);
      WriteData(ulByte);
    }
    break;
  }
  }
}


x86 assembly (clang, -O0):
<Formike128x128x16PixelDrawMultiple>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    $0x2a,%edi
call   1040 <WriteCommand@plt>
mov    -0x10(%rbp),%rdi
call   1030 <WriteData@plt>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
lea    -0x1(%rax,%rcx,1),%rdi
call   1030 <WriteData@plt>
mov    $0x2b,%edi
call   1040 <WriteCommand@plt>
mov    -0x18(%rbp),%rdi
add    $0x1,%rdi
call   1030 <WriteData@plt>
mov    -0x18(%rbp),%rdi
add    $0x1,%rdi
call   1030 <WriteData@plt>
mov    $0x2c,%edi
call   1040 <WriteCommand@plt>
mov    -0x30(%rbp),%rax
mov    %rax,-0x40(%rbp)
sub    $0x1,%rax
je     11d8 <Formike128x128x16PixelDrawMultiple+0xb8>
jmp    11b2 <Formike128x128x16PixelDrawMultiple+0x92>
mov    -0x40(%rbp),%rax
sub    $0x4,%rax
je     1291 <Formike128x128x16PixelDrawMultiple+0x171>
jmp    11c5 <Formike128x128x16PixelDrawMultiple+0xa5>
mov    -0x40(%rbp),%rax
sub    $0x8,%rax
je     1413 <Formike128x128x16PixelDrawMultiple+0x2f3>
jmp    14c6 <Formike128x128x16PixelDrawMultiple+0x3a6>
jmp    11dd <Formike128x128x16PixelDrawMultiple+0xbd>
cmpq   $0x0,-0x28(%rbp)
je     128c <Formike128x128x16PixelDrawMultiple+0x16c>
mov    0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,0x10(%rbp)
movzbl (%rax),%eax
mov    %rax,-0x38(%rbp)
xor    %eax,%eax
cmpq   $0x8,-0x20(%rbp)
mov    %al,-0x41(%rbp)
jge    1219 <Formike128x128x16PixelDrawMultiple+0xf9>
cmpq   $0x0,-0x28(%rbp)
setne  %al
mov    %al,-0x41(%rbp)
mov    -0x41(%rbp),%al
test   $0x1,%al
jne    1229 <Formike128x128x16PixelDrawMultiple+0x109>
jmp    127f <Formike128x128x16PixelDrawMultiple+0x15f>
mov    0x18(%rbp),%rax
mov    -0x38(%rbp),%rdx
mov    $0x7,%ecx
sub    -0x20(%rbp),%rcx
shr    %cl,%rdx
mov    %rdx,%rcx
and    $0x1,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
sar    $0x8,%rdi
call   1030 <WriteData@plt>
mov    -0x30(%rbp),%rdi
call   1030 <WriteData@plt>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x28(%rbp)
jmp    11fe <Formike128x128x16PixelDrawMultiple+0xde>
movq   $0x0,-0x20(%rbp)
jmp    11dd <Formike128x128x16PixelDrawMultiple+0xbd>
jmp    14c6 <Formike128x128x16PixelDrawMultiple+0x3a6>
mov    -0x20(%rbp),%rax
and    $0x1,%rax
mov    %rax,-0x50(%rbp)
je     12bb <Formike128x128x16PixelDrawMultiple+0x19b>
jmp    12a8 <Formike128x128x16PixelDrawMultiple+0x188>
mov    -0x50(%rbp),%rax
sub    $0x1,%rax
je     136a <Formike128x128x16PixelDrawMultiple+0x24a>
jmp    140e <Formike128x128x16PixelDrawMultiple+0x2ee>
jmp    12c0 <Formike128x128x16PixelDrawMultiple+0x1a0>
cmpq   $0x0,-0x28(%rbp)
je     1409 <Formike128x128x16PixelDrawMultiple+0x2e9>
mov    0x10(%rbp),%rax
movzbl (%rax),%eax
sar    $0x4,%eax
imul   $0x3,%eax,%eax
cltq
mov    %rax,-0x38(%rbp)
mov    0x18(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    (%rax,%rcx,1),%rax
and    $0xffffff,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
and    $0xff0000,%rax
shr    $0x13,%rax
mov    -0x38(%rbp),%rcx
and    $0xff00,%rcx
shr    $0x5,%rcx
and    $0x7e0,%rcx
or     %rcx,%rax
mov    -0x38(%rbp),%rcx
and    $0xff,%rcx
shl    $0x8,%rcx
and    $0xf800,%rcx
or     %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
shr    $0x8,%rdi
call   1030 <WriteData@plt>
mov    -0x38(%rbp),%rdi
call   1030 <WriteData@plt>
mov    -0x28(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1404 <Formike128x128x16PixelDrawMultiple+0x2e4>
jmp    136a <Formike128x128x16PixelDrawMultiple+0x24a>
mov    0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,0x10(%rbp)
movzbl (%rax),%eax
and    $0xf,%eax
imul   $0x3,%eax,%eax
cltq
mov    %rax,-0x38(%rbp)
mov    0x18(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    (%rax,%rcx,1),%rax
and    $0xffffff,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
and    $0xff0000,%rax
shr    $0x13,%rax
mov    -0x38(%rbp),%rcx
and    $0xff00,%rcx
shr    $0x5,%rcx
and    $0x7e0,%rcx
or     %rcx,%rax
mov    -0x38(%rbp),%rcx
and    $0xff,%rcx
shl    $0x8,%rcx
and    $0xf800,%rcx
or     %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
shr    $0x8,%rdi
call   1030 <WriteData@plt>
mov    -0x38(%rbp),%rdi
call   1030 <WriteData@plt>
mov    -0x28(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x28(%rbp)
jmp    12c0 <Formike128x128x16PixelDrawMultiple+0x1a0>
jmp    140e <Formike128x128x16PixelDrawMultiple+0x2ee>
jmp    14c6 <Formike128x128x16PixelDrawMultiple+0x3a6>
jmp    1418 <Formike128x128x16PixelDrawMultiple+0x2f8>
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x28(%rbp)
cmp    $0x0,%rax
je     14c1 <Formike128x128x16PixelDrawMultiple+0x3a1>
mov    0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,0x10(%rbp)
movzbl (%rax),%eax
imul   $0x3,%eax,%eax
cltq
mov    %rax,-0x38(%rbp)
mov    0x18(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    (%rax,%rcx,1),%rax
and    $0xffffff,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
and    $0xff0000,%rax
shr    $0x13,%rax
mov    -0x38(%rbp),%rcx
and    $0xff00,%rcx
shr    $0x5,%rcx
and    $0x7e0,%rcx
or     %rcx,%rax
mov    -0x38(%rbp),%rcx
and    $0xff,%rcx
shl    $0x8,%rcx
and    $0xf800,%rcx
or     %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
shr    $0x8,%rdi
call   1030 <WriteData@plt>
mov    -0x38(%rbp),%rdi
call   1030 <WriteData@plt>
jmp    1418 <Formike128x128x16PixelDrawMultiple+0x2f8>
jmp    14c6 <Formike128x128x16PixelDrawMultiple+0x3a6>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Formike128x128x16PixelDrawMultiple>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%r12
mov    %r8,%r14
mov    %rcx,%r15
mov    %rdx,%rbx
mov    %rsi,%rbp
mov    0x48(%rsp),%r13
mov    $0x2a,%edi
call   1040 <WriteCommand@plt>
mov    %rbp,%rdi
call   1030 <WriteData@plt>
lea    (%r14,%rbp,1),%rdi
add    $0xffffffffffffffff,%rdi
call   1030 <WriteData@plt>
mov    $0x2b,%edi
call   1040 <WriteCommand@plt>
add    $0x1,%rbx
mov    %rbx,%rdi
call   1030 <WriteData@plt>
mov    %rbx,%rdi
call   1030 <WriteData@plt>
mov    $0x2c,%edi
call   1040 <WriteCommand@plt>
cmp    $0x1,%r12
je     1201 <Formike128x128x16PixelDrawMultiple+0xe1>
cmp    $0x4,%r12
je     1295 <Formike128x128x16PixelDrawMultiple+0x175>
cmp    $0x8,%r12
mov    0x40(%rsp),%r15
jne    120b <Formike128x128x16PixelDrawMultiple+0xeb>
test   %r14,%r14
je     120b <Formike128x128x16PixelDrawMultiple+0xeb>
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
movzbl (%r15,%rbp,1),%eax
lea    (%rax,%rax,2),%rax
mov    0x0(%r13,%rax,1),%rbx
mov    %ebx,%eax
shr    $0x13,%eax
and    $0x1f,%eax
mov    %rbx,%rcx
shr    $0x5,%rcx
and    $0x7e0,%ecx
or     %rax,%rcx
shl    $0x8,%ebx
and    $0xf800,%ebx
or     %rcx,%rbx
mov    %rbx,%rdi
shr    $0x8,%rdi
call   1030 <WriteData@plt>
mov    %rbx,%rdi
call   1030 <WriteData@plt>
add    $0x1,%rbp
cmp    %rbp,%r14
jne    11b0 <Formike128x128x16PixelDrawMultiple+0x90>
jmp    120b <Formike128x128x16PixelDrawMultiple+0xeb>
test   %r14,%r14
mov    0x40(%rsp),%rax
jne    1235 <Formike128x128x16PixelDrawMultiple+0x115>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
nopw   0x0(%rax,%rax,1)
mov    %r14,%rax
mov    $0x0,%r15d
mov    %rax,%r14
test   %rax,%rax
mov    (%rsp),%rax
je     120b <Formike128x128x16PixelDrawMultiple+0xeb>
movzbl (%rax),%ebp
add    $0x1,%rax
mov    %rax,(%rsp)
cmp    $0x7,%r15
jg     1220 <Formike128x128x16PixelDrawMultiple+0x100>
mov    $0x7,%ebx
sub    %r15,%rbx
xchg   %ax,%ax
mov    %rbp,%rax
mov    %ebx,%ecx
shr    %cl,%rax
mov    %r15,%r12
and    $0x1,%eax
mov    0x0(%r13,%rax,8),%r15
mov    %r15,%rdi
sar    $0x8,%rdi
call   1030 <WriteData@plt>
mov    %r15,%rdi
call   1030 <WriteData@plt>
lea    0x1(%r12),%r15
lea    -0x1(%r14),%rax
add    $0xffffffffffffffff,%rbx
cmp    $0x6,%r12
jg     1223 <Formike128x128x16PixelDrawMultiple+0x103>
cmp    $0x1,%r14
mov    %rax,%r14
jne    1250 <Formike128x128x16PixelDrawMultiple+0x130>
jmp    1223 <Formike128x128x16PixelDrawMultiple+0x103>
test   $0x1,%r15b
mov    0x40(%rsp),%r15
jne    1310 <Formike128x128x16PixelDrawMultiple+0x1f0>
mov    %r14,%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
test   %rbp,%rbp
je     120b <Formike128x128x16PixelDrawMultiple+0xeb>
movzbl (%r15),%eax
shr    $0x4,%rax
lea    (%rax,%rax,2),%rax
mov    0x0(%r13,%rax,1),%rbx
mov    %ebx,%eax
shr    $0x13,%eax
and    $0x1f,%eax
mov    %rbx,%rcx
shr    $0x5,%rcx
and    $0x7e0,%ecx
or     %rax,%rcx
shl    $0x8,%ebx
and    $0xf800,%ebx
or     %rcx,%rbx
mov    %rbx,%rdi
shr    $0x8,%rdi
call   1030 <WriteData@plt>
mov    %rbx,%rdi
call   1030 <WriteData@plt>
mov    %rbp,%r14
mov    $0x0,%ebp
add    $0xffffffffffffffff,%r14
je     12b0 <Formike128x128x16PixelDrawMultiple+0x190>
movzbl (%r15),%eax
add    $0x1,%r15
and    $0xf,%eax
lea    (%rax,%rax,2),%rax
mov    0x0(%r13,%rax,1),%rbx
mov    %ebx,%eax
shr    $0x13,%eax
and    $0x1f,%eax
mov    %rbx,%rcx
shr    $0x5,%rcx
and    $0x7e0,%ecx
or     %rax,%rcx
shl    $0x8,%ebx
and    $0xf800,%ebx
or     %rcx,%rbx
mov    %rbx,%rdi
shr    $0x8,%rdi
call   1030 <WriteData@plt>
mov    %rbx,%rdi
call   1030 <WriteData@plt>
add    $0xffffffffffffffff,%r14
jmp    12a0 <Formike128x128x16PixelDrawMultiple+0x180>

LLVM IR (-O0):
define void @Formike128x128x16PixelDrawMultiple(i8* %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5, i8* %6, i8* %7) {
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
%14 = alloca i64
%15 = alloca i8*
%16 = alloca i8*
%17 = alloca i64
store i8* %0, i8** %9
store i64 %1, i64* %10
store i64 %2, i64* %11
store i64 %3, i64* %12
store i64 %4, i64* %13
store i64 %5, i64* %14
store i8* %6, i8** %15
store i8* %7, i8** %16
%18 = call i32 @WriteCommand(i32 42)
%19 = load i64, i64* %10
%20 = call i32 @WriteData(i64 %19)
%21 = load i64, i64* %10
%22 = load i64, i64* %13
%23 = add nsw i64 %21, %22
%24 = sub nsw i64 %23, 1
%25 = call i32 @WriteData(i64 %24)
%26 = call i32 @WriteCommand(i32 43)
%27 = load i64, i64* %11
%28 = add nsw i64 %27, 1
%29 = call i32 @WriteData(i64 %28)
%30 = load i64, i64* %11
%31 = add nsw i64 %30, 1
%32 = call i32 @WriteData(i64 %31)
%33 = call i32 @WriteCommand(i32 44)
%34 = load i64, i64* %14
switch i64 %34, label %191 [
i64 1, label %35
i64 4, label %74
i64 8, label %154
]
35: ; preds = %8
br label %36
36: ; preds = %72, %35
%37 = load i64, i64* %13
%38 = icmp ne i64 %37, 0
br i1 %38, label %39, label %73
39: ; preds = %36
%40 = load i8*, i8** %15
%41 = getelementptr inbounds i8, i8* %40, i32 1
store i8* %41, i8** %15
%42 = load i8, i8* %40
%43 = zext i8 %42 to i64
store i64 %43, i64* %17
br label %44
44: ; preds = %67, %39
%45 = load i64, i64* %12
%46 = icmp slt i64 %45, 8
br i1 %46, label %47, label %50
47: ; preds = %44
%48 = load i64, i64* %13
%49 = icmp ne i64 %48, 0
br label %50
50: ; preds = %47, %44
%51 = phi i1 [ false, %44 ], [ %49, %47 ]
br i1 %51, label %52, label %72
52: ; preds = %50
%53 = load i8*, i8** %16
%54 = bitcast i8* %53 to i64*
%55 = load i64, i64* %17
%56 = load i64, i64* %12
%57 = sub nsw i64 7, %56
%58 = lshr i64 %55, %57
%59 = and i64 %58, 1
%60 = getelementptr inbounds i64, i64* %54, i64 %59
%61 = load i64, i64* %60
store i64 %61, i64* %14
%62 = load i64, i64* %14
%63 = ashr i64 %62, 8
%64 = call i32 @WriteData(i64 %63)
%65 = load i64, i64* %14
%66 = call i32 @WriteData(i64 %65)
br label %67
67: ; preds = %52
%68 = load i64, i64* %12
%69 = add nsw i64 %68, 1
store i64 %69, i64* %12
%70 = load i64, i64* %13
%71 = add nsw i64 %70, -1
store i64 %71, i64* %13
br label %44
72: ; preds = %50
store i64 0, i64* %12
br label %36
73: ; preds = %36
br label %191
74: ; preds = %8
%75 = load i64, i64* %12
%76 = and i64 %75, 1
switch i64 %76, label %153 [
i64 0, label %77
i64 1, label %117
]
77: ; preds = %74
br label %78
78: ; preds = %151, %77
%79 = load i64, i64* %13
%80 = icmp ne i64 %79, 0
br i1 %80, label %81, label %152
81: ; preds = %78
%82 = load i8*, i8** %15
%83 = load i8, i8* %82
%84 = zext i8 %83 to i32
%85 = ashr i32 %84, 4
%86 = mul nsw i32 %85, 3
%87 = sext i32 %86 to i64
store i64 %87, i64* %17
%88 = load i8*, i8** %16
%89 = load i64, i64* %17
%90 = getelementptr inbounds i8, i8* %88, i64 %89
%91 = bitcast i8* %90 to i64*
%92 = load i64, i64* %91
%93 = and i64 %92, 16777215
store i64 %93, i64* %17
%94 = load i64, i64* %17
%95 = and i64 %94, 16711680
%96 = lshr i64 %95, 19
%97 = load i64, i64* %17
%98 = and i64 %97, 65280
%99 = lshr i64 %98, 5
%100 = and i64 %99, 2016
%101 = or i64 %96, %100
%102 = load i64, i64* %17
%103 = and i64 %102, 255
%104 = shl i64 %103, 8
%105 = and i64 %104, 63488
%106 = or i64 %101, %105
store i64 %106, i64* %17
%107 = load i64, i64* %17
%108 = lshr i64 %107, 8
%109 = call i32 @WriteData(i64 %108)
%110 = load i64, i64* %17
%111 = call i32 @WriteData(i64 %110)
%112 = load i64, i64* %13
%113 = add nsw i64 %112, -1
store i64 %113, i64* %13
%114 = load i64, i64* %13
%115 = icmp ne i64 %114, 0
br i1 %115, label %116, label %151
116: ; preds = %81
br label %117
117: ; preds = %74, %116
%118 = load i8*, i8** %15
%119 = getelementptr inbounds i8, i8* %118, i32 1
store i8* %119, i8** %15
%120 = load i8, i8* %118
%121 = zext i8 %120 to i32
%122 = and i32 %121, 15
%123 = mul nsw i32 %122, 3
%124 = sext i32 %123 to i64
store i64 %124, i64* %17
%125 = load i8*, i8** %16
%126 = load i64, i64* %17
%127 = getelementptr inbounds i8, i8* %125, i64 %126
%128 = bitcast i8* %127 to i64*
%129 = load i64, i64* %128
%130 = and i64 %129, 16777215
store i64 %130, i64* %17
%131 = load i64, i64* %17
%132 = and i64 %131, 16711680
%133 = lshr i64 %132, 19
%134 = load i64, i64* %17
%135 = and i64 %134, 65280
%136 = lshr i64 %135, 5
%137 = and i64 %136, 2016
%138 = or i64 %133, %137
%139 = load i64, i64* %17
%140 = and i64 %139, 255
%141 = shl i64 %140, 8
%142 = and i64 %141, 63488
%143 = or i64 %138, %142
store i64 %143, i64* %17
%144 = load i64, i64* %17
%145 = lshr i64 %144, 8
%146 = call i32 @WriteData(i64 %145)
%147 = load i64, i64* %17
%148 = call i32 @WriteData(i64 %147)
%149 = load i64, i64* %13
%150 = add nsw i64 %149, -1
store i64 %150, i64* %13
br label %151
151: ; preds = %117, %81
br label %78
152: ; preds = %78
br label %153
153: ; preds = %152, %74
br label %191
154: ; preds = %8
br label %155
155: ; preds = %159, %154
%156 = load i64, i64* %13
%157 = add nsw i64 %156, -1
store i64 %157, i64* %13
%158 = icmp ne i64 %156, 0
br i1 %158, label %159, label %190
159: ; preds = %155
%160 = load i8*, i8** %15
%161 = getelementptr inbounds i8, i8* %160, i32 1
store i8* %161, i8** %15
%162 = load i8, i8* %160
%163 = zext i8 %162 to i32
%164 = mul nsw i32 %163, 3
%165 = sext i32 %164 to i64
store i64 %165, i64* %17
%166 = load i8*, i8** %16
%167 = load i64, i64* %17
%168 = getelementptr inbounds i8, i8* %166, i64 %167
%169 = bitcast i8* %168 to i64*
%170 = load i64, i64* %169
%171 = and i64 %170, 16777215
store i64 %171, i64* %17
%172 = load i64, i64* %17
%173 = and i64 %172, 16711680
%174 = lshr i64 %173, 19
%175 = load i64, i64* %17
%176 = and i64 %175, 65280
%177 = lshr i64 %176, 5
%178 = and i64 %177, 2016
%179 = or i64 %174, %178
%180 = load i64, i64* %17
%181 = and i64 %180, 255
%182 = shl i64 %181, 8
%183 = and i64 %182, 63488
%184 = or i64 %179, %183
store i64 %184, i64* %17
%185 = load i64, i64* %17
%186 = lshr i64 %185, 8
%187 = call i32 @WriteData(i64 %186)
%188 = load i64, i64* %17
%189 = call i32 @WriteData(i64 %188)
br label %155
190: ; preds = %155
br label %191
191: ; preds = %8, %190, %153, %73
ret void
}

LLVM IR (-O2):
define void @Formike128x128x16PixelDrawMultiple(i8* nocapture readnone %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5, i8* nocapture %6, i8* nocapture %7) {
%9 = tail call i32 @WriteCommand(i32 42)
%10 = tail call i32 @WriteData(i64 %1)
%11 = add i64 %1, -1
%12 = add i64 %11, %4
%13 = tail call i32 @WriteData(i64 %12)
%14 = tail call i32 @WriteCommand(i32 43)
%15 = add nsw i64 %2, 1
%16 = tail call i32 @WriteData(i64 %15)
%17 = tail call i32 @WriteData(i64 %15)
%18 = tail call i32 @WriteCommand(i32 44)
switch i64 %5, label %128 [
i64 1, label %21
i64 4, label %52
i64 8, label %19
]
19: ; preds = %8
%20 = icmp eq i64 %4, 0
br i1 %20, label %128, label %105
21: ; preds = %8
%22 = icmp eq i64 %4, 0
br i1 %22, label %128, label %23
23: ; preds = %21
%24 = bitcast i8* %7 to i64*
br label %28
25: ; preds = %36, %28
%26 = phi i64 [ %31, %28 ], [ %48, %36 ]
%27 = icmp eq i64 %26, 0
br i1 %27, label %128, label %28
28: ; preds = %23, %25
%29 = phi i64 [ %3, %23 ], [ 0, %25 ]
%30 = phi i8* [ %6, %23 ], [ %32, %25 ]
%31 = phi i64 [ %4, %23 ], [ %26, %25 ]
%32 = getelementptr inbounds i8, i8* %30, i64 1
%33 = load i8, i8* %30
%34 = zext i8 %33 to i64
%35 = icmp slt i64 %29, 8
br i1 %35, label %36, label %25
36: ; preds = %28, %36
%37 = phi i64 [ %47, %36 ], [ %29, %28 ]
%38 = phi i64 [ %48, %36 ], [ %31, %28 ]
%39 = sub nsw i64 7, %37
%40 = lshr i64 %34, %39
%41 = and i64 %40, 1
%42 = getelementptr inbounds i64, i64* %24, i64 %41
%43 = load i64, i64* %42
%44 = ashr i64 %43, 8
%45 = tail call i32 @WriteData(i64 %44)
%46 = tail call i32 @WriteData(i64 %43)
%47 = add nsw i64 %37, 1
%48 = add nsw i64 %38, -1
%49 = icmp slt i64 %37, 7
%50 = icmp ne i64 %48, 0
%51 = select i1 %49, i1 %50, i1 false
br i1 %51, label %36, label %25
52: ; preds = %8
%53 = and i64 %3, 1
%54 = icmp eq i64 %53, 0
br i1 %54, label %55, label %82
55: ; preds = %52, %82
%56 = phi i64 [ %104, %82 ], [ %4, %52 ]
%57 = phi i8* [ %85, %82 ], [ %6, %52 ]
br label %58
58: ; preds = %55, %61
%59 = phi i64 [ 0, %61 ], [ %56, %55 ]
%60 = icmp eq i64 %59, 0
br i1 %60, label %128, label %61
61: ; preds = %58
%62 = load i8, i8* %57
%63 = lshr i8 %62, 4
%64 = mul nuw nsw i8 %63, 3
%65 = zext i8 %64 to i64
%66 = getelementptr inbounds i8, i8* %7, i64 %65
%67 = bitcast i8* %66 to i64*
%68 = load i64, i64* %67
%69 = lshr i64 %68, 19
%70 = and i64 %69, 31
%71 = lshr i64 %68, 5
%72 = and i64 %71, 2016
%73 = or i64 %70, %72
%74 = shl i64 %68, 8
%75 = and i64 %74, 63488
%76 = or i64 %73, %75
%77 = lshr i64 %76, 8
%78 = tail call i32 @WriteData(i64 %77)
%79 = tail call i32 @WriteData(i64 %76)
%80 = add nsw i64 %59, -1
%81 = icmp eq i64 %80, 0
br i1 %81, label %58, label %82
82: ; preds = %61, %52
%83 = phi i64 [ %4, %52 ], [ %80, %61 ]
%84 = phi i8* [ %6, %52 ], [ %57, %61 ]
%85 = getelementptr inbounds i8, i8* %84, i64 1
%86 = load i8, i8* %84
%87 = and i8 %86, 15
%88 = mul nuw nsw i8 %87, 3
%89 = zext i8 %88 to i64
%90 = getelementptr inbounds i8, i8* %7, i64 %89
%91 = bitcast i8* %90 to i64*
%92 = load i64, i64* %91
%93 = lshr i64 %92, 19
%94 = and i64 %93, 31
%95 = lshr i64 %92, 5
%96 = and i64 %95, 2016
%97 = or i64 %94, %96
%98 = shl i64 %92, 8
%99 = and i64 %98, 63488
%100 = or i64 %97, %99
%101 = lshr i64 %100, 8
%102 = tail call i32 @WriteData(i64 %101)
%103 = tail call i32 @WriteData(i64 %100)
%104 = add nsw i64 %83, -1
br label %55
105: ; preds = %19, %105
%106 = phi i8* [ %109, %105 ], [ %6, %19 ]
%107 = phi i64 [ %108, %105 ], [ %4, %19 ]
%108 = add nsw i64 %107, -1
%109 = getelementptr inbounds i8, i8* %106, i64 1
%110 = load i8, i8* %106
%111 = zext i8 %110 to i64
%112 = mul nuw nsw i64 %111, 3
%113 = getelementptr inbounds i8, i8* %7, i64 %112
%114 = bitcast i8* %113 to i64*
%115 = load i64, i64* %114
%116 = lshr i64 %115, 19
%117 = and i64 %116, 31
%118 = lshr i64 %115, 5
%119 = and i64 %118, 2016
%120 = or i64 %117, %119
%121 = shl i64 %115, 8
%122 = and i64 %121, 63488
%123 = or i64 %120, %122
%124 = lshr i64 %123, 8
%125 = tail call i32 @WriteData(i64 %124)
%126 = tail call i32 @WriteData(i64 %123)
%127 = icmp eq i64 %108, 0
br i1 %127, label %128, label %105
128: ; preds = %105, %58, %25, %19, %21, %8
ret void
}