#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_10__ TYPE_4__;
typedef struct TYPE_9__ TYPE_3__;
typedef struct TYPE_8__ TYPE_2__;
typedef struct TYPE_7__ TYPE_1__;

/* Type definitions */
typedef int /*<<< orphan*/ types;
struct TYPE_9__ {
  int /*<<< orphan*/ state;
};
struct TYPE_8__ {
  int /*<<< orphan*/ requestor;
  int /*<<< orphan*/ time;
  scalar_t__ target;
  int /*<<< orphan*/ selection;
  int /*<<< orphan*/ display;
  scalar_t__ property;
};
struct TYPE_7__ {
  int /*<<< orphan*/ time;
  scalar_t__ target;
  int /*<<< orphan*/ selection;
  int /*<<< orphan*/ requestor;
  int /*<<< orphan*/ display;
  int /*<<< orphan*/ type;
  scalar_t__ property;
};
struct TYPE_10__ {
  TYPE_3__ xproperty;
  int /*<<< orphan*/ type;
  TYPE_2__ xselectionrequest;
  TYPE_1__ xselection;
};
typedef TYPE_4__ XEvent;
typedef int /*<<< orphan*/ Window;
typedef int /*<<< orphan*/ Display;
typedef scalar_t__ Atom;

/* Variables and functions */
int /*<<< orphan*/ False;
int /*<<< orphan*/ PropModeReplace;
int /*<<< orphan*/ PropertyChangeMask;
int /*<<< orphan*/ PropertyDelete;
int /*<<< orphan*/ PropertyNotify;
int /*<<< orphan*/ SelectionNotify;
int /*<<< orphan*/ SelectionRequest;
scalar_t__ XA_ATOM;
int /*<<< orphan*/ XChangeProperty(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                   scalar_t__, scalar_t__, int,
                                   int /*<<< orphan*/, unsigned char *, int);
int XExtendedMaxRequestSize(int /*<<< orphan*/ *);
int /*<<< orphan*/ XFlush(int /*<<< orphan*/ *);
scalar_t__ XInternAtom(int /*<<< orphan*/ *, char *, int /*<<< orphan*/);
int XMaxRequestSize(int /*<<< orphan*/ *);
int /*<<< orphan*/ XSelectInput(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                int /*<<< orphan*/);
int /*<<< orphan*/ XSendEvent(int /*<<< orphan*/ *, int /*<<< orphan*/,
                              int /*<<< orphan*/, int /*<<< orphan*/,
                              TYPE_4__ *);
int xcin(Display *dpy, Window *win, XEvent evt, Atom *pty, Atom target,
         unsigned char *txt, unsigned long len, unsigned long *pos,
         unsigned int *context) {
  unsigned long chunk_len;
  XEvent res;
  static Atom inc;
  static Atom targets;
  static long chunk_size;
  if (!targets) {
    targets = XInternAtom(dpy, "TARGETS", False);
  }
  if (!inc) {
    inc = XInternAtom(dpy, "INCR", False);
  }
  if (!chunk_size) {
    chunk_size = XExtendedMaxRequestSize(dpy) / 4;
    if (!chunk_size) {
      chunk_size = XMaxRequestSize(dpy) / 4;
    }
  }
  switch (*context) {
  case 0:
    if (evt.type != SelectionRequest)
      return (0);
    *win = evt.xselectionrequest.requestor;
    *pty = evt.xselectionrequest.property;
    *pos = 0;
    if (evt.xselectionrequest.target == targets) {
      Atom types[2] = {targets, target};
      XChangeProperty(dpy, *win, *pty, XA_ATOM, 32, PropModeReplace,
                      (unsigned char *)types,
                      (int)(sizeof(types) / sizeof(Atom)));
    } else if (len > chunk_size) {
      XChangeProperty(dpy, *win, *pty, inc, 32, PropModeReplace, 0, 0);
      XSelectInput(dpy, *win, PropertyChangeMask);
      *context = 2;
    } else {
      XChangeProperty(dpy, *win, *pty, target, 8, PropModeReplace,
                      (unsigned char *)txt, (int)len);
    }
    res.xselection.property = *pty;
    res.xselection.type = SelectionNotify;
    res.xselection.display = evt.xselectionrequest.display;
    res.xselection.requestor = *win;
    res.xselection.selection = evt.xselectionrequest.selection;
    res.xselection.target = evt.xselectionrequest.target;
    res.xselection.time = evt.xselectionrequest.time;
    XSendEvent(dpy, evt.xselectionrequest.requestor, 0, 0, &res);
    XFlush(dpy);
    if (len > chunk_size)
      return (0);
    else
      return (1);
    break;
  case 2:
    if (evt.type != PropertyNotify)
      return (0);
    if (evt.xproperty.state != PropertyDelete)
      return (0);
    chunk_len = chunk_size;
    if ((*pos + chunk_len) > len)
      chunk_len = len - *pos;
    if (*pos > len)
      chunk_len = 0;
    if (chunk_len) {
      XChangeProperty(dpy, *win, *pty, target, 8, PropModeReplace, &txt[*pos],
                      (int)chunk_len);
    } else {
      XChangeProperty(dpy, *win, *pty, target, 8, PropModeReplace, 0, 0);
    }
    XFlush(dpy);
    if (!chunk_len)
      *context = 0;
    *pos += chunk_size;
    if (chunk_len > 0)
      return (0);
    else
      return (1);
    break;
  }
  return (0);
}


