// File: /workspace/github_c_makefile_star2_O3/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 $0x128, %rsp            # imm = 0x128
movl %edx, %ebp
movq %rdi, %r14
leaq 0xb1ff(%rip), %r15      # 0x134f0
pshuflw $0xe8, 0xb1f6(%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 0x18(%rsp), %rbx
movq %xmm0, (%rbx)
movq 0xb174(%rip), %rdi      # 0x13488
movq 0xb30d(%rip), %rax      # 0x13628
leaq (%rsi,%rsi,2), %r13
movq 0x20(%r15,%r13,8), %rdx
movq %rax, %rsi
callq 0x5330
movq 0xb155(%rip), %rdi      # 0x13488
movq 0xb2e6(%rip), %rsi      # 0x13620
movq 0xb2e7(%rip), %rdx      # 0x13628
movq %rbx, %rcx
movl $0x1, %r8d
callq 0x5310
testq %r14, %r14
je 0x84ee
movq %r14, %rdi
callq 0x52c0
movq %rax, %r12
movl 0xb2c7(%rip), %eax      # 0x13630
movl 0xb2c5(%rip), %ecx      # 0x13634
leal (%rcx,%rax), %edx
movl %edx, %ebx
shrl $0x1f, %ebx
addl %edx, %ebx
sarl %ebx
testl %ebp, %ebp
cmovel %ebp, %ebx
movq %r12, 0x10(%rsp)
shlq $0x20, %r12
je 0x84ee
subl %ecx, %eax
addl 0xb165(%rip), %eax      # 0x134fc
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
addl 0xb14e(%rip), %ecx      # 0x134f4
movl %ecx, 0x4(%rsp)
addl 0xb140(%rip), %ebx      # 0x134f0
sarq $0x20, %r12
movl $0x100, %eax            # imm = 0x100
cmpq %rax, %r12
cmovaeq %rax, %r12
leaq (%r15,%r13,8), %rax
addq $0x10, %rax
movq %rax, 0x8(%rsp)
movl $0x1, %r15d
xorl %ebp, %ebp
xorl %r13d, %r13d
leal (%r12,%r13), %esi
movq %r14, %rdi
callq 0x8235
cmpl 0xb10e(%rip), %eax      # 0x134f8
jle 0x83ff
incq %r15
decq %r13
incq %rbp
cmpl %ebp, %r12d
jne 0x83d8
jmp 0x84ee
leaq (%r12,%r13), %rbp
leaq 0x20(%rsp), %rdi
movq %r14, %rsi
movq %rbp, %rdx
callq 0x5760
cmpl 0x10(%rsp), %ebp
jge 0x8479
movl $0x1, %r14d
cmpl %r15d, %r12d
je 0x847c
movq %r12, %rcx
subq %r15, %rcx
movslq %ecx, %rax
leaq (%rsp,%rax), %rdx
addq $0x20, %rdx
xorl %eax, %eax
movb (%rdx), %sil
testb %sil, %sil
js 0x8449
movb $0x2e, (%rdx)
cmpl $0x2, %eax
jne 0x845c
jmp 0x8479
shrb $0x6, %sil
cmpl $0x2, %eax
setae %dil
movb $0x2e, (%rdx)
testb %dil, %sil
jne 0x8467
incl %eax
decq %rdx
cmpl %eax, %ecx
jne 0x8437
movl %ecx, %eax
cmpl $0x2, %eax
jbe 0x8479
subl %eax, %r12d
leal (%r12,%r13), %r14d
addl $0x2, %r14d
jmp 0x847c
movl %ebp, %r14d
movq 0xb005(%rip), %rdi      # 0x13488
movq 0xb19e(%rip), %rsi      # 0x13628
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rdx
callq 0x5330
movq 0xb1a1(%rip), %rdx      # 0x13640
movq 0xafe2(%rip), %rdi      # 0x13488
movq 0xb173(%rip), %rsi      # 0x13620
movq 0xb174(%rip), %rcx      # 0x13628
testq %rdx, %rdx
je 0x84d0
movl %ebx, %r8d
movl 0x4(%rsp), %r9d
pushq %r14
leaq 0x28(%rsp), %rax
pushq %rax
callq 0x5580
jmp 0x84ea
subq $0x8, %rsp
leaq 0x28(%rsp), %r9
movq %rcx, %rdx
movl %ebx, %ecx
movl 0xc(%rsp), %r8d
pushq %r14
callq 0x5030
addq $0x10, %rsp
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq