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

```asm
<cfg_set_regions>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x48(%rbp)
  mov    -0x48(%rbp),%rax
  mov    %rax,-0x18(%rbp)
L25:
  mov    -0x18(%rbp),%rax
  mov    (%rax),%eax
  mov    %eax,-0x3c(%rbp)
  mov    -0x18(%rbp),%rax
  add    $0x4,%rax
  mov    (%rax),%eax
  mov    %eax,-0x38(%rbp)
  cmpl   $0x0,-0x3c(%rbp)
  je     L64
  mov    -0x18(%rbp),%rax
  add    $0x14,%rax
  mov    (%rax),%eax
  shl    $0x18,%eax
  mov    %eax,%edx
  mov    -0x18(%rbp),%rax
  add    $0x10,%rax
  mov    (%rax),%eax
  shl    $0x10,%eax
  or     %eax,%edx
  mov    -0x18(%rbp),%rax
  add    $0xc,%rax
  mov    (%rax),%eax
  shl    $0x8,%eax
  or     %eax,%edx
  mov    -0x18(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%eax
  or     %edx,%eax
  mov    %eax,-0x34(%rbp)
  mov    -0x34(%rbp),%eax
  cltq
  mov    %rax,-0x10(%rbp)
  addq   $0x18,-0x18(%rbp)
  cmpl   $0x1,-0x3c(%rbp)
  jne    L11
  mov    -0x18(%rbp),%rax
  mov    (%rax),%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x18(%rbp),%rax
  add    $0x4,%rax
  mov    (%rax),%eax
  mov    %eax,-0x20(%rbp)
  mov    -0x24(%rbp),%eax
  shl    $0x8,%eax
  or     -0x38(%rbp),%eax
  mov    %eax,-0x1c(%rbp)
  mov    -0x1c(%rbp),%edx
  mov    -0x20(%rbp),%ecx
  mov    -0x10(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  addq   $0x8,-0x18(%rbp)
  jmp    L25
L11:
  cmpl   $0x2,-0x3c(%rbp)
  jne    L50
  movl   $0x0,-0x40(%rbp)
  jmp    L65
L23:
  mov    -0x18(%rbp),%rax
  mov    (%rax),%eax
  mov    %eax,-0x2c(%rbp)
  mov    -0x18(%rbp),%rax
  add    $0x4,%rax
  mov    (%rax),%eax
  mov    %eax,-0x28(%rbp)
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x10(%rbp),%rax
  add    %rax,%rdx
  mov    -0x28(%rbp),%eax
  mov    %eax,(%rdx)
  addq   $0x8,-0x18(%rbp)
  addl   $0x1,-0x40(%rbp)
L65:
  mov    -0x40(%rbp),%eax
  cmp    -0x38(%rbp),%eax
  jl     L23
  jmp    L25
L50:
  cmpl   $0x3,-0x3c(%rbp)
  jne    L13
  mov    -0x38(%rbp),%edx
  mov    -0x18(%rbp),%rcx
  mov    -0x10(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x38(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rax,-0x18(%rbp)
  jmp    L25
L13:
  cmpl   $0x4,-0x3c(%rbp)
  jne    L25
  mov    -0x18(%rbp),%rax
  add    $0xc,%rax
  mov    (%rax),%eax
  shl    $0x18,%eax
  mov    %eax,%edx
  mov    -0x18(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%eax
  shl    $0x10,%eax
  or     %eax,%edx
  mov    -0x18(%rbp),%rax
  add    $0x4,%rax
  mov    (%rax),%eax
  shl    $0x8,%eax
  or     %eax,%edx
  mov    -0x18(%rbp),%rax
  mov    (%rax),%eax
  or     %edx,%eax
  mov    %eax,-0x30(%rbp)
  mov    -0x30(%rbp),%eax
  cltq
  mov    %rax,-0x8(%rbp)
  mov    -0x38(%rbp),%edx
  mov    -0x8(%rbp),%rcx
  mov    -0x10(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  addq   $0x10,-0x18(%rbp)
  jmp    L25
L64:
  nop
  nop
  leave
  ret
```

assistant: ```c
void cfg_set_regions(const uint8_t *cfg_base_addr) {
  const uint8_t *tbl = cfg_base_addr;
  while (1) {
    uint8_t table_type = tbl[0];
    uint8_t count_low = tbl[1];
    if (table_type == 0)
      break;
    uint32_t addr = (tbl[5] << 24) | (tbl[4] << 16) | (tbl[3] << 8) | tbl[2];
    uint8_t *ap = (uint8_t *)((size_t)addr);
    tbl += 6;
    if (table_type == 1) {
      uint8_t count_hi = tbl[0];
      uint8_t value = tbl[1];
      uint16_t count = (count_hi << 8) | count_low;
      memset(ap, value, count);
      tbl += 2;
    } else if (table_type == 2) {
      uint8_t i;
      for (i = 0; i < count_low; i++) {
        uint8_t offset = tbl[0];
        uint8_t value = tbl[1];
        ap[offset] = value;
        tbl += 2;
      }
    } else if (table_type == 3) {
      memcpy(ap, tbl, count_low);
      tbl += count_low;
    } else if (table_type == 4) {
      uint32_t saddr = (tbl[3] << 24) | (tbl[2] << 16) | (tbl[1] << 8) | tbl[0];
      uint8_t *sap = (uint8_t *)((size_t)saddr);
      memcpy(ap, sap, count_low);
      tbl += 4;
    } else {
    }
  }
}
```