user: 请将以下的汇编代码转换成C语言代码:

```asm
<scgi_urlencode>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x440,%rsp
  mov    %rdi,-0x438(%rbp)
  mov    %rsi,-0x440(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x410(%rbp),%rax
  lea    D16(%rip),%rdx
  mov    $0x80,%ecx
  mov    %rax,%rdi
  mov    %rdx,%rsi
  rep movsq %ds:(%rsi),%es:(%rdi)
  cmpq   $0x0,-0x438(%rbp)
  jne    L33
  mov    $0x0,%eax
  jmp    L74
L33:
  cmpq   $0x0,-0x440(%rbp)
  jne    L61
  lea    D18(%rip),%rax
  mov    %rax,%rdi
  call   <strdup@plt>
  jmp    L74
L61:
  mov    -0x440(%rbp),%rax
  mov    %eax,%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  add    $0x1,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x430(%rbp)
  mov    -0x430(%rbp),%rax
  mov    %rax,-0x420(%rbp)
  mov    -0x440(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    -0x438(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x418(%rbp)
  mov    -0x438(%rbp),%rax
  mov    %rax,-0x428(%rbp)
  jmp    L66
L67:
  mov    -0x428(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  cltq
  mov    -0x410(%rbp,%rax,4),%eax
  test   %eax,%eax
  jne    L21
  mov    -0x428(%rbp),%rax
  movzbl (%rax),%edx
  mov    -0x430(%rbp),%rax
  mov    %dl,(%rax)
  addq   $0x1,-0x430(%rbp)
  jmp    L79
L21:
  mov    -0x428(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%edx
  mov    -0x430(%rbp),%rax
  lea    D20(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <sprintf@plt>
  addq   $0x3,-0x430(%rbp)
L79:
  addq   $0x1,-0x428(%rbp)
L66:
  mov    -0x428(%rbp),%rax
  cmp    -0x418(%rbp),%rax
  jbe    L67
  mov    -0x430(%rbp),%rax
  movb   $0x0,(%rax)
  mov    -0x420(%rbp),%rax
L74:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L37
  call   <__stack_chk_fail@plt>
L37:
  leave
  ret
```

tool_calls: name: parse_data
arguments: label: D16
type_guessed: string
name: parse_data
arguments: label: D18
type_guessed: string
name: parse_data
arguments: label: D20
type_guessed: string

tool: D16: 

tool: 

tool: D20: %%%02x

assistant: ```c
char *scgi_urlencode(const char *dec, size_t decsz) {
  const bool _encc[256] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
  char *enc, *start, *end, *p;
  if (dec == NULL) {
    return (NULL);
  }
  if (decsz == 0) {
    return (strdup(""));
  }
  enc = (char *)malloc(3 * decsz + 1);
  start = enc;
  end = (char *)(dec + decsz - 1);
  p = (char *)dec;
  while (p <= end) {
    if (!_encc[*((unsigned char *)p)]) {
      *enc = *p;
      enc++;
    } else {
      sprintf(enc, "%%%02x", *((unsigned char *)p));
      enc += 3;
    }
    p++;
  }
  *enc = '\0';
  return (start);
}
```