user: What would the C source look like for the assembly code provided here?

```asm
<xml_write_to_mtd>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x20,%rsp
  mov    (%rdi),%rdi
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  movq   $0x0,0x8(%rsp)
  movq   $0x0,0x10(%rsp)
  test   %rdi,%rdi
  je     L76
  cmpq   $0x0,(%rdx)
  mov    %rdx,%r12
  je     L76
  test   %esi,%esi
  je     L45
L99:
  call   <strlen@plt>
  lea    0x6(%rax),%edi
  mov    %eax,%ebp
  call   <malloc@plt>
  mov    (%rbx),%rsi
  mov    %rax,%rdi
  mov    %rax,0x8(%rsp)
  call   <strcpy@plt>
  mov    (%rbx),%rdi
  lea    0x1(%rbp),%esi
  call   <crc32@plt>
  mov    0x8(%rsp),%rcx
  movslq %ebp,%rdx
  mov    %rax,%rsi
  mov    %al,0x1(%rcx,%rdx,1)
  mov    0x8(%rsp),%rcx
  shr    $0x10,%rsi
  mov    %ah,0x2(%rcx,%rdx,1)
  mov    0x8(%rsp),%rcx
  shr    $0x18,%rax
  mov    %sil,0x3(%rcx,%rdx,1)
  mov    0x8(%rsp),%rcx
  lea    0x8(%rsp),%rsi
  mov    %al,0x4(%rcx,%rdx,1)
  mov    0x8(%rsp),%rax
  movb   $0x0,0x9(%rax,%rdx,1)
  mov    (%r12),%rdi
  call   <write_block_device@plt>
  mov    0x8(%rsp),%rdi
  mov    %eax,%r12d
  call   <free@plt>
L30:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L34
  add    $0x20,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax)
L45:
  lea    D16(%rip),%rdi
  call   <printf@plt>
  lea    0x10(%rsp),%rsi
  lea    D34(%rip),%rdi
  call   <scanf@plt>
  cmp    $0x1,%eax
  je     L89
L47:
  mov    $0x1,%r12d
  jmp    L30
  nopw   0x0(%rax,%rax,1)
L76:
  lea    D4(%rip),%rdi
  mov    $0x1,%r12d
  call   <perror@plt>
  jmp    L30
  nopl   0x0(%rax)
L89:
  mov    0x10(%rsp),%rdi
  mov    $0x1,%edx
  lea    D35(%rip),%rsi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L47
  mov    0x10(%rsp),%rdi
  test   %rdi,%rdi
  je     L38
  call   <free@plt>
L38:
  mov    (%rbx),%rdi
  jmp    L99
L34:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_tag: D16
datatype: string
name: disassemble_data
arguments: data_tag: D34
datatype: string
name: disassemble_data
arguments: data_tag: D4
datatype: string
name: disassemble_data
arguments: data_tag: D35
datatype: string

tool: D16: Update RedBoot non-volatile configuration - continue (y/n)? 

tool: D34: %a[a-z]

tool: D4: Error writing to device: Insufficient Data


tool: D35: y

assistant: ```c
int xml_write_to_mtd(char **fisroot_str, int assume_yes, char **target) {
  int ret = 0;
  int len = 0;
  char *tmp_str = NULL;
  char *affirm = NULL;
  unsigned long checksum;
  if ((!*fisroot_str) || (!*target)) {
    perror("Error writing to device: Insufficient Data\n");
    return 1;
  }
  if (!assume_yes) {
    printf("Update RedBoot non-volatile configuration - continue (y/n)? ");
    ret = scanf("%a[a-z]", &affirm);
    if (ret == 1) {
      if (strncmp(affirm, "y", 1))
        return 1;
    } else {
      return 1;
    }
    ret = 0;
    if (affirm)
      free(affirm);
  };
  len = strlen(*fisroot_str);
  tmp_str = malloc(len + 6);
  strcpy(tmp_str, *fisroot_str);
  checksum = crc32((unsigned char *)*fisroot_str, len + 1);
  *(tmp_str + len + 1) = checksum & 0xFF;
  *(tmp_str + len + 2) = (checksum >> 8) & 0xFF;
  *(tmp_str + len + 3) = (checksum >> 16) & 0xFF;
  *(tmp_str + len + 4) = (checksum >> 24) & 0xFF;
  ;
  tmp_str[len + sizeof checksum + 1] = '\0';
  ;
  ret = write_block_device(*target, &tmp_str);
  free(tmp_str);
  return ret;
}
```