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

/* Variables and functions */
int /*<<< orphan*/ XClearWindow(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ XDrawString(int /*<<< orphan*/ *, int /*<<< orphan*/,
                               int /*<<< orphan*/, int, int, char *,
                               int /*<<< orphan*/);
int /*<<< orphan*/ XFlush(int /*<<< orphan*/ *);
int /*<<< orphan*/ XGetWindowAttributes(int /*<<< orphan*/ *,
                                        int /*<<< orphan*/, TYPE_1__ *);
int XTextWidth(int /*<<< orphan*/ *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
void zeichne_menutext(Display *myd, Window w, GC mygc, XFontStruct *font,
                      char *str) {
  XWindowAttributes attribs;
  int lstr, width, height;
  XClearWindow(myd, w);
  XGetWindowAttributes(myd, w, &attribs);
  width = attribs.width;
  height = attribs.height;
  lstr = XTextWidth(font, str, strlen(str));
  XDrawString(myd, w, mygc, (width - lstr) / 2, height * 2 / 3, str,
              strlen(str));
  XFlush(myd);
}


x86 assembly (clang, -O0):
<zeichne_menutext>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <XClearWindow@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
lea    -0x28(%rbp),%rdx
call   1070 <XGetWindowAttributes@plt>
mov    -0x28(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x68(%rbp),%rdi
mov    -0x60(%rbp),%rsi
mov    %eax,%edx
call   1080 <XTextWidth@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x30(%rbp),%eax
sub    -0x2c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x48(%rbp)
mov    -0x34(%rbp),%eax
shl    $0x1,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,-0x44(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x58(%rbp),%rdi
mov    -0x50(%rbp),%esi
mov    -0x4c(%rbp),%edx
mov    -0x48(%rbp),%ecx
mov    -0x44(%rbp),%r8d
mov    -0x40(%rbp),%r9
mov    %eax,(%rsp)
call   1050 <XDrawString@plt>
mov    -0x8(%rbp),%rdi
call   1060 <XFlush@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zeichne_menutext>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8,%r14
mov    %rcx,%rbp
mov    %edx,0xc(%rsp)
mov    %esi,%r13d
mov    %rdi,%r15
call   1030 <XClearWindow@plt>
lea    0x10(%rsp),%rdx
mov    %r15,%rdi
mov    %r13d,%esi
call   1070 <XGetWindowAttributes@plt>
mov    0x10(%rsp),%ebx
mov    0x14(%rsp),%r12d
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1080 <XTextWidth@plt>
sub    %eax,%ebx
mov    %ebx,%ebp
shr    $0x1f,%ebp
add    %ebx,%ebp
sar    %ebp
add    %r12d,%r12d
movslq %r12d,%rax
imul   $0x55555556,%rax,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
shr    $0x20,%rbx
add    %eax,%ebx
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %eax,(%rsp)
mov    %r15,%rdi
mov    %r13d,%esi
mov    0xc(%rsp),%edx
mov    %ebp,%ecx
mov    %ebx,%r8d
mov    %r14,%r9
call   1050 <XDrawString@plt>
mov    %r15,%rdi
call   1060 <XFlush@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32, i32 }
define void @zeichne_menutext(i32* %0, i32 %1, i32 %2, i32* %3, i8* %4) {
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i8*
%11 = alloca %struct.TYPE_3__
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i32* %0, i32** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32* %3, i32** %9
store i8* %4, i8** %10
%15 = load i32*, i32** %6
%16 = load i32, i32* %7
%17 = call i32 @XClearWindow(i32* %15, i32 %16)
%18 = load i32*, i32** %6
%19 = load i32, i32* %7
%20 = call i32 @XGetWindowAttributes(i32* %18, i32 %19, %struct.TYPE_3__* %11)
%21 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %11, i32 0, i32 0
%22 = load i32, i32* %21
store i32 %22, i32* %13
%23 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %11, i32 0, i32 1
%24 = load i32, i32* %23
store i32 %24, i32* %14
%25 = load i32*, i32** %9
%26 = load i8*, i8** %10
%27 = load i8*, i8** %10
%28 = call i32 @strlen(i8* %27)
%29 = call i32 @XTextWidth(i32* %25, i8* %26, i32 %28)
store i32 %29, i32* %12
%30 = load i32*, i32** %6
%31 = load i32, i32* %7
%32 = load i32, i32* %8
%33 = load i32, i32* %13
%34 = load i32, i32* %12
%35 = sub nsw i32 %33, %34
%36 = sdiv i32 %35, 2
%37 = load i32, i32* %14
%38 = mul nsw i32 %37, 2
%39 = sdiv i32 %38, 3
%40 = load i8*, i8** %10
%41 = load i8*, i8** %10
%42 = call i32 @strlen(i8* %41)
%43 = call i32 @XDrawString(i32* %30, i32 %31, i32 %32, i32 %36, i32 %39, i8* %40, i32 %42)
%44 = load i32*, i32** %6
%45 = call i32 @XFlush(i32* %44)
ret void
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32, i32 }
define void @zeichne_menutext(i32* %0, i32 %1, i32 %2, i32* %3, i8* %4) {
%6 = alloca %struct.TYPE_3__
%7 = bitcast %struct.TYPE_3__* %6 to i8*
%8 = tail call i32 @XClearWindow(i32* %0, i32 %1)
%9 = call i32 @XGetWindowAttributes(i32* %0, i32 %1, %struct.TYPE_3__* %6)
%10 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %6, i64 0, i32 0
%11 = load i32, i32* %10
%12 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %6, i64 0, i32 1
%13 = load i32, i32* %12
%14 = call i32 @strlen(i8* %4)
%15 = call i32 @XTextWidth(i32* %3, i8* %4, i32 %14)
%16 = sub nsw i32 %11, %15
%17 = sdiv i32 %16, 2
%18 = shl nsw i32 %13, 1
%19 = sdiv i32 %18, 3
%20 = call i32 @strlen(i8* %4)
%21 = call i32 @XDrawString(i32* %0, i32 %1, i32 %2, i32 %17, i32 %19, i8* %4, i32 %20)
%22 = call i32 @XFlush(i32* %0)
ret void
}