// File: /workspace/github_c_makefile_star2_O3/Cloudef[P]dwm-fork/dwm.c
// Function: systray_acquire
Bool
systray_acquire(void) {
   XSetWindowAttributes wattr;

   if(!systray_enable || traywin) return False;

   if(XGetSelectionOwner(dpy, netatom[NetSystemTray]) != None) {
      fprintf(stderr, "Can't initialize system tray: owned by another process\n");
      return False;
   }

   // Init traywin window
   wattr.event_mask        = ButtonPressMask | ExposureMask;
   wattr.override_redirect = True;
   wattr.background_pixmap = ParentRelative;
   wattr.background_pixel  = dc.colors[0][ColBG];

   //traywin = XCreateSimpleWindow(dpy, root, 200, 100, 500, 500, 0, BlackPixel (dpy, 0), BlackPixel(dpy, 0));
   //traywin = XCreateSimpleWindow(dpy, root, 0, 0, 1, 1, 0, 0, dc.colors[0][ColBG]);
   traywin = XCreateWindow(dpy, root, 0, 0, 1, 1, 0, DefaultDepth(dpy, screen),
         CopyFromParent, DefaultVisual(dpy, screen),
         CWOverrideRedirect|CWBackPixmap|CWEventMask|CWBackPixel, &wattr);

   XSelectInput(dpy, traywin, KeyPressMask | ButtonPressMask);
   XMapRaised(dpy, traywin);

   XDefineCursor(dpy, traywin, cursor[CurNormal]);
   XSetSelectionOwner(dpy, netatom[NetSystemTray], traywin, CurrentTime);

   if(XGetSelectionOwner(dpy, netatom[NetSystemTray]) != traywin) {
      systray_freeicons();
      fprintf(stderr, "System tray: can't get systray manager\n");
      return False;
   }
   dwm_send_message(ROOT, ROOT, "MANAGER", CurrentTime, netatom[NetSystemTray], traywin, 0, 0);

   XSync(dpy, False);

   return True;
}

// Assembly:
cmpq $0x0, 0xcbcc(%rip)      # 0x13498
je 0x68cf
retq
pushq %r14
pushq %rbx
subq $0x78, %rsp
movq 0xcbab(%rip), %rdi      # 0x13488
movq 0xcbfc(%rip), %rsi      # 0x134e0
callq 0x5770
testq %rax, %rax
jne 0x6a36
leaq 0x8(%rsp), %rax
movq $0x8004, 0x48(%rax)     # imm = 0x8004
movl $0x1, 0x58(%rax)
movq $0x1, (%rax)
movq 0xcbfc(%rip), %rcx      # 0x13510
movq %rcx, 0x8(%rax)
movq 0xcb69(%rip), %rdi      # 0x13488
movq 0xcd2a(%rip), %rsi      # 0x13650
movq 0xe8(%rdi), %r10
movslq 0xcd34(%rip), %r11      # 0x13668
shlq $0x7, %r11
movl 0x38(%r10,%r11), %ebx
xorl %r14d, %r14d
xorl %edx, %edx
xorl %ecx, %ecx
movl $0x1, %r8d
movl $0x1, %r9d
pushq %rax
pushq $0xa03                  # imm = 0xA03
pushq 0x40(%r10,%r11)
pushq %r14
pushq %rbx
pushq %r14
callq 0x5230
addq $0x30, %rsp
movq %rax, 0xcb28(%rip)      # 0x13498
movq 0xcb11(%rip), %rdi      # 0x13488
movl $0x5, %edx
movq %rax, %rsi
callq 0x5490
movq 0xcafd(%rip), %rdi      # 0x13488
movq 0xcb06(%rip), %rsi      # 0x13498
callq 0x5710
movq 0xcaea(%rip), %rdi      # 0x13488
movq 0xcaf3(%rip), %rsi      # 0x13498
movq 0xccd4(%rip), %rdx      # 0x13680
callq 0x5590
movq 0xcad0(%rip), %rdi      # 0x13488
movq 0xcb21(%rip), %rsi      # 0x134e0
movq 0xcad2(%rip), %rdx      # 0x13498
xorl %ecx, %ecx
callq 0x54d0
movq 0xcab4(%rip), %rdi      # 0x13488
movq 0xcb05(%rip), %rsi      # 0x134e0
callq 0x5770
cmpq 0xcab1(%rip), %rax      # 0x13498
jne 0x6a3d
movq 0xca98(%rip), %rcx      # 0x13488
movq 0xe8(%rcx), %rdx
movslq 0xe0(%rcx), %rcx
shlq $0x7, %rcx
movq 0x10(%rdx,%rcx), %rdi
movq 0xcad2(%rip), %rcx      # 0x134e0
leaq 0x69dc(%rip), %rdx      # 0xd3f1
movq %rdi, %rsi
movq %rax, %r8
callq 0x859d
movq 0xca61(%rip), %rdi      # 0x13488
xorl %esi, %esi
callq 0x54c0
addq $0x78, %rsp
popq %rbx
popq %r14
retq
callq 0x582d
jmp 0x6a2e
callq 0x5849
jmp 0x6a2e