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

```asm
<fannkuch>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xa8,%rsp
  mov    %edi,0x18(%rsp)
  movq   $0x0,0x8(%rsp)
  test   %edi,%edi
  jg     L444
L13:
  mov    0x8(%rsp),%rax
  add    $0xa8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L444:
  mov    %edi,%r14d
  mov    $0x4,%esi
  call   <calloc@plt>
  mov    $0x4,%esi
  mov    %r14d,%edi
  mov    %rax,%rbx
  call   <calloc@plt>
  mov    %r14d,%edi
  mov    $0x4,%esi
  mov    %rax,%rbp
  call   <calloc@plt>
  mov    %r14d,%edi
  mov    %rax,%r12
  lea    -0x1(%r14),%eax
  mov    %eax,0x1c(%rsp)
  cmp    $0x2,%eax
  jbe    L342
  shr    $0x2,%edi
  movdqa D36(%rip),%xmm0
  movdqa D60(%rip),%xmm2
  mov    %rbp,%rax
  mov    %edi,%edx
  shl    $0x4,%rdx
  add    %rbp,%rdx
L664:
  movdqa %xmm0,%xmm1
  add    $0x10,%rax
  paddd  %xmm2,%xmm0
  movups %xmm1,-0x10(%rax)
  cmp    %rdx,%rax
  jne    L664
  mov    0x18(%rsp),%edi
  mov    %edi,%eax
  and    $0xfffffffc,%eax
  and    $0x3,%edi
  je     L552
L325:
  movslq %eax,%rdx
  mov    0x18(%rsp),%edi
  mov    %eax,0x0(%rbp,%rdx,4)
  lea    0x0(,%rdx,4),%rcx
  lea    0x1(%rax),%edx
  cmp    %edx,%edi
  jle    L552
  add    $0x2,%eax
  mov    %edx,0x4(%rbp,%rcx,1)
  cmp    %eax,%edi
  jle    L552
  mov    %eax,0x8(%rbp,%rcx,1)
L552:
  movslq 0x1c(%rsp),%rax
  lea    0x8(%rbp),%rdx
  mov    %rbp,%r13
  mov    %r12,%r15
  movl   $0x0,0x10(%rsp)
  movq   $0x0,0x8(%rsp)
  mov    %rax,%rdi
  lea    0x0(%rbp,%rax,4),%rax
  mov    %rax,0x30(%rsp)
  mov    0x18(%rsp),%eax
  mov    %rax,%r14
  lea    0x0(%rbp,%rax,4),%rax
  mov    %rax,0x50(%rsp)
  lea    0x4(%rbx),%rax
  lea    -0x2(%r14),%esi
  mov    %rax,0x48(%rsp)
  sub    %rdx,%rax
  cmp    $0x8,%rax
  mov    %esi,0x3c(%rsp)
  seta   %dl
  cmp    $0x2,%esi
  seta   %al
  and    %eax,%edx
  mov    %edi,%eax
  and    $0xfffffffc,%edi
  shr    $0x2,%eax
  mov    %edi,0x9c(%rsp)
  sub    $0x1,%eax
  mov    %dl,0x5b(%rsp)
  shl    $0x4,%rax
  add    $0x14,%rax
  mov    %rax,0x68(%rsp)
  lea    0x1(%rdi),%eax
  shl    $0x2,%rax
  lea    0x0(%rbp,%rax,1),%rsi
  add    %rbx,%rax
  mov    %rax,0x70(%rsp)
  lea    0x2(%rdi),%eax
  mov    %eax,0x98(%rsp)
  shl    $0x2,%rax
  mov    %rsi,0x60(%rsp)
  lea    0x0(%rbp,%rax,1),%rsi
  add    %rbx,%rax
  mov    %rax,0x80(%rsp)
  lea    0x3(%rdi),%eax
  mov    %eax,0x5c(%rsp)
  shl    $0x2,%rax
  lea    0x0(%rbp,%rax,1),%rdi
  add    %rbx,%rax
  mov    %rsi,0x78(%rsp)
  mov    %rax,0x90(%rsp)
  mov    0x10(%rsp),%eax
  mov    %rdi,0x88(%rsp)
  mov    %eax,0x38(%rsp)
  cmp    $0x1d,%eax
  jle    L371
L779:
  cmp    $0x1,%r14d
  je     L455
  lea    -0x2(%r14),%eax
  lea    -0x1(%r14),%ecx
  cmp    $0x2,%eax
  jbe    L191
  movslq %r14d,%rax
  mov    %ecx,%esi
  movd   %r14d,%xmm7
  shr    $0x2,%esi
  lea    -0x10(%r15,%rax,4),%rdx
  pshufd $0x0,%xmm7,%xmm1
  lea    -0x1(%rsi),%edi
  lea    -0x10(%rdx),%rax
  shl    $0x4,%rdi
  mov    %rax,%rsi
  paddd  D22(%rip),%xmm1
  sub    %rdi,%rsi
  jmp    L442
  nopl   0x0(%rax)
L30:
  sub    $0x10,%rax
L442:
  movdqa %xmm1,%xmm0
  paddd  D20(%rip),%xmm1
  pshufd $0x1b,%xmm0,%xmm0
  movups %xmm0,(%rdx)
  mov    %rax,%rdx
  cmp    %rax,%rsi
  jne    L30
  mov    %ecx,%eax
  and    $0xfffffffc,%eax
  sub    %eax,%r14d
  cmp    %eax,%ecx
  je     L455
  lea    -0x1(%r14),%ecx
L191:
  movslq %r14d,%rax
  mov    %r14d,-0x4(%r15,%rax,4)
  cmp    $0x1,%ecx
  je     L455
  movslq %ecx,%rax
  mov    %ecx,-0x4(%r15,%rax,4)
  lea    -0x2(%r14),%eax
  cmp    $0x3,%r14d
  je     L455
  movslq %eax,%rdx
  mov    %eax,-0x4(%r15,%rdx,4)
L455:
  mov    0x0(%r13),%r10d
  test   %r10d,%r10d
  je     L255
  mov    0x30(%rsp),%rax
  mov    0x1c(%rsp),%edi
  cmp    %edi,(%rax)
  jne    L173
L255:
  cmpl   $0x1,0x18(%rsp)
  je     L13
  mov    0x3c(%rsp),%ebp
  lea    0x4(%r13),%r12
  mov    %rbx,0x40(%rsp)
  mov    %r13,%rcx
  mov    %r12,0x28(%rsp)
  lea    0x2(%rbp),%rax
  mov    $0x1,%ebp
  mov    %rax,0x20(%rsp)
  mov    %rax,%rbx
  jmp    L162
  nopl   0x0(%rax)
L787:
  add    $0x1,%rbp
  cmp    %rbx,%rbp
  je     L13
L162:
  mov    (%rcx),%r13d
  mov    %rcx,%rdi
  mov    %r12,%rsi
  mov    %ebp,%r14d
  lea    0x0(,%rbp,4),%rdx
  call   <memmove@plt>
  mov    %r13d,(%rax,%rbp,4)
  mov    %rax,%rcx
  mov    (%r15,%rbp,4),%eax
  sub    $0x1,%eax
  mov    %eax,(%r15,%rbp,4)
  test   %eax,%eax
  jle    L787
  cmpl   $0x1d,0x10(%rsp)
  mov    0x40(%rsp),%rbx
  mov    %rcx,%r13
  jg     L423
  mov    0x38(%rsp),%eax
  mov    %eax,0x10(%rsp)
  mov    0x10(%rsp),%eax
  mov    %eax,0x38(%rsp)
  cmp    $0x1d,%eax
  jg     L779
L371:
  mov    0x50(%rsp),%r12
  mov    %rbx,0x20(%rsp)
  lea    D48(%rip),%rbp
  mov    %r13,%rbx
L158:
  mov    (%rbx),%eax
  mov    %rbp,%rdi
  add    $0x4,%rbx
  lea    0x1(%rax),%esi
  xor    %eax,%eax
  call   <printf@plt>
  cmp    %r12,%rbx
  jne    L158
  mov    $0xa,%edi
  mov    0x20(%rsp),%rbx
  call   <putchar@plt>
  mov    0x10(%rsp),%eax
  add    $0x1,%eax
  mov    %eax,0x38(%rsp)
  jmp    L779
  nopw   0x0(%rax,%rax,1)
L423:
  mov    0x28(%rsp),%r13
  mov    %rcx,%rbp
  mov    %r15,%r12
  mov    %r13,0x10(%rsp)
L609:
  cmp    $0x1,%r14d
  je     L447
  lea    -0x2(%r14),%eax
  lea    -0x1(%r14),%ecx
  cmp    $0x2,%eax
  jbe    L700
  movslq %r14d,%rax
  mov    %ecx,%esi
  movd   %r14d,%xmm7
  shr    $0x2,%esi
  lea    -0x10(%r12,%rax,4),%rdx
  pshufd $0x0,%xmm7,%xmm1
  lea    -0x1(%rsi),%edi
  lea    -0x10(%rdx),%rax
  shl    $0x4,%rdi
  mov    %rax,%rsi
  paddd  D22(%rip),%xmm1
  sub    %rdi,%rsi
  jmp    L813
  nopl   0x0(%rax)
L319:
  sub    $0x10,%rax
L813:
  movdqa %xmm1,%xmm0
  paddd  D20(%rip),%xmm1
  pshufd $0x1b,%xmm0,%xmm0
  movups %xmm0,(%rdx)
  mov    %rax,%rdx
  cmp    %rsi,%rax
  jne    L319
  mov    %ecx,%eax
  and    $0xfffffffc,%eax
  sub    %eax,%r14d
  cmp    %eax,%ecx
  je     L447
  lea    -0x1(%r14),%ecx
L700:
  movslq %r14d,%rax
  mov    %r14d,-0x4(%r12,%rax,4)
  cmp    $0x1,%ecx
  je     L447
  movslq %ecx,%rax
  mov    %ecx,-0x4(%r12,%rax,4)
  lea    -0x2(%r14),%eax
  cmp    $0x3,%r14d
  je     L447
  movslq %eax,%rdx
  mov    %eax,-0x4(%r12,%rdx,4)
L447:
  mov    0x0(%rbp),%eax
  test   %eax,%eax
  je     L810
  mov    0x30(%rsp),%rax
  mov    0x1c(%rsp),%edi
  cmp    (%rax),%edi
  jne    L327
L810:
  mov    %rbx,0x28(%rsp)
  mov    0x10(%rsp),%r13
  mov    $0x1,%r15d
  mov    %rbp,%rcx
  mov    0x20(%rsp),%rbx
  jmp    L825
  nopl   0x0(%rax)
L713:
  add    $0x1,%r15
  cmp    %r15,%rbx
  je     L13
L825:
  mov    (%rcx),%ebp
  mov    %rcx,%rdi
  lea    0x0(,%r15,4),%rdx
  mov    %r13,%rsi
  call   <memmove@plt>
  mov    %r15d,%r14d
  mov    %ebp,(%rax,%r15,4)
  mov    %rax,%rcx
  mov    (%r12,%r15,4),%eax
  sub    $0x1,%eax
  mov    %eax,(%r12,%r15,4)
  test   %eax,%eax
  jle    L713
  mov    0x28(%rsp),%rbx
  mov    %rcx,%rbp
  jmp    L609
L173:
  cmpl   $0x1,0x18(%rsp)
  je     L352
  cmpb   $0x0,0x5b(%rsp)
  je     L468
  mov    0x68(%rsp),%rdx
  mov    $0x4,%eax
  nopl   0x0(%rax,%rax,1)
L87:
  movdqu 0x0(%r13,%rax,1),%xmm5
  movups %xmm5,(%rbx,%rax,1)
  add    $0x10,%rax
  cmp    %rax,%rdx
  jne    L87
  mov    0x1c(%rsp),%edi
  cmp    %edi,0x9c(%rsp)
  je     L52
  mov    0x60(%rsp),%rax
  mov    0x70(%rsp),%rdi
  mov    (%rax),%eax
  mov    %eax,(%rdi)
  mov    0x18(%rsp),%edi
  mov    0x98(%rsp),%eax
  cmp    %eax,%edi
  jle    L52
  mov    0x78(%rsp),%rax
  mov    0x80(%rsp),%rsi
  mov    (%rax),%eax
  mov    %eax,(%rsi)
  mov    0x5c(%rsp),%eax
  cmp    %eax,%edi
  jle    L52
  mov    0x88(%rsp),%rax
  mov    0x90(%rsp),%rdi
  mov    (%rax),%eax
  mov    %eax,(%rdi)
L52:
  mov    0x0(%r13),%r10d
L352:
  lea    -0x1(%r10),%eax
  mov    0x48(%rsp),%rdi
  xor    %r14d,%r14d
  lea    0x14(%rbx),%r8
  cmp    $0x1,%eax
  jle    L363
  nopl   0x0(%rax,%rax,1)
L25:
  lea    -0x3(%r10),%ecx
  movslq %r10d,%rsi
  mov    %ecx,%ebp
  lea    0x0(,%rsi,4),%r11
  shr    %ebp
  lea    0x1(%rbp),%edx
  lea    0x4(,%rdx,4),%r12
  mov    %rdx,%r9
  neg    %rdx
  lea    (%r11,%rdx,4),%rdx
  cmp    %rdx,%r12
  lea    (%rbx,%r11,1),%rdx
  setle  %r12b
  cmp    %rdx,%rdi
  setae  %dl
  or     %r12b,%dl
  je     L679
  cmp    $0x1,%ecx
  jbe    L679
  cmp    $0x5,%ecx
  jbe    L486
  mov    %r9d,%r12d
  mov    %rdi,%rdx
  lea    -0x10(%rbx,%r11,1),%rcx
  shr    $0x2,%r12d
  sub    $0x1,%r12d
  shl    $0x4,%r12
  add    %r8,%r12
  xchg   %ax,%ax
L770:
  movdqu (%rcx),%xmm3
  movdqu (%rdx),%xmm0
  add    $0x10,%rdx
  sub    $0x10,%rcx
  pshufd $0x1b,%xmm3,%xmm1
  pshufd $0x1b,%xmm0,%xmm0
  movups %xmm1,-0x10(%rdx)
  movups %xmm0,0x10(%rcx)
  cmp    %rdx,%r12
  jne    L770
  mov    %r9d,%ecx
  and    $0xfffffffc,%ecx
  lea    0x1(%rcx),%edx
  sub    %ecx,%eax
  cmp    %ecx,%r9d
  je     L775
L232:
  sub    %ecx,%r9d
  cmp    %ecx,%ebp
  je     L142
  lea    0x4(%rbx,%rcx,4),%rbp
  neg    %rcx
  lea    -0x8(%r11,%rcx,4),%rcx
  movq   0x0(%rbp),%xmm0
  add    %rbx,%rcx
  movq   (%rcx),%xmm1
  pshufd $0xe1,%xmm0,%xmm0
  pshufd $0xe1,%xmm1,%xmm1
  movq   %xmm1,0x0(%rbp)
  movq   %xmm0,(%rcx)
  mov    %r9d,%ecx
  and    $0xfffffffe,%ecx
  add    %ecx,%edx
  sub    %ecx,%eax
  cmp    %ecx,%r9d
  je     L775
L142:
  movslq %edx,%rdx
  cltq
  lea    (%rbx,%rdx,4),%rdx
  lea    (%rbx,%rax,4),%rax
  mov    (%rdx),%ecx
  mov    (%rax),%r9d
  mov    %r9d,(%rdx)
  mov    %ecx,(%rax)
L775:
  lea    (%rbx,%rsi,4),%rax
  add    $0x1,%r14
  mov    (%rax),%edx
  mov    %r10d,(%rax)
  test   %edx,%edx
  je     L534
  mov    %edx,%r10d
  lea    -0x1(%r10),%eax
  cmp    $0x1,%eax
  jg     L25
L363:
  movslq %r10d,%rsi
  jmp    L775
L679:
  cltq
  mov    $0x1,%edx
  nopl   (%rax)
L712:
  mov    (%rbx,%rdx,4),%ecx
  mov    (%rbx,%rax,4),%r9d
  mov    %r9d,(%rbx,%rdx,4)
  add    $0x1,%rdx
  mov    %ecx,(%rbx,%rax,4)
  sub    $0x1,%rax
  cmp    %edx,%eax
  jg     L712
  jmp    L775
L534:
  mov    0x8(%rsp),%rax
  cmp    %r14,%rax
  cmovge %rax,%r14
  mov    %r14,0x8(%rsp)
  jmp    L255
L327:
  cmpb   $0x0,0x5b(%rsp)
  je     L198
  mov    0x68(%rsp),%rdx
  mov    $0x4,%eax
  nopw   0x0(%rax,%rax,1)
L348:
  movdqu 0x0(%rbp,%rax,1),%xmm6
  movups %xmm6,(%rbx,%rax,1)
  add    $0x10,%rax
  cmp    %rax,%rdx
  jne    L348
  mov    0x1c(%rsp),%edi
  cmp    %edi,0x9c(%rsp)
  je     L410
  mov    0x60(%rsp),%rax
  mov    0x70(%rsp),%rdi
  mov    (%rax),%eax
  mov    %eax,(%rdi)
  mov    0x18(%rsp),%edi
  mov    0x98(%rsp),%eax
  cmp    %eax,%edi
  jle    L410
  mov    0x78(%rsp),%rax
  mov    0x80(%rsp),%rsi
  mov    (%rax),%eax
  mov    %eax,(%rsi)
  mov    0x5c(%rsp),%eax
  cmp    %eax,%edi
  jle    L410
  mov    0x88(%rsp),%rax
  mov    0x90(%rsp),%rdi
  mov    (%rax),%eax
  mov    %eax,(%rdi)
L410:
  mov    0x0(%rbp),%r8d
  mov    0x48(%rsp),%rdi
  xor    %r14d,%r14d
  lea    0x14(%rbx),%r15
  lea    -0x1(%r8),%eax
  cmp    $0x1,%eax
  jle    L507
  nopw   0x0(%rax,%rax,1)
L697:
  lea    -0x3(%r8),%ecx
  movslq %r8d,%rsi
  mov    %ecx,%r11d
  lea    0x0(,%rsi,4),%r10
  shr    %r11d
  lea    0x1(%r11),%edx
  lea    0x4(,%rdx,4),%r13
  mov    %rdx,%r9
  neg    %rdx
  lea    (%r10,%rdx,4),%rdx
  cmp    %rdx,%r13
  lea    (%rbx,%r10,1),%rdx
  setle  %r13b
  cmp    %rdx,%rdi
  setae  %dl
  or     %r13b,%dl
  je     L606
  cmp    $0x1,%ecx
  jbe    L606
  cmp    $0x5,%ecx
  jbe    L58
  mov    %r9d,%r13d
  mov    %rdi,%rdx
  lea    -0x10(%rbx,%r10,1),%rcx
  shr    $0x2,%r13d
  sub    $0x1,%r13d
  shl    $0x4,%r13
  add    %r15,%r13
  nopl   0x0(%rax)
L24:
  movdqu (%rcx),%xmm4
  movdqu (%rdx),%xmm0
  add    $0x10,%rdx
  sub    $0x10,%rcx
  pshufd $0x1b,%xmm4,%xmm1
  pshufd $0x1b,%xmm0,%xmm0
  movups %xmm1,-0x10(%rdx)
  movups %xmm0,0x10(%rcx)
  cmp    %rdx,%r13
  jne    L24
  mov    %r9d,%ecx
  and    $0xfffffffc,%ecx
  lea    0x1(%rcx),%edx
  sub    %ecx,%eax
  cmp    %ecx,%r9d
  je     L40
L751:
  sub    %ecx,%r9d
  cmp    %ecx,%r11d
  je     L151
  lea    0x4(%rbx,%rcx,4),%r11
  neg    %rcx
  lea    -0x8(%r10,%rcx,4),%rcx
  movq   (%r11),%xmm0
  add    %rbx,%rcx
  movq   (%rcx),%xmm1
  pshufd $0xe1,%xmm0,%xmm0
  pshufd $0xe1,%xmm1,%xmm1
  movq   %xmm1,(%r11)
  movq   %xmm0,(%rcx)
  mov    %r9d,%ecx
  and    $0xfffffffe,%ecx
  add    %ecx,%edx
  sub    %ecx,%eax
  cmp    %ecx,%r9d
  je     L40
L151:
  movslq %edx,%rdx
  cltq
  lea    (%rbx,%rdx,4),%rdx
  lea    (%rbx,%rax,4),%rax
  mov    (%rdx),%ecx
  mov    (%rax),%r9d
  mov    %r9d,(%rdx)
  mov    %ecx,(%rax)
L40:
  lea    (%rbx,%rsi,4),%rax
  add    $0x1,%r14
  mov    (%rax),%edx
  mov    %r8d,(%rax)
  test   %edx,%edx
  je     L645
  mov    %edx,%r8d
  lea    -0x1(%r8),%eax
  cmp    $0x1,%eax
  jg     L697
L507:
  movslq %r8d,%rsi
  jmp    L40
L606:
  cltq
  mov    $0x1,%edx
  cs nopw 0x0(%rax,%rax,1)
L172:
  mov    (%rbx,%rdx,4),%ecx
  mov    (%rbx,%rax,4),%r9d
  mov    %r9d,(%rbx,%rdx,4)
  add    $0x1,%rdx
  mov    %ecx,(%rbx,%rax,4)
  sub    $0x1,%rax
  cmp    %edx,%eax
  jg     L172
  jmp    L40
L645:
  mov    0x8(%rsp),%rax
  cmp    %r14,%rax
  cmovge %rax,%r14
  mov    %r14,0x8(%rsp)
  jmp    L810
L58:
  xor    %ecx,%ecx
  mov    $0x1,%edx
  jmp    L751
L486:
  xor    %ecx,%ecx
  mov    $0x1,%edx
  jmp    L232
L342:
  xor    %eax,%eax
  jmp    L325
L198:
  mov    0x20(%rsp),%rcx
  mov    $0x1,%eax
L473:
  mov    0x0(%rbp,%rax,4),%edx
  mov    %edx,(%rbx,%rax,4)
  add    $0x1,%rax
  cmp    %rax,%rcx
  jne    L473
  jmp    L410
L468:
  mov    0x3c(%rsp),%ecx
  mov    $0x1,%eax
  add    $0x2,%rcx
L222:
  mov    0x0(%r13,%rax,4),%edx
  mov    %edx,(%rbx,%rax,4)
  add    $0x1,%rax
  cmp    %rax,%rcx
  jne    L222
  jmp    L52
```

