#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_6__ TYPE_1__;

/* Type definitions */
typedef int /*<<< orphan*/ XtAppContext;
struct TYPE_6__ {
  int /*<<< orphan*/ flags;
};
typedef TYPE_1__ XSizeHints;
typedef int /*<<< orphan*/ Window;
typedef int /*<<< orphan*/ Widget;
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
int /*<<< orphan*/ PPosition;
TYPE_1__ *XAllocSizeHints();
int /*<<< orphan*/ XFree(TYPE_1__ *);
scalar_t__ XGetWMNormalHints(int /*<<< orphan*/ *, int /*<<< orphan*/,
                             TYPE_1__ *, long *);
int /*<<< orphan*/ *XOpenDisplay(int /*<<< orphan*/ *);
int /*<<< orphan*/ XSetWMNormalHints(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                     TYPE_1__ *);
int /*<<< orphan*/ XtAppMainLoop(int /*<<< orphan*/);
int /*<<< orphan*/ XtNheight;
int /*<<< orphan*/ XtNtitle;
int /*<<< orphan*/ XtNwidth;
int /*<<< orphan*/ XtRealizeWidget(int /*<<< orphan*/);
int /*<<< orphan*/ XtVaOpenApplication(int /*<<< orphan*/ *, char *,
                                       int /*<<< orphan*/ *, int /*<<< orphan*/,
                                       int *, char **, int /*<<< orphan*/ *,
                                       int /*<<< orphan*/,
                                       int /*<<< orphan*/ *);
int /*<<< orphan*/ XtVaSetValues(int /*<<< orphan*/, int /*<<< orphan*/, char *,
                                 int /*<<< orphan*/, int, int /*<<< orphan*/,
                                 int, int /*<<< orphan*/ *);
