#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*/ boundaryvalues_free_slip(int, int, int, double ***,
                                            double ***, double ***, int ***);
int /*<<< orphan*/ boundaryvalues_inflow(int, int, int, double ***, double ***,
                                         double ***, int ***, double);
int /*<<< orphan*/ boundaryvalues_moving_wall(int, int, int, double ***,
                                              double ***, double ***, int ***,
                                              double *);
int /*<<< orphan*/ boundaryvalues_no_slip(int, int, int, double ***, double ***,
                                          double ***, int ***);
int /*<<< orphan*/ boundaryvalues_outflow(int, int, int, double ***, double ***,
                                          double ***, int ***);
int getcelltype(int);
void boundaryvalues(int imax, int jmax, int kmax, double ***U, double ***V,
                    double ***W, double ***P, double ***F, double ***G,
                    double ***H, char *problem, int ***Flag, double velIN,
                    double *velMW) {
  int i, j, k;
#pragma omp parallel for private(j, k)
  for (i = 0; i < imax + 2; i++) {
    for (j = 0; j < jmax + 2; j++) {
      for (k = 0; k < kmax + 2; k++) {
        switch (getcelltype(Flag[i][j][k])) {
        case 2:
          boundaryvalues_no_slip(i, j, k, U, V, W, Flag);
          break;
        case 3:
          boundaryvalues_free_slip(i, j, k, U, V, W, Flag);
          break;
        case 5:
          boundaryvalues_no_slip(i, j, k, U, V, W, Flag);
          boundaryvalues_inflow(i, j, k, U, V, W, Flag, velIN);
          break;
        case 4:
          boundaryvalues_outflow(i, j, k, U, V, W, Flag);
          break;
        case 6:
          boundaryvalues_moving_wall(i, j, k, U, V, W, Flag, velMW);
          break;
        default:
          break;
        }
      }
    }
  }
}


