#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*/ HECMW_vis_print_exit(char *);
double fabs(double);
void find_projection_range(double view_point[3], double n_vertex[24],
                           double scr_area[4]) {
  int i;
  double p[8][2];
  for (i = 0; i < 8; i++) {
    if (fabs(n_vertex[i * 3 + 2] - view_point[2]) < 0.00000001)
      HECMW_vis_print_exit(
          "ERROR: HEC-MW-VIS-E2002: The viewpoint position is not correct");
    p[i][0] = view_point[0] - view_point[2] /
                                  (n_vertex[i * 3 + 2] - view_point[2]) *
                                  (n_vertex[i * 3] - view_point[0]);
    p[i][1] = view_point[1] - view_point[2] /
                                  (n_vertex[i * 3 + 2] - view_point[2]) *
                                  (n_vertex[i * 3 + 1] - view_point[1]);
  }
  scr_area[0] = scr_area[1] = p[0][0];
  scr_area[2] = scr_area[3] = p[0][1];
  for (i = 0; i < 8; i++) {
    if (p[i][0] < scr_area[0])
      scr_area[0] = p[i][0];
    if (p[i][0] > scr_area[1])
      scr_area[1] = p[i][0];
    if (p[i][1] < scr_area[2])
      scr_area[2] = p[i][1];
    if (p[i][1] > scr_area[3])
      scr_area[3] = p[i][1];
  }
  return;
}


