#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 */

/* Type definitions */
typedef scalar_t__ Window;
typedef int /*<<< orphan*/ Display;
typedef int /*<<< orphan*/ Atom;

/* Variables and functions */
int /*<<< orphan*/ False;
scalar_t__ RootWindow(int /*<<< orphan*/ *, int);
scalar_t__ Success;
int /*<<< orphan*/ XA_ATOM;
int /*<<< orphan*/ XA_CARDINAL;
int /*<<< orphan*/ XA_WINDOW;
int /*<<< orphan*/ XFree(char *);
scalar_t__ XGetWindowProperty(int /*<<< orphan*/ *, scalar_t__,
                              int /*<<< orphan*/, int /*<<< orphan*/, int,
                              int /*<<< orphan*/, int /*<<< orphan*/,
                              int /*<<< orphan*/ *, int *, unsigned long *,
                              unsigned long *, unsigned char **);
int /*<<< orphan*/ XInternAtom(int /*<<< orphan*/ *, char *,
                               int /*<<< orphan*/);
scalar_t__ XQueryTree(int /*<<< orphan*/ *, scalar_t__, scalar_t__ *,
                      scalar_t__ *, scalar_t__ **, unsigned int *);
scalar_t__ __ToonGetKDEDesktop(int /*<<< orphan*/ *, int, scalar_t__,
                               int /*<<< orphan*/, char *, int /*<<< orphan*/);
scalar_t__ __ToonGetNautilusDesktop(int /*<<< orphan*/ *, int, scalar_t__,
                                    int /*<<< orphan*/);
Window ToonGetRootWindow(Display *display, int screen, Window *clientparent) {
  Window background = 0;
  Window root = RootWindow(display, screen);
  Window rootReturn, parentReturn, *children;
  Window *toplevel = (Window *)0;
  unsigned int nChildren;
  unsigned long nitems, bytesafter;
  Atom actual_type;
  int actual_format;
  unsigned long *workspace = NULL;
  unsigned long *desktop = NULL;
  Atom NAUTILUS_DESKTOP_WINDOW_ID =
      XInternAtom(display, "NAUTILUS_DESKTOP_WINDOW_ID", False);
  *clientparent = root;
  if (XGetWindowProperty(display, root, NAUTILUS_DESKTOP_WINDOW_ID, 0, 1, False,
                         XA_WINDOW, &actual_type, &actual_format, &nitems,
                         &bytesafter, (unsigned char **)&toplevel) == Success &&
      toplevel) {
    background = __ToonGetNautilusDesktop(display, screen, *toplevel, 0);
    XFree((char *)toplevel);
    if (background) {
    }
  }
  if (!background && XQueryTree(display, root, &rootReturn, &parentReturn,
                                &children, &nChildren)) {
    int i;
    Atom _NET_WM_WINDOW_TYPE =
        XInternAtom(display, "_NET_WM_WINDOW_TYPE", False);
    Atom __SWM_VROOT = XInternAtom(display, "__SWM_VROOT", False);
    for (i = 0; i < nChildren && !background; ++i) {
      Window *newroot = (Window *)0;
      if (XGetWindowProperty(display, children[i], __SWM_VROOT, 0, 1, False,
                             XA_WINDOW, &actual_type, &actual_format, &nitems,
                             &bytesafter,
                             (unsigned char **)&newroot) == Success &&
          newroot) {
        Atom _NET_SUPPORTED = XInternAtom(display, "_NET_SUPPORTED", False);
        Atom *tmpatom;
        if (XGetWindowProperty(display, root, _NET_SUPPORTED, 0, 1, False,
                               XA_ATOM, &actual_type, &actual_format, &nitems,
                               &bytesafter,
                               (unsigned char **)&tmpatom) == Success &&
            tmpatom) {
          Window *tmpwindow = (Window *)0;
          Atom _NET_VIRTUAL_ROOTS =
              XInternAtom(display, "_NET_VIRTUAL_ROOTS", False);
          XFree((char *)tmpatom);
          if (XGetWindowProperty(display, root, _NET_VIRTUAL_ROOTS, 0, 1, False,
                                 XA_WINDOW, &actual_type, &actual_format,
                                 &nitems, &bytesafter,
                                 (unsigned char **)&tmpwindow) != Success ||
              !tmpwindow) {
            background = *newroot;
          } else if (tmpwindow) {
            XFree((char *)tmpwindow);
          }
        }
        if (!background) {
          background = *clientparent = *newroot;
        }
        XFree((char *)newroot);
      } else if ((background = __ToonGetKDEDesktop(
                      display, screen, children[i], _NET_WM_WINDOW_TYPE,
                      "_NET_WM_WINDOW_TYPE_DESKTOP", 0))) {
      }
    }
    XFree((char *)children);
  }
  if (!background) {
    Atom _WIN_WORKSPACE = XInternAtom(display, "_WIN_WORKSPACE", False);
    if (XGetWindowProperty(display, root, _WIN_WORKSPACE, 0, 1, False,
                           XA_CARDINAL, &actual_type, &actual_format, &nitems,
                           &bytesafter,
                           (unsigned char **)&workspace) == Success &&
        workspace) {
      Atom ENLIGHTENMENT_DESKTOP =
          XInternAtom(display, "ENLIGHTENMENT_DESKTOP", False);
      if (XGetWindowProperty(display, root, ENLIGHTENMENT_DESKTOP, 0, 1, False,
                             XA_CARDINAL, &actual_type, &actual_format, &nitems,
                             &bytesafter,
                             (unsigned char **)&desktop) == Success &&
          desktop && *desktop == *workspace) {
        background = root;
        XFree((char *)desktop);
      } else if (XQueryTree(display, root, &rootReturn, &parentReturn,
                            &children, &nChildren)) {
        int i;
        for (i = 0; i < nChildren; ++i) {
          if (XGetWindowProperty(display, children[i], ENLIGHTENMENT_DESKTOP, 0,
                                 1, False, XA_CARDINAL, &actual_type,
                                 &actual_format, &nitems, &bytesafter,
                                 (unsigned char **)&desktop) == Success &&
              desktop && *desktop == *workspace) {
            background = *clientparent = children[i];
            XFree((char *)desktop);
          }
        }
        XFree((char *)children);
      }
      XFree((char *)workspace);
    }
  }
  if (background) {
    return background;
  } else {
    return root;
  }
}


