#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
struct vision {
  int dummy;
};
struct grid {
  int dummy;
};

/* Variables and functions */
scalar_t__ vcheck(struct grid *, struct vision *, int, int, int);
int /*<<< orphan*/ vmark_safe(struct grid *, struct vision *, int, int, int,
                              int);
int /*<<< orphan*/ vmark_xynb(struct grid *, struct vision *, int, int, int,
                              int, int, int);
void vscan(struct grid *g, struct vision *v, int (*trans_x)(int, int),
           int (*trans_y)(int, int), int x0, int y0, int z0, int zminus,
           int zplus, int range, int xfl, int yfl, int xfh, int yfh, int prev_x,
           int prev_yl, int prev_yh) {
  int x, y, dyl, dyh, yl, yh;
  int b_lower = 0;
  int lower = y0;
  int range_u = range - 1;
  int xx, yy;
  if (range_u >= 0) {
    x = prev_x + 1;
    dyl = 0;
    if (2 * ((yfl - y0) * (x - x0) + (y0 - prev_yl) * (xfl - x0)) /
            (xfl - x0) >=
        1) {
      dyl = 1;
    }
    yl = prev_yl + dyl;
    dyh = 0;
    if (2 * ((yfh - y0) * (x - x0) + (y0 - prev_yh) * (xfh - x0)) /
            (xfh - x0) >=
        1) {
      dyh = 1;
    }
    yh = prev_yh + dyh;
    xx = x0 + trans_x(x - x0, yl - y0);
    yy = y0 + trans_y(x - x0, yl - y0);
    if (vcheck(g, v, xx, yy, z0)) {
      b_lower = 1;
      lower = yl;
    }
    for (y = yl; y <= yh; ++y) {
      xx = x0 + trans_x(x - x0, y - y0);
      yy = y0 + trans_y(x - x0, y - y0);
      if (vcheck(g, v, xx, yy, z0)) {
        vmark_xynb(g, v, xx, yy, z0, zminus, zplus, 1);
        if (b_lower) {
          if (y == yh) {
            vscan(g, v, trans_x, trans_y, x0, y0, z0, zminus, zplus, range_u,
                  xfl, yfl, xfh, yfh, x, lower, y);
          } else {
            ;
          }
        } else {
          xfl = x;
          yfl = y;
          b_lower = 1;
          lower = y;
        }
      } else {
        xx = x0 + trans_x(x - x0, y - y0);
        yy = y0 + trans_y(x - x0, y - y0);
        vmark_safe(g, v, xx, yy, z0, 1);
        if (b_lower) {
          vscan(g, v, trans_x, trans_y, x0, y0, z0, zminus, zplus, range_u, xfl,
                yfl, x, y - 1, x, lower, y - 1);
          xfl = x;
          yfl = y + 1;
          b_lower = 0;
        } else {
          xfl = x;
          yfl = y + 1;
          b_lower = 0;
        }
      }
    }
  }
}


