user: What is the c source code of the assembly code below?

```asm
<set_reg>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x4(%rbp)
  mov    %esi,-0x8(%rbp)
  mov    %edx,-0xc(%rbp)
  mov    %ecx,-0x10(%rbp)
  cmpl   $0x20,-0xc(%rbp)
  je     L608
  cmpl   $0x20,-0xc(%rbp)
  jg     L267
  cmpl   $0x8,-0xc(%rbp)
  je     L157
  cmpl   $0x10,-0xc(%rbp)
  je     L317
  jmp    L267
L157:
  mov    -0x4(%rbp),%eax
  mov    %rax,D466(%rip)
  mov    D466(%rip),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  mov    %eax,D31(%rip)
  movb   $0x8,D330(%rip)
  jmp    L483
L317:
  mov    -0x4(%rbp),%eax
  mov    %rax,D122(%rip)
  mov    D122(%rip),%rax
  movzwl (%rax),%eax
  movzwl %ax,%eax
  mov    %eax,D36(%rip)
  movb   $0x10,D330(%rip)
  jmp    L483
L608:
  mov    -0x4(%rbp),%eax
  mov    %rax,D36(%rip)
  mov    D36(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,D467(%rip)
  movb   $0x20,D330(%rip)
  jmp    L483
L267:
  mov    $0x0,%eax
  jmp    L321
L483:
  movzbl D330(%rip),%eax
  movsbl %al,%eax
  cmp    $0x20,%eax
  je     L182
  cmp    $0x20,%eax
  jg     L322
  cmp    $0x8,%eax
  je     L603
  cmp    $0x10,%eax
  je     L607
  jmp    L322
L603:
  cmpl   $0x2,-0x10(%rbp)
  je     L254
  cmpl   $0x2,-0x10(%rbp)
  jg     L128
  cmpl   $0x0,-0x10(%rbp)
  je     L41
  cmpl   $0x1,-0x10(%rbp)
  je     L81
  jmp    L128
L41:
  mov    D466(%rip),%rax
  mov    -0x8(%rbp),%edx
  mov    %dl,(%rax)
  mov    D466(%rip),%rax
  movzbl (%rax),%eax
  mov    -0x8(%rbp),%edx
  cmp    %dl,%al
  je     L28
  mov    $0x0,%eax
  jmp    L321
L28:
  mov    $0x1,%eax
  jmp    L321
L81:
  mov    D466(%rip),%rax
  movzbl (%rax),%edx
  mov    -0x8(%rbp),%eax
  mov    %eax,%ecx
  mov    D466(%rip),%rax
  or     %ecx,%edx
  mov    %dl,(%rax)
  mov    D466(%rip),%rax
  movzbl (%rax),%eax
  mov    D467(%rip),%edx
  mov    %edx,%ecx
  mov    -0x8(%rbp),%edx
  or     %ecx,%edx
  cmp    %dl,%al
  je     L75
  mov    $0x0,%eax
  jmp    L321
L75:
  mov    $0x1,%eax
  jmp    L321
L254:
  mov    D466(%rip),%rax
  movzbl (%rax),%edx
  mov    -0x8(%rbp),%eax
  mov    %eax,%ecx
  mov    D466(%rip),%rax
  and    %ecx,%edx
  mov    %dl,(%rax)
  mov    D466(%rip),%rax
  movzbl (%rax),%eax
  mov    D467(%rip),%edx
  mov    %edx,%ecx
  mov    -0x8(%rbp),%edx
  and    %ecx,%edx
  cmp    %dl,%al
  je     L304
  mov    $0x0,%eax
  jmp    L321
L304:
  mov    $0x1,%eax
  jmp    L321
L128:
  mov    D466(%rip),%rax
  mov    -0x8(%rbp),%edx
  mov    %dl,(%rax)
  mov    D466(%rip),%rax
  movzbl (%rax),%eax
  mov    -0x8(%rbp),%edx
  cmp    %dl,%al
  je     L150
  mov    $0x0,%eax
  jmp    L321
L150:
  mov    $0x1,%eax
  jmp    L321
L607:
  cmpl   $0x2,-0x10(%rbp)
  je     L371
  cmpl   $0x2,-0x10(%rbp)
  jg     L450
  cmpl   $0x0,-0x10(%rbp)
  je     L204
  cmpl   $0x1,-0x10(%rbp)
  je     L151
  jmp    L450
L204:
  mov    D122(%rip),%rax
  mov    -0x8(%rbp),%edx
  mov    %dx,(%rax)
  mov    D122(%rip),%rax
  movzwl (%rax),%eax
  mov    -0x8(%rbp),%edx
  cmp    %dx,%ax
  je     L577
  mov    $0x0,%eax
  jmp    L321
L577:
  mov    $0x1,%eax
  jmp    L321
L151:
  mov    D122(%rip),%rax
  movzwl (%rax),%edx
  mov    -0x8(%rbp),%eax
  mov    %eax,%ecx
  mov    D122(%rip),%rax
  or     %ecx,%edx
  mov    %dx,(%rax)
  mov    D122(%rip),%rax
  movzwl (%rax),%eax
  mov    D467(%rip),%edx
  mov    %edx,%ecx
  mov    -0x8(%rbp),%edx
  or     %ecx,%edx
  cmp    %dx,%ax
  je     L394
  mov    $0x0,%eax
  jmp    L321
L394:
  mov    $0x1,%eax
  jmp    L321
L371:
  mov    D122(%rip),%rax
  movzwl (%rax),%edx
  mov    -0x8(%rbp),%eax
  mov    %eax,%ecx
  mov    D122(%rip),%rax
  and    %ecx,%edx
  mov    %dx,(%rax)
  mov    D122(%rip),%rax
  movzwl (%rax),%eax
  mov    D467(%rip),%edx
  mov    %edx,%ecx
  mov    -0x8(%rbp),%edx
  and    %ecx,%edx
  cmp    %dx,%ax
  je     L299
  mov    $0x0,%eax
  jmp    L321
L299:
  mov    $0x1,%eax
  jmp    L321
L450:
  mov    D122(%rip),%rax
  mov    -0x8(%rbp),%edx
  mov    %dx,(%rax)
  mov    D122(%rip),%rax
  movzwl (%rax),%eax
  mov    -0x8(%rbp),%edx
  cmp    %dx,%ax
  je     L550
  mov    $0x0,%eax
  jmp    L321
L550:
  mov    $0x1,%eax
  jmp    L321
L182:
  cmpl   $0x2,-0x10(%rbp)
  je     L185
  cmpl   $0x2,-0x10(%rbp)
  jg     L232
  cmpl   $0x0,-0x10(%rbp)
  je     L480
  cmpl   $0x1,-0x10(%rbp)
  je     L535
  jmp    L232
L480:
  mov    D36(%rip),%rax
  mov    -0x8(%rbp),%edx
  mov    %edx,(%rax)
  mov    D36(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x8(%rbp)
  je     L362
  mov    $0x0,%eax
  jmp    L321
L362:
  mov    $0x1,%eax
  jmp    L321
L535:
  mov    D36(%rip),%rax
  mov    (%rax),%edx
  mov    D36(%rip),%rax
  or     -0x8(%rbp),%edx
  mov    %edx,(%rax)
  mov    D36(%rip),%rax
  mov    (%rax),%edx
  mov    D467(%rip),%eax
  or     -0x8(%rbp),%eax
  cmp    %eax,%edx
  je     L392
  mov    $0x0,%eax
  jmp    L321
L392:
  mov    $0x1,%eax
  jmp    L321
L185:
  mov    D36(%rip),%rax
  mov    (%rax),%edx
  mov    D36(%rip),%rax
  and    -0x8(%rbp),%edx
  mov    %edx,(%rax)
  mov    D36(%rip),%rax
  mov    (%rax),%edx
  mov    D467(%rip),%eax
  and    -0x8(%rbp),%eax
  cmp    %eax,%edx
  je     L177
  mov    $0x0,%eax
  jmp    L321
L177:
  mov    $0x1,%eax
  jmp    L321
L232:
  mov    D36(%rip),%rax
  mov    -0x8(%rbp),%edx
  mov    %edx,(%rax)
  mov    D36(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x8(%rbp)
  je     L159
  mov    $0x0,%eax
  jmp    L321
L159:
  mov    $0x1,%eax
  jmp    L321
L322:
  mov    $0x0,%eax
L321:
  pop    %rbp
  ret
```

