// File: /workspace/github_c_makefile_star2_O2/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:
subq $0xa8, %rsp
cmpq $0x0, 0xcd51(%rip)      # 0x13498
jne 0x68ad
movq 0xcd34(%rip), %rdi      # 0x13488
movq 0xcd85(%rip), %rsi      # 0x134e0
callq 0x5770
testq %rax, %rax
jne 0x68b5
leaq 0x38(%rsp), %rax
movq $0x8004, 0x48(%rax)     # imm = 0x8004
movl $0x1, 0x58(%rax)
movq $0x1, (%rax)
movq 0xcd85(%rip), %rcx      # 0x13510
movq %rcx, 0x8(%rax)
movq 0xccf2(%rip), %rdi      # 0x13488
movq 0xceb3(%rip), %rsi      # 0x13650
movq 0xe8(%rdi), %rcx
movslq 0xcebd(%rip), %rdx      # 0x13668
shlq $0x7, %rdx
movl 0x38(%rcx,%rdx), %r8d
movq 0x40(%rcx,%rdx), %rcx
movq %rax, 0x28(%rsp)
movq %rcx, 0x18(%rsp)
andl $0x0, 0x10(%rsp)
movl %r8d, 0x8(%rsp)
andl $0x0, (%rsp)
movq $0xa03, 0x20(%rsp)      # imm = 0xA03
pushq $0x1
popq %r8
xorl %edx, %edx
xorl %ecx, %ecx
movl %r8d, %r9d
callq 0x5230
movq %rax, 0xcca7(%rip)      # 0x13498
movq 0xcc90(%rip), %rdi      # 0x13488
pushq $0x5
popq %rdx
movq %rax, %rsi
callq 0x5490
movq 0xcc7e(%rip), %rdi      # 0x13488
movq 0xcc87(%rip), %rsi      # 0x13498
callq 0x5710
movq 0xcc6b(%rip), %rdi      # 0x13488
movq 0xcc74(%rip), %rsi      # 0x13498
movq 0xce55(%rip), %rdx      # 0x13680
callq 0x5590
movq 0xcc51(%rip), %rdi      # 0x13488
movq 0xcca2(%rip), %rsi      # 0x134e0
movq 0xcc53(%rip), %rdx      # 0x13498
xorl %ecx, %ecx
callq 0x54d0
movq 0xcc35(%rip), %rdi      # 0x13488
movq 0xcc86(%rip), %rsi      # 0x134e0
callq 0x5770
cmpq 0xcc32(%rip), %rax      # 0x13498
jne 0x68d8
movq 0xcc19(%rip), %rcx      # 0x13488
movq 0xe8(%rcx), %rdx
movslq 0xe0(%rcx), %rcx
shlq $0x7, %rcx
movq 0x10(%rdx,%rcx), %rdi
movq 0xcc53(%rip), %rcx      # 0x134e0
leaq 0x6b6d(%rip), %rdx      # 0xd401
movq %rdi, %rsi
movq %rax, %r8
callq 0x834c
movq 0xcbe2(%rip), %rdi      # 0x13488
xorl %esi, %esi
callq 0x54c0
addq $0xa8, %rsp
retq
movq 0xb72c(%rip), %rax      # 0x11fe8
movq (%rax), %rcx
leaq 0x6adb(%rip), %rdi      # 0xd3a1
pushq $0x37
popq %rsi
pushq $0x1
popq %rdx
addq $0xa8, %rsp
jmp 0x56c0
callq 0x82b9
movq 0xb704(%rip), %rax      # 0x11fe8
movq (%rax), %rcx
leaq 0x6aeb(%rip), %rdi      # 0xd3d9
pushq $0x27
popq %rsi
pushq $0x1
popq %rdx
callq 0x56c0
jmp 0x68ad