user: 请将以下的汇编代码转换成C语言代码:

```asm
<bot>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  cmp    $0x1,%esi
  je     L1569
  cmp    $0xffffffff,%esi
  je     L433
L1603:
  pop    %rbx
  mov    %r15d,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L433:
  lea    0x1c(%rdi),%rax
  movl   $0x0,-0x44(%rsp)
  mov    %rdi,%r14
  mov    %rax,-0x8(%rsp)
L669:
  mov    $0x2,%r10d
  mov    $0x3,%r15d
  mov    $0xfffffffe,%ebp
  mov    $0xffffffff,%r9d
  mov    $0xfffffffd,%r12d
  mov    $0x1,%ebx
  xor    %r13d,%r13d
L699:
  movslq -0x44(%rsp),%rdx
  mov    %r13d,-0x20(%rsp)
  lea    0x0(,%r13,4),%rdi
  lea    0x0(,%rdx,8),%rax
  sub    %rdx,%rax
  shl    $0x2,%rax
  lea    (%r14,%rax,1),%rcx
  mov    %rax,-0x40(%rsp)
  mov    (%rcx,%r13,4),%esi
  cmp    $0xffffffff,%esi
  je     L244
  cmp    $0x1,%esi
  jne    L507
  lea    0x1c(%r14,%rax,1),%rdx
  cmpl   $0x1,(%rdx,%rdi,1)
  je     L1408
L1818:
  mov    %ebx,%edi
  cmpl   $0x1,(%rcx,%rdi,4)
  je     L475
L65:
  cmpl   $0x1,(%rdx,%rdi,4)
  je     L1757
L1452:
  lea    -0x1c(%r14,%rax,1),%rcx
  movslq %r9d,%rsi
  cmpl   $0x1,(%rcx,%rsi,4)
  je     L738
L278:
  cmpl   $0x1,(%rcx,%rdi,4)
  je     L1249
L1023:
  cmpl   $0x1,(%rdx,%rsi,4)
  je     L684
L507:
  add    $0x1,%r13
  add    $0x1,%ebx
  add    $0x1,%r12d
  add    $0x1,%ebp
  add    $0x1,%r9d
  add    $0x1,%r15d
  add    $0x1,%r10d
  cmp    $0x7,%r13
  jne    L699
  addl   $0x1,-0x44(%rsp)
  mov    -0x44(%rsp),%eax
  cmp    $0x5,%eax
  jle    L669
  mov    %r14,%r12
  xor    %eax,%eax
L1066:
  mov    (%r12,%rax,4),%edx
  mov    %eax,%r15d
  test   %edx,%edx
  je     L1603
  add    $0x1,%rax
  cmp    $0x6,%rax
  jne    L1066
  nopl   0x0(%rax)
L1593:
  xor    %r15d,%r15d
  jmp    L1603
L244:
  lea    0x1c(%r14,%rax,1),%rsi
  mov    %rsi,-0x30(%rsp)
  mov    (%rsi,%r13,4),%esi
  mov    %esi,-0x14(%rsp)
  cmp    $0xffffffff,%esi
  je     L503
L680:
  mov    %ebx,%esi
  mov    %rsi,-0x28(%rsp)
  mov    (%rcx,%rsi,4),%esi
  mov    %esi,-0x10(%rsp)
  cmp    $0xffffffff,%esi
  je     L948
L314:
  mov    -0x30(%rsp),%rsi
  mov    -0x28(%rsp),%r11
  mov    (%rsi,%r11,4),%esi
  mov    %esi,-0xc(%rsp)
  cmp    $0xffffffff,%esi
  je     L1929
L1824:
  lea    -0x1c(%r14,%rax,1),%rsi
  mov    %rsi,%r8
  mov    %rsi,-0x38(%rsp)
  movslq %r9d,%rsi
  mov    (%r8,%rsi,4),%r8d
  mov    %r8d,-0x18(%rsp)
  cmp    $0xffffffff,%r8d
  je     L604
L1647:
  mov    -0x38(%rsp),%r8
  mov    -0x28(%rsp),%r11
  cmpl   $0xffffffff,(%r8,%r11,4)
  je     L1104
L1538:
  mov    -0x30(%rsp),%r8
  cmpl   $0xffffffff,(%r8,%rsi,4)
  je     L1139
L221:
  cmpl   $0xffffffff,-0x14(%rsp)
  je     L273
L899:
  cmpl   $0xffffffff,-0x10(%rsp)
  je     L1844
L277:
  cmpl   $0xffffffff,-0xc(%rsp)
  je     L1887
  cmpl   $0xffffffff,-0x18(%rsp)
  je     L1913
L545:
  mov    -0x38(%rsp),%rdi
  movslq %ebx,%rax
  cmpl   $0xffffffff,(%rdi,%rax,4)
  je     L1973
L2049:
  add    $0x1,%rdx
  lea    0x0(,%rdx,8),%rax
  sub    %rdx,%rax
  lea    (%r14,%rax,4),%rax
  cmpl   $0xffffffff,(%rax,%rsi,4)
  jne    L507
  mov    -0x40(%rsp),%rdi
  movslq %ebp,%rax
  mov    %ebp,%r11d
  lea    (%r14,%rax,4),%rax
  mov    0x38(%rdi,%rax,1),%ecx
  test   %ecx,%ecx
  jne    L507
  cmpl   $0x3,-0x44(%rsp)
  jg     L507
  cmp    $0x1,%r13d
  jle    L507
  jmp    L492
  nopl   (%rax)
L1569:
  movl   $0x0,-0x44(%rsp)
  lea    -0x54(%rdi),%rbp
  mov    %rdi,-0x20(%rsp)
L936:
  mov    %rbp,-0x28(%rsp)
  lea    0x38(%rbp),%r11
  lea    0x54(%rbp),%rax
  xor    %r14d,%r14d
  lea    0x70(%rbp),%rdx
  lea    0x8c(%rbp),%rcx
  mov    $0xfffffffd,%r13d
  mov    $0x3,%r12d
  lea    0x24(%rbp),%rsi
  lea    0xa8(%rbp),%rdi
L1761:
  mov    (%rax),%r9d
  mov    %r14d,%r8d
  mov    %r14d,%ebx
  cmp    $0x1,%r9d
  je     L1008
  cmp    $0xffffffff,%r9d
  jne    L1003
  cmpl   $0xffffffff,(%rdx)
  je     L963
L1907:
  cmpl   $0xffffffff,0x4(%rax)
  je     L421
L1427:
  cmpl   $0xffffffff,0x4(%rdx)
  je     L59
L1754:
  cmpl   $0xffffffff,-0x4(%r11,%r14,4)
  je     L1571
L1402:
  cmpl   $0xffffffff,0x4(%r11,%r14,4)
  je     L531
L242:
  cmpl   $0xffffffff,-0x4(%rdx)
  je     L1270
L1003:
  add    $0x1,%r14
  add    $0x4,%rax
  add    $0x4,%rcx
  add    $0x4,%rdx
  add    $0x4,%rsi
  add    $0x4,%rdi
  add    $0x1,%r12d
  add    $0x1,%r13d
  cmp    $0x7,%r14
  jne    L1761
  addl   $0x1,-0x44(%rsp)
  mov    -0x28(%rsp),%rbp
  mov    -0x44(%rsp),%eax
  add    $0x1c,%rbp
  cmp    $0x6,%eax
  jne    L936
  mov    -0x20(%rsp),%r12
  xor    %eax,%eax
L3:
  mov    (%r12,%rax,4),%ebx
  mov    %eax,%r15d
  test   %ebx,%ebx
  je     L1603
  add    $0x1,%rax
  cmp    $0x6,%rax
  jne    L3
  jmp    L1593
  nopl   0x0(%rax)
L1008:
  mov    (%rdx),%r9d
  cmp    $0x1,%r9d
  je     L1102
L1900:
  mov    0x4(%rax),%ebp
  cmp    $0x1,%ebp
  je     L1687
L729:
  mov    0x4(%rdx),%r10d
  mov    %r10d,-0x40(%rsp)
  cmp    $0x1,%r10d
  je     L1646
L1272:
  mov    -0x4(%r11,%r14,4),%r15d
  mov    %r15d,-0x38(%rsp)
  cmp    $0x1,%r15d
  je     L1030
L1581:
  mov    0x4(%r11,%r14,4),%r15d
  mov    %r15d,-0x30(%rsp)
  cmp    $0x1,%r15d
  je     L641
L519:
  mov    -0x4(%rdx),%r15d
  mov    %r15d,%r10d
  cmp    $0x1,%r15d
  je     L1095
L2036:
  cmp    $0x1,%r9d
  je     L1661
L1717:
  cmp    $0x1,%ebp
  je     L346
L1153:
  cmpl   $0x1,-0x40(%rsp)
  je     L415
L255:
  cmpl   $0x1,-0x38(%rsp)
  je     L1991
L424:
  cmpl   $0x1,-0x30(%rsp)
  je     L1635
L6:
  cmp    $0x1,%r10d
  jne    L1003
  mov    -0x8(%rcx),%ebp
  lea    -0x2(%r8),%r15d
  test   %ebp,%ebp
  jne    L1003
  cmpl   $0x3,-0x44(%rsp)
  jg     L1003
  cmp    $0x1,%r14d
  jle    L1003
  jmp    L1603
  nopl   0x0(%rax)
L1102:
  cmpl   $0x1,(%rcx)
  jne    L1900
  mov    (%rdi),%ebp
  test   %ebp,%ebp
  jne    L1900
  cmpl   $0x2,-0x44(%rsp)
  jg     L1900
L2002:
  mov    %r14d,%r15d
  jmp    L1603
  cs nopw 0x0(%rax,%rax,1)
L1687:
  cmpl   $0x1,0x8(%rax)
  jne    L729
  mov    0xc(%rax),%r10d
  mov    %r12d,%r15d
  test   %r10d,%r10d
  jne    L729
  cmp    $0x3,%r14d
  jle    L1603
  jmp    L729
  nopl   0x0(%rax)
L1646:
  cmpl   $0x1,0x8(%rcx)
  jne    L1272
  mov    0xc(%rdi),%r10d
  mov    %r12d,%r15d
  test   %r10d,%r10d
  jne    L1272
  cmpl   $0x2,-0x44(%rsp)
  jg     L1272
  cmp    $0x3,%r14d
  jg     L1272
  jmp    L1603
  nopl   0x0(%rax)
L1030:
  cmpl   $0x1,-0x10(%rsi)
  jne    L1581
  mov    -0x28(%rsp),%r10
  mov    %r13d,%r15d
  mov    -0xc(%r10,%r14,4),%r10d
  test   %r10d,%r10d
  jne    L1581
  cmpl   $0x2,-0x44(%rsp)
  jle    L1581
  cmp    $0x2,%r14d
  jle    L1581
  jmp    L1603
  nopw   0x0(%rax,%rax,1)
L641:
  cmpl   $0x1,(%rsi)
  jne    L519
  mov    -0x28(%rsp),%r10
  mov    %r12d,%r15d
  mov    0xc(%r10,%r14,4),%r10d
  test   %r10d,%r10d
  jne    L519
  cmpl   $0x2,-0x44(%rsp)
  jle    L519
  cmp    $0x3,%r14d
  jg     L519
  jmp    L1603
  nopl   0x0(%rax)
L1095:
  cmpl   $0x1,-0x8(%rcx)
  jne    L2036
  cmpl   $0x0,-0xc(%rdi)
  mov    %r13d,%r15d
  jne    L2036
  cmpl   $0x2,-0x44(%rsp)
  jg     L2036
  cmp    $0x2,%r14d
  jle    L2036
  jmp    L1603
  nopl   0x0(%rax)
L963:
  cmpl   $0xffffffff,(%rcx)
  jne    L1907
  mov    (%rdi),%r15d
  test   %r15d,%r15d
  jne    L1907
  cmpl   $0x2,-0x44(%rsp)
  jg     L1907
  jmp    L2002
  nopl   (%rax)
L421:
  cmpl   $0xffffffff,0x8(%rax)
  jne    L1427
  mov    0xc(%rax),%ebp
  mov    %r12d,%r15d
  test   %ebp,%ebp
  jne    L1427
  cmp    $0x3,%r14d
  jle    L1603
  jmp    L1427
  nop
L59:
  cmpl   $0xffffffff,0x8(%rcx)
  jne    L1754
  mov    0xc(%rdi),%ebx
  mov    %r12d,%r15d
  test   %ebx,%ebx
  jne    L1754
  cmpl   $0x2,-0x44(%rsp)
  jg     L1754
  cmp    $0x3,%r14d
  jg     L1754
  jmp    L1603
  nopw   0x0(%rax,%rax,1)
L1571:
  cmpl   $0xffffffff,-0x10(%rsi)
  jne    L1402
  mov    -0x28(%rsp),%rbx
  mov    %r13d,%r15d
  mov    -0xc(%rbx,%r14,4),%r10d
  test   %r10d,%r10d
  jne    L1402
  cmpl   $0x2,-0x44(%rsp)
  jle    L1402
  cmp    $0x2,%r14d
  jle    L1402
  jmp    L1603
  nopw   0x0(%rax,%rax,1)
L1270:
  cmpl   $0xffffffff,-0x8(%rcx)
  jne    L1003
  mov    -0xc(%rdi),%r8d
  mov    %r13d,%r15d
  test   %r8d,%r8d
  jne    L1003
  cmpl   $0x2,-0x44(%rsp)
  jg     L1003
  cmp    $0x2,%r14d
  jle    L1003
  jmp    L1603
  nopl   0x0(%rax)
L531:
  cmpl   $0xffffffff,(%rsi)
  jne    L242
  mov    -0x28(%rsp),%rbx
  mov    %r12d,%r15d
  mov    0xc(%rbx,%r14,4),%r9d
  test   %r9d,%r9d
  jne    L242
  cmpl   $0x2,-0x44(%rsp)
  jle    L242
  cmp    $0x3,%r14d
  jg     L242
  jmp    L1603
  nopl   0x0(%rax)
L1661:
  mov    (%rcx),%r15d
  test   %r15d,%r15d
  jne    L1717
  cmpl   $0x3,-0x44(%rsp)
  jg     L1717
  mov    %ebx,%r15d
  jmp    L1603
  nop
L346:
  mov    0x8(%rax),%r9d
  lea    0x2(%r8),%r15d
  test   %r9d,%r9d
  jne    L1153
  cmp    $0x4,%r14d
  jg     L1153
  pop    %rbx
  mov    %r15d,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L415:
  mov    0x8(%rcx),%ebp
  lea    0x2(%r8),%r15d
  test   %ebp,%ebp
  jne    L255
  cmpl   $0x3,-0x44(%rsp)
  jg     L255
  cmp    $0x4,%r14d
  jg     L255
  jmp    L1603
  nopl   0x0(%rax)
L1991:
  mov    -0x10(%rsi),%ebx
  lea    -0x2(%r8),%r15d
  test   %ebx,%ebx
  jne    L424
  cmp    $0x1,%r14d
  jle    L424
  cmpl   $0x1,-0x44(%rsp)
  jle    L424
  jmp    L1603
  nopl   0x0(%rax)
L1635:
  mov    (%rsi),%r9d
  lea    0x2(%r8),%r15d
  test   %r9d,%r9d
  jne    L6
  cmpl   $0x1,-0x44(%rsp)
  jle    L6
  cmp    $0x4,%r14d
  jg     L6
  jmp    L1603
  nopw   0x0(%rax,%rax,1)
L948:
  movslq %r10d,%rsi
  cmpl   $0xffffffff,(%rcx,%rsi,4)
  jne    L314
  movslq %r15d,%rsi
  mov    %r15d,%r11d
  mov    (%rcx,%rsi,4),%r8d
  test   %r8d,%r8d
  jne    L314
  cmp    $0x3,%r13d
  jle    L492
  jmp    L314
  nop
L503:
  lea    (%rcx,%rdi,1),%rsi
  cmpl   $0xffffffff,0x38(%rsi)
  jne    L680
  mov    0x54(%rsi),%r11d
  test   %r11d,%r11d
  jne    L680
  cmpl   $0x2,-0x44(%rsp)
  jg     L680
L1978:
  mov    %r13d,%r15d
  jmp    L1603
  xchg   %ax,%ax
L1139:
  movslq %ebp,%r8
  lea    (%r14,%r8,4),%r8
  cmpl   $0xffffffff,0x38(%rax,%r8,1)
  jne    L221
  movslq %r12d,%r8
  mov    %r12d,%r11d
  lea    (%r14,%r8,4),%r8
  mov    0x54(%rax,%r8,1),%r8d
  test   %r8d,%r8d
  jne    L221
  cmpl   $0x2,-0x44(%rsp)
  jg     L221
  cmp    $0x2,%r13d
  jle    L221
  jmp    L492
  nopl   (%rax)
L1104:
  movslq %r10d,%r8
  lea    (%r14,%r8,4),%r8
  cmpl   $0xffffffff,-0x38(%rax,%r8,1)
  jne    L1538
  movslq %r15d,%r8
  mov    %r15d,%r11d
  lea    (%r14,%r8,4),%r8
  mov    -0x54(%rax,%r8,1),%r8d
  test   %r8d,%r8d
  jne    L1538
  cmpl   $0x2,-0x44(%rsp)
  jle    L1538
  cmp    $0x3,%r13d
  jg     L1538
  jmp    L492
  nopl   (%rax)
L604:
  movslq %ebp,%r8
  lea    (%r14,%r8,4),%r8
  cmpl   $0xffffffff,-0x38(%rax,%r8,1)
  jne    L1647
  movslq %r12d,%r8
  mov    %r12d,%r11d
  lea    (%r14,%r8,4),%r8
  mov    -0x54(%rax,%r8,1),%r8d
  test   %r8d,%r8d
  jne    L1647
  cmpl   $0x2,-0x44(%rsp)
  jle    L1647
  cmp    $0x2,%r13d
  jle    L1647
  jmp    L492
  nopl   (%rax)
L1929:
  movslq %r10d,%rsi
  lea    (%r14,%rsi,4),%rsi
  cmpl   $0xffffffff,0x38(%rax,%rsi,1)
  jne    L1824
  movslq %r15d,%rsi
  mov    %r15d,%r11d
  lea    (%r14,%rsi,4),%rsi
  mov    0x54(%rax,%rsi,1),%esi
  test   %esi,%esi
  jne    L1824
  cmpl   $0x2,-0x44(%rsp)
  jg     L1824
  cmp    $0x3,%r13d
  jg     L1824
  jmp    L492
  nopw   0x0(%rax,%rax,1)
L1408:
  lea    (%rcx,%rdi,1),%rsi
  cmpl   $0x1,0x38(%rsi)
  jne    L1818
  mov    0x54(%rsi),%edi
  test   %edi,%edi
  jne    L1818
  cmpl   $0x2,-0x44(%rsp)
  jg     L1818
  jmp    L1978
  nopl   0x0(%rax)
L475:
  movslq %r10d,%rsi
  cmpl   $0x1,(%rcx,%rsi,4)
  jne    L65
  movslq %r15d,%rsi
  mov    %r15d,%r11d
  mov    (%rcx,%rsi,4),%esi
  test   %esi,%esi
  jne    L65
  cmp    $0x3,%r13d
  jle    L492
  jmp    L65
  nopl   (%rax)
L1757:
  movslq %r10d,%rcx
  lea    (%r14,%rcx,4),%rcx
  cmpl   $0x1,0x38(%rax,%rcx,1)
  jne    L1452
  movslq %r15d,%rcx
  mov    %r15d,%r11d
  lea    (%r14,%rcx,4),%rcx
  mov    0x54(%rax,%rcx,1),%ecx
  test   %ecx,%ecx
  jne    L1452
  cmpl   $0x2,-0x44(%rsp)
  jg     L1452
  cmp    $0x3,%r13d
  jg     L1452
  jmp    L492
  nopw   0x0(%rax,%rax,1)
L684:
  movslq %ebp,%rdx
  lea    (%r14,%rdx,4),%rdx
  cmpl   $0x1,0x38(%rax,%rdx,1)
  jne    L507
  movslq %r12d,%rdx
  mov    %r12d,%r11d
  lea    (%r14,%rdx,4),%rdx
  mov    0x54(%rax,%rdx,1),%eax
  test   %eax,%eax
  jne    L507
  cmpl   $0x2,-0x44(%rsp)
  jg     L507
  cmp    $0x2,%r13d
  jle    L507
  jmp    L492
  nopw   0x0(%rax,%rax,1)
L1249:
  movslq %r10d,%rcx
  lea    (%r14,%rcx,4),%rcx
  cmpl   $0x1,-0x38(%rax,%rcx,1)
  jne    L1023
  movslq %r15d,%rcx
  mov    %r15d,%r11d
  lea    (%r14,%rcx,4),%rcx
  mov    -0x54(%rax,%rcx,1),%ecx
  test   %ecx,%ecx
  jne    L1023
  cmpl   $0x2,-0x44(%rsp)
  jle    L1023
  cmp    $0x3,%r13d
  jg     L1023
  jmp    L492
  nopw   0x0(%rax,%rax,1)
L738:
  movslq %ebp,%r8
  lea    (%r14,%r8,4),%r8
  cmpl   $0x1,-0x38(%rax,%r8,1)
  jne    L278
  movslq %r12d,%r8
  mov    %r12d,%r11d
  lea    (%r14,%r8,4),%r8
  mov    -0x54(%rax,%r8,1),%r8d
  test   %r8d,%r8d
  jne    L278
  cmpl   $0x2,-0x44(%rsp)
  jle    L278
  cmp    $0x2,%r13d
  jle    L278
  jmp    L492
  nopw   0x0(%rax,%rax,1)
L273:
  mov    0x38(%rdi,%rcx,1),%eax
  test   %eax,%eax
  jne    L899
  cmpl   $0x3,-0x44(%rsp)
  jg     L899
  mov    -0x20(%rsp),%r15d
  jmp    L1603
  nopl   0x0(%rax)
L1844:
  movslq %r10d,%rax
  mov    %r10d,%r11d
  mov    (%rcx,%rax,4),%eax
  test   %eax,%eax
  jne    L277
  cmp    $0x4,%r13d
  jg     L277
L492:
  mov    %r11d,%r15d
  pop    %rbx
  pop    %rbp
  mov    %r15d,%eax
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L1887:
  mov    0x40(%r14,%r13,4),%eax
  mov    %r10d,%r11d
  test   %eax,%eax
  jne    L829
  cmp    $0x4,%r13d
  jle    L492
L829:
  cmpl   $0xffffffff,0x38(%r14,%r13,4)
  jne    L462
  mov    -0x8(%rsp),%rax
  movl   $0x2,-0x44(%rsp)
  mov    $0x2,%edx
  movq   $0x38,-0x40(%rsp)
  mov    %rax,-0x38(%rsp)
  mov    0x18(%r14,%r13,4),%eax
  mov    %eax,-0x18(%rsp)
  cmpl   $0xffffffff,-0x18(%rsp)
  jne    L545
L1913:
  mov    -0x40(%rsp),%rdi
  movslq %ebp,%rax
  mov    %ebp,%r11d
  lea    (%r14,%rax,4),%rax
  mov    -0x38(%rdi,%rax,1),%r8d
  test   %r8d,%r8d
  jne    L545
  cmpl   $0x1,-0x44(%rsp)
  jle    L545
  cmp    $0x1,%r13d
  jle    L545
  jmp    L492
  nopl   0x0(%rax)
L1973:
  mov    -0x40(%rsp),%rdi
  movslq %r10d,%rax
  mov    %r10d,%r11d
  lea    (%r14,%rax,4),%rax
  mov    -0x38(%rdi,%rax,1),%edi
  test   %edi,%edi
  jne    L2049
  cmpl   $0x1,-0x44(%rsp)
  jle    L2049
  cmp    $0x4,%r13d
  jg     L2049
  jmp    L492
L462:
  movl   $0x2,-0x44(%rsp)
  jmp    L507
```

