user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<paint_rval_text>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%r13
  mov    %esi,%ebx
  mov    %edx,%r12d
  mov    %ecx,0x4(%rsp)
  mov    %esi,%r14d
  shr    $0x3,%r14d
  and    $0x1,%r14d
  mov    %esi,%r15d
  and    $0x1,%r15d
  je     L23
  lea    0xb(%r8),%ebp
  and    $0x30,%ebx
  je     L26
L160:
  mov    %r12d,%edi
  mov    $0x0,%eax
  call   <cmalloc@plt>
  movslq %eax,%rsi
  mov    %rsi,0x8(%rsp)
  cmp    $0x10,%ebx
  je     L24
  cmp    $0x20,%ebx
  je     L88
L65:
  sub    $0x8,%rsp
  push   $0x1
  mov    %r14d,%r9d
  mov    %r15d,%r8d
  mov    %r12d,%ecx
  mov    %r13,%rdx
  mov    %ebp,%esi
  mov    0x14(%rsp),%edi
  mov    $0x0,%eax
  call   <omshell_terminaldrawimagestring@plt>
  add    $0x10,%rsp
  test   %r15d,%r15d
  jne    L36
L102:
  mov    0x8(%rsp),%rdi
  call   <free@plt>
L103:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L23:
  lea    0xb(%r8),%ebp
  and    $0x30,%ebx
  jne    L160
  sub    $0x8,%rsp
  push   $0x0
  mov    %r14d,%r9d
  mov    $0x0,%r8d
  mov    %edx,%ecx
  mov    %rdi,%rdx
  mov    %ebp,%esi
  mov    0x14(%rsp),%edi
  mov    $0x0,%eax
  call   <omshell_terminaldrawimagestring@plt>
  add    $0x10,%rsp
  jmp    L103
L24:
  test   %r12d,%r12d
  jle    L65
  mov    %r12d,%ecx
  add    %rsi,%rcx
  mov    %rsi,%rdx
  mov    %r13,%rdi
  sub    %rsi,%rdi
  mov    $0x1e,%esi
L159:
  movzbl (%rdi,%rdx,1),%eax
  cmp    $0x23,%al
  cmove  %esi,%eax
  mov    %al,(%rdx)
  add    $0x1,%rdx
  cmp    %rcx,%rdx
  jne    L159
  jmp    L65
L88:
  test   %r12d,%r12d
  jle    L65
  cltq
  mov    %r12d,%esi
  add    %rax,%rsi
  mov    %rax,%rdx
  mov    %r13,%rdi
  sub    %rax,%rdi
  jmp    L89
L100:
  mov    %al,(%rdx)
L136:
  add    $0x1,%rdx
  cmp    %rsi,%rdx
  je     L65
L89:
  movzbl (%rdi,%rdx,1),%eax
  lea    -0x60(%rax),%ecx
  cmp    $0x1e,%cl
  ja     L100
  and    $0x1f,%eax
  add    $0x1,%eax
  mov    %al,(%rdx)
  jmp    L136
L36:
  mov    0x4(%rsp),%edi
  add    $0x1,%edi
  sub    $0x8,%rsp
  push   $0x1
  mov    %r14d,%r9d
  mov    $0x1,%r8d
  mov    %r12d,%ecx
  mov    %r13,%rdx
  mov    %ebp,%esi
  mov    $0x0,%eax
  call   <omshell_terminaldrawimagestring@plt>
  add    $0x10,%rsp
  jmp    L102
L26:
  sub    $0x8,%rsp
  push   $0x0
  mov    %r14d,%r9d
  mov    $0x1,%r8d
  mov    %edx,%ecx
  mov    %rdi,%rdx
  mov    %ebp,%esi
  mov    0x14(%rsp),%ebx
  mov    %ebx,%edi
  mov    $0x0,%eax
  call   <omshell_terminaldrawimagestring@plt>
  mov    %ebx,%edi
  add    $0x1,%edi
  movl   $0x0,(%rsp)
  mov    %r14d,%r9d
  mov    $0x1,%r8d
  mov    %r12d,%ecx
  mov    %r13,%rdx
  mov    %ebp,%esi
  mov    $0x0,%eax
  call   <omshell_terminaldrawimagestring@plt>
  add    $0x10,%rsp
  jmp    L103
```

assistant: ```c
void paint_rval_text(str, rval, len, x, y) unsigned char *str;
int rval;
int len, x, y;
{
  unsigned char *buf;
  int overstrike;
  int i;
  int b = 0, inverso = 0;
  if (rval & 0x08) {
    inverso = 1;
  }
  overstrike = 0;
  if (rval & 0x01) {
    b = 1;
    if (0) {
      y += 11;
    } else {
      overstrike = 1;
      y += 11;
    }
  } else
    y += 11;
  if ((rval & 0x30) == 0x00) {
    omshell_terminaldrawimagestring(x, y, str, len, b, inverso, 0);
    if (overstrike) {
      omshell_terminaldrawimagestring(x + 1, y, str, len, b, inverso, 0);
    }
  } else {
    buf = (unsigned char *)cmalloc(len);
    if ((rval & 0x30) == 0x10) {
      for (i = 0; i < len; i++)
        buf[i] = (str[i] == '#') ? 036 : str[i];
    } else if ((rval & 0x30) == 0x20) {
      for (i = 0; i < len; i++)
        if (str[i] >= 0140 && str[i] <= 0176)
          buf[i] = (str[i] & 037) + 1;
        else
          buf[i] = str[i];
    }
    omshell_terminaldrawimagestring(x, y, str, len, b, inverso, 1);
    if (overstrike)
      omshell_terminaldrawimagestring(x + 1, y, str, len, b, inverso, 1);
    free((void *)buf);
  }
  y++;
  if (rval & 0x02) {
  }
  if (rval & 0x08) {
  }
  if (rval & 0x01) {
  }
}
```