#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 */

/* Variables and functions */
int /*<<< orphan*/ scanOctantFOV(char **, short, short, short, float, int, int,
                                 int /*<<< orphan*/, unsigned long,
                                 unsigned long, char);
void getFOVMask(char grid[(100 - 20 - 1)][((31 + 5) - 5 - 2)], short xLoc,
                short yLoc, float maxRadius, unsigned long forbiddenTerrain,
                unsigned long forbiddenFlags, char cautiousOnWalls) {
  short i;
  for (i = 1; i <= 8; i++) {
    scanOctantFOV(grid, xLoc, yLoc, i, maxRadius, 1, 32768 * -1, 0,
                  forbiddenTerrain, forbiddenFlags, cautiousOnWalls);
  }
}


x86 assembly (clang, -O0):
<getFOVMask>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %r9b,%al
mov    %rdi,-0x8(%rbp)
mov    %si,-0xa(%rbp)
mov    %dx,-0xc(%rbp)
movss  %xmm0,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %al,-0x21(%rbp)
movw   $0x1,-0x24(%rbp)
movswl -0x24(%rbp),%eax
cmp    $0x8,%eax
jg     11ae <getFOVMask+0x9e>
mov    -0x8(%rbp),%rdi
mov    -0xa(%rbp),%si
mov    -0xc(%rbp),%dx
mov    -0x24(%rbp),%cx
movss  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%r10
mov    -0x20(%rbp),%rax
mov    $0x1,%r8d
mov    $0xffff8000,%r9d
xor    %r11d,%r11d
movswl %si,%esi
movswl %dx,%edx
movswl %cx,%ecx
movl   $0x0,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
movsbl -0x21(%rbp),%eax
mov    %eax,0x18(%rsp)
call   1030 <scanOctantFOV@plt>
mov    -0x24(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x24(%rbp)
jmp    113d <getFOVMask+0x2d>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getFOVMask>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,%r12d
mov    %r8,%r15
mov    %rcx,%r14
movss  %xmm0,0x4(%rsp)
mov    %edx,%r13d
mov    %esi,%ebx
mov    %rdi,%rbp
mov    $0x1,%ecx
mov    $0x1,%r8d
mov    $0xffff8000,%r9d
push   %r12
push   %r15
push   %r14
push   $0x0
call   1030 <scanOctantFOV@plt>
add    $0x20,%rsp
mov    %rbp,%rdi
mov    %ebx,%esi
mov    %r13d,%edx
mov    $0x2,%ecx
movss  0x4(%rsp),%xmm0
mov    $0x1,%r8d
mov    $0xffff8000,%r9d
push   %r12
push   %r15
push   %r14
push   $0x0
call   1030 <scanOctantFOV@plt>
add    $0x20,%rsp
mov    %rbp,%rdi
mov    %ebx,%esi
mov    %r13d,%edx
mov    $0x3,%ecx
movss  0x4(%rsp),%xmm0
mov    $0x1,%r8d
mov    $0xffff8000,%r9d
push   %r12
push   %r15
push   %r14
push   $0x0
call   1030 <scanOctantFOV@plt>
add    $0x20,%rsp
mov    %rbp,%rdi
mov    %ebx,%esi
mov    %r13d,%edx
mov    $0x4,%ecx
movss  0x4(%rsp),%xmm0
mov    $0x1,%r8d
mov    $0xffff8000,%r9d
push   %r12
push   %r15
push   %r14
push   $0x0
call   1030 <scanOctantFOV@plt>
add    $0x20,%rsp
mov    %rbp,%rdi
mov    %ebx,%esi
mov    %r13d,%edx
mov    $0x5,%ecx
movss  0x4(%rsp),%xmm0
mov    $0x1,%r8d
mov    $0xffff8000,%r9d
push   %r12
push   %r15
push   %r14
push   $0x0
call   1030 <scanOctantFOV@plt>
add    $0x20,%rsp
mov    %rbp,%rdi
mov    %ebx,%esi
mov    %r13d,%edx
mov    $0x6,%ecx
movss  0x4(%rsp),%xmm0
mov    $0x1,%r8d
mov    $0xffff8000,%r9d
push   %r12
push   %r15
push   %r14
push   $0x0
call   1030 <scanOctantFOV@plt>
add    $0x20,%rsp
mov    %rbp,%rdi
mov    %ebx,%esi
mov    %r13d,%edx
mov    $0x7,%ecx
movss  0x4(%rsp),%xmm0
mov    $0x1,%r8d
mov    $0xffff8000,%r9d
push   %r12
push   %r15
push   %r14
push   $0x0
call   1030 <scanOctantFOV@plt>
add    $0x20,%rsp
mov    %rbp,%rdi
mov    %ebx,%esi
mov    %r13d,%edx
mov    $0x8,%ecx
movss  0x4(%rsp),%xmm0
mov    $0x1,%r8d
mov    $0xffff8000,%r9d
push   %r12
push   %r15
push   %r14
push   $0x0
call   1030 <scanOctantFOV@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @getFOVMask([29 x i8]* %0, i16 signext %1, i16 signext %2, float %3, i64 %4, i64 %5, i8 signext %6) {
%8 = alloca [29 x i8]*
%9 = alloca i16
%10 = alloca i16
%11 = alloca float
%12 = alloca i64
%13 = alloca i64
%14 = alloca i8
%15 = alloca i16
store [29 x i8]* %0, [29 x i8]** %8
store i16 %1, i16* %9
store i16 %2, i16* %10
store float %3, float* %11
store i64 %4, i64* %12
store i64 %5, i64* %13
store i8 %6, i8* %14
store i16 1, i16* %15
br label %16
16: ; preds = %31, %7
%17 = load i16, i16* %15
%18 = sext i16 %17 to i32
%19 = icmp sle i32 %18, 8
br i1 %19, label %20, label %34
20: ; preds = %16
%21 = load [29 x i8]*, [29 x i8]** %8
%22 = bitcast [29 x i8]* %21 to i8**
%23 = load i16, i16* %9
%24 = load i16, i16* %10
%25 = load i16, i16* %15
%26 = load float, float* %11
%27 = load i64, i64* %12
%28 = load i64, i64* %13
%29 = load i8, i8* %14
%30 = call i32 @scanOctantFOV(i8** %22, i16 signext %23, i16 signext %24, i16 signext %25, float %26, i32 1, i32 -32768, i32 0, i64 %27, i64 %28, i8 signext %29)
br label %31
31: ; preds = %20
%32 = load i16, i16* %15
%33 = add i16 %32, 1
store i16 %33, i16* %15
br label %16
34: ; preds = %16
ret void
}

LLVM IR (-O2):
define void @getFOVMask([29 x i8]* %0, i16 signext %1, i16 signext %2, float %3, i64 %4, i64 %5, i8 signext %6) {
%8 = bitcast [29 x i8]* %0 to i8**
%9 = tail call i32 @scanOctantFOV(i8** %8, i16 signext %1, i16 signext %2, i16 signext 1, float %3, i32 1, i32 -32768, i32 0, i64 %4, i64 %5, i8 signext %6)
%10 = tail call i32 @scanOctantFOV(i8** %8, i16 signext %1, i16 signext %2, i16 signext 2, float %3, i32 1, i32 -32768, i32 0, i64 %4, i64 %5, i8 signext %6)
%11 = tail call i32 @scanOctantFOV(i8** %8, i16 signext %1, i16 signext %2, i16 signext 3, float %3, i32 1, i32 -32768, i32 0, i64 %4, i64 %5, i8 signext %6)
%12 = tail call i32 @scanOctantFOV(i8** %8, i16 signext %1, i16 signext %2, i16 signext 4, float %3, i32 1, i32 -32768, i32 0, i64 %4, i64 %5, i8 signext %6)
%13 = tail call i32 @scanOctantFOV(i8** %8, i16 signext %1, i16 signext %2, i16 signext 5, float %3, i32 1, i32 -32768, i32 0, i64 %4, i64 %5, i8 signext %6)
%14 = tail call i32 @scanOctantFOV(i8** %8, i16 signext %1, i16 signext %2, i16 signext 6, float %3, i32 1, i32 -32768, i32 0, i64 %4, i64 %5, i8 signext %6)
%15 = tail call i32 @scanOctantFOV(i8** %8, i16 signext %1, i16 signext %2, i16 signext 7, float %3, i32 1, i32 -32768, i32 0, i64 %4, i64 %5, i8 signext %6)
%16 = tail call i32 @scanOctantFOV(i8** %8, i16 signext %1, i16 signext %2, i16 signext 8, float %3, i32 1, i32 -32768, i32 0, i64 %4, i64 %5, i8 signext %6)
ret void
}