int /*<<< orphan*/ XtWindow(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ setbuf(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ topLevelShellWidgetClass;
int main(int argc, char **argv) {
  Display *display;
  XtAppContext context;
  XSizeHints *hints;
  long supplied;
  Widget toplevel, w;
  Window toplevelwin;
  setbuf(stdout, NULL);
  setbuf(stderr, NULL);
  display = XOpenDisplay(NULL);
  toplevel = XtVaOpenApplication(&context, "SoXt", NULL, 0, &argc, argv, NULL,
                                 topLevelShellWidgetClass, NULL);
  XtVaSetValues(toplevel, XtNtitle, "TestWin", XtNwidth, 400, XtNheight, 300,
                NULL);
  XtRealizeWidget(toplevel);
  w = toplevel;
  toplevelwin = XtWindow(w);
  fprintf(stderr, "toplevelwin: %ld\n", toplevelwin);
  hints = XAllocSizeHints();
  if (XGetWMNormalHints(display, toplevelwin, hints, &supplied)) {
    fprintf(stderr, "removing position hint\n");
    hints->flags &= ~PPosition;
    XSetWMNormalHints(display, toplevelwin, hints);
  }
  XFree(hints);
  XtAppMainLoop(context);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2de3(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1060 <setbuf@plt>
mov    0x2de1(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1060 <setbuf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1090 <XOpenDisplay@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%r9
mov    0x2dde(%rip),%rax
mov    (%rax),%eax
lea    -0x1c(%rbp),%rdi
lea    0xde1(%rip),%rsi
xor    %ecx,%ecx
mov    %ecx,%edx
xor    %ecx,%ecx
lea    -0x8(%rbp),%r8
movq   $0x0,(%rsp)
mov    %eax,0x8(%rsp)
movq   $0x0,0x10(%rsp)
call   10e0 <XtVaOpenApplication@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%edi
mov    0x2d68(%rip),%rax
mov    (%rax),%esi
mov    0x2d6f(%rip),%rax
mov    (%rax),%ecx
mov    0x2d46(%rip),%rax
mov    (%rax),%r9d
lea    0xd99(%rip),%rdx
mov    $0x190,%r8d
xor    %eax,%eax
movl   $0x12c,(%rsp)
movq   $0x0,0x8(%rsp)
call   1030 <XtVaSetValues@plt>
mov    -0x34(%rbp),%edi
call   10b0 <XtRealizeWidget@plt>
mov    -0x34(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%edi
call   1050 <XtWindow@plt>
mov    %eax,-0x3c(%rbp)
mov    0x2d27(%rip),%rax
mov    (%rax),%edi
mov    -0x3c(%rbp),%edx
lea    0xd58(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x0,%al
call   10c0 <XAllocSizeHints@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x3c(%rbp),%esi
mov    -0x28(%rbp),%rdx
lea    -0x30(%rbp),%rcx
call   1040 <XGetWMNormalHints@plt>
cmp    $0x0,%rax
je     1320 <main+0x160>
mov    0x2ce4(%rip),%rax
mov    (%rax),%edi
lea    0xd2a(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    0x2cd5(%rip),%rax
mov    (%rax),%ecx
xor    $0xffffffff,%ecx
mov    -0x28(%rbp),%rax
and    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rdi
mov    -0x3c(%rbp),%esi
mov    -0x28(%rbp),%rdx
call   1080 <XSetWMNormalHints@plt>
mov    -0x28(%rbp),%rdi
call   1070 <XFree@plt>
mov    -0x1c(%rbp),%edi
call   10d0 <XtAppMainLoop@plt>
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %edi,0xc(%rsp)
mov    0x2de8(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1060 <setbuf@plt>
mov    0x2de8(%rip),%r15
mov    (%r15),%edi
xor    %esi,%esi
call   1060 <setbuf@plt>
xor    %edi,%edi
call   1090 <XOpenDisplay@plt>
mov    %rax,%r14
mov    0x2ded(%rip),%rax
mov    (%rax),%eax
sub    $0x8,%rsp
lea    0xdf0(%rip),%rsi
lea    0x10(%rsp),%rdi
lea    0x14(%rsp),%r8
xor    %edx,%edx
xor    %ecx,%ecx
mov    %rbx,%r9
push   $0x0
push   %rax
push   $0x0
call   10e0 <XtVaOpenApplication@plt>
add    $0x20,%rsp
mov    %eax,%ebx
mov    0x2d80(%rip),%rax
mov    (%rax),%esi
mov    0x2d87(%rip),%rax
mov    (%rax),%ecx
mov    0x2d5e(%rip),%rax
mov    (%rax),%r9d
lea    0xdb1(%rip),%rdx
mov    %ebx,%edi
mov    $0x190,%r8d
push   $0x0
push   $0x12c
call   1030 <XtVaSetValues@plt>
add    $0x10,%rsp
mov    %ebx,%edi
call   10b0 <XtRealizeWidget@plt>
mov    %ebx,%edi
call   1050 <XtWindow@plt>
mov    %eax,%ebp
mov    (%r15),%edi
lea    0xd87(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   10a0 <fprintf@plt>
xor    %eax,%eax
call   10c0 <XAllocSizeHints@plt>
mov    %rax,%rbx
lea    0x10(%rsp),%rcx
mov    %r14,%rdi
mov    %ebp,%esi
mov    %rax,%rdx
call   1040 <XGetWMNormalHints@plt>
test   %rax,%rax
je     12db <main+0x11b>
mov    (%r15),%edi
lea    0xd65(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    0x2d10(%rip),%rax
mov    (%rax),%eax
not    %eax
and    %eax,(%rbx)
mov    %r14,%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1080 <XSetWMNormalHints@plt>
mov    %rbx,%rdi
call   1070 <XFree@plt>
mov    0x8(%rsp),%edi
call   10d0 <XtAppMainLoop@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_6__ = type { i32 }
@stdout = global i32 0
@stderr = global i32 0
@.str = [5 x i8] c"SoXt\00"
@topLevelShellWidgetClass = global i32 0
@XtNtitle = global i32 0
@.str.1 = [8 x i8] c"TestWin\00"
@XtNwidth = global i32 0
@XtNheight = global i32 0
@.str.2 = [18 x i8] c"toplevelwin: %ld\0A\00"
@.str.3 = [24 x i8] c"removing position hint\0A\00"
@PPosition = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32
%8 = alloca %struct.TYPE_6__*
%9 = alloca i64
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i32, i32* @stdout
%14 = call i32 @setbuf(i32 %13, i32* null)
%15 = load i32, i32* @stderr
%16 = call i32 @setbuf(i32 %15, i32* null)
%17 = call i32* @XOpenDisplay(i32* null)
store i32* %17, i32** %6
%18 = load i8**, i8*** %5
%19 = load i32, i32* @topLevelShellWidgetClass
%20 = call i32 @XtVaOpenApplication(i32* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* null, i32 0, i32* %4, i8** %18, i32* null, i32 %19, i32* null)
store i32 %20, i32* %10
%21 = load i32, i32* %10
%22 = load i32, i32* @XtNtitle
%23 = load i32, i32* @XtNwidth
%24 = load i32, i32* @XtNheight
%25 = call i32 @XtVaSetValues(i32 %21, i32 %22, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %23, i32 400, i32 %24, i32 300, i32* null)
%26 = load i32, i32* %10
%27 = call i32 @XtRealizeWidget(i32 %26)
%28 = load i32, i32* %10
store i32 %28, i32* %11
%29 = load i32, i32* %11
%30 = call i32 @XtWindow(i32 %29)
store i32 %30, i32* %12
%31 = load i32, i32* @stderr
%32 = load i32, i32* %12
%33 = call i32 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %32)
%34 = call %struct.TYPE_6__* (...) @XAllocSizeHints()
store %struct.TYPE_6__* %34, %struct.TYPE_6__** %8
%35 = load i32*, i32** %6
%36 = load i32, i32* %12
%37 = load %struct.TYPE_6__*, %struct.TYPE_6__** %8
%38 = call i64 @XGetWMNormalHints(i32* %35, i32 %36, %struct.TYPE_6__* %37, i64* %9)
%39 = icmp ne i64 %38, 0
br i1 %39, label %40, label %53
40: ; preds = %2
%41 = load i32, i32* @stderr
%42 = call i32 (i32, i8*, ...) @fprintf(i32 %41, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
%43 = load i32, i32* @PPosition
%44 = xor i32 %43, -1
%45 = load %struct.TYPE_6__*, %struct.TYPE_6__** %8
%46 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %45, i32 0, i32 0
%47 = load i32, i32* %46
%48 = and i32 %47, %44
store i32 %48, i32* %46
%49 = load i32*, i32** %6
%50 = load i32, i32* %12
%51 = load %struct.TYPE_6__*, %struct.TYPE_6__** %8
%52 = call i32 @XSetWMNormalHints(i32* %49, i32 %50, %struct.TYPE_6__* %51)
br label %53
53: ; preds = %40, %2
%54 = load %struct.TYPE_6__*, %struct.TYPE_6__** %8
%55 = call i32 @XFree(%struct.TYPE_6__* %54)
%56 = load i32, i32* %7
%57 = call i32 @XtAppMainLoop(i32 %56)
%58 = load i32, i32* %3
ret i32 %58
}

LLVM IR (-O2):
%struct.TYPE_6__ = type { i32 }
@stdout = global i32 0
@stderr = global i32 0
@.str = [5 x i8] c"SoXt\00"
@topLevelShellWidgetClass = global i32 0
@XtNtitle = global i32 0
@.str.1 = [8 x i8] c"TestWin\00"
@XtNwidth = global i32 0
@XtNheight = global i32 0
@.str.2 = [18 x i8] c"toplevelwin: %ld\0A\00"
@.str.3 = [24 x i8] c"removing position hint\0A\00"
@PPosition = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i64
store i32 %0, i32* %3
%6 = bitcast i32* %4 to i8*
%7 = bitcast i64* %5 to i8*
%8 = load i32, i32* @stdout
%9 = tail call i32 @setbuf(i32 %8, i32* null)
%10 = load i32, i32* @stderr
%11 = tail call i32 @setbuf(i32 %10, i32* null)
%12 = tail call i32* @XOpenDisplay(i32* null)
%13 = load i32, i32* @topLevelShellWidgetClass
%14 = call i32 @XtVaOpenApplication(i32* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* null, i32 0, i32* %3, i8** %1, i32* null, i32 %13, i32* null)
%15 = load i32, i32* @XtNtitle
%16 = load i32, i32* @XtNwidth
%17 = load i32, i32* @XtNheight
%18 = call i32 @XtVaSetValues(i32 %14, i32 %15, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %16, i32 400, i32 %17, i32 300, i32* null)
%19 = call i32 @XtRealizeWidget(i32 %14)
%20 = call i32 @XtWindow(i32 %14)
%21 = load i32, i32* @stderr
%22 = call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %20)
%23 = call %struct.TYPE_6__* (...) @XAllocSizeHints()
%24 = call i64 @XGetWMNormalHints(i32* %12, i32 %20, %struct.TYPE_6__* %23, i64* %5)
%25 = icmp eq i64 %24, 0
br i1 %25, label %35, label %26
26: ; preds = %2
%27 = load i32, i32* @stderr
%28 = call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
%29 = load i32, i32* @PPosition
%30 = xor i32 %29, -1
%31 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %23, i64 0, i32 0
%32 = load i32, i32* %31
%33 = and i32 %32, %30
store i32 %33, i32* %31
%34 = call i32 @XSetWMNormalHints(i32* %12, i32 %20, %struct.TYPE_6__* %23)
br label %35
35: ; preds = %26, %2
%36 = call i32 @XFree(%struct.TYPE_6__* %23)
%37 = load i32, i32* %4
%38 = call i32 @XtAppMainLoop(i32 %37)
ret i32 0
}