user: Please show me the C implementation that matches the assembly code listed below:

```asm
<do_title_expn>:
  endbr64
  push   %r15
  xor    %r15d,%r15d
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x138,%rsp
  mov    %rcx,0x18(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x128(%rsp)
  xor    %eax,%eax
  lea    -0x1(%rsi),%eax
  movb   $0x0,(%rdi)
  mov    %eax,0x4(%rsp)
  mov    %eax,%r13d
  test   %eax,%eax
  jle    L468
L381:
  movzbl (%rbx),%eax
  test   %al,%al
  je     L468
L491:
  lea    0x1(%rbx),%r12
  cmp    $0x25,%al
  je     L186
  cmp    $0x5c,%al
  jne    L585
  test   %r15w,%r15w
  je     L439
L585:
  mov    0x4(%rsp),%edx
  sub    %r13d,%edx
  sub    $0x1,%r13d
  movslq %edx,%rdx
  mov    %al,0x0(%rbp,%rdx,1)
  movb   $0x0,0x1(%rbp,%rdx,1)
L154:
  mov    %r12,%rbx
  test   %r13d,%r13d
  jle    L468
  movzbl (%rbx),%eax
  xor    %r15d,%r15d
  test   %al,%al
  jne    L491
L468:
  xor    %eax,%eax
  test   %r13d,%r13d
  mov    0x4(%rsp),%ebx
  cmovns %r13d,%eax
  sub    %eax,%ebx
  movslq %ebx,%rbx
  movb   $0x0,0x0(%rbp,%rbx,1)
  mov    0x128(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L425
  add    $0x138,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L186:
  test   %r15w,%r15w
  jne    L585
  movsbl 0x1(%rbx),%edi
  test   %dil,%dil
  je     L617
  cmp    $0x28,%dil
  jne    L597
L629:
  movsbl 0x2(%rbx),%edi
  test   %dil,%dil
  je     L28
L584:
  mov    0x18(%rsp),%rsi
  call   <title_expn_subs@plt>
  movzbl 0x3(%rbx),%esi
  mov    %rax,%r11
  test   %sil,%sil
  je     L563
L155:
  cmpb   $0x0,0x4(%rbx)
  lea    0x4(%rbx),%r14
  je     L138
L328:
  xor    %ecx,%ecx
  lea    0x20(%rsp),%r12
  test   %r11,%r11
  jne    L323
  jmp    L493
  nopl   0x0(%rax,%rax,1)
L49:
  add    $0x1,%rcx
L323:
  movslq %ecx,%rax
  test   %r15w,%r15w
  jne    L556
  cmp    %sil,(%r14)
  je     L153
L556:
  cmp    $0xfe,%rcx
  je     L69
L137:
  movzbl (%r14),%eax
  xor    %r15d,%r15d
  cmp    $0x5c,%al
  mov    %al,(%r12,%rcx,1)
  sete   %r15b
  add    $0x1,%r14
  cmpb   $0x0,(%r14)
  jne    L49
  lea    D87(%rip),%rdi
  mov    %rcx,0x10(%rsp)
  mov    %sil,0x8(%rsp)
  call   <fatal@plt>
  mov    0x10(%rsp),%rcx
  movzbl 0x8(%rsp),%esi
  jmp    L49
  nopl   0x0(%rax,%rax,1)
L439:
  mov    $0x1,%r15d
L160:
  mov    %r12,%rbx
  jmp    L381
  xchg   %ax,%ax
L597:
  mov    0x18(%rsp),%rsi
  call   <title_expn_subs@plt>
  mov    %rax,%r14
  test   %rax,%rax
  je     L243
  lea    -0x1(%r13),%edx
  mov    %rax,%rsi
  mov    %rbp,%rdi
  add    $0x1,%r12
  call   <strncat@plt>
  mov    %r14,%rdi
  call   <strlen@plt>
  sub    %eax,%r13d
  jmp    L154
  nopl   0x0(%rax)
L617:
  lea    D87(%rip),%rdi
  call   <fatal@plt>
  movsbl 0x1(%rbx),%edi
  cmp    $0x28,%dil
  je     L629
  jmp    L597
  nopl   0x0(%rax)
L69:
  lea    D13(%rip),%rdi
  mov    %rcx,0x10(%rsp)
  mov    %sil,0x8(%rsp)
  call   <fatal@plt>
  mov    0x10(%rsp),%rcx
  movzbl 0x8(%rsp),%esi
  jmp    L137
  nopl   (%rax)
L153:
  mov    %r14,%rbx
  movb   $0x0,0x20(%rsp,%rax,1)
  lea    D87(%rip),%r14
  jmp    L371
  nopl   0x0(%rax)
L399:
  lea    0x1(%rbx),%r15
  test   %sil,%sil
  je     L566
L149:
  mov    %r15,%rbx
L371:
  cmp    $0x29,%sil
  je     L600
L414:
  cmpb   $0x5c,(%rbx)
  movzbl 0x1(%rbx),%esi
  jne    L399
  test   %sil,%sil
  je     L329
L42:
  movzbl 0x2(%rbx),%esi
  lea    0x2(%rbx),%r15
  test   %sil,%sil
  jne    L149
  mov    %r14,%rdi
  call   <fatal@plt>
  movzbl 0x2(%rbx),%esi
  jmp    L149
  nopl   0x0(%rax,%rax,1)
L566:
  mov    %r14,%rdi
  call   <fatal@plt>
  cmpb   $0x29,0x1(%rbx)
  mov    %r15,%rbx
  jne    L414
  nopl   0x0(%rax)
L600:
  movslq 0x4(%rsp),%r14
  movslq %r13d,%rax
  mov    0x18(%rsp),%rcx
  mov    %r12,%rdx
  mov    %r13d,%esi
  lea    0x1(%rbx),%r12
  sub    %rax,%r14
  add    %rbp,%r14
  mov    %r14,%rdi
  call   <do_title_expn>
  mov    %r14,%rdi
  call   <strlen@plt>
  sub    %eax,%r13d
  jmp    L154
  nopl   (%rax)
L329:
  mov    %r14,%rdi
  call   <fatal@plt>
  jmp    L42
  nopw   0x0(%rax,%rax,1)
L243:
  add    $0x1,%r12
  jmp    L160
  nopl   0x0(%rax)
L138:
  lea    D87(%rip),%rdi
  mov    %r11,0x10(%rsp)
  mov    %sil,0x8(%rsp)
  call   <fatal@plt>
  mov    0x10(%rsp),%r11
  movzbl 0x8(%rsp),%esi
  jmp    L328
  nopl   (%rax)
L563:
  lea    D87(%rip),%rdi
  mov    %rax,0x8(%rsp)
  call   <fatal@plt>
  movzbl 0x3(%rbx),%esi
  mov    0x8(%rsp),%r11
  jmp    L155
  nopw   0x0(%rax,%rax,1)
L28:
  lea    D87(%rip),%rdi
  call   <fatal@plt>
  movsbl 0x2(%rbx),%edi
  jmp    L584
  nopl   (%rax)
L493:
  movzbl 0x4(%rbx),%eax
  lea    D87(%rip),%r12
  jmp    L48
  nopl   (%rax)
L513:
  lea    0x1(%r14),%rbx
  test   %al,%al
  je     L577
L206:
  mov    %rbx,%r14
L48:
  cmp    %al,%sil
  je     L292
L201:
  cmpb   $0x5c,(%r14)
  movzbl 0x1(%r14),%eax
  jne    L513
  test   %al,%al
  je     L611
L402:
  movzbl 0x2(%r14),%eax
  lea    0x2(%r14),%rbx
  test   %al,%al
  jne    L206
  mov    %r12,%rdi
  mov    %sil,0x8(%rsp)
  call   <fatal@plt>
  movzbl 0x2(%r14),%eax
  movzbl 0x8(%rsp),%esi
  jmp    L206
  nopl   0x0(%rax)
L577:
  mov    %r12,%rdi
  mov    %sil,0x8(%rsp)
  call   <fatal@plt>
  movzbl 0x8(%rsp),%esi
  cmp    %sil,0x1(%r14)
  mov    %rbx,%r14
  jne    L201
L292:
  cmpb   $0x0,0x1(%r14)
  lea    0x1(%r14),%rbx
  je     L537
L114:
  movzbl 0x1(%r14),%ecx
  xor    %r15d,%r15d
  lea    0x20(%rsp),%r12
  jmp    L514
  nopl   0x0(%rax)
L487:
  test   %cl,%cl
  je     L123
L264:
  mov    %r14,%rbx
L514:
  cmp    $0x29,%cl
  je     L288
L599:
  movslq %r15d,%rdx
  add    %r12,%rdx
  cmp    $0xfe,%r15d
  je     L173
L136:
  movzbl (%rbx),%eax
  movzbl 0x1(%rbx),%ecx
  add    $0x1,%r15d
  lea    0x1(%rbx),%r14
  mov    %al,(%rdx)
  cmp    $0x5c,%al
  jne    L487
  add    $0x1,%rdx
  test   %cl,%cl
  je     L150
  mov    %r14,%rbx
  cmp    $0xfe,%r15d
  jne    L136
L173:
  lea    D53(%rip),%rdi
  mov    %rdx,0x8(%rsp)
  call   <fatal@plt>
  mov    0x8(%rsp),%rdx
  jmp    L136
  nopl   0x0(%rax,%rax,1)
L123:
  lea    D87(%rip),%rdi
  call   <fatal@plt>
  movzbl 0x1(%rbx),%ecx
  jmp    L264
  nopw   0x0(%rax,%rax,1)
L150:
  lea    D87(%rip),%rdi
  mov    %r14,%rbx
  call   <fatal@plt>
  jmp    L599
  nopl   0x0(%rax)
L288:
  movslq %r15d,%r15
  movb   $0x0,0x20(%rsp,%r15,1)
  jmp    L600
  xchg   %ax,%ax
L611:
  mov    %r12,%rdi
  mov    %sil,0x8(%rsp)
  call   <fatal@plt>
  movzbl 0x8(%rsp),%esi
  jmp    L402
L537:
  lea    D87(%rip),%rdi
  call   <fatal@plt>
  jmp    L114
L425:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: label: D87
type_guessed: string
name: extract_symbolic_data
arguments: label: D13
type_guessed: string
name: extract_symbolic_data
arguments: label: D53
type_guessed: string

tool: D87: Unexpected end of title expression

tool: D13: nasted trenary expression too long

tool: D53: trenary expression too long

assistant: ```c
void do_title_expn(char *dest, int size, const char *fmt, const struct file_tags *tags) {
  const char *h;
  int free = --size;
  short escape = 0;
  dest[0] = 0;
  while (free > 0 && *fmt) {
    if (*fmt == '%' && !escape) {
      if ((*++fmt) == '\0')
        fatal("Unexpected end of title expression");
      if (*fmt == '(') {
        char separator, expr[256];
        int expr_pos = 0;
        if ((*++fmt) == '\0')
          fatal("Unexpected end of title expression");
        h = title_expn_subs(*fmt, tags);
        if ((*++fmt) == '\0')
          fatal("Unexpected end of title expression");
        separator = *fmt;
        if ((*++fmt) == '\0')
          fatal("Unexpected end of title expression");
        if (h) {
          while (escape || *fmt != separator) {
            if (expr_pos == sizeof(expr) - 2)
              fatal("nasted trenary expression too long");
            expr[expr_pos++] = *fmt;
            if (*fmt == '\\')
              escape = 1;
            else
              escape = 0;
            if ((*++fmt) == '\0')
              fatal("Unexpected end of title expression");
          }
          expr[expr_pos] = '\0';
          while (escape || *fmt != ')') {
            if (escape)
              escape = 0;
            else if (*fmt == '\\')
              escape = 1;
            if ((*++fmt) == '\0')
              fatal("Unexpected end of title expression");
          }
        } else {
          while (escape || *fmt != separator) {
            if (escape)
              escape = 0;
            else if (*fmt == '\\')
              escape = 1;
            if ((*++fmt) == '\0')
              fatal("Unexpected end of title expression");
          }
          if ((*++fmt) == '\0')
            fatal("Unexpected end of title expression");
          while (escape || *fmt != ')') {
            if (expr_pos == sizeof(expr) - 2)
              fatal("trenary expression too long");
            expr[expr_pos++] = *fmt;
            if (*fmt == '\\')
              escape = 1;
            else
              escape = 0;
            if ((*++fmt) == '\0')
              fatal("Unexpected end of title expression");
          }
          expr[expr_pos] = '\0';
        }
        do_title_expn((dest + size - free), free, expr, tags);
        free -= strlen(dest + size - free);
      } else {
        h = title_expn_subs(*fmt, tags);
        if (h) {
          strncat(dest, h, free - 1);
          free -= strlen(h);
        }
      }
    } else if (*fmt == '\\' && !escape)
      escape = 1;
    else {
      dest[size - free] = *fmt;
      dest[size - free + 1] = 0;
      --free;
      escape = 0;
    }
    fmt++;
  }
  free = free < 0 ? 0 : free;
  dest[size - free] = '\0';
}
```