// File: /workspace/github_c_makefile_star2_O2/Cloudef[P]dwm-fork/dwm.c
// Function: drawtext
void
drawtext(const char *text, size_t col_index, Bool pad) {
   char buf[256];
   int i, p, x, y, h, len, olen;

   XRectangle r = { dc.x , dc.y, dc.w , dc.h };
   XSetForeground(dpy, dc.gc, dc.colors[col_index][ColBG]);
   XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);

   if(!text)
      return;

   olen = strlen(text);
   h    = pad ? (dc.font.ascent + dc.font.descent) : 0;
#ifndef XFT
   y    = dc.y + ((dc.h + dc.font.ascent - dc.font.descent) / 2);
#else
   y    = dc.y + dc.h - dc.font.height;
#endif
   x    = dc.x + (h / 2);

   /* shorten text if necessary */
   for(len = MIN(olen, sizeof buf); len && textnw(text, len) > dc.w; len--);
   if(!len)
      return;

   memcpy(buf, text, len);
   if(len < olen) {
      for(i = len - 1, p = 0; i; --i, ++p) {
         if(buf[i] & 0x80) { /* 10xxxxxx */
            if((buf[i] & 0x40) && (p >= 2)) { /* 11xxxxxx */
               buf[i] = '.';
               break;
            }
            buf[i] = '.';
         }
         else {
            buf[i] = '.';
            if(p == 2) break;
         }
      }
      ++p;
      if (p > 3)
         len -= p - 3;
   }

#ifdef XFT
   pango_layout_set_text(dc.plo, buf, len);
   pango_xft_render_layout(dc.xftdrawable, &dc.xftcolors[col_index][ColFG], dc.plo, x * PANGO_SCALE, y * PANGO_SCALE);
#else
   XSetForeground(dpy, dc.gc, dc.colors[col_index][ColFG]);
   if(dc.font.set)
      XmbDrawString(dpy, dc.drawable, dc.font.set, dc.gc, x, y, buf, len);
   else
      XDrawString(dpy, dc.drawable, dc.gc, x, y, buf, len);
#endif
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movl %edx, %r14d
movq %rdi, %r15
leaq 0xb418(%rip), %r12      # 0x134f0
pshuflw $0xe8, 0xb40f(%rip), %xmm0 # xmm0 = mem[0,2,2,3,4,5,6,7]
pshufhw $0xe8, %xmm0, %xmm0     # xmm0 = xmm0[0,1,2,3,4,6,6,7]
pshufd $0xe8, %xmm0, %xmm0     # xmm0 = xmm0[0,2,2,3]
leaq 0x8(%rsp), %rbx
movq %xmm0, (%rbx)
movq 0xb38d(%rip), %rdi      # 0x13488
movq 0xb526(%rip), %rax      # 0x13628
imulq $0x18, %rsi, %r13
movq 0x20(%r13,%r12), %rdx
movq %rax, %rsi
callq 0x5330
movq 0xb36e(%rip), %rdi      # 0x13488
movq 0xb4ff(%rip), %rsi      # 0x13620
movq 0xb500(%rip), %rdx      # 0x13628
pushq $0x1
popq %r8
movq %rbx, %rcx
callq 0x5310
testq %r15, %r15
je 0x8286
addq %r13, %r12
addq $0x10, %r12
movq %r15, %rdi
callq 0x52c0
movq %rax, %r13
movl 0xb4db(%rip), %ecx      # 0x13630
movl 0xb4d9(%rip), %esi      # 0x13634
leal (%rsi,%rcx), %eax
pushq $0x2
popq %rdi
cltd
idivl %edi
movl %eax, %ebx
subl %esi, %ecx
addl 0xb38e(%rip), %ecx      # 0x134fc
movl %ecx, %eax
cltd
idivl %edi
movl %eax, %ebp
addl 0xb379(%rip), %ebp      # 0x134f4
testl %r14d, %r14d
cmovel %r14d, %ebx
addl 0xb368(%rip), %ebx      # 0x134f0
movslq %r13d, %rax
movl $0x100, %r14d           # imm = 0x100
cmpq %r14, %rax
cmovbq %rax, %r14
testl %r14d, %r14d
je 0x8286
movq %r15, %rdi
movl %r14d, %esi
callq 0x8039
cmpl 0xb346(%rip), %eax      # 0x134f8
jle 0x81b9
decq %r14
jmp 0x8198
movslq %r14d, %rdx
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0x5760
cmpl %r13d, %r14d
jge 0x821c
leaq -0x1(%r14), %rcx
leaq 0xf(%rsp), %rdx
xorl %eax, %eax
cmpq %rax, %rcx
je 0x8210
movb (%rdx,%r14), %sil
testb %sil, %sil
js 0x81f3
movb $0x2e, (%rdx,%r14)
cmpl $0x2, %eax
jne 0x8208
jmp 0x821c
shrb $0x6, %sil
cmpl $0x2, %eax
setae %dil
movb $0x2e, (%rdx,%r14)
testb %dil, %sil
jne 0x8210
incq %rax
decq %rdx
jmp 0x81d9
cmpl $0x3, %eax
jb 0x821c
subl %eax, %r14d
addl $0x2, %r14d
movq 0xb265(%rip), %rdi      # 0x13488
movq 0xb3fe(%rip), %rsi      # 0x13628
movq 0x8(%r12), %rdx
callq 0x5330
movq 0xb405(%rip), %rdx      # 0x13640
movq 0xb246(%rip), %rdi      # 0x13488
movq 0xb3d7(%rip), %rsi      # 0x13620
movq 0xb3d8(%rip), %rcx      # 0x13628
testq %rdx, %rdx
je 0x826c
movl %ebx, %r8d
movl %ebp, %r9d
pushq %r14
leaq 0x18(%rsp), %rax
pushq %rax
callq 0x5580
popq %rax
popq %rcx
jmp 0x8286
subq $0x8, %rsp
leaq 0x18(%rsp), %r9
movq %rcx, %rdx
movl %ebx, %ecx
movl %ebp, %r8d
pushq %r14
callq 0x5030
popq %rcx
popq %rdx
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq