user: What is the c source code of the assembly code below?

```asm
<ConfigConvertStrWithResolvEnvToStr>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  call   <strdup@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L135
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %rax,%r13
  test   %rax,%rax
  je     L135
  mov    $0x0,%ebp
  jmp    L160
L167:
  cmp    %r13,%rbx
  je     L24
L181:
  add    $0x1,%rbx
  movzbl (%r12,%rbx,1),%edx
  mov    %edx,%eax
  and    $0xffffffdf,%eax
  sub    $0x41,%eax
  cmp    $0x19,%al
  jbe    L167
  lea    -0x30(%rdx),%eax
  cmp    $0x9,%al
  jbe    L167
  cmp    $0x5f,%dl
  je     L167
  jmp    L16
L24:
  mov    %r13,%rbx
L16:
  mov    %rbx,%rax
  sub    0x8(%rsp),%rax
  mov    %rax,0x10(%rsp)
  lea    0x1(%rax),%rdi
  call   <malloc@plt>
  mov    %rax,%r14
  test   %rax,%rax
  je     L2
  movslq %r15d,%rsi
  mov    0x10(%rsp),%rax
  sub    %rsi,%rax
  add    0x8(%rsp),%rsi
  add    %r12,%rsi
  mov    %rax,0x10(%rsp)
  mov    %rax,%rdx
  mov    %r14,%rdi
  call   <strncpy@plt>
  mov    0x10(%rsp),%rax
  movb   $0x0,(%r14,%rax,1)
  mov    %rbx,0x10(%rsp)
  cmp    $0x1,%r15d
  je     L21
L122:
  mov    %r14,%rdi
  call   <getenv@plt>
  mov    %rax,0x18(%rsp)
  test   %rax,%rax
  je     L111
  mov    %r12,%rdi
  call   <strlen@plt>
  mov    %rax,%r15
  mov    0x18(%rsp),%rdi
  call   <strlen@plt>
  mov    %rax,%rdx
  mov    0x8(%rsp),%rax
  sub    0x10(%rsp),%rax
  add    %r15,%rax
  add    %rdx,%rax
  mov    %rax,0x8(%rsp)
  lea    0x1(%rax),%rdi
  call   <malloc@plt>
  mov    %rax,%r15
  test   %rax,%rax
  je     L23
  mov    %rbp,%rdx
  mov    %r12,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
  movb   $0x0,(%r15,%rbp,1)
  mov    0x18(%rsp),%rsi
  mov    %r15,%rdi
  call   <strcat@plt>
  mov    0x10(%rsp),%rsi
  add    %r12,%rsi
  mov    %r15,%rdi
  call   <strcat@plt>
  mov    %r12,%rdi
  call   <free@plt>
  mov    %r15,%r12
  mov    0x8(%rsp),%r13
  mov    $0x0,%ebp
L126:
  mov    %r14,%rdi
  call   <free@plt>
L59:
  add    $0x1,%rbp
  cmp    %rbp,%r13
  jbe    L135
L160:
  cmpb   $0x24,(%r12,%rbp,1)
  jne    L59
  lea    0x1(%rbp),%rax
  mov    %rax,0x8(%rsp)
  mov    $0x0,%r15d
  cmpb   $0x7b,0x1(%r12,%rbp,1)
  mov    %rax,%rbx
  cmovne %rbp,%rbx
  mov    $0x1,%eax
  cmove  %eax,%r15d
  cmp    %r13,%rbx
  jb     L181
  jmp    L16
L21:
  lea    0x1(%rbx),%rax
  cmp    %r13,%rax
  cmova  %rbx,%rax
  mov    %rax,0x10(%rsp)
  jmp    L122
L111:
  mov    %rbx,%rbp
  jmp    L126
L23:
  mov    %rbx,%rbp
  jmp    L126
L2:
  mov    %rbx,%rbp
  jmp    L59
L135:
  mov    %r12,%rax
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
char *ConfigConvertStrWithResolvEnvToStr(const char *str) {
  size_t beg, end, i, max;
  char *env_var, *env_str, *new, *res;
  if ((res = strdup(str)) == NULL)
    return NULL;
  max = strlen(res);
  for (i = 0; i < max; i++)
    if (res[i] == '$') {
      int firstIsBlock = 0;
      beg = i + 1;
      if (res[beg] == '{') {
        firstIsBlock = 1;
        i++;
      }
      while (i < max) {
        i++;
        if (!((res[i] >= 'a' && res[i] <= 'z') || (res[i] >= 'A' && res[i] <= 'Z') || (res[i] >= '0' && res[i] <= '9') || (res[i] == '_')))
          break;
      }
      end = i;
      env_str = malloc(end - beg + 1);
      if (env_str != NULL) {
        strncpy(env_str, res + beg + firstIsBlock, end - beg - firstIsBlock);
        env_str[end - beg - firstIsBlock] = '\0';
        if (firstIsBlock == 1 && (end + 1) <= max)
          end++;
        if ((env_var = getenv(env_str))) {
          size_t len;
          len = strlen(res) - (end - beg) + strlen(env_var) + 1;
          new = malloc(len);
          if (new != NULL) {
            strncpy(new, res, beg - 1);
            new[beg - 1] = '\0';
            strcat(new, env_var);
            strcat(new, res + end);
            free(res);
            res = new;
            i = 0;
            max = len - 1;
          }
        }
        free(env_str);
      }
    }
  return (res);
}
```