user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<httpd_decode_url>:
  endbr64
  mov    %rdi,%rax
  movzbl (%rdi),%edx
  test   %dl,%dl
  je     L425
  cmp    $0x3f,%dl
  je     L425
  mov    $0x0,%ecx
  mov    $0x0,%edi
  mov    $0x0,%esi
  mov    $0xffffffff,%r8d
  jmp    L31
L38:
  movzbl 0x1(%rax,%rsi,1),%edx
  lea    -0x30(%rdx),%r9d
  cmp    $0x9,%r9b
  ja     L450
  movsbl %dl,%edx
  sub    $0x30,%edx
L351:
  movzbl 0x2(%rax,%rsi,1),%esi
  lea    -0x30(%rsi),%r9d
  cmp    $0x9,%r9b
  ja     L149
  movsbl %sil,%esi
  sub    $0x30,%esi
L270:
  cmp    $0x1,%edx
  jg     L265
L230:
  cmp    $0x1,%edx
  ja     L139
  mov    $0x0,%eax
  ret
L450:
  lea    -0x41(%rdx),%r9d
  cmp    $0x5,%r9b
  ja     L171
  movsbl %dl,%edx
  sub    $0x37,%edx
  jmp    L351
L171:
  lea    -0x61(%rdx),%r9d
  movsbl %dl,%edx
  sub    $0x57,%edx
  cmp    $0x6,%r9b
  cmovae %r8d,%edx
  jmp    L351
L149:
  lea    -0x41(%rsi),%r9d
  cmp    $0x5,%r9b
  ja     L37
  movsbl %sil,%esi
  sub    $0x37,%esi
  jmp    L270
L37:
  lea    -0x61(%rsi),%r9d
  cmp    $0x5,%r9b
  ja     L230
  movsbl %sil,%esi
  sub    $0x57,%esi
  jmp    L270
L265:
  add    $0x3,%edi
  movslq %ecx,%r9
  shl    $0x4,%edx
  add    %esi,%edx
  mov    %dl,(%rax,%r9,1)
  lea    0x1(%rcx),%ecx
  jmp    L139
L322:
  movslq %ecx,%rdx
  movb   $0x20,(%rax,%rdx,1)
  add    $0x1,%edi
  lea    0x1(%rcx),%ecx
L139:
  movslq %edi,%rsi
  movzbl (%rax,%rsi,1),%edx
  test   %dl,%dl
  je     L260
  cmp    $0x3f,%dl
  je     L260
L31:
  cmp    $0x25,%dl
  je     L38
  cmp    $0x2b,%dl
  je     L322
  add    $0x1,%edi
  movslq %ecx,%rsi
  mov    %dl,(%rax,%rsi,1)
  lea    0x1(%rcx),%ecx
  jmp    L139
L425:
  mov    $0x0,%ecx
L260:
  movslq %ecx,%rcx
  movb   $0x0,(%rax,%rcx,1)
  movzbl (%rax),%edx
  test   %dl,%dl
  je     L244
  cmp    $0x3f,%dl
  je     L244
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    $0x0,%edi
  mov    $0x0,%r8d
  mov    $0x0,%ecx
  jmp    L440
L196:
  cmp    $0x2f,%r10d
  je     L412
  cmp    $0x5c,%r10d
  jne    L308
L412:
  add    $0x1,%r8d
  movb   $0x2f,(%r9)
  jmp    L223
L393:
  cmp    $0x2e,%ecx
  jne    L384
  movsbl %r12b,%ecx
  cmp    $0x2f,%r12b
  je     L107
  cmp    $0x5c,%ecx
  je     L107
L384:
  add    $0x1,%r8d
  movslq %edi,%rcx
  mov    %dl,(%rax,%rcx,1)
  lea    0x1(%rdi),%edi
L223:
  movslq %r8d,%rcx
  movzbl (%rax,%rcx,1),%edx
  test   %dl,%dl
  je     L347
  cmp    $0x3f,%dl
  je     L347
