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

/* Variables and functions */
int /*<<< orphan*/ BlackPixel(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ CapRound;
int /*<<< orphan*/ JoinRound;
int /*<<< orphan*/ LineSolid;
int /*<<< orphan*/ WhitePixel(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ XCreateGC(int /*<<< orphan*/ *, int /*<<< orphan*/,
                             unsigned long, int /*<<< orphan*/ *);
int /*<<< orphan*/ XSetBackground(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                  int /*<<< orphan*/);
int /*<<< orphan*/ XSetForeground(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                  int /*<<< orphan*/);
int /*<<< orphan*/ XSetLineAttributes(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                      int, int /*<<< orphan*/,
                                      int /*<<< orphan*/, int /*<<< orphan*/);
GC mk_black_gc(Display *display, int screen, Window win) {
  unsigned long valuemask = 0;
  XGCValues values;
  GC gc = XCreateGC(display, win, valuemask, &values);
  XSetBackground(display, gc, WhitePixel(display, screen));
  XSetForeground(display, gc, BlackPixel(display, screen));
  XSetLineAttributes(display, gc, 1, LineSolid, CapRound, JoinRound);
  return gc;
}


x86 assembly (clang, -O0):
<mk_black_gc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0x18(%rbp),%rdx
lea    -0x1c(%rbp),%rcx
call   1050 <XCreateGC@plt>
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <WhitePixel@plt>
mov    -0x40(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    %eax,%edx
call   1080 <XSetBackground@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1060 <BlackPixel@plt>
mov    -0x30(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    %eax,%edx
call   1070 <XSetForeground@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%esi
mov    0x2de9(%rip),%rax
mov    (%rax),%ecx
mov    0x2df0(%rip),%rax
mov    (%rax),%r8d
mov    0x2dce(%rip),%rax
mov    (%rax),%r9d
mov    $0x1,%edx
call   1040 <XSetLineAttributes@plt>
mov    -0x20(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mk_black_gc>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %esi,%r14d
mov    %rdi,%rbx
lea    0xc(%rsp),%rcx
mov    %edx,%esi
xor    %edx,%edx
call   1050 <XCreateGC@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    %r14d,%esi
call   1030 <WhitePixel@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %eax,%edx
call   1080 <XSetBackground@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
call   1060 <BlackPixel@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %eax,%edx
call   1070 <XSetForeground@plt>
mov    0x2e25(%rip),%rax
mov    (%rax),%ecx
mov    0x2e2c(%rip),%rax
mov    (%rax),%r8d
mov    0x2e0a(%rip),%rax
mov    (%rax),%r9d
mov    %rbx,%rdi
mov    %ebp,%esi
mov    $0x1,%edx
call   1040 <XSetLineAttributes@plt>
mov    %ebp,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@LineSolid = global i32 0
@CapRound = global i32 0
@JoinRound = global i32 0
define i32 @mk_black_gc(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i64
%8 = alloca i32
%9 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i64 0, i64* %7
%10 = load i32*, i32** %4
%11 = load i32, i32* %6
%12 = load i64, i64* %7
%13 = call i32 @XCreateGC(i32* %10, i32 %11, i64 %12, i32* %8)
store i32 %13, i32* %9
%14 = load i32*, i32** %4
%15 = load i32, i32* %9
%16 = load i32*, i32** %4
%17 = load i32, i32* %5
%18 = call i32 @WhitePixel(i32* %16, i32 %17)
%19 = call i32 @XSetBackground(i32* %14, i32 %15, i32 %18)
%20 = load i32*, i32** %4
%21 = load i32, i32* %9
%22 = load i32*, i32** %4
%23 = load i32, i32* %5
%24 = call i32 @BlackPixel(i32* %22, i32 %23)
%25 = call i32 @XSetForeground(i32* %20, i32 %21, i32 %24)
%26 = load i32*, i32** %4
%27 = load i32, i32* %9
%28 = load i32, i32* @LineSolid
%29 = load i32, i32* @CapRound
%30 = load i32, i32* @JoinRound
%31 = call i32 @XSetLineAttributes(i32* %26, i32 %27, i32 1, i32 %28, i32 %29, i32 %30)
%32 = load i32, i32* %9
ret i32 %32
}

LLVM IR (-O2):
@LineSolid = global i32 0
@CapRound = global i32 0
@JoinRound = global i32 0
define i32 @mk_black_gc(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
%6 = call i32 @XCreateGC(i32* %0, i32 %2, i64 0, i32* %4)
%7 = call i32 @WhitePixel(i32* %0, i32 %1)
%8 = call i32 @XSetBackground(i32* %0, i32 %6, i32 %7)
%9 = call i32 @BlackPixel(i32* %0, i32 %1)
%10 = call i32 @XSetForeground(i32* %0, i32 %6, i32 %9)
%11 = load i32, i32* @LineSolid
%12 = load i32, i32* @CapRound
%13 = load i32, i32* @JoinRound
%14 = call i32 @XSetLineAttributes(i32* %0, i32 %6, i32 1, i32 %11, i32 %12, i32 %13)
ret i32 %6
}