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

```asm
<bdecode_value>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x28(%rbp)
  movl   $0x0,-0x24(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x20(%rbp)
  mov    -0x40(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x1c(%rbp)
  mov    -0x1c(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x18(%rbp)
  lea    -0xd(%rbp),%rax
  mov    $0x5,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  mov    -0x1c(%rbp),%edx
  mov    -0x18(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  movl   $0x0,-0x2c(%rbp)
  jmp    L82
L64:
  mov    -0x2c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x38(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x1c(%rbp),%edx
  mov    -0x18(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
  mov    -0x1c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    -0x40(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L18
  mov    -0x1c(%rbp),%eax
  add    $0x1,%eax
  add    %eax,-0x2c(%rbp)
  jmp    L5
L61:
  mov    -0x2c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%edx
  mov    -0x28(%rbp),%eax
  cltq
  mov    %dl,-0xd(%rbp,%rax,1)
  addl   $0x1,-0x28(%rbp)
  addl   $0x1,-0x2c(%rbp)
L5:
  mov    -0x2c(%rbp),%eax
  cmp    -0x20(%rbp),%eax
  jge    L20
  cmpl   $0x4,-0x28(%rbp)
  jg     L20
  mov    -0x2c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jle    L20
  mov    -0x2c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x39,%al
  jle    L61
L20:
  lea    -0xd(%rbp),%rax
  mov    %rax,%rdi
  call   <atoi@plt>
  mov    %eax,-0x24(%rbp)
  jmp    L1
L18:
  addl   $0x1,-0x2c(%rbp)
L82:
  mov    -0x2c(%rbp),%eax
  cmp    -0x20(%rbp),%eax
  jl     L64
L1:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x24(%rbp),%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L54
  call   <__stack_chk_fail@plt>
L54:
  leave
  ret
```

assistant: ```c
int bdecode_value(char *source, char *search) {
  int i, intlen = 0, value = 0;
  int source_len = strlen(source);
  int search_len = strlen(search);
  char *seek = (char *)malloc(search_len + 1);
  char tmp[5];
  memset(tmp, '\0', sizeof(tmp));
  memset(seek, '\0', search_len);
  for (i = 0; i < source_len; i++) {
    strncpy(seek, source + i, search_len);
    seek[search_len] = '\0';
    if (strcmp(seek, search) == 0) {
      i += search_len + 1;
      while (i < source_len && intlen < 5 && 47 < source[i] && source[i] < 58) {
        tmp[intlen] = source[i];
        intlen++;
        i++;
      }
      value = atoi(tmp);
      break;
    }
  }
  free(seek);
  return value;
}
```