user: Translate the below assembly code into C programming language:

```asm
<fin42f>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x148,%rsp
  mov    %esi,%r15d
  mov    %edx,0x34(%rsp)
  mov    %ecx,%r14d
  mov    %r8d,%r13d
  mov    %r9d,0x40(%rsp)
  mov    0x180(%rsp),%rax
  mov    %rax,0x88(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x138(%rsp)
  xor    %eax,%eax
  lea    0x90(%rsp),%rcx
  mov    %rcx,0x80(%rsp)
  lea    0x138(%rsp),%r8
L2012:
  mov    %rdi,%rsi
  mov    $0x0,%eax
L420:
  mov    (%rsi,%rax,1),%edx
  mov    %edx,(%rcx,%rax,1)
  add    $0x4,%rax
  cmp    $0x1c,%rax
  jne    L420
  add    $0x1c,%rdi
  add    $0x1c,%rcx
  cmp    %r8,%rcx
  jne    L2012
  cmp    $0xffffffff,%r13d
  je     L1967
  movslq %r13d,%rax
  movslq %r14d,%rdx
  lea    (%rax,%rdx,8),%rax
  sub    %rdx,%rax
  mov    %r15d,0x90(%rsp,%rax,4)
L1967:
  mov    0x80(%rsp),%rax
  mov    %rax,0x60(%rsp)
  movl   $0xfffffffe,0x68(%rsp)
  movl   $0xffffffff,0x30(%rsp)
  movl   $0x1,0x58(%rsp)
  movq   $0x0,0x28(%rsp)
  mov    %r15d,%eax
  neg    %eax
  mov    %eax,0x70(%rsp)
  mov    %r13d,%r12d
  jmp    L2558
L2738:
  cmp    %r15d,-0x38(%r10)
  jne    L327
  cmp    %r15d,-0x54(%r10)
  sete   %dl
  cmp    %ebp,%r14d
  setl   %al
  test   %al,%dl
  je     L327
  lea    -0x3(%rbp),%eax
  cmp    %eax,%r14d
  jl     L327
  cmpl   $0x0,0x34(%rsp)
  jne    L467
  mov    0x8(%rsp),%rax
  mov    0x70(%rsp),%edi
  mov    %edi,(%rax)
  mov    0x4c(%rsp),%eax
  mov    %eax,0x50(%rsp)
  mov    %ebp,0x74(%rsp)
  movl   $0x2,0x34(%rsp)
  jmp    L2493
L467:
  mov    0x88(%rsp),%rax
  mov    %ebp,(%rax)
  jmp    L42
L2728:
  cmpl   $0x2,0x44(%rsp)
  jle    L2675
  cmp    %r15d,0x0(%r13)
  je     L1497
  cmpl   $0x3,0x68(%rsp)
  ja     L630
  jmp    L2402
L1497:
  mov    0x20(%rsp),%rax
  cmp    %r15d,(%rax)
  je     L2267
L2525:
  cmpl   $0x3,0x68(%rsp)
  jbe    L839
  cmpl   $0x3,0x30(%rsp)
  ja     L2402
  mov    0x30(%rsp),%ecx
  jmp    L1601
L2267:
  mov    0x8(%rsp),%rax
  cmp    %r15d,-0xc(%rax)
  jne    L2525
  cmp    %r12d,0x68(%rsp)
  sete   %dl
  cmp    %r12d,0x30(%rsp)
  sete   %al
  or     %dl,%al
  jne    L1427
  mov    0x6c(%rsp),%eax
  sub    $0x3,%eax
  cmp    %r12d,%eax
  jne    L2525
L1427:
  cmpl   $0x0,0x34(%rsp)
  jne    L2595
  mov    0x8(%rsp),%rax
  mov    0x70(%rsp),%edi
  mov    %edi,(%rax)
  mov    0x4c(%rsp),%eax
  mov    %eax,0x50(%rsp)
  mov    %ebp,0x74(%rsp)
  movl   $0x2,0x34(%rsp)
L2675:
  cmpl   $0x3,0x68(%rsp)
  jbe    L2686
L630:
  cmpl   $0x3,0x30(%rsp)
  jbe    L1160
L2402:
  cmpl   $0x3,0x44(%rsp)
  jg     L2493
  mov    0x58(%rsp),%eax
  mov    0x10(%rsp),%rsi
  cmp    %r15d,(%rsi)
  jne    L2493
L205:
  mov    0x18(%rsp),%rsi
  cmp    %r15d,(%rsi)
  jne    L2493
  mov    0x8(%rsp),%rdi
  cmp    %r15d,0xc(%rdi)
  jne    L2493
  cmp    %r12d,0x78(%rsp)
  sete   %cl
  cmp    %r12d,0x7c(%rsp)
  sete   %dl
  or     %cl,%dl
  jne    L2689
  cmp    %eax,%r12d
  jne    L2493
L2689:
  cmpl   $0x0,0x34(%rsp)
  jne    L1797
  mov    0x8(%rsp),%rax
  mov    0x70(%rsp),%edi
  mov    %edi,(%rax)
  mov    0x4c(%rsp),%eax
  mov    %eax,0x50(%rsp)
  mov    %ebp,0x74(%rsp)
  movl   $0x2,0x34(%rsp)
  jmp    L2493
L2595:
  mov    0x88(%rsp),%rax
  mov    %ebp,(%rax)
  jmp    L42
L2686:
  mov    0x30(%rsp),%ecx
  cmp    %r15d,0x0(%r13)
  jne    L2402
L1831:
  mov    0x20(%rsp),%rax
  cmp    %r15d,(%rax)
  jne    L198
  mov    0x10(%rsp),%rax
  cmp    %r15d,(%rax)
  jne    L198
  cmp    %r12d,0x68(%rsp)
  sete   %dl
  cmp    %r12d,0x58(%rsp)
  sete   %al
  or     %dl,%al
  jne    L1994
  cmp    %ecx,%r12d
  jne    L198
L1994:
  cmpl   $0x0,0x34(%rsp)
  je     L1732
  mov    0x88(%rsp),%rax
  mov    %ebp,(%rax)
  jmp    L42
L1732:
  mov    0x8(%rsp),%rax
  mov    0x70(%rsp),%edi
  mov    %edi,(%rax)
  mov    0x4c(%rsp),%eax
  mov    %eax,0x50(%rsp)
  mov    %ebp,0x74(%rsp)
  movl   $0x2,0x34(%rsp)
  jmp    L630
L1160:
  mov    0x30(%rsp),%ecx
  cmp    %r15d,0x0(%r13)
  jne    L2402
L1601:
  mov    0x10(%rsp),%rax
  cmp    %r15d,(%rax)
  jne    L2493
  mov    0x18(%rsp),%rax
  cmp    %r15d,(%rax)
  jne    L2515
  cmp    %r12d,0x78(%rsp)
  sete   %dl
  cmp    %r12d,0x58(%rsp)
  sete   %al
  or     %dl,%al
  jne    L1613
  cmp    %ecx,%r12d
  jne    L2515
L1613:
  cmpl   $0x0,0x34(%rsp)
  je     L1645
  mov    0x88(%rsp),%rax
  mov    %ebp,(%rax)
  jmp    L42
L1645:
  mov    0x8(%rsp),%rax
  mov    0x70(%rsp),%edi
  mov    %edi,(%rax)
  mov    0x4c(%rsp),%eax
  mov    %eax,0x50(%rsp)
  mov    %ebp,0x74(%rsp)
  movl   $0x2,0x34(%rsp)
  jmp    L2402
L1797:
  mov    0x88(%rsp),%rax
  mov    %ebp,(%rax)
  jmp    L42
L389:
  cmp    %eax,%r14d
  jne    L489
  cmp    %edx,%r12d
  mov    $0x1,%r8d
  cmove  %r8d,%edi
L489:
  add    $0x1,%esi
  cmp    $0x3,%esi
  jne    L2340
  cmp    $0x1,%edi
  je     L2804
L2340:
  sub    $0x1,%edx
  sub    $0x20,%rcx
  sub    $0x1,%eax
  js     L2365
  test   %edx,%edx
  js     L1386
L1453:
  cmp    %r15d,-0x20(%rcx)
  je     L389
  mov    0x4(%rsp),%r8d
  cmp    $0x3,%esi
  jne    L2052
  cmp    $0x1,%edi
  jne    L2052
L2804:
  cmpl   $0x0,0x34(%rsp)
  jne    L1215
  mov    0x8(%rsp),%rax
  mov    0x70(%rsp),%esi
  mov    %esi,(%rax)
  mov    0x4c(%rsp),%eax
  mov    %eax,0x50(%rsp)
  mov    %ebp,0x74(%rsp)
  movl   $0x2,0x34(%rsp)
L1595:
  cmpl   $0x0,0x40(%rsp)
  je     L1316
L2736:
  add    $0x1,%ebp
  add    $0x1,%rbx
  add    $0x1c,%r10
  addq   $0x1c,0x10(%rsp)
  addq   $0x1c,0x18(%rsp)
  add    $0x1c,%r13
  addq   $0x1c,0x20(%rsp)
  cmp    $0x6,%ebp
  je     L1316
L1992:
  mov    %r10,0x8(%rsp)
  mov    (%r10),%r8d
  test   %r8d,%r8d
  jne    L2736
  cmp    $0x2,%ebp
  jle    L327
  cmp    0x28(%rsp),%r12d
  jne    L327
  cmp    %r15d,-0x1c(%r10)
  je     L2738
L327:
  cmp    %ebp,%r14d
  je     L2728
L2493:
  lea    -0x1(%rbp),%r11d
  mov    0x30(%rsp),%r9d
  mov    %ebp,%eax
  neg    %eax
  mov    %eax,%edi
  shr    $0x1f,%edi
  mov    %edi,0x48(%rsp)
  test   %eax,%eax
  jns    L1835
  cmpb   $0x0,0x38(%rsp)
  je     L1835
  mov    %r10,%rcx
  mov    %r8d,%edi
  mov    %r9d,%edx
  mov    %r11d,%eax
  mov    %r8d,%esi
  mov    %r8d,0x4(%rsp)
  jmp    L1453
L1215:
  mov    0x88(%rsp),%rax
  mov    %ebp,(%rax)
  jmp    L42
L1386:
  mov    0x4(%rsp),%r8d
L2052:
  cmp    $0x3,%esi
  je     L1636
L1061:
  mov    %ebx,%edx
  mov    0x6c(%rsp),%eax
  add    $0x1,%eax
  cmp    $0x5,%ebx
  jg     L1636
  cmp    $0x6,%eax
  jg     L1636
  lea    0x20(%r10),%rcx
  mov    %r8d,0x4(%rsp)
  jmp    L985
L2365:
  mov    0x4(%rsp),%r8d
  jmp    L2052
L1835:
  mov    %r8d,%edi
  mov    %r8d,%esi
  jmp    L1061
L169:
  cmp    %edx,%r14d
  jne    L1062
  cmp    %eax,%r12d
  mov    $0x1,%r8d
  cmove  %r8d,%edi
L1062:
  add    $0x1,%esi
  cmp    $0x3,%esi
  jne    L2585
  cmp    $0x1,%edi
  je     L2381
L2585:
  add    $0x1,%edx
  add    $0x1,%eax
  add    $0x20,%rcx
  cmp    $0x5,%edx
  jg     L1801
  cmp    $0x6,%eax
  jg     L953
L985:
  cmp    %r15d,(%rcx)
  je     L169
  mov    0x4(%rsp),%r8d
  cmp    $0x3,%esi
  jne    L1636
  cmp    $0x1,%edi
  jne    L1636
L2381:
  cmpl   $0x0,0x34(%rsp)
  jne    L1151
  mov    0x8(%rsp),%rax
  mov    0x70(%rsp),%esi
  mov    %esi,(%rax)
  mov    0x4c(%rsp),%eax
  mov    %eax,0x50(%rsp)
  mov    %ebp,0x74(%rsp)
  movl   $0x2,0x34(%rsp)
  jmp    L1595
L1151:
  mov    0x88(%rsp),%rax
  mov    %ebp,(%rax)
  jmp    L42
L953:
  mov    0x4(%rsp),%r8d
L1636:
  cmpl   $0x2,0x34(%rsp)
  je     L1595
  mov    %ebx,%eax
  cmp    $0x5,%ebx
  jg     L2458
  cmpb   $0x0,0x38(%rsp)
  je     L2458
  mov    %r10,%rdx
  mov    %r8d,%ecx
  jmp    L1330
L1801:
  mov    0x4(%rsp),%r8d
  jmp    L1636
L1986:
  cmp    %eax,%r14d
  jne    L2341
  cmp    %r9d,%r12d
  mov    $0x1,%edi
  cmove  %edi,%ecx
L2341:
  add    $0x1,%r8d
  cmp    $0x3,%r8d
  jne    L2573
  cmp    $0x1,%ecx
  je     L1216
L2573:
  add    $0x1,%eax
  sub    $0x1,%r9d
  add    $0x18,%rdx
  cmp    $0x5,%eax
  jg     L2355
  test   %r9d,%r9d
  js     L2355
L1330:
  cmp    %r15d,0x18(%rdx)
  je     L1986
  cmp    $0x3,%r8d
  jne    L2355
  cmp    $0x1,%ecx
  jne    L2355
L1216:
  cmpl   $0x0,0x34(%rsp)
  jne    L1214
  mov    0x8(%rsp),%rax
  mov    0x70(%rsp),%edi
  mov    %edi,(%rax)
  mov    0x4c(%rsp),%eax
  mov    %eax,0x50(%rsp)
  mov    %ebp,0x74(%rsp)
  movl   $0x2,0x34(%rsp)
  jmp    L1595
L1214:
  mov    0x88(%rsp),%rax
  mov    %ebp,(%rax)
  jmp    L42
L2355:
  cmp    $0x3,%r8d
  je     L1595
L2562:
  mov    0x58(%rsp),%edi
  mov    %edi,%eax
  cmp    $0x6,%edi
  jg     L1595
  cmpb   $0x0,0x48(%rsp)
  je     L1595
  mov    %r10,%rdx
  jmp    L1862
L2458:
  mov    %r8d,%ecx
  jmp    L2562
L355:
  cmp    %r11d,%r14d
  jne    L2730
  cmp    %eax,%r12d
  mov    $0x1,%edi
  cmove  %edi,%ecx
L2730:
  add    $0x1,%r8d
  cmp    $0x3,%r8d
  jne    L1369
  cmp    $0x1,%ecx
  je     L930
L1369:
  add    $0x1,%eax
  sub    $0x18,%rdx
  sub    $0x1,%r11d
  js     L1595
  cmp    $0x6,%eax
  jg     L1595
L1862:
  cmp    %r15d,-0x18(%rdx)
  je     L355
  cmp    $0x3,%r8d
  jne    L1595
  cmp    $0x1,%ecx
  jne    L1595
L930:
  cmpl   $0x0,0x34(%rsp)
  jne    L1395
  mov    0x8(%rsp),%rax
  mov    0x70(%rsp),%edi
  mov    %edi,(%rax)
  mov    0x4c(%rsp),%eax
  mov    %eax,0x50(%rsp)
  mov    %ebp,0x74(%rsp)
  movl   $0x2,0x34(%rsp)
  jmp    L1595
L1395:
  mov    0x88(%rsp),%rax
  mov    %ebp,(%rax)
  jmp    L42
L1316:
  addq   $0x1,0x28(%rsp)
  mov    0x28(%rsp),%rax
  addl   $0x1,0x58(%rsp)
  addl   $0x1,0x30(%rsp)
  addl   $0x1,0x68(%rsp)
  cmp    $0x7,%rax
  je     L1338
L2558:
  mov    0x28(%rsp),%rsi
  mov    %esi,0x6c(%rsp)
  mov    %esi,0x54(%rsp)
  mov    0x60(%rsp),%rax
  mov    %rax,%r10
  add    $0x4,%rax
  mov    %rax,0x60(%rsp)
  lea    0x8(%r10),%rbx
  mov    %rbx,0x18(%rsp)
  lea    -0x4(%r10),%r13
  lea    -0x8(%r10),%rbx
  mov    %rbx,0x20(%rsp)
  mov    %rax,0x10(%rsp)
  mov    $0x1,%ebx
  mov    $0x0,%ebp
  mov    %esi,0x44(%rsp)
  mov    0x30(%rsp),%eax
  not    %eax
  shr    $0x1f,%eax
  mov    %eax,0x38(%rsp)
  mov    %esi,0x4c(%rsp)
  lea    0x2(%rsi),%eax
  mov    %eax,0x78(%rsp)
  lea    0x3(%rsi),%eax
  mov    %eax,0x7c(%rsp)
  jmp    L1992
L1338:
  cmpl   $0x2,0x34(%rsp)
  jne    L2229
  mov    0x80(%rsp),%rax
  mov    %rax,0x38(%rsp)
  movl   $0xfffffffe,0x30(%rsp)
  movl   $0x2,0x4c(%rsp)
  movq   $0x3,0x28(%rsp)
  movl   $0xffffffff,0x4(%rsp)
  movl   $0x1,0x34(%rsp)
  mov    $0x0,%r13d
  mov    $0x1,%r14d
  mov    %r13,0x8(%rsp)
  mov    0x74(%rsp),%r10d
  jmp    L1038
L2229:
  movl   $0xffffffff,0x54(%rsp)
  jmp    L42
L674:
  cmp    %r15d,-0x38(%r9)
  jne    L2726
  cmp    %r15d,-0x54(%r9)
  sete   %sil
  cmp    %r12d,%r10d
  setl   %dl
  test   %dl,%sil
  je     L2726
  lea    -0x3(%r12),%edx
  cmp    %edx,%r10d
  jl     L2726
  mov    0x88(%rsp),%rax
  mov    %r12d,(%rax)
  jmp    L42
L1342:
  cmpl   $0x2,0x20(%rsp)
  jle    L2630
  cmp    %r15d,(%rbx)
  je     L2491
  cmpl   $0x3,0x30(%rsp)
  ja     L17
  jmp    L2615
L2491:
  cmp    %r15d,0x0(%r13)
  je     L1155
L1521:
  cmpl   $0x3,0x30(%rsp)
  jbe    L1559
  cmpl   $0x3,0x4(%rsp)
  ja     L2615
  mov    0x68(%rsp),%edi
  jmp    L536
L1155:
  cmp    %r15d,-0xc(%rax)
  jne    L1521
  cmp    %r8d,0x30(%rsp)
  sete   %sil
  cmp    %r8d,0x4(%rsp)
  sete   %dl
  or     %sil,%dl
  jne    L1360
  cmp    %r8d,0x60(%rsp)
  jne    L1521
L1360:
  mov    0x88(%rsp),%rax
  mov    %r12d,(%rax)
  jmp    L42
L2630:
  cmpl   $0x3,0x30(%rsp)
  jbe    L1450
L17:
  cmpl   $0x3,0x4(%rsp)
  jbe    L1347
L2615:
  cmpl   $0x3,0x20(%rsp)
  jg     L15
  mov    0x48(%rsp),%edx
  cmp    %r15d,(%r11)
  jne    L15
L309:
  cmp    %r15d,0x0(%rbp)
  jne    L15
  mov    0x58(%rsp),%rdi
  cmp    %r15d,(%rax,%rdi,4)
  jne    L15
  cmp    %r8d,0x4c(%rsp)
  sete   %sil
  cmp    0x28(%rsp),%r8d
  sete   %al
  or     %sil,%al
  jne    L2281
  cmp    %edx,%r8d
  jne    L15
L2281:
  mov    0x88(%rsp),%rax
  mov    %r12d,(%rax)
  jmp    L42
L1450:
  mov    0x68(%rsp),%edi
  cmp    %r15d,(%rbx)
  jne    L2615
L1478:
  cmp    %r15d,0x0(%r13)
  jne    L2536
  cmp    %r15d,(%r11)
  jne    L2536
  cmp    %r8d,0x30(%rsp)
  sete   %sil
  cmp    %r8d,0x34(%rsp)
  sete   %dl
  or     %sil,%dl
  jne    L2791
  cmp    %edi,%r8d
  jne    L2536
L2791:
  mov    0x88(%rsp),%rax
  mov    %r12d,(%rax)
  jmp    L42
L1347:
  mov    0x68(%rsp),%edi
  cmp    %r15d,(%rbx)
  jne    L2615
L536:
  cmp    %r15d,(%r11)
  jne    L15
  cmp    %r15d,0x0(%rbp)
  jne    L2054
  cmp    %r8d,0x34(%rsp)
  sete   %sil
  cmp    %r8d,0x4c(%rsp)
  sete   %dl
  or     %sil,%dl
  jne    L870
  cmp    %edi,%r8d
  jne    L2054
L870:
  mov    0x88(%rsp),%rax
  mov    %r12d,(%rax)
  jmp    L42
L1161:
  cmp    %eax,%r10d
  jne    L412
  cmp    %edx,%r8d
  cmove  %r14d,%edi
L412:
  add    $0x1,%ecx
  cmp    $0x3,%ecx
  jne    L1763
  cmp    $0x1,%edi
  je     L149
L1763:
  sub    $0x1,%edx
  sub    $0x20,%rsi
  sub    $0x1,%eax
  js     L2671
  test   %edx,%edx
  js     L2671
L609:
  cmp    %r15d,-0x20(%rsi)
  je     L1161
  cmp    $0x1,%edi
  jne    L2671
  cmp    $0x3,%ecx
  jne    L2671
L149:
  mov    0x88(%rsp),%rax
  mov    %r12d,(%rax)
  jmp    L42
L2671:
  cmp    $0x3,%ecx
  je     L1049
L1444:
  mov    0x10(%rsp),%eax
  add    $0x1,%eax
  mov    0x44(%rsp),%esi
  lea    0x1(%rsi),%edx
  cmp    $0x5,%eax
  jg     L1049
  cmp    $0x6,%edx
  jg     L1049
  lea    0x20(%r9),%rsi
  jmp    L1871
L692:
  mov    %ecx,%edi
  jmp    L1444
L2329:
  cmp    %eax,%r10d
  jne    L1423
  cmp    %edx,%r8d
  cmove  %r14d,%edi
L1423:
  add    $0x1,%ecx
  cmp    $0x3,%ecx
  jne    L84
  cmp    $0x1,%edi
  je     L1840
L84:
  add    $0x1,%eax
  add    $0x1,%edx
  add    $0x20,%rsi
  cmp    $0x5,%eax
  jg     L1049
  cmp    $0x6,%edx
  jg     L1049
L1871:
  cmp    %r15d,(%rsi)
  je     L2329
  cmp    $0x1,%edi
  jne    L1049
  cmp    $0x3,%ecx
  jne    L1049
L1840:
  mov    0x88(%rsp),%rax
  mov    %r12d,(%rax)
  jmp    L42
L1049:
  cmpl   $0x0,0x40(%rsp)
  je     L1579
L2068:
  add    $0x1,%r12d
  add    $0x1c,%r9
  add    $0x1c,%r11
  add    $0x1c,%rbp
  add    $0x1c,%rbx
  add    $0x1c,%r13
  cmp    $0x6,%r12d
  je     L1579
L2367:
  mov    %r9,%rax
  mov    (%r9),%ecx
  test   %ecx,%ecx
  jne    L2068
  cmp    $0x2,%r12d
  jle    L2726
  cmp    0x8(%rsp),%r8d
  jne    L2726
  cmp    %r15d,-0x1c(%r9)
  je     L674
L2726:
  cmp    %r12d,%r10d
  je     L1342
L15:
  mov    %r12d,0x10(%rsp)
  lea    -0x1(%r12),%eax
  mov    0x4(%rsp),%edx
  mov    %r12d,%esi
  neg    %esi
  jns    L692
  cmpb   $0x0,0x18(%rsp)
  je     L692
  mov    %r9,%rsi
  mov    %ecx,%edi
  jmp    L609
L1579:
  addq   $0x1,0x8(%rsp)
  mov    0x8(%rsp),%rax
  addl   $0x1,0x34(%rsp)
  addl   $0x1,0x4(%rsp)
  addq   $0x1,0x28(%rsp)
  addl   $0x1,0x4c(%rsp)
  addl   $0x1,0x30(%rsp)
  cmp    $0x7,%rax
  je     L173
L1038:
  mov    0x8(%rsp),%rsi
  mov    %esi,0x44(%rsp)
  mov    %esi,0x54(%rsp)
  mov    0x38(%rsp),%rax
  mov    %rax,%r9
  add    $0x4,%rax
  mov    %rax,0x38(%rsp)
  lea    0x8(%r9),%rbp
  lea    -0x4(%r9),%rbx
  lea    -0x8(%r9),%r13
  mov    %rax,%r11
  mov    $0x0,%r12d
  mov    %esi,0x20(%rsp)
  mov    0x4(%rsp),%edi
  mov    %edi,%eax
  not    %eax
  shr    $0x1f,%eax
  mov    %eax,0x18(%rsp)
  mov    0x28(%rsp),%rax
  sub    %rsi,%rax
  mov    %rax,0x58(%rsp)
  mov    0x34(%rsp),%eax
  mov    %eax,0x48(%rsp)
  mov    %edi,0x68(%rsp)
  lea    -0x3(%rsi),%eax
  mov    %eax,0x60(%rsp)
  mov    0x50(%rsp),%r8d
  jmp    L2367
L1534:
  cmp    $0x2,%eax
  jle    L2200
  movslq 0x54(%rsp),%rsi
  lea    -0x1(%rax),%ecx
  movslq %ecx,%rcx
  lea    (%rsi,%rcx,8),%rsi
  sub    %rcx,%rsi
  cmp    %r15d,0x90(%rsp,%rsi,4)
  je     L2623
L2200:
  cmpl   $0x2,0x54(%rsp)
  jle    L1177
  movslq %r13d,%rcx
  movslq %eax,%rsi
  lea    (%rcx,%rsi,8),%rcx
  sub    %rsi,%rcx
  cmp    %r15d,0x90(%rsp,%rcx,4)
  je     L2677
  cmp    $0x3,%ebx
  ja     L2440
  jmp    L1255
L2623:
  movslq 0x54(%rsp),%rsi
  lea    -0x2(%rax),%ecx
  movslq %ecx,%rcx
  lea    (%rsi,%rcx,8),%rsi
  sub    %rcx,%rsi
  cmp    %r15d,0x90(%rsp,%rsi,4)
  jne    L2200
  movslq 0x54(%rsp),%rsi
  lea    -0x3(%rax),%ecx
  movslq %ecx,%rcx
  lea    (%rsi,%rcx,8),%rsi
  sub    %rcx,%rsi
  cmp    %r15d,0x90(%rsp,%rsi,4)
  jne    L2200
  mov    0x88(%rsp),%rbx
  mov    %eax,(%rbx)
  jmp    L42
L2677:
  movslq %ebx,%rcx
  lea    (%rcx,%rsi,8),%rcx
  sub    %rsi,%rcx
  cmp    %r15d,0x90(%rsp,%rcx,4)
  je     L1890
  cmp    $0x3,%ebx
  jbe    L1848
L2198:
  cmp    $0x3,%r13d
  ja     L1255
  jmp    L282
L1890:
  lea    -0x3(%rdi),%ecx
  movslq %ecx,%rcx
  lea    (%rcx,%rsi,8),%rcx
  sub    %rsi,%rcx
  cmp    %r15d,0x90(%rsp,%rcx,4)
  je     L538
  cmp    $0x3,%ebx
  ja     L2198
  jmp    L1815
L538:
  mov    0x88(%rsp),%rbx
  mov    %eax,(%rbx)
  jmp    L42
L1177:
  cmp    $0x3,%ebx
  jbe    L1052
L2440:
  cmp    $0x3,%r13d
  jbe    L1577
L1255:
  cmpl   $0x3,0x54(%rsp)
  jg     L113
  movslq %ebp,%rcx
  movslq %eax,%rsi
  lea    (%rcx,%rsi,8),%rcx
  sub    %rsi,%rcx
  cmp    %r15d,0x90(%rsp,%rcx,4)
  jne    L113
  movslq %r14d,%rcx
  lea    (%rcx,%rsi,8),%rcx
  sub    %rsi,%rcx
  cmp    %r15d,0x90(%rsp,%rcx,4)
  je     L517
L113:
  lea    -0x1(%rax),%r10d
  mov    %eax,%ecx
  neg    %ecx
  mov    %ecx,%esi
  shr    $0x1f,%esi
  mov    %esi,0x20(%rsp)
  mov    %r13d,%esi
  not    %esi
  shr    $0x1f,%esi
  mov    %esi,0x30(%rsp)
  test   %ecx,%ecx
  jns    L1745
  test   %sil,%sil
  je     L1745
  movslq %eax,%rsi
  lea    (%r12,%rsi,8),%rcx
  sub    %rsi,%rcx
  mov    0x8(%rsp),%rsi
  lea    (%rsi,%rcx,4),%rsi
  mov    %edx,%ecx
  mov    %r10d,%r9d
  lea    -0x1(%rdi),%r8d
  jmp    L1616
L1052:
  movslq %r13d,%rsi
  movslq %eax,%rcx
  imul   $0x7,%rcx,%rcx
  add    %rsi,%rcx
  cmp    %r15d,0x90(%rsp,%rcx,4)
  jne    L1255
  movslq %ebx,%rsi
  movslq %eax,%rcx
  imul   $0x7,%rcx,%rcx
  add    %rsi,%rcx
  cmp    %r15d,0x90(%rsp,%rcx,4)
  jne    L1848
L1815:
  movslq %ebp,%rsi
  movslq %eax,%rcx
  imul   $0x7,%rcx,%rcx
  add    %rsi,%rcx
  cmp    %r15d,0x90(%rsp,%rcx,4)
  jne    L2512
  mov    0x88(%rsp),%rbx
  mov    %eax,(%rbx)
  jmp    L42
L1577:
  movslq %r13d,%rsi
  movslq %eax,%rcx
  imul   $0x7,%rcx,%rcx
  add    %rsi,%rcx
  cmp    %r15d,0x90(%rsp,%rcx,4)
  jne    L1255
L282:
  movslq %ebp,%rsi
  movslq %eax,%rcx
  imul   $0x7,%rcx,%rcx
  add    %rsi,%rcx
  cmp    %r15d,0x90(%rsp,%rcx,4)
  jne    L113
  movslq %r14d,%rsi
  movslq %eax,%rcx
  imul   $0x7,%rcx,%rcx
  add    %rsi,%rcx
  cmp    %r15d,0x90(%rsp,%rcx,4)
  jne    L113
  mov    0x88(%rsp),%rbx
  mov    %eax,(%rbx)
  jmp    L42
L517:
  lea    0x3(%rdi),%ecx
  movslq %ecx,%rcx
  lea    (%rcx,%rsi,8),%rcx
  sub    %rsi,%rcx
  cmp    %r15d,0x90(%rsp,%rcx,4)
  jne    L113
  mov    0x88(%rsp),%rbx
  mov    %eax,(%rbx)
  jmp    L42
L262:
  add    $0x1,%ecx
  cmp    $0x3,%ecx
  je     L2439
  sub    $0x20,%rsi
  cmp    %ecx,%r9d
  js     L2188
  cmp    %ecx,%r8d
  js     L2188
L1616:
  cmp    %r15d,-0x20(%rsi)
  je     L262
  cmp    $0x3,%ecx
  jne    L2188
L2439:
  mov    0x88(%rsp),%rbx
  mov    %eax,(%rbx)
  jmp    L42
L1745:
  mov    %edx,%ecx
L2188:
  cmp    $0x4,%eax
  setle  0x10(%rsp)
  movzbl 0x10(%rsp),%esi
  cmp    $0x6,%ebp
  setle  0x18(%rsp)
  movzbl 0x18(%rsp),%r11d
  test   %sil,%sil
  je     L2348
  test   %r11b,%r11b
  je     L2348
  lea    0x2(%rax),%esi
  movslq %esi,%rsi
  movslq %eax,%r9
  mov    %r12,%r8
  sub    %r9,%r8
  mov    0x8(%rsp),%r11
  lea    (%r11,%r8,4),%r11
  mov    %edi,%r9d
  sub    %eax,%r9d
  mov    %r9d,0x4(%rsp)
  jmp    L1382
L4:
  add    $0x1,%ecx
  cmp    $0x3,%ecx
  je     L435
  mov    0x4(%rsp),%r9d
  lea    (%r9,%rsi,1),%r8d
  cmp    $0x6,%r8d
  setle  %r9b
  cmp    $0x5,%esi
  setle  %r8b
  add    $0x1,%rsi
  test   %r8b,%r9b
  je     L2348
L1382:
  mov    %rsi,%r8
  shl    $0x5,%r8
  cmp    %r15d,-0x20(%r11,%r8,1)
  je     L4
  cmp    $0x3,%ecx
  jne    L2348
L435:
  mov    0x88(%rsp),%rbx
  mov    %eax,(%rbx)
  jmp    L42
L2348:
  cmpb   $0x0,0x10(%rsp)
  je     L1974
  cmpb   $0x0,0x30(%rsp)
  je     L1974
  movslq %eax,%rsi
  lea    (%r12,%rsi,8),%rcx
  sub    %rsi,%rcx
  mov    0x8(%rsp),%rsi
  lea    (%rsi,%rcx,4),%rcx
  lea    0x1(%rax),%r9d
  lea    -0x1(%rdi),%r8d
  jmp    L2128
L41:
  add    $0x1,%edx
  cmp    $0x3,%edx
  je     L1851
  add    $0x18,%rcx
  lea    (%r9,%rdx,1),%esi
  cmp    $0x5,%esi
  jg     L1974
  cmp    %edx,%r8d
  js     L1974
L2128:
  cmp    %r15d,0x18(%rcx)
  je     L41
  cmp    $0x3,%edx
  jne    L1974
L1851:
  mov    0x88(%rsp),%rbx
  mov    %eax,(%rbx)
  jmp    L42
L1974:
  cmpb   $0x0,0x18(%rsp)
  je     L2692
  cmpb   $0x0,0x20(%rsp)
  je     L2692
  movslq %eax,%rsi
  lea    (%r12,%rsi,8),%rcx
  sub    %rsi,%rcx
  mov    0x8(%rsp),%rsi
  lea    (%rsi,%rcx,4),%rsi
  jmp    L1227
L1222:
  add    $0x1,%edx
  cmp    $0x3,%edx
  je     L2651
  sub    $0x1,%r10d
  sub    $0x18,%rsi
  mov    %edi,%ecx
  sub    %r10d,%ecx
  add    %eax,%ecx
  cmp    $0x6,%ecx
  jg     L1403
  test   %r10d,%r10d
  js     L1403
L1227:
  cmp    %r15d,-0x18(%rsi)
  je     L1222
  cmp    $0x3,%edx
  jne    L1403
L2651:
  mov    0x88(%rsp),%rbx
  mov    %eax,(%rbx)
  jmp    L42
L2692:
  cmp    $0x6,%ebp
  jg     L360
L1403:
  add    $0x1,%edi
  add    $0x1,%r12
  add    $0x1,%ebp
  add    $0x1,%r13d
  add    $0x1,%r14d
  add    $0x1,%ebx
  addq   $0x4,0x80(%rsp)
L987:
  mov    %edi,0x54(%rsp)
  mov    0x80(%rsp),%rcx
  mov    $0x0,%eax
L798:
  mov    (%rcx),%edx
  test   %edx,%edx
  je     L1534
  add    $0x1,%eax
  add    $0x1c,%rcx
  cmp    $0x6,%eax
  jne    L798
  jmp    L2692
L173:
  mov    $0xfffffffe,%ebx
  mov    $0x2,%r14d
  mov    $0xffffffff,%r13d
  mov    $0x1,%ebp
  mov    $0x0,%r12d
  mov    $0x0,%edi
  lea    0x90(%rsp),%rax
  mov    %rax,0x8(%rsp)
  jmp    L987
L360:
  movl   $0xffffffff,0x54(%rsp)
L42:
  mov    0x138(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L137
  mov    0x54(%rsp),%eax
  add    $0x148,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L1848:
  cmp    $0x3,%r13d
  ja     L1255
  jmp    L282
L2054:
  mov    0x48(%rsp),%edx
  cmpl   $0x3,0x20(%rsp)
  jle    L309
  jmp    L15
L2536:
  cmpl   $0x3,0x4(%rsp)
  ja     L2615
  mov    0x68(%rsp),%edi
  jmp    L536
L1559:
  mov    0x68(%rsp),%edi
  jmp    L1478
L2515:
  mov    0x58(%rsp),%eax
  cmpl   $0x3,0x44(%rsp)
  jle    L205
  jmp    L2493
L198:
  cmpl   $0x3,0x30(%rsp)
  ja     L2402
  mov    0x30(%rsp),%ecx
  jmp    L1601
L839:
  mov    0x30(%rsp),%ecx
  jmp    L1831
L2512:
  cmp    $0x3,%r13d
  ja     L1255
  jmp    L113
L137:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int fin42f(int grid1[6][7], int move, int fin, int row, int col, int fut, int *r) {
  int f, c, x, y, i, v, j, row1, col1;
  int grid[6][7], i1, j1;
  for (i1 = 0; i1 < 6; i1++)
    for (j1 = 0; j1 < 7; j1++) {
      grid[i1][j1] = grid1[i1][j1];
    }
  if (col != -1)
    grid[row][col] = move;
  for (i = 0; i < 7; i++) {
    for (j = 0; j < 6; j++) {
      if (grid[j][i] == 0) {
        if (j >= 3 && i == col)
          if ((grid[j - 1][i] == move) && (grid[j - 2][i] == move) && (grid[j - 3][i] == move) && ((row >= j - 3) && (row <= j - 1)))
            if (fin) {
              *r = j;
              return i;
            } else {
              fin = 2;
              grid[j][i] = -move;
              row1 = j;
              col1 = i;
            }
        if (j == row) {
          if (i >= 3)
            if ((grid[j][i - 1] == move) && (grid[j][i - 2] == move) && (grid[j][i - 3] == move) && (((i - 1) == col) || ((i - 2) == col) || ((i - 3) == col)))
              if (fin) {
                *r = j;
                return i;
              } else {
                fin = 2;
                grid[j][i] = -move;
                row1 = j;
                col1 = i;
              }
          if (i >= 2 && i <= 5)
            if ((grid[j][i - 1] == move) && (grid[j][i - 2] == move) && (grid[j][i + 1] == move) && (((i - 1) == col) || ((i - 2) == col) || ((i + 1) == col)))
              if (fin) {
                *r = j;
                return i;
              } else {
                fin = 2;
                grid[j][i] = -move;
                row1 = j;
                col1 = i;
              }
          if (i >= 1 && i <= 4)
            if ((grid[j][i - 1] == move) && (grid[j][i + 1] == move) && (grid[j][i + 2] == move) && (((i - 1) == col) || ((i + 1) == col) || ((i + 2) == col)))
              if (fin) {
                *r = j;
                return i;
              } else {
                fin = 2;
                grid[j][i] = -move;
                row1 = j;
                col1 = i;
              }
          if (i <= 3)
            if ((grid[j][i + 1] == move) && (grid[j][i + 2] == move) && (grid[j][i + 3] == move) && (((i + 1) == col) || ((i + 2) == col) || ((i + 3) == col)))
              if (fin) {
                *r = j;
                return i;
              } else {
                fin = 2;
                grid[j][i] = -move;
                row1 = j;
                col1 = i;
              }
        }
        for (x = j - 1, y = i - 1, c = 0, v = 0, f = 1; x >= 0 && y >= 0 && f == 1; x = x - 1, y = y - 1) {
          if (grid[x][y] != move)
            f = 0;
          else {
            if (x == row && y == col)
              v = 1;
            c++;
          }
          if (c == 3 && v == 1)
            if (fin) {
              *r = j;
              return i;
            } else {
              fin = 2;
              grid[j][i] = -move;
              row1 = j;
              col1 = i;
              break;
            }
        }
        if (c != 3)
          for (x = j + 1, y = i + 1, f = 1; x <= 5 && y <= 6 && f == 1; x = x + 1, y = y + 1) {
            if (grid[x][y] != move)
              f = 0;
            else {
              if (x == row && y == col)
                v = 1;
              c++;
            }
            if (c == 3 && v == 1)
              if (fin) {
                *r = j;
                return i;
              } else {
                fin = 2;
                grid[j][i] = -move;
                row1 = j;
                col1 = i;
                break;
              }
          }
        if (fin != 2) {
          for (x = j + 1, y = i - 1, c = 0, v = 0, f = 1; x <= 5 && y >= 0 && f == 1; x = x + 1, y = y - 1) {
            if (grid[x][y] != move)
              f = 0;
            else {
              if (x == row && y == col)
                v = 1;
              c++;
            }
            if (c == 3 && v == 1)
              if (fin) {
                *r = j;
                return i;
              } else {
                fin = 2;
                grid[j][i] = -move;
                row1 = j;
                col1 = i;
                break;
              }
          }
          if (c != 3)
            for (x = j - 1, y = i + 1, f = 1; x >= 0 && y <= 6 && f == 1; x = x - 1, y = y + 1) {
              if (grid[x][y] != move)
                f = 0;
              else {
                if (x == row && y == col)
                  v = 1;
                c++;
              }
              if (c == 3 && v == 1)
                if (fin) {
                  *r = j;
                  return i;
                } else {
                  fin = 2;
                  grid[j][i] = -move;
                  row1 = j;
                  col1 = i;
                  break;
                }
            }
        }
        if (!fut)
          break;
      }
    }
  }
  if (fin == 2) {
    v = 0;
    for (i = 0; i < 7; i++) {
      for (j = 0; j < 6; j++) {
        if (grid[j][i] == 0) {
          if (j >= 3 && i == col1)
            if ((grid[j - 1][i] == move) && (grid[j - 2][i] == move) && (grid[j - 3][i] == move) && ((row1 >= j - 3) && (row1 <= j - 1)))
              if (fin) {
                *r = j;
                return i;
              } else {
                fin = 2;
                grid[j][i] = -move;
              }
          if (j == row1) {
            if (i >= 3)
              if ((grid[j][i - 1] == move) && (grid[j][i - 2] == move) && (grid[j][i - 3] == move) && (((i - 1) == col1) || ((i - 2) == col1) || ((i - 3) == col1)))
                if (fin) {
                  *r = j;
                  return i;
                } else {
                  fin = 2;
                  grid[j][i] = -move;
                }
            if (i >= 2 && i <= 5)
              if ((grid[j][i - 1] == move) && (grid[j][i - 2] == move) && (grid[j][i + 1] == move) && (((i - 1) == col1) || ((i - 2) == col1) || ((i + 1) == col1)))
                if (fin) {
                  *r = j;
                  return i;
                } else {
                  fin = 2;
                  grid[j][i] = -move;
                }
            if (i >= 1 && i <= 4)
              if ((grid[j][i - 1] == move) && (grid[j][i + 1] == move) && (grid[j][i + 2] == move) && (((i - 1) == col1) || ((i + 1) == col1) || ((i + 2) == col1)))
                if (fin) {
                  *r = j;
                  return i;
                } else {
                  fin = 2;
                  grid[j][i] = -move;
                }
            if (i <= 3)
              if ((grid[j][i + 1] == move) && (grid[j][i + 2] == move) && (grid[j][i + 3] == move) && (((i + 1) == col1) || ((i + 2) == col1) || ((i + 3) == col1)))
                if (fin) {
                  *r = j;
                  return i;
                } else {
                  fin = 2;
                  grid[j][i] = -move;
                }
          }
          for (x = j - 1, y = i - 1, c = 0, v = 0, f = 1; x >= 0 && y >= 0 && f == 1; x = x - 1, y = y - 1) {
            if (grid[x][y] != move)
              f = 0;
            else {
              if (x == row1 && y == col1)
                v = 1;
              c++;
            }
            if (c == 3 && v == 1)
              if (fin) {
                *r = j;
                return i;
              } else {
                fin = 2;
                grid[j][i] = -move;
                break;
              }
          }
          if (c != 3)
            for (x = j + 1, y = i + 1, f = 1; x <= 5 && y <= 6 && f == 1; x = x + 1, y = y + 1) {
              if (grid[x][y] != move)
                f = 0;
              else {
                if (x == row1 && y == col1)
                  v = 1;
                c++;
              }
              if (c == 3 && v == 1)
                if (fin) {
                  *r = j;
                  return i;
                } else {
                  fin = 2;
                  grid[j][i] = -move;
                  break;
                }
            }
          if (fin != 2) {
            for (x = j + 1, y = i - 1, c = 0, v = 0, f = 1; x <= 5 && y >= 0 && f == 1; x = x + 1, y = y - 1) {
              if (grid[x][y] != move)
                f = 0;
              else {
                if (x == row1 && y == col1)
                  v = 1;
                c++;
              }
              if (c == 3 && v == 1)
                if (fin) {
                  *r = j;
                  return i;
                } else {
                  fin = 2;
                  grid[j][i] = -move;
                  break;
                }
            }
            if (c != 3)
              for (x = j - 1, y = i + 1, f = 1; x >= 0 && y <= 6 && f == 1; x = x - 1, y = y + 1) {
                if (grid[x][y] != move)
                  f = 0;
                else {
                  if (x == row1 && y == col1)
                    v = 1;
                  c++;
                }
                if (c == 3 && v == 1)
                  if (fin) {
                    *r = j;
                    return i;
                  } else {
                    fin = 2;
                    grid[j][i] = -move;
                    break;
                  }
              }
          }
          if (!fut)
            break;
        }
      }
    }
    for (i = 0; i < 7; i++) {
      for (j = 0; j < 6; j++) {
        if (grid[j][i] == 0) {
          if (j >= 3)
            if ((grid[j - 1][i] == move) && (grid[j - 2][i] == move) && (grid[j - 3][i] == move)) {
              *r = j;
              return i;
            }
          if (i >= 3)
            if ((grid[j][i - 1] == move) && (grid[j][i - 2] == move) && (grid[j][i - 3] == move)) {
              *r = j;
              return i;
            }
          if (i >= 2 && i <= 5)
            if ((grid[j][i - 1] == move) && (grid[j][i - 2] == move) && (grid[j][i + 1] == move)) {
              *r = j;
              return i;
            }
          if (i >= 1 && i <= 4)
            if ((grid[j][i - 1] == move) && (grid[j][i + 1] == move) && (grid[j][i + 2] == move)) {
              *r = j;
              return i;
            }
          if (i <= 3)
            if ((grid[j][i + 1] == move) && (grid[j][i + 2] == move) && (grid[j][i + 3] == move)) {
              *r = j;
              return i;
            }
          for (x = j - 1, y = i - 1, c = 0, f = 1; x >= 0 && y >= 0 && f == 1; x = x - 1, y = y - 1) {
            if (grid[x][y] != move)
              f = 0;
            else
              c++;
            if (c == 3) {
              *r = j;
              return i;
            }
          }
          for (x = j + 1, y = i + 1, f = 1; x <= 5 && y <= 6 && f == 1; x = x + 1, y = y + 1) {
            if (grid[x][y] != move)
              f = 0;
            else
              c++;
            if (c == 3) {
              *r = j;
              return i;
            }
          }
          for (x = j + 1, y = i - 1, c = 0, f = 1; x <= 5 && y >= 0 && f == 1; x = x + 1, y = y - 1) {
            if (grid[x][y] != move)
              f = 0;
            else
              c++;
            if (c == 3) {
              *r = j;
              return i;
            }
          }
          for (x = j - 1, y = i + 1, f = 1; x >= 0 && y <= 6 && f == 1; x = x - 1, y = y + 1) {
            if (grid[x][y] != move)
              f = 0;
            else
              c++;
            if (c == 3) {
              *r = j;
              return i;
            }
          }
          break;
        }
      }
    }
  }
  return -1;
}
```