user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<router_rewrite_metric>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,%r14
  mov    %rsi,0x18(%rsp)
  mov    %rdx,%r13
  mov    %rcx,(%rsp)
  mov    %r8,%rbx
  mov    %r9,0x8(%rsp)
  cmpq   $0x0,0x70(%rsp)
  setne  %dil
  movzbl %dil,%edi
  call   <assert@plt>
  mov    0x70(%rsp),%rax
  movslq (%rax),%rbp
  mov    $0x0,%eax
  cmp    $0x1fff,%rbp
  ja     L419
  lea    0x0(%r13,%rbp,1),%rax
  cmp    %rax,%r13
  jae    L395
  mov    $0x0,%eax
L25:
  movzbl 0x0(%r13,%rax,1),%edx
  mov    %dl,(%r14,%rax,1)
  add    $0x1,%rax
  cmp    %rax,%rbp
  jne    L25
  add    %r14,%rbp
L113:
  mov    $0x0,%r15d
  mov    $0x0,%esi
  mov    $0x0,%r12d
  mov    %r13,0x10(%rsp)
  jmp    L391
L395:
  mov    %r14,%rbp
  jmp    L113
L162:
  lea    (%rsi,%rsi,4),%edx
  movsbl %al,%eax
  lea    -0x30(%rax,%rdx,2),%esi
  mov    $0x2,%r12d
  jmp    L232
L133:
  mov    %rdi,%rax
  sub    %rdx,%rax
  add    %rbp,%rax
  mov    %rax,0x20(%rsp)
  mov    $0x0,%esi
  cmp    %rcx,%r13
  jae    L82
  mov    %r12b,0x2f(%rsp)
  mov    0x20(%rsp),%r12
L331:
  add    $0x1,%r13
  movsbl -0x1(%r13),%edi
  call   <toupper@plt>
  add    $0x1,%rbp
  mov    %al,-0x1(%rbp)
  cmp    %r12,%rbp
  jne    L331
  movzbl 0x2f(%rsp),%r12d
  mov    0x20(%rsp),%rbp
  mov    $0x0,%esi
  jmp    L82
L224:
  mov    %rdi,%rax
  sub    %rdx,%rax
  add    %rbp,%rax
  mov    %rax,0x20(%rsp)
  mov    $0x0,%esi
  cmp    %rcx,%r13
  jae    L82
  mov    %r12b,0x2f(%rsp)
  mov    0x20(%rsp),%r12
L165:
  add    $0x1,%r13
  movsbl -0x1(%r13),%edi
  call   <tolower@plt>
  add    $0x1,%rbp
  mov    %al,-0x1(%rbp)
  cmp    %r12,%rbp
  jne    L165
  movzbl 0x2f(%rsp),%r12d
  mov    0x20(%rsp),%rbp
  mov    $0x0,%esi
  jmp    L82
L238:
  mov    $0x0,%esi
L82:
  movzbl (%rbx),%edx
  cmp    $0x5c,%dl
  je     L232
  mov    %rbp,%rax
  sub    %r14,%rax
  add    $0x1,%rax
  cmp    $0x1fff,%rax
  ja     L80
  mov    %dl,0x0(%rbp)
  lea    0x1(%rbp),%rbp
L80:
  cmpb   $0x0,(%rbx)
  je     L51
  mov    $0x0,%r15d
  mov    $0x0,%r12d
L232:
  add    $0x1,%rbx
L391:
  movzbl (%rbx),%eax
  test   %r12b,%r12b
  jne    L370
  cmp    $0x5c,%al
  je     L255
L370:
  cmp    $0x1,%r12b
  sete   %dl
  test   %r15d,%r15d
  sete   %cl
  and    %ecx,%edx
  cmp    $0x5f,%al
  jne    L346
  test   %dl,%dl
  jne    L373
L346:
  cmp    $0x5e,%al
  jne    L363
  test   %dl,%dl
  jne    L292
L363:
  lea    -0x30(%rax),%edx
  cmp    $0x9,%dl
  ja     L15
  test   %r12b,%r12b
  jne    L162
L15:
  test   %r12b,%r12b
  je     L82
  test   %esi,%esi
  jle    L238
  movslq %esi,%rax
  mov    $0x0,%esi
  cmp    0x8(%rsp),%rax
  ja     L82
  mov    0x70(%rsp),%rsi
  lea    (%rsi,%rax,8),%rax
  mov    (%rax),%edx
  mov    $0x0,%esi
  test   %edx,%edx
  js     L82
  movslq %edx,%rdx
  mov    0x10(%rsp),%rsi
  lea    (%rsi,%rdx,1),%r13
  movslq 0x4(%rax),%rdi
  lea    (%rsi,%rdi,1),%rcx
  mov    %rbp,%rax
  sub    %r14,%rax
  add    %rcx,%rax
  sub    %r13,%rax
  mov    $0x0,%esi
  cmp    $0x1fff,%rax
  ja     L82
  cmp    $0x1,%r15d
  je     L224
  cmp    $0x2,%r15d
  je     L133
  test   %r15d,%r15d
  jne    L82
  cmp    %rcx,%r13
  jae    L351
  sub    %rdx,%rdi
  mov    %rdi,%rcx
  mov    $0x0,%eax
