user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<TestEmbedChar>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%rbx
  mov    %esi,%ebp
  mov    %ecx,%r13d
  mov    %r8,%r12
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  movq   $0x0,(%rsp)
  mov    %rsp,%rcx
  call   <embed@plt>
  cmp    %r13d,%eax
  je     L18
  lea    D20(%rip),%rdi
  call   <puts@plt>
  mov    (%rsp),%rdi
  test   %rdi,%rdi
  je     L107
  call   <free@plt>
L107:
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L81
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L18:
  lea    D46(%rip),%rdi
  call   <puts@plt>
  test   %rbx,%rbx
  je     L36
  lea    D25(%rip),%rdi
  call   <puts@plt>
  lea    D49(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  test   %ebp,%ebp
  jle    L36
  mov    %ebp,%ebp
  mov    $0x0,%ebx
  lea    D41(%rip),%r15
  lea    D3(%rip),%r14
  jmp    L17
L41:
  mov    (%rsp),%rax
  movzbl (%rax,%rbx,1),%edx
  movzbl (%r12,%rbx,1),%ecx
  cmp    %cl,%dl
  movzbl %cl,%ecx
  movzbl %dl,%edx
  mov    %r14,%r8
  cmove  %r15,%r8
  mov    %r13d,%esi
  lea    D32(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  add    $0x1,%rbx
  cmp    %rbp,%rbx
  je     L36
L17:
  mov    %ebx,%r13d
  test   $0x7,%bl
  jne    L41
  mov    $0xa,%edi
  call   <putchar@plt>
  jmp    L41
L36:
  lea    D64(%rip),%rdi
  call   <puts@plt>
  mov    (%rsp),%rdi
  test   %rdi,%rdi
  je     L107
  call   <free@plt>
  jmp    L107
L81:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: tag: D20
datatype: string
name: retrieve_data
arguments: tag: D46
datatype: string
name: retrieve_data
arguments: tag: D25
datatype: string
name: retrieve_data
arguments: tag: D49
datatype: string
name: retrieve_data
arguments: tag: D41
datatype: string
name: retrieve_data
arguments: tag: D3
datatype: string
name: retrieve_data
arguments: tag: D32
datatype: string
name: retrieve_data
arguments: tag: D64
datatype: string

tool: D20: Test Failed

tool: D46: Yay it worked! WoooHoo!!!

tool: D25: Compare arrays:

tool: D49:   encode:    result:

tool: D41: true

tool: D3: false

tool: D32: %3d: 0x%02x == 0x%02x (%s)


tool: D64: 


assistant: ```c
void TestEmbedChar(char *image_data, int data_length, char *message, int resultf, char *resultem) {
  char *encoded = NULL;
  int rcembed;
  int idx;
  rcembed = embed(image_data, data_length, message, &encoded);
  if (rcembed != resultf) {
    printf("Test Failed\n");
    if (encoded != NULL) {
      free(encoded);
      encoded = NULL;
    }
    return;
  } else {
    printf("Yay it worked! WoooHoo!!!\n");
  }
  if (image_data != NULL) {
    printf("Compare arrays:\n");
    printf("  encode:    result:");
    for (idx = 0; idx < data_length; idx++) {
      if ((idx % 8) == 0) {
        printf("\n");
      }
      printf("%3d: 0x%02x == 0x%02x (%s)\n", idx, (unsigned char)encoded[idx], (unsigned char)resultem[idx], ((unsigned char)encoded[idx] == (unsigned char)resultem[idx] ? "true" : "false"));
    }
  }
  printf("\n\n");
  if (encoded != NULL) {
    free(encoded);
    encoded = NULL;
  }
}
```