#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 */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
typedef int /*<<< orphan*/ XImage;
struct TYPE_3__ {
  unsigned int byte1;
  unsigned int byte2;
};
typedef TYPE_1__ XChar2b;
typedef int /*<<< orphan*/ Pixmap;
typedef int GLubyte;
typedef int /*<<< orphan*/ GC;
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
int /*<<< orphan*/ XDestroyImage(int /*<<< orphan*/ *);
int /*<<< orphan*/ XDrawString16(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                 int /*<<< orphan*/, int, int, TYPE_1__ *, int);
int /*<<< orphan*/ XFillRectangle(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                  int /*<<< orphan*/, int /*<<< orphan*/,
                                  int /*<<< orphan*/, unsigned int,
                                  unsigned int);
int /*<<< orphan*/ *XGetImage(int /*<<< orphan*/ *, int /*<<< orphan*/,
                              int /*<<< orphan*/, int /*<<< orphan*/,
                              unsigned int, unsigned int, int,
                              int /*<<< orphan*/);
scalar_t__ XGetPixel(int /*<<< orphan*/ *, unsigned int, unsigned int);
int /*<<< orphan*/ XSetForeground(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                  int);
int /*<<< orphan*/ XYPixmap;
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ memset(int *, int /*<<< orphan*/, int const);
void fill_bitmap(Display *dpy, Pixmap pixmap, GC gc, unsigned int bitmapWidth,
                 unsigned int bitmapHeight, unsigned int charWidth,
                 unsigned int charHeight, int xPos, int yPos, unsigned int c,
                 GLubyte *bitmap, int rotation) {
  const int bytesPerRow = (bitmapWidth + 7) / 8;
  XImage *image;
  XChar2b char2b;
  XSetForeground(dpy, gc, 0);
  XFillRectangle(dpy, pixmap, gc, 0, 0, charWidth, charHeight);
  XSetForeground(dpy, gc, 1);
  char2b.byte1 = (c >> 8) & 0xff;
  char2b.byte2 = (c & 0xff);
  XDrawString16(dpy, pixmap, gc, xPos, yPos, &char2b, 1);
  memset(bitmap, 0, bytesPerRow * bitmapHeight);
  image = XGetImage(dpy, pixmap, 0, 0, charWidth, charHeight, 1, XYPixmap);
  if (image) {
    unsigned int x, y;
    if (rotation == 0) {
      for (y = 0; y < charHeight; y++) {
        for (x = 0; x < charWidth; x++) {
          if (XGetPixel(image, x, y)) {
            int y2 = bitmapHeight - y - 1;
            bitmap[bytesPerRow * y2 + x / 8] |= (1 << (7 - (x % 8)));
          }
        }
      }
    } else if (rotation == 90) {
      for (y = 0; y < charHeight; y++) {
        for (x = 0; x < charWidth; x++) {
          if (XGetPixel(image, x, y)) {
            int x2 = y;
            int y2 = x;
            bitmap[bytesPerRow * y2 + x2 / 8] |= (1 << (7 - (x2 % 8)));
          }
        }
      }
    } else if (rotation == 180) {
      for (y = 0; y < charHeight; y++) {
        for (x = 0; x < charWidth; x++) {
          if (XGetPixel(image, x, y)) {
            int x2 = charWidth - x - 1;
            bitmap[bytesPerRow * y + x2 / 8] |= (1 << (7 - (x2 % 8)));
          }
        }
      }
    } else {
      assert(rotation == 270);
      for (y = 0; y < charHeight; y++) {
        for (x = 0; x < charWidth; x++) {
          if (XGetPixel(image, x, y)) {
            int x2 = charHeight - y - 1;
            int y2 = charWidth - x - 1;
            bitmap[bytesPerRow * y2 + x2 / 8] |= (1 << (7 - (x2 % 8)));
          }
        }
      }
    }
    XDestroyImage(image);
  }
}


