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

```asm
<check_weird>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x1,%edx
  mov    $0x1,%eax
L118:
  lea    0x1(%rdx,%rdx,1),%ecx
  mov    %edx,%esi
  mov    %ecx,%edx
  cmp    %sil,%cl
  je     L92
  add    $0x1,%eax
  cmp    $0x100,%eax
  jne    L118
L92:
  movslq %eax,%rdi
  mov    %eax,%ecx
  lea    0x0(,%rax,4),%edx
  lea    0x2(%rdx),%r8d
  mov    %r8d,%eax
L76:
  sub    $0x1,%eax
  jne    L76
  lea    0x3(%rdx),%esi
  cmp    %esi,%edx
  jle    L86
  lea    -0x1(,%rdi,4),%r9
  movslq %esi,%rax
  cmp    %r9,%rax
  jne    L134
  lea    0x0(,%rcx,8),%esi
  lea    -0x1(%rsi),%eax
  mov    $0x2,%ecx
L146:
  sub    $0x1,%eax
  je     L51
  lea    (%rcx,%rcx,1),%edi
  cmp    %edi,%ecx
  jge    L51
  mov    %edi,%ecx
  jmp    L146
L86:
  lea    D1(%rip),%rdi
  call   <puts@plt>
L28:
  add    $0x8,%rsp
  ret
L134:
  lea    D38(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L28
L51:
  sub    %eax,%esi
  cmp    %esi,%edx
  jle    L20
  movslq %esi,%rax
  cmp    %rax,%r9
  jne    L37
L9:
  sub    $0x1,%r8d
  jne    L9
  jmp    L28
L20:
  lea    D35(%rip),%rdi
  call   <puts@plt>
  jmp    L28
L37:
  lea    D32(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L28
```

tool_calls: name: disassemble_data
arguments: data_tag: D1
type_infered: string
name: disassemble_data
arguments: data_tag: D38
type_infered: string
name: disassemble_data
arguments: data_tag: D35
type_infered: string
name: disassemble_data
arguments: data_tag: D32
type_infered: string

tool: D1: WARNING(A): Signed integers are insane (too big for their bit size).

tool: D38: WARNING(A): Signed integers have %d magnitude bits.


tool: D35: WARNING(B): Signed integers are insane (too big for their bit size).

tool: D32: WARNING(B): Signed integers have %d magnitude bits.


assistant: ```c
void check_weird(void) {
  int known_weird = 0;
  int char_bit, char_min = 0, char_max = 0;
  {
    char x1 = 0, x2 = 0, x3 = 1;
    for (char_bit = 0; char_bit < 256; char_bit++) {
      x1 = x2;
      x2 = x2 * 2 + 1;
      x3 = (x3 << 1);
      if (x2 == x1 || (x2 + 1) == x2)
        break;
      if (char_min > x2)
        char_min = x2;
      if (char_min > x3)
        char_min = x3;
      if (char_max < x2)
        char_max = x2;
    }
  }
  if (!known_weird) {
    int x, flg = sizeof(int) * char_bit + 2;
    for (x = 1; x + 1 > x && --flg; x = (x | (x << 1)))
      ;
    x = sizeof(int) * char_bit + 3 - flg;
    known_weird = 1;
    if (x >= (int)(sizeof(int) * char_bit))
      printf("WARNING(A): Signed integers are insane (too big for their bit size).\n");
    else if (x != sizeof(int) * char_bit - 1)
      printf("WARNING(A): Signed integers have %d magnitude bits.\n", x);
    else
      known_weird = 0;
  }
  if (!known_weird) {
    int x, y = 0, flg = sizeof(int) * char_bit * 2;
    for (x = 1; x > y && --flg; y = x, x = (x << 1))
      ;
    x = sizeof(int) * char_bit * 2 - flg;
    known_weird = 1;
    if (x >= (int)(sizeof(int) * char_bit))
      printf("WARNING(B): Signed integers are insane (too big for their bit size).\n");
    else if (x != sizeof(int) * char_bit - 1)
      printf("WARNING(B): Signed integers have %d magnitude bits.\n", x);
    else
      known_weird = 0;
  }
  if (!known_weird) {
    int x, flg = sizeof(int) * char_bit + 2;
    for (x = 1; x + 2 >= x && --flg; x = (x | (x << 1)))
      ;
    x = sizeof(int) * char_bit + 3 - flg;
    known_weird = 1;
    if (x >= (int)(sizeof(int) * char_bit))
      printf("WARNING(C): Signed integers are insane (too big for their bit size).\n");
    else if (x != sizeof(int) * char_bit - 1)
      printf("WARNING(C): Signed integers have %d magnitude bits.\n", x);
    else
      known_weird = 0;
  }
}
```