assistant: ```c
int bot(int grid[6][7], int move) {
  int i, j, t;
  if (move == 1) {
    for (i = 0; i < 6; i++) {
      for (j = 0; j < 7; j++) {
        if (grid[i][j] == 1 && grid[i + 1][j] == 1 && grid[i + 2][j] == 1 && grid[i + 3][j] == 0 && i < 3) {
          return j;
        } else if (grid[i][j] == 1 && grid[i][j + 1] == 1 && grid[i][j + 2] == 1 && grid[i][j + 3] == 0 && j < 4) {
          return j + 3;
        } else if (grid[i][j] == 1 && grid[i + 1][j + 1] == 1 && grid[i + 2][j + 2] == 1 && grid[i + 3][j + 3] == 0 && i < 3 && j < 4) {
          return j + 3;
        } else if (grid[i][j] == 1 && grid[i - 1][j - 1] == 1 && grid[i - 2][j - 2] == 1 && grid[i - 3][j - 3] == 0 && i > 2 && j > 2) {
          return j - 3;
        } else if (grid[i][j] == 1 && grid[i - 1][j + 1] == 1 && grid[i - 2][j + 2] == 1 && grid[i - 3][j + 3] == 0 && i > 2 && j < 4) {
          return j + 3;
        } else if (grid[i][j] == 1 && grid[i + 1][j - 1] == 1 && grid[i + 2][j - 2] == 1 && grid[i + 3][j - 3] == 0 && i < 3 && j > 2) {
          return j - 3;
        } else if (grid[i][j] == -1 && grid[i + 1][j] == -1 && grid[i + 2][j] == -1 && grid[i + 3][j] == 0 && i < 3) {
          return j;
        } else if (grid[i][j] == -1 && grid[i][j + 1] == -1 && grid[i][j + 2] == -1 && grid[i][j + 3] == 0 && j < 4) {
          return j + 3;
        } else if (grid[i][j] == -1 && grid[i + 1][j + 1] == -1 && grid[i + 2][j + 2] == -1 && grid[i + 3][j + 3] == 0 && i < 3 && j < 4) {
          return j + 3;
        } else if (grid[i][j] == -1 && grid[i - 1][j - 1] == -1 && grid[i - 2][j - 2] == -1 && grid[i - 3][j - 3] == 0 && i > 2 && j > 2) {
          return j - 3;
        } else if (grid[i][j] == -1 && grid[i - 1][j + 1] == -1 && grid[i - 2][j + 2] == -1 && grid[i - 3][j + 3] == 0 && i > 2 && j < 4) {
          return j + 3;
        } else if (grid[i][j] == -1 && grid[i + 1][j - 1] == -1 && grid[i + 2][j - 2] == -1 && grid[i + 3][j - 3] == 0 && i < 3 && j > 2) {
          return j - 3;
        } else if (grid[i][j] == 1 && grid[i + 1][j] == 1 && grid[i + 2][j] == 0 && i < 4) {
          return j;
        } else if (grid[i][j] == 1 && grid[i][j + 1] == 1 && grid[i][j + 2] == 0 && j < 5) {
          return j + 2;
        } else if (grid[i][j] == 1 && grid[i + 1][j + 1] == 1 && grid[i + 2][j + 2] == 0 && i < 4 && j < 5) {
          return j + 2;
        } else if (grid[i][j] == 1 && grid[i - 1][j - 1] == 1 && grid[i - 2][j - 2] == 0 && j > 1 && i > 1) {
          return j - 2;
        } else if (grid[i][j] == 1 && grid[i - 1][j + 1] == 1 && grid[i - 2][j + 2] == 0 && i > 1 && j < 5) {
          return j + 2;
        } else if (grid[i][j] == 1 && grid[i + 1][j - 1] == 1 && grid[i + 2][j - 2] == 0 && i < 4 && j > 1) {
          return j - 2;
        }
      }
    }
    for (t = 0; t < 6; t++)
      if (grid[0][t] == 0)
        return t;
    return 0;
  } else if (move == -1) {
    for (i = 0; i < 6; i++) {
      for (j = 0; j < 7; j++) {
        if (grid[i][j] == -1 && grid[i + 1][j] == -1 && grid[i + 2][j] == -1 && grid[i + 3][j] == 0 && i < 3) {
          return j;
        } else if (grid[i][j] == -1 && grid[i][j + 1] == -1 && grid[i][j + 2] == -1 && grid[i][j + 3] == 0 && j < 4) {
          return j + 3;
        } else if (grid[i][j] == -1 && grid[i + 1][j + 1] == -1 && grid[i + 2][j + 2] == -1 && grid[i + 3][j + 3] == 0 && i < 3 && j < 4) {
          return j + 3;
        } else if (grid[i][j] == -1 && grid[i - 1][j - 1] == -1 && grid[i - 2][j - 2] == -1 && grid[i - 3][j - 3] == 0 && i > 2 && j > 2) {
          return j - 3;
        } else if (grid[i][j] == -1 && grid[i - 1][j + 1] == -1 && grid[i - 2][j + 2] == -1 && grid[i - 3][j + 3] == 0 && i > 2 && j < 4) {
          return j + 3;
        } else if (grid[i][j] == -1 && grid[i + 1][j - 1] == -1 && grid[i + 2][j - 2] == -1 && grid[i + 3][j - 3] == 0 && i < 3 && j > 2) {
          return j - 3;
        } else if (grid[i][j] == 1 && grid[i + 1][j] == 1 && grid[i + 2][j] == 1 && grid[i + 3][j] == 0 && i < 3) {
          return j;
        } else if (grid[i][j] == 1 && grid[i][j + 1] == 1 && grid[i][j + 2] == 1 && grid[i][j + 3] == 0 && j < 4) {
          return j + 3;
        } else if (grid[i][j] == 1 && grid[i + 1][j + 1] == 1 && grid[i + 2][j + 2] == 1 && grid[i + 3][j + 3] == 0 && i < 3 && j < 4) {
          return j + 3;
        } else if (grid[i][j] == 1 && grid[i - 1][j - 1] == 1 && grid[i - 2][j - 2] == 1 && grid[i - 3][j - 3] == 0 && i > 2 && j > 2) {
          return j - 3;
        } else if (grid[i][j] == 1 && grid[i - 1][j + 1] == 1 && grid[i - 2][j + 2] == 1 && grid[i - 3][j + 3] == 0 && i > 2 && j < 4) {
          return j + 3;
        } else if (grid[i][j] == 1 && grid[i + 1][j - 1] == 1 && grid[i + 2][j - 2] == 1 && grid[i + 3][j - 3] == 0 && i < 3 && j > 2) {
          return j - 3;
        } else if (grid[i][j] == -1 && grid[i + 1][j] == -1 && grid[i + 2][j] == 0 && i < 4) {
          return j;
        } else if (grid[i][j] == -1 && grid[i][j + 1] == -1 && grid[i][j + 2] == 0 && j < 5) {
          return j + 2;
        } else if (grid[i][j] == -1 && grid[i + 1][j + 1] == -1 && grid[i = 2][j + 2] == 0 && i < 4 && j < 5) {
          return j + 2;
        } else if (grid[i][j] == -1 && grid[i - 1][j - 1] == -1 && grid[i - 2][j - 2] == 0 && i > 1 && j > 1) {
          return j - 2;
        } else if (grid[i][j] == -1 && grid[i - 1][j + 1] == -1 && grid[i - 2][j + 2] == 0 && i > 1 && j < 5) {
          return j + 2;
        } else if (grid[i][j] == -1 && grid[i + 1][j - 1] == -1 && grid[i + 2][j - 2] == 0 && i < 4 && j > 1) {
          return j - 2;
        }
      }
    }
    for (t = 0; t < 6; t++)
      if (grid[0][t] == 0)
        return t;
    return 0;
  }
}
```