user: Converte this assembly snippet into its equivalent C code:

```asm
<UARTConfigSet>:
  endbr64
  push   %r13
  mov    %rdx,%r13
  and    $0x1600,%edx
  push   %r12
  and    $0x3000,%r13d
  mov    %rdx,%r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x8,%rsp
  cmp    $0x40013800,%rdi
  je     L28
  cmp    $0x40004400,%rdi
  je     L3
  cmp    $0x40004800,%rdi
  je     L23
  cmp    $0x40004c00,%rdi
  je     L32
  mov    $0x20100010,%edi
  call   <SysCtlPeripheralReset@plt>
L51:
  mov    0x10(%rbx),%rax
  and    $0xcf,%ah
  mov    %rax,0x10(%rbx)
  mov    %r13,0x10(%rbx)
  mov    0xc(%rbx),%rax
  and    $0xffffffffffffe9f3,%rax
  mov    %rax,0xc(%rbx)
  xor    %eax,%eax
  mov    %r12,0xc(%rbx)
  call   <SysCtlAPB1ClockGet@plt>
L38:
  lea    (%rax,%rax,4),%rax
  mov    0xc(%rbx),%rdx
  xor    %edx,%edx
  shl    $0x2,%rbp
  movabs $0x28f5c28f5c28f5c3,%rdi
  lea    (%rax,%rax,4),%rax
  div    %rbp
  mov    %rax,%rdx
  mov    %rax,%rcx
  shr    $0x2,%rdx
  mov    %rdx,%rax
  mul    %rdi
  mov    0xc(%rbx),%rax
  shr    $0x2,%rdx
  lea    (%rdx,%rdx,4),%rax
  mov    %rdx,%rsi
  lea    (%rax,%rax,4),%rax
  shl    $0x4,%rsi
  shl    $0x2,%rax
  sub    %rax,%rcx
  mov    %rcx,%rdx
  shl    $0x4,%rdx
  add    $0x32,%rdx
  shr    $0x2,%rdx
  mov    %rdx,%rax
  mul    %rdi
  shr    $0x2,%rdx
  and    $0xf,%edx
  or     %rsi,%rdx
  mov    %rdx,0x8(%rbx)
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax,%rax,1)
L28:
  mov    $0x10004000,%edi
  call   <SysCtlPeripheralReset@plt>
  mov    0x40013810,%rax
  and    $0xcf,%ah
  mov    %rax,0x40013810
  mov    %r13,0x40013810
  mov    0x4001380c,%rax
  and    $0xffffffffffffe9f3,%rax
  mov    %rax,0x4001380c
  xor    %eax,%eax
  mov    %r12,0x4001380c
  call   <SysCtlAPB2ClockGet@plt>
  jmp    L38
  nop
L32:
  mov    $0x20100008,%edi
  call   <SysCtlPeripheralReset@plt>
  jmp    L51
  nop
L3:
  mov    $0x20100002,%edi
  call   <SysCtlPeripheralReset@plt>
  jmp    L51
  nop
L23:
  mov    $0x20100004,%edi
  call   <SysCtlPeripheralReset@plt>
  jmp    L51
```

assistant: ```c
void UARTConfigSet(unsigned long ulBase, unsigned long ulBaud, unsigned long ulConfig) {
  unsigned long ulExtClk, ultemp, uldiv;
  ;
  ;
  if (ulBase == 0x40013800) {
    SysCtlPeripheralReset(0x10004000);
  } else if (ulBase == 0x40004400) {
    SysCtlPeripheralReset(0x20100002);
  } else if (ulBase == 0x40004800) {
    SysCtlPeripheralReset(0x20100004);
  } else if (ulBase == 0x40004C00) {
    SysCtlPeripheralReset(0x20100008);
  } else {
    SysCtlPeripheralReset(0x20100010);
  }
  (*((volatile unsigned long *)(ulBase + 0x00000010))) &= ~0x00003000;
  (*((volatile unsigned long *)(ulBase + 0x00000010))) = ulConfig & 0x00003000;
  (*((volatile unsigned long *)(ulBase + 0x0000000C))) &= ~(0x00001000 | 0x00000400 | 0x00000200 | 0x00000008 | 0x00000004);
  (*((volatile unsigned long *)(ulBase + 0x0000000C))) = ulConfig & (0x00001000 | 0x00000600);
  if (ulBase == 0x40013800) {
    ulExtClk = SysCtlAPB2ClockGet();
  } else {
    ulExtClk = SysCtlAPB1ClockGet();
  }
  if (((*((volatile unsigned long *)(ulBase + 0x0000000C))) & 0) != 0) {
    ultemp = ((25 * ulExtClk) / (2 * (ulBaud)));
  } else {
    ultemp = ((25 * ulExtClk) / (4 * (ulBaud)));
  }
  uldiv = (ultemp / 100) << 4;
  ultemp = ultemp - (100 * (uldiv >> 4));
  if (((*((volatile unsigned long *)(ulBase + 0x0000000C))) & 0) != 0) {
    uldiv |= ((((ultemp * 8) + 50) / 100)) & ((unsigned char)0x07);
  } else {
    uldiv |= ((((ultemp * 16) + 50) / 100)) & ((unsigned char)0x0F);
  }
  (*((volatile unsigned long *)(ulBase + 0x00000008))) = uldiv;
}
```