x86 assembly (clang, -O0):
<xcin>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    0x68(%rbp),%rax
mov    0x60(%rbp),%rax
lea    0x10(%rbp),%rax
mov    %rax,-0xa8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
cmpq   $0x0,0x2eba(%rip)
jne    11d4 <xcin+0x64>
mov    -0x10(%rbp),%rdi
mov    0x2e11(%rip),%rax
mov    (%rax),%edx
lea    0xe38(%rip),%rsi
call   1050 <XInternAtom@plt>
mov    %rax,0x2e94(%rip)
cmpq   $0x0,0x2e84(%rip)
jne    1202 <xcin+0x92>
mov    -0x10(%rbp),%rdi
mov    0x2de3(%rip),%rax
mov    (%rax),%edx
lea    0xe12(%rip),%rsi
call   1050 <XInternAtom@plt>
mov    %rax,0x2e5e(%rip)
cmpq   $0x0,0x2e66(%rip)
jne    1257 <xcin+0xe7>
mov    -0x10(%rbp),%rdi
call   1040 <XExtendedMaxRequestSize@plt>
mov    $0x4,%ecx
cltd
idiv   %ecx
cltq
mov    %rax,0x2e46(%rip)
cmpq   $0x0,0x2e3e(%rip)
jne    1252 <xcin+0xe2>
mov    -0x10(%rbp),%rdi
call   1090 <XMaxRequestSize@plt>
mov    $0x4,%ecx
cltd
idiv   %ecx
cltq
mov    %rax,0x2e1e(%rip)
jmp    1257 <xcin+0xe7>
mov    0x68(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0xac(%rbp)
test   %eax,%eax
je     1284 <xcin+0x114>
jmp    1270 <xcin+0x100>
mov    -0xac(%rbp),%eax
sub    $0x2,%eax
je     1483 <xcin+0x313>
jmp    15f5 <xcin+0x485>
mov    -0xa8(%rbp),%rax
mov    0x4(%rax),%eax
mov    0x2d2b(%rip),%rcx
cmp    (%rcx),%eax
je     12a9 <xcin+0x139>
movl   $0x0,-0x4(%rbp)
jmp    15fc <xcin+0x48c>
mov    -0xa8(%rbp),%rax
mov    0x8(%rax),%edx
mov    -0x18(%rbp),%rcx
mov    %edx,(%rcx)
mov    0x20(%rax),%rdx
mov    -0x20(%rbp),%rcx
mov    %rdx,(%rcx)
mov    0x60(%rbp),%rcx
movq   $0x0,(%rcx)
mov    0x10(%rax),%rax
cmp    0x2d8e(%rip),%rax
jne    1341 <xcin+0x1d1>
mov    0x2d81(%rip),%rax
mov    %rax,-0xa0(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x98(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
mov    -0x20(%rbp),%rax
mov    (%rax),%rdx
mov    0x2cc7(%rip),%rax
mov    (%rax),%rcx
mov    0x2c8d(%rip),%rax
mov    (%rax),%r9d
lea    -0xa0(%rbp),%rax
mov    $0x20,%r8d
mov    %rax,(%rsp)
movl   $0x2,0x8(%rsp)
call   1060 <XChangeProperty@plt>
jmp    13f9 <xcin+0x289>
mov    -0x38(%rbp),%rax
cmp    0x2d24(%rip),%rax
jbe    13ba <xcin+0x24a>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
mov    -0x20(%rbp),%rax
mov    (%rax),%rdx
mov    0x2cf6(%rip),%rcx
mov    0x2c37(%rip),%rax
mov    (%rax),%r9d
mov    $0x20,%r8d
xor    %eax,%eax
xor    %eax,%eax
movq   $0x0,(%rsp)
movl   $0x0,0x8(%rsp)
call   1060 <XChangeProperty@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
mov    0x2c24(%rip),%rax
mov    (%rax),%edx
call   1070 <XSelectInput@plt>
mov    0x68(%rbp),%rax
movl   $0x2,(%rax)
jmp    13f4 <xcin+0x284>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
mov    -0x20(%rbp),%rax
mov    (%rax),%rdx
mov    -0x28(%rbp),%rcx
mov    0x2bd2(%rip),%rax
mov    (%rax),%r9d
mov    -0x30(%rbp),%r10
mov    -0x38(%rbp),%rax
mov    $0x8,%r8d
mov    %r10,(%rsp)
mov    %eax,0x8(%rsp)
call   1060 <XChangeProperty@plt>
jmp    13f9 <xcin+0x289>
mov    -0xa8(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rcx),%rcx
mov    %rcx,-0x48(%rbp)
mov    0x2be6(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,-0x4c(%rbp)
mov    0x1c(%rax),%ecx
mov    %ecx,-0x50(%rbp)
mov    -0x18(%rbp),%rcx
mov    (%rcx),%ecx
mov    %ecx,-0x54(%rbp)
mov    0x18(%rax),%ecx
mov    %ecx,-0x58(%rbp)
mov    0x10(%rax),%rcx
mov    %rcx,-0x60(%rbp)
mov    0xc(%rax),%ecx
mov    %ecx,-0x68(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x8(%rax),%esi
xor    %ecx,%ecx
lea    -0x90(%rbp),%r8
mov    %ecx,%edx
call   1030 <XSendEvent@plt>
mov    -0x10(%rbp),%rdi
call   1080 <XFlush@plt>
mov    -0x38(%rbp),%rax
cmp    0x2c0b(%rip),%rax
jbe    1477 <xcin+0x307>
movl   $0x0,-0x4(%rbp)
jmp    15fc <xcin+0x48c>
movl   $0x1,-0x4(%rbp)
jmp    15fc <xcin+0x48c>
mov    -0xa8(%rbp),%rax
mov    0x4(%rax),%eax
mov    0x2b1c(%rip),%rcx
cmp    (%rcx),%eax
je     14a8 <xcin+0x338>
movl   $0x0,-0x4(%rbp)
jmp    15fc <xcin+0x48c>
mov    -0xa8(%rbp),%rax
mov    (%rax),%eax
mov    0x2b38(%rip),%rcx
cmp    (%rcx),%eax
je     14cc <xcin+0x35c>
movl   $0x0,-0x4(%rbp)
jmp    15fc <xcin+0x48c>
mov    0x2b9d(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0x60(%rbp),%rax
mov    (%rax),%rax
add    -0x40(%rbp),%rax
cmp    -0x38(%rbp),%rax
jbe    14fb <xcin+0x38b>
mov    -0x38(%rbp),%rax
mov    0x60(%rbp),%rcx
sub    (%rcx),%rax
mov    %rax,-0x40(%rbp)
mov    0x60(%rbp),%rax
mov    (%rax),%rax
cmp    -0x38(%rbp),%rax
jbe    1514 <xcin+0x3a4>
movq   $0x0,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
je     1565 <xcin+0x3f5>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
mov    -0x20(%rbp),%rax
mov    (%rax),%rdx
mov    -0x28(%rbp),%rcx
mov    0x2a6d(%rip),%rax
mov    (%rax),%r9d
mov    -0x30(%rbp),%r10
mov    0x60(%rbp),%rax
add    (%rax),%r10
mov    -0x40(%rbp),%rax
mov    $0x8,%r8d
mov    %r10,(%rsp)
mov    %eax,0x8(%rsp)
call   1060 <XChangeProperty@plt>
jmp    15a3 <xcin+0x433>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
mov    -0x20(%rbp),%rax
mov    (%rax),%rdx
mov    -0x28(%rbp),%rcx
mov    0x2a27(%rip),%rax
mov    (%rax),%r9d
mov    $0x8,%r8d
xor    %eax,%eax
xor    %eax,%eax
movq   $0x0,(%rsp)
movl   $0x0,0x8(%rsp)
call   1060 <XChangeProperty@plt>
mov    -0x10(%rbp),%rdi
call   1080 <XFlush@plt>
cmpq   $0x0,-0x40(%rbp)
jne    15c1 <xcin+0x451>
mov    0x68(%rbp),%rax
movl   $0x0,(%rax)
mov    0x2aa8(%rip),%rcx
mov    0x60(%rbp),%rax
add    (%rax),%rcx
mov    %rcx,(%rax)
cmpq   $0x0,-0x40(%rbp)
jbe    15e9 <xcin+0x479>
movl   $0x0,-0x4(%rbp)
jmp    15fc <xcin+0x48c>
movl   $0x1,-0x4(%rbp)
jmp    15fc <xcin+0x48c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xcin>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %r9,%r15
mov    %r8,0x18(%rsp)
mov    %rcx,%r13
mov    %rdx,%r12
mov    %rsi,0x8(%rsp)
mov    %rdi,%rbx
cmpq   $0x0,0x2ecc(%rip)
je     12bd <xcin+0x14d>
cmpq   $0x0,0x2eb6(%rip)
je     12ea <xcin+0x17a>
mov    0x108(%rsp),%rdi
mov    0x2eb1(%rip),%rax
test   %rax,%rax
jne    120b <xcin+0x9b>
mov    %rdi,%rbp
mov    %rbx,%rdi
call   1040 <XExtendedMaxRequestSize@plt>
mov    %rbp,%rdi
lea    0x3(%rax),%ecx
test   %eax,%eax
cmovs  %ecx,%eax
sar    $0x2,%eax
cltq
mov    %rax,0x2e8a(%rip)
cmp    $0x6,%ecx
ja     120b <xcin+0x9b>
mov    %rbx,%rdi
call   1090 <XMaxRequestSize@plt>
mov    %rbp,%rdi
lea    0x3(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
sar    $0x2,%ecx
movslq %ecx,%rax
mov    %rax,0x2e65(%rip)
mov    0x100(%rsp),%rbp
lea    0xb0(%rsp),%r14
mov    (%rdi),%ecx
cmp    $0x2,%ecx
je     130e <xcin+0x19e>
test   %ecx,%ecx
jne    1399 <xcin+0x229>
mov    0x4(%r14),%ecx
mov    0x2d87(%rip),%rdx
cmp    (%rdx),%ecx
jne    1399 <xcin+0x229>
mov    0x8(%r14),%esi
mov    0x8(%rsp),%rcx
mov    %esi,(%rcx)
mov    0x20(%r14),%rcx
mov    %rcx,(%r12)
movq   $0x0,0x0(%rbp)
mov    0x10(%r14),%rcx
cmp    0x2e01(%rip),%rcx
jne    13ae <xcin+0x23e>
mov    %rcx,0x20(%rsp)
mov    %r13,0x28(%rsp)
mov    (%r12),%rdx
mov    0x2d56(%rip),%rax
mov    %rcx,%rbp
mov    (%rax),%rcx
mov    0x2d19(%rip),%rax
mov    (%rax),%r9d
lea    0x20(%rsp),%rax
mov    %rbx,%rdi
mov    %esi,%r13d
mov    $0x20,%r8d
push   $0x2
push   %rax
call   1060 <XChangeProperty@plt>
mov    %rbp,%rcx
add    $0x10,%rsp
mov    %r15,%rbp
mov    %r13d,%r15d
jmp    1482 <xcin+0x312>
mov    0x2d0c(%rip),%rax
mov    (%rax),%edx
lea    0xd33(%rip),%rsi
mov    %rbx,%rdi
call   1050 <XInternAtom@plt>
mov    %rax,0x2d8c(%rip)
cmpq   $0x0,0x2d7c(%rip)
jne    11b0 <xcin+0x40>
mov    0x2cdf(%rip),%rax
mov    (%rax),%edx
lea    0xd0e(%rip),%rsi
mov    %rbx,%rdi
call   1050 <XInternAtom@plt>
mov    %rax,0x2d57(%rip)
jmp    11b0 <xcin+0x40>
mov    0x4(%r14),%ecx
mov    0x2c97(%rip),%rdx
cmp    (%rdx),%ecx
jne    1399 <xcin+0x229>
mov    (%r14),%ecx
mov    0x2cc9(%rip),%rdx
cmp    (%rdx),%ecx
jne    1399 <xcin+0x229>
mov    0x0(%rbp),%rcx
lea    (%rcx,%rax,1),%rdx
mov    %r15,%r10
sub    %rcx,%r10
setb   %sil
cmp    %r15,%rdx
cmovbe %rax,%r10
test   %r10,%r10
sete   %bpl
or     %sil,%bpl
mov    0x8(%rsp),%rax
mov    (%rax),%esi
mov    (%r12),%rdx
mov    0x2c48(%rip),%rax
mov    (%rax),%r9d
je     1414 <xcin+0x2a4>
mov    %rdi,%r14
mov    %rbx,%rdi
mov    %r13,%rcx
mov    $0x8,%r8d
push   $0x0
push   $0x0
call   1060 <XChangeProperty@plt>
add    $0x10,%rsp
mov    %rbx,%rdi
call   1080 <XFlush@plt>
movl   $0x0,(%r14)
jmp    143c <xcin+0x2cc>
xor    %ebp,%ebp
movzbl %bpl,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rcx,0x10(%rsp)
mov    (%r12),%rdx
cmp    %r15,%rax
jae    1453 <xcin+0x2e3>
mov    0x2c99(%rip),%rcx
mov    0x2bda(%rip),%rax
mov    (%rax),%r9d
mov    %rdi,%rbp
mov    %rbx,%rdi
mov    %esi,%r13d
mov    $0x20,%r8d
push   $0x0
push   $0x0
call   1060 <XChangeProperty@plt>
add    $0x10,%rsp
mov    0x8(%rsp),%rax
mov    (%rax),%esi
mov    0x2bcd(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
call   1070 <XSelectInput@plt>
movl   $0x2,0x0(%rbp)
mov    %r15,%rbp
mov    %r13d,%r15d
jmp    147d <xcin+0x30d>
mov    0x18(%rsp),%rax
add    %rcx,%rax
mov    %rbx,%rdi
mov    %r13,%rcx
mov    $0x8,%r8d
push   %r10
push   %rax
call   1060 <XChangeProperty@plt>
add    $0x10,%rsp
mov    %rbx,%rdi
call   1080 <XFlush@plt>
mov    0x2c2d(%rip),%rax
mov    0x100(%rsp),%rcx
add    %rax,(%rcx)
jmp    139b <xcin+0x22b>
mov    %r15,%rbp
mov    0x2b4b(%rip),%rax
mov    (%rax),%r9d
mov    %rbx,%rdi
mov    %esi,%r15d
mov    %r13,%rcx
mov    $0x8,%r8d
push   %rbp
push   0x20(%rsp)
call   1060 <XChangeProperty@plt>
add    $0x10,%rsp
mov    0x10(%rsp),%rcx
mov    (%r12),%rax
mov    %rax,0x68(%rsp)
mov    0x2b66(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x64(%rsp)
mov    0x1c(%r14),%eax
mov    %eax,0x60(%rsp)
mov    0x8(%rsp),%rax
mov    (%rax),%eax
mov    %eax,0x5c(%rsp)
mov    0x18(%r14),%eax
mov    %eax,0x58(%rsp)
mov    %rcx,0x50(%rsp)
mov    0xc(%r14),%eax
mov    %eax,0x48(%rsp)
lea    0x20(%rsp),%r8
mov    %rbx,%rdi
mov    %r15d,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1030 <XSendEvent@plt>
mov    %rbx,%rdi
call   1080 <XFlush@plt>
cmp    %rbp,0x2b8d(%rip)
setae  %bpl
jmp    139b <xcin+0x22b>

LLVM IR (-O0):
%struct.TYPE_10__ = type { %struct.TYPE_9__, i32, %struct.TYPE_8__, %struct.TYPE_7__ }
%struct.TYPE_9__ = type { i32 }
%struct.TYPE_8__ = type { i32, i32, i64, i32, i32, i64 }
%struct.TYPE_7__ = type { i32, i64, i32, i32, i32, i32, i64 }
@xcin.inc = internal global i64 0
@xcin.targets = internal global i64 0
@xcin.chunk_size = internal global i64 0
@.str = [8 x i8] c"TARGETS\00"
@False = global i32 0
@.str.1 = [5 x i8] c"INCR\00"
@SelectionRequest = global i32 0
@XA_ATOM = global i64 0
@PropModeReplace = global i32 0
@PropertyChangeMask = global i32 0
@SelectionNotify = global i32 0
@PropertyNotify = global i32 0
@PropertyDelete = global i32 0
define i32 @xcin(i32* %0, i32* %1, %struct.TYPE_10__* byval(%struct.TYPE_10__) align 8 %2, i64* %3, i64 %4, i8* %5, i64 %6, i64* %7, i32* %8) {
%10 = alloca i32
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i64*
%14 = alloca i64
%15 = alloca i8*
%16 = alloca i64
%17 = alloca i64*
%18 = alloca i32*
%19 = alloca i64
%20 = alloca %struct.TYPE_10__
%21 = alloca [2 x i64]
store i32* %0, i32** %11
store i32* %1, i32** %12
store i64* %3, i64** %13
store i64 %4, i64* %14
store i8* %5, i8** %15
store i64 %6, i64* %16
store i64* %7, i64** %17
store i32* %8, i32** %18
%22 = load i64, i64* @xcin.targets
%23 = icmp ne i64 %22, 0
br i1 %23, label %28, label %24
24: ; preds = %9
%25 = load i32*, i32** %11
%26 = load i32, i32* @False
%27 = call i64 @XInternAtom(i32* %25, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %26)
store i64 %27, i64* @xcin.targets
br label %28
28: ; preds = %24, %9
%29 = load i64, i64* @xcin.inc
%30 = icmp ne i64 %29, 0
br i1 %30, label %35, label %31
31: ; preds = %28
%32 = load i32*, i32** %11
%33 = load i32, i32* @False
%34 = call i64 @XInternAtom(i32* %32, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %33)
store i64 %34, i64* @xcin.inc
br label %35
35: ; preds = %31, %28
%36 = load i64, i64* @xcin.chunk_size
%37 = icmp ne i64 %36, 0
br i1 %37, label %51, label %38
38: ; preds = %35
%39 = load i32*, i32** %11
%40 = call i32 @XExtendedMaxRequestSize(i32* %39)
%41 = sdiv i32 %40, 4
%42 = sext i32 %41 to i64
store i64 %42, i64* @xcin.chunk_size
%43 = load i64, i64* @xcin.chunk_size
%44 = icmp ne i64 %43, 0
br i1 %44, label %50, label %45
45: ; preds = %38
%46 = load i32*, i32** %11
%47 = call i32 @XMaxRequestSize(i32* %46)
%48 = sdiv i32 %47, 4
%49 = sext i32 %48 to i64
store i64 %49, i64* @xcin.chunk_size
br label %50
50: ; preds = %45, %38
br label %51
51: ; preds = %50, %35
%52 = load i32*, i32** %18
%53 = load i32, i32* %52
switch i32 %53, label %241 [
i32 0, label %54
i32 2, label %166
]
54: ; preds = %51
%55 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %2, i32 0, i32 1
%56 = load i32, i32* %55
%57 = load i32, i32* @SelectionRequest
%58 = icmp ne i32 %56, %57
br i1 %58, label %59, label %60
59: ; preds = %54
store i32 0, i32* %10
br label %242
60: ; preds = %54
%61 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %2, i32 0, i32 2
%62 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %61, i32 0, i32 0
%63 = load i32, i32* %62
%64 = load i32*, i32** %12
store i32 %63, i32* %64
%65 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %2, i32 0, i32 2
%66 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %65, i32 0, i32 5
%67 = load i64, i64* %66
%68 = load i64*, i64** %13
store i64 %67, i64* %68
%69 = load i64*, i64** %17
store i64 0, i64* %69
%70 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %2, i32 0, i32 2
%71 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %70, i32 0, i32 2
%72 = load i64, i64* %71
%73 = load i64, i64* @xcin.targets
%74 = icmp eq i64 %72, %73
br i1 %74, label %75, label %90
75: ; preds = %60
%76 = getelementptr inbounds [2 x i64], [2 x i64]* %21, i64 0, i64 0
%77 = load i64, i64* @xcin.targets
store i64 %77, i64* %76
%78 = getelementptr inbounds i64, i64* %76, i64 1
%79 = load i64, i64* %14
store i64 %79, i64* %78
%80 = load i32*, i32** %11
%81 = load i32*, i32** %12
%82 = load i32, i32* %81
%83 = load i64*, i64** %13
%84 = load i64, i64* %83
%85 = load i64, i64* @XA_ATOM
%86 = load i32, i32* @PropModeReplace
%87 = getelementptr inbounds [2 x i64], [2 x i64]* %21, i64 0, i64 0
%88 = bitcast i64* %87 to i8*
%89 = call i32 @XChangeProperty(i32* %80, i32 %82, i64 %84, i64 %85, i32 32, i32 %86, i8* %88, i32 2)
br label %122
90: ; preds = %60
%91 = load i64, i64* %16
%92 = load i64, i64* @xcin.chunk_size
%93 = icmp ugt i64 %91, %92
br i1 %93, label %94, label %109
94: ; preds = %90
%95 = load i32*, i32** %11
%96 = load i32*, i32** %12
%97 = load i32, i32* %96
%98 = load i64*, i64** %13
%99 = load i64, i64* %98
%100 = load i64, i64* @xcin.inc
%101 = load i32, i32* @PropModeReplace
%102 = call i32 @XChangeProperty(i32* %95, i32 %97, i64 %99, i64 %100, i32 32, i32 %101, i8* null, i32 0)
%103 = load i32*, i32** %11
%104 = load i32*, i32** %12
%105 = load i32, i32* %104
%106 = load i32, i32* @PropertyChangeMask
%107 = call i32 @XSelectInput(i32* %103, i32 %105, i32 %106)
%108 = load i32*, i32** %18
store i32 2, i32* %108
br label %121
109: ; preds = %90
%110 = load i32*, i32** %11
%111 = load i32*, i32** %12
%112 = load i32, i32* %111
%113 = load i64*, i64** %13
%114 = load i64, i64* %113
%115 = load i64, i64* %14
%116 = load i32, i32* @PropModeReplace
%117 = load i8*, i8** %15
%118 = load i64, i64* %16
%119 = trunc i64 %118 to i32
%120 = call i32 @XChangeProperty(i32* %110, i32 %112, i64 %114, i64 %115, i32 8, i32 %116, i8* %117, i32 %119)
br label %121
121: ; preds = %109, %94
br label %122
122: ; preds = %121, %75
%123 = load i64*, i64** %13
%124 = load i64, i64* %123
%125 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %20, i32 0, i32 3
%126 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %125, i32 0, i32 6
store i64 %124, i64* %126
%127 = load i32, i32* @SelectionNotify
%128 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %20, i32 0, i32 3
%129 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %128, i32 0, i32 5
store i32 %127, i32* %129
%130 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %2, i32 0, i32 2
%131 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %130, i32 0, i32 4
%132 = load i32, i32* %131
%133 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %20, i32 0, i32 3
%134 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %133, i32 0, i32 4
store i32 %132, i32* %134
%135 = load i32*, i32** %12
%136 = load i32, i32* %135
%137 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %20, i32 0, i32 3
%138 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %137, i32 0, i32 3
store i32 %136, i32* %138
%139 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %2, i32 0, i32 2
%140 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %139, i32 0, i32 3
%141 = load i32, i32* %140
%142 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %20, i32 0, i32 3
%143 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %142, i32 0, i32 2
store i32 %141, i32* %143
%144 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %2, i32 0, i32 2
%145 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %144, i32 0, i32 2
%146 = load i64, i64* %145
%147 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %20, i32 0, i32 3
%148 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %147, i32 0, i32 1
store i64 %146, i64* %148
%149 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %2, i32 0, i32 2
%150 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %149, i32 0, i32 1
%151 = load i32, i32* %150
%152 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %20, i32 0, i32 3
%153 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %152, i32 0, i32 0
store i32 %151, i32* %153
%154 = load i32*, i32** %11
%155 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %2, i32 0, i32 2
%156 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %155, i32 0, i32 0
%157 = load i32, i32* %156
%158 = call i32 @XSendEvent(i32* %154, i32 %157, i32 0, i32 0, %struct.TYPE_10__* %20)
%159 = load i32*, i32** %11
%160 = call i32 @XFlush(i32* %159)
%161 = load i64, i64* %16
%162 = load i64, i64* @xcin.chunk_size
%163 = icmp ugt i64 %161, %162
br i1 %163, label %164, label %165
164: ; preds = %122
store i32 0, i32* %10
br label %242
165: ; preds = %122
store i32 1, i32* %10
br label %242
166: ; preds = %51
%167 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %2, i32 0, i32 1
%168 = load i32, i32* %167
%169 = load i32, i32* @PropertyNotify
%170 = icmp ne i32 %168, %169
br i1 %170, label %171, label %172
171: ; preds = %166
store i32 0, i32* %10
br label %242
172: ; preds = %166
%173 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %2, i32 0, i32 0
%174 = getelementptr inbounds %struct.TYPE_9__, %struct.TYPE_9__* %173, i32 0, i32 0
%175 = load i32, i32* %174
%176 = load i32, i32* @PropertyDelete
%177 = icmp ne i32 %175, %176
br i1 %177, label %178, label %179
178: ; preds = %172
store i32 0, i32* %10
br label %242
179: ; preds = %172
%180 = load i64, i64* @xcin.chunk_size
store i64 %180, i64* %19
%181 = load i64*, i64** %17
%182 = load i64, i64* %181
%183 = load i64, i64* %19
%184 = add i64 %182, %183
%185 = load i64, i64* %16
%186 = icmp ugt i64 %184, %185
br i1 %186, label %187, label %192
187: ; preds = %179
%188 = load i64, i64* %16
%189 = load i64*, i64** %17
%190 = load i64, i64* %189
%191 = sub i64 %188, %190
store i64 %191, i64* %19
br label %192
192: ; preds = %187, %179
%193 = load i64*, i64** %17
%194 = load i64, i64* %193
%195 = load i64, i64* %16
%196 = icmp ugt i64 %194, %195
br i1 %196, label %197, label %198
197: ; preds = %192
store i64 0, i64* %19
br label %198
198: ; preds = %197, %192
%199 = load i64, i64* %19
%200 = icmp ne i64 %199, 0
br i1 %200, label %201, label %216
201: ; preds = %198
%202 = load i32*, i32** %11
%203 = load i32*, i32** %12
%204 = load i32, i32* %203
%205 = load i64*, i64** %13
%206 = load i64, i64* %205
%207 = load i64, i64* %14
%208 = load i32, i32* @PropModeReplace
%209 = load i8*, i8** %15
%210 = load i64*, i64** %17
%211 = load i64, i64* %210
%212 = getelementptr inbounds i8, i8* %209, i64 %211
%213 = load i64, i64* %19
%214 = trunc i64 %213 to i32
%215 = call i32 @XChangeProperty(i32* %202, i32 %204, i64 %206, i64 %207, i32 8, i32 %208, i8* %212, i32 %214)
br label %225
216: ; preds = %198
%217 = load i32*, i32** %11
%218 = load i32*, i32** %12
%219 = load i32, i32* %218
%220 = load i64*, i64** %13
%221 = load i64, i64* %220
%222 = load i64, i64* %14
%223 = load i32, i32* @PropModeReplace
%224 = call i32 @XChangeProperty(i32* %217, i32 %219, i64 %221, i64 %222, i32 8, i32 %223, i8* null, i32 0)
br label %225
225: ; preds = %216, %201
%226 = load i32*, i32** %11
%227 = call i32 @XFlush(i32* %226)
%228 = load i64, i64* %19
%229 = icmp ne i64 %228, 0
br i1 %229, label %232, label %230
230: ; preds = %225
%231 = load i32*, i32** %18
store i32 0, i32* %231
br label %232
232: ; preds = %230, %225
%233 = load i64, i64* @xcin.chunk_size
%234 = load i64*, i64** %17
%235 = load i64, i64* %234
%236 = add i64 %235, %233
store i64 %236, i64* %234
%237 = load i64, i64* %19
%238 = icmp ugt i64 %237, 0
br i1 %238, label %239, label %240
239: ; preds = %232
store i32 0, i32* %10
br label %242
240: ; preds = %232
store i32 1, i32* %10
br label %242
241: ; preds = %51
store i32 0, i32* %10
br label %242
242: ; preds = %241, %240, %239, %178, %171, %165, %164, %59
%243 = load i32, i32* %10
ret i32 %243
}

LLVM IR (-O2):
%struct.TYPE_10__ = type { %struct.TYPE_9__, i32, %struct.TYPE_8__, %struct.TYPE_7__ }
%struct.TYPE_9__ = type { i32 }
%struct.TYPE_8__ = type { i32, i32, i64, i32, i32, i64 }
%struct.TYPE_7__ = type { i32, i64, i32, i32, i32, i32, i64 }
@xcin.inc = internal unnamed_addr global i64 0
@xcin.targets = internal unnamed_addr global i64 0
@xcin.chunk_size = internal unnamed_addr global i64 0
@.str = [8 x i8] c"TARGETS\00"
@False = global i32 0
@.str.1 = [5 x i8] c"INCR\00"
@SelectionRequest = global i32 0
@XA_ATOM = global i64 0
@PropModeReplace = global i32 0
@PropertyChangeMask = global i32 0
@SelectionNotify = global i32 0
@PropertyNotify = global i32 0
@PropertyDelete = global i32 0
define i32 @xcin(i32* %0, i32* nocapture %1, %struct.TYPE_10__* nocapture byval(%struct.TYPE_10__) align 8 %2, i64* nocapture %3, i64 %4, i8* %5, i64 %6, i64* nocapture %7, i32* nocapture %8) {
%10 = alloca %struct.TYPE_10__
%11 = alloca [2 x i64]
%12 = bitcast %struct.TYPE_10__* %10 to i8*
%13 = load i64, i64* @xcin.targets
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %9
%16 = load i32, i32* @False
%17 = tail call i64 @XInternAtom(i32* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %16)
store i64 %17, i64* @xcin.targets
br label %18
18: ; preds = %15, %9
%19 = load i64, i64* @xcin.inc
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = load i32, i32* @False
%23 = tail call i64 @XInternAtom(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %22)
store i64 %23, i64* @xcin.inc
br label %24
24: ; preds = %21, %18
%25 = load i64, i64* @xcin.chunk_size
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %37
27: ; preds = %24
%28 = tail call i32 @XExtendedMaxRequestSize(i32* %0)
%29 = sdiv i32 %28, 4
%30 = sext i32 %29 to i64
store i64 %30, i64* @xcin.chunk_size
%31 = add i32 %28, 3
%32 = icmp ult i32 %31, 7
br i1 %32, label %33, label %37
33: ; preds = %27
%34 = tail call i32 @XMaxRequestSize(i32* %0)
%35 = sdiv i32 %34, 4
%36 = sext i32 %35 to i64
store i64 %36, i64* @xcin.chunk_size
br label %37
37: ; preds = %27, %33, %24
%38 = phi i64 [ %30, %27 ], [ %36, %33 ], [ %25, %24 ]
%39 = load i32, i32* %8
switch i32 %39, label %131 [
i32 0, label %40
i32 2, label %97
]
40: ; preds = %37
%41 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %2, i64 0, i32 1
%42 = load i32, i32* %41
%43 = load i32, i32* @SelectionRequest
%44 = icmp eq i32 %42, %43
br i1 %44, label %45, label %131
45: ; preds = %40
%46 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %2, i64 0, i32 2, i32 0
%47 = load i32, i32* %46
store i32 %47, i32* %1
%48 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %2, i64 0, i32 2, i32 5
%49 = load i64, i64* %48
store i64 %49, i64* %3
store i64 0, i64* %7
%50 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %2, i64 0, i32 2, i32 2
%51 = load i64, i64* %50
%52 = load i64, i64* @xcin.targets
%53 = icmp eq i64 %51, %52
br i1 %53, label %54, label %62
54: ; preds = %45
%55 = bitcast [2 x i64]* %11 to i8*
%56 = getelementptr inbounds [2 x i64], [2 x i64]* %11, i64 0, i64 0
store i64 %51, i64* %56
%57 = getelementptr inbounds [2 x i64], [2 x i64]* %11, i64 0, i64 1
store i64 %4, i64* %57
%58 = load i64, i64* %3
%59 = load i64, i64* @XA_ATOM
%60 = load i32, i32* @PropModeReplace
%61 = call i32 @XChangeProperty(i32* %0, i32 %47, i64 %58, i64 %59, i32 32, i32 %60, i8* %55, i32 2)
br label %76
62: ; preds = %45
%63 = icmp ult i64 %38, %6
%64 = load i64, i64* %3
br i1 %63, label %65, label %72
65: ; preds = %62
%66 = load i64, i64* @xcin.inc
%67 = load i32, i32* @PropModeReplace
%68 = tail call i32 @XChangeProperty(i32* %0, i32 %47, i64 %64, i64 %66, i32 32, i32 %67, i8* null, i32 0)
%69 = load i32, i32* %1
%70 = load i32, i32* @PropertyChangeMask
%71 = tail call i32 @XSelectInput(i32* %0, i32 %69, i32 %70)
store i32 2, i32* %8
br label %76
72: ; preds = %62
%73 = load i32, i32* @PropModeReplace
%74 = trunc i64 %6 to i32
%75 = tail call i32 @XChangeProperty(i32* %0, i32 %47, i64 %64, i64 %4, i32 8, i32 %73, i8* %5, i32 %74)
br label %76
76: ; preds = %65, %72, %54
%77 = load i64, i64* %3
%78 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %10, i64 0, i32 3, i32 6
store i64 %77, i64* %78
%79 = load i32, i32* @SelectionNotify
%80 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %10, i64 0, i32 3, i32 5
store i32 %79, i32* %80
%81 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %2, i64 0, i32 2, i32 4
%82 = load i32, i32* %81
%83 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %10, i64 0, i32 3, i32 4
store i32 %82, i32* %83
%84 = load i32, i32* %1
%85 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %10, i64 0, i32 3, i32 3
store i32 %84, i32* %85
%86 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %2, i64 0, i32 2, i32 3
%87 = load i32, i32* %86
%88 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %10, i64 0, i32 3, i32 2
store i32 %87, i32* %88
%89 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %10, i64 0, i32 3, i32 1
store i64 %51, i64* %89
%90 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %2, i64 0, i32 2, i32 1
%91 = load i32, i32* %90
%92 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %10, i64 0, i32 3, i32 0
store i32 %91, i32* %92
%93 = call i32 @XSendEvent(i32* %0, i32 %47, i32 0, i32 0, %struct.TYPE_10__* %10)
%94 = call i32 @XFlush(i32* %0)
%95 = load i64, i64* @xcin.chunk_size
%96 = icmp uge i64 %95, %6
br label %131
97: ; preds = %37
%98 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %2, i64 0, i32 1
%99 = load i32, i32* %98
%100 = load i32, i32* @PropertyNotify
%101 = icmp eq i32 %99, %100
br i1 %101, label %102, label %131
102: ; preds = %97
%103 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %2, i64 0, i32 0, i32 0
%104 = load i32, i32* %103
%105 = load i32, i32* @PropertyDelete
%106 = icmp eq i32 %104, %105
br i1 %106, label %107, label %131
107: ; preds = %102
%108 = load i64, i64* %7
%109 = add i64 %108, %38
%110 = icmp ugt i64 %109, %6
%111 = sub i64 %6, %108
%112 = select i1 %110, i64 %111, i64 %38
%113 = icmp ugt i64 %108, %6
%114 = icmp eq i64 %112, 0
%115 = select i1 %113, i1 true, i1 %114
%116 = load i32, i32* %1
%117 = load i64, i64* %3
%118 = load i32, i32* @PropModeReplace
br i1 %115, label %124, label %119
119: ; preds = %107
%120 = getelementptr inbounds i8, i8* %5, i64 %108
%121 = trunc i64 %112 to i32
%122 = tail call i32 @XChangeProperty(i32* %0, i32 %116, i64 %117, i64 %4, i32 8, i32 %118, i8* %120, i32 %121)
%123 = tail call i32 @XFlush(i32* %0)
br label %127
124: ; preds = %107
%125 = tail call i32 @XChangeProperty(i32* %0, i32 %116, i64 %117, i64 %4, i32 8, i32 %118, i8* null, i32 0)
%126 = tail call i32 @XFlush(i32* %0)
store i32 0, i32* %8
br label %127
127: ; preds = %119, %124
%128 = load i64, i64* @xcin.chunk_size
%129 = load i64, i64* %7
%130 = add i64 %129, %128
store i64 %130, i64* %7
br label %131
131: ; preds = %37, %127, %102, %97, %76, %40
%132 = phi i1 [ false, %40 ], [ %96, %76 ], [ false, %97 ], [ false, %102 ], [ %115, %127 ], [ false, %37 ]
%133 = zext i1 %132 to i32
ret i32 %133
}