x86 assembly (clang, -O0):
<ToonGetRootWindow>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
sub    $0xf8,%rsp
mov    %rdi,-0x28(%rbp)
mov    %esi,-0x2c(%rbp)
mov    %rdx,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x2c(%rbp),%esi
call   1080 <RootWindow@plt>
mov    %rax,-0x48(%rbp)
movq   $0x0,-0x68(%rbp)
movq   $0x0,-0x90(%rbp)
movq   $0x0,-0x98(%rbp)
mov    -0x28(%rbp),%rdi
mov    0x2e0c(%rip),%rax
mov    (%rax),%edx
lea    0xe2b(%rip),%rsi
call   1060 <XInternAtom@plt>
mov    %eax,-0x9c(%rbp)
mov    -0x48(%rbp),%rcx
mov    -0x38(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x28(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    -0x9c(%rbp),%edx
mov    0x2dd8(%rip),%rax
mov    (%rax),%r9d
mov    0x2dbe(%rip),%rax
mov    (%rax),%r15d
lea    -0x68(%rbp),%rax
xor    %ecx,%ecx
mov    $0x1,%r8d
lea    -0x84(%rbp),%r14
lea    -0x88(%rbp),%rbx
lea    -0x78(%rbp),%r11
lea    -0x80(%rbp),%r10
mov    %r15d,(%rsp)
mov    %r14,0x8(%rsp)
mov    %rbx,0x10(%rsp)
mov    %r11,0x18(%rsp)
mov    %r10,0x20(%rsp)
mov    %rax,0x28(%rsp)
call   1090 <XGetWindowProperty@plt>
mov    0x2da0(%rip),%rcx
cmp    (%rcx),%rax
jne    12a3 <ToonGetRootWindow+0x133>
cmpq   $0x0,-0x68(%rbp)
je     12a3 <ToonGetRootWindow+0x133>
mov    -0x28(%rbp),%rdi
mov    -0x2c(%rbp),%esi
mov    -0x68(%rbp),%rax
mov    (%rax),%rdx
xor    %ecx,%ecx
call   1030 <__ToonGetNautilusDesktop@plt>
mov    %rax,-0x40(%rbp)
mov    -0x68(%rbp),%rdi
call   1050 <XFree@plt>
cmpq   $0x0,-0x40(%rbp)
je     129e <ToonGetRootWindow+0x12e>
jmp    129e <ToonGetRootWindow+0x12e>
jmp    12a3 <ToonGetRootWindow+0x133>
cmpq   $0x0,-0x40(%rbp)
jne    1624 <ToonGetRootWindow+0x4b4>
mov    -0x28(%rbp),%rdi
mov    -0x48(%rbp),%rsi
lea    -0x50(%rbp),%rdx
lea    -0x58(%rbp),%rcx
lea    -0x60(%rbp),%r8
lea    -0x6c(%rbp),%r9
call   1040 <XQueryTree@plt>
cmp    $0x0,%rax
je     1624 <ToonGetRootWindow+0x4b4>
mov    -0x28(%rbp),%rdi
mov    0x2cf8(%rip),%rax
mov    (%rax),%edx
lea    0xd32(%rip),%rsi
call   1060 <XInternAtom@plt>
mov    %eax,-0xa4(%rbp)
mov    -0x28(%rbp),%rdi
mov    0x2cd9(%rip),%rax
mov    (%rax),%edx
lea    0xd27(%rip),%rsi
call   1060 <XInternAtom@plt>
mov    %eax,-0xa8(%rbp)
movl   $0x0,-0xa0(%rbp)
mov    -0xa0(%rbp),%ecx
xor    %eax,%eax
cmp    -0x6c(%rbp),%ecx
mov    %al,-0xd9(%rbp)
jae    1344 <ToonGetRootWindow+0x1d4>
cmpq   $0x0,-0x40(%rbp)
setne  %al
xor    $0xff,%al
mov    %al,-0xd9(%rbp)
mov    -0xd9(%rbp),%al
test   $0x1,%al
jne    1357 <ToonGetRootWindow+0x1e7>
jmp    161b <ToonGetRootWindow+0x4ab>
movq   $0x0,-0xb0(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x60(%rbp),%rax
movslq -0xa0(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0xa8(%rbp),%edx
mov    0x2c56(%rip),%rax
mov    (%rax),%r9d
mov    0x2c3c(%rip),%rax
mov    (%rax),%r15d
lea    -0xb0(%rbp),%rax
xor    %ecx,%ecx
mov    $0x1,%r8d
lea    -0x84(%rbp),%r14
lea    -0x88(%rbp),%rbx
lea    -0x78(%rbp),%r11
lea    -0x80(%rbp),%r10
mov    %r15d,(%rsp)
mov    %r14,0x8(%rsp)
mov    %rbx,0x10(%rsp)
mov    %r11,0x18(%rsp)
mov    %r10,0x20(%rsp)
mov    %rax,0x28(%rsp)
call   1090 <XGetWindowProperty@plt>
mov    0x2c1b(%rip),%rcx
cmp    (%rcx),%rax
jne    15bf <ToonGetRootWindow+0x44f>
cmpq   $0x0,-0xb0(%rbp)
je     15bf <ToonGetRootWindow+0x44f>
mov    -0x28(%rbp),%rdi
mov    0x2bd9(%rip),%rax
mov    (%rax),%edx
lea    0xc33(%rip),%rsi
call   1060 <XInternAtom@plt>
mov    %eax,-0xb4(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    -0xb4(%rbp),%edx
mov    0x2bb0(%rip),%rax
mov    (%rax),%r9d
mov    0x2bae(%rip),%rax
mov    (%rax),%r15d
lea    -0xc0(%rbp),%rax
xor    %ecx,%ecx
mov    $0x1,%r8d
lea    -0x84(%rbp),%r14
lea    -0x88(%rbp),%rbx
lea    -0x78(%rbp),%r11
lea    -0x80(%rbp),%r10
mov    %r15d,(%rsp)
mov    %r14,0x8(%rsp)
mov    %rbx,0x10(%rsp)
mov    %r11,0x18(%rsp)
mov    %r10,0x20(%rsp)
mov    %rax,0x28(%rsp)
call   1090 <XGetWindowProperty@plt>
mov    0x2b75(%rip),%rcx
cmp    (%rcx),%rax
jne    158e <ToonGetRootWindow+0x41e>
cmpq   $0x0,-0xc0(%rbp)
je     158e <ToonGetRootWindow+0x41e>
movq   $0x0,-0xc8(%rbp)
mov    -0x28(%rbp),%rdi
mov    0x2b28(%rip),%rax
mov    (%rax),%edx
lea    0xb91(%rip),%rsi
call   1060 <XInternAtom@plt>
mov    %eax,-0xcc(%rbp)
mov    -0xc0(%rbp),%rdi
call   1050 <XFree@plt>
mov    -0x28(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    -0xcc(%rbp),%edx
mov    0x2af3(%rip),%rax
mov    (%rax),%r9d
mov    0x2ad9(%rip),%rax
mov    (%rax),%r15d
lea    -0xc8(%rbp),%rax
xor    %ecx,%ecx
mov    $0x1,%r8d
lea    -0x84(%rbp),%r14
lea    -0x88(%rbp),%rbx
lea    -0x78(%rbp),%r11
lea    -0x80(%rbp),%r10
mov    %r15d,(%rsp)
mov    %r14,0x8(%rsp)
mov    %rbx,0x10(%rsp)
mov    %r11,0x18(%rsp)
mov    %r10,0x20(%rsp)
mov    %rax,0x28(%rsp)
call   1090 <XGetWindowProperty@plt>
mov    0x2ab8(%rip),%rcx
cmp    (%rcx),%rax
jne    1557 <ToonGetRootWindow+0x3e7>
cmpq   $0x0,-0xc8(%rbp)
jne    156a <ToonGetRootWindow+0x3fa>
mov    -0xb0(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x40(%rbp)
jmp    1589 <ToonGetRootWindow+0x419>
cmpq   $0x0,-0xc8(%rbp)
je     1584 <ToonGetRootWindow+0x414>
mov    -0xc8(%rbp),%rdi
call   1050 <XFree@plt>
jmp    1589 <ToonGetRootWindow+0x419>
jmp    158e <ToonGetRootWindow+0x41e>
cmpq   $0x0,-0x40(%rbp)
jne    15ae <ToonGetRootWindow+0x43e>
mov    -0xb0(%rbp),%rax
mov    (%rax),%rax
mov    -0x38(%rbp),%rcx
mov    %rax,(%rcx)
mov    %rax,-0x40(%rbp)
mov    -0xb0(%rbp),%rdi
call   1050 <XFree@plt>
jmp    1602 <ToonGetRootWindow+0x492>
mov    -0x28(%rbp),%rdi
mov    -0x2c(%rbp),%esi
mov    -0x60(%rbp),%rax
movslq -0xa0(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0xa4(%rbp),%ecx
lea    0xa7b(%rip),%r8
xor    %r9d,%r9d
call   1070 <__ToonGetKDEDesktop@plt>
mov    %rax,-0x40(%rbp)
cmp    $0x0,%rax
je     15fd <ToonGetRootWindow+0x48d>
jmp    15fd <ToonGetRootWindow+0x48d>
jmp    1602 <ToonGetRootWindow+0x492>
jmp    1607 <ToonGetRootWindow+0x497>
mov    -0xa0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa0(%rbp)
jmp    131d <ToonGetRootWindow+0x1ad>
mov    -0x60(%rbp),%rdi
call   1050 <XFree@plt>
cmpq   $0x0,-0x40(%rbp)
jne    18f8 <ToonGetRootWindow+0x788>
mov    -0x28(%rbp),%rdi
mov    0x299e(%rip),%rax
mov    (%rax),%edx
lea    0xa36(%rip),%rsi
call   1060 <XInternAtom@plt>
mov    %eax,-0xd0(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    -0xd0(%rbp),%edx
mov    0x2975(%rip),%rax
mov    (%rax),%r9d
mov    0x2953(%rip),%rax
mov    (%rax),%r15d
lea    -0x90(%rbp),%rax
xor    %ecx,%ecx
mov    $0x1,%r8d
lea    -0x84(%rbp),%r14
lea    -0x88(%rbp),%rbx
lea    -0x78(%rbp),%r11
lea    -0x80(%rbp),%r10
mov    %r15d,(%rsp)
mov    %r14,0x8(%rsp)
mov    %rbx,0x10(%rsp)
mov    %r11,0x18(%rsp)
mov    %r10,0x20(%rsp)
mov    %rax,0x28(%rsp)
call   1090 <XGetWindowProperty@plt>
mov    0x293a(%rip),%rcx
cmp    (%rcx),%rax
jne    18f3 <ToonGetRootWindow+0x783>
cmpq   $0x0,-0x90(%rbp)
je     18f3 <ToonGetRootWindow+0x783>
mov    -0x28(%rbp),%rdi
mov    0x28f8(%rip),%rax
mov    (%rax),%edx
lea    0x99f(%rip),%rsi
call   1060 <XInternAtom@plt>
mov    %eax,-0xd4(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    -0xd4(%rbp),%edx
mov    0x28cf(%rip),%rax
mov    (%rax),%r9d
mov    0x28ad(%rip),%rax
mov    (%rax),%r15d
lea    -0x98(%rbp),%rax
xor    %ecx,%ecx
mov    $0x1,%r8d
lea    -0x84(%rbp),%r14
lea    -0x88(%rbp),%rbx
lea    -0x78(%rbp),%r11
lea    -0x80(%rbp),%r10
mov    %r15d,(%rsp)
mov    %r14,0x8(%rsp)
mov    %rbx,0x10(%rsp)
mov    %r11,0x18(%rsp)
mov    %r10,0x20(%rsp)
mov    %rax,0x28(%rsp)
call   1090 <XGetWindowProperty@plt>
mov    0x2894(%rip),%rcx
cmp    (%rcx),%rax
jne    17ae <ToonGetRootWindow+0x63e>
cmpq   $0x0,-0x98(%rbp)
je     17ae <ToonGetRootWindow+0x63e>
mov    -0x98(%rbp),%rax
mov    (%rax),%rax
mov    -0x90(%rbp),%rcx
cmp    (%rcx),%rax
jne    17ae <ToonGetRootWindow+0x63e>
mov    -0x48(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x98(%rbp),%rdi
call   1050 <XFree@plt>
jmp    18e7 <ToonGetRootWindow+0x777>
mov    -0x28(%rbp),%rdi
mov    -0x48(%rbp),%rsi
lea    -0x50(%rbp),%rdx
lea    -0x58(%rbp),%rcx
lea    -0x60(%rbp),%r8
lea    -0x6c(%rbp),%r9
call   1040 <XQueryTree@plt>
cmp    $0x0,%rax
je     18e2 <ToonGetRootWindow+0x772>
movl   $0x0,-0xd8(%rbp)
mov    -0xd8(%rbp),%eax
cmp    -0x6c(%rbp),%eax
jae    18d9 <ToonGetRootWindow+0x769>
mov    -0x28(%rbp),%rdi
mov    -0x60(%rbp),%rax
movslq -0xd8(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0xd4(%rbp),%edx
mov    0x27ca(%rip),%rax
mov    (%rax),%r9d
mov    0x27a8(%rip),%rax
mov    (%rax),%r15d
lea    -0x98(%rbp),%rax
xor    %ecx,%ecx
mov    $0x1,%r8d
lea    -0x84(%rbp),%r14
lea    -0x88(%rbp),%rbx
lea    -0x78(%rbp),%r11
lea    -0x80(%rbp),%r10
mov    %r15d,(%rsp)
mov    %r14,0x8(%rsp)
mov    %rbx,0x10(%rsp)
mov    %r11,0x18(%rsp)
mov    %r10,0x20(%rsp)
mov    %rax,0x28(%rsp)
call   1090 <XGetWindowProperty@plt>
mov    0x278f(%rip),%rcx
cmp    (%rcx),%rax
jne    18c0 <ToonGetRootWindow+0x750>
cmpq   $0x0,-0x98(%rbp)
je     18c0 <ToonGetRootWindow+0x750>
mov    -0x98(%rbp),%rax
mov    (%rax),%rax
mov    -0x90(%rbp),%rcx
cmp    (%rcx),%rax
jne    18c0 <ToonGetRootWindow+0x750>
mov    -0x60(%rbp),%rax
movslq -0xd8(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x38(%rbp),%rcx
mov    %rax,(%rcx)
mov    %rax,-0x40(%rbp)
mov    -0x98(%rbp),%rdi
call   1050 <XFree@plt>
jmp    18c5 <ToonGetRootWindow+0x755>
mov    -0xd8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd8(%rbp)
jmp    17df <ToonGetRootWindow+0x66f>
mov    -0x60(%rbp),%rdi
call   1050 <XFree@plt>
jmp    18e7 <ToonGetRootWindow+0x777>
mov    -0x90(%rbp),%rdi
call   1050 <XFree@plt>
jmp    18f8 <ToonGetRootWindow+0x788>
cmpq   $0x0,-0x40(%rbp)
je     1910 <ToonGetRootWindow+0x7a0>
mov    -0x40(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    1918 <ToonGetRootWindow+0x7a8>
mov    -0x48(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0xf8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<ToonGetRootWindow>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %rdx,%r14
mov    %rdi,%rbx
mov    %esi,0x3c(%rsp)
call   1080 <RootWindow@plt>
mov    %rax,%rbp
movq   $0x0,0x50(%rsp)
movq   $0x0,0x20(%rsp)
movq   $0x0,0x48(%rsp)
mov    0x2e23(%rip),%r12
mov    (%r12),%edx
lea    0xe40(%rip),%rsi
mov    %rbx,%rdi
call   1060 <XInternAtom@plt>
mov    %r14,0x60(%rsp)
mov    %rbp,(%r14)
mov    (%r12),%r9d
mov    0x2ded(%rip),%rcx
mov    (%rcx),%r11d
lea    0x28(%rsp),%r14
lea    0x30(%rsp),%r15
lea    0x4(%rsp),%r13
lea    0x8(%rsp),%r10
mov    %rbx,%rdi
mov    %rbp,0x10(%rsp)
mov    %rbp,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
mov    $0x1,%r8d
lea    0x50(%rsp),%rax
push   %rax
push   %r14
push   %r15
push   %r13
push   %r10
push   %r11
call   1090 <XGetWindowProperty@plt>
add    $0x30,%rsp
mov    0x2dd1(%rip),%rcx
cmp    (%rcx),%rax
jne    125d <ToonGetRootWindow+0xed>
mov    0x50(%rsp),%rax
test   %rax,%rax
je     125d <ToonGetRootWindow+0xed>
mov    (%rax),%rdx
mov    %rbx,%rdi
mov    0x3c(%rsp),%esi
xor    %ecx,%ecx
call   1030 <__ToonGetNautilusDesktop@plt>
mov    %rax,%r15
mov    0x50(%rsp),%rdi
call   1050 <XFree@plt>
test   %r15,%r15
jne    16f8 <ToonGetRootWindow+0x588>
lea    0x80(%rsp),%rdx
lea    0x78(%rsp),%rcx
lea    0x18(%rsp),%r8
lea    0xc(%rsp),%r9
mov    %rbx,%rdi
mov    0x10(%rsp),%rsi
call   1040 <XQueryTree@plt>
test   %rax,%rax
je     14da <ToonGetRootWindow+0x36a>
mov    (%r12),%edx
lea    0xd86(%rip),%rsi
mov    %rbx,%rdi
call   1060 <XInternAtom@plt>
mov    %eax,0x5c(%rsp)
mov    (%r12),%edx
lea    0xd83(%rip),%rsi
mov    %rbx,%rdi
call   1060 <XInternAtom@plt>
cmpl   $0x0,0xc(%rsp)
je     14d0 <ToonGetRootWindow+0x360>
mov    %eax,%r14d
mov    $0x1,%r13d
nopl   0x0(%rax,%rax,1)
movq   $0x0,0x40(%rsp)
mov    0x18(%rsp),%rax
mov    -0x8(%rax,%r13,8),%rsi
mov    (%r12),%r9d
mov    0x2cda(%rip),%rax
mov    (%rax),%eax
mov    %rbx,%rdi
mov    %r14d,%edx
xor    %ecx,%ecx
mov    $0x1,%r8d
lea    0x40(%rsp),%rbp
push   %rbp
lea    0x30(%rsp),%rbp
push   %rbp
lea    0x40(%rsp),%rbp
push   %rbp
lea    0x1c(%rsp),%rbp
push   %rbp
lea    0x28(%rsp),%rbp
push   %rbp
push   %rax
call   1090 <XGetWindowProperty@plt>
add    $0x30,%rsp
mov    0x2ccb(%rip),%rcx
cmp    (%rcx),%rax
jne    1450 <ToonGetRootWindow+0x2e0>
cmpq   $0x0,0x40(%rsp)
je     1450 <ToonGetRootWindow+0x2e0>
mov    (%r12),%edx
mov    %rbx,%rdi
lea    0xceb(%rip),%rsi
call   1060 <XInternAtom@plt>
mov    (%r12),%r9d
mov    0x2c80(%rip),%rcx
mov    (%rcx),%ebp
mov    %rbx,%rdi
mov    0x10(%rsp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
mov    $0x1,%r8d
lea    0x70(%rsp),%rax
push   %rax
lea    0x30(%rsp),%rax
push   %rax
lea    0x40(%rsp),%rax
push   %rax
lea    0x1c(%rsp),%rax
push   %rax
lea    0x28(%rsp),%rax
push   %rax
push   %rbp
call   1090 <XGetWindowProperty@plt>
add    $0x30,%rsp
mov    0x2c55(%rip),%rcx
cmp    (%rcx),%rax
jne    1490 <ToonGetRootWindow+0x320>
cmpq   $0x0,0x70(%rsp)
je     1490 <ToonGetRootWindow+0x320>
movq   $0x0,0x68(%rsp)
mov    (%r12),%edx
mov    %rbx,%rdi
lea    0xc7b(%rip),%rsi
call   1060 <XInternAtom@plt>
mov    %eax,%ebp
mov    0x70(%rsp),%rdi
call   1050 <XFree@plt>
mov    (%r12),%r9d
mov    0x2bdd(%rip),%rax
mov    (%rax),%eax
mov    %rbx,%rdi
mov    0x10(%rsp),%rsi
mov    %ebp,%edx
xor    %ecx,%ecx
mov    $0x1,%r8d
lea    0x68(%rsp),%rbp
push   %rbp
lea    0x30(%rsp),%rbp
push   %rbp
lea    0x40(%rsp),%rbp
push   %rbp
lea    0x1c(%rsp),%rbp
push   %rbp
lea    0x28(%rsp),%rbp
push   %rbp
push   %rax
call   1090 <XGetWindowProperty@plt>
add    $0x30,%rsp
mov    0x2bca(%rip),%rcx
cmp    (%rcx),%rax
jne    1479 <ToonGetRootWindow+0x309>
mov    0x68(%rsp),%rdi
test   %rdi,%rdi
je     1479 <ToonGetRootWindow+0x309>
call   1050 <XFree@plt>
jmp    1490 <ToonGetRootWindow+0x320>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x18(%rsp),%rax
mov    -0x8(%rax,%r13,8),%rdx
mov    %rbx,%rdi
mov    0x3c(%rsp),%esi
mov    0x5c(%rsp),%ecx
lea    0xbf1(%rip),%r8
xor    %r9d,%r9d
call   1070 <__ToonGetKDEDesktop@plt>
mov    %rax,%r15
jmp    14a5 <ToonGetRootWindow+0x335>
mov    0x40(%rsp),%rdi
mov    (%rdi),%r15
test   %r15,%r15
jne    14a0 <ToonGetRootWindow+0x330>
cs nopw 0x0(%rax,%rax,1)
mov    0x40(%rsp),%rdi
mov    (%rdi),%r15
mov    0x60(%rsp),%rax
mov    %r15,(%rax)
call   1050 <XFree@plt>
mov    0xc(%rsp),%eax
cmp    %rax,%r13
jae    14bb <ToonGetRootWindow+0x34b>
add    $0x1,%r13
test   %r15,%r15
je     12d0 <ToonGetRootWindow+0x160>
mov    0x18(%rsp),%rdi
call   1050 <XFree@plt>
test   %r15,%r15
jne    16f8 <ToonGetRootWindow+0x588>
jmp    14da <ToonGetRootWindow+0x36a>
mov    0x18(%rsp),%rdi
call   1050 <XFree@plt>
mov    (%r12),%edx
lea    0xb94(%rip),%rsi
mov    %rbx,%rdi
call   1060 <XInternAtom@plt>
mov    (%r12),%r9d
mov    0x2ac8(%rip),%rcx
mov    (%rcx),%ebp
lea    0x20(%rsp),%r10
mov    %rbx,%rdi
mov    0x10(%rsp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
mov    $0x1,%r8d
push   %r10
lea    0x30(%rsp),%rax
push   %rax
lea    0x40(%rsp),%rax
push   %rax
lea    0x1c(%rsp),%rax
push   %rax
lea    0x28(%rsp),%rax
push   %rax
push   %rbp
call   1090 <XGetWindowProperty@plt>
add    $0x30,%rsp
mov    0x2abc(%rip),%rcx
cmp    (%rcx),%rax
jne    16f3 <ToonGetRootWindow+0x583>
cmpq   $0x0,0x20(%rsp)
je     16f3 <ToonGetRootWindow+0x583>
mov    (%r12),%edx
lea    0xb2c(%rip),%rsi
mov    %rbx,%rdi
call   1060 <XInternAtom@plt>
mov    %eax,%r13d
mov    (%r12),%r9d
mov    0x2a4e(%rip),%rax
mov    (%rax),%ebp
lea    0x48(%rsp),%rax
mov    %rbx,%rdi
mov    0x10(%rsp),%rsi
mov    %r13d,%edx
xor    %ecx,%ecx
mov    $0x1,%r8d
push   %rax
lea    0x30(%rsp),%rax
push   %rax
lea    0x40(%rsp),%rax
push   %rax
lea    0x1c(%rsp),%rax
push   %rax
lea    0x28(%rsp),%rax
push   %rax
push   %rbp
call   1090 <XGetWindowProperty@plt>
add    $0x30,%rsp
mov    0x2a42(%rip),%rcx
cmp    (%rcx),%rax
jne    15e1 <ToonGetRootWindow+0x471>
mov    0x48(%rsp),%rdi
test   %rdi,%rdi
je     15e1 <ToonGetRootWindow+0x471>
mov    (%rdi),%rax
mov    0x20(%rsp),%rcx
cmp    (%rcx),%rax
jne    15e1 <ToonGetRootWindow+0x471>
call   1050 <XFree@plt>
mov    0x10(%rsp),%r15
jmp    16e4 <ToonGetRootWindow+0x574>
lea    0x80(%rsp),%rdx
lea    0x78(%rsp),%rcx
lea    0x18(%rsp),%r8
lea    0xc(%rsp),%r9
mov    %rbx,%rdi
mov    0x10(%rsp),%rsi
call   1040 <XQueryTree@plt>
test   %rax,%rax
je     16cb <ToonGetRootWindow+0x55b>
cmpl   $0x0,0xc(%rsp)
je     16d7 <ToonGetRootWindow+0x567>
xor    %r14d,%r14d
xor    %r15d,%r15d
jmp    1641 <ToonGetRootWindow+0x4d1>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%r14
mov    0xc(%rsp),%eax
cmp    %rax,%r14
jae    16da <ToonGetRootWindow+0x56a>
mov    0x18(%rsp),%rax
mov    (%rax,%r14,8),%rsi
mov    (%r12),%r9d
mov    0x296b(%rip),%rax
mov    (%rax),%eax
mov    %rbx,%rdi
mov    %r13d,%edx
xor    %ecx,%ecx
mov    $0x1,%r8d
lea    0x48(%rsp),%rbp
push   %rbp
lea    0x30(%rsp),%rbp
push   %rbp
lea    0x40(%rsp),%rbp
push   %rbp
lea    0x1c(%rsp),%rbp
push   %rbp
lea    0x28(%rsp),%rbp
push   %rbp
push   %rax
call   1090 <XGetWindowProperty@plt>
add    $0x30,%rsp
mov    0x2964(%rip),%rcx
cmp    (%rcx),%rax
jne    1630 <ToonGetRootWindow+0x4c0>
mov    0x48(%rsp),%rdi
test   %rdi,%rdi
je     1630 <ToonGetRootWindow+0x4c0>
mov    (%rdi),%rax
mov    0x20(%rsp),%rcx
cmp    (%rcx),%rax
jne    1630 <ToonGetRootWindow+0x4c0>
mov    0x18(%rsp),%rax
mov    (%rax,%r14,8),%r15
mov    0x60(%rsp),%rax
mov    %r15,(%rax)
call   1050 <XFree@plt>
jmp    1630 <ToonGetRootWindow+0x4c0>
mov    0x20(%rsp),%rdi
call   1050 <XFree@plt>
jmp    16f3 <ToonGetRootWindow+0x583>
xor    %r15d,%r15d
mov    0x18(%rsp),%rdi
call   1050 <XFree@plt>
mov    0x20(%rsp),%rdi
call   1050 <XFree@plt>
test   %r15,%r15
jne    16f8 <ToonGetRootWindow+0x588>
mov    0x10(%rsp),%r15
mov    %r15,%rax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [27 x i8] c"NAUTILUS_DESKTOP_WINDOW_ID\00"
@False = global i32 0
@XA_WINDOW = global i32 0
@Success = global i64 0
@.str.1 = [20 x i8] c"_NET_WM_WINDOW_TYPE\00"
@.str.2 = [12 x i8] c"__SWM_VROOT\00"
@.str.3 = [15 x i8] c"_NET_SUPPORTED\00"
@XA_ATOM = global i32 0
@.str.4 = [19 x i8] c"_NET_VIRTUAL_ROOTS\00"
@.str.5 = [28 x i8] c"_NET_WM_WINDOW_TYPE_DESKTOP\00"
@.str.6 = [15 x i8] c"_WIN_WORKSPACE\00"
@XA_CARDINAL = global i32 0
@.str.7 = [22 x i8] c"ENLIGHTENMENT_DESKTOP\00"
define i64 @ToonGetRootWindow(i32* %0, i32 %1, i64* %2) {
%4 = alloca i64
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i64*
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64*
%13 = alloca i64*
%14 = alloca i32
%15 = alloca i64
%16 = alloca i64
%17 = alloca i32
%18 = alloca i32
%19 = alloca i64*
%20 = alloca i64*
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i64*
%26 = alloca i32
%27 = alloca i32*
%28 = alloca i64*
%29 = alloca i32
%30 = alloca i32
%31 = alloca i32
%32 = alloca i32
store i32* %0, i32** %5
store i32 %1, i32* %6
store i64* %2, i64** %7
store i64 0, i64* %8
%33 = load i32*, i32** %5
%34 = load i32, i32* %6
%35 = call i64 @RootWindow(i32* %33, i32 %34)
store i64 %35, i64* %9
store i64* null, i64** %13
store i64* null, i64** %19
store i64* null, i64** %20
%36 = load i32*, i32** %5
%37 = load i32, i32* @False
%38 = call i32 @XInternAtom(i32* %36, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %37)
store i32 %38, i32* %21
%39 = load i64, i64* %9
%40 = load i64*, i64** %7
store i64 %39, i64* %40
%41 = load i32*, i32** %5
%42 = load i64, i64* %9
%43 = load i32, i32* %21
%44 = load i32, i32* @False
%45 = load i32, i32* @XA_WINDOW
%46 = bitcast i64** %13 to i8**
%47 = call i64 @XGetWindowProperty(i32* %41, i64 %42, i32 %43, i32 0, i32 1, i32 %44, i32 %45, i32* %17, i32* %18, i64* %15, i64* %16, i8** %46)
%48 = load i64, i64* @Success
%49 = icmp eq i64 %47, %48
br i1 %49, label %50, label %66
50: ; preds = %3
%51 = load i64*, i64** %13
%52 = icmp ne i64* %51, null
br i1 %52, label %53, label %66
53: ; preds = %50
%54 = load i32*, i32** %5
%55 = load i32, i32* %6
%56 = load i64*, i64** %13
%57 = load i64, i64* %56
%58 = call i64 @__ToonGetNautilusDesktop(i32* %54, i32 %55, i64 %57, i32 0)
store i64 %58, i64* %8
%59 = load i64*, i64** %13
%60 = bitcast i64* %59 to i8*
%61 = call i32 @XFree(i8* %60)
%62 = load i64, i64* %8
%63 = icmp ne i64 %62, 0
br i1 %63, label %64, label %65
64: ; preds = %53
br label %65
65: ; preds = %64, %53
br label %66
66: ; preds = %65, %50, %3
%67 = load i64, i64* %8
%68 = icmp ne i64 %67, 0
br i1 %68, label %187, label %69
69: ; preds = %66
%70 = load i32*, i32** %5
%71 = load i64, i64* %9
%72 = call i64 @XQueryTree(i32* %70, i64 %71, i64* %10, i64* %11, i64** %12, i32* %14)
%73 = icmp ne i64 %72, 0
br i1 %73, label %74, label %187
74: ; preds = %69
%75 = load i32*, i32** %5
%76 = load i32, i32* @False
%77 = call i32 @XInternAtom(i32* %75, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %76)
store i32 %77, i32* %23
%78 = load i32*, i32** %5
%79 = load i32, i32* @False
%80 = call i32 @XInternAtom(i32* %78, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %79)
store i32 %80, i32* %24
store i32 0, i32* %22
br label %81
81: ; preds = %180, %74
%82 = load i32, i32* %22
%83 = load i32, i32* %14
%84 = icmp ult i32 %82, %83
br i1 %84, label %85, label %89
85: ; preds = %81
%86 = load i64, i64* %8
%87 = icmp ne i64 %86, 0
%88 = xor i1 %87, true
br label %89
89: ; preds = %85, %81
%90 = phi i1 [ false, %81 ], [ %88, %85 ]
br i1 %90, label %91, label %183
91: ; preds = %89
store i64* null, i64** %25
%92 = load i32*, i32** %5
%93 = load i64*, i64** %12
%94 = load i32, i32* %22
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds i64, i64* %93, i64 %95
%97 = load i64, i64* %96
%98 = load i32, i32* %24
%99 = load i32, i32* @False
%100 = load i32, i32* @XA_WINDOW
%101 = bitcast i64** %25 to i8**
%102 = call i64 @XGetWindowProperty(i32* %92, i64 %97, i32 %98, i32 0, i32 1, i32 %99, i32 %100, i32* %17, i32* %18, i64* %15, i64* %16, i8** %101)
%103 = load i64, i64* @Success
%104 = icmp eq i64 %102, %103
br i1 %104, label %105, label %166
105: ; preds = %91
%106 = load i64*, i64** %25
%107 = icmp ne i64* %106, null
br i1 %107, label %108, label %166
108: ; preds = %105
%109 = load i32*, i32** %5
%110 = load i32, i32* @False
%111 = call i32 @XInternAtom(i32* %109, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 %110)
store i32 %111, i32* %26
%112 = load i32*, i32** %5
%113 = load i64, i64* %9
%114 = load i32, i32* %26
%115 = load i32, i32* @False
%116 = load i32, i32* @XA_ATOM
%117 = bitcast i32** %27 to i8**
%118 = call i64 @XGetWindowProperty(i32* %112, i64 %113, i32 %114, i32 0, i32 1, i32 %115, i32 %116, i32* %17, i32* %18, i64* %15, i64* %16, i8** %117)
%119 = load i64, i64* @Success
%120 = icmp eq i64 %118, %119
br i1 %120, label %121, label %155
121: ; preds = %108
%122 = load i32*, i32** %27
%123 = icmp ne i32* %122, null
br i1 %123, label %124, label %155
124: ; preds = %121
store i64* null, i64** %28
%125 = load i32*, i32** %5
%126 = load i32, i32* @False
%127 = call i32 @XInternAtom(i32* %125, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %126)
store i32 %127, i32* %29
%128 = load i32*, i32** %27
%129 = bitcast i32* %128 to i8*
%130 = call i32 @XFree(i8* %129)
%131 = load i32*, i32** %5
%132 = load i64, i64* %9
%133 = load i32, i32* %29
%134 = load i32, i32* @False
%135 = load i32, i32* @XA_WINDOW
%136 = bitcast i64** %28 to i8**
%137 = call i64 @XGetWindowProperty(i32* %131, i64 %132, i32 %133, i32 0, i32 1, i32 %134, i32 %135, i32* %17, i32* %18, i64* %15, i64* %16, i8** %136)
%138 = load i64, i64* @Success
%139 = icmp ne i64 %137, %138
br i1 %139, label %143, label %140
140: ; preds = %124
%141 = load i64*, i64** %28
%142 = icmp ne i64* %141, null
br i1 %142, label %146, label %143
143: ; preds = %140, %124
%144 = load i64*, i64** %25
%145 = load i64, i64* %144
store i64 %145, i64* %8
br label %154
146: ; preds = %140
%147 = load i64*, i64** %28
%148 = icmp ne i64* %147, null
br i1 %148, label %149, label %153
149: ; preds = %146
%150 = load i64*, i64** %28
%151 = bitcast i64* %150 to i8*
%152 = call i32 @XFree(i8* %151)
br label %153
153: ; preds = %149, %146
br label %154
154: ; preds = %153, %143
br label %155
155: ; preds = %154, %121, %108
%156 = load i64, i64* %8
%157 = icmp ne i64 %156, 0
br i1 %157, label %162, label %158
158: ; preds = %155
%159 = load i64*, i64** %25
%160 = load i64, i64* %159
%161 = load i64*, i64** %7
store i64 %160, i64* %161
store i64 %160, i64* %8
br label %162
162: ; preds = %158, %155
%163 = load i64*, i64** %25
%164 = bitcast i64* %163 to i8*
%165 = call i32 @XFree(i8* %164)
br label %179
166: ; preds = %105, %91
%167 = load i32*, i32** %5
%168 = load i32, i32* %6
%169 = load i64*, i64** %12
%170 = load i32, i32* %22
%171 = sext i32 %170 to i64
%172 = getelementptr inbounds i64, i64* %169, i64 %171
%173 = load i64, i64* %172
%174 = load i32, i32* %23
%175 = call i64 @__ToonGetKDEDesktop(i32* %167, i32 %168, i64 %173, i32 %174, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i32 0)
store i64 %175, i64* %8
%176 = icmp ne i64 %175, 0
br i1 %176, label %177, label %178
177: ; preds = %166
br label %178
178: ; preds = %177, %166
br label %179
179: ; preds = %178, %162
br label %180
180: ; preds = %179
%181 = load i32, i32* %22
%182 = add nsw i32 %181, 1
store i32 %182, i32* %22
br label %81
183: ; preds = %89
%184 = load i64*, i64** %12
%185 = bitcast i64* %184 to i8*
%186 = call i32 @XFree(i8* %185)
br label %187
187: ; preds = %183, %69, %66
%188 = load i64, i64* %8
%189 = icmp ne i64 %188, 0
br i1 %189, label %290, label %190
190: ; preds = %187
%191 = load i32*, i32** %5
%192 = load i32, i32* @False
%193 = call i32 @XInternAtom(i32* %191, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i32 %192)
store i32 %193, i32* %30
%194 = load i32*, i32** %5
%195 = load i64, i64* %9
%196 = load i32, i32* %30
%197 = load i32, i32* @False
%198 = load i32, i32* @XA_CARDINAL
%199 = bitcast i64** %19 to i8**
%200 = call i64 @XGetWindowProperty(i32* %194, i64 %195, i32 %196, i32 0, i32 1, i32 %197, i32 %198, i32* %17, i32* %18, i64* %15, i64* %16, i8** %199)
%201 = load i64, i64* @Success
%202 = icmp eq i64 %200, %201
br i1 %202, label %203, label %289
203: ; preds = %190
%204 = load i64*, i64** %19
%205 = icmp ne i64* %204, null
br i1 %205, label %206, label %289
206: ; preds = %203
%207 = load i32*, i32** %5
%208 = load i32, i32* @False
%209 = call i32 @XInternAtom(i32* %207, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), i32 %208)
store i32 %209, i32* %31
%210 = load i32*, i32** %5
%211 = load i64, i64* %9
%212 = load i32, i32* %31
%213 = load i32, i32* @False
%214 = load i32, i32* @XA_CARDINAL
%215 = bitcast i64** %20 to i8**
%216 = call i64 @XGetWindowProperty(i32* %210, i64 %211, i32 %212, i32 0, i32 1, i32 %213, i32 %214, i32* %17, i32* %18, i64* %15, i64* %16, i8** %215)
%217 = load i64, i64* @Success
%218 = icmp eq i64 %216, %217
br i1 %218, label %219, label %233
219: ; preds = %206
%220 = load i64*, i64** %20
%221 = icmp ne i64* %220, null
br i1 %221, label %222, label %233
222: ; preds = %219
%223 = load i64*, i64** %20
%224 = load i64, i64* %223
%225 = load i64*, i64** %19
%226 = load i64, i64* %225
%227 = icmp eq i64 %224, %226
br i1 %227, label %228, label %233
228: ; preds = %222
%229 = load i64, i64* %9
store i64 %229, i64* %8
%230 = load i64*, i64** %20
%231 = bitcast i64* %230 to i8*
%232 = call i32 @XFree(i8* %231)
br label %285
233: ; preds = %222, %219, %206
%234 = load i32*, i32** %5
%235 = load i64, i64* %9
%236 = call i64 @XQueryTree(i32* %234, i64 %235, i64* %10, i64* %11, i64** %12, i32* %14)
%237 = icmp ne i64 %236, 0
br i1 %237, label %238, label %284
238: ; preds = %233
store i32 0, i32* %32
br label %239
239: ; preds = %277, %238
%240 = load i32, i32* %32
%241 = load i32, i32* %14
%242 = icmp ult i32 %240, %241
br i1 %242, label %243, label %280
243: ; preds = %239
%244 = load i32*, i32** %5
%245 = load i64*, i64** %12
%246 = load i32, i32* %32
%247 = sext i32 %246 to i64
%248 = getelementptr inbounds i64, i64* %245, i64 %247
%249 = load i64, i64* %248
%250 = load i32, i32* %31
%251 = load i32, i32* @False
%252 = load i32, i32* @XA_CARDINAL
%253 = bitcast i64** %20 to i8**
%254 = call i64 @XGetWindowProperty(i32* %244, i64 %249, i32 %250, i32 0, i32 1, i32 %251, i32 %252, i32* %17, i32* %18, i64* %15, i64* %16, i8** %253)
%255 = load i64, i64* @Success
%256 = icmp eq i64 %254, %255
br i1 %256, label %257, label %276
257: ; preds = %243
%258 = load i64*, i64** %20
%259 = icmp ne i64* %258, null
br i1 %259, label %260, label %276
260: ; preds = %257
%261 = load i64*, i64** %20
%262 = load i64, i64* %261
%263 = load i64*, i64** %19
%264 = load i64, i64* %263
%265 = icmp eq i64 %262, %264
br i1 %265, label %266, label %276
266: ; preds = %260
%267 = load i64*, i64** %12
%268 = load i32, i32* %32
%269 = sext i32 %268 to i64
%270 = getelementptr inbounds i64, i64* %267, i64 %269
%271 = load i64, i64* %270
%272 = load i64*, i64** %7
store i64 %271, i64* %272
store i64 %271, i64* %8
%273 = load i64*, i64** %20
%274 = bitcast i64* %273 to i8*
%275 = call i32 @XFree(i8* %274)
br label %276
276: ; preds = %266, %260, %257, %243
br label %277
277: ; preds = %276
%278 = load i32, i32* %32
%279 = add nsw i32 %278, 1
store i32 %279, i32* %32
br label %239
280: ; preds = %239
%281 = load i64*, i64** %12
%282 = bitcast i64* %281 to i8*
%283 = call i32 @XFree(i8* %282)
br label %284
284: ; preds = %280, %233
br label %285
285: ; preds = %284, %228
%286 = load i64*, i64** %19
%287 = bitcast i64* %286 to i8*
%288 = call i32 @XFree(i8* %287)
br label %289
289: ; preds = %285, %203, %190
br label %290
290: ; preds = %289, %187
%291 = load i64, i64* %8
%292 = icmp ne i64 %291, 0
br i1 %292, label %293, label %295
293: ; preds = %290
%294 = load i64, i64* %8
store i64 %294, i64* %4
br label %297
295: ; preds = %290
%296 = load i64, i64* %9
store i64 %296, i64* %4
br label %297
297: ; preds = %295, %293
%298 = load i64, i64* %4
ret i64 %298
}

LLVM IR (-O2):
@.str = [27 x i8] c"NAUTILUS_DESKTOP_WINDOW_ID\00"
@False = global i32 0
@XA_WINDOW = global i32 0
@Success = global i64 0
@.str.1 = [20 x i8] c"_NET_WM_WINDOW_TYPE\00"
@.str.2 = [12 x i8] c"__SWM_VROOT\00"
@.str.3 = [15 x i8] c"_NET_SUPPORTED\00"
@XA_ATOM = global i32 0
@.str.4 = [19 x i8] c"_NET_VIRTUAL_ROOTS\00"
@.str.5 = [28 x i8] c"_NET_WM_WINDOW_TYPE_DESKTOP\00"
@.str.6 = [15 x i8] c"_WIN_WORKSPACE\00"
@XA_CARDINAL = global i32 0
@.str.7 = [22 x i8] c"ENLIGHTENMENT_DESKTOP\00"
define i64 @ToonGetRootWindow(i32* %0, i32 %1, i64* nocapture writeonly %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64*
%7 = alloca i64*
%8 = alloca i32
%9 = alloca i64
%10 = alloca i64
%11 = alloca i32
%12 = alloca i32
%13 = alloca i64*
%14 = alloca i64*
%15 = alloca i64*
%16 = alloca i32*
%17 = alloca i64*
%18 = tail call i64 @RootWindow(i32* %0, i32 %1)
%19 = bitcast i64* %4 to i8*
%20 = bitcast i64* %5 to i8*
%21 = bitcast i64** %6 to i8*
%22 = bitcast i64** %7 to i8*
store i64* null, i64** %7
%23 = bitcast i32* %8 to i8*
%24 = bitcast i64* %9 to i8*
%25 = bitcast i64* %10 to i8*
%26 = bitcast i32* %11 to i8*
%27 = bitcast i32* %12 to i8*
%28 = bitcast i64** %13 to i8*
store i64* null, i64** %13
%29 = bitcast i64** %14 to i8*
store i64* null, i64** %14
%30 = load i32, i32* @False
%31 = tail call i32 @XInternAtom(i32* %0, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %30)
store i64 %18, i64* %2
%32 = load i32, i32* @False
%33 = load i32, i32* @XA_WINDOW
%34 = bitcast i64** %7 to i8**
%35 = call i64 @XGetWindowProperty(i32* %0, i64 %18, i32 %31, i32 0, i32 1, i32 %32, i32 %33, i32* %11, i32* %12, i64* %9, i64* %10, i8** %34)
%36 = load i64, i64* @Success
%37 = icmp eq i64 %35, %36
%38 = load i64*, i64** %7
%39 = icmp ne i64* %38, null
%40 = select i1 %37, i1 %39, i1 false
br i1 %40, label %41, label %47
41: ; preds = %3
%42 = load i64, i64* %38
%43 = call i64 @__ToonGetNautilusDesktop(i32* %0, i32 %1, i64 %42, i32 0)
%44 = load i8*, i8** %34
%45 = call i32 @XFree(i8* %44)
%46 = icmp eq i64 %43, 0
br i1 %46, label %47, label %221
47: ; preds = %3, %41
%48 = call i64 @XQueryTree(i32* %0, i64 %18, i64* %4, i64* %5, i64** %6, i32* %8)
%49 = icmp eq i64 %48, 0
br i1 %49, label %138, label %50
50: ; preds = %47
%51 = load i32, i32* @False
%52 = call i32 @XInternAtom(i32* %0, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %51)
%53 = load i32, i32* @False
%54 = call i32 @XInternAtom(i32* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %53)
%55 = load i32, i32* %8
%56 = icmp eq i32 %55, 0
br i1 %56, label %57, label %61
57: ; preds = %50
%58 = bitcast i64** %6 to i8**
%59 = load i8*, i8** %58
%60 = call i32 @XFree(i8* %59)
br label %138
61: ; preds = %50
%62 = bitcast i64** %15 to i8*
%63 = bitcast i64** %15 to i8**
%64 = bitcast i32** %16 to i8*
%65 = bitcast i32** %16 to i8**
%66 = bitcast i64** %17 to i8*
%67 = bitcast i64** %17 to i8**
br label %68
68: ; preds = %61, %125
%69 = phi i64 [ 0, %61 ], [ %127, %125 ]
store i64* null, i64** %15
%70 = load i64*, i64** %6
%71 = getelementptr inbounds i64, i64* %70, i64 %69
%72 = load i64, i64* %71
%73 = load i32, i32* @False
%74 = load i32, i32* @XA_WINDOW
%75 = call i64 @XGetWindowProperty(i32* %0, i64 %72, i32 %54, i32 0, i32 1, i32 %73, i32 %74, i32* %11, i32* %12, i64* %9, i64* %10, i8** %63)
%76 = load i64, i64* @Success
%77 = icmp eq i64 %75, %76
%78 = load i64*, i64** %15
%79 = icmp ne i64* %78, null
%80 = select i1 %77, i1 %79, i1 false
br i1 %80, label %81, label %120
81: ; preds = %68
%82 = load i32, i32* @False
%83 = call i32 @XInternAtom(i32* %0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 %82)
%84 = load i32, i32* @False
%85 = load i32, i32* @XA_ATOM
%86 = call i64 @XGetWindowProperty(i32* %0, i64 %18, i32 %83, i32 0, i32 1, i32 %84, i32 %85, i32* %11, i32* %12, i64* %9, i64* %10, i8** %65)
%87 = load i64, i64* @Success
%88 = icmp eq i64 %86, %87
%89 = load i32*, i32** %16
%90 = icmp ne i32* %89, null
%91 = select i1 %88, i1 %90, i1 false
br i1 %91, label %92, label %112
92: ; preds = %81
store i64* null, i64** %17
%93 = load i32, i32* @False
%94 = call i32 @XInternAtom(i32* %0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %93)
%95 = load i8*, i8** %65
%96 = call i32 @XFree(i8* %95)
%97 = load i32, i32* @False
%98 = load i32, i32* @XA_WINDOW
%99 = call i64 @XGetWindowProperty(i32* %0, i64 %18, i32 %94, i32 0, i32 1, i32 %97, i32 %98, i32* %11, i32* %12, i64* %9, i64* %10, i8** %67)
%100 = load i64, i64* @Success
%101 = icmp eq i64 %99, %100
%102 = load i64*, i64** %17
%103 = icmp ne i64* %102, null
%104 = select i1 %101, i1 %103, i1 false
br i1 %104, label %105, label %108
105: ; preds = %92
%106 = bitcast i64* %102 to i8*
%107 = call i32 @XFree(i8* %106)
br label %112
108: ; preds = %92
%109 = load i64*, i64** %15
%110 = load i64, i64* %109
%111 = icmp eq i64 %110, 0
br i1 %111, label %112, label %115
112: ; preds = %81, %105, %108
%113 = load i64*, i64** %15
%114 = load i64, i64* %113
store i64 %114, i64* %2
br label %115
115: ; preds = %112, %108
%116 = phi i64* [ %109, %108 ], [ %113, %112 ]
%117 = phi i64 [ %110, %108 ], [ %114, %112 ]
%118 = bitcast i64* %116 to i8*
%119 = call i32 @XFree(i8* %118)
br label %125
120: ; preds = %68
%121 = load i64*, i64** %6
%122 = getelementptr inbounds i64, i64* %121, i64 %69
%123 = load i64, i64* %122
%124 = call i64 @__ToonGetKDEDesktop(i32* %0, i32 %1, i64 %123, i32 %52, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i32 0)
br label %125
125: ; preds = %120, %115
%126 = phi i64 [ %117, %115 ], [ %124, %120 ]
%127 = add nuw nsw i64 %69, 1
%128 = load i32, i32* %8
%129 = zext i32 %128 to i64
%130 = icmp ult i64 %127, %129
%131 = icmp eq i64 %126, 0
%132 = select i1 %130, i1 %131, i1 false
br i1 %132, label %68, label %133
133: ; preds = %125
%134 = bitcast i64** %6 to i8**
%135 = load i8*, i8** %134
%136 = call i32 @XFree(i8* %135)
%137 = icmp eq i64 %126, 0
br i1 %137, label %138, label %221
138: ; preds = %57, %47, %133
%139 = load i32, i32* @False
%140 = call i32 @XInternAtom(i32* %0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i32 %139)
%141 = load i32, i32* @False
%142 = load i32, i32* @XA_CARDINAL
%143 = bitcast i64** %13 to i8**
%144 = call i64 @XGetWindowProperty(i32* %0, i64 %18, i32 %140, i32 0, i32 1, i32 %141, i32 %142, i32* %11, i32* %12, i64* %9, i64* %10, i8** %143)
%145 = load i64, i64* @Success
%146 = icmp eq i64 %144, %145
%147 = load i64*, i64** %13
%148 = icmp ne i64* %147, null
%149 = select i1 %146, i1 %148, i1 false
br i1 %149, label %150, label %220
150: ; preds = %138
%151 = load i32, i32* @False
%152 = call i32 @XInternAtom(i32* %0, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), i32 %151)
%153 = load i32, i32* @False
%154 = load i32, i32* @XA_CARDINAL
%155 = bitcast i64** %14 to i8**
%156 = call i64 @XGetWindowProperty(i32* %0, i64 %18, i32 %152, i32 0, i32 1, i32 %153, i32 %154, i32* %11, i32* %12, i64* %9, i64* %10, i8** %155)
%157 = load i64, i64* @Success
%158 = icmp eq i64 %156, %157
%159 = load i64*, i64** %14
%160 = icmp ne i64* %159, null
%161 = select i1 %158, i1 %160, i1 false
br i1 %161, label %162, label %170
162: ; preds = %150
%163 = load i64, i64* %159
%164 = load i64*, i64** %13
%165 = load i64, i64* %164
%166 = icmp eq i64 %163, %165
br i1 %166, label %167, label %170
167: ; preds = %162
%168 = bitcast i64* %159 to i8*
%169 = call i32 @XFree(i8* %168)
br label %215
170: ; preds = %162, %150
%171 = call i64 @XQueryTree(i32* %0, i64 %18, i64* %4, i64* %5, i64** %6, i32* %8)
%172 = icmp eq i64 %171, 0
br i1 %172, label %176, label %173
173: ; preds = %170
%174 = load i32, i32* %8
%175 = icmp eq i32 %174, 0
br i1 %175, label %210, label %179
176: ; preds = %170
%177 = load i8*, i8** %143
%178 = call i32 @XFree(i8* %177)
br label %220
179: ; preds = %173, %204
%180 = phi i64 [ %206, %204 ], [ 0, %173 ]
%181 = phi i64 [ %205, %204 ], [ 0, %173 ]
%182 = load i64*, i64** %6
%183 = getelementptr inbounds i64, i64* %182, i64 %180
%184 = load i64, i64* %183
%185 = load i32, i32* @False
%186 = load i32, i32* @XA_CARDINAL
%187 = call i64 @XGetWindowProperty(i32* %0, i64 %184, i32 %152, i32 0, i32 1, i32 %185, i32 %186, i32* %11, i32* %12, i64* %9, i64* %10, i8** %155)
%188 = load i64, i64* @Success
%189 = icmp eq i64 %187, %188
%190 = load i64*, i64** %14
%191 = icmp ne i64* %190, null
%192 = select i1 %189, i1 %191, i1 false
%193 = bitcast i64* %190 to i8*
br i1 %192, label %194, label %204
194: ; preds = %179
%195 = load i64, i64* %190
%196 = load i64*, i64** %13
%197 = load i64, i64* %196
%198 = icmp eq i64 %195, %197
br i1 %198, label %199, label %204
199: ; preds = %194
%200 = load i64*, i64** %6
%201 = getelementptr inbounds i64, i64* %200, i64 %180
%202 = load i64, i64* %201
store i64 %202, i64* %2
%203 = call i32 @XFree(i8* %193)
br label %204
204: ; preds = %179, %194, %199
%205 = phi i64 [ %202, %199 ], [ %181, %194 ], [ %181, %179 ]
%206 = add nuw nsw i64 %180, 1
%207 = load i32, i32* %8
%208 = zext i32 %207 to i64
%209 = icmp ult i64 %206, %208
br i1 %209, label %179, label %210
210: ; preds = %204, %173
%211 = phi i64 [ 0, %173 ], [ %205, %204 ]
%212 = bitcast i64** %6 to i8**
%213 = load i8*, i8** %212
%214 = call i32 @XFree(i8* %213)
br label %215
215: ; preds = %167, %210
%216 = phi i64 [ %18, %167 ], [ %211, %210 ]
%217 = load i8*, i8** %143
%218 = call i32 @XFree(i8* %217)
%219 = icmp eq i64 %216, 0
br i1 %219, label %220, label %221
220: ; preds = %138, %176, %215
br label %221
221: ; preds = %41, %133, %215, %220
%222 = phi i64 [ %18, %220 ], [ %216, %215 ], [ %126, %133 ], [ %43, %41 ]
ret i64 %222
}