x86 assembly (clang, -O0):
<vscan>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xe8,%rsp
mov    0x60(%rbp),%eax
mov    0x58(%rbp),%eax
mov    0x50(%rbp),%eax
mov    0x48(%rbp),%eax
mov    0x40(%rbp),%eax
mov    0x38(%rbp),%eax
mov    0x30(%rbp),%eax
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x30(%rbp)
mov    %rsi,-0x38(%rbp)
mov    %rdx,-0x40(%rbp)
mov    %rcx,-0x48(%rbp)
mov    %r8d,-0x4c(%rbp)
mov    %r9d,-0x50(%rbp)
movl   $0x0,-0x6c(%rbp)
mov    -0x50(%rbp),%eax
mov    %eax,-0x70(%rbp)
mov    0x28(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x74(%rbp)
cmpl   $0x0,-0x74(%rbp)
jl     15ca <vscan+0x48a>
mov    0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
movl   $0x0,-0x5c(%rbp)
mov    0x38(%rbp),%eax
sub    -0x50(%rbp),%eax
mov    -0x54(%rbp),%ecx
sub    -0x4c(%rbp),%ecx
imul   %ecx,%eax
mov    -0x50(%rbp),%ecx
sub    0x58(%rbp),%ecx
mov    0x30(%rbp),%edx
sub    -0x4c(%rbp),%edx
imul   %edx,%ecx
add    %ecx,%eax
shl    $0x1,%eax
mov    0x30(%rbp),%ecx
sub    -0x4c(%rbp),%ecx
cltd
idiv   %ecx
cmp    $0x1,%eax
jl     11f9 <vscan+0xb9>
movl   $0x1,-0x5c(%rbp)
mov    0x58(%rbp),%eax
add    -0x5c(%rbp),%eax
mov    %eax,-0x64(%rbp)
movl   $0x0,-0x60(%rbp)
mov    0x48(%rbp),%eax
sub    -0x50(%rbp),%eax
mov    -0x54(%rbp),%ecx
sub    -0x4c(%rbp),%ecx
imul   %ecx,%eax
mov    -0x50(%rbp),%ecx
sub    0x60(%rbp),%ecx
mov    0x40(%rbp),%edx
sub    -0x4c(%rbp),%edx
imul   %edx,%ecx
add    %ecx,%eax
shl    $0x1,%eax
mov    0x40(%rbp),%ecx
sub    -0x4c(%rbp),%ecx
cltd
idiv   %ecx
cmp    $0x1,%eax
jl     1245 <vscan+0x105>
movl   $0x1,-0x60(%rbp)
mov    0x60(%rbp),%eax
add    -0x60(%rbp),%eax
mov    %eax,-0x68(%rbp)
mov    -0x4c(%rbp),%eax
mov    %eax,-0x84(%rbp)
mov    -0x40(%rbp),%rax
mov    -0x54(%rbp),%edi
sub    -0x4c(%rbp),%edi
mov    -0x64(%rbp),%esi
sub    -0x50(%rbp),%esi
call   *%rax
mov    %eax,%ecx
mov    -0x84(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x78(%rbp)
mov    -0x50(%rbp),%eax
mov    %eax,-0x80(%rbp)
mov    -0x48(%rbp),%rax
mov    -0x54(%rbp),%edi
sub    -0x4c(%rbp),%edi
mov    -0x64(%rbp),%esi
sub    -0x50(%rbp),%esi
call   *%rax
mov    %eax,%ecx
mov    -0x80(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x7c(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x78(%rbp),%edx
mov    -0x7c(%rbp),%ecx
mov    0x10(%rbp),%r8d
call   1030 <vcheck@plt>
cmp    $0x0,%rax
je     12c6 <vscan+0x186>
movl   $0x1,-0x6c(%rbp)
mov    -0x64(%rbp),%eax
mov    %eax,-0x70(%rbp)
mov    -0x64(%rbp),%eax
mov    %eax,-0x58(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x68(%rbp),%eax
jg     15c5 <vscan+0x485>
mov    -0x4c(%rbp),%eax
mov    %eax,-0x8c(%rbp)
mov    -0x40(%rbp),%rax
mov    -0x54(%rbp),%edi
sub    -0x4c(%rbp),%edi
mov    -0x58(%rbp),%esi
sub    -0x50(%rbp),%esi
call   *%rax
mov    %eax,%ecx
mov    -0x8c(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x78(%rbp)
mov    -0x50(%rbp),%eax
mov    %eax,-0x88(%rbp)
mov    -0x48(%rbp),%rax
mov    -0x54(%rbp),%edi
sub    -0x4c(%rbp),%edi
mov    -0x58(%rbp),%esi
sub    -0x50(%rbp),%esi
call   *%rax
mov    %eax,%ecx
mov    -0x88(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x7c(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x78(%rbp),%edx
mov    -0x7c(%rbp),%ecx
mov    0x10(%rbp),%r8d
call   1030 <vcheck@plt>
cmp    $0x0,%rax
je     145a <vscan+0x31a>
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x78(%rbp),%edx
mov    -0x7c(%rbp),%ecx
mov    0x10(%rbp),%r8d
mov    0x18(%rbp),%r9d
mov    0x20(%rbp),%eax
mov    %eax,(%rsp)
movl   $0x1,0x8(%rsp)
call   1040 <vmark_xynb@plt>
cmpl   $0x0,-0x6c(%rbp)
je     143c <vscan+0x2fc>
mov    -0x58(%rbp),%eax
cmp    -0x68(%rbp),%eax
jne    1432 <vscan+0x2f2>
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x40(%rbp),%rdx
mov    -0x48(%rbp),%rcx
mov    -0x4c(%rbp),%r8d
mov    -0x50(%rbp),%r9d
mov    0x10(%rbp),%eax
mov    %eax,-0x9c(%rbp)
mov    0x18(%rbp),%eax
mov    %eax,-0x98(%rbp)
mov    0x20(%rbp),%eax
mov    %eax,-0x94(%rbp)
mov    -0x74(%rbp),%r13d
mov    0x30(%rbp),%r12d
mov    0x38(%rbp),%r15d
mov    0x40(%rbp),%r14d
mov    0x48(%rbp),%ebx
mov    -0x54(%rbp),%r11d
mov    -0x70(%rbp),%r10d
mov    -0x58(%rbp),%eax
mov    %eax,-0x90(%rbp)
mov    -0x9c(%rbp),%eax
mov    %eax,(%rsp)
mov    -0x98(%rbp),%eax
mov    %eax,0x8(%rsp)
mov    -0x94(%rbp),%eax
mov    %eax,0x10(%rsp)
mov    -0x90(%rbp),%eax
mov    %r13d,0x18(%rsp)
mov    %r12d,0x20(%rsp)
mov    %r15d,0x28(%rsp)
mov    %r14d,0x30(%rsp)
mov    %ebx,0x38(%rsp)
mov    %r11d,0x40(%rsp)
mov    %r10d,0x48(%rsp)
mov    %eax,0x50(%rsp)
call   1060 <vscan@plt>
jmp    1437 <vscan+0x2f7>
jmp    1437 <vscan+0x2f7>
jmp    1455 <vscan+0x315>
mov    -0x54(%rbp),%eax
mov    %eax,0x30(%rbp)
mov    -0x58(%rbp),%eax
mov    %eax,0x38(%rbp)
movl   $0x1,-0x6c(%rbp)
mov    -0x58(%rbp),%eax
mov    %eax,-0x70(%rbp)
jmp    15b2 <vscan+0x472>
mov    -0x4c(%rbp),%eax
mov    %eax,-0xa4(%rbp)
mov    -0x40(%rbp),%rax
mov    -0x54(%rbp),%edi
sub    -0x4c(%rbp),%edi
mov    -0x58(%rbp),%esi
sub    -0x50(%rbp),%esi
call   *%rax
mov    %eax,%ecx
mov    -0xa4(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x78(%rbp)
mov    -0x50(%rbp),%eax
mov    %eax,-0xa0(%rbp)
mov    -0x48(%rbp),%rax
mov    -0x54(%rbp),%edi
sub    -0x4c(%rbp),%edi
mov    -0x58(%rbp),%esi
sub    -0x50(%rbp),%esi
call   *%rax
mov    %eax,%ecx
mov    -0xa0(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x7c(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x78(%rbp),%edx
mov    -0x7c(%rbp),%ecx
mov    0x10(%rbp),%r8d
mov    $0x1,%r9d
call   1050 <vmark_safe@plt>
cmpl   $0x0,-0x6c(%rbp)
je     1597 <vscan+0x457>
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x40(%rbp),%rdx
mov    -0x48(%rbp),%rcx
mov    -0x4c(%rbp),%r8d
mov    -0x50(%rbp),%r9d
mov    0x10(%rbp),%eax
mov    %eax,-0xb4(%rbp)
mov    0x18(%rbp),%eax
mov    %eax,-0xb0(%rbp)
mov    0x20(%rbp),%eax
mov    %eax,-0xac(%rbp)
mov    -0x74(%rbp),%r13d
mov    0x30(%rbp),%r12d
mov    0x38(%rbp),%r15d
mov    -0x54(%rbp),%r14d
mov    -0x58(%rbp),%ebx
sub    $0x1,%ebx
mov    -0x54(%rbp),%r11d
mov    -0x70(%rbp),%r10d
mov    -0x58(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xa8(%rbp)
mov    -0xb4(%rbp),%eax
mov    %eax,(%rsp)
mov    -0xb0(%rbp),%eax
mov    %eax,0x8(%rsp)
mov    -0xac(%rbp),%eax
mov    %eax,0x10(%rsp)
mov    -0xa8(%rbp),%eax
mov    %r13d,0x18(%rsp)
mov    %r12d,0x20(%rsp)
mov    %r15d,0x28(%rsp)
mov    %r14d,0x30(%rsp)
mov    %ebx,0x38(%rsp)
mov    %r11d,0x40(%rsp)
mov    %r10d,0x48(%rsp)
mov    %eax,0x50(%rsp)
call   1060 <vscan@plt>
mov    -0x54(%rbp),%eax
mov    %eax,0x30(%rbp)
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,0x38(%rbp)
movl   $0x0,-0x6c(%rbp)
jmp    15ad <vscan+0x46d>
mov    -0x54(%rbp),%eax
mov    %eax,0x30(%rbp)
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,0x38(%rbp)
movl   $0x0,-0x6c(%rbp)
jmp    15b2 <vscan+0x472>
jmp    15b7 <vscan+0x477>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    12cc <vscan+0x18c>
jmp    15ca <vscan+0x48a>
add    $0xe8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<vscan>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
mov    %r9,0x48(%rsp)
mov    %rsi,0x80(%rsp)
mov    %rdi,0x78(%rsp)
mov    0xe8(%rsp),%eax
mov    %rax,0x58(%rsp)
test   %eax,%eax
jle    1295 <vscan+0x155>
mov    %rdx,%rbp
mov    0x120(%rsp),%r9d
mov    0x118(%rsp),%edi
mov    0x110(%rsp),%eax
mov    0x108(%rsp),%ebx
mov    0x100(%rsp),%r10d
mov    0xf8(%rsp),%edx
mov    0xf0(%rsp),%esi
add    $0x1,%eax
mov    %rdx,0x40(%rsp)
mov    %r8,0x10(%rsp)
mov    %rcx,0x28(%rsp)
mov    0x48(%rsp),%r13
sub    %r13d,%edx
mov    %rax,0x60(%rsp)
mov    %eax,%r15d
sub    0x10(%rsp),%r15d
imul   %r15d,%edx
mov    %r13d,%eax
sub    %edi,%eax
mov    %rsi,0x38(%rsp)
sub    0x10(%rsp),%esi
imul   %esi,%eax
add    %edx,%eax
add    %eax,%eax
cltd
idiv   %esi
xor    %ecx,%ecx
test   %eax,%eax
setg   %cl
mov    %ebx,%edx
sub    %r13d,%edx
imul   %r15d,%edx
mov    %r13d,%eax
sub    %r9d,%eax
mov    %r10d,%esi
sub    0x10(%rsp),%esi
imul   %esi,%eax
add    %edx,%eax
add    %eax,%eax
cltd
idiv   %esi
xor    %r12d,%r12d
test   %eax,%eax
mov    %rcx,0x30(%rsp)
lea    (%rcx,%rdi,1),%r14d
setg   %r12b
add    %r9d,%r12d
mov    %r14d,%ebx
sub    %r13d,%ebx
mov    %r15d,%edi
mov    %ebx,%esi
mov    %rbp,0x20(%rsp)
call   *0x20(%rsp)
mov    0x10(%rsp),%rcx
add    %ecx,%eax
mov    %eax,0x1c(%rsp)
mov    %r15d,%edi
mov    %ebx,%esi
mov    %r15d,%ebx
call   *0x28(%rsp)
lea    (%rax,%r13,1),%ecx
mov    0x28(%rsp),%rbp
mov    0x10(%rsp),%r13
mov    0x78(%rsp),%rdi
mov    0x80(%rsp),%rsi
mov    0x1c(%rsp),%edx
mov    0xd0(%rsp),%r8d
call   1030 <vcheck@plt>
mov    %r14,%rsi
mov    0x20(%rsp),%r8
mov    %r12,0x70(%rsp)
cmp    %r12d,%esi
jle    12a7 <vscan+0x167>
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x58(%rsp),%rcx
add    $0xffffffff,%ecx
mov    %rcx,0x58(%rsp)
xor    %r14d,%r14d
test   %rax,%rax
mov    %esi,%ecx
mov    0x48(%rsp),%rax
cmove  %eax,%ecx
mov    %rcx,0x68(%rsp)
setne  %r14b
mov    0x70(%rsp),%rcx
neg    %ecx
mov    %rcx,0x88(%rsp)
mov    0x118(%rsp),%ecx
mov    0x30(%rsp),%rdi
add    %edi,%ecx
add    $0x1,%ecx
neg    %eax
mov    %rax,0x90(%rsp)
mov    %ebx,0xc(%rsp)
jmp    1338 <vscan+0x1f8>
mov    0x10(%rsp),%r13
mov    0x28(%rsp),%rbp
mov    0x20(%rsp),%r8
mov    0xc(%rsp),%ebx
mov    0x50(%rsp),%rsi
add    $0x1,%esi
mov    0x88(%rsp),%rax
add    %r15d,%eax
add    $0x1,%eax
mov    %r15d,%ecx
add    $0x1,%ecx
mov    %edx,%r14d
cmp    $0x2,%eax
je     1295 <vscan+0x155>
mov    %r14d,0x1c(%rsp)
mov    %rsi,0x50(%rsp)
mov    0x90(%rsp),%rax
mov    %rcx,0x30(%rsp)
lea    (%rax,%rcx,1),%r12d
add    $0xffffffff,%r12d
mov    %ebx,%edi
mov    %r12d,%esi
mov    %r8,%r15
call   *%r8
mov    %eax,%r14d
add    %r13d,%r14d
mov    %ebx,%edi
mov    %r12d,%esi
call   *%rbp
mov    %eax,%r13d
add    0x48(%rsp),%r13d
mov    0x78(%rsp),%rbp
mov    %rbp,%rdi
mov    0x80(%rsp),%rbx
mov    %rbx,%rsi
mov    %r14d,%edx
mov    %r13d,%ecx
mov    0xd0(%rsp),%eax
mov    %rax,%r8
call   1030 <vcheck@plt>
test   %rax,%rax
je     1480 <vscan+0x340>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
mov    %r13d,%ecx
mov    0xd0(%rsp),%r15d
mov    %r15d,%r8d
mov    0xd8(%rsp),%r9d
push   $0x1
mov    0xe8(%rsp),%eax
push   %rax
call   1040 <vmark_xynb@plt>
add    $0x10,%rsp
mov    $0x1,%edx
cmpl   $0x0,0x1c(%rsp)
je     1510 <vscan+0x3d0>
mov    %r15,%r10
mov    0x88(%rsp),%rax
mov    0x30(%rsp),%r15
add    %r15d,%eax
cmp    $0x1,%eax
jne    12fd <vscan+0x1bd>
sub    $0x8,%rsp
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    0x28(%rsp),%rbx
mov    %rbx,%rdx
mov    0x30(%rsp),%rcx
mov    0x18(%rsp),%r13
mov    %rcx,%rbp
mov    %r13d,%r8d
mov    0x50(%rsp),%r9
push   0x78(%rsp)
push   0x78(%rsp)
push   0x78(%rsp)
mov    0x128(%rsp),%eax
push   %rax
mov    0x128(%rsp),%eax
push   %rax
push   0x70(%rsp)
push   0x70(%rsp)
push   0x98(%rsp)
mov    0x128(%rsp),%eax
push   %rax
mov    0x128(%rsp),%eax
push   %rax
push   %r10
call   1060 <vscan@plt>
mov    $0x1,%edx
mov    %rbx,%r8
add    $0x60,%rsp
jmp    130c <vscan+0x1cc>
mov    0xc(%rsp),%r14d
mov    %r14d,%edi
mov    %r12d,%esi
call   *%r15
mov    0x10(%rsp),%r13
lea    (%rax,%r13,1),%r15d
mov    %r14d,%edi
mov    %r12d,%esi
mov    0x28(%rsp),%r12
call   *%r12
mov    0x48(%rsp),%r14
lea    (%rax,%r14,1),%ecx
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r15d,%edx
mov    0xd0(%rsp),%r15d
mov    %r15d,%r8d
mov    $0x1,%r9d
call   1050 <vmark_safe@plt>
xor    %edx,%edx
cmpl   $0x0,0x1c(%rsp)
jne    1545 <vscan+0x405>
mov    0x30(%rsp),%r15
mov    %r15d,%eax
mov    %rax,0x40(%rsp)
mov    0x60(%rsp),%rax
mov    %rax,0x38(%rsp)
mov    0x20(%rsp),%r8
mov    0xc(%rsp),%ebx
mov    0x50(%rsp),%rsi
mov    %r12,%rbp
jmp    1315 <vscan+0x1d5>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x30(%rsp),%r15
lea    -0x1(%r15),%eax
mov    %rax,0x68(%rsp)
mov    0x50(%rsp),%rsi
mov    %esi,%eax
mov    %rax,0x40(%rsp)
mov    0x60(%rsp),%rax
mov    %rax,0x38(%rsp)
mov    0x10(%rsp),%r13
mov    0x28(%rsp),%rbp
mov    0x20(%rsp),%r8
jmp    15bd <vscan+0x47d>
mov    %r15,%r10
mov    0x30(%rsp),%r15
lea    -0x2(%r15),%eax
sub    $0x8,%rsp
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    0x28(%rsp),%rbx
mov    %rbx,%rdx
mov    %r12,%rcx
mov    %r13d,%r8d
mov    %r14d,%r9d
push   %rax
push   0x78(%rsp)
mov    0x78(%rsp),%rbp
push   %rbp
push   %rax
push   %rbp
push   0x70(%rsp)
push   0x70(%rsp)
push   0x98(%rsp)
mov    0x128(%rsp),%eax
push   %rax
mov    0x128(%rsp),%eax
push   %rax
push   %r10
call   1060 <vscan@plt>
xor    %edx,%edx
mov    %rbx,%r8
add    $0x60,%rsp
mov    0x50(%rsp),%rsi
lea    0x1(%rsi),%eax
mov    %rax,0x40(%rsp)
mov    %rbp,0x38(%rsp)
mov    %r12,%rbp
mov    0xc(%rsp),%ebx
jmp    1315 <vscan+0x1d5>

LLVM IR (-O0):
%struct.grid = type { i32 }
%struct.vision = type { i32 }
define void @vscan(%struct.grid* %0, %struct.vision* %1, i32 (i32, i32)* %2, i32 (i32, i32)* %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9, i32 %10, i32 %11, i32 %12, i32 %13, i32 %14, i32 %15, i32 %16) {
%18 = alloca %struct.grid*
%19 = alloca %struct.vision*
%20 = alloca i32 (i32, i32)*
%21 = alloca i32 (i32, i32)*
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
%28 = alloca i32
%29 = alloca i32
%30 = alloca i32
%31 = alloca i32
%32 = alloca i32
%33 = alloca i32
%34 = alloca i32
%35 = alloca i32
%36 = alloca i32
%37 = alloca i32
%38 = alloca i32
%39 = alloca i32
%40 = alloca i32
%41 = alloca i32
%42 = alloca i32
%43 = alloca i32
%44 = alloca i32
%45 = alloca i32
store %struct.grid* %0, %struct.grid** %18
store %struct.vision* %1, %struct.vision** %19
store i32 (i32, i32)* %2, i32 (i32, i32)** %20
store i32 (i32, i32)* %3, i32 (i32, i32)** %21
store i32 %4, i32* %22
store i32 %5, i32* %23
store i32 %6, i32* %24
store i32 %7, i32* %25
store i32 %8, i32* %26
store i32 %9, i32* %27
store i32 %10, i32* %28
store i32 %11, i32* %29
store i32 %12, i32* %30
store i32 %13, i32* %31
store i32 %14, i32* %32
store i32 %15, i32* %33
store i32 %16, i32* %34
store i32 0, i32* %41
%46 = load i32, i32* %23
store i32 %46, i32* %42
%47 = load i32, i32* %27
%48 = sub nsw i32 %47, 1
store i32 %48, i32* %43
%49 = load i32, i32* %43
%50 = icmp sge i32 %49, 0
br i1 %50, label %51, label %271
51: ; preds = %17
%52 = load i32, i32* %32
%53 = add nsw i32 %52, 1
store i32 %53, i32* %35
store i32 0, i32* %37
%54 = load i32, i32* %29
%55 = load i32, i32* %23
%56 = sub nsw i32 %54, %55
%57 = load i32, i32* %35
%58 = load i32, i32* %22
%59 = sub nsw i32 %57, %58
%60 = mul nsw i32 %56, %59
%61 = load i32, i32* %23
%62 = load i32, i32* %33
%63 = sub nsw i32 %61, %62
%64 = load i32, i32* %28
%65 = load i32, i32* %22
%66 = sub nsw i32 %64, %65
%67 = mul nsw i32 %63, %66
%68 = add nsw i32 %60, %67
%69 = mul nsw i32 2, %68
%70 = load i32, i32* %28
%71 = load i32, i32* %22
%72 = sub nsw i32 %70, %71
%73 = sdiv i32 %69, %72
%74 = icmp sge i32 %73, 1
br i1 %74, label %75, label %76
75: ; preds = %51
store i32 1, i32* %37
br label %76
76: ; preds = %75, %51
%77 = load i32, i32* %33
%78 = load i32, i32* %37
%79 = add nsw i32 %77, %78
store i32 %79, i32* %39
store i32 0, i32* %38
%80 = load i32, i32* %31
%81 = load i32, i32* %23
%82 = sub nsw i32 %80, %81
%83 = load i32, i32* %35
%84 = load i32, i32* %22
%85 = sub nsw i32 %83, %84
%86 = mul nsw i32 %82, %85
%87 = load i32, i32* %23
%88 = load i32, i32* %34
%89 = sub nsw i32 %87, %88
%90 = load i32, i32* %30
%91 = load i32, i32* %22
%92 = sub nsw i32 %90, %91
%93 = mul nsw i32 %89, %92
%94 = add nsw i32 %86, %93
%95 = mul nsw i32 2, %94
%96 = load i32, i32* %30
%97 = load i32, i32* %22
%98 = sub nsw i32 %96, %97
%99 = sdiv i32 %95, %98
%100 = icmp sge i32 %99, 1
br i1 %100, label %101, label %102
101: ; preds = %76
store i32 1, i32* %38
br label %102
102: ; preds = %101, %76
%103 = load i32, i32* %34
%104 = load i32, i32* %38
%105 = add nsw i32 %103, %104
store i32 %105, i32* %40
%106 = load i32, i32* %22
%107 = load i32 (i32, i32)*, i32 (i32, i32)** %20
%108 = load i32, i32* %35
%109 = load i32, i32* %22
%110 = sub nsw i32 %108, %109
%111 = load i32, i32* %39
%112 = load i32, i32* %23
%113 = sub nsw i32 %111, %112
%114 = call i32 %107(i32 %110, i32 %113)
%115 = add nsw i32 %106, %114
store i32 %115, i32* %44
%116 = load i32, i32* %23
%117 = load i32 (i32, i32)*, i32 (i32, i32)** %21
%118 = load i32, i32* %35
%119 = load i32, i32* %22
%120 = sub nsw i32 %118, %119
%121 = load i32, i32* %39
%122 = load i32, i32* %23
%123 = sub nsw i32 %121, %122
%124 = call i32 %117(i32 %120, i32 %123)
%125 = add nsw i32 %116, %124
store i32 %125, i32* %45
%126 = load %struct.grid*, %struct.grid** %18
%127 = load %struct.vision*, %struct.vision** %19
%128 = load i32, i32* %44
%129 = load i32, i32* %45
%130 = load i32, i32* %24
%131 = call i64 @vcheck(%struct.grid* %126, %struct.vision* %127, i32 %128, i32 %129, i32 %130)
%132 = icmp ne i64 %131, 0
br i1 %132, label %133, label %135
133: ; preds = %102
store i32 1, i32* %41
%134 = load i32, i32* %39
store i32 %134, i32* %42
br label %135
135: ; preds = %133, %102
%136 = load i32, i32* %39
store i32 %136, i32* %36
br label %137
137: ; preds = %267, %135
%138 = load i32, i32* %36
%139 = load i32, i32* %40
%140 = icmp sle i32 %138, %139
br i1 %140, label %141, label %270
141: ; preds = %137
%142 = load i32, i32* %22
%143 = load i32 (i32, i32)*, i32 (i32, i32)** %20
%144 = load i32, i32* %35
%145 = load i32, i32* %22
%146 = sub nsw i32 %144, %145
%147 = load i32, i32* %36
%148 = load i32, i32* %23
%149 = sub nsw i32 %147, %148
%150 = call i32 %143(i32 %146, i32 %149)
%151 = add nsw i32 %142, %150
store i32 %151, i32* %44
%152 = load i32, i32* %23
%153 = load i32 (i32, i32)*, i32 (i32, i32)** %21
%154 = load i32, i32* %35
%155 = load i32, i32* %22
%156 = sub nsw i32 %154, %155
%157 = load i32, i32* %36
%158 = load i32, i32* %23
%159 = sub nsw i32 %157, %158
%160 = call i32 %153(i32 %156, i32 %159)
%161 = add nsw i32 %152, %160
store i32 %161, i32* %45
%162 = load %struct.grid*, %struct.grid** %18
%163 = load %struct.vision*, %struct.vision** %19
%164 = load i32, i32* %44
%165 = load i32, i32* %45
%166 = load i32, i32* %24
%167 = call i64 @vcheck(%struct.grid* %162, %struct.vision* %163, i32 %164, i32 %165, i32 %166)
%168 = icmp ne i64 %167, 0
br i1 %168, label %169, label %209
169: ; preds = %141
%170 = load %struct.grid*, %struct.grid** %18
%171 = load %struct.vision*, %struct.vision** %19
%172 = load i32, i32* %44
%173 = load i32, i32* %45
%174 = load i32, i32* %24
%175 = load i32, i32* %25
%176 = load i32, i32* %26
%177 = call i32 @vmark_xynb(%struct.grid* %170, %struct.vision* %171, i32 %172, i32 %173, i32 %174, i32 %175, i32 %176, i32 1)
%178 = load i32, i32* %41
%179 = icmp ne i32 %178, 0
br i1 %179, label %180, label %204
180: ; preds = %169
%181 = load i32, i32* %36
%182 = load i32, i32* %40
%183 = icmp eq i32 %181, %182
br i1 %183, label %184, label %202
184: ; preds = %180
%185 = load %struct.grid*, %struct.grid** %18
%186 = load %struct.vision*, %struct.vision** %19
%187 = load i32 (i32, i32)*, i32 (i32, i32)** %20
%188 = load i32 (i32, i32)*, i32 (i32, i32)** %21
%189 = load i32, i32* %22
%190 = load i32, i32* %23
%191 = load i32, i32* %24
%192 = load i32, i32* %25
%193 = load i32, i32* %26
%194 = load i32, i32* %43
%195 = load i32, i32* %28
%196 = load i32, i32* %29
%197 = load i32, i32* %30
%198 = load i32, i32* %31
%199 = load i32, i32* %35
%200 = load i32, i32* %42
%201 = load i32, i32* %36
br label %203
202: ; preds = %180
br label %203
203: ; preds = %202, %184
br label %208
204: ; preds = %169
%205 = load i32, i32* %35
store i32 %205, i32* %28
%206 = load i32, i32* %36
store i32 %206, i32* %29
store i32 1, i32* %41
%207 = load i32, i32* %36
store i32 %207, i32* %42
br label %208
208: ; preds = %204, %203
br label %266
209: ; preds = %141
%210 = load i32, i32* %22
%211 = load i32 (i32, i32)*, i32 (i32, i32)** %20
%212 = load i32, i32* %35
%213 = load i32, i32* %22
%214 = sub nsw i32 %212, %213
%215 = load i32, i32* %36
%216 = load i32, i32* %23
%217 = sub nsw i32 %215, %216
%218 = call i32 %211(i32 %214, i32 %217)
%219 = add nsw i32 %210, %218
store i32 %219, i32* %44
%220 = load i32, i32* %23
%221 = load i32 (i32, i32)*, i32 (i32, i32)** %21
%222 = load i32, i32* %35
%223 = load i32, i32* %22
%224 = sub nsw i32 %222, %223
%225 = load i32, i32* %36
%226 = load i32, i32* %23
%227 = sub nsw i32 %225, %226
%228 = call i32 %221(i32 %224, i32 %227)
%229 = add nsw i32 %220, %228
store i32 %229, i32* %45
%230 = load %struct.grid*, %struct.grid** %18
%231 = load %struct.vision*, %struct.vision** %19
%232 = load i32, i32* %44
%233 = load i32, i32* %45
%234 = load i32, i32* %24
%235 = call i32 @vmark_safe(%struct.grid* %230, %struct.vision* %231, i32 %232, i32 %233, i32 %234, i32 1)
%236 = load i32, i32* %41
%237 = icmp ne i32 %236, 0
br i1 %237, label %238, label %261
238: ; preds = %209
%239 = load %struct.grid*, %struct.grid** %18
%240 = load %struct.vision*, %struct.vision** %19
%241 = load i32 (i32, i32)*, i32 (i32, i32)** %20
%242 = load i32 (i32, i32)*, i32 (i32, i32)** %21
%243 = load i32, i32* %22
%244 = load i32, i32* %23
%245 = load i32, i32* %24
%246 = load i32, i32* %25
%247 = load i32, i32* %26
%248 = load i32, i32* %43
%249 = load i32, i32* %28
%250 = load i32, i32* %29
%251 = load i32, i32* %35
%252 = load i32, i32* %36
%253 = sub nsw i32 %252, 1
%254 = load i32, i32* %35
%255 = load i32, i32* %42
%256 = load i32, i32* %36
%257 = sub nsw i32 %256, 1
%258 = load i32, i32* %35
store i32 %258, i32* %28
%259 = load i32, i32* %36
%260 = add nsw i32 %259, 1
store i32 %260, i32* %29
store i32 0, i32* %41
br label %265
261: ; preds = %209
%262 = load i32, i32* %35
store i32 %262, i32* %28
%263 = load i32, i32* %36
%264 = add nsw i32 %263, 1
store i32 %264, i32* %29
store i32 0, i32* %41
br label %265
265: ; preds = %261, %238
br label %266
266: ; preds = %265, %208
br label %267
267: ; preds = %266
%268 = load i32, i32* %36
%269 = add nsw i32 %268, 1
store i32 %269, i32* %36
br label %137
270: ; preds = %137
br label %271
271: ; preds = %270, %17
ret void
}

LLVM IR (-O2):
%struct.grid = type { i32 }
%struct.vision = type { i32 }
define void @vscan(%struct.grid* %0, %struct.vision* %1, i32 (i32, i32)* %2, i32 (i32, i32)* %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9, i32 %10, i32 %11, i32 %12, i32 %13, i32 %14, i32 %15, i32 %16) {
%18 = add nsw i32 %9, -1
%19 = icmp sgt i32 %9, 0
br i1 %19, label %20, label %95
20: ; preds = %17
%21 = add nsw i32 %14, 1
%22 = sub nsw i32 %11, %5
%23 = sub nsw i32 %21, %4
%24 = mul nsw i32 %23, %22
%25 = sub nsw i32 %5, %15
%26 = sub nsw i32 %10, %4
%27 = mul nsw i32 %25, %26
%28 = add nsw i32 %24, %27
%29 = shl nsw i32 %28, 1
%30 = sdiv i32 %29, %26
%31 = icmp sgt i32 %30, 0
%32 = zext i1 %31 to i32
%33 = add nsw i32 %32, %15
%34 = sub nsw i32 %13, %5
%35 = mul nsw i32 %23, %34
%36 = sub nsw i32 %5, %16
%37 = sub nsw i32 %12, %4
%38 = mul nsw i32 %36, %37
%39 = add nsw i32 %38, %35
%40 = shl nsw i32 %39, 1
%41 = sdiv i32 %40, %37
%42 = icmp sgt i32 %41, 0
%43 = zext i1 %42 to i32
%44 = add i32 %43, %16
%45 = sub nsw i32 %33, %5
%46 = tail call i32 %2(i32 %23, i32 %45)
%47 = add nsw i32 %46, %4
%48 = tail call i32 %3(i32 %23, i32 %45)
%49 = add nsw i32 %48, %5
%50 = tail call i64 @vcheck(%struct.grid* %0, %struct.vision* %1, i32 %47, i32 %49, i32 %6)
%51 = icmp eq i64 %50, 0
%52 = icmp sgt i32 %33, %44
br i1 %52, label %95, label %53
53: ; preds = %20
%54 = select i1 %51, i32 %5, i32 %33
%55 = xor i1 %51, true
%56 = zext i1 %55 to i32
br label %57
57: ; preds = %53, %88
%58 = phi i32 [ %92, %88 ], [ %10, %53 ]
%59 = phi i32 [ %91, %88 ], [ %54, %53 ]
%60 = phi i32 [ %90, %88 ], [ %56, %53 ]
%61 = phi i32 [ %89, %88 ], [ %11, %53 ]
%62 = phi i32 [ %93, %88 ], [ %33, %53 ]
%63 = sub nsw i32 %62, %5
%64 = tail call i32 %2(i32 %23, i32 %63)
%65 = add nsw i32 %64, %4
%66 = tail call i32 %3(i32 %23, i32 %63)
%67 = add nsw i32 %66, %5
%68 = tail call i64 @vcheck(%struct.grid* %0, %struct.vision* %1, i32 %65, i32 %67, i32 %6)
%69 = icmp eq i64 %68, 0
br i1 %69, label %76, label %70
70: ; preds = %57
%71 = tail call i32 @vmark_xynb(%struct.grid* %0, %struct.vision* %1, i32 %65, i32 %67, i32 %6, i32 %7, i32 %8, i32 1)
%72 = icmp eq i32 %60, 0
br i1 %72, label %88, label %73
73: ; preds = %70
%74 = icmp eq i32 %62, %44
br i1 %74, label %75, label %88
75: ; preds = %73
tail call void @vscan(%struct.grid* %0, %struct.vision* %1, i32 (i32, i32)* %2, i32 (i32, i32)* %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %18, i32 %58, i32 %61, i32 %12, i32 %13, i32 %21, i32 %59, i32 %44)
br label %88
76: ; preds = %57
%77 = tail call i32 %2(i32 %23, i32 %63)
%78 = add nsw i32 %77, %4
%79 = tail call i32 %3(i32 %23, i32 %63)
%80 = add nsw i32 %79, %5
%81 = tail call i32 @vmark_safe(%struct.grid* %0, %struct.vision* %1, i32 %78, i32 %80, i32 %6, i32 1)
%82 = icmp eq i32 %60, 0
br i1 %82, label %86, label %83
83: ; preds = %76
%84 = add nsw i32 %62, -1
tail call void @vscan(%struct.grid* %0, %struct.vision* %1, i32 (i32, i32)* %2, i32 (i32, i32)* %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %18, i32 %58, i32 %61, i32 %21, i32 %84, i32 %21, i32 %59, i32 %84)
%85 = add nsw i32 %62, 1
br label %88
86: ; preds = %76
%87 = add nsw i32 %62, 1
br label %88
88: ; preds = %70, %75, %73, %86, %83
%89 = phi i32 [ %61, %75 ], [ %61, %73 ], [ %85, %83 ], [ %87, %86 ], [ %62, %70 ]
%90 = phi i32 [ 1, %75 ], [ 1, %73 ], [ 0, %83 ], [ 0, %86 ], [ 1, %70 ]
%91 = phi i32 [ %59, %75 ], [ %59, %73 ], [ %59, %83 ], [ %59, %86 ], [ %62, %70 ]
%92 = phi i32 [ %58, %75 ], [ %58, %73 ], [ %21, %83 ], [ %21, %86 ], [ %21, %70 ]
%93 = add i32 %62, 1
%94 = icmp eq i32 %62, %44
br i1 %94, label %95, label %57
95: ; preds = %88, %20, %17
ret void
}