x86 assembly (clang, -O0):
<fill_bitmap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    0x38(%rbp),%eax
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
add    $0x7,%eax
shr    $0x3,%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
xor    %edx,%edx
call   1080 <XSetForeground@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x1c(%rbp),%r9d
mov    0x10(%rbp),%eax
xor    %r8d,%r8d
mov    %r8d,%ecx
mov    %eax,(%rsp)
call   1040 <XFillRectangle@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    $0x1,%edx
call   1080 <XSetForeground@plt>
mov    0x28(%rbp),%eax
shr    $0x8,%eax
and    $0xff,%eax
mov    %eax,-0x30(%rbp)
mov    0x28(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    0x18(%rbp),%ecx
mov    0x20(%rbp),%r8d
lea    -0x30(%rbp),%r9
movl   $0x1,(%rsp)
call   1090 <XDrawString16@plt>
mov    0x30(%rbp),%rdi
mov    -0x20(%rbp),%edx
imul   -0x18(%rbp),%edx
xor    %esi,%esi
call   1060 <memset@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x1c(%rbp),%r8d
mov    0x10(%rbp),%r9d
mov    0x2d81(%rip),%rax
mov    (%rax),%eax
xor    %ecx,%ecx
mov    %ecx,%edx
movl   $0x1,(%rsp)
mov    %eax,0x8(%rsp)
call   10a0 <XGetImage@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     15bc <fill_bitmap+0x43c>
cmpl   $0x0,0x38(%rbp)
jne    1333 <fill_bitmap+0x1b3>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    0x10(%rbp),%eax
jae    132e <fill_bitmap+0x1ae>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jae    131b <fill_bitmap+0x19b>
mov    -0x28(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    -0x38(%rbp),%edx
call   1030 <XGetPixel@plt>
cmp    $0x0,%rax
je     1308 <fill_bitmap+0x188>
mov    -0x18(%rbp),%eax
sub    -0x38(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x34(%rbp),%eax
and    $0x7,%eax
mov    $0x7,%ecx
sub    %eax,%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    0x30(%rbp),%rax
mov    -0x20(%rbp),%ecx
imul   -0x3c(%rbp),%ecx
mov    -0x34(%rbp),%esi
shr    $0x3,%esi
add    %esi,%ecx
mov    %ecx,%ecx
or     (%rax,%rcx,4),%edx
mov    %edx,(%rax,%rcx,4)
jmp    130d <fill_bitmap+0x18d>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    12a8 <fill_bitmap+0x128>
jmp    1320 <fill_bitmap+0x1a0>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1295 <fill_bitmap+0x115>
jmp    15b3 <fill_bitmap+0x433>
cmpl   $0x5a,0x38(%rbp)
jne    13fd <fill_bitmap+0x27d>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    0x10(%rbp),%eax
jae    13f8 <fill_bitmap+0x278>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jae    13e5 <fill_bitmap+0x265>
mov    -0x28(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    -0x38(%rbp),%edx
call   1030 <XGetPixel@plt>
cmp    $0x0,%rax
je     13d2 <fill_bitmap+0x252>
mov    -0x38(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x40(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    $0x7,%ecx
sub    %edx,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x5c(%rbp)
mov    0x30(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x20(%rbp),%ecx
imul   -0x44(%rbp),%ecx
mov    -0x40(%rbp),%eax
mov    $0x8,%esi
cltd
idiv   %esi
mov    -0x5c(%rbp),%edx
mov    %eax,%esi
mov    -0x58(%rbp),%rax
add    %esi,%ecx
movslq %ecx,%rcx
or     (%rax,%rcx,4),%edx
mov    %edx,(%rax,%rcx,4)
jmp    13d7 <fill_bitmap+0x257>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1357 <fill_bitmap+0x1d7>
jmp    13ea <fill_bitmap+0x26a>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1344 <fill_bitmap+0x1c4>
jmp    15ae <fill_bitmap+0x42e>
cmpl   $0xb4,0x38(%rbp)
jne    14c9 <fill_bitmap+0x349>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    0x10(%rbp),%eax
jae    14c4 <fill_bitmap+0x344>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jae    14b1 <fill_bitmap+0x331>
mov    -0x28(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    -0x38(%rbp),%edx
call   1030 <XGetPixel@plt>
cmp    $0x0,%rax
je     149e <fill_bitmap+0x31e>
mov    -0x1c(%rbp),%eax
sub    -0x34(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x48(%rbp)
mov    -0x48(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    $0x7,%ecx
sub    %edx,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x6c(%rbp)
mov    0x30(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x20(%rbp),%ecx
imul   -0x38(%rbp),%ecx
mov    -0x48(%rbp),%eax
mov    $0x8,%esi
cltd
idiv   %esi
mov    -0x6c(%rbp),%edx
mov    %eax,%esi
mov    -0x68(%rbp),%rax
add    %esi,%ecx
mov    %ecx,%ecx
or     (%rax,%rcx,4),%edx
mov    %edx,(%rax,%rcx,4)
jmp    14a3 <fill_bitmap+0x323>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1424 <fill_bitmap+0x2a4>
jmp    14b6 <fill_bitmap+0x336>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1411 <fill_bitmap+0x291>
jmp    15a9 <fill_bitmap+0x429>
cmpl   $0x10e,0x38(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    0x10(%rbp),%eax
jae    15a4 <fill_bitmap+0x424>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jae    1591 <fill_bitmap+0x411>
mov    -0x28(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    -0x38(%rbp),%edx
call   1030 <XGetPixel@plt>
cmp    $0x0,%rax
je     157e <fill_bitmap+0x3fe>
mov    0x10(%rbp),%eax
sub    -0x38(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x1c(%rbp),%eax
sub    -0x34(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x50(%rbp)
mov    -0x4c(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    $0x7,%ecx
sub    %edx,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x7c(%rbp)
mov    0x30(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x20(%rbp),%ecx
imul   -0x50(%rbp),%ecx
mov    -0x4c(%rbp),%eax
mov    $0x8,%esi
cltd
idiv   %esi
mov    -0x7c(%rbp),%edx
mov    %eax,%esi
mov    -0x78(%rbp),%rax
add    %esi,%ecx
movslq %ecx,%rcx
or     (%rax,%rcx,4),%edx
mov    %edx,(%rax,%rcx,4)
jmp    1583 <fill_bitmap+0x403>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    14f7 <fill_bitmap+0x377>
jmp    1596 <fill_bitmap+0x416>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    14e4 <fill_bitmap+0x364>
jmp    15a9 <fill_bitmap+0x429>
jmp    15ae <fill_bitmap+0x42e>
jmp    15b3 <fill_bitmap+0x433>
mov    -0x28(%rbp),%rdi
call   1050 <XDestroyImage@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fill_bitmap>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r9d,%r13d
mov    %r8d,%r12d
mov    %ecx,%ebp
mov    %edx,%r15d
mov    %esi,%r14d
mov    %rdi,%rbx
add    $0x7,%ebp
shr    $0x3,%ebp
mov    %edx,%esi
xor    %edx,%edx
call   1080 <XSetForeground@plt>
mov    0x60(%rsp),%eax
mov    %eax,(%rsp)
mov    %rbx,%rdi
mov    %r14d,%esi
mov    %r15d,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
mov    %r13d,%r9d
call   1040 <XFillRectangle@plt>
mov    %rbx,%rdi
mov    %r15d,%esi
mov    $0x1,%edx
call   1080 <XSetForeground@plt>
mov    0x78(%rsp),%ecx
movzbl %ch,%eax
mov    %eax,0x20(%rsp)
movzbl %cl,%eax
mov    %eax,0x24(%rsp)
movl   $0x1,(%rsp)
lea    0x20(%rsp),%r9
mov    %rbx,%rdi
mov    %r14d,%esi
mov    %r15d,%edx
mov    0x68(%rsp),%ecx
mov    0x70(%rsp),%r8d
call   1090 <XDrawString16@plt>
mov    %ebp,0x18(%rsp)
mov    %ebp,%edx
mov    %r12d,%ebp
imul   %r12d,%edx
mov    0x80(%rsp),%rdi
xor    %esi,%esi
call   1060 <memset@plt>
mov    0x2dad(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x8(%rsp)
movl   $0x1,(%rsp)
mov    %rbx,%rdi
mov    %r14d,%esi
xor    %edx,%edx
xor    %ecx,%ecx
mov    %r13d,%r8d
mov    0x60(%rsp),%r9d
call   10a0 <XGetImage@plt>
test   %rax,%rax
je     14e7 <fill_bitmap+0x367>
mov    %rax,%r15
mov    0x88(%rsp),%eax
test   %eax,%eax
je     131e <fill_bitmap+0x19e>
cmp    $0x5a,%eax
je     13ac <fill_bitmap+0x22c>
cmp    $0xb4,%eax
jne    142f <fill_bitmap+0x2af>
mov    0x60(%rsp),%eax
test   %eax,%eax
je     14df <fill_bitmap+0x35f>
lea    -0x1(%r13),%eax
mov    %eax,0x1c(%rsp)
xor    %ebx,%ebx
jmp    12af <fill_bitmap+0x12f>
xchg   %ax,%ax
add    $0x1,%ebx
mov    0x60(%rsp),%eax
cmp    %eax,%ebx
je     14df <fill_bitmap+0x35f>
test   %r13d,%r13d
je     12a0 <fill_bitmap+0x120>
mov    %ebx,%r14d
imul   0x18(%rsp),%r14d
xor    %ebp,%ebp
mov    0x1c(%rsp),%eax
mov    %eax,%r12d
jmp    12d9 <fill_bitmap+0x159>
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
add    $0xffffffff,%r12d
jae    12a0 <fill_bitmap+0x120>
mov    %r15,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1030 <XGetPixel@plt>
test   %rax,%rax
je     12d0 <fill_bitmap+0x150>
lea    0x7(%r12),%eax
test   %r12d,%r12d
cmovns %r12d,%eax
mov    %eax,%ecx
and    $0xfffffff8,%ecx
mov    %r12d,%edx
sub    %ecx,%edx
mov    $0x7,%cl
sub    %dl,%cl
mov    $0x1,%edx
shl    %cl,%edx
sar    $0x3,%eax
add    %r14d,%eax
mov    0x80(%rsp),%rcx
or     %edx,(%rcx,%rax,4)
jmp    12d0 <fill_bitmap+0x150>
mov    0x60(%rsp),%eax
test   %eax,%eax
je     14df <fill_bitmap+0x35f>
mov    %ebp,%r12d
xor    %ebx,%ebx
jmp    134f <fill_bitmap+0x1cf>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebx
mov    0x60(%rsp),%eax
cmp    %eax,%ebx
je     14df <fill_bitmap+0x35f>
test   %r13d,%r13d
je     1340 <fill_bitmap+0x1c0>
mov    %ebx,%r14d
not    %r14d
add    %r12d,%r14d
imul   0x18(%rsp),%r14d
xor    %ebp,%ebp
jmp    1378 <fill_bitmap+0x1f8>
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebp
cmp    %ebp,%r13d
je     1340 <fill_bitmap+0x1c0>
mov    %r15,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1030 <XGetPixel@plt>
test   %rax,%rax
je     1370 <fill_bitmap+0x1f0>
mov    %ebp,%ecx
not    %cl
and    $0x7,%cl
mov    $0x1,%eax
shl    %cl,%eax
mov    %ebp,%ecx
shr    $0x3,%ecx
add    %r14d,%ecx
mov    0x80(%rsp),%rdx
or     %eax,(%rdx,%rcx,4)
jmp    1370 <fill_bitmap+0x1f0>
mov    0x60(%rsp),%eax
test   %eax,%eax
je     14df <fill_bitmap+0x35f>
xor    %r14d,%r14d
jmp    13d1 <fill_bitmap+0x251>
nopl   (%rax)
add    $0x1,%r14d
mov    0x60(%rsp),%eax
cmp    %eax,%r14d
je     14df <fill_bitmap+0x35f>
test   %r13d,%r13d
je     13c0 <fill_bitmap+0x240>
lea    0x7(%r14),%ebx
test   %r14d,%r14d
cmovns %r14d,%ebx
mov    %ebx,%eax
and    $0xfffffff8,%eax
mov    %r14d,%edx
sub    %eax,%edx
mov    $0x7,%cl
sub    %dl,%cl
mov    $0x1,%r12d
shl    %cl,%r12d
sar    $0x3,%ebx
xor    %ebp,%ebp
jmp    140c <fill_bitmap+0x28c>
nop
add    $0x1,%ebp
add    0x18(%rsp),%ebx
cmp    %ebp,%r13d
je     13c0 <fill_bitmap+0x240>
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1030 <XGetPixel@plt>
test   %rax,%rax
je     1400 <fill_bitmap+0x280>
movslq %ebx,%rax
mov    0x80(%rsp),%rcx
or     %r12d,(%rcx,%rax,4)
jmp    1400 <fill_bitmap+0x280>
xor    %edi,%edi
cmp    $0x10e,%eax
sete   %dil
call   1070 <assert@plt>
mov    0x60(%rsp),%eax
test   %eax,%eax
je     14df <fill_bitmap+0x35f>
lea    -0x1(%r13),%eax
imul   0x18(%rsp),%eax
mov    %eax,0x1c(%rsp)
xor    %r14d,%r14d
jmp    146d <fill_bitmap+0x2ed>
nopl   (%rax)
add    $0x1,%r14d
mov    0x60(%rsp),%eax
cmp    %eax,%r14d
je     14df <fill_bitmap+0x35f>
test   %r13d,%r13d
je     1460 <fill_bitmap+0x2e0>
mov    %r14d,%eax
not    %eax
mov    0x60(%rsp),%ecx
lea    (%rax,%rcx,1),%ebx
add    $0x7,%ebx
add    %ecx,%eax
cmovns %eax,%ebx
mov    %ebx,%ecx
and    $0xfffffff8,%ecx
sub    %ecx,%eax
mov    $0x7,%cl
sub    %al,%cl
mov    $0x1,%r12d
shl    %cl,%r12d
sar    $0x3,%ebx
add    0x1c(%rsp),%ebx
xor    %ebp,%ebp
jmp    14bc <fill_bitmap+0x33c>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%ebp
sub    0x18(%rsp),%ebx
cmp    %ebp,%r13d
je     1460 <fill_bitmap+0x2e0>
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1030 <XGetPixel@plt>
test   %rax,%rax
je     14b0 <fill_bitmap+0x330>
movslq %ebx,%rax
mov    0x80(%rsp),%rcx
or     %r12d,(%rcx,%rax,4)
jmp    14b0 <fill_bitmap+0x330>
mov    %r15,%rdi
call   1050 <XDestroyImage@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32, i32 }
@XYPixmap = global i32 0
define void @fill_bitmap(i32* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9, i32* %10, i32 %11) {
%13 = alloca i32*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32*
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32*
%27 = alloca %struct.TYPE_3__
%28 = alloca i32
%29 = alloca i32
%30 = alloca i32
%31 = alloca i32
%32 = alloca i32
%33 = alloca i32
%34 = alloca i32
%35 = alloca i32
store i32* %0, i32** %13
store i32 %1, i32* %14
store i32 %2, i32* %15
store i32 %3, i32* %16
store i32 %4, i32* %17
store i32 %5, i32* %18
store i32 %6, i32* %19
store i32 %7, i32* %20
store i32 %8, i32* %21
store i32 %9, i32* %22
store i32* %10, i32** %23
store i32 %11, i32* %24
%36 = load i32, i32* %16
%37 = add i32 %36, 7
%38 = udiv i32 %37, 8
store i32 %38, i32* %25
%39 = load i32*, i32** %13
%40 = load i32, i32* %15
%41 = call i32 @XSetForeground(i32* %39, i32 %40, i32 0)
%42 = load i32*, i32** %13
%43 = load i32, i32* %14
%44 = load i32, i32* %15
%45 = load i32, i32* %18
%46 = load i32, i32* %19
%47 = call i32 @XFillRectangle(i32* %42, i32 %43, i32 %44, i32 0, i32 0, i32 %45, i32 %46)
%48 = load i32*, i32** %13
%49 = load i32, i32* %15
%50 = call i32 @XSetForeground(i32* %48, i32 %49, i32 1)
%51 = load i32, i32* %22
%52 = lshr i32 %51, 8
%53 = and i32 %52, 255
%54 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %27, i32 0, i32 0
store i32 %53, i32* %54
%55 = load i32, i32* %22
%56 = and i32 %55, 255
%57 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %27, i32 0, i32 1
store i32 %56, i32* %57
%58 = load i32*, i32** %13
%59 = load i32, i32* %14
%60 = load i32, i32* %15
%61 = load i32, i32* %20
%62 = load i32, i32* %21
%63 = call i32 @XDrawString16(i32* %58, i32 %59, i32 %60, i32 %61, i32 %62, %struct.TYPE_3__* %27, i32 1)
%64 = load i32*, i32** %23
%65 = load i32, i32* %25
%66 = load i32, i32* %17
%67 = mul i32 %65, %66
%68 = call i32 @memset(i32* %64, i32 0, i32 %67)
%69 = load i32*, i32** %13
%70 = load i32, i32* %14
%71 = load i32, i32* %18
%72 = load i32, i32* %19
%73 = load i32, i32* @XYPixmap
%74 = call i32* @XGetImage(i32* %69, i32 %70, i32 0, i32 0, i32 %71, i32 %72, i32 1, i32 %73)
store i32* %74, i32** %26
%75 = load i32*, i32** %26
%76 = icmp ne i32* %75, null
br i1 %76, label %77, label %277
77: ; preds = %12
%78 = load i32, i32* %24
%79 = icmp eq i32 %78, 0
br i1 %79, label %80, label %125
80: ; preds = %77
store i32 0, i32* %29
br label %81
81: ; preds = %121, %80
%82 = load i32, i32* %29
%83 = load i32, i32* %19
%84 = icmp ult i32 %82, %83
br i1 %84, label %85, label %124
85: ; preds = %81
store i32 0, i32* %28
br label %86
86: ; preds = %117, %85
%87 = load i32, i32* %28
%88 = load i32, i32* %18
%89 = icmp ult i32 %87, %88
br i1 %89, label %90, label %120
90: ; preds = %86
%91 = load i32*, i32** %26
%92 = load i32, i32* %28
%93 = load i32, i32* %29
%94 = call i64 @XGetPixel(i32* %91, i32 %92, i32 %93)
%95 = icmp ne i64 %94, 0
br i1 %95, label %96, label %116
96: ; preds = %90
%97 = load i32, i32* %17
%98 = load i32, i32* %29
%99 = sub i32 %97, %98
%100 = sub i32 %99, 1
store i32 %100, i32* %30
%101 = load i32, i32* %28
%102 = urem i32 %101, 8
%103 = sub i32 7, %102
%104 = shl i32 1, %103
%105 = load i32*, i32** %23
%106 = load i32, i32* %25
%107 = load i32, i32* %30
%108 = mul nsw i32 %106, %107
%109 = load i32, i32* %28
%110 = udiv i32 %109, 8
%111 = add i32 %108, %110
%112 = zext i32 %111 to i64
%113 = getelementptr inbounds i32, i32* %105, i64 %112
%114 = load i32, i32* %113
%115 = or i32 %114, %104
store i32 %115, i32* %113
br label %116
116: ; preds = %96, %90
br label %117
117: ; preds = %116
%118 = load i32, i32* %28
%119 = add i32 %118, 1
store i32 %119, i32* %28
br label %86
120: ; preds = %86
br label %121
121: ; preds = %120
%122 = load i32, i32* %29
%123 = add i32 %122, 1
store i32 %123, i32* %29
br label %81
124: ; preds = %81
br label %274
125: ; preds = %77
%126 = load i32, i32* %24
%127 = icmp eq i32 %126, 90
br i1 %127, label %128, label %171
128: ; preds = %125
store i32 0, i32* %29
br label %129
129: ; preds = %167, %128
%130 = load i32, i32* %29
%131 = load i32, i32* %19
%132 = icmp ult i32 %130, %131
br i1 %132, label %133, label %170
133: ; preds = %129
store i32 0, i32* %28
br label %134
134: ; preds = %163, %133
%135 = load i32, i32* %28
%136 = load i32, i32* %18
%137 = icmp ult i32 %135, %136
br i1 %137, label %138, label %166
138: ; preds = %134
%139 = load i32*, i32** %26
%140 = load i32, i32* %28
%141 = load i32, i32* %29
%142 = call i64 @XGetPixel(i32* %139, i32 %140, i32 %141)
%143 = icmp ne i64 %142, 0
br i1 %143, label %144, label %162
144: ; preds = %138
%145 = load i32, i32* %29
store i32 %145, i32* %31
%146 = load i32, i32* %28
store i32 %146, i32* %32
%147 = load i32, i32* %31
%148 = srem i32 %147, 8
%149 = sub nsw i32 7, %148
%150 = shl i32 1, %149
%151 = load i32*, i32** %23
%152 = load i32, i32* %25
%153 = load i32, i32* %32
%154 = mul nsw i32 %152, %153
%155 = load i32, i32* %31
%156 = sdiv i32 %155, 8
%157 = add nsw i32 %154, %156
%158 = sext i32 %157 to i64
%159 = getelementptr inbounds i32, i32* %151, i64 %158
%160 = load i32, i32* %159
%161 = or i32 %160, %150
store i32 %161, i32* %159
br label %162
162: ; preds = %144, %138
br label %163
163: ; preds = %162
%164 = load i32, i32* %28
%165 = add i32 %164, 1
store i32 %165, i32* %28
br label %134
166: ; preds = %134
br label %167
167: ; preds = %166
%168 = load i32, i32* %29
%169 = add i32 %168, 1
store i32 %169, i32* %29
br label %129
170: ; preds = %129
br label %273
171: ; preds = %125
%172 = load i32, i32* %24
%173 = icmp eq i32 %172, 180
br i1 %173, label %174, label %219
174: ; preds = %171
store i32 0, i32* %29
br label %175
175: ; preds = %215, %174
%176 = load i32, i32* %29
%177 = load i32, i32* %19
%178 = icmp ult i32 %176, %177
br i1 %178, label %179, label %218
179: ; preds = %175
store i32 0, i32* %28
br label %180
180: ; preds = %211, %179
%181 = load i32, i32* %28
%182 = load i32, i32* %18
%183 = icmp ult i32 %181, %182
br i1 %183, label %184, label %214
184: ; preds = %180
%185 = load i32*, i32** %26
%186 = load i32, i32* %28
%187 = load i32, i32* %29
%188 = call i64 @XGetPixel(i32* %185, i32 %186, i32 %187)
%189 = icmp ne i64 %188, 0
br i1 %189, label %190, label %210
190: ; preds = %184
%191 = load i32, i32* %18
%192 = load i32, i32* %28
%193 = sub i32 %191, %192
%194 = sub i32 %193, 1
store i32 %194, i32* %33
%195 = load i32, i32* %33
%196 = srem i32 %195, 8
%197 = sub nsw i32 7, %196
%198 = shl i32 1, %197
%199 = load i32*, i32** %23
%200 = load i32, i32* %25
%201 = load i32, i32* %29
%202 = mul i32 %200, %201
%203 = load i32, i32* %33
%204 = sdiv i32 %203, 8
%205 = add i32 %202, %204
%206 = zext i32 %205 to i64
%207 = getelementptr inbounds i32, i32* %199, i64 %206
%208 = load i32, i32* %207
%209 = or i32 %208, %198
store i32 %209, i32* %207
br label %210
210: ; preds = %190, %184
br label %211
211: ; preds = %210
%212 = load i32, i32* %28
%213 = add i32 %212, 1
store i32 %213, i32* %28
br label %180
214: ; preds = %180
br label %215
215: ; preds = %214
%216 = load i32, i32* %29
%217 = add i32 %216, 1
store i32 %217, i32* %29
br label %175
218: ; preds = %175
br label %272
219: ; preds = %171
%220 = load i32, i32* %24
%221 = icmp eq i32 %220, 270
%222 = zext i1 %221 to i32
%223 = call i32 @assert(i32 %222)
store i32 0, i32* %29
br label %224
224: ; preds = %268, %219
%225 = load i32, i32* %29
%226 = load i32, i32* %19
%227 = icmp ult i32 %225, %226
br i1 %227, label %228, label %271
228: ; preds = %224
store i32 0, i32* %28
br label %229
229: ; preds = %264, %228
%230 = load i32, i32* %28
%231 = load i32, i32* %18
%232 = icmp ult i32 %230, %231
br i1 %232, label %233, label %267
233: ; preds = %229
%234 = load i32*, i32** %26
%235 = load i32, i32* %28
%236 = load i32, i32* %29
%237 = call i64 @XGetPixel(i32* %234, i32 %235, i32 %236)
%238 = icmp ne i64 %237, 0
br i1 %238, label %239, label %263
239: ; preds = %233
%240 = load i32, i32* %19
%241 = load i32, i32* %29
%242 = sub i32 %240, %241
%243 = sub i32 %242, 1
store i32 %243, i32* %34
%244 = load i32, i32* %18
%245 = load i32, i32* %28
%246 = sub i32 %244, %245
%247 = sub i32 %246, 1
store i32 %247, i32* %35
%248 = load i32, i32* %34
%249 = srem i32 %248, 8
%250 = sub nsw i32 7, %249
%251 = shl i32 1, %250
%252 = load i32*, i32** %23
%253 = load i32, i32* %25
%254 = load i32, i32* %35
%255 = mul nsw i32 %253, %254
%256 = load i32, i32* %34
%257 = sdiv i32 %256, 8
%258 = add nsw i32 %255, %257
%259 = sext i32 %258 to i64
%260 = getelementptr inbounds i32, i32* %252, i64 %259
%261 = load i32, i32* %260
%262 = or i32 %261, %251
store i32 %262, i32* %260
br label %263
263: ; preds = %239, %233
br label %264
264: ; preds = %263
%265 = load i32, i32* %28
%266 = add i32 %265, 1
store i32 %266, i32* %28
br label %229
267: ; preds = %229
br label %268
268: ; preds = %267
%269 = load i32, i32* %29
%270 = add i32 %269, 1
store i32 %270, i32* %29
br label %224
271: ; preds = %224
br label %272
272: ; preds = %271, %218
br label %273
273: ; preds = %272, %170
br label %274
274: ; preds = %273, %124
%275 = load i32*, i32** %26
%276 = call i32 @XDestroyImage(i32* %275)
br label %277
277: ; preds = %274, %12
ret void
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32, i32 }
@XYPixmap = global i32 0
define void @fill_bitmap(i32* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9, i32* %10, i32 %11) {
%13 = alloca %struct.TYPE_3__
%14 = add i32 %3, 7
%15 = lshr i32 %14, 3
%16 = bitcast %struct.TYPE_3__* %13 to i8*
%17 = tail call i32 @XSetForeground(i32* %0, i32 %2, i32 0)
%18 = tail call i32 @XFillRectangle(i32* %0, i32 %1, i32 %2, i32 0, i32 0, i32 %5, i32 %6)
%19 = tail call i32 @XSetForeground(i32* %0, i32 %2, i32 1)
%20 = lshr i32 %9, 8
%21 = and i32 %20, 255
%22 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %13, i64 0, i32 0
store i32 %21, i32* %22
%23 = and i32 %9, 255
%24 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %13, i64 0, i32 1
store i32 %23, i32* %24
%25 = call i32 @XDrawString16(i32* %0, i32 %1, i32 %2, i32 %7, i32 %8, %struct.TYPE_3__* %13, i32 1)
%26 = mul i32 %15, %4
%27 = call i32 @memset(i32* %10, i32 0, i32 %26)
%28 = load i32, i32* @XYPixmap
%29 = call i32* @XGetImage(i32* %0, i32 %1, i32 0, i32 0, i32 %5, i32 %6, i32 1, i32 %28)
%30 = icmp eq i32* %29, null
br i1 %30, label %157, label %31
31: ; preds = %12
switch i32 %11, label %120 [
i32 0, label %40
i32 90, label %36
i32 180, label %32
]
32: ; preds = %31
%33 = icmp eq i32 %6, 0
br i1 %33, label %155, label %34
34: ; preds = %32
%35 = icmp eq i32 %5, 0
br label %94
36: ; preds = %31
%37 = icmp eq i32 %6, 0
br i1 %37, label %155, label %38
38: ; preds = %36
%39 = icmp eq i32 %5, 0
br label %70
40: ; preds = %31
%41 = icmp eq i32 %6, 0
br i1 %41, label %155, label %42
42: ; preds = %40
%43 = icmp eq i32 %5, 0
br label %44
44: ; preds = %42, %67
%45 = phi i32 [ 0, %42 ], [ %68, %67 ]
br i1 %43, label %67, label %46
46: ; preds = %44
%47 = xor i32 %45, -1
%48 = add i32 %47, %4
%49 = mul nsw i32 %48, %15
br label %50
50: ; preds = %46, %64
%51 = phi i32 [ 0, %46 ], [ %65, %64 ]
%52 = call i64 @XGetPixel(i32* %29, i32 %51, i32 %45)
%53 = icmp eq i64 %52, 0
br i1 %53, label %64, label %54
54: ; preds = %50
%55 = and i32 %51, 7
%56 = xor i32 %55, 7
%57 = shl nuw i32 1, %56
%58 = lshr i32 %51, 3
%59 = add i32 %58, %49
%60 = zext i32 %59 to i64
%61 = getelementptr inbounds i32, i32* %10, i64 %60
%62 = load i32, i32* %61
%63 = or i32 %62, %57
store i32 %63, i32* %61
br label %64
64: ; preds = %50, %54
%65 = add nuw i32 %51, 1
%66 = icmp eq i32 %65, %5
br i1 %66, label %67, label %50
67: ; preds = %64, %44
%68 = add nuw i32 %45, 1
%69 = icmp eq i32 %68, %6
br i1 %69, label %155, label %44
70: ; preds = %38, %91
%71 = phi i32 [ 0, %38 ], [ %92, %91 ]
br i1 %39, label %91, label %72
72: ; preds = %70
%73 = srem i32 %71, 8
%74 = sub nsw i32 7, %73
%75 = shl nuw nsw i32 1, %74
%76 = sdiv i32 %71, 8
br label %77
77: ; preds = %72, %88
%78 = phi i32 [ 0, %72 ], [ %89, %88 ]
%79 = call i64 @XGetPixel(i32* %29, i32 %78, i32 %71)
%80 = icmp eq i64 %79, 0
br i1 %80, label %88, label %81
81: ; preds = %77
%82 = mul nsw i32 %78, %15
%83 = add nsw i32 %82, %76
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds i32, i32* %10, i64 %84
%86 = load i32, i32* %85
%87 = or i32 %86, %75
store i32 %87, i32* %85
br label %88
88: ; preds = %77, %81
%89 = add nuw i32 %78, 1
%90 = icmp eq i32 %89, %5
br i1 %90, label %91, label %77
91: ; preds = %88, %70
%92 = add nuw i32 %71, 1
%93 = icmp eq i32 %92, %6
br i1 %93, label %155, label %70
94: ; preds = %34, %117
%95 = phi i32 [ 0, %34 ], [ %118, %117 ]
br i1 %35, label %117, label %96
96: ; preds = %94
%97 = mul i32 %95, %15
br label %98
98: ; preds = %96, %114
%99 = phi i32 [ 0, %96 ], [ %115, %114 ]
%100 = call i64 @XGetPixel(i32* %29, i32 %99, i32 %95)
%101 = icmp eq i64 %100, 0
br i1 %101, label %114, label %102
102: ; preds = %98
%103 = xor i32 %99, -1
%104 = add i32 %103, %5
%105 = srem i32 %104, 8
%106 = sub nsw i32 7, %105
%107 = shl nuw nsw i32 1, %106
%108 = sdiv i32 %104, 8
%109 = add i32 %108, %97
%110 = zext i32 %109 to i64
%111 = getelementptr inbounds i32, i32* %10, i64 %110
%112 = load i32, i32* %111
%113 = or i32 %112, %107
store i32 %113, i32* %111
br label %114
114: ; preds = %98, %102
%115 = add nuw i32 %99, 1
%116 = icmp eq i32 %115, %5
br i1 %116, label %117, label %98
117: ; preds = %114, %94
%118 = add nuw i32 %95, 1
%119 = icmp eq i32 %118, %6
br i1 %119, label %155, label %94
120: ; preds = %31
%121 = icmp eq i32 %11, 270
%122 = zext i1 %121 to i32
%123 = call i32 @assert(i32 %122)
%124 = icmp eq i32 %6, 0
br i1 %124, label %155, label %125
125: ; preds = %120
%126 = icmp eq i32 %5, 0
br label %127
127: ; preds = %125, %152
%128 = phi i32 [ 0, %125 ], [ %153, %152 ]
br i1 %126, label %152, label %129
129: ; preds = %127
%130 = xor i32 %128, -1
%131 = add i32 %130, %6
%132 = srem i32 %131, 8
%133 = sub nsw i32 7, %132
%134 = shl nuw nsw i32 1, %133
%135 = sdiv i32 %131, 8
br label %136
136: ; preds = %129, %149
%137 = phi i32 [ 0, %129 ], [ %150, %149 ]
%138 = call i64 @XGetPixel(i32* %29, i32 %137, i32 %128)
%139 = icmp eq i64 %138, 0
br i1 %139, label %149, label %140
140: ; preds = %136
%141 = xor i32 %137, -1
%142 = add i32 %141, %5
%143 = mul nsw i32 %142, %15
%144 = add nsw i32 %143, %135
%145 = sext i32 %144 to i64
%146 = getelementptr inbounds i32, i32* %10, i64 %145
%147 = load i32, i32* %146
%148 = or i32 %147, %134
store i32 %148, i32* %146
br label %149
149: ; preds = %136, %140
%150 = add nuw i32 %137, 1
%151 = icmp eq i32 %150, %5
br i1 %151, label %152, label %136
152: ; preds = %149, %127
%153 = add nuw i32 %128, 1
%154 = icmp eq i32 %153, %6
br i1 %154, label %155, label %127
155: ; preds = %117, %91, %67, %152, %32, %36, %40, %120
%156 = call i32 @XDestroyImage(i32* %29)
br label %157
157: ; preds = %155, %12
ret void
}