L120:
  movzbl 0x0(%r13,%rax,1),%edx
  mov    %dl,0x0(%rbp,%rax,1)
  add    $0x1,%rax
  cmp    %rcx,%rax
  jne    L120
  add    %rcx,%rbp
  mov    $0x0,%esi
  jmp    L82
L351:
  mov    $0x0,%esi
  jmp    L82
L51:
  mov    0x10(%rsp),%r13
  lea    -0x1(%rbp),%rbx
  mov    0x70(%rsp),%rax
  movslq 0x4(%rax),%rax
  add    %rax,%r13
  mov    %rbx,%rdx
  sub    %r14,%rdx
  mov    (%rsp),%rdi
  add    %rdi,%rdx
  sub    %r13,%rdx
  mov    $0x0,%eax
  cmp    $0x1fff,%rdx
  ja     L419
  cmp    %rdi,%r13
  jae    L350
  sub    %r13,%rdi
  mov    %rdi,%rcx
L241:
  movzbl 0x0(%r13,%rax,1),%edx
  mov    %dl,-0x1(%rbp,%rax,1)
  add    $0x1,%rax
  cmp    %rcx,%rax
  jne    L241
  add    %rcx,%rbx
L350:
  mov    0x18(%rsp),%rax
  mov    %rbx,(%rax)
  mov    %rbx,%rbp
  sub    %r14,%rbp
  mov    (%rsp),%rdi
  call   <strlen@plt>
  movslq %eax,%rdx
  add    %rbp,%rdx
  mov    $0x0,%eax
  cmp    $0x1fff,%rdx
  jbe    L299
L419:
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L299:
  mov    (%rsp),%rdx
  movzbl (%rdx),%eax
  test   %al,%al
  je     L312
L289:
  add    $0x1,%rbx
  mov    %al,-0x1(%rbx)
  add    $0x1,%rdx
  movzbl (%rdx),%eax
  test   %al,%al
  jne    L289
L312:
  movb   $0x0,(%rbx)
  lea    0x1(%rbx),%rax
  sub    %r14,%rax
  jmp    L419
L255:
  mov    $0x0,%r15d
  mov    $0x1,%r12d
  jmp    L232
L373:
  mov    $0x1,%r15d
  mov    $0x1,%r12d
  jmp    L232
L292:
  mov    $0x2,%r15d
  mov    $0x1,%r12d
  jmp    L232
```

assistant: ```c
size_t router_rewrite_metric(char (*newmetric)[8192], char **newfirstspace, const char *metric, const char *firstspace, const char *replacement, const size_t nmatch, const regmatch_t *pmatch) {
  char escape = 0;
  int ref = 0;
  char *s = *newmetric;
  const char *p;
  const char *q;
  const char *t;
  enum rewrite_case { RETAIN, LOWER, UPPER } rcase = RETAIN;
  assert(pmatch != NULL);
  q = metric;
  t = metric + pmatch[0].rm_so;
  if (s - *newmetric + t - q < sizeof(*newmetric)) {
    while (q < t)
      *s++ = *q++;
  } else {
    return 0;
  }
  for (p = replacement;; p++) {
    switch (*p) {
    case '\\':
      if (!escape) {
        escape = 1;
        rcase = RETAIN;
        break;
      }
    default:
      if (escape == 1 && rcase == RETAIN && *p == '_') {
        rcase = LOWER;
      } else if (escape == 1 && rcase == RETAIN && *p == '^') {
        rcase = UPPER;
      } else if (escape && *p >= '0' && *p <= '9') {
        escape = 2;
        ref *= 10;
        ref += *p - '0';
      } else {
        if (escape) {
          if (ref > 0 && ref <= nmatch && pmatch[ref].rm_so >= 0) {
            q = metric + pmatch[ref].rm_so;
            t = metric + pmatch[ref].rm_eo;
            if (s - *newmetric + t - q < sizeof(*newmetric)) {
              switch (rcase) {
              case RETAIN:
                while (q < t)
                  *s++ = *q++;
                break;
              case LOWER:
                while (q < t)
                  *s++ = (char)tolower(*q++);
                break;
              case UPPER:
                while (q < t)
                  *s++ = (char)toupper(*q++);
                break;
              }
            }
          }
          ref = 0;
        }
        if (*p != '\\') {
          escape = 0;
          rcase = RETAIN;
          if (s - *newmetric + 1 < sizeof(*newmetric))
            *s++ = *p;
        }
      }
      break;
    }
    if (*p == '\0')
      break;
  }
  s--;
  q = metric + pmatch[0].rm_eo;
  t = firstspace;
  if (s - *newmetric + t - q < sizeof(*newmetric)) {
    while (q < t)
      *s++ = *q++;
  } else {
    return 0;
  }
  *newfirstspace = s;
  if (s - *newmetric + strlen(firstspace) < sizeof(*newmetric)) {
    for (p = firstspace; *p != '\0'; p++)
      *s++ = *p;
    *s++ = '\0';
    return s - *newmetric;
  }
  return 0;
}
```