// File: /workspace/github_c_makefile_star2_O1/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 0xb1bd(%rip), %r15      # 0x134f0
movzwl 0xb1b6(%rip), %eax      # 0x134f0
leaq 0x18(%rsp), %rbx
movw %ax, (%rbx)
movzwl 0xb1ab(%rip), %eax      # 0x134f4
movw %ax, 0x2(%rbx)
movzwl 0xb1a4(%rip), %eax      # 0x134f8
movw %ax, 0x4(%rbx)
movzwl 0xb19d(%rip), %eax      # 0x134fc
movw %ax, 0x6(%rbx)
movq 0xb11e(%rip), %rdi      # 0x13488
movq 0xb2b7(%rip), %rax      # 0x13628
leaq (%rsi,%rsi,2), %r13
movq 0x20(%r15,%r13,8), %rdx
movq %rax, %rsi
callq 0x5330
movq 0xb0ff(%rip), %rdi      # 0x13488
movq 0xb290(%rip), %rsi      # 0x13620
movq 0xb291(%rip), %rdx      # 0x13628
movq %rbx, %rcx
movl $0x1, %r8d
callq 0x5310
testq %r14, %r14
je 0x8540
movq %r14, %rdi
callq 0x52c0
movq %rax, %r12
movl 0xb271(%rip), %eax      # 0x13630
movl 0xb26f(%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 0x8540
subl %ecx, %eax
addl 0xb10f(%rip), %eax      # 0x134fc
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
addl 0xb0f8(%rip), %ecx      # 0x134f4
movl %ecx, 0x4(%rsp)
addl 0xb0ea(%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, %ebp
xorl %r13d, %r13d
xorl %r15d, %r15d
leal (%r12,%r13), %esi
movq %r14, %rdi
callq 0x8277
cmpl 0xb0b8(%rip), %eax      # 0x134f8
jle 0x8455
incq %rbp
incq %r15
decq %r13
cmpl %r15d, %r12d
jne 0x842e
jmp 0x8540
movq %r12, %rdx
subq %r15, %rdx
leaq 0x20(%rsp), %rdi
movq %r14, %rsi
callq 0x5770
addq %r12, %r13
cmpl 0x10(%rsp), %r13d
jge 0x84ce
xorl %eax, %eax
cmpl %ebp, %r12d
je 0x84bc
movq %r12, %rcx
subq %rbp, %rcx
movslq %ecx, %rax
leaq (%rsp,%rax), %rdx
addq $0x20, %rdx
xorl %eax, %eax
movb (%rdx), %sil
testb %sil, %sil
js 0x849e
movb $0x2e, (%rdx)
cmpl $0x2, %eax
jne 0x84b1
jmp 0x84bc
shrb $0x6, %sil
cmpl $0x2, %eax
setae %dil
movb $0x2e, (%rdx)
testb %dil, %sil
jne 0x84bc
incl %eax
decq %rdx
cmpl %eax, %ecx
jne 0x848c
movl %ecx, %eax
cmpl $0x2, %eax
jbe 0x84ce
subl %eax, %r12d
subl %r15d, %r12d
addl $0x2, %r12d
movl %r12d, %r13d
movq 0xafb3(%rip), %rdi      # 0x13488
movq 0xb14c(%rip), %rsi      # 0x13628
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rdx
callq 0x5330
movq 0xb14f(%rip), %rdx      # 0x13640
movq 0xaf90(%rip), %rdi      # 0x13488
movq 0xb121(%rip), %rsi      # 0x13620
movq 0xb122(%rip), %rcx      # 0x13628
testq %rdx, %rdx
je 0x8522
movl %ebx, %r8d
movl 0x4(%rsp), %r9d
pushq %r13
leaq 0x28(%rsp), %rax
pushq %rax
callq 0x5590
jmp 0x853c
subq $0x8, %rsp
leaq 0x28(%rsp), %r9
movq %rcx, %rdx
movl %ebx, %ecx
movl 0xc(%rsp), %r8d
pushq %r13
callq 0x5030
addq $0x10, %rsp
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq