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

```asm
<GetVideoMemSize>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  movl   $0x0,-0x1c(%rbp)
  mov    $0x8414,%edi
  call   <gfx_read_reg32@plt>
  mov    %eax,-0x10(%rbp)
  mov    $0x8408,%edi
  call   <gfx_read_reg32@plt>
  mov    %eax,-0xc(%rbp)
  movl   $0x4,-0x14(%rbp)
  movl   $0x7ff,-0x8(%rbp)
  movl   $0x13,-0x4(%rbp)
  movl   $0x0,-0x18(%rbp)
  jmp    L23
L115:
  mov    -0x14(%rbp),%eax
  mov    -0xc(%rbp),%edx
  mov    %eax,%ecx
  shr    %cl,%edx
  mov    %edx,%eax
  and    $0x7,%eax
  cmp    $0x7,%eax
  je     L16
  mov    -0x14(%rbp),%eax
  add    $0x4,%eax
  mov    -0xc(%rbp),%edx
  mov    %eax,%ecx
  shr    %cl,%edx
  mov    %edx,%eax
  and    $0x7,%eax
  cmp    $0x7,%eax
  ja     L21
  mov    %eax,%eax
  lea    0x0(,%rax,4),%rdx
  lea    D9(%rip),%rax
  mov    (%rdx,%rax,1),%eax
  cltq
  lea    D9(%rip),%rdx
  add    %rdx,%rax
  notrack jmp *%rax
  addl   $0x400000,-0x1c(%rbp)
  jmp    L16
  addl   $0x800000,-0x1c(%rbp)
  jmp    L16
  addl   $0x1000000,-0x1c(%rbp)
  jmp    L16
  addl   $0x2000000,-0x1c(%rbp)
  jmp    L16
  addl   $0x4000000,-0x1c(%rbp)
  jmp    L16
  addl   $0x8000000,-0x1c(%rbp)
  jmp    L16
  addl   $0x10000000,-0x1c(%rbp)
  jmp    L16
  addl   $0x20000000,-0x1c(%rbp)
  jmp    L16
L21:
  nop
L16:
  addl   $0x10,-0x14(%rbp)
  addl   $0x1,-0x18(%rbp)
L23:
  cmpl   $0x1,-0x18(%rbp)
  jle    L115
  mov    -0x8(%rbp),%eax
  and    %eax,-0x10(%rbp)
  mov    -0x4(%rbp),%eax
  mov    %eax,%ecx
  shll   %cl,-0x10(%rbp)
  mov    -0x1c(%rbp),%eax
  sub    -0x10(%rbp),%eax
  leave
  ret
```

assistant: ```c
unsigned int GetVideoMemSize(void) {
  unsigned int graphicsMemBaseAddr;
  unsigned int totalMem = 0;
  int i;
  unsigned int graphicsMemMask, graphicsMemShift;
  graphicsMemBaseAddr = gfx_read_reg32(0x8414);
  if (1) {
    unsigned int mcBankCfg = gfx_read_reg32(0x8408);
    unsigned int dimmShift = 4;
    graphicsMemMask = 0x7FF;
    graphicsMemShift = 19;
    for (i = 0; i < 2; i++) {
      if (((mcBankCfg >> dimmShift) & 0x7) != 0x7) {
        switch ((mcBankCfg >> (dimmShift + 4)) & 0x7) {
        case 0:
          totalMem += 0x400000;
          break;
        case 1:
          totalMem += 0x800000;
          break;
        case 2:
          totalMem += 0x1000000;
          break;
        case 3:
          totalMem += 0x2000000;
          break;
        case 4:
          totalMem += 0x4000000;
          break;
        case 5:
          totalMem += 0x8000000;
          break;
        case 6:
          totalMem += 0x10000000;
          break;
        case 7:
          totalMem += 0x20000000;
          break;
        default:
          break;
        }
      }
      dimmShift += 16;
    }
  } else {
    unsigned int mcMemCntrl1 = gfx_read_reg32(0x8400);
    unsigned int bankSizeShift = 12;
    graphicsMemMask = 0x3FF;
    graphicsMemShift = 17;
    for (i = 0; i < 4; i++) {
      switch ((mcMemCntrl1 >> bankSizeShift) & 0x7) {
      case 1:
        totalMem += 0x200000;
        break;
      case 2:
        totalMem += 0x400000;
        break;
      case 3:
        totalMem += 0x800000;
        break;
      case 4:
        totalMem += 0x1000000;
        break;
      case 5:
        totalMem += 0x2000000;
        break;
      default:
        break;
      }
      bankSizeShift += 3;
    }
  }
  graphicsMemBaseAddr &= graphicsMemMask;
  graphicsMemBaseAddr <<= graphicsMemShift;
  return (totalMem - graphicsMemBaseAddr);
}
```