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

```asm
<find_mantissa>:
  endbr64
  push   %r12
  lea    -0x1(%rsi),%edx
  push   %rbp
  mov    $0x1,%ebp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0xc0,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0xb8(%rsp)
  xor    %eax,%eax
  test   %edx,%edx
  jle    L201
  nopl   0x0(%rax)
L129:
  lea    0x0(%rbp,%rbp,4),%rbp
  add    $0x1,%eax
  add    %rbp,%rbp
  cmp    %edx,%eax
  jne    L129
L201:
  cmp    %rbp,%rbx
  jbe    L76
  mov    $0x2e,%edi
  sub    %rbp,%rbx
  call   <malloc@plt>
  mov    %rax,%r9
L12:
  mov    $0x1,%r8d
  mov    %rsp,%rdi
  movabs $0xcccccccccccccccd,%r12
  nopl   0x0(%rax,%rax,1)
L234:
  add    %rbx,%rbx
  mov    %r8d,%r10d
  mov    %r8d,%r11d
  xor    %eax,%eax
  cmp    %rbx,%rbp
  ja     L273
  sub    %rbp,%rbx
  mov    $0x1,%eax
L273:
  mov    %ax,-0x2(%r9,%r8,2)
  cmp    $0xa,%rbx
  jbe    L286
  mov    %rbx,%rax
  mul    %r12
  mov    %rbp,%rax
  mov    %rdx,%rbx
  mul    %r12
  shr    $0x3,%rbx
  mov    %rdx,%rbp
  shr    $0x3,%rbp
L286:
  cmp    $0x1,%r8d
  je     L214
  lea    -0x2(%r8),%esi
  mov    $0x1,%eax
  add    $0x2,%rsi
  jmp    L218
  nopl   0x0(%rax,%rax,1)
L115:
  add    $0x1,%rax
  cmp    %rsi,%rax
  je     L214
L218:
  movslq %eax,%rcx
  cmp    %rbx,-0x8(%rdi,%rax,8)
  jne    L115
  test   %rbx,%rbx
  je     L92
  cmp    $0x17,%r11w
  jle    L60
  test   %rbx,%rbx
  jne    L60
  nopl   0x0(%rax)
L92:
  mov    0xb8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L40
  add    $0xc0,%rsp
  mov    %r9,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  cs nopw 0x0(%rax,%rax,1)
L214:
  test   %rbx,%rbx
  mov    %rbx,-0x8(%rdi,%r8,8)
  setne  %dl
  cmp    $0x17,%r8w
  setle  %al
  add    $0x1,%r8
  test   %al,%dl
  jne    L234
  test   %rbx,%rbx
  jne    L92
  movswl %r11w,%ecx
  movslq %ecx,%rdx
  cmp    $0x16,%r11w
  jle    L7
  jmp    L92
L76:
  mov    $0x2e,%edi
  call   <malloc@plt>
  mov    %rax,%r9
  test   %rbx,%rbx
  jne    L12
  xor    %edx,%edx
  xor    %ecx,%ecx
L7:
  mov    $0x17,%eax
  lea    (%r9,%rdx,2),%rdx
  xor    %edi,%edi
  sub    %ecx,%eax
  add    %rax,%rax
  cmp    $0x8,%eax
  jae    L241
  test   $0x4,%al
  jne    L137
  test   %eax,%eax
  je     L92
  movb   $0x0,(%rdx)
  test   $0x2,%al
  je     L92
  mov    %eax,%eax
  xor    %ecx,%ecx
  mov    %cx,-0x2(%rdx,%rax,1)
  jmp    L92
  nopl   0x0(%rax)
L60:
  sub    %eax,%r10d
  nopl   0x0(%rax,%rax,1)
L203:
  movzwl (%r9,%rcx,2),%edx
  lea    (%r10,%rcx,1),%eax
  add    $0x1,%rcx
  movswq %ax,%rax
  mov    %dx,(%r9,%rax,2)
  cmp    $0x17,%ecx
  jle    L203
  jmp    L92
L241:
  mov    %eax,%ecx
  movq   $0x0,(%rdx)
  movq   $0x0,-0x8(%rdx,%rcx,1)
  lea    0x8(%rdx),%rcx
  and    $0xfffffffffffffff8,%rcx
  sub    %rcx,%rdx
  add    %edx,%eax
  and    $0xfffffff8,%eax
  cmp    $0x8,%eax
  jb     L92
  and    $0xfffffff8,%eax
  xor    %edx,%edx
L123:
  mov    %edx,%esi
  add    $0x8,%edx
  mov    %rdi,(%rcx,%rsi,1)
  cmp    %eax,%edx
  jb     L123
  jmp    L92
L137:
  mov    %eax,%eax
  movl   $0x0,(%rdx)
  movl   $0x0,-0x4(%rdx,%rax,1)
  jmp    L92
L40:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
short *find_mantissa(unsigned long number_in_scientific, int count_digits) {
  unsigned long one = 1ul;
  int i;
  for (i = 0; i < count_digits - 1; i++) {
    one *= 10;
  }
  if (number_in_scientific > one) {
    number_in_scientific -= one;
  }
  short *mantissa;
  mantissa = (short *)malloc(23 * sizeof(short));
  short mantissa_index = 0;
  unsigned long results[23];
  int res_index = 0;
  unsigned long res = number_in_scientific;
  short result_repeating = 0;
  int result_repeat_start = 0;
  while (mantissa_index <= 23 && res != 0 && result_repeating == 0) {
    res *= 2;
    if (res >= one) {
      mantissa[mantissa_index] = 1;
    } else {
      mantissa[mantissa_index] = 0;
    }
    mantissa_index++;
    if (res >= one) {
      res -= one;
    }
    if (res > 10) {
      res /= 10;
      one /= 10;
    }
    for (i = 0; i < res_index; i++) {
      if (results[i] == res) {
        result_repeat_start = i + 1;
        result_repeating = 1;
        break;
      }
    }
    if (result_repeating == 0) {
      results[res_index] = res;
      res_index++;
    }
  }
  if (res != 0 && result_repeating == 1) {
    for (i = result_repeat_start; i <= 23; i++) {
      mantissa[mantissa_index] = mantissa[i];
      mantissa_index++;
    }
  }
  if (res == 0 && result_repeating == 0) {
    for (i = mantissa_index; i < 23; i++) {
      mantissa[i] = 0;
    }
  }
  return mantissa;
}
```