L440:
  movsbl %dl,%esi
  lea    0x1(%rax,%rcx,1),%r9
  movsbl (%r9),%r10d
  lea    0x2(%rax,%rcx,1),%r11
  movzbl (%r11),%ebp
  lea    0x3(%rax,%rcx,1),%rbx
  movzbl (%rbx),%r12d
  mov    %edx,%ecx
  and    $0xffffffbf,%ecx
  cmp    $0x3c,%cl
  sete   %cl
  cmp    $0x2a,%dl
  sete   %r13b
  or     %r13b,%cl
  jne    L301
  lea    -0x3e(%rdx),%ecx
  cmp    $0x1,%cl
  jbe    L301
  cmp    $0x2f,%esi
  je     L196
L308:
  cmp    $0x2f,%esi
  sete   %cl
  cmp    $0x5c,%esi
  sete   %sil
  or     %sil,%cl
  je     L384
  cmp    $0x2e,%r10d
  jne    L384
  movsbl %bpl,%ecx
  cmp    $0x2f,%bpl
  je     L124
  cmp    $0x5c,%ecx
  jne    L393
L124:
  add    $0x2,%r8d
  movb   $0x2f,(%r11)
  jmp    L223
L107:
  test   %edi,%edi
  jle    L49
  lea    -0x1(%rdi),%edx
  movslq %edx,%rdx
L313:
  mov    %edx,%edi
  cmpb   $0x2f,(%rax,%rdx,1)
  je     L226
  sub    $0x1,%rdx
  test   %edx,%edx
  jns    L313
  mov    $0x0,%eax
  jmp    L375
L226:
  test   %edx,%edx
  js     L13
  add    $0x3,%r8d
  movb   $0x2f,(%rbx)
  jmp    L223
L347:
  movslq %edi,%rdi
  movb   $0x0,(%rax,%rdi,1)
  mov    $0x1,%eax
  jmp    L375
L301:
  mov    $0x0,%eax
L375:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L49:
  mov    $0x0,%eax
  jmp    L375
L13:
  mov    $0x0,%eax
  jmp    L375
L244:
  mov    $0x0,%edi
  movslq %edi,%rdi
  movb   $0x0,(%rax,%rdi,1)
  mov    $0x1,%eax
  ret
```

assistant: ```c
int httpd_decode_url(char *url) {
  int s = 0, d = 0;
  while (url[s] != '\0' && url[s] != '?') {
    if (url[s] == '%') {
      int a1 = ((url[s + 1] >= '0' && url[s + 1] <= '9') ? url[s + 1] - '0' : (url[s + 1] >= 'A' && url[s + 1] <= 'F') ? url[s + 1] - 'A' + 10 : (url[s + 1] >= 'a' && url[s + 1] <= 'f') ? url[s + 1] - 'a' + 10 : -1), a2 = ((url[s + 2] >= '0' && url[s + 2] <= '9') ? url[s + 2] - '0' : (url[s + 2] >= 'A' && url[s + 2] <= 'F') ? url[s + 2] - 'A' + 10 : (url[s + 2] >= 'a' && url[s + 2] <= 'f') ? url[s + 2] - 'a' + 10 : -1);
      if (a1 >= 2 && a2 >= 0) {
        s += 3;
        url[d++] = (a1 << 4) + a2;
      } else if (a1 >= 0 && a1 < 2) {
        return 0;
      }
      continue;
    } else if (url[s] == '+') {
      url[d++] = ' ';
      s++;
      continue;
    }
    url[d++] = url[s++];
  }
  url[d] = '\0';
  s = d = 0;
  while (url[s] != '\0' && url[s] != '?') {
    int c0 = url[s], c1 = url[s + 1], c2 = url[s + 2], c3 = url[s + 3];
    if (url[s] == '|' || url[s] == '<' || url[s] == '>' || url[s] == '?' || url[s] == '*')
      return 0;
    if (c0 == '/' && (c1 == '/' || c1 == '\\')) {
      s++;
      url[s] = '/';
      continue;
    } else if ((c0 == '/' || c0 == '\\') && c1 == '.' && (c2 == '/' || c2 == '\\')) {
      s += 2;
      url[s] = '/';
      continue;
    } else if ((c0 == '/' || c0 == '\\') && c1 == '.' && c2 == '.' && (c3 == '/' || c3 == '\\')) {
      int r;
      if (d <= 0)
        return 0;
      for (r = d - 1; r >= 0 && url[r] != '/'; r--)
        ;
      if (r < 0)
        return 0;
      s += 3;
      d = r;
      url[s] = '/';
      continue;
    }
    url[d++] = url[s++];
  }
  url[d] = '\0';
  return 1;
}
```