user: Converte this assembly snippet into its equivalent C code:

```asm
<openvpn_envp_to_json>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  test   %rdi,%rdi
  je     L40
  mov    %rdi,%r12
  mov    (%rdi),%rdi
  mov    %rsi,%r13
  test   %rdi,%rdi
  je     L95
  lea    0x8(%r12),%rbx
  xor    %r14d,%r14d
  nopl   (%rax)
L101:
  call   <strlen@plt>
  mov    (%rbx),%rdi
  add    $0x8,%rbx
  lea    0xf(%r14,%rax,1),%r14
  test   %rdi,%rdi
  jne    L101
  mov    %r14d,%edi
L110:
  call   <malloc@plt>
  mov    %r14,%rdx
  xor    %esi,%esi
  mov    $0x1,%r14d
  mov    %rax,%r15
  mov    %rax,%rdi
  call   <memset@plt>
  movb   $0x7b,(%r15)
  mov    (%r12),%rdi
  test   %rdi,%rdi
  je     L127
  nopl   (%rax)
L63:
  movzbl (%rdi),%edx
  lea    0x1(%rdi),%rbp
  test   %dl,%dl
  jne    L3
  jmp    L46
L91:
  movzbl 0x0(%rbp),%edx
  add    $0x1,%rbp
  test   %dl,%dl
  je     L46
L3:
  mov    %rbp,%rax
  sub    %rdi,%rax
  lea    -0x1(%rax),%rbx
  cmp    $0x3d,%dl
  jne    L91
  mov    %r13,%rdx
  mov    %rbx,%rsi
  call   <is_in_list@plt>
  test   %rax,%rax
  jne    L46
  mov    $0x2,%ecx
  cmp    $0x1,%r14
  je     L38
  movb   $0x2c,(%r15,%r14,1)
  lea    0x3(%r14),%rcx
  movb   $0x20,0x1(%r15,%r14,1)
  add    $0x2,%r14
L38:
  movb   $0x22,(%r15,%r14,1)
  mov    (%r12),%rsi
  lea    (%r15,%rcx,1),%rdi
  mov    %rbx,%rdx
  mov    %rcx,0x8(%rsp)
  call   <memcpy@plt>
  mov    0x8(%rsp),%rcx
  mov    %rbp,%rdi
  lea    (%rbx,%rcx,1),%rax
  movb   $0x22,(%r15,%rax,1)
  lea    0x3(%rax),%r14
  movb   $0x3a,0x1(%r15,%rax,1)
  movb   $0x22,0x2(%r15,%rax,1)
  call   <strlen@plt>
  lea    (%r15,%r14,1),%rdi
  mov    %rbp,%rsi
  mov    %rax,%rdx
  call   <memcpy@plt>
  mov    %rbp,%rdi
  call   <strlen@plt>
  add    %rax,%r14
  movb   $0x22,(%r15,%r14,1)
  add    $0x1,%r14
L46:
  mov    0x8(%r12),%rdi
  add    $0x8,%r12
  test   %rdi,%rdi
  jne    L63
L127:
  movb   $0x7d,(%r15,%r14,1)
L37:
  add    $0x18,%rsp
  mov    %r15,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L95:
  xor    %edi,%edi
  xor    %r14d,%r14d
  jmp    L110
L40:
  xor    %r15d,%r15d
  jmp    L37
```

assistant: ```c
char *openvpn_envp_to_json(const char *envp[], const char *exclude[]) {
  size_t i, j;
  size_t buffer_size = 0;
  size_t buffer_pos = 0;
  const size_t str_space = 15;
  char *json_str;
  const char *value_pos;
  if (!envp)
    return NULL;
  for (i = 0; envp[i]; i++)
    buffer_size += strlen(envp[i]) + str_space;
  json_str = (char *)malloc(sizeof(char) * buffer_size);
  memset(json_str, 0, buffer_size);
  json_str[buffer_pos] = '{';
  buffer_pos++;
  for (i = 0; envp[i]; i++) {
    value_pos = NULL;
    for (j = 0; envp[i][j]; j++) {
      if (envp[i][j] == '=') {
        value_pos = envp[i] + j + 1;
        break;
      }
    }
    if (!value_pos)
      continue;
    if (is_in_list(envp[i], j, exclude))
      continue;
    if (buffer_pos != 1) {
      json_str[buffer_pos] = ',';
      buffer_pos++;
      json_str[buffer_pos] = ' ';
      buffer_pos++;
    }
    json_str[buffer_pos] = '\"';
    buffer_pos++;
    memcpy(json_str + buffer_pos, envp[i], j);
    buffer_pos += j;
    json_str[buffer_pos] = '\"';
    buffer_pos++;
    json_str[buffer_pos] = ':';
    buffer_pos++;
    json_str[buffer_pos] = '\"';
    buffer_pos++;
    memcpy(json_str + buffer_pos, value_pos, strlen(value_pos));
    buffer_pos += strlen(value_pos);
    json_str[buffer_pos] = '\"';
    buffer_pos++;
  }
  json_str[buffer_pos] = '}';
  buffer_pos++;
  return json_str;
}
```