#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 getboundarytype(int);
int /*<<< orphan*/ printf(char *);
void boundaryvalues_inflow(int i, int j, int k, double ***U, double ***V,
                           double ***W, int ***Flag, double velIN) {
  switch (getboundarytype(Flag[i][j][k])) {
  case 32:
    U[i][j][k] = velIN;
    break;
  case 16:
    U[i - 1][j][k] = -velIN;
    break;
  case 8:
    V[i][j][k] = velIN;
    break;
  case 4:
    V[i][j - 1][k] = -velIN;
    break;
  case 1:
    W[i][j][k] = velIN;
    break;
  case 2:
    W[i][j][k - 1] = -velIN;
    break;
  case 0:
    break;
  default:
    printf("Trying to set inflow at edge or corner cells. Not allowed!\n");
    break;
  }
}


x86 assembly (clang, -O0):
<boundaryvalues_inflow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
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)
mov    0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1040 <getboundarytype@plt>
mov    %eax,%ecx
mov    %rcx,-0x38(%rbp)
sub    $0x20,%eax
ja     12cc <boundaryvalues_inflow+0x1ac>
mov    -0x38(%rbp),%rax
lea    0xe80(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movsd  -0x30(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xc(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    12d8 <boundaryvalues_inflow+0x1b8>
movsd  -0x30(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x18(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xc(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    12d8 <boundaryvalues_inflow+0x1b8>
movsd  -0x30(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xc(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    12d8 <boundaryvalues_inflow+0x1b8>
movsd  -0x30(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x20(%rbp),%rax
movslq -0x4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xc(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    12d8 <boundaryvalues_inflow+0x1b8>
movsd  -0x30(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xc(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    12d8 <boundaryvalues_inflow+0x1b8>
movsd  -0x30(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x28(%rbp),%rax
movslq -0x4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    12d8 <boundaryvalues_inflow+0x1b8>
jmp    12d8 <boundaryvalues_inflow+0x1b8>
lea    0xdb1(%rip),%rdi
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<boundaryvalues_inflow>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
movaps %xmm0,(%rsp)
mov    %r9,%r14
mov    %r8,%r15
mov    %rcx,%r12
mov    0x50(%rsp),%rax
movslq %edi,%rbp
mov    (%rax,%rbp,8),%rax
movslq %esi,%rbx
mov    (%rax,%rbx,8),%rax
movslq %edx,%r13
mov    (%rax,%r13,4),%edi
call   1040 <getboundarytype@plt>
cmp    $0x20,%eax
ja     1192 <boundaryvalues_inflow+0x72>
mov    %eax,%eax
lea    0xea8(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    (%r14,%rbp,8),%rax
jmp    11e7 <boundaryvalues_inflow+0xc7>
movaps (%rsp),%xmm0
xorps  0xe7e(%rip),%xmm0
mov    (%r14,%rbp,8),%rax
mov    (%rax,%rbx,8),%rax
movlps %xmm0,-0x8(%rax,%r13,8)
jmp    11f5 <boundaryvalues_inflow+0xd5>
lea    0xefb(%rip),%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <puts@plt>
movaps (%rsp),%xmm0
xorps  0xe49(%rip),%xmm0
mov    (%r15,%rbp,8),%rax
mov    -0x8(%rax,%rbx,8),%rax
jmp    11d6 <boundaryvalues_inflow+0xb6>
movaps (%rsp),%xmm0
xorps  0xe33(%rip),%xmm0
mov    -0x8(%r12,%rbp,8),%rax
mov    (%rax,%rbx,8),%rax
movlps %xmm0,(%rax,%r13,8)
jmp    11f5 <boundaryvalues_inflow+0xd5>
mov    (%r12,%rbp,8),%rax
jmp    11e7 <boundaryvalues_inflow+0xc7>
mov    (%r15,%rbp,8),%rax
mov    (%rax,%rbx,8),%rax
movaps (%rsp),%xmm0
movsd  %xmm0,(%rax,%r13,8)
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [60 x i8] c"Trying to set inflow at edge or corner cells. Not allowed!\0A\00"
define void @boundaryvalues_inflow(i32 %0, i32 %1, i32 %2, double*** %3, double*** %4, double*** %5, i32*** %6, double %7) {
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca double***
%13 = alloca double***
%14 = alloca double***
%15 = alloca i32***
%16 = alloca double
store i32 %0, i32* %9
store i32 %1, i32* %10
store i32 %2, i32* %11
store double*** %3, double**** %12
store double*** %4, double**** %13
store double*** %5, double**** %14
store i32*** %6, i32**** %15
store double %7, double* %16
%17 = load i32***, i32**** %15
%18 = load i32, i32* %9
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i32**, i32*** %17, i64 %19
%21 = load i32**, i32*** %20
%22 = load i32, i32* %10
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i32*, i32** %21, i64 %23
%25 = load i32*, i32** %24
%26 = load i32, i32* %11
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i32, i32* %25, i64 %27
%29 = load i32, i32* %28
%30 = call i32 @getboundarytype(i32 %29)
switch i32 %30, label %122 [
i32 32, label %31
i32 16, label %45
i32 8, label %61
i32 4, label %75
i32 1, label %91
i32 2, label %105
i32 0, label %121
]
31: ; preds = %8
%32 = load double, double* %16
%33 = load double***, double**** %12
%34 = load i32, i32* %9
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds double**, double*** %33, i64 %35
%37 = load double**, double*** %36
%38 = load i32, i32* %10
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds double*, double** %37, i64 %39
%41 = load double*, double** %40
%42 = load i32, i32* %11
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds double, double* %41, i64 %43
store double %32, double* %44
br label %124
45: ; preds = %8
%46 = load double, double* %16
%47 = fneg double %46
%48 = load double***, double**** %12
%49 = load i32, i32* %9
%50 = sub nsw i32 %49, 1
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds double**, double*** %48, i64 %51
%53 = load double**, double*** %52
%54 = load i32, i32* %10
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds double*, double** %53, i64 %55
%57 = load double*, double** %56
%58 = load i32, i32* %11
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds double, double* %57, i64 %59
store double %47, double* %60
br label %124
61: ; preds = %8
%62 = load double, double* %16
%63 = load double***, double**** %13
%64 = load i32, i32* %9
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds double**, double*** %63, i64 %65
%67 = load double**, double*** %66
%68 = load i32, i32* %10
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds double*, double** %67, i64 %69
%71 = load double*, double** %70
%72 = load i32, i32* %11
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds double, double* %71, i64 %73
store double %62, double* %74
br label %124
75: ; preds = %8
%76 = load double, double* %16
%77 = fneg double %76
%78 = load double***, double**** %13
%79 = load i32, i32* %9
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds double**, double*** %78, i64 %80
%82 = load double**, double*** %81
%83 = load i32, i32* %10
%84 = sub nsw i32 %83, 1
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds double*, double** %82, i64 %85
%87 = load double*, double** %86
%88 = load i32, i32* %11
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds double, double* %87, i64 %89
store double %77, double* %90
br label %124
91: ; preds = %8
%92 = load double, double* %16
%93 = load double***, double**** %14
%94 = load i32, i32* %9
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds double**, double*** %93, i64 %95
%97 = load double**, double*** %96
%98 = load i32, i32* %10
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds double*, double** %97, i64 %99
%101 = load double*, double** %100
%102 = load i32, i32* %11
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds double, double* %101, i64 %103
store double %92, double* %104
br label %124
105: ; preds = %8
%106 = load double, double* %16
%107 = fneg double %106
%108 = load double***, double**** %14
%109 = load i32, i32* %9
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds double**, double*** %108, i64 %110
%112 = load double**, double*** %111
%113 = load i32, i32* %10
%114 = sext i32 %113 to i64
%115 = getelementptr inbounds double*, double** %112, i64 %114
%116 = load double*, double** %115
%117 = load i32, i32* %11
%118 = sub nsw i32 %117, 1
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds double, double* %116, i64 %119
store double %107, double* %120
br label %124
121: ; preds = %8
br label %124
122: ; preds = %8
%123 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
br label %124
124: ; preds = %122, %121, %105, %91, %75, %61, %45, %31
ret void
}

LLVM IR (-O2):
@str = [59 x i8] c"Trying to set inflow at edge or corner cells. Not allowed!\00"
define void @boundaryvalues_inflow(i32 %0, i32 %1, i32 %2, double*** nocapture %3, double*** nocapture %4, double*** nocapture %5, i32*** nocapture %6, double %7) {
%9 = sext i32 %0 to i64
%10 = getelementptr inbounds i32**, i32*** %6, i64 %9
%11 = load i32**, i32*** %10
%12 = sext i32 %1 to i64
%13 = getelementptr inbounds i32*, i32** %11, i64 %12
%14 = load i32*, i32** %13
%15 = sext i32 %2 to i64
%16 = getelementptr inbounds i32, i32* %14, i64 %15
%17 = load i32, i32* %16
%18 = tail call i32 @getboundarytype(i32 %17)
switch i32 %18, label %64 [
i32 32, label %19
i32 16, label %25
i32 8, label %34
i32 4, label %40
i32 1, label %49
i32 2, label %55
i32 0, label %66
]
19: ; preds = %8
%20 = getelementptr inbounds double**, double*** %3, i64 %9
%21 = load double**, double*** %20
%22 = getelementptr inbounds double*, double** %21, i64 %12
%23 = load double*, double** %22
%24 = getelementptr inbounds double, double* %23, i64 %15
store double %7, double* %24
br label %66
25: ; preds = %8
%26 = fneg double %7
%27 = add nsw i32 %0, -1
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds double**, double*** %3, i64 %28
%30 = load double**, double*** %29
%31 = getelementptr inbounds double*, double** %30, i64 %12
%32 = load double*, double** %31
%33 = getelementptr inbounds double, double* %32, i64 %15
store double %26, double* %33
br label %66
34: ; preds = %8
%35 = getelementptr inbounds double**, double*** %4, i64 %9
%36 = load double**, double*** %35
%37 = getelementptr inbounds double*, double** %36, i64 %12
%38 = load double*, double** %37
%39 = getelementptr inbounds double, double* %38, i64 %15
store double %7, double* %39
br label %66
40: ; preds = %8
%41 = fneg double %7
%42 = getelementptr inbounds double**, double*** %4, i64 %9
%43 = load double**, double*** %42
%44 = add nsw i32 %1, -1
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds double*, double** %43, i64 %45
%47 = load double*, double** %46
%48 = getelementptr inbounds double, double* %47, i64 %15
store double %41, double* %48
br label %66
49: ; preds = %8
%50 = getelementptr inbounds double**, double*** %5, i64 %9
%51 = load double**, double*** %50
%52 = getelementptr inbounds double*, double** %51, i64 %12
%53 = load double*, double** %52
%54 = getelementptr inbounds double, double* %53, i64 %15
store double %7, double* %54
br label %66
55: ; preds = %8
%56 = fneg double %7
%57 = getelementptr inbounds double**, double*** %5, i64 %9
%58 = load double**, double*** %57
%59 = getelementptr inbounds double*, double** %58, i64 %12
%60 = load double*, double** %59
%61 = add nsw i32 %2, -1
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds double, double* %60, i64 %62
store double %56, double* %63
br label %66
64: ; preds = %8
%65 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str, i64 0, i64 0))
br label %66
66: ; preds = %64, %8, %55, %49, %40, %34, %25, %19
ret void
}