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

```asm
<addValue>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbp
  mov    %rsi,%r14
  mov    %rdx,%r12
  mov    %rcx,%rbx
  mov    %rsi,%rdi
  call   <strlen@plt>
  mov    %eax,%r15d
  mov    %r12,%rdi
  call   <strlen@plt>
  test   %r15d,%r15d
  je     L185
  mov    %eax,%r13d
  test   %eax,%eax
  je     L185
  mov    $0x800,%edi
  call   <malloc@plt>
  mov    %r14,%rsi
  mov    %rbp,%rdi
  call   <searchKeyIndex@plt>
  mov    %eax,%edx
  cmp    $0xffffffff,%eax
  je     L221
  mov    %eax,%esi
  mov    $0x0,%eax
  test   %edx,%edx
  jle    L155
L27:
  movzbl 0x0(%rbp,%rax,1),%ecx
  mov    %cl,(%rbx,%rax,1)
  add    $0x1,%rax
  cmp    %rsi,%rax
  jne    L27
L63:
  movslq %edx,%rcx
  movb   $0x3a,(%rbx,%rcx,1)
  lea    0x1(%rdx),%edi
  test   %r13d,%r13d
  jle    L224
  movslq %edi,%rax
  lea    0x1(%r13),%r8d
  add    %rcx,%r8
  sub    %rcx,%r12
L54:
  mov    %eax,%ecx
  movzbl -0x1(%r12,%rax,1),%esi
  test   %sil,%sil
  je     L86
  mov    %sil,(%rbx,%rax,1)
  lea    0x1(%rax),%ecx
  add    $0x1,%rax
  cmp    %r8,%rax
  jne    L54
L86:
  movslq %ecx,%r8
  movb   $0x3b,(%rbx,%r8,1)
  movslq %edi,%rax
  cmpb   $0x3b,0x0(%rbp,%rax,1)
  je     L115
  lea    0x2(%rdx),%eax
  cltq
L217:
  mov    %eax,%edi
  add    $0x1,%rax
  cmpb   $0x3b,-0x1(%rbp,%rax,1)
  jne    L217
L115:
  cmp    $0x7ff,%edi
  jg     L134
  mov    $0x7ff,%eax
  sub    %edi,%eax
  lea    0x1(%r8,%rax,1),%rsi
  mov    %r8,%rax
  movslq %edi,%rdi
  sub    %r8,%rdi
  add    %rdi,%rbp
L10:
  mov    %eax,%ecx
  movzbl 0x0(%rbp,%rax,1),%edx
  test   %dl,%dl
  je     L134
  mov    %dl,(%rbx,%rax,1)
  lea    0x1(%rax),%ecx
  add    $0x1,%rax
  cmp    %rsi,%rax
  jne    L10
L134:
  movslq %ecx,%rcx
  movb   $0x0,(%rbx,%rcx,1)
  mov    $0x0,%eax
  jmp    L15
L155:
  mov    $0x0,%edx
  jmp    L63
L221:
  movzbl 0x0(%rbp),%ecx
  test   %cl,%cl
  je     L201
  mov    $0x1,%edx
L96:
  mov    %cl,-0x1(%rbx,%rdx,1)
  mov    %edx,%eax
  add    $0x1,%rdx
  movzbl -0x1(%rbp,%rdx,1),%ecx
  test   %cl,%cl
  jne    L96
L122:
  movzbl (%r14),%ecx
  test   %cl,%cl
  je     L204
  lea    0x1(%rax),%edx
  movslq %edx,%rdx
  cltq
  sub    %rax,%r14
L179:
  mov    %cl,-0x1(%rbx,%rdx,1)
  mov    %edx,%eax
  add    $0x1,%rdx
  movzbl -0x1(%r14,%rdx,1),%ecx
  test   %cl,%cl
  jne    L179
L204:
  movslq %eax,%rsi
  movb   $0x3a,(%rbx,%rsi,1)
  lea    0x1(%rax),%ecx
  movzbl (%r12),%edx
  test   %dl,%dl
  je     L97
  add    $0x2,%eax
  cltq
  sub    %rsi,%r12
L123:
  mov    %dl,-0x1(%rbx,%rax,1)
  mov    %eax,%ecx
  add    $0x1,%rax
  movzbl -0x2(%r12,%rax,1),%edx
  test   %dl,%dl
  jne    L123
L97:
  movslq %ecx,%rax
  movb   $0x3b,(%rbx,%rax,1)
  add    $0x1,%ecx
  movslq %ecx,%rcx
  movb   $0x0,(%rbx,%rcx,1)
  mov    $0x0,%eax
  jmp    L15
L201:
  mov    $0x0,%eax
  jmp    L122
L224:
  mov    %edi,%ecx
  jmp    L86
L185:
  mov    $0x1,%eax
L15:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
int addValue(const char *configurationBuffer, const char *targetKey, const char *value, char *resultConfigurationBuffer, int resultConfigurationBufferSize) {
  const int key_size = (unsigned)strlen(targetKey);
  const int value_size = (unsigned)strlen(value);
  if (key_size == 0 || value_size == 0)
    return 1;
  int keyIndex = 0;
  char *writeBuffer = (char *)malloc(sizeof(char) * 2048);
  keyIndex = searchKeyIndex(configurationBuffer, targetKey);
  int tempIndex = 0;
  int tempUpdateIndex = 0;
  int i = 0;
  if (keyIndex == -1) {
    while (configurationBuffer[i] != '\0') {
      resultConfigurationBuffer[i] = configurationBuffer[i];
      i++;
    }
    while (targetKey[tempIndex] != '\0') {
      resultConfigurationBuffer[i] = targetKey[tempIndex];
      i++;
      tempIndex++;
    }
    resultConfigurationBuffer[i] = ':';
    i++;
    tempIndex = 0;
    while (value[tempIndex] != '\0') {
      resultConfigurationBuffer[i] = value[tempIndex];
      i++;
      tempIndex++;
    }
    resultConfigurationBuffer[i] = ';';
    i++;
    resultConfigurationBuffer[i] = '\0';
    return 0;
  }
  for (i = 0; i < keyIndex; i++) {
    resultConfigurationBuffer[i] = configurationBuffer[i];
  }
  resultConfigurationBuffer[i] = ':';
  i++;
  tempUpdateIndex = i;
  for (tempIndex = 0; tempIndex < value_size; tempIndex++) {
    if (value[tempIndex] == '\0')
      break;
    resultConfigurationBuffer[tempUpdateIndex] = value[tempIndex];
    tempUpdateIndex++;
  }
  resultConfigurationBuffer[tempUpdateIndex] = ';';
  tempIndex = tempUpdateIndex;
  while (configurationBuffer[i] != ';') {
    i++;
  }
  for (i = i; i < 2048; i++) {
    if (configurationBuffer[i] == '\0')
      break;
    resultConfigurationBuffer[tempIndex] = configurationBuffer[i];
    tempIndex++;
  }
  resultConfigurationBuffer[tempIndex] = '\0';
  return 0;
}
```