user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<create_fg_image>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %edx,-0x24(%rbp)
  movl   $0x0,-0x10(%rbp)
  mov    $0x465000,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    $0x465000,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  movl   $0x0,-0xc(%rbp)
  jmp    L39
L58:
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    -0xc(%rbp),%edx
  movslq %edx,%rcx
  mov    -0x20(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rdx),%edx
  sub    %edx,%eax
  movzbl %al,%eax
  mov    %eax,%edi
  call   <abs@plt>
  cmp    %eax,-0x24(%rbp)
  jge    L59
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    -0xc(%rbp),%edx
  movslq %edx,%rcx
  mov    -0x8(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rax),%eax
  mov    %al,(%rdx)
  jmp    L84
L59:
  mov    -0x10(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x10(%rbp)
L84:
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    -0xc(%rbp),%edx
  movslq %edx,%rdx
  lea    0x1(%rdx),%rcx
  mov    -0x20(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rdx),%edx
  sub    %edx,%eax
  movzbl %al,%eax
  mov    %eax,%edi
  call   <abs@plt>
  cmp    %eax,-0x24(%rbp)
  jge    L98
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    -0xc(%rbp),%edx
  movslq %edx,%rdx
  lea    0x1(%rdx),%rcx
  mov    -0x8(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rax),%eax
  mov    %al,(%rdx)
  jmp    L64
L98:
  mov    -0x10(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x10(%rbp)
L64:
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x2(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    -0xc(%rbp),%edx
  movslq %edx,%rdx
  lea    0x2(%rdx),%rcx
  mov    -0x20(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rdx),%edx
  sub    %edx,%eax
  movzbl %al,%eax
  mov    %eax,%edi
  call   <abs@plt>
  cmp    %eax,-0x24(%rbp)
  jge    L51
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x2(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    -0xc(%rbp),%edx
  movslq %edx,%rdx
  lea    0x2(%rdx),%rcx
  mov    -0x8(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rax),%eax
  mov    %al,(%rdx)
  jmp    L65
L51:
  mov    -0x10(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x10(%rbp)
L65:
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x3(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    -0xc(%rbp),%edx
  movslq %edx,%rdx
  lea    0x3(%rdx),%rcx
  mov    -0x20(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rdx),%edx
  sub    %edx,%eax
  movzbl %al,%eax
  mov    %eax,%edi
  call   <abs@plt>
  cmp    %eax,-0x24(%rbp)
  jge    L91
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x3(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    -0xc(%rbp),%edx
  movslq %edx,%rdx
  lea    0x3(%rdx),%rcx
  mov    -0x8(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rax),%eax
  mov    %al,(%rdx)
  jmp    L50
L91:
  mov    -0x10(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x10(%rbp)
L50:
  addl   $0x5,-0xc(%rbp)
L39:
  cmpl   $0x464fff,-0xc(%rbp)
  jle    L58
  pxor   %xmm0,%xmm0
  cvtsi2sdl -0x10(%rbp),%xmm0
  movsd  D8(%rip),%xmm2
  movapd %xmm0,%xmm1
  divsd  %xmm2,%xmm1
  movsd  D28(%rip),%xmm0
  mulsd  %xmm1,%xmm0
  cvttsd2si %xmm0,%edx
  mov    -0x10(%rbp),%eax
  mov    $0x384000,%ecx
  mov    %eax,%esi
  lea    D27(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    -0x8(%rbp),%rax
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D8
datatype: byte[8]
name: extract_symbolic_data
arguments: data_label: D28
datatype: f64
name: extract_symbolic_data
arguments: data_label: D27
datatype: string

tool: {"D8": [0x00,0x00,0x00,0x00,0x00,0x20,0x4c,0x41]}

tool: D28: 100

tool: D27: %d (%2.1f %) of Total %d is subtracted.


assistant: ```c
unsigned char *create_fg_image(unsigned char *input, unsigned char *bg, int threshold) {
  int subtracted_cnt = 0;
  int i;
  unsigned char *out = (unsigned char *)malloc(4608000 * sizeof(unsigned char));
  memset(out, 0, 4608000 * sizeof(unsigned char));
  for (i = 0; i < 4608000; i += 5) {
    (abs(input[i] - bg[i]) > threshold) ? out[i] = input[i] : subtracted_cnt++;
    (abs(input[i + 1] - bg[i + 1]) > threshold) ? out[i + 1] = input[i + 1] : subtracted_cnt++;
    (abs(input[i + 2] - bg[i + 2]) > threshold) ? out[i + 2] = input[i + 2] : subtracted_cnt++;
    (abs(input[i + 3] - bg[i + 3]) > threshold) ? out[i + 3] = input[i + 3] : subtracted_cnt++;
  }
  printf("%d (%2.1f %) of Total %d is subtracted.\n", subtracted_cnt, (subtracted_cnt / (double)3686400) * 100.0, 3686400);
  return out;
}
```