user: Translate the below assembly code into C programming language:

```asm
<getModuleFamily>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x198,%rsp
  mov    %rdi,%r12
  mov    %fs:0x28,%rax
  mov    %rax,0x188(%rsp)
  xor    %eax,%eax
  movq   $0x0,(%rsp)
  movq   $0x0,0x8(%rsp)
  movq   $0x0,0x10(%rsp)
  movq   $0x0,0x18(%rsp)
  movq   $0x0,0x20(%rsp)
  movq   $0x0,0x28(%rsp)
  movq   $0x0,0x30(%rsp)
  movq   $0x0,0x38(%rsp)
  movq   $0x0,0x40(%rsp)
  movq   $0x0,0x48(%rsp)
  movq   $0x0,0x50(%rsp)
  movq   $0x0,0x58(%rsp)
  movq   $0x0,0x60(%rsp)
  movq   $0x0,0x68(%rsp)
  movq   $0x0,0x70(%rsp)
  movq   $0x0,0x78(%rsp)
  lea    D81(%rip),%rsi
  lea    D23(%rip),%rdi
  call   <fopen@plt>
  mov    %rax,%rbx
  lea    D167(%rip),%r13
  lea    0x80(%rsp),%rbp
  lea    D49(%rip),%r14
  test   %rax,%rax
  je     L25
L109:
  mov    %rbx,%rdx
  mov    $0xff,%esi
  mov    %rbp,%rdi
  call   <fgets@plt>
  test   %rax,%rax
  je     L68
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L109
  lea    0x87(%rsp),%rdi
  mov    $0x3a,%esi
  call   <strchr@plt>
  mov    %rax,%rdx
  mov    %rsp,%rdi
  mov    %r14,%rsi
  call   <sprintf@plt>
  jmp    L109
L68:
  mov    %rbx,%rdi
  call   <fclose@plt>
  mov    %rsp,%rdi
  lea    D52(%rip),%rsi
  call   <strstr@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L34
  add    $0x8,%rbx
  lea    D31(%rip),%rsi
  mov    %rbx,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L190
  sub    %rbx,%rax
  lea    -0x1(%rax),%rbp
L90:
  mov    %rbp,%rdx
  mov    %rbx,%rsi
  mov    %r12,%rdi
  call   <strncpy@plt>
  lea    D3(%rip),%rsi
  mov    %r12,%rdi
  call   <strstr@plt>
  mov    %rax,%rdx
  mov    $0x0,%eax
  test   %rdx,%rdx
  je     L11
L31:
  mov    0x188(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L181
  add    $0x198,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L190:
  lea    D137(%rip),%rsi
  mov    %rbx,%rdi
  call   <strcspn@plt>
  mov    %rax,%rbp
  jmp    L90
L34:
  lea    D81(%rip),%rsi
  lea    D61(%rip),%rdi
  call   <fopen@plt>
  mov    %rax,%r14
  test   %rax,%rax
  je     L104
L17:
  mov    $0x0,%ebp
  lea    0x80(%rsp),%r13
  lea    D52(%rip),%r15
  jmp    L59
L104:
  lea    D81(%rip),%rsi
  lea    D32(%rip),%rdi
  call   <fopen@plt>
  mov    %rax,%r14
  test   %rax,%rax
  jne    L17
  mov    %rax,%rbx
  mov    $0x0,%ebp
  jmp    L90
L41:
  lea    D20(%rip),%rdi
  call   <printf@plt>
  mov    $0xffffffff,%edi
  call   <exit@plt>
  jmp    L0
L134:
  mov    %rbx,%rdi
  call   <strlen@plt>
  mov    %rax,%rbp
L59:
  mov    %r14,%rdx
  mov    $0xff,%esi
  mov    %r13,%rdi
  call   <fgets@plt>
  test   %rax,%rax
  je     L116
  mov    %r15,%rsi
  mov    %r13,%rdi
  call   <strstr@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L41
L0:
  add    $0x8,%rbx
  lea    D124(%rip),%rsi
  mov    %rbx,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L134
  sub    %rbx,%rax
  lea    -0x1(%rax),%rbp
  jmp    L59
L116:
  mov    %r14,%rdi
  call   <fclose@plt>
  jmp    L90
L25:
  lea    D14(%rip),%rdi
  call   <printf@plt>
  mov    $0xffffffff,%edi
  call   <exit@plt>
  mov    $0x0,%ebp
  jmp    L90
L11:
  lea    D77(%rip),%rsi
  mov    %r12,%rdi
  call   <strstr@plt>
  cmp    $0x1,%rax
  sbb    %eax,%eax
  or     $0x1,%eax
  jmp    L31
L181:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_tag: D81
datatype: string
name: retrieve_data
arguments: data_tag: D23
datatype: string
name: retrieve_data
arguments: data_tag: D167
datatype: string
name: retrieve_data
arguments: data_tag: D49
datatype: string
name: retrieve_data
arguments: data_tag: D52
datatype: string
name: retrieve_data
arguments: data_tag: D31
datatype: string
name: retrieve_data
arguments: data_tag: D3
datatype: string
name: retrieve_data
arguments: data_tag: D137
datatype: string
name: retrieve_data
arguments: data_tag: D61
datatype: string
name: retrieve_data
arguments: data_tag: D32
datatype: string
name: retrieve_data
arguments: data_tag: D20
datatype: string
name: retrieve_data
arguments: data_tag: D124
datatype: string
name: retrieve_data
arguments: data_tag: D14
datatype: string
name: retrieve_data
arguments: data_tag: D77
datatype: string

tool: D81: r

tool: D23: /proc/cpuinfo

tool: D167: Hardware

tool: D49: %s

tool: D52: Toradex

tool: D31: Module

tool: D3: Colibri

tool: D137: 


tool: D61: /sys/firmware/devicetree/base/model

tool: D32: /sys/bus/soc/devices/soc0/machine

tool: D20: Invalid Machine!

tool: D124: on

tool: D14: CPU info not available!

tool: D77: Apalis

assistant: ```c
unsigned int getModuleFamily(char *moduleName) {
  char buf[256], hardware[128] = {0};
  FILE *file = NULL;
  char *start = NULL, *numStr = NULL, *end = NULL;
  size_t len = 0;
  file = fopen("/proc/cpuinfo", "r");
  if (file) {
    while (fgets(buf, 255, file)) {
      if (strstr(buf, "Hardware")) {
        numStr = strstr(&buf[7], ":");
        sprintf(hardware, "%s", numStr);
      }
    }
    fclose(file);
    start = strstr(hardware, "Toradex");
    if (start != NULL) {
      start += 8;
      end = strstr(start, "Module");
      if (end)
        len = end - start - 1;
      else
        len = strcspn(start, "\n");
    } else {
      file = fopen("/sys/firmware/devicetree/base/model", "r");
      if (file == NULL) {
        file = fopen("/sys/bus/soc/devices/soc0/machine", "r");
      }
      if (file) {
        while (fgets(buf, 255, file)) {
          start = strstr(buf, "Toradex");
          if (start == NULL) {
            printf("Invalid Machine!");
            exit(-1);
          }
          start += 8;
          end = strstr(start, "on");
          if (end)
            len = end - start - 1;
          else
            len = strlen(start);
        }
        fclose(file);
      }
    }
  } else {
    printf("CPU info not available!");
    exit(-1);
  }
  strncpy(moduleName, start, len);
  if (strstr(moduleName, "Colibri")) {
    return 0;
  } else if (strstr(moduleName, "Apalis")) {
    return 1;
  }
  return -1;
}
```