tool_calls: name: read_data
arguments: data_label: D36
type: byte[16]
name: read_data
arguments: data_label: D60
type: byte[16]
name: read_data
arguments: data_label: D22
type: byte[16]
name: read_data
arguments: data_label: D20
type: byte[16]
name: read_data
arguments: data_label: D48
type: string

tool: {"D36": [0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x03,0x00,0x00,0x00]}

tool: {"D60": [0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00]}

tool: {"D22": [0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xfe,0xff,0xff,0xff,0xfd,0xff,0xff,0xff]}

tool: {"D20": [0xfc,0xff,0xff,0xff,0xfc,0xff,0xff,0xff,0xfc,0xff,0xff,0xff,0xfc,0xff,0xff,0xff]}

tool: D48: %d

assistant: ```c
long fannkuch(int n) {
  int *perm;
  int *perm1;
  int *count;
  long flips;
  long flipsMax;
  int r;
  int i;
  int k;
  int didpr;
  const int n1 = n - 1;
  if (n < 1)
    return 0;
  perm = calloc(n, sizeof(*perm));
  perm1 = calloc(n, sizeof(*perm1));
  count = calloc(n, sizeof(*count));
  for (i = 0; i < n; ++i)
    perm1[i] = i;
  r = n;
  didpr = 0;
  flipsMax = 0;
  for (;;) {
    if (didpr < 30) {
      for (i = 0; i < n; ++i)
        printf("%d", (int)(1 + perm1[i]));
      printf("\n");
      ++didpr;
    }
    for (; r != 1; --r) {
      count[r - 1] = r;
    }
    if (!(perm1[0] == 0 || perm1[n1] == n1)) {
      flips = 0;
      for (i = 1; i < n; ++i) {
        perm[i] = perm1[i];
      }
      k = perm1[0];
      do {
        int j;
        for (i = 1, j = k - 1; i < j; ++i, --j) {
          {
            int t_mp;
            t_mp = (perm[i]);
            (perm[i]) = (perm[j]);
            (perm[j]) = t_mp;
          }
        }
        ++flips;
        j = perm[k];
        perm[k] = k;
        k = j;
      } while (k);
      if (flipsMax < flips) {
        flipsMax = flips;
      }
    }
    for (;;) {
      if (r == n) {
        return flipsMax;
      }
      {
        int perm0 = perm1[0];
        i = 0;
        while (i < r) {
          k = i + 1;
          perm1[i] = perm1[k];
          i = k;
        }
        perm1[r] = perm0;
      }
      if ((count[r] -= 1) > 0) {
        break;
      }
      ++r;
    }
  }
}
```