user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<cycles_per_second>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x10(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <gettimeofday@plt>
  mov    -0x10(%rbp),%eax
  imul   $0x3e8,%eax,%ecx
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  imul   $0x10624dd3,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x6,%edx
  sar    $0x1f,%eax
  mov    %eax,%esi
  mov    %edx,%eax
  sub    %esi,%eax
  add    %ecx,%eax
  cltq
  mov    %rax,-0x30(%rbp)
L15:
  lea    -0x10(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <gettimeofday@plt>
  mov    -0x10(%rbp),%eax
  imul   $0x3e8,%eax,%ecx
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  imul   $0x10624dd3,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x6,%edx
  sar    $0x1f,%eax
  mov    %eax,%esi
  mov    %edx,%eax
  sub    %esi,%eax
  add    %ecx,%eax
  cltq
  mov    %rax,-0x28(%rbp)
  mov    -0x28(%rbp),%rax
  cmp    -0x30(%rbp),%rax
  je     L15
L19:
  lea    -0x10(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <gettimeofday@plt>
  mov    -0x10(%rbp),%eax
  imul   $0x3e8,%eax,%ecx
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  imul   $0x10624dd3,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x6,%edx
  sar    $0x1f,%eax
  mov    %eax,%esi
  mov    %edx,%eax
  sub    %esi,%eax
  add    %ecx,%eax
  cltq
  mov    %rax,-0x28(%rbp)
  mov    -0x28(%rbp),%rax
  sub    -0x30(%rbp),%rax
  cmp    $0x1,%rax
  jbe    L19
  rdtsc
  shl    $0x20,%rdx
  or     %rdx,%rax
  mov    %rax,-0x20(%rbp)
  nop
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x30(%rbp)
L6:
  lea    -0x10(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <gettimeofday@plt>
  mov    -0x10(%rbp),%eax
  imul   $0x3e8,%eax,%ecx
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  imul   $0x10624dd3,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x6,%edx
  sar    $0x1f,%eax
  mov    %eax,%esi
  mov    %edx,%eax
  sub    %esi,%eax
  add    %ecx,%eax
  cltq
  mov    %rax,-0x28(%rbp)
  mov    -0x28(%rbp),%rax
  sub    -0x30(%rbp),%rax
  cmp    $0x3e8,%rax
  jbe    L6
  rdtsc
  shl    $0x20,%rdx
  or     %rdx,%rax
  mov    %rax,-0x18(%rbp)
  nop
  mov    -0x18(%rbp),%rax
  sub    -0x20(%rbp),%rax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L36
  call   <__stack_chk_fail@plt>
L36:
  leave
  ret
```

assistant: ```c
unsigned long long cycles_per_second() {
  double seconds;
  unsigned long long starttick, endtick;
  unsigned long long starttime, endtime;
  struct timeval tv;
  gettimeofday(&tv, 0);
  starttime = tv.tv_sec * 1000 + tv.tv_usec / 1000;
  while (1) {
    gettimeofday(&tv, 0);
    endtime = tv.tv_sec * 1000 + tv.tv_usec / 1000;
    if (endtime != starttime) {
      break;
    }
  }
  while (1) {
    gettimeofday(&tv, 0);
    endtime = tv.tv_sec * 1000 + tv.tv_usec / 1000;
    if ((endtime - starttime) > 1) {
      ({
        __asm__ __volatile__("rdtsc\n\t"
                             "shlq\t$32, %%rdx\n\t"
                             "orq\t%%rdx, %%rax\n\t"
                             : "=A"(starttick)
                             :
                             : "%rdx");
      });
      break;
    }
  }
  starttime = endtime;
  while (1) {
    gettimeofday(&tv, 0);
    endtime = tv.tv_sec * 1000 + tv.tv_usec / 1000;
    if ((endtime - starttime) > 1000) {
      ({
        __asm__ __volatile__("rdtsc\n\t"
                             "shlq\t$32, %%rdx\n\t"
                             "orq\t%%rdx, %%rax\n\t"
                             : "=A"(endtick)
                             :
                             : "%rdx");
      });
      break;
    }
  }
  return (endtick - starttick);
}
```