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

```asm
<main>:
  endbr64
  push   %rbp
  lea    D0(%rip),%rdi
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  call   <printf@plt>
  lea    -0x3c(%rbp),%rsi
  lea    D36(%rip),%rdi
  call   <scanf@plt>
  lea    D34(%rip),%rdi
  call   <puts@plt>
  movslq -0x3c(%rbp),%rax
  mov    %rsp,%rsi
  mov    %rax,%rcx
  lea    0xf(,%rax,4),%rax
  mov    %rax,%rdi
  mov    %rax,%rdx
  and    $0xfffffffffffff000,%rdi
  and    $0xfffffffffffffff0,%rdx
  sub    %rdi,%rsi
  cmp    %rsi,%rsp
  je     L29
L114:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rsi,%rsp
  jne    L114
L29:
  and    $0xfff,%edx
  sub    %rdx,%rsp
  test   %rdx,%rdx
  jne    L69
L216:
  mov    %rax,%rdx
  mov    %rsp,%rsi
  and    $0xfffffffffffff000,%rax
  mov    %rsp,%r12
  and    $0xfffffffffffffff0,%rdx
  sub    %rax,%rsi
L143:
  cmp    %rsi,%rsp
  je     L116
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L143
L69:
  orq    $0x0,-0x8(%rsp,%rdx,1)
  jmp    L216
L116:
  and    $0xfff,%edx
  sub    %rdx,%rsp
  test   %rdx,%rdx
  jne    L179
L5:
  mov    %rsp,%rbx
  test   %ecx,%ecx
  jle    L161
  mov    %r12,%r15
  xor    %r14d,%r14d
  nopw   0x0(%rax,%rax,1)
L105:
  mov    %r15,%rsi
  lea    D36(%rip),%rdi
  add    $0x4,%r15
  call   <scanf@plt>
  mov    -0x3c(%rbp),%edi
  movl   $0x0,(%rbx,%r14,4)
  add    $0x1,%r14
  cmp    %r14d,%edi
  jg     L105
  test   %edi,%edi
  jle    L161
  lea    -0x2(%rdi),%esi
  movslq %edi,%r8
  xor    %edx,%edx
  add    $0x2,%rsi
  nopl   0x0(%rax,%rax,1)
L174:
  cmpl   $0x1,(%rbx,%rdx,4)
  je     L169
  cmp    $0x1,%edi
  je     L169
  mov    $0x1,%eax
  jmp    L72
  nopw   0x0(%rax,%rax,1)
L76:
  mov    %ecx,%r13d
L215:
  add    $0x1,%rax
  cmp    %rsi,%rax
  je     L169
L72:
  cmpl   $0x1,(%rbx,%rax,4)
  je     L215
  mov    (%r12,%rdx,4),%ecx
  cmp    %ecx,(%r12,%rax,4)
  jne    L76
  cmp    %edx,%eax
  je     L76
  movl   $0x1,(%rbx,%rdx,4)
  movl   $0x1,(%rbx,%rax,4)
  add    $0x1,%rax
  cmp    %rsi,%rax
  jne    L72
  nopw   0x0(%rax,%rax,1)
L169:
  add    $0x1,%rdx
  cmp    %r8,%rdx
  jne    L174
  xor    %eax,%eax
  nopl   0x0(%rax,%rax,1)
L26:
  mov    (%r12,%rax,4),%edx
  cmp    %r13d,%edx
  jle    L178
  mov    (%rbx,%rax,4),%ecx
  test   %ecx,%ecx
  cmove  %edx,%r13d
L178:
  add    $0x1,%rax
  cmp    %r8,%rax
  jne    L26
L161:
  lea    D8(%rip),%rdi
  xor    %eax,%eax
  mov    %r13d,%esi
  call   <printf@plt>
  lea    D7(%rip),%rdi
  call   <system@plt>
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L71
  lea    -0x28(%rbp),%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L179:
  orq    $0x0,-0x8(%rsp,%rdx,1)
  jmp    L5
L71:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D0
type: string
name: extract_symbolic_data
arguments: data_label: D36
type: string
name: extract_symbolic_data
arguments: data_label: D34
type: string
name: extract_symbolic_data
arguments: data_label: D8
type: string
name: extract_symbolic_data
arguments: data_label: D7
type: string

tool: D0: Vvedit kilkist elementiv masivy -> 

tool: D36: %d

tool: D34: Vvedit elementy masivy

tool: D8: Max element z masiva(bez povtoren): %d

tool: D7: PAUSE

assistant: ```c
int main(int argc, char *argv[]) {
  int countOfElements;
  printf("Vvedit kilkist elementiv masivy -> ");
  scanf("%d", &countOfElements);
  printf("Vvedit elementy masivy\n");
  int numbers[countOfElements], check[countOfElements], maxElement;
  for (int currentElement = 0; currentElement < countOfElements; currentElement++) {
    scanf("%d", &numbers[currentElement]);
    check[currentElement] = 0;
  };
  for (int currentElement = 0; currentElement < countOfElements; currentElement++) {
    if (check[currentElement] == 1)
      continue;
    for (int nextElement = 1; nextElement < countOfElements; nextElement++) {
      if (check[nextElement] == 1)
        continue;
      if (numbers[currentElement] == numbers[nextElement] && currentElement != nextElement) {
        check[currentElement] = 1;
        check[nextElement] = 1;
      } else
        maxElement = numbers[currentElement];
    }
  }
  for (int currentElement = 0; currentElement < countOfElements; currentElement++)
    if (maxElement < numbers[currentElement] && check[currentElement] == 0)
      maxElement = numbers[currentElement];
  printf("Max element z masiva(bez povtoren): %d", maxElement);
  system("PAUSE");
  return 0;
}
```