#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_5__ TYPE_2__;
typedef struct TYPE_4__ TYPE_1__;

/* Type definitions */
typedef int /*<<< orphan*/ cm;
typedef int /*<<< orphan*/ XEvent;
struct TYPE_4__ {
  int *l;
};
struct TYPE_5__ {
  int format;
  TYPE_1__ data;
  int /*<<< orphan*/ window;
  void *message_type;
  int /*<<< orphan*/ send_event;
  int /*<<< orphan*/ type;
};
typedef TYPE_2__ XClientMessageEvent;
typedef int /*<<< orphan*/ Window;
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
int /*<<< orphan*/ ClientMessage;
int /*<<< orphan*/ DefaultRootWindow(int /*<<< orphan*/ *);
int /*<<< orphan*/ False;
int /*<<< orphan*/ NoEventMask;
int /*<<< orphan*/ True;
void *XInternAtom(int /*<<< orphan*/ *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ XMoveWindow(int /*<<< orphan*/ *, int /*<<< orphan*/,
                               int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ XSendEvent(int /*<<< orphan*/ *, int /*<<< orphan*/,
                              int /*<<< orphan*/, int /*<<< orphan*/,
                              int /*<<< orphan*/ *);
int /*<<< orphan*/ bzero(TYPE_2__ *, int);
void fullscreen(Display *d, Window win) {
  XClientMessageEvent cm;
  bzero(&cm, sizeof(cm));
  cm.type = ClientMessage;
  cm.send_event = True;
  cm.message_type = XInternAtom(d, "_NET_WM_STATE", False);
  cm.window = win;
  cm.format = 32;
  cm.data.l[0] = 1;
  cm.data.l[1] = XInternAtom(d, "_NET_WM_STATE_FULLSCREEN", False);
  cm.data.l[2] = 0;
  cm.data.l[3] = 1;
  XSendEvent(d, DefaultRootWindow(d), False, NoEventMask, (XEvent *)&cm);
  XMoveWindow(d, win, 0, 0);
}


x86 assembly (clang, -O0):
<fullscreen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0x38(%rbp),%rdi
mov    $0x28,%esi
call   1070 <bzero@plt>
mov    0x2e5c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    0x2e58(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e50(%rip),%rax
mov    (%rax),%edx
lea    0xe67(%rip),%rsi
call   1060 <XInternAtom@plt>
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x28(%rbp)
movl   $0x20,-0x38(%rbp)
mov    -0x30(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x8(%rbp),%rdi
mov    0x2e1c(%rip),%rax
mov    (%rax),%edx
lea    0xe41(%rip),%rsi
call   1060 <XInternAtom@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x30(%rbp),%rax
movl   $0x0,0x8(%rax)
mov    -0x30(%rbp),%rax
movl   $0x1,0xc(%rax)
mov    -0x8(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <DefaultRootWindow@plt>
mov    -0x40(%rbp),%rdi
mov    %eax,%esi
mov    0x2dd1(%rip),%rax
mov    (%rax),%edx
mov    0x2dd8(%rip),%rax
mov    (%rax),%ecx
lea    -0x38(%rbp),%r8
call   1030 <XSendEvent@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1050 <XMoveWindow@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fullscreen>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x30,%rsp
mov    %esi,%r12d
mov    %rdi,%rbx
lea    0x8(%rsp),%r14
mov    %r14,%rdi
mov    $0x28,%esi
call   1070 <bzero@plt>
mov    0x2e55(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x2c(%rsp)
mov    0x2e50(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x28(%rsp)
mov    0x2e4b(%rip),%r15
mov    (%r15),%edx
lea    0xe61(%rip),%rsi
mov    %rbx,%rdi
call   1060 <XInternAtom@plt>
mov    %rax,0x20(%rsp)
mov    %r12d,0x18(%rsp)
movl   $0x20,0x8(%rsp)
mov    0x10(%rsp),%rbp
movl   $0x1,0x0(%rbp)
mov    (%r15),%edx
lea    0xe3f(%rip),%rsi
mov    %rbx,%rdi
call   1060 <XInternAtom@plt>
mov    %eax,0x4(%rbp)
movabs $0x100000000,%rax
mov    %rax,0x8(%rbp)
mov    %rbx,%rdi
call   1040 <DefaultRootWindow@plt>
mov    (%r15),%edx
mov    0x2df6(%rip),%rcx
mov    (%rcx),%ecx
mov    %rbx,%rdi
mov    %eax,%esi
mov    %r14,%r8
call   1030 <XSendEvent@plt>
mov    %rbx,%rdi
mov    %r12d,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1050 <XMoveWindow@plt>
add    $0x30,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_5__ = type { i32, %struct.TYPE_4__, i32, i8*, i32, i32 }
%struct.TYPE_4__ = type { i32* }
@ClientMessage = global i32 0
@True = global i32 0
@.str = [14 x i8] c"_NET_WM_STATE\00"
@False = global i32 0
@.str.1 = [25 x i8] c"_NET_WM_STATE_FULLSCREEN\00"
@NoEventMask = global i32 0
define void @fullscreen(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca %struct.TYPE_5__
store i32* %0, i32** %3
store i32 %1, i32* %4
%6 = call i32 @bzero(%struct.TYPE_5__* %5, i32 40)
%7 = load i32, i32* @ClientMessage
%8 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %5, i32 0, i32 5
store i32 %7, i32* %8
%9 = load i32, i32* @True
%10 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %5, i32 0, i32 4
store i32 %9, i32* %10
%11 = load i32*, i32** %3
%12 = load i32, i32* @False
%13 = call i8* @XInternAtom(i32* %11, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %5, i32 0, i32 3
store i8* %13, i8** %14
%15 = load i32, i32* %4
%16 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %5, i32 0, i32 2
store i32 %15, i32* %16
%17 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %5, i32 0, i32 0
store i32 32, i32* %17
%18 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %5, i32 0, i32 1
%19 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %18, i32 0, i32 0
%20 = load i32*, i32** %19
%21 = getelementptr inbounds i32, i32* %20, i64 0
store i32 1, i32* %21
%22 = load i32*, i32** %3
%23 = load i32, i32* @False
%24 = call i8* @XInternAtom(i32* %22, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %23)
%25 = ptrtoint i8* %24 to i32
%26 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %5, i32 0, i32 1
%27 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %26, i32 0, i32 0
%28 = load i32*, i32** %27
%29 = getelementptr inbounds i32, i32* %28, i64 1
store i32 %25, i32* %29
%30 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %5, i32 0, i32 1
%31 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %30, i32 0, i32 0
%32 = load i32*, i32** %31
%33 = getelementptr inbounds i32, i32* %32, i64 2
store i32 0, i32* %33
%34 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %5, i32 0, i32 1
%35 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %34, i32 0, i32 0
%36 = load i32*, i32** %35
%37 = getelementptr inbounds i32, i32* %36, i64 3
store i32 1, i32* %37
%38 = load i32*, i32** %3
%39 = load i32*, i32** %3
%40 = call i32 @DefaultRootWindow(i32* %39)
%41 = load i32, i32* @False
%42 = load i32, i32* @NoEventMask
%43 = bitcast %struct.TYPE_5__* %5 to i32*
%44 = call i32 @XSendEvent(i32* %38, i32 %40, i32 %41, i32 %42, i32* %43)
%45 = load i32*, i32** %3
%46 = load i32, i32* %4
%47 = call i32 @XMoveWindow(i32* %45, i32 %46, i32 0, i32 0)
ret void
}

LLVM IR (-O2):
%struct.TYPE_5__ = type { i32, %struct.TYPE_4__, i32, i8*, i32, i32 }
%struct.TYPE_4__ = type { i32* }
@ClientMessage = global i32 0
@True = global i32 0
@.str = [14 x i8] c"_NET_WM_STATE\00"
@False = global i32 0
@.str.1 = [25 x i8] c"_NET_WM_STATE_FULLSCREEN\00"
@NoEventMask = global i32 0
define void @fullscreen(i32* %0, i32 %1) {
%3 = alloca %struct.TYPE_5__
%4 = bitcast %struct.TYPE_5__* %3 to i8*
%5 = call i32 @bzero(%struct.TYPE_5__* %3, i32 40)
%6 = load i32, i32* @ClientMessage
%7 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %3, i64 0, i32 5
store i32 %6, i32* %7
%8 = load i32, i32* @True
%9 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %3, i64 0, i32 4
store i32 %8, i32* %9
%10 = load i32, i32* @False
%11 = tail call i8* @XInternAtom(i32* %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %3, i64 0, i32 3
store i8* %11, i8** %12
%13 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %3, i64 0, i32 2
store i32 %1, i32* %13
%14 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %3, i64 0, i32 0
store i32 32, i32* %14
%15 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %3, i64 0, i32 1, i32 0
%16 = load i32*, i32** %15
store i32 1, i32* %16
%17 = load i32, i32* @False
%18 = tail call i8* @XInternAtom(i32* %0, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%19 = ptrtoint i8* %18 to i64
%20 = trunc i64 %19 to i32
%21 = getelementptr inbounds i32, i32* %16, i64 1
store i32 %20, i32* %21
%22 = getelementptr inbounds i32, i32* %16, i64 2
store i32 0, i32* %22
%23 = getelementptr inbounds i32, i32* %16, i64 3
store i32 1, i32* %23
%24 = tail call i32 @DefaultRootWindow(i32* %0)
%25 = load i32, i32* @False
%26 = load i32, i32* @NoEventMask
%27 = call i32 @XSendEvent(i32* %0, i32 %24, i32 %25, i32 %26, i32* %14)
%28 = call i32 @XMoveWindow(i32* %0, i32 %1, i32 0, i32 0)
ret void
}