x86 assembly (clang, -O0):
<boundaryvalues>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    0x40(%rbp),%rax
mov    0x38(%rbp),%rax
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
movsd  %xmm0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    -0x4(%rbp),%ecx
add    $0x2,%ecx
cmp    %ecx,%eax
jge    135d <boundaryvalues+0x1fd>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x2,%ecx
cmp    %ecx,%eax
jge    134a <boundaryvalues+0x1ea>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    -0xc(%rbp),%ecx
add    $0x2,%ecx
cmp    %ecx,%eax
jge    1337 <boundaryvalues+0x1d7>
mov    0x38(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1080 <getcelltype@plt>
add    $0xfffffffe,%eax
mov    %eax,%ecx
mov    %rcx,-0x48(%rbp)
sub    $0x4,%eax
ja     131f <boundaryvalues+0x1bf>
mov    -0x48(%rbp),%rax
lea    0xddd(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x34(%rbp),%edi
mov    -0x38(%rbp),%esi
mov    -0x3c(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x28(%rbp),%r9
mov    0x38(%rbp),%rax
mov    %rax,(%rsp)
call   1030 <boundaryvalues_no_slip@plt>
jmp    1324 <boundaryvalues+0x1c4>
mov    -0x34(%rbp),%edi
mov    -0x38(%rbp),%esi
mov    -0x3c(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x28(%rbp),%r9
mov    0x38(%rbp),%rax
mov    %rax,(%rsp)
call   1060 <boundaryvalues_free_slip@plt>
jmp    1324 <boundaryvalues+0x1c4>
mov    -0x34(%rbp),%edi
mov    -0x38(%rbp),%esi
mov    -0x3c(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x28(%rbp),%r9
mov    0x38(%rbp),%rax
mov    %rax,(%rsp)
call   1030 <boundaryvalues_no_slip@plt>
mov    -0x34(%rbp),%edi
mov    -0x38(%rbp),%esi
mov    -0x3c(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x28(%rbp),%r9
mov    0x38(%rbp),%rax
movsd  -0x30(%rbp),%xmm0
mov    %rax,(%rsp)
call   1070 <boundaryvalues_inflow@plt>
jmp    1324 <boundaryvalues+0x1c4>
mov    -0x34(%rbp),%edi
mov    -0x38(%rbp),%esi
mov    -0x3c(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x28(%rbp),%r9
mov    0x38(%rbp),%rax
mov    %rax,(%rsp)
call   1040 <boundaryvalues_outflow@plt>
jmp    1324 <boundaryvalues+0x1c4>
mov    -0x34(%rbp),%edi
mov    -0x38(%rbp),%esi
mov    -0x3c(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x28(%rbp),%r9
mov    0x38(%rbp),%r10
mov    0x40(%rbp),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1050 <boundaryvalues_moving_wall@plt>
jmp    1324 <boundaryvalues+0x1c4>
jmp    1324 <boundaryvalues+0x1c4>
jmp    1329 <boundaryvalues+0x1c9>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11d5 <boundaryvalues+0x75>
jmp    133c <boundaryvalues+0x1dc>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11bd <boundaryvalues+0x5d>
jmp    134f <boundaryvalues+0x1ef>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11a5 <boundaryvalues+0x45>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<boundaryvalues>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
movsd  %xmm0,0x50(%rsp)
mov    %r9,0x20(%rsp)
mov    %r8,0x18(%rsp)
mov    %rdx,0x38(%rsp)
mov    %rsi,0x30(%rsp)
mov    %rdi,0x28(%rsp)
cmp    $0xffffffff,%edi
jl     1364 <boundaryvalues+0x204>
mov    %rcx,%r15
mov    0xb8(%rsp),%rbx
mov    0x38(%rsp),%rax
lea    0x2(%rax),%r14d
mov    0x30(%rsp),%rax
add    $0x2,%eax
mov    %rax,0x40(%rsp)
mov    0x28(%rsp),%rax
add    $0x2,%eax
mov    %rax,0x28(%rsp)
xor    %eax,%eax
mov    %rax,0x10(%rsp)
lea    0xe2e(%rip),%r13
mov    %r14,0x48(%rsp)
jmp    11fc <boundaryvalues+0x9c>
nopl   0x0(%rax)
mov    0x10(%rsp),%rcx
add    $0x1,%rcx
mov    %rcx,%rax
mov    %rcx,0x10(%rsp)
cmp    0x28(%rsp),%rcx
je     1364 <boundaryvalues+0x204>
cmpl   $0xffffffff,0x30(%rsp)
jl     11e0 <boundaryvalues+0x80>
xor    %ebp,%ebp
jmp    121b <boundaryvalues+0xbb>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbp
cmp    0x40(%rsp),%rbp
je     11e0 <boundaryvalues+0x80>
cmpl   $0xffffffff,0x38(%rsp)
jl     1210 <boundaryvalues+0xb0>
xor    %r12d,%r12d
jmp    1269 <boundaryvalues+0x109>
mov    0xc0(%rsp),%rax
mov    %rax,0x8(%rsp)
mov    %rbx,(%rsp)
mov    0x10(%rsp),%rdi
mov    %ebp,%esi
mov    %r12d,%edx
mov    %r15,%rcx
mov    0x18(%rsp),%r8
mov    0x20(%rsp),%r9
call   1050 <boundaryvalues_moving_wall@plt>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%r12
cmp    %r12,%r14
je     1210 <boundaryvalues+0xb0>
mov    0x10(%rsp),%rax
mov    (%rbx,%rax,8),%rax
mov    (%rax,%rbp,8),%rax
mov    (%rax,%r12,4),%edi
call   1080 <getcelltype@plt>
add    $0xfffffffe,%eax
cmp    $0x4,%eax
ja     1260 <boundaryvalues+0x100>
movslq 0x0(%r13,%rax,4),%rax
add    %r13,%rax
jmp    *%rax
mov    %rbx,(%rsp)
mov    0x10(%rsp),%rdi
mov    %ebp,%esi
mov    %r12d,%edx
mov    %r15,%rcx
mov    0x18(%rsp),%r8
mov    0x20(%rsp),%r9
call   1030 <boundaryvalues_no_slip@plt>
jmp    1260 <boundaryvalues+0x100>
mov    %rbx,(%rsp)
mov    0x10(%rsp),%rdi
mov    %ebp,%esi
mov    %r12d,%edx
mov    %r15,%rcx
mov    0x18(%rsp),%r8
mov    0x20(%rsp),%r9
call   1060 <boundaryvalues_free_slip@plt>
jmp    1260 <boundaryvalues+0x100>
mov    %rbx,(%rsp)
mov    0x10(%rsp),%rdi
mov    %ebp,%esi
mov    %r12d,%edx
mov    %r15,%rcx
mov    0x18(%rsp),%r8
mov    0x20(%rsp),%r9
call   1040 <boundaryvalues_outflow@plt>
jmp    1260 <boundaryvalues+0x100>
mov    %rbx,(%rsp)
mov    0x10(%rsp),%r13
mov    %r13d,%edi
mov    %ebp,%esi
mov    %r12d,%edx
mov    %r15,%rcx
mov    0x18(%rsp),%r8
mov    %r8,%r14
mov    0x20(%rsp),%rbx
mov    %rbx,%r9
call   1030 <boundaryvalues_no_slip@plt>
mov    0xb8(%rsp),%rax
mov    %rax,(%rsp)
mov    %r13d,%edi
lea    0xcc7(%rip),%r13
mov    %ebp,%esi
mov    %r12d,%edx
mov    %r15,%rcx
mov    %r14,%r8
mov    %rbx,%r9
mov    0xb8(%rsp),%rbx
mov    0x48(%rsp),%r14
movsd  0x50(%rsp),%xmm0
call   1070 <boundaryvalues_inflow@plt>
jmp    1260 <boundaryvalues+0x100>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @boundaryvalues(i32 %0, i32 %1, i32 %2, double*** %3, double*** %4, double*** %5, double*** %6, double*** %7, double*** %8, double*** %9, i8* %10, i32*** %11, double %12, double* %13) {
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca double***
%19 = alloca double***
%20 = alloca double***
%21 = alloca double***
%22 = alloca double***
%23 = alloca double***
%24 = alloca double***
%25 = alloca i8*
%26 = alloca i32***
%27 = alloca double
%28 = alloca double*
%29 = alloca i32
%30 = alloca i32
%31 = alloca i32
store i32 %0, i32* %15
store i32 %1, i32* %16
store i32 %2, i32* %17
store double*** %3, double**** %18
store double*** %4, double**** %19
store double*** %5, double**** %20
store double*** %6, double**** %21
store double*** %7, double**** %22
store double*** %8, double**** %23
store double*** %9, double**** %24
store i8* %10, i8** %25
store i32*** %11, i32**** %26
store double %12, double* %27
store double* %13, double** %28
store i32 0, i32* %29
br label %32
32: ; preds = %129, %14
%33 = load i32, i32* %29
%34 = load i32, i32* %15
%35 = add nsw i32 %34, 2
%36 = icmp slt i32 %33, %35
br i1 %36, label %37, label %132
37: ; preds = %32
store i32 0, i32* %30
br label %38
38: ; preds = %125, %37
%39 = load i32, i32* %30
%40 = load i32, i32* %16
%41 = add nsw i32 %40, 2
%42 = icmp slt i32 %39, %41
br i1 %42, label %43, label %128
43: ; preds = %38
store i32 0, i32* %31
br label %44
44: ; preds = %121, %43
%45 = load i32, i32* %31
%46 = load i32, i32* %17
%47 = add nsw i32 %46, 2
%48 = icmp slt i32 %45, %47
br i1 %48, label %49, label %124
49: ; preds = %44
%50 = load i32***, i32**** %26
%51 = load i32, i32* %29
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds i32**, i32*** %50, i64 %52
%54 = load i32**, i32*** %53
%55 = load i32, i32* %30
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds i32*, i32** %54, i64 %56
%58 = load i32*, i32** %57
%59 = load i32, i32* %31
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i32, i32* %58, i64 %60
%62 = load i32, i32* %61
%63 = call i32 @getcelltype(i32 %62)
switch i32 %63, label %119 [
i32 2, label %64
i32 3, label %73
i32 5, label %82
i32 4, label %100
i32 6, label %109
]
64: ; preds = %49
%65 = load i32, i32* %29
%66 = load i32, i32* %30
%67 = load i32, i32* %31
%68 = load double***, double**** %18
%69 = load double***, double**** %19
%70 = load double***, double**** %20
%71 = load i32***, i32**** %26
%72 = call i32 @boundaryvalues_no_slip(i32 %65, i32 %66, i32 %67, double*** %68, double*** %69, double*** %70, i32*** %71)
br label %120
73: ; preds = %49
%74 = load i32, i32* %29
%75 = load i32, i32* %30
%76 = load i32, i32* %31
%77 = load double***, double**** %18
%78 = load double***, double**** %19
%79 = load double***, double**** %20
%80 = load i32***, i32**** %26
%81 = call i32 @boundaryvalues_free_slip(i32 %74, i32 %75, i32 %76, double*** %77, double*** %78, double*** %79, i32*** %80)
br label %120
82: ; preds = %49
%83 = load i32, i32* %29
%84 = load i32, i32* %30
%85 = load i32, i32* %31
%86 = load double***, double**** %18
%87 = load double***, double**** %19
%88 = load double***, double**** %20
%89 = load i32***, i32**** %26
%90 = call i32 @boundaryvalues_no_slip(i32 %83, i32 %84, i32 %85, double*** %86, double*** %87, double*** %88, i32*** %89)
%91 = load i32, i32* %29
%92 = load i32, i32* %30
%93 = load i32, i32* %31
%94 = load double***, double**** %18
%95 = load double***, double**** %19
%96 = load double***, double**** %20
%97 = load i32***, i32**** %26
%98 = load double, double* %27
%99 = call i32 @boundaryvalues_inflow(i32 %91, i32 %92, i32 %93, double*** %94, double*** %95, double*** %96, i32*** %97, double %98)
br label %120
100: ; preds = %49
%101 = load i32, i32* %29
%102 = load i32, i32* %30
%103 = load i32, i32* %31
%104 = load double***, double**** %18
%105 = load double***, double**** %19
%106 = load double***, double**** %20
%107 = load i32***, i32**** %26
%108 = call i32 @boundaryvalues_outflow(i32 %101, i32 %102, i32 %103, double*** %104, double*** %105, double*** %106, i32*** %107)
br label %120
109: ; preds = %49
%110 = load i32, i32* %29
%111 = load i32, i32* %30
%112 = load i32, i32* %31
%113 = load double***, double**** %18
%114 = load double***, double**** %19
%115 = load double***, double**** %20
%116 = load i32***, i32**** %26
%117 = load double*, double** %28
%118 = call i32 @boundaryvalues_moving_wall(i32 %110, i32 %111, i32 %112, double*** %113, double*** %114, double*** %115, i32*** %116, double* %117)
br label %120
119: ; preds = %49
br label %120
120: ; preds = %119, %109, %100, %82, %73, %64
br label %121
121: ; preds = %120
%122 = load i32, i32* %31
%123 = add nsw i32 %122, 1
store i32 %123, i32* %31
br label %44
124: ; preds = %44
br label %125
125: ; preds = %124
%126 = load i32, i32* %30
%127 = add nsw i32 %126, 1
store i32 %127, i32* %30
br label %38
128: ; preds = %38
br label %129
129: ; preds = %128
%130 = load i32, i32* %29
%131 = add nsw i32 %130, 1
store i32 %131, i32* %29
br label %32
132: ; preds = %32
ret void
}

LLVM IR (-O2):
define void @boundaryvalues(i32 %0, i32 %1, i32 %2, double*** %3, double*** %4, double*** %5, double*** nocapture readnone %6, double*** nocapture readnone %7, double*** nocapture readnone %8, double*** nocapture readnone %9, i8* nocapture readnone %10, i32*** %11, double %12, double* %13) {
%15 = icmp sgt i32 %0, -2
br i1 %15, label %16, label %75
16: ; preds = %14
%17 = icmp sgt i32 %1, -2
%18 = icmp sgt i32 %2, -2
%19 = add i32 %2, 2
%20 = add i32 %1, 2
%21 = add i32 %0, 2
%22 = zext i32 %21 to i64
%23 = zext i32 %20 to i64
%24 = zext i32 %19 to i64
br label %25
25: ; preds = %16, %72
%26 = phi i64 [ 0, %16 ], [ %73, %72 ]
br i1 %17, label %27, label %72
27: ; preds = %25
%28 = getelementptr inbounds i32**, i32*** %11, i64 %26
%29 = trunc i64 %26 to i32
%30 = trunc i64 %26 to i32
%31 = trunc i64 %26 to i32
%32 = trunc i64 %26 to i32
%33 = trunc i64 %26 to i32
br label %34
34: ; preds = %27, %69
%35 = phi i64 [ 0, %27 ], [ %70, %69 ]
br i1 %18, label %36, label %69
36: ; preds = %34
%37 = trunc i64 %35 to i32
%38 = trunc i64 %35 to i32
%39 = trunc i64 %35 to i32
%40 = trunc i64 %35 to i32
%41 = trunc i64 %35 to i32
br label %42
42: ; preds = %36, %66
%43 = phi i64 [ 0, %36 ], [ %67, %66 ]
%44 = load i32**, i32*** %28
%45 = getelementptr inbounds i32*, i32** %44, i64 %35
%46 = load i32*, i32** %45
%47 = getelementptr inbounds i32, i32* %46, i64 %43
%48 = load i32, i32* %47
%49 = tail call i32 @getcelltype(i32 %48)
switch i32 %49, label %66 [
i32 2, label %50
i32 3, label %53
i32 5, label %56
i32 4, label %60
i32 6, label %63
]
50: ; preds = %42
%51 = trunc i64 %43 to i32
%52 = tail call i32 @boundaryvalues_no_slip(i32 %33, i32 %41, i32 %51, double*** %3, double*** %4, double*** %5, i32*** %11)
br label %66
53: ; preds = %42
%54 = trunc i64 %43 to i32
%55 = tail call i32 @boundaryvalues_free_slip(i32 %32, i32 %40, i32 %54, double*** %3, double*** %4, double*** %5, i32*** %11)
br label %66
56: ; preds = %42
%57 = trunc i64 %43 to i32
%58 = tail call i32 @boundaryvalues_no_slip(i32 %31, i32 %39, i32 %57, double*** %3, double*** %4, double*** %5, i32*** %11)
%59 = tail call i32 @boundaryvalues_inflow(i32 %31, i32 %39, i32 %57, double*** %3, double*** %4, double*** %5, i32*** %11, double %12)
br label %66
60: ; preds = %42
%61 = trunc i64 %43 to i32
%62 = tail call i32 @boundaryvalues_outflow(i32 %30, i32 %38, i32 %61, double*** %3, double*** %4, double*** %5, i32*** %11)
br label %66
63: ; preds = %42
%64 = trunc i64 %43 to i32
%65 = tail call i32 @boundaryvalues_moving_wall(i32 %29, i32 %37, i32 %64, double*** %3, double*** %4, double*** %5, i32*** %11, double* %13)
br label %66
66: ; preds = %50, %53, %56, %60, %63, %42
%67 = add nuw nsw i64 %43, 1
%68 = icmp eq i64 %67, %24
br i1 %68, label %69, label %42
69: ; preds = %66, %34
%70 = add nuw nsw i64 %35, 1
%71 = icmp eq i64 %70, %23
br i1 %71, label %72, label %34
72: ; preds = %69, %25
%73 = add nuw nsw i64 %26, 1
%74 = icmp eq i64 %73, %22
br i1 %74, label %75, label %25
75: ; preds = %72, %14
ret void
}