user: Demonstrate the C code that generates the assembly output below:

```asm
<refined_soundex>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  mov    %rdi,%r15
  xor    %edi,%edi
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  test   %r15,%r15
  setne  %dil
  call   <assert@plt>
  mov    %r15,%rdi
  call   <strlen@plt>
  mov    %rsp,%rcx
  mov    %rax,%r12
  lea    0x10(%rax),%rax
  mov    %rax,%rdx
  and    $0xfffffffffffff000,%rax
  sub    %rax,%rcx
  and    $0xfffffffffffffff0,%rdx
  cmp    %rcx,%rsp
  je     L55
L47:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rcx,%rsp
  jne    L47
L55:
  and    $0xfff,%edx
  sub    %rdx,%rsp
  test   %rdx,%rdx
  jne    L154
L19:
  lea    0xf(%r12),%rax
  mov    %rsp,%rcx
  mov    %rsp,-0x48(%rbp)
  mov    %rax,%rdx
  and    $0xfffffffffffff000,%rax
  sub    %rax,%rcx
  and    $0xfffffffffffffff0,%rdx
  cmp    %rcx,%rsp
  je     L126
L59:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rcx,%rsp
  jne    L59
L126:
  and    $0xfff,%edx
  sub    %rdx,%rsp
  test   %rdx,%rdx
  jne    L137
L60:
  movsbl (%r15),%edi
  mov    %rsp,%r13
  call   <toupper@plt>
  mov    %eax,%ebx
  mov    -0x48(%rbp),%rax
  mov    %bl,(%rax)
  test   %r12,%r12
  je     L145
  xor    %r14d,%r14d
  xor    %eax,%eax
  xor    %ebx,%ebx
  nop
L17:
  movsbl (%r15,%rax,1),%edi
  call   <encode_char@plt>
  mov    %al,0x0(%r13,%rbx,1)
  lea    0x1(%r14),%ebx
  mov    %rbx,%r14
  mov    %rbx,%rax
  cmp    %r12,%rbx
  jb     L17
  xor    %ecx,%ecx
  xor    %eax,%eax
  mov    $0x1,%ebx
  xor    %edx,%edx
  nopl   0x0(%rax)
L118:
  mov    %eax,%esi
  movzbl 0x0(%r13,%rdx,1),%eax
  cmp    %sil,%al
  je     L62
  mov    -0x48(%rbp),%rsi
  mov    %ebx,%edx
  add    $0x1,%ebx
  mov    %al,(%rsi,%rdx,1)
L62:
  lea    0x1(%rcx),%edx
  mov    %rdx,%rcx
  cmp    %r12,%rdx
  jb     L118
  mov    %ebx,%edi
  mov    %ebx,%r12d
  call   <malloc@plt>
  mov    %rax,%r8
  test   %ebx,%ebx
  je     L8
  mov    -0x48(%rbp),%rsi
  mov    %r12,%rdx
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    %rax,%r8
L108:
  movb   $0x0,(%r8,%r12,1)
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L92
  lea    -0x28(%rbp),%rsp
  mov    %r8,%rax
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
  nopl   (%rax)
L154:
  orq    $0x0,-0x8(%rsp,%rdx,1)
  jmp    L19
  nopl   0x0(%rax,%rax,1)
L8:
  xor    %r12d,%r12d
  jmp    L108
L145:
  mov    $0x1,%edi
  mov    $0x1,%r12d
  call   <malloc@plt>
  mov    %bl,(%rax)
  mov    %rax,%r8
  jmp    L108
L137:
  orq    $0x0,-0x8(%rsp,%rdx,1)
  jmp    L60
L92:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
char *refined_soundex(const char *str) {
  assert(str != NULL);
  size_t str_len = strlen(str);
  char code[str_len + 1];
  char buf[str_len];
  code[0] = toupper(str[0]);
  unsigned d = 1;
  for (unsigned i = 0; i < str_len; i++)
    buf[i] = encode_char(str[i]);
  char prev = '\0';
  for (unsigned i = 0; i < str_len; i++) {
    if (!((buf[i]) == (prev))) {
      code[d] = buf[i];
      d++;
      prev = buf[i];
    }
  }
  char *result = malloc(d * sizeof(char));
  for (unsigned i = 0; i < d; i++) {
    result[i] = code[i];
  }
  result[d] = '\0';
  return result;
}
```