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

```asm
<get_element_from_html>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x48,%rsp
  mov    %rdi,-0x1048(%rbp)
  mov    %rsi,-0x1050(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x18(%rbp)
  xor    %eax,%eax
  movq   $0x0,-0x1030(%rbp)
  movq   $0x0,-0x1038(%rbp)
  mov    -0x1048(%rbp),%rax
  lea    D1(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x1028(%rbp)
  cmpq   $0x0,-0x1028(%rbp)
  jne    L21
  mov    $0x0,%eax
  jmp    L33
L21:
  mov    -0x1050(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,%ebx
  lea    D16(%rip),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    %ebx,%eax
  add    $0x2,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x1030(%rbp)
  mov    -0x1050(%rbp),%rdx
  mov    -0x1030(%rbp),%rax
  lea    D4(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <sprintf@plt>
  jmp    L77
L43:
  lea    -0x1020(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  test   %eax,%eax
  jle    L77
  mov    -0x1030(%rbp),%rdx
  lea    -0x1020(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L77
  mov    -0x1030(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    $0x2,%eax
  mov    %eax,-0x103c(%rbp)
  lea    -0x1020(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x1038(%rbp)
  lea    -0x1020(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  sub    $0x6,%eax
  sub    -0x103c(%rbp),%eax
  mov    %eax,%edx
  mov    -0x103c(%rbp),%eax
  cltq
  lea    -0x1020(%rbp),%rcx
  add    %rax,%rcx
  mov    -0x1038(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  lea    -0x1020(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  sub    $0x6,%eax
  sub    -0x103c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x1038(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  jmp    L42
L77:
  mov    -0x1028(%rbp),%rdx
  lea    -0x1020(%rbp),%rax
  mov    $0x1000,%esi
  mov    %rax,%rdi
  call   <fgets@plt>
  test   %rax,%rax
  jne    L43
L42:
  mov    -0x1028(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  mov    -0x1030(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x1038(%rbp),%rax
L33:
  mov    -0x18(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L70
  call   <__stack_chk_fail@plt>
L70:
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: data_label: D1
type_guessed: string
name: disassemble_data
arguments: data_label: D16
type_guessed: string
name: disassemble_data
arguments: data_label: D4
type_guessed: string

tool: D1: r

tool: D16: <!-- 

tool: D4: <!-- %s

assistant: ```c
char *get_element_from_html(char *file_name, char *element_name) {
  char *element_pattern = NULL;
  char buff[0x1000];
  char *element_val = NULL;
  FILE *f;
  f = fopen(file_name, "r");
  if (!f)
    return NULL;
  element_pattern = (char *)malloc(sizeof(char) * (strlen(element_name) + strlen("<!-- ") + 2));
  sprintf(element_pattern, "<!-- %s", element_name);
  while (fgets(buff, sizeof(buff), f) != NULL) {
    if (strlen(buff) > 0)
      if (strstr(buff, element_pattern) != NULL) {
        int pattern_offset = strlen(element_pattern) + 2;
        element_val = (char *)malloc(sizeof(char) * strlen(buff));
        memcpy(element_val, buff + pattern_offset, strlen(buff) - 6 - pattern_offset);
        element_val[strlen(buff) - 6 - pattern_offset] = '\0';
        break;
      }
  }
  fclose(f);
  free(element_pattern);
  return element_val;
}
```