#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_9__ TYPE_4__;
typedef struct TYPE_8__ TYPE_3__;
typedef struct TYPE_7__ TYPE_2__;
typedef struct TYPE_6__ TYPE_1__;

/* Type definitions */
struct TYPE_7__ {
  int /*<<< orphan*/ *l;
};
struct TYPE_8__ {
  TYPE_2__ data;
};
struct TYPE_6__ {
  int width;
  int height;
  int /*<<< orphan*/ y;
  int /*<<< orphan*/ x;
};
struct TYPE_9__ {
  int type;
  TYPE_3__ xclient;
  TYPE_1__ xexpose;
};
typedef TYPE_4__ XEvent;
typedef int /*<<< orphan*/ Window;
typedef int /*<<< orphan*/ Pixmap;
typedef int /*<<< orphan*/ GC;
typedef int /*<<< orphan*/ Display;
typedef int /*<<< orphan*/ Atom;

/* Variables and functions */
int /*<<< orphan*/ BlackPixel(int /*<<< orphan*/ *, int /*<<< orphan*/);
#define ClientMessage 129
int /*<<< orphan*/ DefaultDepth(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ DefaultRootWindow(int /*<<< orphan*/ *);
#define Expose 128
int /*<<< orphan*/ ExposureMask;
int /*<<< orphan*/ False;
int /*<<< orphan*/ WhitePixel(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ XCopyArea(int /*<<< orphan*/ *, int /*<<< orphan*/,
                             int /*<<< orphan*/, int /*<<< orphan*/,
                             int /*<<< orphan*/, int /*<<< orphan*/, int, int,
                             int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ XCreateGC(int /*<<< orphan*/ *, int /*<<< orphan*/,
                             int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ XCreatePixmap(int /*<<< orphan*/ *, int /*<<< orphan*/, int,
                                 int, int /*<<< orphan*/);
int /*<<< orphan*/ XCreateSimpleWindow(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                       int /*<<< orphan*/, int /*<<< orphan*/,
                                       int, int, int /*<<< orphan*/, long,
                                       int /*<<< orphan*/);
int /*<<< orphan*/ XFillRectangle(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                  int /*<<< orphan*/, int, int, int, int);
int /*<<< orphan*/ XFreePixmap(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ XInternAtom(int /*<<< orphan*/ *, char *,
                               int /*<<< orphan*/);
int /*<<< orphan*/ XMapWindow(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ XNextEvent(int /*<<< orphan*/ *, TYPE_4__ *);
int /*<<< orphan*/ *XOpenDisplay(char *);
int /*<<< orphan*/ XSelectInput(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                int /*<<< orphan*/);
int /*<<< orphan*/ XSetForeground(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                  int /*<<< orphan*/);
int /*<<< orphan*/ XSetWMProtocols(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                   int /*<<< orphan*/ *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
char *getenv(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  char *pcDisplay;
  Display *dpy;
  int ret;
  if ((pcDisplay = getenv("DISPLAY")) == NULL) {
    fprintf(stderr, "Error: DISPLAY environment variable not set\n");
    exit(1);
  }
  if ((dpy = XOpenDisplay(pcDisplay)) == NULL) {
    fprintf(stderr, "Error: Can't open display: %s\n", pcDisplay);
    exit(1);
  }
  int width = 200;
  int height = 200;
  Window w = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 0, 0, width,
                                 height, 0, 0L, WhitePixel(dpy, 0));
  XSelectInput(dpy, w, ExposureMask);
  Pixmap canvas = XCreatePixmap(dpy, w, width, height, DefaultDepth(dpy, 0));
  GC gc = XCreateGC(dpy, canvas, 0, NULL);
  XSetForeground(dpy, gc, BlackPixel(dpy, 0));
  XFillRectangle(dpy, canvas, gc, 0, 0, width, height);
  XSetForeground(dpy, gc, WhitePixel(dpy, 0));
  XFillRectangle(dpy, canvas, gc, 50, 50, 50, 50);
  XCopyArea(dpy, canvas, w, gc, 0, 0, width, height, 0, 0);
  XMapWindow(dpy, w);
  Atom wmDeleteMessage = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
  XSetWMProtocols(dpy, w, &wmDeleteMessage, 1);
  XEvent e;
  int running = 1;
  while (running) {
    XNextEvent(dpy, &e);
    switch (e.type) {
    case Expose:
      XCopyArea(dpy, canvas, w, gc, e.xexpose.x, e.xexpose.y, e.xexpose.width,
                e.xexpose.height, e.xexpose.x, e.xexpose.y);
      break;
    case ClientMessage:
      if (e.xclient.data.l[0] == wmDeleteMessage)
        running = 0;
      break;
    Default:
      printf("Got event %d\n", e.type);
    }
  }
  printf("%s:%d: after for loop \n",
         "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
         "2022-01-22/02-19-57/repos/bgoodr/x-manip/refs/heads/master/"
         "ximagetunnel/pixmap.c",
         86);
  fflush(stdout);
  XFreePixmap(dpy, canvas);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0xd8,%rsp
movl   $0x0,-0xc(%rbp)
mov    %edi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
lea    0xd7f(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    12b5 <main+0x55>
mov    0x2d3d(%rip),%rax
mov    (%rax),%edi
lea    0xd64(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
mov    -0x20(%rbp),%rdi
call   1090 <XOpenDisplay@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    12f1 <main+0x91>
mov    0x2d05(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xd55(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
movl   $0xc8,-0x30(%rbp)
movl   $0xc8,-0x34(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0xb8(%rbp)
mov    -0x28(%rbp),%rdi
call   1040 <DefaultRootWindow@plt>
mov    %eax,-0xac(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0xa8(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0xa4(%rbp)
mov    -0x28(%rbp),%rdi
xor    %esi,%esi
call   1080 <WhitePixel@plt>
mov    -0xb8(%rbp),%rdi
mov    -0xac(%rbp),%esi
mov    -0xa8(%rbp),%r8d
mov    -0xa4(%rbp),%r9d
xor    %ecx,%ecx
xor    %edx,%edx
mov    %ecx,%edx
movl   $0x0,(%rsp)
movq   $0x0,0x8(%rsp)
mov    %eax,0x10(%rsp)
call   1130 <XCreateSimpleWindow@plt>
mov    %eax,-0x38(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x38(%rbp),%esi
mov    0x2c47(%rip),%rax
mov    (%rax),%edx
call   1100 <XSelectInput@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0xa0(%rbp)
mov    -0x38(%rbp),%eax
mov    %eax,-0x94(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x90(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x8c(%rbp)
mov    -0x28(%rbp),%rdi
xor    %esi,%esi
call   1110 <DefaultDepth@plt>
mov    -0xa0(%rbp),%rdi
mov    -0x94(%rbp),%esi
mov    -0x90(%rbp),%edx
mov    -0x8c(%rbp),%ecx
mov    %eax,%r8d
call   1180 <XCreatePixmap@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x3c(%rbp),%esi
xor    %edx,%edx
xor    %eax,%eax
mov    %eax,%ecx
call   1120 <XCreateGC@plt>
mov    %eax,-0x40(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x40(%rbp),%eax
mov    %eax,-0x7c(%rbp)
mov    -0x28(%rbp),%rdi
xor    %esi,%esi
call   1140 <BlackPixel@plt>
mov    -0x88(%rbp),%rdi
mov    -0x7c(%rbp),%esi
mov    %eax,%edx
call   1150 <XSetForeground@plt>
mov    -0x28(%rbp),%rdi
mov    -0x3c(%rbp),%esi
mov    -0x40(%rbp),%edx
mov    -0x30(%rbp),%r9d
mov    -0x34(%rbp),%eax
xor    %r8d,%r8d
mov    %r8d,%ecx
mov    %eax,(%rsp)
call   1050 <XFillRectangle@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x40(%rbp),%eax
mov    %eax,-0x70(%rbp)
mov    -0x28(%rbp),%rdi
xor    %esi,%esi
call   1080 <WhitePixel@plt>
mov    -0x78(%rbp),%rdi
mov    -0x70(%rbp),%esi
mov    %eax,%edx
call   1150 <XSetForeground@plt>
mov    -0x28(%rbp),%rdi
mov    -0x3c(%rbp),%esi
mov    -0x40(%rbp),%edx
mov    $0x32,%r9d
mov    %r9d,%ecx
mov    %r9d,%r8d
movl   $0x32,(%rsp)
call   1050 <XFillRectangle@plt>
mov    -0x28(%rbp),%rdi
mov    -0x3c(%rbp),%esi
mov    -0x38(%rbp),%edx
mov    -0x40(%rbp),%ecx
mov    -0x30(%rbp),%r10d
mov    -0x34(%rbp),%eax
xor    %r9d,%r9d
mov    %r9d,%r8d
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
movl   $0x0,0x10(%rsp)
movl   $0x0,0x18(%rsp)
call   10c0 <XCopyArea@plt>
mov    -0x28(%rbp),%rdi
mov    -0x38(%rbp),%esi
call   1160 <XMapWindow@plt>
mov    -0x28(%rbp),%rdi
mov    0x2b13(%rip),%rax
mov    (%rax),%edx
lea    0xb76(%rip),%rsi
call   10f0 <XInternAtom@plt>
mov    %eax,-0x44(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x38(%rbp),%esi
lea    -0x44(%rbp),%rdx
mov    $0x1,%ecx
call   10b0 <XSetWMProtocols@plt>
movl   $0x1,-0x6c(%rbp)
cmpl   $0x0,-0x6c(%rbp)
je     15a6 <main+0x346>
mov    -0x28(%rbp),%rdi
lea    -0x68(%rbp),%rsi
call   10d0 <XNextEvent@plt>
mov    -0x68(%rbp),%eax
mov    %eax,-0xbc(%rbp)
sub    $0x80,%eax
je     1548 <main+0x2e8>
jmp    1532 <main+0x2d2>
mov    -0xbc(%rbp),%eax
sub    $0x81,%eax
je     1586 <main+0x326>
jmp    15a1 <main+0x341>
mov    -0x28(%rbp),%rdi
mov    -0x3c(%rbp),%esi
mov    -0x38(%rbp),%edx
mov    -0x40(%rbp),%ecx
mov    -0x4c(%rbp),%r8d
mov    -0x50(%rbp),%r9d
mov    -0x58(%rbp),%ebx
mov    -0x54(%rbp),%r11d
mov    -0x4c(%rbp),%r10d
mov    -0x50(%rbp),%eax
mov    %ebx,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
call   10c0 <XCopyArea@plt>
jmp    15a1 <main+0x341>
mov    -0x60(%rbp),%rax
mov    (%rax),%eax
cmp    -0x44(%rbp),%eax
jne    159c <main+0x33c>
movl   $0x0,-0x6c(%rbp)
jmp    15a1 <main+0x341>
jmp    1502 <main+0x2a2>
lea    0xac6(%rip),%rdi
lea    0xad7(%rip),%rsi
mov    $0x56,%edx
mov    $0x0,%al
call   1060 <printf@plt>
mov    0x2a09(%rip),%rax
mov    (%rax),%edi
call   10e0 <fflush@plt>
mov    -0x28(%rbp),%rdi
mov    -0x3c(%rbp),%esi
call   1070 <XFreePixmap@plt>
xor    %eax,%eax
add    $0xd8,%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
lea    0xd8b(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     14c0 <main+0x260>
mov    %rax,%rbp
mov    %rax,%rdi
call   1090 <XOpenDisplay@plt>
test   %rax,%rax
je     14e1 <main+0x281>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <DefaultRootWindow@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
xor    %esi,%esi
call   1080 <WhitePixel@plt>
sub    $0x8,%rsp
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %edx,%edx
xor    %ecx,%ecx
mov    $0xc8,%r8d
mov    $0xc8,%r9d
push   %rax
push   $0x0
push   $0x0
call   1130 <XCreateSimpleWindow@plt>
add    $0x20,%rsp
mov    %eax,%r14d
mov    0x2ce9(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    %r14d,%esi
call   1100 <XSelectInput@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1110 <DefaultDepth@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
mov    $0xc8,%edx
mov    $0xc8,%ecx
mov    %eax,%r8d
call   1180 <XCreatePixmap@plt>
mov    %eax,%r15d
mov    %rbx,%rdi
mov    %eax,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1120 <XCreateGC@plt>
mov    %eax,%r12d
mov    %rbx,%rdi
xor    %esi,%esi
call   1140 <BlackPixel@plt>
mov    %rbx,%rdi
mov    %r12d,%esi
mov    %eax,%edx
call   1150 <XSetForeground@plt>
sub    $0x8,%rsp
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %r12d,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
mov    $0xc8,%r9d
push   $0xc8
call   1050 <XFillRectangle@plt>
add    $0x10,%rsp
mov    %rbx,%rdi
xor    %esi,%esi
call   1080 <WhitePixel@plt>
mov    %rbx,%rdi
mov    %r12d,%esi
mov    %eax,%edx
call   1150 <XSetForeground@plt>
sub    $0x8,%rsp
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %r12d,%edx
mov    $0x32,%ecx
mov    $0x32,%r8d
mov    $0x32,%r9d
push   $0x32
call   1050 <XFillRectangle@plt>
add    $0x10,%rsp
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %r14d,%edx
mov    %r12d,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
push   $0x0
push   $0x0
push   $0xc8
push   $0xc8
call   10c0 <XCopyArea@plt>
add    $0x20,%rsp
mov    %rbx,%rdi
mov    %r14d,%esi
call   1160 <XMapWindow@plt>
mov    0x2c0e(%rip),%rax
mov    (%rax),%edx
lea    0xc71(%rip),%rsi
mov    %rbx,%rdi
call   10f0 <XInternAtom@plt>
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%rdx
mov    %rbx,%rdi
mov    %r14d,%esi
mov    $0x1,%ecx
call   10b0 <XSetWMProtocols@plt>
lea    0x8(%rsp),%r13
jmp    1424 <main+0x1c4>
nopl   0x0(%rax,%rax,1)
mov    0x10(%rsp),%rax
mov    (%rax),%ecx
xor    %eax,%eax
cmp    0x4(%rsp),%ecx
setne  %al
test   %eax,%eax
je     147c <main+0x21c>
mov    %rbx,%rdi
mov    %r13,%rsi
call   10d0 <XNextEvent@plt>
mov    0x8(%rsp),%ecx
cmp    $0x81,%ecx
je     1410 <main+0x1b0>
mov    $0x1,%eax
cmp    $0x80,%ecx
jne    1420 <main+0x1c0>
mov    0x24(%rsp),%r8d
mov    0x20(%rsp),%r9d
mov    0x18(%rsp),%eax
mov    0x1c(%rsp),%ebp
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %r14d,%edx
mov    %r12d,%ecx
push   %r9
push   %r8
push   %rbp
push   %rax
call   10c0 <XCopyArea@plt>
add    $0x20,%rsp
mov    $0x1,%eax
jmp    1420 <main+0x1c0>
lea    0xbe2(%rip),%rdi
lea    0xbf3(%rip),%rsi
mov    $0x56,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x2b33(%rip),%rax
mov    (%rax),%edi
call   10e0 <fflush@plt>
mov    %rbx,%rdi
mov    %r15d,%esi
call   1070 <XFreePixmap@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2b11(%rip),%rax
mov    (%rax),%edi
lea    0xb38(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
mov    0x2af0(%rip),%rax
mov    (%rax),%edi
lea    0xb44(%rip),%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   1170 <exit@plt>

LLVM IR (-O0):
%struct.TYPE_9__ = type { i32, %struct.TYPE_8__, %struct.TYPE_6__ }
%struct.TYPE_8__ = type { %struct.TYPE_7__ }
%struct.TYPE_7__ = type { i32* }
%struct.TYPE_6__ = type { i32, i32, i32, i32 }
@.str = [8 x i8] c"DISPLAY\00"
@stderr = global i32 0
@.str.1 = [45 x i8] c"Error: DISPLAY environment variable not set\0A\00"
@.str.2 = [31 x i8] c"Error: Can't open display: %s\0A\00"
@ExposureMask = global i32 0
@.str.3 = [17 x i8] c"WM_DELETE_WINDOW\00"
@False = global i32 0
@.str.4 = [14 x i8] c"Got event %d\0A\00"
@.str.5 = [24 x i8] c"%s:%d: after for loop \0A\00"
@.str.6 = [145 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bgoodr/x-manip/refs/heads/master/ximagetunnel/pixmap.c\00"
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca %struct.TYPE_9__
%16 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = call i8* @getenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
store i8* %17, i8** %6
%18 = icmp eq i8* %17, null
br i1 %18, label %19, label %23
19: ; preds = %2
%20 = load i32, i32* @stderr
%21 = call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
%22 = call i32 @exit(i32 1)
unreachable
23: ; preds = %2
%24 = load i8*, i8** %6
%25 = call i32* @XOpenDisplay(i8* %24)
store i32* %25, i32** %7
%26 = icmp eq i32* %25, null
br i1 %26, label %27, label %32
27: ; preds = %23
%28 = load i32, i32* @stderr
%29 = load i8*, i8** %6
%30 = call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i8* %29)
%31 = call i32 @exit(i32 1)
unreachable
32: ; preds = %23
store i32 200, i32* %9
store i32 200, i32* %10
%33 = load i32*, i32** %7
%34 = load i32*, i32** %7
%35 = call i32 @DefaultRootWindow(i32* %34)
%36 = load i32, i32* %9
%37 = load i32, i32* %10
%38 = load i32*, i32** %7
%39 = call i32 @WhitePixel(i32* %38, i32 0)
%40 = call i32 @XCreateSimpleWindow(i32* %33, i32 %35, i32 0, i32 0, i32 %36, i32 %37, i32 0, i64 0, i32 %39)
store i32 %40, i32* %11
%41 = load i32*, i32** %7
%42 = load i32, i32* %11
%43 = load i32, i32* @ExposureMask
%44 = call i32 @XSelectInput(i32* %41, i32 %42, i32 %43)
%45 = load i32*, i32** %7
%46 = load i32, i32* %11
%47 = load i32, i32* %9
%48 = load i32, i32* %10
%49 = load i32*, i32** %7
%50 = call i32 @DefaultDepth(i32* %49, i32 0)
%51 = call i32 @XCreatePixmap(i32* %45, i32 %46, i32 %47, i32 %48, i32 %50)
store i32 %51, i32* %12
%52 = load i32*, i32** %7
%53 = load i32, i32* %12
%54 = call i32 @XCreateGC(i32* %52, i32 %53, i32 0, i32* null)
store i32 %54, i32* %13
%55 = load i32*, i32** %7
%56 = load i32, i32* %13
%57 = load i32*, i32** %7
%58 = call i32 @BlackPixel(i32* %57, i32 0)
%59 = call i32 @XSetForeground(i32* %55, i32 %56, i32 %58)
%60 = load i32*, i32** %7
%61 = load i32, i32* %12
%62 = load i32, i32* %13
%63 = load i32, i32* %9
%64 = load i32, i32* %10
%65 = call i32 @XFillRectangle(i32* %60, i32 %61, i32 %62, i32 0, i32 0, i32 %63, i32 %64)
%66 = load i32*, i32** %7
%67 = load i32, i32* %13
%68 = load i32*, i32** %7
%69 = call i32 @WhitePixel(i32* %68, i32 0)
%70 = call i32 @XSetForeground(i32* %66, i32 %67, i32 %69)
%71 = load i32*, i32** %7
%72 = load i32, i32* %12
%73 = load i32, i32* %13
%74 = call i32 @XFillRectangle(i32* %71, i32 %72, i32 %73, i32 50, i32 50, i32 50, i32 50)
%75 = load i32*, i32** %7
%76 = load i32, i32* %12
%77 = load i32, i32* %11
%78 = load i32, i32* %13
%79 = load i32, i32* %9
%80 = load i32, i32* %10
%81 = call i32 @XCopyArea(i32* %75, i32 %76, i32 %77, i32 %78, i32 0, i32 0, i32 %79, i32 %80, i32 0, i32 0)
%82 = load i32*, i32** %7
%83 = load i32, i32* %11
%84 = call i32 @XMapWindow(i32* %82, i32 %83)
%85 = load i32*, i32** %7
%86 = load i32, i32* @False
%87 = call i32 @XInternAtom(i32* %85, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %86)
store i32 %87, i32* %14
%88 = load i32*, i32** %7
%89 = load i32, i32* %11
%90 = call i32 @XSetWMProtocols(i32* %88, i32 %89, i32* %14, i32 1)
store i32 1, i32* %16
br label %91
91: ; preds = %138, %32
%92 = load i32, i32* %16
%93 = icmp ne i32 %92, 0
br i1 %93, label %94, label %139
94: ; preds = %91
%95 = load i32*, i32** %7
%96 = call i32 @XNextEvent(i32* %95, %struct.TYPE_9__* %15)
%97 = getelementptr inbounds %struct.TYPE_9__, %struct.TYPE_9__* %15, i32 0, i32 0
%98 = load i32, i32* %97
switch i32 %98, label %138 [
i32 128, label %99
i32 129, label %123
]
99: ; preds = %94
%100 = load i32*, i32** %7
%101 = load i32, i32* %12
%102 = load i32, i32* %11
%103 = load i32, i32* %13
%104 = getelementptr inbounds %struct.TYPE_9__, %struct.TYPE_9__* %15, i32 0, i32 2
%105 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %104, i32 0, i32 3
%106 = load i32, i32* %105
%107 = getelementptr inbounds %struct.TYPE_9__, %struct.TYPE_9__* %15, i32 0, i32 2
%108 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %107, i32 0, i32 2
%109 = load i32, i32* %108
%110 = getelementptr inbounds %struct.TYPE_9__, %struct.TYPE_9__* %15, i32 0, i32 2
%111 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %110, i32 0, i32 0
%112 = load i32, i32* %111
%113 = getelementptr inbounds %struct.TYPE_9__, %struct.TYPE_9__* %15, i32 0, i32 2
%114 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %113, i32 0, i32 1
%115 = load i32, i32* %114
%116 = getelementptr inbounds %struct.TYPE_9__, %struct.TYPE_9__* %15, i32 0, i32 2
%117 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %116, i32 0, i32 3
%118 = load i32, i32* %117
%119 = getelementptr inbounds %struct.TYPE_9__, %struct.TYPE_9__* %15, i32 0, i32 2
%120 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %119, i32 0, i32 2
%121 = load i32, i32* %120
%122 = call i32 @XCopyArea(i32* %100, i32 %101, i32 %102, i32 %103, i32 %106, i32 %109, i32 %112, i32 %115, i32 %118, i32 %121)
br label %138
123: ; preds = %94
%124 = getelementptr inbounds %struct.TYPE_9__, %struct.TYPE_9__* %15, i32 0, i32 1
%125 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %124, i32 0, i32 0
%126 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %125, i32 0, i32 0
%127 = load i32*, i32** %126
%128 = getelementptr inbounds i32, i32* %127, i64 0
%129 = load i32, i32* %128
%130 = load i32, i32* %14
%131 = icmp eq i32 %129, %130
br i1 %131, label %132, label %133
132: ; preds = %123
store i32 0, i32* %16
br label %133
133: ; preds = %132, %123
br label %138
134: ; No predecessors!
%135 = getelementptr inbounds %struct.TYPE_9__, %struct.TYPE_9__* %15, i32 0, i32 0
%136 = load i32, i32* %135
%137 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 %136)
br label %138
138: ; preds = %134, %94, %133, %99
br label %91
139: ; preds = %91
%140 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str.6, i64 0, i64 0), i32 86)
%141 = load i32, i32* @stdout
%142 = call i32 @fflush(i32 %141)
%143 = load i32*, i32** %7
%144 = load i32, i32* %12
%145 = call i32 @XFreePixmap(i32* %143, i32 %144)
ret i32 0
}

LLVM IR (-O2):
%struct.TYPE_9__ = type { i32, %struct.TYPE_8__, %struct.TYPE_6__ }
%struct.TYPE_8__ = type { %struct.TYPE_7__ }
%struct.TYPE_7__ = type { i32* }
%struct.TYPE_6__ = type { i32, i32, i32, i32 }
@.str = [8 x i8] c"DISPLAY\00"
@stderr = global i32 0
@.str.1 = [45 x i8] c"Error: DISPLAY environment variable not set\0A\00"
@.str.2 = [31 x i8] c"Error: Can't open display: %s\0A\00"
@ExposureMask = global i32 0
@.str.3 = [17 x i8] c"WM_DELETE_WINDOW\00"
@False = global i32 0
@.str.5 = [24 x i8] c"%s:%d: after for loop \0A\00"
@.str.6 = [145 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bgoodr/x-manip/refs/heads/master/ximagetunnel/pixmap.c\00"
@stdout = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca %struct.TYPE_9__
%5 = tail call i8* @getenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = tail call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %2
%12 = tail call i32* @XOpenDisplay(i8* %5)
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %18
14: ; preds = %11
%15 = load i32, i32* @stderr
%16 = tail call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i8* %5)
%17 = tail call i32 @exit(i32 1)
unreachable
18: ; preds = %11
%19 = tail call i32 @DefaultRootWindow(i32* %12)
%20 = tail call i32 @WhitePixel(i32* %12, i32 0)
%21 = tail call i32 @XCreateSimpleWindow(i32* %12, i32 %19, i32 0, i32 0, i32 200, i32 200, i32 0, i64 0, i32 %20)
%22 = load i32, i32* @ExposureMask
%23 = tail call i32 @XSelectInput(i32* %12, i32 %21, i32 %22)
%24 = tail call i32 @DefaultDepth(i32* %12, i32 0)
%25 = tail call i32 @XCreatePixmap(i32* %12, i32 %21, i32 200, i32 200, i32 %24)
%26 = tail call i32 @XCreateGC(i32* %12, i32 %25, i32 0, i32* null)
%27 = tail call i32 @BlackPixel(i32* %12, i32 0)
%28 = tail call i32 @XSetForeground(i32* %12, i32 %26, i32 %27)
%29 = tail call i32 @XFillRectangle(i32* %12, i32 %25, i32 %26, i32 0, i32 0, i32 200, i32 200)
%30 = tail call i32 @WhitePixel(i32* %12, i32 0)
%31 = tail call i32 @XSetForeground(i32* %12, i32 %26, i32 %30)
%32 = tail call i32 @XFillRectangle(i32* %12, i32 %25, i32 %26, i32 50, i32 50, i32 50, i32 50)
%33 = tail call i32 @XCopyArea(i32* %12, i32 %25, i32 %21, i32 %26, i32 0, i32 0, i32 200, i32 200, i32 0, i32 0)
%34 = tail call i32 @XMapWindow(i32* %12, i32 %21)
%35 = bitcast i32* %3 to i8*
%36 = load i32, i32* @False
%37 = tail call i32 @XInternAtom(i32* %12, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %36)
store i32 %37, i32* %3
%38 = call i32 @XSetWMProtocols(i32* %12, i32 %21, i32* %3, i32 1)
%39 = bitcast %struct.TYPE_9__* %4 to i8*
%40 = getelementptr inbounds %struct.TYPE_9__, %struct.TYPE_9__* %4, i64 0, i32 0
%41 = getelementptr inbounds %struct.TYPE_9__, %struct.TYPE_9__* %4, i64 0, i32 1, i32 0, i32 0
%42 = getelementptr inbounds %struct.TYPE_9__, %struct.TYPE_9__* %4, i64 0, i32 2, i32 3
%43 = getelementptr inbounds %struct.TYPE_9__, %struct.TYPE_9__* %4, i64 0, i32 2, i32 2
%44 = getelementptr inbounds %struct.TYPE_9__, %struct.TYPE_9__* %4, i64 0, i32 2, i32 0
%45 = getelementptr inbounds %struct.TYPE_9__, %struct.TYPE_9__* %4, i64 0, i32 2, i32 1
br label %46
46: ; preds = %18, %61
%47 = call i32 @XNextEvent(i32* %12, %struct.TYPE_9__* %4)
%48 = load i32, i32* %40
switch i32 %48, label %61 [
i32 128, label %49
i32 129, label %55
]
49: ; preds = %46
%50 = load i32, i32* %42
%51 = load i32, i32* %43
%52 = load i32, i32* %44
%53 = load i32, i32* %45
%54 = call i32 @XCopyArea(i32* %12, i32 %25, i32 %21, i32 %26, i32 %50, i32 %51, i32 %52, i32 %53, i32 %50, i32 %51)
br label %61
55: ; preds = %46
%56 = load i32*, i32** %41
%57 = load i32, i32* %56
%58 = load i32, i32* %3
%59 = icmp ne i32 %57, %58
%60 = zext i1 %59 to i32
br label %61
61: ; preds = %55, %46, %49
%62 = phi i32 [ 1, %46 ], [ 1, %49 ], [ %60, %55 ]
%63 = icmp eq i32 %62, 0
br i1 %63, label %64, label %46
64: ; preds = %61
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str.6, i64 0, i64 0), i32 86)
%66 = load i32, i32* @stdout
%67 = call i32 @fflush(i32 %66)
%68 = call i32 @XFreePixmap(i32* %12, i32 %25)
ret i32 0
}