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

```asm
<set_reg>:
  endbr64
  mov    %edi,%eax
  cmp    $0x10,%edx
  je     L24
  cmp    $0x20,%edx
  je     L25
  xor    %r8d,%r8d
  cmp    $0x8,%edx
  je     L111
L119:
  mov    %r8d,%eax
  ret
L24:
  mov    %edi,%edi
  movb   $0x10,D79(%rip)
  mov    %rdi,D13(%rip)
  movzwl (%eax),%edi
  mov    %edi,D84(%rip)
  mov    %edi,%edx
  cmp    $0x1,%ecx
  je     L40
  cmp    $0x2,%ecx
  je     L158
  mov    %si,(%eax)
  mov    $0x1,%r8d
  jmp    L119
  nopw   0x0(%rax,%rax,1)
L111:
  mov    %edi,%edi
  movb   $0x8,D79(%rip)
  mov    %rdi,D81(%rip)
  movzbl (%eax),%edi
  mov    %edi,D50(%rip)
  mov    %edi,%edx
  cmp    $0x1,%ecx
  je     L147
  cmp    $0x2,%ecx
  je     L139
  mov    %sil,(%eax)
  mov    $0x1,%r8d
  jmp    L119
  cs nopw 0x0(%rax,%rax,1)
L25:
  mov    (%eax),%edx
  mov    %edi,%edi
  movb   $0x20,D79(%rip)
  mov    %rdi,D50(%rip)
  mov    %edx,D46(%rip)
  cmp    $0x1,%ecx
  je     L86
  cmp    $0x2,%ecx
  je     L80
  mov    %esi,(%eax)
  mov    $0x1,%r8d
  jmp    L119
  nopl   0x0(%rax)
L139:
  and    %esi,%edx
  mov    $0x1,%r8d
  mov    %dl,(%eax)
  jmp    L119
  nopl   0x0(%rax,%rax,1)
L80:
  and    %esi,%edx
  mov    $0x1,%r8d
  mov    %edx,(%eax)
  jmp    L119
L158:
  and    %esi,%edx
  mov    $0x1,%r8d
  mov    %dx,(%eax)
  jmp    L119
  nopl   0x0(%rax)
L147:
  or     %esi,%edx
  mov    $0x1,%r8d
  mov    %dl,(%eax)
  jmp    L119
  nopl   0x0(%rax,%rax,1)
L86:
  or     %esi,%edx
  mov    $0x1,%r8d
  mov    %edx,(%eax)
  jmp    L119
L40:
  or     %esi,%edx
  mov    $0x1,%r8d
  mov    %dx,(%eax)
  jmp    L119
```

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;
  }
}
```