#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 */
struct TYPE_3__ {
  scalar_t__ background;
};
typedef TYPE_1__ XGCValues;
typedef int /*<<< orphan*/ Pixmap;
typedef int /*<<< orphan*/ GC;
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
int /*<<< orphan*/ CapButt;
int /*<<< orphan*/ GCBackground;
int /*<<< orphan*/ JoinBevel;
int /*<<< orphan*/ LineSolid;
int /*<<< orphan*/ XCreateGC(int /*<<< orphan*/ *, int /*<<< orphan*/,
                             int /*<<< orphan*/, TYPE_1__ *);
int /*<<< orphan*/ XDrawLine(int /*<<< orphan*/ *, int /*<<< orphan*/,
                             int /*<<< orphan*/, int /*<<< orphan*/, int, int,
                             int);
int /*<<< orphan*/ XFillRectangle(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                  int /*<<< orphan*/, int, int, int, int);
int /*<<< orphan*/ XFreeGC(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ XSetForeground(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                  int);
int /*<<< orphan*/ XSetLineAttributes(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                      int, int /*<<< orphan*/,
                                      int /*<<< orphan*/, int /*<<< orphan*/);
void DrawPixmapImage(Display *dpy, Pixmap pm, int w, int h) {
  XGCValues gcvals;
  GC gc;
  gcvals.background = 0;
  gc = XCreateGC(dpy, pm, GCBackground, &gcvals);
  XSetForeground(dpy, gc, 0x0);
  XFillRectangle(dpy, pm, gc, 0, 0, w, h);
  XSetForeground(dpy, gc, 0xff0000);
  XFillRectangle(dpy, pm, gc, 0, 0, 50, 50);
  XSetForeground(dpy, gc, 0x00ff00);
  XFillRectangle(dpy, pm, gc, w - 50, 0, 50, 50);
  XSetForeground(dpy, gc, 0x0000ff);
  XFillRectangle(dpy, pm, gc, 0, h - 50, 50, 50);
  XSetForeground(dpy, gc, 0xffffff);
  XFillRectangle(dpy, pm, gc, h - 50, h - 50, 50, 50);
  XSetForeground(dpy, gc, 0xffff00);
  XSetLineAttributes(dpy, gc, 3, LineSolid, CapButt, JoinBevel);
  XDrawLine(dpy, pm, gc, 0, 0, w, h);
  XDrawLine(dpy, pm, gc, 0, h, w, 0);
  XFreeGC(dpy, gc);
}


x86 assembly (clang, -O0):
<DrawPixmapImage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    0x2e45(%rip),%rax
mov    (%rax),%edx
lea    -0x20(%rbp),%rcx
call   1050 <XCreateGC@plt>
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%esi
xor    %edx,%edx
call   1060 <XSetForeground@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x10(%rbp),%r9d
mov    -0x14(%rbp),%eax
xor    %r8d,%r8d
mov    %r8d,%ecx
mov    %eax,(%rsp)
call   1030 <XFillRectangle@plt>
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    $0xff0000,%edx
call   1060 <XSetForeground@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x24(%rbp),%edx
xor    %r8d,%r8d
mov    $0x32,%r9d
mov    %r8d,%ecx
movl   $0x32,(%rsp)
call   1030 <XFillRectangle@plt>
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    $0xff00,%edx
call   1060 <XSetForeground@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x10(%rbp),%ecx
sub    $0x32,%ecx
xor    %r8d,%r8d
mov    $0x32,%r9d
movl   $0x32,(%rsp)
call   1030 <XFillRectangle@plt>
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    $0xff,%edx
call   1060 <XSetForeground@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x14(%rbp),%r8d
sub    $0x32,%r8d
xor    %ecx,%ecx
mov    $0x32,%r9d
movl   $0x32,(%rsp)
call   1030 <XFillRectangle@plt>
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    $0xffffff,%edx
call   1060 <XSetForeground@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x14(%rbp),%ecx
sub    $0x32,%ecx
mov    -0x14(%rbp),%r8d
sub    $0x32,%r8d
mov    $0x32,%r9d
movl   $0x32,(%rsp)
call   1030 <XFillRectangle@plt>
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    $0xffff00,%edx
call   1060 <XSetForeground@plt>
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    0x2d18(%rip),%rax
mov    (%rax),%ecx
mov    0x2d1f(%rip),%rax
mov    (%rax),%r8d
mov    0x2cf5(%rip),%rax
mov    (%rax),%r9d
mov    $0x3,%edx
call   1040 <XSetLineAttributes@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x10(%rbp),%r9d
mov    -0x14(%rbp),%eax
xor    %r8d,%r8d
mov    %r8d,%ecx
mov    %eax,(%rsp)
call   1080 <XDrawLine@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x14(%rbp),%r8d
mov    -0x10(%rbp),%r9d
xor    %ecx,%ecx
movl   $0x0,(%rsp)
call   1080 <XDrawLine@plt>
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1070 <XFreeGC@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DrawPixmapImage>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %ecx,%r15d
mov    %edx,%r14d
mov    %esi,%r12d
mov    %rdi,%rbx
movq   $0x0,0x10(%rsp)
mov    0x2e46(%rip),%rax
mov    (%rax),%edx
lea    0x10(%rsp),%rcx
call   1050 <XCreateGC@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    %eax,%esi
xor    %edx,%edx
call   1060 <XSetForeground@plt>
mov    %r15d,(%rsp)
mov    %rbx,%rdi
mov    %r12d,%esi
mov    %ebp,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
mov    %r14d,%r9d
call   1030 <XFillRectangle@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    $0xff0000,%edx
call   1060 <XSetForeground@plt>
movl   $0x32,(%rsp)
mov    %rbx,%rdi
mov    %r12d,%esi
mov    %ebp,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
mov    $0x32,%r9d
call   1030 <XFillRectangle@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    $0xff00,%edx
call   1060 <XSetForeground@plt>
lea    -0x32(%r14),%ecx
movl   $0x32,(%rsp)
mov    %rbx,%rdi
mov    %r12d,%esi
mov    %ebp,%edx
xor    %r8d,%r8d
mov    $0x32,%r9d
call   1030 <XFillRectangle@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    $0xff,%edx
call   1060 <XSetForeground@plt>
lea    -0x32(%r15),%r13d
movl   $0x32,(%rsp)
mov    %rbx,%rdi
mov    %r12d,%esi
mov    %ebp,%edx
xor    %ecx,%ecx
mov    %r13d,%r8d
mov    $0x32,%r9d
call   1030 <XFillRectangle@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    $0xffffff,%edx
call   1060 <XSetForeground@plt>
movl   $0x32,(%rsp)
mov    %rbx,%rdi
mov    %r12d,%esi
mov    %ebp,%edx
mov    %r13d,%ecx
mov    %r13d,%r8d
mov    $0x32,%r9d
call   1030 <XFillRectangle@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    $0xffff00,%edx
call   1060 <XSetForeground@plt>
mov    0x2d46(%rip),%rax
mov    (%rax),%ecx
mov    0x2d4d(%rip),%rax
mov    (%rax),%r8d
mov    0x2d23(%rip),%rax
mov    (%rax),%r9d
mov    %rbx,%rdi
mov    %ebp,%esi
mov    $0x3,%edx
call   1040 <XSetLineAttributes@plt>
mov    %r15d,(%rsp)
mov    %rbx,%rdi
mov    %r12d,%esi
mov    %ebp,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
mov    %r14d,%r9d
call   1080 <XDrawLine@plt>
movl   $0x0,(%rsp)
mov    %rbx,%rdi
mov    %r12d,%esi
mov    %ebp,%edx
xor    %ecx,%ecx
mov    %r15d,%r8d
mov    %r14d,%r9d
call   1080 <XDrawLine@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1070 <XFreeGC@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i64 }
@GCBackground = global i32 0
@LineSolid = global i32 0
@CapButt = global i32 0
@JoinBevel = global i32 0
define void @DrawPixmapImage(i32* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca %struct.TYPE_3__
%10 = alloca i32
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%11 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %9, i32 0, i32 0
store i64 0, i64* %11
%12 = load i32*, i32** %5
%13 = load i32, i32* %6
%14 = load i32, i32* @GCBackground
%15 = call i32 @XCreateGC(i32* %12, i32 %13, i32 %14, %struct.TYPE_3__* %9)
store i32 %15, i32* %10
%16 = load i32*, i32** %5
%17 = load i32, i32* %10
%18 = call i32 @XSetForeground(i32* %16, i32 %17, i32 0)
%19 = load i32*, i32** %5
%20 = load i32, i32* %6
%21 = load i32, i32* %10
%22 = load i32, i32* %7
%23 = load i32, i32* %8
%24 = call i32 @XFillRectangle(i32* %19, i32 %20, i32 %21, i32 0, i32 0, i32 %22, i32 %23)
%25 = load i32*, i32** %5
%26 = load i32, i32* %10
%27 = call i32 @XSetForeground(i32* %25, i32 %26, i32 16711680)
%28 = load i32*, i32** %5
%29 = load i32, i32* %6
%30 = load i32, i32* %10
%31 = call i32 @XFillRectangle(i32* %28, i32 %29, i32 %30, i32 0, i32 0, i32 50, i32 50)
%32 = load i32*, i32** %5
%33 = load i32, i32* %10
%34 = call i32 @XSetForeground(i32* %32, i32 %33, i32 65280)
%35 = load i32*, i32** %5
%36 = load i32, i32* %6
%37 = load i32, i32* %10
%38 = load i32, i32* %7
%39 = sub nsw i32 %38, 50
%40 = call i32 @XFillRectangle(i32* %35, i32 %36, i32 %37, i32 %39, i32 0, i32 50, i32 50)
%41 = load i32*, i32** %5
%42 = load i32, i32* %10
%43 = call i32 @XSetForeground(i32* %41, i32 %42, i32 255)
%44 = load i32*, i32** %5
%45 = load i32, i32* %6
%46 = load i32, i32* %10
%47 = load i32, i32* %8
%48 = sub nsw i32 %47, 50
%49 = call i32 @XFillRectangle(i32* %44, i32 %45, i32 %46, i32 0, i32 %48, i32 50, i32 50)
%50 = load i32*, i32** %5
%51 = load i32, i32* %10
%52 = call i32 @XSetForeground(i32* %50, i32 %51, i32 16777215)
%53 = load i32*, i32** %5
%54 = load i32, i32* %6
%55 = load i32, i32* %10
%56 = load i32, i32* %8
%57 = sub nsw i32 %56, 50
%58 = load i32, i32* %8
%59 = sub nsw i32 %58, 50
%60 = call i32 @XFillRectangle(i32* %53, i32 %54, i32 %55, i32 %57, i32 %59, i32 50, i32 50)
%61 = load i32*, i32** %5
%62 = load i32, i32* %10
%63 = call i32 @XSetForeground(i32* %61, i32 %62, i32 16776960)
%64 = load i32*, i32** %5
%65 = load i32, i32* %10
%66 = load i32, i32* @LineSolid
%67 = load i32, i32* @CapButt
%68 = load i32, i32* @JoinBevel
%69 = call i32 @XSetLineAttributes(i32* %64, i32 %65, i32 3, i32 %66, i32 %67, i32 %68)
%70 = load i32*, i32** %5
%71 = load i32, i32* %6
%72 = load i32, i32* %10
%73 = load i32, i32* %7
%74 = load i32, i32* %8
%75 = call i32 @XDrawLine(i32* %70, i32 %71, i32 %72, i32 0, i32 0, i32 %73, i32 %74)
%76 = load i32*, i32** %5
%77 = load i32, i32* %6
%78 = load i32, i32* %10
%79 = load i32, i32* %8
%80 = load i32, i32* %7
%81 = call i32 @XDrawLine(i32* %76, i32 %77, i32 %78, i32 0, i32 %79, i32 %80, i32 0)
%82 = load i32*, i32** %5
%83 = load i32, i32* %10
%84 = call i32 @XFreeGC(i32* %82, i32 %83)
ret void
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i64 }
@GCBackground = global i32 0
@LineSolid = global i32 0
@CapButt = global i32 0
@JoinBevel = global i32 0
define void @DrawPixmapImage(i32* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca %struct.TYPE_3__
%6 = bitcast %struct.TYPE_3__* %5 to i8*
%7 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %5, i64 0, i32 0
store i64 0, i64* %7
%8 = load i32, i32* @GCBackground
%9 = call i32 @XCreateGC(i32* %0, i32 %1, i32 %8, %struct.TYPE_3__* %5)
%10 = call i32 @XSetForeground(i32* %0, i32 %9, i32 0)
%11 = call i32 @XFillRectangle(i32* %0, i32 %1, i32 %9, i32 0, i32 0, i32 %2, i32 %3)
%12 = call i32 @XSetForeground(i32* %0, i32 %9, i32 16711680)
%13 = call i32 @XFillRectangle(i32* %0, i32 %1, i32 %9, i32 0, i32 0, i32 50, i32 50)
%14 = call i32 @XSetForeground(i32* %0, i32 %9, i32 65280)
%15 = add nsw i32 %2, -50
%16 = call i32 @XFillRectangle(i32* %0, i32 %1, i32 %9, i32 %15, i32 0, i32 50, i32 50)
%17 = call i32 @XSetForeground(i32* %0, i32 %9, i32 255)
%18 = add nsw i32 %3, -50
%19 = call i32 @XFillRectangle(i32* %0, i32 %1, i32 %9, i32 0, i32 %18, i32 50, i32 50)
%20 = call i32 @XSetForeground(i32* %0, i32 %9, i32 16777215)
%21 = call i32 @XFillRectangle(i32* %0, i32 %1, i32 %9, i32 %18, i32 %18, i32 50, i32 50)
%22 = call i32 @XSetForeground(i32* %0, i32 %9, i32 16776960)
%23 = load i32, i32* @LineSolid
%24 = load i32, i32* @CapButt
%25 = load i32, i32* @JoinBevel
%26 = call i32 @XSetLineAttributes(i32* %0, i32 %9, i32 3, i32 %23, i32 %24, i32 %25)
%27 = call i32 @XDrawLine(i32* %0, i32 %1, i32 %9, i32 0, i32 0, i32 %2, i32 %3)
%28 = call i32 @XDrawLine(i32* %0, i32 %1, i32 %9, i32 0, i32 %3, i32 %2, i32 0)
%29 = call i32 @XFreeGC(i32* %0, i32 %9)
ret void
}