// File: /workspace/github_c_makefile_star2_O1/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, 0xcb31(%rip)      # 0x13498
je 0x696a
retq
pushq %r14
pushq %rbx
subq $0x78, %rsp
movq 0xcb10(%rip), %rdi      # 0x13488
movq 0xcb61(%rip), %rsi      # 0x134e0
callq 0x5780
testq %rax, %rax
jne 0x6ad1
leaq 0x8(%rsp), %rax
movq $0x8004, 0x48(%rax)     # imm = 0x8004
movl $0x1, 0x58(%rax)
movq $0x1, (%rax)
movq 0xcb61(%rip), %rcx      # 0x13510
movq %rcx, 0x8(%rax)
movq 0xcace(%rip), %rdi      # 0x13488
movq 0xcc8f(%rip), %rsi      # 0x13650
movq 0xe8(%rdi), %r10
movslq 0xcc99(%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, 0xca8d(%rip)      # 0x13498
movq 0xca76(%rip), %rdi      # 0x13488
movl $0x5, %edx
movq %rax, %rsi
callq 0x5490
movq 0xca62(%rip), %rdi      # 0x13488
movq 0xca6b(%rip), %rsi      # 0x13498
callq 0x5720
movq 0xca4f(%rip), %rdi      # 0x13488
movq 0xca58(%rip), %rsi      # 0x13498
movq 0xcc39(%rip), %rdx      # 0x13680
callq 0x55a0
movq 0xca35(%rip), %rdi      # 0x13488
movq 0xca86(%rip), %rsi      # 0x134e0
movq 0xca37(%rip), %rdx      # 0x13498
xorl %ecx, %ecx
callq 0x54d0
movq 0xca19(%rip), %rdi      # 0x13488
movq 0xca6a(%rip), %rsi      # 0x134e0
callq 0x5780
movq 0xca16(%rip), %r8       # 0x13498
cmpq %r8, %rax
jne 0x6ad8
movq 0xc9fa(%rip), %rax      # 0x13488
movq 0xe8(%rax), %rcx
movslq 0xe0(%rax), %rax
shlq $0x7, %rax
movq 0x10(%rcx,%rax), %rdi
movq 0xca34(%rip), %rcx      # 0x134e0
leaq 0x6931(%rip), %rdx      # 0xd3e4
movq %rdi, %rsi
callq 0x85ef
movq 0xc9c6(%rip), %rdi      # 0x13488
xorl %esi, %esi
callq 0x54c0
addq $0x78, %rsp
popq %rbx
popq %r14
retq
callq 0x5889
jmp 0x6ac9
callq 0x58a5
jmp 0x6ac9