user: Please show me the C implementation that matches the assembly code listed below:

```asm
<decode>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  call   <strlen@plt>
  lea    (%rax,%rax,1),%edi
  mov    %rax,%rbx
  call   <malloc@plt>
  movb   $0x0,(%rax)
  mov    %rax,%r12
  movb   $0x0,0x20(%rsp)
  test   %rbx,%rbx
  je     L84
  lea    0x0(%rbp,%rbx,1),%rax
  lea    (%rbx,%rbx,1),%r13
  movabs $0xaaaaaaaaaaaaaaab,%r14
  xor    %ebx,%ebx
  mov    %rax,0x10(%rsp)
  lea    0x20(%rsp),%r15
  jmp    L72
  nopw   0x0(%rax,%rax,1)
L124:
  mov    %r15,%rdi
  call   <strlen@plt>
  test   %rax,%rax
  jne    L134
  mov    $0x1,%edx
  mov    %rbp,%rsi
  mov    %r12,%rdi
  add    $0x1,%rbx
  call   <strncat@plt>
  lea    0x0(%r13,%r13,1),%rcx
  mov    %rcx,%rax
  mul    %r14
  shr    %rdx
  cmp    %rbx,%rdx
  jb     L126
L46:
  movb   $0x0,0x20(%rsp)
  add    $0x1,%rbp
  cmp    %rbp,0x10(%rsp)
  je     L84
L72:
  movsbl 0x0(%rbp),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  je     L124
  mov    %rbp,%rsi
  mov    $0x1,%edx
  mov    %r15,%rdi
  add    $0x1,%rbp
  call   <strncat@plt>
  cmp    %rbp,0x10(%rsp)
  jne    L72
L84:
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L129
  add    $0x48,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L134:
  mov    %r15,%rdi
  call   <atoi@plt>
  test   %rax,%rax
  je     L46
  add    %rbx,%rax
  mov    %rax,0x8(%rsp)
  jmp    L95
  nopw   0x0(%rax,%rax,1)
L37:
  cmp    %rbx,0x8(%rsp)
  je     L46
L95:
  mov    $0x1,%edx
  mov    %rbp,%rsi
  mov    %r12,%rdi
  add    $0x1,%rbx
  call   <strncat@plt>
  lea    0x0(%r13,%r13,1),%rcx
  mov    %rcx,%rax
  mul    %r14
  shr    %rdx
  cmp    %rbx,%rdx
  jae    L37
  mov    %r12,%rdi
  mov    %rcx,%rsi
  mov    %rcx,0x18(%rsp)
  call   <realloc@plt>
  mov    0x18(%rsp),%r13
  mov    %rax,%r12
  jmp    L37
  nopl   0x0(%rax)
L126:
  mov    %r12,%rdi
  mov    %rcx,%rsi
  mov    %rcx,0x8(%rsp)
  call   <realloc@plt>
  mov    0x8(%rsp),%r13
  mov    %rax,%r12
  jmp    L46
L129:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
char *decode(const char *data) {
  size_t length = strlen(data);
  char *result = malloc(sizeof(char) * length * 2);
  size_t result_size = length * 2;
  size_t result_len = 0;
  result[0] = '\0';
  char temp[20];
  temp[0] = '\0';
  if (length == 0)
    return result;
  for (size_t i = 0; i < length; ++i) {
    if (isdigit(data[i])) {
      strncat(temp, &data[i], 1);
    } else {
      if (strlen(temp) > 0) {
        size_t number = atoi(temp);
        for (size_t j = 0; j < number; ++j) {
          strncat(result, &data[i], 1);
          result_len++;
          if (result_len > result_size * 2 / 3) {
            result = realloc(result, result_size * 2);
            result_size *= 2;
          }
        }
      } else {
        strncat(result, &data[i], 1);
        result_len++;
        if (result_len > result_size * 2 / 3) {
          result = realloc(result, result_size * 2);
          result_size *= 2;
        }
      }
      temp[0] = '\0';
    }
  }
  return result;
}
```