#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__ {
  int flags;
  int red;
  int /*<<< orphan*/ pixel;
  scalar_t__ green;
  scalar_t__ blue;
};
typedef TYPE_1__ XColor;
typedef int /*<<< orphan*/ Window;
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
int /*<<< orphan*/ BlackPixel(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ DefaultColormap(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ DefaultScreen(int /*<<< orphan*/ *);
int DoBlue;
int DoGreen;
int DoRed;
int /*<<< orphan*/ XAllocColor(int /*<<< orphan*/ *, int /*<<< orphan*/,
                               TYPE_1__ *);
int /*<<< orphan*/ XCreateSimpleWindow(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                       int, int, int, int, int, int,
                                       int /*<<< orphan*/);
int /*<<< orphan*/ XDefaultGC(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ XDefaultRootWindow(int /*<<< orphan*/ *);
int /*<<< orphan*/ XDrawLine(int /*<<< orphan*/ *, int /*<<< orphan*/,
                             int /*<<< orphan*/, int, int, int, int);
int /*<<< orphan*/ XFlush(int /*<<< orphan*/ *);
int /*<<< orphan*/ XMapWindow(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ *XOpenDisplay(int /*<<< orphan*/ *);
int /*<<< orphan*/ XSetForeground(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                  int /*<<< orphan*/);
int /*<<< orphan*/ sleep(int);
int main() {
  Display *disp = NULL;
  Window ventana;
  XColor color;
  disp = XOpenDisplay(NULL);
  ventana =
      XCreateSimpleWindow(disp, XDefaultRootWindow(disp), 100, 100, 500, 500, 1,
                          1, BlackPixel(disp, DefaultScreen(disp)));
  XMapWindow(disp, ventana);
  XFlush(disp);
  color.flags = DoRed | DoGreen | DoBlue;
  color.red = 65535;
  color.blue = 0;
  color.green = 0;
  XAllocColor(disp, DefaultColormap(disp, DefaultScreen(disp)), &color);
  XSetForeground(disp, XDefaultGC(disp, DefaultScreen(disp)), color.pixel);
  XDrawLine(disp, ventana, XDefaultGC(disp, DefaultScreen(disp)), 10, 10, 100,
            100);
  XFlush(disp);
  sleep(100);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movq   $0x0,-0x8(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <XOpenDisplay@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x8(%rbp),%rdi
call   1070 <XDefaultRootWindow@plt>
mov    %eax,-0x6c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    -0x8(%rbp),%rdi
call   10d0 <DefaultScreen@plt>
mov    -0x80(%rbp),%rdi
mov    %eax,%esi
call   1080 <BlackPixel@plt>
mov    -0x78(%rbp),%rdi
mov    -0x6c(%rbp),%esi
mov    $0x64,%ecx
mov    $0x1f4,%r9d
mov    %ecx,%edx
mov    %r9d,%r8d
movl   $0x1,(%rsp)
movl   $0x1,0x8(%rsp)
mov    %eax,0x10(%rsp)
call   1060 <XCreateSimpleWindow@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   10c0 <XMapWindow@plt>
mov    -0x8(%rbp),%rdi
call   10b0 <XFlush@plt>
mov    0x2d7a(%rip),%rax
mov    (%rax),%eax
mov    0x2d59(%rip),%rcx
or     (%rcx),%eax
mov    0x2d58(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x30(%rbp)
movl   $0xffff,-0x2c(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x8(%rbp),%rdi
call   10d0 <DefaultScreen@plt>
mov    -0x68(%rbp),%rdi
mov    %eax,%esi
call   1090 <DefaultColormap@plt>
mov    -0x60(%rbp),%rdi
mov    %eax,%esi
lea    -0x30(%rbp),%rdx
call   1030 <XAllocColor@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x8(%rbp),%rdi
call   10d0 <DefaultScreen@plt>
mov    -0x58(%rbp),%rdi
mov    %eax,%esi
call   1040 <XDefaultGC@plt>
mov    -0x50(%rbp),%rdi
mov    %eax,%esi
mov    -0x28(%rbp),%edx
call   10a0 <XSetForeground@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x8(%rbp),%rdi
call   10d0 <DefaultScreen@plt>
mov    -0x48(%rbp),%rdi
mov    %eax,%esi
call   1040 <XDefaultGC@plt>
mov    -0x40(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    %eax,%edx
mov    $0xa,%r8d
mov    $0x64,%r9d
mov    %r8d,%ecx
movl   $0x64,(%rsp)
call   10f0 <XDrawLine@plt>
mov    -0x8(%rbp),%rdi
call   10b0 <XFlush@plt>
mov    $0x64,%edi
call   10e0 <sleep@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x28,%rsp
xor    %edi,%edi
call   1050 <XOpenDisplay@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1070 <XDefaultRootWindow@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   10d0 <DefaultScreen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1080 <BlackPixel@plt>
sub    $0x8,%rsp
mov    %rbx,%rdi
mov    %ebp,%esi
mov    $0x64,%edx
mov    $0x64,%ecx
mov    $0x1f4,%r8d
mov    $0x1f4,%r9d
push   %rax
push   $0x1
push   $0x1
call   1060 <XCreateSimpleWindow@plt>
add    $0x20,%rsp
mov    %eax,%ebp
mov    %rbx,%rdi
mov    %eax,%esi
call   10c0 <XMapWindow@plt>
mov    %rbx,%rdi
call   10b0 <XFlush@plt>
mov    0x2da4(%rip),%rax
mov    0x2d85(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    0x2d82(%rip),%rax
or     (%rax),%ecx
mov    %ecx,0x8(%rsp)
movl   $0xffff,0xc(%rsp)
xorps  %xmm0,%xmm0
movups %xmm0,0x18(%rsp)
mov    %rbx,%rdi
call   10d0 <DefaultScreen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1090 <DefaultColormap@plt>
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <XAllocColor@plt>
mov    %rbx,%rdi
call   10d0 <DefaultScreen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <XDefaultGC@plt>
mov    0x10(%rsp),%edx
mov    %rbx,%rdi
mov    %eax,%esi
call   10a0 <XSetForeground@plt>
mov    %rbx,%rdi
call   10d0 <DefaultScreen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <XDefaultGC@plt>
sub    $0x8,%rsp
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %eax,%edx
mov    $0xa,%ecx
mov    $0xa,%r8d
mov    $0x64,%r9d
push   $0x64
call   10f0 <XDrawLine@plt>
add    $0x10,%rsp
mov    %rbx,%rdi
call   10b0 <XFlush@plt>
mov    $0x64,%edi
call   10e0 <sleep@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32, i32, i32, i64, i64 }
@DoRed = global i32 0
@DoGreen = global i32 0
@DoBlue = global i32 0
define i32 @main() {
%1 = alloca i32*
%2 = alloca i32
%3 = alloca %struct.TYPE_3__
store i32* null, i32** %1
%4 = call i32* @XOpenDisplay(i32* null)
store i32* %4, i32** %1
%5 = load i32*, i32** %1
%6 = load i32*, i32** %1
%7 = call i32 @XDefaultRootWindow(i32* %6)
%8 = load i32*, i32** %1
%9 = load i32*, i32** %1
%10 = call i32 @DefaultScreen(i32* %9)
%11 = call i32 @BlackPixel(i32* %8, i32 %10)
%12 = call i32 @XCreateSimpleWindow(i32* %5, i32 %7, i32 100, i32 100, i32 500, i32 500, i32 1, i32 1, i32 %11)
store i32 %12, i32* %2
%13 = load i32*, i32** %1
%14 = load i32, i32* %2
%15 = call i32 @XMapWindow(i32* %13, i32 %14)
%16 = load i32*, i32** %1
%17 = call i32 @XFlush(i32* %16)
%18 = load i32, i32* @DoRed
%19 = load i32, i32* @DoGreen
%20 = or i32 %18, %19
%21 = load i32, i32* @DoBlue
%22 = or i32 %20, %21
%23 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i32 0, i32 0
store i32 %22, i32* %23
%24 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i32 0, i32 1
store i32 65535, i32* %24
%25 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i32 0, i32 4
store i64 0, i64* %25
%26 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i32 0, i32 3
store i64 0, i64* %26
%27 = load i32*, i32** %1
%28 = load i32*, i32** %1
%29 = load i32*, i32** %1
%30 = call i32 @DefaultScreen(i32* %29)
%31 = call i32 @DefaultColormap(i32* %28, i32 %30)
%32 = call i32 @XAllocColor(i32* %27, i32 %31, %struct.TYPE_3__* %3)
%33 = load i32*, i32** %1
%34 = load i32*, i32** %1
%35 = load i32*, i32** %1
%36 = call i32 @DefaultScreen(i32* %35)
%37 = call i32 @XDefaultGC(i32* %34, i32 %36)
%38 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i32 0, i32 2
%39 = load i32, i32* %38
%40 = call i32 @XSetForeground(i32* %33, i32 %37, i32 %39)
%41 = load i32*, i32** %1
%42 = load i32, i32* %2
%43 = load i32*, i32** %1
%44 = load i32*, i32** %1
%45 = call i32 @DefaultScreen(i32* %44)
%46 = call i32 @XDefaultGC(i32* %43, i32 %45)
%47 = call i32 @XDrawLine(i32* %41, i32 %42, i32 %46, i32 10, i32 10, i32 100, i32 100)
%48 = load i32*, i32** %1
%49 = call i32 @XFlush(i32* %48)
%50 = call i32 @sleep(i32 100)
ret i32 0
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32, i32, i32, i64, i64 }
@DoRed = global i32 0
@DoGreen = global i32 0
@DoBlue = global i32 0
define i32 @main() {
%1 = alloca %struct.TYPE_3__
%2 = bitcast %struct.TYPE_3__* %1 to i8*
%3 = tail call i32* @XOpenDisplay(i32* null)
%4 = tail call i32 @XDefaultRootWindow(i32* %3)
%5 = tail call i32 @DefaultScreen(i32* %3)
%6 = tail call i32 @BlackPixel(i32* %3, i32 %5)
%7 = tail call i32 @XCreateSimpleWindow(i32* %3, i32 %4, i32 100, i32 100, i32 500, i32 500, i32 1, i32 1, i32 %6)
%8 = tail call i32 @XMapWindow(i32* %3, i32 %7)
%9 = tail call i32 @XFlush(i32* %3)
%10 = load i32, i32* @DoRed
%11 = load i32, i32* @DoGreen
%12 = or i32 %11, %10
%13 = load i32, i32* @DoBlue
%14 = or i32 %12, %13
%15 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %1, i64 0, i32 0
store i32 %14, i32* %15
%16 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %1, i64 0, i32 1
store i32 65535, i32* %16
%17 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %1, i64 0, i32 3
%18 = bitcast i64* %17 to i8*
%19 = tail call i32 @DefaultScreen(i32* %3)
%20 = tail call i32 @DefaultColormap(i32* %3, i32 %19)
%21 = call i32 @XAllocColor(i32* %3, i32 %20, %struct.TYPE_3__* %1)
%22 = call i32 @DefaultScreen(i32* %3)
%23 = call i32 @XDefaultGC(i32* %3, i32 %22)
%24 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %1, i64 0, i32 2
%25 = load i32, i32* %24
%26 = call i32 @XSetForeground(i32* %3, i32 %23, i32 %25)
%27 = call i32 @DefaultScreen(i32* %3)
%28 = call i32 @XDefaultGC(i32* %3, i32 %27)
%29 = call i32 @XDrawLine(i32* %3, i32 %7, i32 %28, i32 10, i32 10, i32 100, i32 100)
%30 = call i32 @XFlush(i32* %3)
%31 = call i32 @sleep(i32 100)
ret i32 0
}