x86 assembly (clang, -O0):
<find_projection_range>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x8,-0x1c(%rbp)
jge    128d <find_projection_range+0x17d>
mov    -0x10(%rbp),%rax
imul   $0x3,-0x1c(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x8(%rbp),%rax
subsd  0x10(%rax),%xmm1
movaps 0xeb5(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xe99(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    117d <find_projection_range+0x6d>
lea    0xea8(%rip),%rdi
call   1030 <HECMW_vis_print_exit@plt>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
imul   $0x3,-0x1c(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x8(%rbp),%rax
subsd  0x10(%rax),%xmm2
divsd  %xmm2,%xmm0
mov    -0x10(%rbp),%rax
imul   $0x3,-0x1c(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x8(%rbp),%rax
subsd  (%rax),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movslq -0x1c(%rbp),%rcx
lea    -0xa0(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
imul   $0x3,-0x1c(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x8(%rbp),%rax
subsd  0x10(%rax),%xmm2
divsd  %xmm2,%xmm0
mov    -0x10(%rbp),%rax
imul   $0x3,-0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x8(%rbp),%rax
subsd  0x8(%rax),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movslq -0x1c(%rbp),%rcx
lea    -0xa0(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movsd  %xmm0,0x8(%rax)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112e <find_projection_range+0x1e>
movsd  -0xa0(%rbp),%xmm0
ff
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x98(%rbp),%xmm0
ff
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x18(%rax)
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x10(%rax)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x8,-0x1c(%rbp)
jge    13fe <find_projection_range+0x2ee>
movslq -0x1c(%rbp),%rcx
lea    -0xa0(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movsd  (%rax),%xmm1
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    1317 <find_projection_range+0x207>
movslq -0x1c(%rbp),%rcx
lea    -0xa0(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movslq -0x1c(%rbp),%rcx
lea    -0xa0(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
ucomisd 0x8(%rax),%xmm0
jbe    135b <find_projection_range+0x24b>
movslq -0x1c(%rbp),%rcx
lea    -0xa0(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movslq -0x1c(%rbp),%rcx
lea    -0xa0(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movsd  0x8(%rax),%xmm1
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    13a5 <find_projection_range+0x295>
movslq -0x1c(%rbp),%rcx
lea    -0xa0(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movsd  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x10(%rax)
movslq -0x1c(%rbp),%rcx
lea    -0xa0(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movsd  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
ucomisd 0x18(%rax),%xmm0
jbe    13eb <find_projection_range+0x2db>
movslq -0x1c(%rbp),%rcx
lea    -0xa0(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movsd  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x18(%rax)
jmp    13f0 <find_projection_range+0x2e0>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    12c7 <find_projection_range+0x1b7>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_projection_range>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x80,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
movsd  0x10(%rdi),%xmm0
add    $0x10,%rbx
xor    %r13d,%r13d
movapd 0xec3(%rip),%xmm4
movsd  0xedb(%rip),%xmm5
lea    0xedc(%rip),%r12
movapd 0xebc(%rip),%xmm6
jmp    119d <find_projection_range+0x8d>
cs nopw 0x0(%rax,%rax,1)
movapd %xmm0,%xmm2
xorpd  %xmm6,%xmm2
divsd  %xmm1,%xmm2
movupd (%r15),%xmm1
movupd -0x10(%rbx),%xmm3
subpd  %xmm1,%xmm3
unpcklpd %xmm2,%xmm2
mulpd  %xmm3,%xmm2
addpd  %xmm1,%xmm2
movapd %xmm2,(%rsp,%r13,1)
add    $0x18,%rbx
add    $0x10,%r13
cmp    $0x80,%r13
je     11e6 <find_projection_range+0xd6>
movsd  (%rbx),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm2
andpd  %xmm4,%xmm2
ucomisd %xmm2,%xmm5
jbe    1160 <find_projection_range+0x50>
mov    %r12,%rdi
call   1030 <HECMW_vis_print_exit@plt>
movapd 0xe4d(%rip),%xmm6
movsd  0xe55(%rip),%xmm5
movapd 0xe2d(%rip),%xmm4
movsd  0x10(%r15),%xmm0
movsd  (%rbx),%xmm1
subsd  %xmm0,%xmm1
jmp    1160 <find_projection_range+0x50>
movapd (%rsp),%xmm1
movlpd %xmm1,(%r14)
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
movhpd %xmm1,0x18(%r14)
movupd %xmm1,0x8(%r14)
movsd  0x10(%rsp),%xmm3
ucomisd %xmm3,%xmm1
movapd %xmm1,%xmm2
jbe    121d <find_projection_range+0x10d>
movsd  %xmm3,(%r14)
movapd %xmm3,%xmm2
ucomisd %xmm1,%xmm3
jbe    122d <find_projection_range+0x11d>
movsd  %xmm3,0x8(%r14)
movapd %xmm3,%xmm1
movsd  0x18(%rsp),%xmm4
ucomisd %xmm4,%xmm0
movapd %xmm0,%xmm3
jbe    1247 <find_projection_range+0x137>
movsd  %xmm4,0x10(%r14)
movapd %xmm4,%xmm3
ucomisd %xmm0,%xmm4
jbe    1257 <find_projection_range+0x147>
movsd  %xmm4,0x18(%r14)
movapd %xmm4,%xmm0
movsd  0x20(%rsp),%xmm4
ucomisd %xmm4,%xmm2
jbe    126c <find_projection_range+0x15c>
movsd  %xmm4,(%r14)
movapd %xmm4,%xmm2
ucomisd %xmm1,%xmm4
jbe    127c <find_projection_range+0x16c>
movsd  %xmm4,0x8(%r14)
movapd %xmm4,%xmm1
movsd  0x28(%rsp),%xmm4
ucomisd %xmm4,%xmm3
jbe    1292 <find_projection_range+0x182>
movsd  %xmm4,0x10(%r14)
movapd %xmm4,%xmm3
ucomisd %xmm0,%xmm4
jbe    12a2 <find_projection_range+0x192>
movsd  %xmm4,0x18(%r14)
movapd %xmm4,%xmm0
movsd  0x30(%rsp),%xmm4
ucomisd %xmm4,%xmm2
jbe    12b7 <find_projection_range+0x1a7>
movsd  %xmm4,(%r14)
movapd %xmm4,%xmm2
ucomisd %xmm1,%xmm4
jbe    12c7 <find_projection_range+0x1b7>
movsd  %xmm4,0x8(%r14)
movapd %xmm4,%xmm1
movsd  0x38(%rsp),%xmm4
ucomisd %xmm4,%xmm3
jbe    12dd <find_projection_range+0x1cd>
movsd  %xmm4,0x10(%r14)
movapd %xmm4,%xmm3
ucomisd %xmm0,%xmm4
jbe    12ed <find_projection_range+0x1dd>
movsd  %xmm4,0x18(%r14)
movapd %xmm4,%xmm0
movsd  0x40(%rsp),%xmm4
ucomisd %xmm4,%xmm2
jbe    1302 <find_projection_range+0x1f2>
movsd  %xmm4,(%r14)
movapd %xmm4,%xmm2
ucomisd %xmm1,%xmm4
jbe    1312 <find_projection_range+0x202>
movsd  %xmm4,0x8(%r14)
movapd %xmm4,%xmm1
movsd  0x48(%rsp),%xmm4
ucomisd %xmm4,%xmm3
jbe    1328 <find_projection_range+0x218>
movsd  %xmm4,0x10(%r14)
movapd %xmm4,%xmm3
ucomisd %xmm0,%xmm4
jbe    1338 <find_projection_range+0x228>
movsd  %xmm4,0x18(%r14)
movapd %xmm4,%xmm0
movsd  0x50(%rsp),%xmm4
ucomisd %xmm4,%xmm2
jbe    134d <find_projection_range+0x23d>
movsd  %xmm4,(%r14)
movapd %xmm4,%xmm2
ucomisd %xmm1,%xmm4
jbe    135d <find_projection_range+0x24d>
movsd  %xmm4,0x8(%r14)
movapd %xmm4,%xmm1
movsd  0x58(%rsp),%xmm4
ucomisd %xmm4,%xmm3
jbe    1373 <find_projection_range+0x263>
movsd  %xmm4,0x10(%r14)
movapd %xmm4,%xmm3
ucomisd %xmm0,%xmm4
jbe    1383 <find_projection_range+0x273>
movsd  %xmm4,0x18(%r14)
movapd %xmm4,%xmm0
movsd  0x60(%rsp),%xmm4
ucomisd %xmm4,%xmm2
jbe    1398 <find_projection_range+0x288>
movsd  %xmm4,(%r14)
movapd %xmm4,%xmm2
ucomisd %xmm1,%xmm4
jbe    13a8 <find_projection_range+0x298>
movsd  %xmm4,0x8(%r14)
movapd %xmm4,%xmm1
movsd  0x68(%rsp),%xmm4
ucomisd %xmm4,%xmm3
jbe    13be <find_projection_range+0x2ae>
movsd  %xmm4,0x10(%r14)
movapd %xmm4,%xmm3
ucomisd %xmm0,%xmm4
jbe    13ce <find_projection_range+0x2be>
movsd  %xmm4,0x18(%r14)
movapd %xmm4,%xmm0
movsd  0x70(%rsp),%xmm4
ucomisd %xmm4,%xmm2
jbe    13df <find_projection_range+0x2cf>
movsd  %xmm4,(%r14)
ucomisd %xmm1,%xmm4
jbe    13eb <find_projection_range+0x2db>
movsd  %xmm4,0x8(%r14)
movsd  0x78(%rsp),%xmm1
ucomisd %xmm1,%xmm3
jbe    13fd <find_projection_range+0x2ed>
movsd  %xmm1,0x10(%r14)
ucomisd %xmm0,%xmm1
jbe    1409 <find_projection_range+0x2f9>
movsd  %xmm1,0x18(%r14)
add    $0x80,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [63 x i8] c"ERROR: HEC-MW-VIS-E2002: The viewpoint position is not correct\00"
define void @find_projection_range(double* %0, double* %1, double* %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double*
%7 = alloca i32
%8 = alloca [8 x [2 x double]]
store double* %0, double** %4
store double* %1, double** %5
store double* %2, double** %6
store i32 0, i32* %7
br label %9
9: ; preds = %98, %3
%10 = load i32, i32* %7
%11 = icmp slt i32 %10, 8
br i1 %11, label %12, label %101
12: ; preds = %9
%13 = load double*, double** %5
%14 = load i32, i32* %7
%15 = mul nsw i32 %14, 3
%16 = add nsw i32 %15, 2
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds double, double* %13, i64 %17
%19 = load double, double* %18
%20 = load double*, double** %4
%21 = getelementptr inbounds double, double* %20, i64 2
%22 = load double, double* %21
%23 = fsub double %19, %22
%24 = call double @llvm.fabs.f64(double %23)
%25 = fcmp olt double %24, 1.000000e-08
br i1 %25, label %26, label %28
26: ; preds = %12
%27 = call i32 @HECMW_vis_print_exit(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0))
br label %28
28: ; preds = %26, %12
%29 = load double*, double** %4
%30 = getelementptr inbounds double, double* %29, i64 0
%31 = load double, double* %30
%32 = load double*, double** %4
%33 = getelementptr inbounds double, double* %32, i64 2
%34 = load double, double* %33
%35 = load double*, double** %5
%36 = load i32, i32* %7
%37 = mul nsw i32 %36, 3
%38 = add nsw i32 %37, 2
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds double, double* %35, i64 %39
%41 = load double, double* %40
%42 = load double*, double** %4
%43 = getelementptr inbounds double, double* %42, i64 2
%44 = load double, double* %43
%45 = fsub double %41, %44
%46 = fdiv double %34, %45
%47 = load double*, double** %5
%48 = load i32, i32* %7
%49 = mul nsw i32 %48, 3
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds double, double* %47, i64 %50
%52 = load double, double* %51
%53 = load double*, double** %4
%54 = getelementptr inbounds double, double* %53, i64 0
%55 = load double, double* %54
%56 = fsub double %52, %55
%57 = fneg double %46
%58 = call double @llvm.fmuladd.f64(double %57, double %56, double %31)
%59 = load i32, i32* %7
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [8 x [2 x double]], [8 x [2 x double]]* %8, i64 0, i64 %60
%62 = getelementptr inbounds [2 x double], [2 x double]* %61, i64 0, i64 0
store double %58, double* %62
%63 = load double*, double** %4
%64 = getelementptr inbounds double, double* %63, i64 1
%65 = load double, double* %64
%66 = load double*, double** %4
%67 = getelementptr inbounds double, double* %66, i64 2
%68 = load double, double* %67
%69 = load double*, double** %5
%70 = load i32, i32* %7
%71 = mul nsw i32 %70, 3
%72 = add nsw i32 %71, 2
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds double, double* %69, i64 %73
%75 = load double, double* %74
%76 = load double*, double** %4
%77 = getelementptr inbounds double, double* %76, i64 2
%78 = load double, double* %77
%79 = fsub double %75, %78
%80 = fdiv double %68, %79
%81 = load double*, double** %5
%82 = load i32, i32* %7
%83 = mul nsw i32 %82, 3
%84 = add nsw i32 %83, 1
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds double, double* %81, i64 %85
%87 = load double, double* %86
%88 = load double*, double** %4
%89 = getelementptr inbounds double, double* %88, i64 1
%90 = load double, double* %89
%91 = fsub double %87, %90
%92 = fneg double %80
%93 = call double @llvm.fmuladd.f64(double %92, double %91, double %65)
%94 = load i32, i32* %7
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds [8 x [2 x double]], [8 x [2 x double]]* %8, i64 0, i64 %95
%97 = getelementptr inbounds [2 x double], [2 x double]* %96, i64 0, i64 1
store double %93, double* %97
br label %98
98: ; preds = %28
%99 = load i32, i32* %7
%100 = add nsw i32 %99, 1
store i32 %100, i32* %7
br label %9
101: ; preds = %9
%102 = getelementptr inbounds [8 x [2 x double]], [8 x [2 x double]]* %8, i64 0, i64 0
%103 = getelementptr inbounds [2 x double], [2 x double]* %102, i64 0, i64 0
%104 = load double, double* %103
%105 = load double*, double** %6
%106 = getelementptr inbounds double, double* %105, i64 1
store double %104, double* %106
%107 = load double*, double** %6
%108 = getelementptr inbounds double, double* %107, i64 0
store double %104, double* %108
%109 = getelementptr inbounds [8 x [2 x double]], [8 x [2 x double]]* %8, i64 0, i64 0
%110 = getelementptr inbounds [2 x double], [2 x double]* %109, i64 0, i64 1
%111 = load double, double* %110
%112 = load double*, double** %6
%113 = getelementptr inbounds double, double* %112, i64 3
store double %111, double* %113
%114 = load double*, double** %6
%115 = getelementptr inbounds double, double* %114, i64 2
store double %111, double* %115
store i32 0, i32* %7
br label %116
116: ; preds = %192, %101
%117 = load i32, i32* %7
%118 = icmp slt i32 %117, 8
br i1 %118, label %119, label %195
119: ; preds = %116
%120 = load i32, i32* %7
%121 = sext i32 %120 to i64
%122 = getelementptr inbounds [8 x [2 x double]], [8 x [2 x double]]* %8, i64 0, i64 %121
%123 = getelementptr inbounds [2 x double], [2 x double]* %122, i64 0, i64 0
%124 = load double, double* %123
%125 = load double*, double** %6
%126 = getelementptr inbounds double, double* %125, i64 0
%127 = load double, double* %126
%128 = fcmp olt double %124, %127
br i1 %128, label %129, label %137
129: ; preds = %119
%130 = load i32, i32* %7
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds [8 x [2 x double]], [8 x [2 x double]]* %8, i64 0, i64 %131
%133 = getelementptr inbounds [2 x double], [2 x double]* %132, i64 0, i64 0
%134 = load double, double* %133
%135 = load double*, double** %6
%136 = getelementptr inbounds double, double* %135, i64 0
store double %134, double* %136
br label %137
137: ; preds = %129, %119
%138 = load i32, i32* %7
%139 = sext i32 %138 to i64
%140 = getelementptr inbounds [8 x [2 x double]], [8 x [2 x double]]* %8, i64 0, i64 %139
%141 = getelementptr inbounds [2 x double], [2 x double]* %140, i64 0, i64 0
%142 = load double, double* %141
%143 = load double*, double** %6
%144 = getelementptr inbounds double, double* %143, i64 1
%145 = load double, double* %144
%146 = fcmp ogt double %142, %145
br i1 %146, label %147, label %155
147: ; preds = %137
%148 = load i32, i32* %7
%149 = sext i32 %148 to i64
%150 = getelementptr inbounds [8 x [2 x double]], [8 x [2 x double]]* %8, i64 0, i64 %149
%151 = getelementptr inbounds [2 x double], [2 x double]* %150, i64 0, i64 0
%152 = load double, double* %151
%153 = load double*, double** %6
%154 = getelementptr inbounds double, double* %153, i64 1
store double %152, double* %154
br label %155
155: ; preds = %147, %137
%156 = load i32, i32* %7
%157 = sext i32 %156 to i64
%158 = getelementptr inbounds [8 x [2 x double]], [8 x [2 x double]]* %8, i64 0, i64 %157
%159 = getelementptr inbounds [2 x double], [2 x double]* %158, i64 0, i64 1
%160 = load double, double* %159
%161 = load double*, double** %6
%162 = getelementptr inbounds double, double* %161, i64 2
%163 = load double, double* %162
%164 = fcmp olt double %160, %163
br i1 %164, label %165, label %173
165: ; preds = %155
%166 = load i32, i32* %7
%167 = sext i32 %166 to i64
%168 = getelementptr inbounds [8 x [2 x double]], [8 x [2 x double]]* %8, i64 0, i64 %167
%169 = getelementptr inbounds [2 x double], [2 x double]* %168, i64 0, i64 1
%170 = load double, double* %169
%171 = load double*, double** %6
%172 = getelementptr inbounds double, double* %171, i64 2
store double %170, double* %172
br label %173
173: ; preds = %165, %155
%174 = load i32, i32* %7
%175 = sext i32 %174 to i64
%176 = getelementptr inbounds [8 x [2 x double]], [8 x [2 x double]]* %8, i64 0, i64 %175
%177 = getelementptr inbounds [2 x double], [2 x double]* %176, i64 0, i64 1
%178 = load double, double* %177
%179 = load double*, double** %6
%180 = getelementptr inbounds double, double* %179, i64 3
%181 = load double, double* %180
%182 = fcmp ogt double %178, %181
br i1 %182, label %183, label %191
183: ; preds = %173
%184 = load i32, i32* %7
%185 = sext i32 %184 to i64
%186 = getelementptr inbounds [8 x [2 x double]], [8 x [2 x double]]* %8, i64 0, i64 %185
%187 = getelementptr inbounds [2 x double], [2 x double]* %186, i64 0, i64 1
%188 = load double, double* %187
%189 = load double*, double** %6
%190 = getelementptr inbounds double, double* %189, i64 3
store double %188, double* %190
br label %191
191: ; preds = %183, %173
br label %192
192: ; preds = %191
%193 = load i32, i32* %7
%194 = add nsw i32 %193, 1
store i32 %194, i32* %7
br label %116
195: ; preds = %116
ret void
}

LLVM IR (-O2):
@.str = [63 x i8] c"ERROR: HEC-MW-VIS-E2002: The viewpoint position is not correct\00"
define void @find_projection_range(double* nocapture %0, double* nocapture %1, double* nocapture %2) {
%4 = alloca [8 x [2 x double]]
%5 = bitcast [8 x [2 x double]]* %4 to i8*
%6 = getelementptr inbounds double, double* %0, i64 2
%7 = load double, double* %6
%8 = bitcast double* %0 to <2 x double>*
br label %9
9: ; preds = %3, %24
%10 = phi double [ %7, %3 ], [ %26, %24 ]
%11 = phi i64 [ 0, %3 ], [ %39, %24 ]
%12 = mul nuw nsw i64 %11, 3
%13 = add nuw nsw i64 %12, 2
%14 = getelementptr inbounds double, double* %1, i64 %13
%15 = load double, double* %14
%16 = fsub double %15, %10
%17 = tail call double @llvm.fabs.f64(double %16)
%18 = fcmp olt double %17, 1.000000e-08
br i1 %18, label %19, label %24
19: ; preds = %9
%20 = tail call i32 @HECMW_vis_print_exit(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0))
%21 = load double, double* %6
%22 = load double, double* %14
%23 = fsub double %22, %21
br label %24
24: ; preds = %19, %9
%25 = phi double [ %23, %19 ], [ %16, %9 ]
%26 = phi double [ %21, %19 ], [ %10, %9 ]
%27 = getelementptr inbounds double, double* %1, i64 %12
%28 = fneg double %26
%29 = fdiv double %28, %25
%30 = getelementptr inbounds [8 x [2 x double]], [8 x [2 x double]]* %4, i64 0, i64 %11, i64 0
%31 = load <2 x double>, <2 x double>* %8
%32 = bitcast double* %27 to <2 x double>*
%33 = load <2 x double>, <2 x double>* %32
%34 = fsub <2 x double> %33, %31
%35 = insertelement <2 x double> poison, double %29, i64 0
%36 = shufflevector <2 x double> %35, <2 x double> poison, <2 x i32> zeroinitializer
%37 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %36, <2 x double> %34, <2 x double> %31)
%38 = bitcast double* %30 to <2 x double>*
store <2 x double> %37, <2 x double>* %38
%39 = add nuw nsw i64 %11, 1
%40 = icmp eq i64 %39, 8
br i1 %40, label %41, label %9
41: ; preds = %24
%42 = getelementptr inbounds double, double* %2, i64 1
%43 = bitcast [8 x [2 x double]]* %4 to <2 x double>*
%44 = load <2 x double>, <2 x double>* %43
%45 = extractelement <2 x double> %44, i64 0
store double %45, double* %2
%46 = getelementptr inbounds double, double* %2, i64 3
%47 = extractelement <2 x double> %44, i64 1
store double %47, double* %46
%48 = getelementptr inbounds double, double* %2, i64 2
%49 = bitcast double* %42 to <2 x double>*
store <2 x double> %44, <2 x double>* %49
%50 = getelementptr inbounds [8 x [2 x double]], [8 x [2 x double]]* %4, i64 0, i64 1, i64 0
%51 = load double, double* %50
%52 = fcmp olt double %51, %45
br i1 %52, label %53, label %54
53: ; preds = %41
store double %51, double* %2
br label %54
54: ; preds = %53, %41
%55 = phi double [ %51, %53 ], [ %45, %41 ]
%56 = fcmp ogt double %51, %45
br i1 %56, label %57, label %58
57: ; preds = %54
store double %51, double* %42
br label %58
58: ; preds = %57, %54
%59 = phi double [ %51, %57 ], [ %45, %54 ]
%60 = getelementptr inbounds [8 x [2 x double]], [8 x [2 x double]]* %4, i64 0, i64 1, i64 1
%61 = load double, double* %60
%62 = fcmp olt double %61, %47
br i1 %62, label %63, label %64
63: ; preds = %58
store double %61, double* %48
br label %64
64: ; preds = %63, %58
%65 = phi double [ %61, %63 ], [ %47, %58 ]
%66 = fcmp ogt double %61, %47
br i1 %66, label %67, label %68
67: ; preds = %64
store double %61, double* %46
br label %68
68: ; preds = %67, %64
%69 = phi double [ %47, %64 ], [ %61, %67 ]
%70 = getelementptr inbounds [8 x [2 x double]], [8 x [2 x double]]* %4, i64 0, i64 2, i64 0
%71 = load double, double* %70
%72 = fcmp olt double %71, %55
br i1 %72, label %73, label %74
73: ; preds = %68
store double %71, double* %2
br label %74
74: ; preds = %73, %68
%75 = phi double [ %71, %73 ], [ %55, %68 ]
%76 = fcmp ogt double %71, %59
br i1 %76, label %77, label %78
77: ; preds = %74
store double %71, double* %42
br label %78
78: ; preds = %77, %74
%79 = phi double [ %71, %77 ], [ %59, %74 ]
%80 = getelementptr inbounds [8 x [2 x double]], [8 x [2 x double]]* %4, i64 0, i64 2, i64 1
%81 = load double, double* %80
%82 = fcmp olt double %81, %65
br i1 %82, label %83, label %84
83: ; preds = %78
store double %81, double* %48
br label %84
84: ; preds = %83, %78
%85 = phi double [ %81, %83 ], [ %65, %78 ]
%86 = fcmp ogt double %81, %69
br i1 %86, label %87, label %88
87: ; preds = %84
store double %81, double* %46
br label %88
88: ; preds = %87, %84
%89 = phi double [ %69, %84 ], [ %81, %87 ]
%90 = getelementptr inbounds [8 x [2 x double]], [8 x [2 x double]]* %4, i64 0, i64 3, i64 0
%91 = load double, double* %90
%92 = fcmp olt double %91, %75
br i1 %92, label %93, label %94
93: ; preds = %88
store double %91, double* %2
br label %94
94: ; preds = %93, %88
%95 = phi double [ %91, %93 ], [ %75, %88 ]
%96 = fcmp ogt double %91, %79
br i1 %96, label %97, label %98
97: ; preds = %94
store double %91, double* %42
br label %98
98: ; preds = %97, %94
%99 = phi double [ %91, %97 ], [ %79, %94 ]
%100 = getelementptr inbounds [8 x [2 x double]], [8 x [2 x double]]* %4, i64 0, i64 3, i64 1
%101 = load double, double* %100
%102 = fcmp olt double %101, %85
br i1 %102, label %103, label %104
103: ; preds = %98
store double %101, double* %48
br label %104
104: ; preds = %103, %98
%105 = phi double [ %101, %103 ], [ %85, %98 ]
%106 = fcmp ogt double %101, %89
br i1 %106, label %107, label %108
107: ; preds = %104
store double %101, double* %46
br label %108
108: ; preds = %107, %104
%109 = phi double [ %89, %104 ], [ %101, %107 ]
%110 = getelementptr inbounds [8 x [2 x double]], [8 x [2 x double]]* %4, i64 0, i64 4, i64 0
%111 = load double, double* %110
%112 = fcmp olt double %111, %95
br i1 %112, label %113, label %114
113: ; preds = %108
store double %111, double* %2
br label %114
114: ; preds = %113, %108
%115 = phi double [ %111, %113 ], [ %95, %108 ]
%116 = fcmp ogt double %111, %99
br i1 %116, label %117, label %118
117: ; preds = %114
store double %111, double* %42
br label %118
118: ; preds = %117, %114
%119 = phi double [ %111, %117 ], [ %99, %114 ]
%120 = getelementptr inbounds [8 x [2 x double]], [8 x [2 x double]]* %4, i64 0, i64 4, i64 1
%121 = load double, double* %120
%122 = fcmp olt double %121, %105
br i1 %122, label %123, label %124
123: ; preds = %118
store double %121, double* %48
br label %124
124: ; preds = %123, %118
%125 = phi double [ %121, %123 ], [ %105, %118 ]
%126 = fcmp ogt double %121, %109
br i1 %126, label %127, label %128
127: ; preds = %124
store double %121, double* %46
br label %128
128: ; preds = %127, %124
%129 = phi double [ %109, %124 ], [ %121, %127 ]
%130 = getelementptr inbounds [8 x [2 x double]], [8 x [2 x double]]* %4, i64 0, i64 5, i64 0
%131 = load double, double* %130
%132 = fcmp olt double %131, %115
br i1 %132, label %133, label %134
133: ; preds = %128
store double %131, double* %2
br label %134
134: ; preds = %133, %128
%135 = phi double [ %131, %133 ], [ %115, %128 ]
%136 = fcmp ogt double %131, %119
br i1 %136, label %137, label %138
137: ; preds = %134
store double %131, double* %42
br label %138
138: ; preds = %137, %134
%139 = phi double [ %131, %137 ], [ %119, %134 ]
%140 = getelementptr inbounds [8 x [2 x double]], [8 x [2 x double]]* %4, i64 0, i64 5, i64 1
%141 = load double, double* %140
%142 = fcmp olt double %141, %125
br i1 %142, label %143, label %144
143: ; preds = %138
store double %141, double* %48
br label %144
144: ; preds = %143, %138
%145 = phi double [ %141, %143 ], [ %125, %138 ]
%146 = fcmp ogt double %141, %129
br i1 %146, label %147, label %148
147: ; preds = %144
store double %141, double* %46
br label %148
148: ; preds = %147, %144
%149 = phi double [ %129, %144 ], [ %141, %147 ]
%150 = getelementptr inbounds [8 x [2 x double]], [8 x [2 x double]]* %4, i64 0, i64 6, i64 0
%151 = load double, double* %150
%152 = fcmp olt double %151, %135
br i1 %152, label %153, label %154
153: ; preds = %148
store double %151, double* %2
br label %154
154: ; preds = %153, %148
%155 = phi double [ %151, %153 ], [ %135, %148 ]
%156 = fcmp ogt double %151, %139
br i1 %156, label %157, label %158
157: ; preds = %154
store double %151, double* %42
br label %158
158: ; preds = %157, %154
%159 = phi double [ %151, %157 ], [ %139, %154 ]
%160 = getelementptr inbounds [8 x [2 x double]], [8 x [2 x double]]* %4, i64 0, i64 6, i64 1
%161 = load double, double* %160
%162 = fcmp olt double %161, %145
br i1 %162, label %163, label %164
163: ; preds = %158
store double %161, double* %48
br label %164
164: ; preds = %163, %158
%165 = phi double [ %161, %163 ], [ %145, %158 ]
%166 = fcmp ogt double %161, %149
br i1 %166, label %167, label %168
167: ; preds = %164
store double %161, double* %46
br label %168
168: ; preds = %167, %164
%169 = phi double [ %149, %164 ], [ %161, %167 ]
%170 = getelementptr inbounds [8 x [2 x double]], [8 x [2 x double]]* %4, i64 0, i64 7, i64 0
%171 = load double, double* %170
%172 = fcmp olt double %171, %155
br i1 %172, label %173, label %174
173: ; preds = %168
store double %171, double* %2
br label %174
174: ; preds = %173, %168
%175 = fcmp ogt double %171, %159
br i1 %175, label %176, label %177
176: ; preds = %174
store double %171, double* %42
br label %177
177: ; preds = %176, %174
%178 = getelementptr inbounds [8 x [2 x double]], [8 x [2 x double]]* %4, i64 0, i64 7, i64 1
%179 = load double, double* %178
%180 = fcmp olt double %179, %165
br i1 %180, label %181, label %182
181: ; preds = %177
store double %179, double* %48
br label %182
182: ; preds = %181, %177
%183 = fcmp ogt double %179, %169
br i1 %183, label %184, label %185
184: ; preds = %182
store double %179, double* %46
br label %185
185: ; preds = %184, %182
ret void
}