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

```asm
<find_gt_nd2>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  cmpq   $0x1,-0x40(%rbp)
  jne    L191
  mov    -0x38(%rbp),%rax
  mov    (%rax),%eax
  jmp    L159
L191:
  movl   $0x1,-0x30(%rbp)
  mov    -0x40(%rbp),%rax
  and    $0x1,%eax
  test   %rax,%rax
  je     L136
  mov    -0x40(%rbp),%rax
  shl    $0x2,%rax
  lea    -0x4(%rax),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  jmp    L143
L136:
  mov    $0xffffffff,%eax
L143:
  mov    %eax,-0x28(%rbp)
  movq   $0x0,-0x20(%rbp)
  mov    -0x40(%rbp),%rax
  shl    $0x2,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  movq   $0x0,-0x18(%rbp)
  jmp    L82
L194:
  mov    -0x18(%rbp),%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x18(%rbp),%rax
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rcx
  mov    -0x38(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jne    L213
  mov    -0x18(%rbp),%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x20(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x20(%rbp)
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rax,%rdx
  mov    (%rcx),%eax
  mov    %eax,(%rdx)
  cmpl   $0xffffffff,-0x28(%rbp)
  je     L213
  mov    -0x18(%rbp),%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    %eax,-0x28(%rbp)
  jne    L213
  addl   $0x1,-0x30(%rbp)
L213:
  addq   $0x2,-0x18(%rbp)
L82:
  mov    -0x18(%rbp),%rax
  cmp    -0x40(%rbp),%rax
  jb     L194
  mov    -0x30(%rbp),%eax
  cltq
  mov    -0x20(%rbp),%rdx
  add    $0x1,%rdx
  shr    %rdx
  cmp    %rdx,%rax
  jbe    L8
  mov    -0x28(%rbp),%eax
  jmp    L159
L8:
  cmpq   $0x0,-0x20(%rbp)
  jne    L60
  cmpl   $0xffffffff,-0x28(%rbp)
  je     L72
  mov    -0x28(%rbp),%eax
  jmp    L159
L72:
  mov    $0xffffffff,%eax
  jmp    L159
L60:
  mov    -0x20(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <find_gt_nd2>
  mov    %eax,-0x24(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  cmpl   $0xffffffff,-0x24(%rbp)
  jne    L90
  mov    $0xffffffff,%eax
  jmp    L159
L90:
  movl   $0x0,-0x2c(%rbp)
  movq   $0x0,-0x10(%rbp)
  jmp    L196
L73:
  mov    -0x10(%rbp),%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    %eax,-0x24(%rbp)
  jne    L116
  addl   $0x1,-0x2c(%rbp)
L116:
  addq   $0x1,-0x10(%rbp)
L196:
  mov    -0x10(%rbp),%rax
  cmp    -0x40(%rbp),%rax
  jb     L73
  mov    -0x2c(%rbp),%eax
  cltq
  mov    -0x40(%rbp),%rdx
  shr    %rdx
  cmp    %rdx,%rax
  jbe    L215
  mov    -0x24(%rbp),%eax
  jmp    L159
L215:
  mov    $0xffffffff,%eax
L159:
  leave
  ret
```

assistant: ```c
int find_gt_nd2(int *sequence, size_t sequence_size) {
  if (sequence_size == 1) {
    return sequence[0];
  }
  int odd_cnt = 1;
  int odd_num = sequence_size % 2 ? sequence[sequence_size - 1] : -1;
  size_t next_sequence_size = 0;
  int *next_sequence = (int *)malloc(sizeof(int) * sequence_size);
  for (size_t i = 0; i < sequence_size; i += 2) {
    if (sequence[i] == sequence[i + 1]) {
      next_sequence[next_sequence_size++] = sequence[i];
      if (odd_num != -1 && odd_num == sequence[i]) {
        ++odd_cnt;
      }
    }
  }
  if (odd_cnt > (next_sequence_size + 1) / 2) {
    return odd_num;
  }
  if (next_sequence_size == 0) {
    if (odd_num != -1) {
      return odd_num;
    }
    return -1;
  }
  int result = find_gt_nd2(next_sequence, next_sequence_size);
  free(next_sequence);
  if (result == -1) {
    return -1;
  }
  int count = 0;
  for (size_t i = 0; i < sequence_size; ++i) {
    if (sequence[i] == result) {
      ++count;
    }
  }
  if (count > sequence_size / 2) {
    return result;
  }
  return -1;
}
```