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

```asm
<TestPutCharIntoArrayEx>:
  endbr64
  push   %r15
  mov    %rdx,%r15
  mov    $0x9,%edx
  push   %r14
  mov    %r8d,%r14d
  push   %r13
  movsbl %r14b,%r14d
  push   %r12
  push   %rbp
  push   %rbx
  mov    %ecx,%ebx
  sub    $0x48,%rsp
  mov    %rdi,0x10(%rsp)
  lea    0x2f(%rsp),%r12
  mov    0x80(%rsp),%r13
  mov    %esi,0x1c(%rsp)
  mov    %r12,%rdi
  xor    %esi,%esi
  mov    %r9d,0x18(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  call   <memset@plt>
  mov    %r14d,0xc(%rsp)
  test   %r15,%r15
  je     L134
  test   %ebx,%ebx
  jg     L155
L134:
  mov    0xc(%rsp),%edi
  call   <isprint@plt>
  test   %rax,%rax
  je     L1
  sub    $0x8,%rsp
  mov    %r15,%r9
  lea    D53(%rip),%rdi
  xor    %eax,%eax
  push   %rbx
  mov    0x1c(%rsp),%r14d
  mov    0x2c(%rsp),%edx
  mov    0x20(%rsp),%rsi
  mov    %r14d,%r8d
  mov    %r14d,%ecx
  call   <printf@plt>
  mov    %r14d,%edx
  xor    %edi,%edi
  mov    %ebx,%esi
  call   <PutCharIntoArray@plt>
  mov    0x28(%rsp),%r14d
  lea    D150(%rip),%rdi
  mov    %eax,%ebp
  mov    %eax,%esi
  xor    %eax,%eax
  mov    %r14d,%edx
  call   <printf@plt>
  cmp    %r14d,%ebp
L132:
  sete   %dil
  movzbl %dil,%edi
  call   <assert@plt>
  pop    %rax
  pop    %rdx
  test   %r14d,%r14d
  je     L92
L83:
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L126
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L155:
  mov    %ebx,%edi
  call   <malloc@plt>
  mov    %ebx,%edx
  mov    %r15,%rsi
  mov    %rax,%rdi
  mov    %rax,(%rsp)
  mov    %rax,%rbp
  call   <memcpy@plt>
  mov    %r14d,%edi
  call   <isprint@plt>
  mov    $0x2e,%r8d
  mov    %r14d,%ecx
  mov    %r15,%r9
  test   %rax,%rax
  lea    D53(%rip),%rdi
  cmovne %r14d,%r8d
  sub    $0x8,%rsp
  xor    %eax,%eax
  push   %rbx
  mov    0x2c(%rsp),%edx
  mov    0x20(%rsp),%rsi
  call   <printf@plt>
  pop    %rcx
  pop    %rsi
  test   %rbp,%rbp
  je     L147
  xor    %r14d,%r14d
L121:
  mov    (%rsp),%rax
  mov    $0x9,%edx
  mov    %r12,%rsi
  lea    (%rax,%r14,1),%r15
  movsbl (%r15),%edi
  call   <BinString@plt>
  movzbl (%r15),%edx
  mov    %r14d,%esi
  lea    D44(%rip),%rdi
  mov    %rax,%rcx
  add    $0x1,%r14
  xor    %eax,%eax
  call   <printf@plt>
  cmp    %r14d,%ebx
  jg     L121
  mov    0xc(%rsp),%edx
  mov    (%rsp),%rdi
  mov    %ebx,%esi
  call   <PutCharIntoArray@plt>
  mov    0x18(%rsp),%r15d
  lea    D150(%rip),%rdi
  mov    %eax,%r14d
  mov    %eax,%esi
  xor    %eax,%eax
  mov    %r15d,%edx
  call   <printf@plt>
  xor    %edi,%edi
  cmp    %r14d,%r15d
  sete   %dil
  call   <assert@plt>
  test   %r15d,%r15d
  je     L40
L42:
  mov    %rbp,%rdi
  call   <free@plt>
  jmp    L83
  nopl   0x0(%rax,%rax,1)
L1:
  sub    $0x8,%rsp
  mov    %r15,%r9
  mov    $0x2e,%r8d
  xor    %eax,%eax
  push   %rbx
  mov    0x1c(%rsp),%r14d
  lea    D53(%rip),%rdi
  mov    0x2c(%rsp),%edx
  mov    0x20(%rsp),%rsi
  mov    %r14d,%ecx
  call   <printf@plt>
  mov    %r14d,%edx
  xor    %edi,%edi
  mov    %ebx,%esi
  call   <PutCharIntoArray@plt>
  mov    0x28(%rsp),%r14d
  lea    D150(%rip),%rdi
  mov    %eax,%ebp
  mov    %eax,%esi
  xor    %eax,%eax
  mov    %r14d,%edx
  call   <printf@plt>
  cmp    %ebp,%r14d
  jmp    L132
  nopl   0x0(%rax,%rax,1)
L92:
  lea    D136(%rip),%rdi
  xor    %ebp,%ebp
  mov    $0x1,%r14d
  call   <puts@plt>
  lea    D36(%rip),%rdi
  call   <puts@plt>
  test   %ebx,%ebx
  jle    L129
L142:
  xor    %r15d,%r15d
  mov    $0x1,%r14d
  nopl   0x0(%rax)
L35:
  movsbl 0x0(%r13,%r15,1),%edi
  mov    $0x9,%edx
  mov    %r12,%rsi
  call   <BinString@plt>
  movzbl 0x0(%r13,%r15,1),%edx
  mov    %r15d,%esi
  lea    D68(%rip),%rdi
  mov    %rax,%rcx
  xor    %eax,%eax
  call   <printf@plt>
  movsbl 0x0(%rbp,%r15,1),%edi
  mov    $0x9,%edx
  mov    %r12,%rsi
  call   <BinString@plt>
  movzbl 0x0(%rbp,%r15,1),%esi
  lea    D130(%rip),%rdi
  mov    %rax,%rdx
  xor    %eax,%eax
  call   <printf@plt>
  movzbl 0x0(%r13,%r15,1),%eax
  lea    D77(%rip),%rdi
  cmp    %al,0x0(%rbp,%r15,1)
  lea    D143(%rip),%rax
  cmove  %rax,%rdi
  call   <puts@plt>
  test   %r14d,%r14d
  je     L79
  xor    %r14d,%r14d
  movzbl 0x0(%r13,%r15,1),%eax
  cmp    %al,0x0(%rbp,%r15,1)
  sete   %r14b
L79:
  add    $0x1,%r15
  cmp    %r15d,%ebx
  jg     L35
L129:
  mov    %r14d,%edi
  call   <assert@plt>
  test   %rbp,%rbp
  jne    L42
  jmp    L83
L147:
  mov    0xc(%rsp),%edx
  xor    %edi,%edi
  mov    %ebx,%esi
  call   <PutCharIntoArray@plt>
  mov    0x18(%rsp),%r15d
  lea    D150(%rip),%rdi
  mov    %eax,%r14d
  mov    %eax,%esi
  xor    %eax,%eax
  mov    %r15d,%edx
  call   <printf@plt>
  xor    %edi,%edi
  cmp    %r14d,%r15d
  sete   %dil
  call   <assert@plt>
  test   %r15d,%r15d
  jne    L83
  nopw   0x0(%rax,%rax,1)
L40:
  lea    D136(%rip),%rdi
  call   <puts@plt>
  lea    D36(%rip),%rdi
  call   <puts@plt>
  jmp    L142
L126:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: label: D53
type: string
name: read_data
arguments: label: D150
type: string
name: read_data
arguments: label: D44
type: string
name: read_data
arguments: label: D136
type: string
name: read_data
arguments: label: D36
type: string
name: read_data
arguments: label: D68
type: string
name: read_data
arguments: label: D130
type: string
name: read_data
arguments: label: D77
type: string
name: read_data
arguments: label: D143
type: string

tool: D53: 
[%s:%d]
Put char (0x%02x) '%c' into array (0x%p) of size (%d): {


tool: D150:   }  == %d : expecting %d


tool: D44:     [%2d]: (0x%02.2x) "%s"


tool: D136: Compare resulting array to expected result

tool: D36:        expected                       result

tool: D68:   [%2d]: (0x%02.2x) "%s" == 

tool: D130: (0x%02.2x) "%s" : 

tool: D77: false

tool: D143: true

assistant: ```c
void TestPutCharIntoArrayEx(const char *fname, const int line, char *srcArray, const int sz, char msg, const int result, char *resArray) {
  char *tmpArray = NULL;
  int rc = 0, idx = 0, cmpRes = 0;
  char buf[9];
  memset(buf, 0, sizeof(char) * 9);
  if (srcArray && (sz > 0)) {
    tmpArray = (char *)malloc(sizeof(char) * sz);
    memcpy(tmpArray, srcArray, sz);
  }
  printf("\n[%s:%d]\nPut char (0x%02x) '%c' into array (0x%p) of size (%d): {\n", fname, line, msg, (isprint(msg) ? msg : '.'), srcArray, sz);
  if (tmpArray && (sz >= 1)) {
    for (idx = 0; idx < sz; ++idx) {
      printf("    [%2d]: (0x%02.2x) \"%s\"\n", idx, (((int)tmpArray[idx]) & 0x000000ff), BinString(tmpArray[idx], buf, 9));
    }
  }
  rc = PutCharIntoArray(tmpArray, sz, msg);
  printf("  }  == %d : expecting %d\n", rc, result);
  assert(rc == result);
  if (result == 0) {
    cmpRes = 1;
    printf("Compare resulting array to expected result\n");
    printf("       expected                       result\n");
    for (idx = 0; idx < sz; ++idx) {
      printf("  [%2d]: (0x%02.2x) \"%s\" == ", idx, (((int)resArray[idx]) & 0x000000ff), BinString(resArray[idx], buf, 9));
      printf("(0x%02.2x) \"%s\" : ", (((int)tmpArray[idx]) & 0x000000ff), BinString(tmpArray[idx], buf, 9));
      printf("%s\n", (tmpArray[idx] == resArray[idx] ? "true" : "false"));
      cmpRes = cmpRes && (tmpArray[idx] == resArray[idx]);
    }
    assert(cmpRes != 0);
  }
  if (tmpArray) {
    free(tmpArray);
    tmpArray = NULL;
  }
}
```