#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 /*<<< orphan*/ height;
  int /*<<< orphan*/ width;
};
typedef TYPE_1__ XRectangle;
typedef int /*<<< orphan*/ GC;
typedef int /*<<< orphan*/ Drawable;
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
int /*<<< orphan*/ BlackPixel(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ DefaultScreen(int /*<<< orphan*/ *);
int /*<<< orphan*/ XFillRectangle(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                  int /*<<< orphan*/, int /*<<< orphan*/,
                                  int /*<<< orphan*/, int /*<<< orphan*/,
                                  int /*<<< orphan*/);
int /*<<< orphan*/ XSetForeground(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                  int /*<<< orphan*/);
void clear(Display *d, Drawable p, GC gc, XRectangle r) {
  XSetForeground(d, gc, BlackPixel(d, DefaultScreen(d)));
  XFillRectangle(d, p, gc, 0, 0, r.width, r.height);
}


x86 assembly (clang, -O0):
<clear>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rcx,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <DefaultScreen@plt>
mov    -0x30(%rbp),%rdi
mov    %eax,%esi
call   1040 <BlackPixel@plt>
mov    -0x28(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    %eax,%edx
call   1050 <XSetForeground@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x4(%rbp),%r9d
mov    -0x8(%rbp),%eax
xor    %r8d,%r8d
mov    %r8d,%ecx
mov    %eax,(%rsp)
call   1030 <XFillRectangle@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rcx,%r12
mov    %edx,%r15d
mov    %esi,%r14d
mov    %rdi,%rbp
mov    %rcx,%rbx
shr    $0x20,%rbx
call   1060 <DefaultScreen@plt>
mov    %rbp,%rdi
mov    %eax,%esi
call   1040 <BlackPixel@plt>
mov    %rbp,%rdi
mov    %r15d,%esi
mov    %eax,%edx
call   1050 <XSetForeground@plt>
mov    %r12d,(%rsp)
mov    %rbp,%rdi
mov    %r14d,%esi
mov    %r15d,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
mov    %ebx,%r9d
call   1030 <XFillRectangle@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32, i32 }
define void @clear(i32* %0, i32 %1, i32 %2, i64 %3) {
%5 = alloca %struct.TYPE_3__
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = bitcast %struct.TYPE_3__* %5 to i64*
store i64 %3, i64* %9
store i32* %0, i32** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
%10 = load i32*, i32** %6
%11 = load i32, i32* %8
%12 = load i32*, i32** %6
%13 = load i32*, i32** %6
%14 = call i32 @DefaultScreen(i32* %13)
%15 = call i32 @BlackPixel(i32* %12, i32 %14)
%16 = call i32 @XSetForeground(i32* %10, i32 %11, i32 %15)
%17 = load i32*, i32** %6
%18 = load i32, i32* %7
%19 = load i32, i32* %8
%20 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %5, i32 0, i32 1
%21 = load i32, i32* %20
%22 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %5, i32 0, i32 0
%23 = load i32, i32* %22
%24 = call i32 @XFillRectangle(i32* %17, i32 %18, i32 %19, i32 0, i32 0, i32 %21, i32 %23)
ret void
}

LLVM IR (-O2):
define void @clear(i32* %0, i32 %1, i32 %2, i64 %3) {
%5 = trunc i64 %3 to i32
%6 = lshr i64 %3, 32
%7 = trunc i64 %6 to i32
%8 = tail call i32 @DefaultScreen(i32* %0)
%9 = tail call i32 @BlackPixel(i32* %0, i32 %8)
%10 = tail call i32 @XSetForeground(i32* %0, i32 %2, i32 %9)
%11 = tail call i32 @XFillRectangle(i32* %0, i32 %1, i32 %2, i32 0, i32 0, i32 %7, i32 %5)
ret void
}