assistant: ```c
char set_reg(unsigned int addr, unsigned int value, int size, int flag) {
  static unsigned char *temp_8;
  static unsigned short *temp_16;
  static unsigned int *temp_32;
  static char sel = 0;
  static unsigned int temp_value;
  switch (size) {
  case 8:
    temp_8 = (unsigned char *)(addr);
    temp_value = (unsigned char)*temp_8;
    sel = 8;
    break;
  case 16:
    temp_16 = (unsigned short *)(addr);
    temp_value = (unsigned int)*temp_16;
    sel = 16;
    break;
  case 32:
    temp_32 = (unsigned int *)(addr);
    temp_value = *temp_32;
    sel = 32;
    break;
  default:
    return 0;
  }
  switch (sel) {
  case 8:
    switch (flag) {
    case 0:
      *temp_8 = (unsigned char)value;
      if (*temp_8 != (unsigned char)value)
        return 0;
      return 1;
    case 1:
      *temp_8 |= (unsigned char)value;
      if (*temp_8 != (unsigned char)(temp_value | value))
        return 0;
      return 1;
    case 2:
      *temp_8 &= (unsigned char)value;
      if (*temp_8 != (unsigned char)(temp_value & value))
        return 0;
      return 1;
    default:
      *temp_8 = (unsigned char)value;
      if (*temp_8 != (unsigned char)value)
        return 0;
      return 1;
    }
  case 16:
    switch (flag) {
    case 0:
      *temp_16 = (unsigned short)value;
      if (*temp_16 != (unsigned short)value)
        return 0;
      return 1;
    case 1:
      *temp_16 |= (unsigned short)value;
      if (*temp_16 != (unsigned short)(temp_value | value))
        return 0;
      return 1;
    case 2:
      *temp_16 &= (unsigned short)value;
      if (*temp_16 != (unsigned short)(temp_value & value))
        return 0;
      return 1;
    default:
      *temp_16 = (unsigned short)value;
      if (*temp_16 != (unsigned short)value)
        return 0;
      return 1;
    }
  case 32:
    switch (flag) {
    case 0:
      *temp_32 = value;
      if (*temp_32 != value)
        return 0;
      return 1;
    case 1:
      *temp_32 |= value;
      if (*temp_32 != (temp_value | value))
        return 0;
      return 1;
    case 2:
      *temp_32 &= value;
      if (*temp_32 != (temp_value & value))
        return 0;
      return 1;
    default:
      *temp_32 = value;
      if (*temp_32 != value)
        return 0;
      return 1;
    }
  default:
    return 0;
  }
}
```