#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__ {
  unsigned long background;
  unsigned long foreground;
  int /*<<< orphan*/ font;
};
typedef TYPE_1__ XGCValues;
typedef int /*<<< orphan*/ Window;
typedef int /*<<< orphan*/ GC;
typedef int /*<<< orphan*/ Font;
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
int GCBackground;
int GCFont;
int GCForeground;
int /*<<< orphan*/ XCreateGC(int /*<<< orphan*/ *, int /*<<< orphan*/, int,
                             TYPE_1__ *);
GC create_text_gc(Display *dpy, Window win, unsigned long bg_pixel,
                  unsigned long fg_pixel, Font fid) {
  XGCValues xgcv;
  GC gc;
  xgcv.background = bg_pixel;
  xgcv.foreground = fg_pixel;
  xgcv.font = fid;
  gc = XCreateGC(dpy, win, GCForeground | GCBackground | GCFont, &xgcv);
  return gc;
}


x86 assembly (clang, -O0):
<create_text_gc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    0x2e99(%rip),%rax
mov    (%rax),%edx
mov    0x2e78(%rip),%rax
or     (%rax),%edx
mov    0x2e77(%rip),%rax
or     (%rax),%edx
lea    -0x40(%rbp),%rcx
call   1030 <XCreateGC@plt>
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_text_gc>:
sub    $0x18,%rsp
mov    %rdx,(%rsp)
mov    %rcx,0x8(%rsp)
mov    0x2ec4(%rip),%rax
mov    0x2ea5(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    %r8d,0x10(%rsp)
mov    0x2e9d(%rip),%rax
or     (%rax),%edx
mov    %rsp,%rcx
call   1030 <XCreateGC@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i64, i64, i32 }
@GCForeground = global i32 0
@GCBackground = global i32 0
@GCFont = global i32 0
define i32 @create_text_gc(i32* %0, i32 %1, i64 %2, i64 %3, i32 %4) {
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i64
%9 = alloca i64
%10 = alloca i32
%11 = alloca %struct.TYPE_3__
%12 = alloca i32
store i32* %0, i32** %6
store i32 %1, i32* %7
store i64 %2, i64* %8
store i64 %3, i64* %9
store i32 %4, i32* %10
%13 = load i64, i64* %8
%14 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %11, i32 0, i32 0
store i64 %13, i64* %14
%15 = load i64, i64* %9
%16 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %11, i32 0, i32 1
store i64 %15, i64* %16
%17 = load i32, i32* %10
%18 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %11, i32 0, i32 2
store i32 %17, i32* %18
%19 = load i32*, i32** %6
%20 = load i32, i32* %7
%21 = load i32, i32* @GCForeground
%22 = load i32, i32* @GCBackground
%23 = or i32 %21, %22
%24 = load i32, i32* @GCFont
%25 = or i32 %23, %24
%26 = call i32 @XCreateGC(i32* %19, i32 %20, i32 %25, %struct.TYPE_3__* %11)
store i32 %26, i32* %12
%27 = load i32, i32* %12
ret i32 %27
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i64, i64, i32 }
@GCForeground = global i32 0
@GCBackground = global i32 0
@GCFont = global i32 0
define i32 @create_text_gc(i32* %0, i32 %1, i64 %2, i64 %3, i32 %4) {
%6 = alloca %struct.TYPE_3__
%7 = bitcast %struct.TYPE_3__* %6 to i8*
%8 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %6, i64 0, i32 0
store i64 %2, i64* %8
%9 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %6, i64 0, i32 1
store i64 %3, i64* %9
%10 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %6, i64 0, i32 2
store i32 %4, i32* %10
%11 = load i32, i32* @GCForeground
%12 = load i32, i32* @GCBackground
%13 = or i32 %12, %11
%14 = load i32, i32* @GCFont
%15 = or i32 %13, %14
%16 = call i32 @XCreateGC(i32* %0, i32 %1, i32 %15, %struct.TYPE_3__* %6)
ret i32 %16
}