#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 /*<<< orphan*/ Window;
typedef int /*<<< orphan*/ Pixmap;
typedef int /*<<< orphan*/ GC;
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
#define BitmapFileInvalid 130
#define BitmapNoMemory 129
#define BitmapOpenFailed 128
int DefaultScreen(int /*<<< orphan*/ *);
unsigned int DisplayHeight(int /*<<< orphan*/ *, int);
unsigned int DisplayWidth(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ False;
int /*<<< orphan*/ XCloseDisplay(int /*<<< orphan*/ *);
int /*<<< orphan*/ XCopyPlane(int /*<<< orphan*/ *, int /*<<< orphan*/,
                              int /*<<< orphan*/, int /*<<< orphan*/,
                              int /*<<< orphan*/, int /*<<< orphan*/,
                              unsigned int, unsigned int, int, int, int);
int /*<<< orphan*/ XFlush(int /*<<< orphan*/ *);
int /*<<< orphan*/ *XOpenDisplay(char *);
int XReadBitmapFile(int /*<<< orphan*/ *, int /*<<< orphan*/, char *,
                    unsigned int *, unsigned int *, int /*<<< orphan*/ *, int *,
                    int *);
int /*<<< orphan*/ XSync(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ create_gc(int /*<<< orphan*/ *, int /*<<< orphan*/,
                             int /*<<< orphan*/);
int /*<<< orphan*/ create_simple_window(int /*<<< orphan*/ *, unsigned int,
                                        unsigned int, int /*<<< orphan*/,
                                        int /*<<< orphan*/);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
char *getenv(char *);
int /*<<< orphan*/ printf(char *, unsigned int, unsigned int);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ usleep(int);
int main(int argc, char *argv[]) {
  Display *display;
  int screen_num;
  Window win;
  unsigned int display_width, display_height;
  unsigned int width, height;
  char *display_name = getenv("DISPLAY");
  GC gc;
  display = XOpenDisplay(display_name);
  if (display == NULL) {
    fprintf(stderr, "%s: cannot connect to X server '%s'\n", argv[0],
            display_name);
    exit(1);
  }
  screen_num = DefaultScreen(display);
  display_width = DisplayWidth(display, screen_num);
  display_height = DisplayHeight(display, screen_num);
  width = (display_width / 3);
  height = (display_height / 3);
  printf("window width - '%d'; height - '%d'\n", width, height);
  win = create_simple_window(display, width, height, 0, 0);
  gc = create_gc(display, win, 0);
  XSync(display, False);
  {
    Pixmap bitmap;
    unsigned int bitmap_width, bitmap_height;
    int hotspot_x, hotspot_y;
    int rc = XReadBitmapFile(display, win, "icon.bmp", &bitmap_width,
                             &bitmap_height, &bitmap, &hotspot_x, &hotspot_y);
    switch (rc) {
    case BitmapOpenFailed:
      fprintf(stderr, "XReadBitmapFile - could not open file 'icon.bmp'.\n");
      exit(1);
      break;
    case BitmapFileInvalid:
      fprintf(stderr,
              "XReadBitmapFile - file '%s' doesn't contain a valid bitmap.\n",
              "icon.bmp");
      exit(1);
      break;
    case BitmapNoMemory:
      fprintf(stderr, "XReadBitmapFile - not enough memory.\n");
      exit(1);
      break;
    }
    {
      int i, j;
      for (i = 0; i < 6; i++) {
        for (j = 0; j < 6; j++) {
          XCopyPlane(display, bitmap, win, gc, 0, 0, bitmap_width,
                     bitmap_height, j * bitmap_width, i * bitmap_height, 1);
          XSync(display, False);
          usleep(100000);
        }
      }
    }
  }
  XFlush(display);
  sleep(4);
  XCloseDisplay(display);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x98,%rsp
movl   $0x0,-0xc(%rbp)
mov    %edi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
lea    0xdcf(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
call   1090 <XOpenDisplay@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    127e <main+0x6e>
mov    0x2d7f(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rax
mov    (%rax),%rdx
mov    -0x40(%rbp),%rcx
lea    0xd9b(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x20(%rbp),%rdi
call   10f0 <DefaultScreen@plt>
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1070 <DisplayWidth@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1060 <DisplayHeight@plt>
mov    %eax,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
mov    $0xaaaaaaab,%ecx
imul   %rcx,%rax
shr    $0x21,%rax
mov    %eax,-0x34(%rbp)
mov    -0x30(%rbp),%eax
imul   %rcx,%rax
shr    $0x21,%rax
mov    %eax,-0x38(%rbp)
mov    -0x34(%rbp),%esi
mov    -0x38(%rbp),%edx
lea    0xd57(%rip),%rdi
call   1080 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    -0x38(%rbp),%edx
xor    %r8d,%r8d
mov    %r8d,-0x6c(%rbp)
mov    %r8d,%ecx
call   10c0 <create_simple_window@plt>
mov    -0x6c(%rbp),%edx
mov    %eax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%esi
call   1050 <create_gc@plt>
mov    %eax,-0x44(%rbp)
mov    -0x20(%rbp),%rdi
mov    0x2cd4(%rip),%rax
mov    (%rax),%esi
call   10b0 <XSync@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    %rsp,%rax
lea    -0x58(%rbp),%rcx
mov    %rcx,0x8(%rax)
lea    -0x54(%rbp),%rcx
mov    %rcx,(%rax)
lea    0xd16(%rip),%rdx
lea    -0x4c(%rbp),%rcx
lea    -0x50(%rbp),%r8
lea    -0x48(%rbp),%r9
call   1110 <XReadBitmapFile@plt>
mov    %eax,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
mov    %eax,-0x68(%rbp)
sub    $0x80,%eax
je     138b <main+0x17b>
jmp    1365 <main+0x155>
mov    -0x68(%rbp),%eax
sub    $0x81,%eax
je     13d4 <main+0x1c4>
jmp    1378 <main+0x168>
mov    -0x68(%rbp),%eax
sub    $0x82,%eax
je     13ac <main+0x19c>
jmp    13f5 <main+0x1e5>
mov    0x2c46(%rip),%rax
mov    (%rax),%edi
lea    0xcbf(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    0x2c25(%rip),%rax
mov    (%rax),%edi
lea    0xcd1(%rip),%rsi
lea    0xc8e(%rip),%rdx
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    0x2bfd(%rip),%rax
mov    (%rax),%edi
lea    0xce6(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
movl   $0x0,-0x60(%rbp)
cmpl   $0x6,-0x60(%rbp)
jge    149c <main+0x28c>
movl   $0x0,-0x64(%rbp)
cmpl   $0x6,-0x64(%rbp)
jge    1489 <main+0x279>
mov    -0x20(%rbp),%rdi
mov    -0x48(%rbp),%esi
mov    -0x28(%rbp),%edx
mov    -0x44(%rbp),%ecx
mov    -0x4c(%rbp),%ebx
mov    -0x50(%rbp),%r11d
mov    -0x64(%rbp),%r10d
imul   -0x4c(%rbp),%r10d
mov    -0x60(%rbp),%eax
imul   -0x50(%rbp),%eax
xor    %r9d,%r9d
mov    %r9d,%r8d
mov    %ebx,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
movl   $0x1,0x20(%rsp)
call   1040 <XCopyPlane@plt>
mov    -0x20(%rbp),%rdi
mov    0x2b7e(%rip),%rax
mov    (%rax),%esi
call   10b0 <XSync@plt>
mov    $0x186a0,%edi
call   1130 <usleep@plt>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    140d <main+0x1fd>
jmp    148e <main+0x27e>
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    13fc <main+0x1ec>
mov    -0x20(%rbp),%rdi
call   10d0 <XFlush@plt>
mov    $0x4,%edi
call   1120 <sleep@plt>
mov    -0x20(%rbp),%rdi
call   1100 <XCloseDisplay@plt>
xor    %eax,%eax
add    $0x98,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r14
lea    0xdd8(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rbp
mov    %rax,%rdi
call   1090 <XOpenDisplay@plt>
test   %rax,%rax
je     155e <main+0x34e>
mov    %rax,%r13
mov    %rax,%rdi
call   10f0 <DefaultScreen@plt>
mov    %eax,%ebp
mov    %r13,%rdi
mov    %eax,%esi
call   1070 <DisplayWidth@plt>
mov    %eax,%r14d
mov    %r13,%rdi
mov    %ebp,%esi
call   1060 <DisplayHeight@plt>
mov    %r14d,%r14d
mov    $0xaaaaaaab,%ecx
imul   %rcx,%r14
shr    $0x21,%r14
mov    %eax,%ebp
imul   %rcx,%rbp
shr    $0x21,%rbp
lea    0xda7(%rip),%rdi
mov    %r14d,%esi
mov    %ebp,%edx
call   1080 <printf@plt>
mov    %r13,%rdi
mov    %r14d,%esi
mov    %ebp,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   10c0 <create_simple_window@plt>
mov    %eax,%ebx
mov    %r13,%rdi
mov    %eax,%esi
xor    %edx,%edx
call   1050 <create_gc@plt>
mov    %eax,%ebp
mov    0x2d2f(%rip),%rax
mov    (%rax),%esi
mov    %r13,%rdi
call   10b0 <XSync@plt>
lea    0x20(%rsp),%rax
lea    0x24(%rsp),%r10
lea    0xd7d(%rip),%rdx
lea    0x10(%rsp),%rcx
lea    0xc(%rsp),%r8
lea    0x14(%rsp),%r9
mov    %r13,%rdi
mov    %ebx,%esi
push   %rax
push   %r10
call   1110 <XReadBitmapFile@plt>
add    $0x10,%rsp
cmp    $0x80,%eax
je     1585 <main+0x375>
cmp    $0x81,%eax
je     1597 <main+0x387>
cmp    $0x82,%eax
je     15b8 <main+0x3a8>
xor    %r15d,%r15d
mov    %ebx,0x1c(%rsp)
mov    %ebp,0x18(%rsp)
mov    0x1c(%rsp),%r12d
mov    0x18(%rsp),%r14d
nopw   0x0(%rax,%rax,1)
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%r10d
mov    0xc(%rsp),%eax
mov    %eax,%ebx
imul   %r15d,%ebx
sub    $0x8,%rsp
mov    %r13,%rdi
mov    %r12d,%edx
mov    %r14d,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
push   $0x1
push   %rbx
push   $0x0
push   %rax
push   %r10
call   1040 <XCopyPlane@plt>
add    $0x30,%rsp
mov    0x2c7a(%rip),%rax
mov    (%rax),%esi
mov    %r13,%rdi
call   10b0 <XSync@plt>
mov    $0x186a0,%edi
call   1130 <usleep@plt>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%eax
mov    0xc(%rsp),%ebp
mov    %ebp,%ebx
imul   %r15d,%ebx
sub    $0x8,%rsp
mov    %r13,%rdi
mov    %r12d,%edx
mov    %r14d,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
push   $0x1
push   %rbx
push   %rax
push   %rbp
push   %rax
call   1040 <XCopyPlane@plt>
add    $0x30,%rsp
mov    0x2c2b(%rip),%rax
mov    (%rax),%esi
mov    %r13,%rdi
call   10b0 <XSync@plt>
mov    $0x186a0,%edi
call   1130 <usleep@plt>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%eax
mov    0xc(%rsp),%ebx
lea    (%rax,%rax,1),%r10d
mov    %ebx,%ebp
imul   %r15d,%ebp
sub    $0x8,%rsp
mov    %r13,%rdi
mov    %r12d,%edx
mov    %r14d,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
push   $0x1
push   %rbp
push   %r10
push   %rbx
push   %rax
call   1040 <XCopyPlane@plt>
add    $0x30,%rsp
mov    0x2bd7(%rip),%rax
mov    (%rax),%esi
mov    %r13,%rdi
call   10b0 <XSync@plt>
mov    $0x186a0,%edi
call   1130 <usleep@plt>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%eax
mov    0xc(%rsp),%ebx
lea    (%rax,%rax,2),%r10d
mov    %ebx,%ebp
imul   %r15d,%ebp
sub    $0x8,%rsp
mov    %r13,%rdi
mov    %r12d,%edx
mov    %r14d,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
push   $0x1
push   %rbp
push   %r10
push   %rbx
push   %rax
call   1040 <XCopyPlane@plt>
add    $0x30,%rsp
mov    0x2b83(%rip),%rax
mov    (%rax),%esi
mov    %r13,%rdi
call   10b0 <XSync@plt>
mov    $0x186a0,%edi
call   1130 <usleep@plt>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%eax
mov    0xc(%rsp),%ebx
lea    0x0(,%rax,4),%r10d
mov    %ebx,%ebp
imul   %r15d,%ebp
sub    $0x8,%rsp
mov    %r13,%rdi
mov    %r12d,%edx
mov    %r14d,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
push   $0x1
push   %rbp
push   %r10
push   %rbx
push   %rax
call   1040 <XCopyPlane@plt>
add    $0x30,%rsp
mov    0x2b2b(%rip),%rax
mov    (%rax),%esi
mov    %r13,%rdi
call   10b0 <XSync@plt>
mov    $0x186a0,%edi
call   1130 <usleep@plt>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%eax
mov    0xc(%rsp),%ebx
lea    (%rax,%rax,4),%r10d
mov    %ebx,%ebp
imul   %r15d,%ebp
sub    $0x8,%rsp
mov    %r13,%rdi
mov    %r12d,%edx
mov    %r14d,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
push   $0x1
push   %rbp
push   %r10
push   %rbx
push   %rax
call   1040 <XCopyPlane@plt>
add    $0x30,%rsp
mov    0x2ad7(%rip),%rax
mov    (%rax),%esi
mov    %r13,%rdi
call   10b0 <XSync@plt>
mov    $0x186a0,%edi
call   1130 <usleep@plt>
add    $0x1,%r15d
cmp    $0x6,%r15d
jne    1330 <main+0x120>
mov    %r13,%rdi
call   10d0 <XFlush@plt>
mov    $0x4,%edi
call   1120 <sleep@plt>
mov    %r13,%rdi
call   1100 <XCloseDisplay@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2a73(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rdx
lea    0xa97(%rip),%rsi
mov    %rbp,%rcx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    0x2a4c(%rip),%rax
mov    (%rax),%edi
lea    0xac5(%rip),%rsi
jmp    15a7 <main+0x397>
mov    0x2a3a(%rip),%rax
mov    (%rax),%edi
lea    0xb23(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    0x2a19(%rip),%rax
mov    (%rax),%edi
lea    0xac5(%rip),%rsi
lea    0xa82(%rip),%rdx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"DISPLAY\00"
@stderr = global i32 0
@.str.1 = [37 x i8] c"%s: cannot connect to X server '%s'\0A\00"
@.str.2 = [36 x i8] c"window width - '%d'; height - '%d'\0A\00"
@False = global i32 0
@.str.3 = [9 x i8] c"icon.bmp\00"
@.str.4 = [51 x i8] c"XReadBitmapFile - could not open file 'icon.bmp'.\0A\00"
@.str.5 = [61 x i8] c"XReadBitmapFile - file '%s' doesn't contain a valid bitmap.\0A\00"
@.str.6 = [38 x i8] c"XReadBitmapFile - not enough memory.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i8*
%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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%23 = call i8* @getenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
store i8* %23, i8** %13
%24 = load i8*, i8** %13
%25 = call i32* @XOpenDisplay(i8* %24)
store i32* %25, i32** %6
%26 = load i32*, i32** %6
%27 = icmp eq i32* %26, null
br i1 %27, label %28, label %36
28: ; preds = %2
%29 = load i32, i32* @stderr
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 0
%32 = load i8*, i8** %31
%33 = load i8*, i8** %13
%34 = call i32 (i32, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i8* %32, i8* %33)
%35 = call i32 @exit(i32 1)
unreachable
36: ; preds = %2
%37 = load i32*, i32** %6
%38 = call i32 @DefaultScreen(i32* %37)
store i32 %38, i32* %7
%39 = load i32*, i32** %6
%40 = load i32, i32* %7
%41 = call i32 @DisplayWidth(i32* %39, i32 %40)
store i32 %41, i32* %9
%42 = load i32*, i32** %6
%43 = load i32, i32* %7
%44 = call i32 @DisplayHeight(i32* %42, i32 %43)
store i32 %44, i32* %10
%45 = load i32, i32* %9
%46 = udiv i32 %45, 3
store i32 %46, i32* %11
%47 = load i32, i32* %10
%48 = udiv i32 %47, 3
store i32 %48, i32* %12
%49 = load i32, i32* %11
%50 = load i32, i32* %12
%51 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i32 %49, i32 %50)
%52 = load i32*, i32** %6
%53 = load i32, i32* %11
%54 = load i32, i32* %12
%55 = call i32 @create_simple_window(i32* %52, i32 %53, i32 %54, i32 0, i32 0)
store i32 %55, i32* %8
%56 = load i32*, i32** %6
%57 = load i32, i32* %8
%58 = call i32 @create_gc(i32* %56, i32 %57, i32 0)
store i32 %58, i32* %14
%59 = load i32*, i32** %6
%60 = load i32, i32* @False
%61 = call i32 @XSync(i32* %59, i32 %60)
%62 = load i32*, i32** %6
%63 = load i32, i32* %8
%64 = call i32 @XReadBitmapFile(i32* %62, i32 %63, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32* %16, i32* %17, i32* %15, i32* %18, i32* %19)
store i32 %64, i32* %20
%65 = load i32, i32* %20
switch i32 %65, label %78 [
i32 128, label %66
i32 130, label %70
i32 129, label %74
]
66: ; preds = %36
%67 = load i32, i32* @stderr
%68 = call i32 (i32, i8*, ...) @fprintf(i32 %67, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.4, i64 0, i64 0))
%69 = call i32 @exit(i32 1)
unreachable
70: ; preds = %36
%71 = load i32, i32* @stderr
%72 = call i32 (i32, i8*, ...) @fprintf(i32 %71, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%73 = call i32 @exit(i32 1)
unreachable
74: ; preds = %36
%75 = load i32, i32* @stderr
%76 = call i32 (i32, i8*, ...) @fprintf(i32 %75, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.6, i64 0, i64 0))
%77 = call i32 @exit(i32 1)
unreachable
78: ; preds = %36
store i32 0, i32* %21
br label %79
79: ; preds = %108, %78
%80 = load i32, i32* %21
%81 = icmp slt i32 %80, 6
br i1 %81, label %82, label %111
82: ; preds = %79
store i32 0, i32* %22
br label %83
83: ; preds = %104, %82
%84 = load i32, i32* %22
%85 = icmp slt i32 %84, 6
br i1 %85, label %86, label %107
86: ; preds = %83
%87 = load i32*, i32** %6
%88 = load i32, i32* %15
%89 = load i32, i32* %8
%90 = load i32, i32* %14
%91 = load i32, i32* %16
%92 = load i32, i32* %17
%93 = load i32, i32* %22
%94 = load i32, i32* %16
%95 = mul i32 %93, %94
%96 = load i32, i32* %21
%97 = load i32, i32* %17
%98 = mul i32 %96, %97
%99 = call i32 @XCopyPlane(i32* %87, i32 %88, i32 %89, i32 %90, i32 0, i32 0, i32 %91, i32 %92, i32 %95, i32 %98, i32 1)
%100 = load i32*, i32** %6
%101 = load i32, i32* @False
%102 = call i32 @XSync(i32* %100, i32 %101)
%103 = call i32 @usleep(i32 100000)
br label %104
104: ; preds = %86
%105 = load i32, i32* %22
%106 = add nsw i32 %105, 1
store i32 %106, i32* %22
br label %83
107: ; preds = %83
br label %108
108: ; preds = %107
%109 = load i32, i32* %21
%110 = add nsw i32 %109, 1
store i32 %110, i32* %21
br label %79
111: ; preds = %79
%112 = load i32*, i32** %6
%113 = call i32 @XFlush(i32* %112)
%114 = call i32 @sleep(i32 4)
%115 = load i32*, i32** %6
%116 = call i32 @XCloseDisplay(i32* %115)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"DISPLAY\00"
@stderr = global i32 0
@.str.1 = [37 x i8] c"%s: cannot connect to X server '%s'\0A\00"
@.str.2 = [36 x i8] c"window width - '%d'; height - '%d'\0A\00"
@False = global i32 0
@.str.3 = [9 x i8] c"icon.bmp\00"
@.str.4 = [51 x i8] c"XReadBitmapFile - could not open file 'icon.bmp'.\0A\00"
@.str.5 = [61 x i8] c"XReadBitmapFile - file '%s' doesn't contain a valid bitmap.\0A\00"
@.str.6 = [38 x i8] c"XReadBitmapFile - not enough memory.\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = tail call i8* @getenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32* @XOpenDisplay(i8* %8)
%10 = icmp eq i32* %9, null
br i1 %10, label %11, label %16
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = load i8*, i8** %1
%14 = tail call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i8* %13, i8* %8)
%15 = tail call i32 @exit(i32 1)
unreachable
16: ; preds = %2
%17 = tail call i32 @DefaultScreen(i32* %9)
%18 = tail call i32 @DisplayWidth(i32* %9, i32 %17)
%19 = tail call i32 @DisplayHeight(i32* %9, i32 %17)
%20 = udiv i32 %18, 3
%21 = udiv i32 %19, 3
%22 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i32 %20, i32 %21)
%23 = tail call i32 @create_simple_window(i32* %9, i32 %20, i32 %21, i32 0, i32 0)
%24 = tail call i32 @create_gc(i32* %9, i32 %23, i32 0)
%25 = load i32, i32* @False
%26 = tail call i32 @XSync(i32* %9, i32 %25)
%27 = bitcast i32* %3 to i8*
%28 = bitcast i32* %4 to i8*
%29 = bitcast i32* %5 to i8*
%30 = bitcast i32* %6 to i8*
%31 = bitcast i32* %7 to i8*
%32 = call i32 @XReadBitmapFile(i32* %9, i32 %23, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32* %4, i32* %5, i32* %3, i32* %6, i32* %7)
switch i32 %32, label %45 [
i32 128, label %33
i32 130, label %37
i32 129, label %41
]
33: ; preds = %16
%34 = load i32, i32* @stderr
%35 = call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.4, i64 0, i64 0))
%36 = call i32 @exit(i32 1)
unreachable
37: ; preds = %16
%38 = load i32, i32* @stderr
%39 = call i32 (i32, i8*, ...) @fprintf(i32 %38, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%40 = call i32 @exit(i32 1)
unreachable
41: ; preds = %16
%42 = load i32, i32* @stderr
%43 = call i32 (i32, i8*, ...) @fprintf(i32 %42, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.6, i64 0, i64 0))
%44 = call i32 @exit(i32 1)
unreachable
45: ; preds = %16, %45
%46 = phi i32 [ %99, %45 ], [ 0, %16 ]
%47 = load i32, i32* %3
%48 = load i32, i32* %4
%49 = load i32, i32* %5
%50 = mul i32 %49, %46
%51 = call i32 @XCopyPlane(i32* %9, i32 %47, i32 %23, i32 %24, i32 0, i32 0, i32 %48, i32 %49, i32 0, i32 %50, i32 1)
%52 = load i32, i32* @False
%53 = call i32 @XSync(i32* %9, i32 %52)
%54 = call i32 @usleep(i32 100000)
%55 = load i32, i32* %3
%56 = load i32, i32* %4
%57 = load i32, i32* %5
%58 = mul i32 %57, %46
%59 = call i32 @XCopyPlane(i32* %9, i32 %55, i32 %23, i32 %24, i32 0, i32 0, i32 %56, i32 %57, i32 %56, i32 %58, i32 1)
%60 = load i32, i32* @False
%61 = call i32 @XSync(i32* %9, i32 %60)
%62 = call i32 @usleep(i32 100000)
%63 = load i32, i32* %3
%64 = load i32, i32* %4
%65 = load i32, i32* %5
%66 = shl i32 %64, 1
%67 = mul i32 %65, %46
%68 = call i32 @XCopyPlane(i32* %9, i32 %63, i32 %23, i32 %24, i32 0, i32 0, i32 %64, i32 %65, i32 %66, i32 %67, i32 1)
%69 = load i32, i32* @False
%70 = call i32 @XSync(i32* %9, i32 %69)
%71 = call i32 @usleep(i32 100000)
%72 = load i32, i32* %3
%73 = load i32, i32* %4
%74 = load i32, i32* %5
%75 = mul i32 %73, 3
%76 = mul i32 %74, %46
%77 = call i32 @XCopyPlane(i32* %9, i32 %72, i32 %23, i32 %24, i32 0, i32 0, i32 %73, i32 %74, i32 %75, i32 %76, i32 1)
%78 = load i32, i32* @False
%79 = call i32 @XSync(i32* %9, i32 %78)
%80 = call i32 @usleep(i32 100000)
%81 = load i32, i32* %3
%82 = load i32, i32* %4
%83 = load i32, i32* %5
%84 = shl i32 %82, 2
%85 = mul i32 %83, %46
%86 = call i32 @XCopyPlane(i32* %9, i32 %81, i32 %23, i32 %24, i32 0, i32 0, i32 %82, i32 %83, i32 %84, i32 %85, i32 1)
%87 = load i32, i32* @False
%88 = call i32 @XSync(i32* %9, i32 %87)
%89 = call i32 @usleep(i32 100000)
%90 = load i32, i32* %3
%91 = load i32, i32* %4
%92 = load i32, i32* %5
%93 = mul i32 %91, 5
%94 = mul i32 %92, %46
%95 = call i32 @XCopyPlane(i32* %9, i32 %90, i32 %23, i32 %24, i32 0, i32 0, i32 %91, i32 %92, i32 %93, i32 %94, i32 1)
%96 = load i32, i32* @False
%97 = call i32 @XSync(i32* %9, i32 %96)
%98 = call i32 @usleep(i32 100000)
%99 = add nuw nsw i32 %46, 1
%100 = icmp eq i32 %99, 6
br i1 %100, label %101, label %45
101: ; preds = %45
%102 = call i32 @XFlush(i32* %9)
%103 = call i32 @sleep(i32 4)
%104 = call i32 @XCloseDisplay(i32* %9)
ret i32 0
}