user: Demonstrate the C code that generates the assembly output below:

```asm
<write_fru_data>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x78,%rsp
  mov    %rdx,0x10(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x68(%rsp)
  xor    %eax,%eax
  mov    %dil,0x40(%rsp)
  test   %ecx,%ecx
  jle    L28
  mov    %ecx,%r14d
  mov    %esi,%r13d
  mov    %r8d,%r15d
  mov    $0x0,%ebp
  mov    $0x10,%ebx
  lea    0x40(%rsp),%rax
  mov    %rax,0x8(%rsp)
  jmp    L4
L21:
  lea    0x3(%rbx),%edx
  mov    %ebp,%esi
  lea    D0(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    %ebx,%eax
  add    $0x2,%eax
  js     L105
  mov    $0x0,%r12d
  mov    %ebx,0x18(%rsp)
  mov    %ebp,0x1c(%rsp)
  mov    %eax,%ebx
  mov    0x8(%rsp),%rbp
L49:
  movzbl (%r12,%rbp,1),%esi
  lea    D19(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  add    $0x1,%r12
  cmp    %r12d,%ebx
  jge    L49
  mov    0x18(%rsp),%ebx
  mov    0x1c(%rsp),%ebp
L105:
  mov    $0xa,%edi
  call   <putchar@plt>
  jmp    L24
L28:
  mov    $0xffffffff,%r12d
  jmp    L14
L97:
  test   %r15b,%r15b
  je     L104
  movzbl 0x30(%rsp),%edx
  mov    %ebp,%esi
  lea    D1(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L104:
  add    %ebx,%r13d
  add    %ebx,%ebp
  cmp    %ebp,%r14d
  jle    L14
L4:
  mov    %r13b,0x41(%rsp)
  mov    %r13d,%eax
  movzbl %ah,%eax
  mov    %al,0x42(%rsp)
  lea    (%rbx,%rbp,1),%edx
  mov    %r14d,%eax
  sub    %ebp,%eax
  cmp    %r14d,%edx
  cmovg  %eax,%ebx
  movslq %ebp,%rsi
  add    0x10(%rsp),%rsi
  lea    0x43(%rsp),%rdi
  mov    %ebx,%edx
  call   <memcpy@plt>
  test   %r15b,%r15b
  jne    L21
L24:
  movl   $0x10,0x2c(%rsp)
  lea    0x30(%rsp),%rcx
  lea    0x3(%rbx),%edx
  movzbl %dl,%edx
  sub    $0x8,%rsp
  movsbl %r15b,%eax
  push   %rax
  lea    0x3b(%rsp),%r9
  lea    0x3c(%rsp),%r8
  mov    0x18(%rsp),%rsi
  mov    $0xa12,%edi
  call   <ipmi_cmd_mc@plt>
  mov    %eax,%r12d
  add    $0x10,%rsp
  test   %eax,%eax
  jne    L14
  movzbl 0x2b(%rsp),%eax
  test   %al,%al
  je     L97
  movzbl %al,%r12d
L14:
  mov    0x68(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L115
  mov    %r12d,%eax
  add    $0x78,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L115:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: label: D0
type_guessed: string
name: retrieve_data
arguments: label: D19
type_guessed: string
name: retrieve_data
arguments: label: D1
type_guessed: string

tool: D0: write_fru_data[%d] (len=%d): 

tool: D19: %02x 

tool: D1: write_fru_data[%d]: %d bytes written


assistant: ```c
int write_fru_data(unsigned char id, unsigned short offset, unsigned char *data, int dlen, char fdebug) {
  int ret = -1;
  int chunk;
  unsigned short fruoff;
  unsigned char req[25];
  unsigned char resp[16];
  int sresp;
  unsigned char cc;
  int i, j;
  req[0] = id;
  fruoff = offset;
  chunk = 16;
  for (i = 0; i < dlen; i += chunk) {
    req[1] = fruoff & 0x00ff;
    req[2] = (fruoff & 0xff00) >> 8;
    if ((i + chunk) > dlen)
      chunk = dlen - i;
    memcpy(&req[3], &data[i], chunk);
    if (fdebug) {
      printf("write_fru_data[%d] (len=%d): ", i, chunk + 3);
      for (j = 0; j < chunk + 3; j++)
        printf("%02x ", req[j]);
      printf("\n");
    }
    sresp = sizeof(resp);
    ret = ipmi_cmd_mc((0x12 | (0x0a << 8)), req, (unsigned char)(chunk + 3), resp, &sresp, &cc, fdebug);
    if ((ret == 0) && (cc != 0))
      ret = cc & 0x00ff;
    if (fdebug && ret == 0)
      printf("write_fru_data[%d]: %d bytes written\n", i, resp[0]);
    if (ret != 0)
      break;
    fruoff += chunk;
  }
  return (ret);
}
```