user: Please show me the C implementation that matches the assembly code listed below:

```asm
<main>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  cmp    $0x2,%edi
  je     L72
  lea    D76(%rip),%rdi
  call   <puts@plt>
  lea    D6(%rip),%rdi
  call   <puts@plt>
  lea    D114(%rip),%rdi
  call   <puts@plt>
  lea    D5(%rip),%rdi
  call   <puts@plt>
  lea    D113(%rip),%rdi
  call   <puts@plt>
  lea    D46(%rip),%rdi
  call   <puts@plt>
  mov    $0x1,%eax
L7:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L53
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L72:
  mov    0x8(%rsi),%rbp
  mov    %rbp,%rdi
  call   <strlen@plt>
  movslq %eax,%r12
  test   %r12,%r12
  je     L136
  xor    %ebx,%ebx
  jmp    L108
  nopl   0x0(%rax,%rax,1)
L154:
  add    $0x1,%rbx
  cmp    %r12,%rbx
  je     L6
L108:
  movsbl 0x0(%rbp,%rbx,1),%edi
  call   <isxdigit@plt>
  test   %eax,%eax
  jne    L154
  mov    %rbp,%rsi
  lea    D53(%rip),%rdi
  xor    %ebp,%ebp
  call   <printf@plt>
  lea    D28(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  test   %rbx,%rbx
  je     L3
  nopl   0x0(%rax,%rax,1)
L129:
  mov    $0x20,%edi
  add    $0x1,%rbp
  call   <putchar@plt>
  cmp    %rbx,%rbp
  jne    L129
L3:
  lea    D123(%rip),%rdi
  call   <puts@plt>
  lea    D58(%rip),%rdi
  call   <puts@plt>
  mov    $0x3,%eax
  jmp    L7
L6:
  movb   $0x0,0x6(%rsp)
  add    %rbp,%rbx
  xor    %eax,%eax
  lea    0x5(%rsp),%r13
  nopl   0x0(%rax)
L54:
  shl    $0x4,%rax
  mov    $0x10,%edx
  xor    %esi,%esi
  mov    %r13,%rdi
  mov    %rax,%r12
  movzbl 0x0(%rbp),%eax
  add    $0x1,%rbp
  mov    %al,0x5(%rsp)
  call   <strtol@plt>
  or     %r12,%rax
  cmp    %rbp,%rbx
  jne    L54
  mov    %rax,%rdx
  mov    %rax,%rcx
  shr    $0x9,%rdx
  shr    $0x19,%rcx
  or     %rcx,%rdx
  and    $0x1,%dl
  mov    %rax,%rdx
  je     L138
  shr    $0x18,%rdx
  shr    $0x8,%rax
  or     %rdx,%rax
  test   $0x1,%al
  jne    L106
  lea    D45(%rip),%rdi
  call   <puts@plt>
  xor    %eax,%eax
  jmp    L7
L138:
  shr    $0x8,%rdx
  shr    $0x18,%rax
  or     %rdx,%rax
  test   $0x1,%al
  je     L91
  lea    D43(%rip),%rdi
  call   <puts@plt>
  xor    %eax,%eax
  jmp    L7
L136:
  movb   $0x0,0x6(%rsp)
L91:
  lea    D36(%rip),%rdi
  call   <puts@plt>
  xor    %eax,%eax
  jmp    L7
L106:
  lea    D75(%rip),%rdi
  call   <puts@plt>
  xor    %eax,%eax
  jmp    L7
L53:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_tag: D76
type_infered: string
name: unpack_data
arguments: data_tag: D6
type_infered: string
name: unpack_data
arguments: data_tag: D114
type_infered: string
name: unpack_data
arguments: data_tag: D5
type_infered: string
name: unpack_data
arguments: data_tag: D113
type_infered: string
name: unpack_data
arguments: data_tag: D46
type_infered: string
name: unpack_data
arguments: data_tag: D53
type_infered: string
name: unpack_data
arguments: data_tag: D28
type_infered: string
name: unpack_data
arguments: data_tag: D123
type_infered: string
name: unpack_data
arguments: data_tag: D58
type_infered: string
name: unpack_data
arguments: data_tag: D45
type_infered: string
name: unpack_data
arguments: data_tag: D43
type_infered: string
name: unpack_data
arguments: data_tag: D36
type_infered: string
name: unpack_data
arguments: data_tag: D75
type_infered: string

tool: D76: Usage: <flags (in hex w/o 0x)>

tool: D6:     Decodes the eSeries dram eccStatus number, from the

tool: D114:     "print__11Ic1Detector" shell command

tool: D5:     output, into double bit ECC error, single bit ECC error, both single and double bit ECC errors,

tool: D113:     or neither single nor double bit ECC errors.

tool: D46:     Written by Jonathan Natale for Juniper Networks on 20-Nov-2010.

tool: D53: Sorry, %s are not a valid flags.


tool: D28:        

tool: D123: ^

tool: D58: Please try again.  Exiting ...

tool: D45: only double bit ECC errors

tool: D43: only single bit ECC errors

tool: D36: neither single nor double bit ECC errors

tool: D75: both single and double bit ECC errors

assistant: ```c
int main(int argc, char **argv) {
  char *flags;
  char hexChar[3];
  unsigned long int hexCharNum;
  unsigned long int i, j;
  unsigned long int flagsNum;
  int len;
  if ((argc != 2) || ((argc != 2) && strcmp(argv[1], "?"))) {
    printf("Usage: <flags (in hex w/o 0x)>\n");
    printf("    Decodes the eSeries dram eccStatus number, from the\n");
    printf("    \"print__11Ic1Detector\" shell command\n");
    printf("    output, into double bit ECC error, single bit ECC error, both single and double bit ECC errors,\n");
    printf("    or neither single nor double bit ECC errors.\n");
    printf("    Written by Jonathan Natale for Juniper Networks on 20-Nov-2010.\n");
    return (1);
  }
  flags = argv[1];
  len = strlen(flags);
  for (i = 0; i < len; i++) {
    if (!isxdigit(flags[i])) {
      printf("Sorry, %s are not a valid flags.\n", flags);
      printf("       ");
      for (j = 0; j < i; j++) {
        printf(" ");
      }
      printf("^\n");
      printf("Please try again.  Exiting ...\n");
      return (3);
    }
  }
  flagsNum = 0;
  hexChar[1] = '\0';
  for (i = 0; i < len; i++) {
    flagsNum = flagsNum << 4;
    hexChar[0] = flags[i];
    hexCharNum = strtol(hexChar, (char **)NULL, 16);
    flagsNum = flagsNum | hexCharNum;
  }
  if ((((flagsNum >> 9) & 1) | ((flagsNum >> 25) & 1)) && (((flagsNum >> 8) & 1) | ((flagsNum >> 24) & 1))) {
    printf("both single and double bit ECC errors\n");
  } else if (((flagsNum >> 8) & 1) | ((flagsNum >> 24) & 1)) {
    printf("only single bit ECC errors\n");
  } else if (((flagsNum >> 9) & 1) | ((flagsNum >> 25) & 1)) {
    printf("only double bit ECC errors\n");
  } else {
    printf("neither single nor double bit ECC errors\n");
  }
  return (0);
}
```