#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*/ boundaryCell(double *, int *, double const *const, int, int,
                                int, int);
void treatBoundary(double *collideField, int *flagField,
                   const double *const wallVelocity, int xlength) {
  int x, y, z;
  int n = xlength + 2;
  z = 0;
  for (y = 0; y < n; ++y) {
    for (x = 0; x < n; ++x) {
      boundaryCell(collideField, flagField, wallVelocity, xlength, x, y, z);
    }
  }
  for (z = 1; z <= xlength; ++z) {
    y = 0;
    for (x = 0; x < n; ++x) {
      boundaryCell(collideField, flagField, wallVelocity, xlength, x, y, z);
    }
    for (y = 1; y <= xlength; ++y) {
      x = 0;
      boundaryCell(collideField, flagField, wallVelocity, xlength, x, y, z);
      x = xlength + 1;
      boundaryCell(collideField, flagField, wallVelocity, xlength, x, y, z);
    }
    y = xlength + 1;
    for (x = 0; x < n; ++x) {
      boundaryCell(collideField, flagField, wallVelocity, xlength, x, y, z);
    }
  }
  z = xlength + 1;
  for (y = 0; y < n; ++y) {
    for (x = 0; x < n; ++x) {
      boundaryCell(collideField, flagField, wallVelocity, xlength, x, y, z);
    }
  }
}


x86 assembly (clang, -O0):
<treatBoundary>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x2c(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    11a0 <treatBoundary+0x90>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    118d <treatBoundary+0x7d>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    -0x24(%rbp),%r9d
mov    -0x28(%rbp),%eax
mov    %eax,(%rsp)
call   1030 <boundaryCell@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1151 <treatBoundary+0x41>
jmp    1192 <treatBoundary+0x82>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    113e <treatBoundary+0x2e>
movl   $0x1,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jg     12d1 <treatBoundary+0x1c1>
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    11fd <treatBoundary+0xed>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    -0x24(%rbp),%r9d
mov    -0x28(%rbp),%eax
mov    %eax,(%rsp)
call   1030 <boundaryCell@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11c1 <treatBoundary+0xb1>
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jg     1272 <treatBoundary+0x162>
movl   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    -0x24(%rbp),%r9d
mov    -0x28(%rbp),%eax
mov    %eax,(%rsp)
call   1030 <boundaryCell@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    -0x24(%rbp),%r9d
mov    -0x28(%rbp),%eax
mov    %eax,(%rsp)
call   1030 <boundaryCell@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1204 <treatBoundary+0xf4>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    12be <treatBoundary+0x1ae>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    -0x24(%rbp),%r9d
mov    -0x28(%rbp),%eax
mov    %eax,(%rsp)
call   1030 <boundaryCell@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1282 <treatBoundary+0x172>
jmp    12c3 <treatBoundary+0x1b3>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11a7 <treatBoundary+0x97>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    1343 <treatBoundary+0x233>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    1330 <treatBoundary+0x220>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    -0x24(%rbp),%r9d
mov    -0x28(%rbp),%eax
mov    %eax,(%rsp)
call   1030 <boundaryCell@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    12f4 <treatBoundary+0x1e4>
jmp    1335 <treatBoundary+0x225>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    12e1 <treatBoundary+0x1d1>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<treatBoundary>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rdx,0x18(%rsp)
mov    %rsi,%r14
mov    %rdi,%r13
lea    0x2(%rcx),%esi
mov    %rcx,0x8(%rsp)
cmp    $0xffffffff,%ecx
jl     12bd <treatBoundary+0x1ad>
cmp    $0x2,%esi
mov    $0x1,%ebp
mov    %esi,0x20(%rsp)
cmovge %esi,%ebp
xor    %r15d,%r15d
nopl   0x0(%rax)
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movl   $0x0,(%rsp)
mov    %r13,%rdi
mov    %r14,%rsi
mov    0x18(%rsp),%rdx
mov    0x8(%rsp),%rcx
mov    %ebx,%r8d
mov    %r15d,%r9d
call   1030 <boundaryCell@plt>
add    $0x1,%ebx
cmp    %ebx,%ebp
jne    1160 <treatBoundary+0x50>
add    $0x1,%r15d
cmp    %ebp,%r15d
jne    1150 <treatBoundary+0x40>
cmpl   $0x0,0x8(%rsp)
mov    0x20(%rsp),%esi
jle    12bd <treatBoundary+0x1ad>
mov    0x8(%rsp),%rcx
lea    0x1(%rcx),%eax
mov    %eax,0x14(%rsp)
cmp    $0x2,%esi
mov    $0x1,%r15d
mov    $0x1,%eax
cmovge %esi,%eax
neg    %ecx
mov    %rcx,0x28(%rsp)
mov    %eax,0x24(%rsp)
mov    0x18(%rsp),%r12
xchg   %ax,%ax
xor    %ebp,%ebp
mov    %eax,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r15d,(%rsp)
mov    %r13,%rdi
mov    %r14,%rsi
mov    0x18(%rsp),%rdx
mov    0x8(%rsp),%rcx
mov    %ebp,%r8d
xor    %r9d,%r9d
call   1030 <boundaryCell@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    11e0 <treatBoundary+0xd0>
mov    $0x1,%ebp
nopl   0x0(%rax,%rax,1)
mov    %r15d,(%rsp)
mov    %r13,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
mov    0x8(%rsp),%rbx
mov    %ebx,%ecx
xor    %r8d,%r8d
mov    %ebp,%r9d
call   1030 <boundaryCell@plt>
mov    %r15d,(%rsp)
mov    %r13,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
mov    %ebx,%ecx
mov    0x14(%rsp),%r8d
mov    %ebp,%r9d
call   1030 <boundaryCell@plt>
mov    0x28(%rsp),%rax
add    %ebp,%eax
add    $0x1,%eax
mov    %ebp,%ecx
add    $0x1,%ecx
mov    %ecx,%ebp
cmp    $0x1,%eax
jne    1210 <treatBoundary+0x100>
xor    %ebp,%ebp
mov    0x24(%rsp),%ebx
nopw   0x0(%rax,%rax,1)
mov    %r15d,(%rsp)
mov    %r13,%rdi
mov    %r14,%rsi
mov    0x18(%rsp),%rdx
mov    0x8(%rsp),%rcx
mov    %ebp,%r8d
mov    0x14(%rsp),%r9d
call   1030 <boundaryCell@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    1270 <treatBoundary+0x160>
lea    0x1(%r15),%eax
cmp    0x8(%rsp),%r15d
mov    %eax,%r15d
mov    %ebx,%eax
jne    11d0 <treatBoundary+0xc0>
mov    0x20(%rsp),%esi
mov    0x14(%rsp),%eax
cmpl   $0xffffffff,0x8(%rsp)
jge    12cc <treatBoundary+0x1bc>
jmp    132f <treatBoundary+0x21f>
mov    0x8(%rsp),%rax
add    $0x1,%eax
cmpl   $0xffffffff,0x8(%rsp)
jl     132f <treatBoundary+0x21f>
cmp    $0x2,%esi
mov    $0x1,%r12d
cmovge %esi,%r12d
xor    %ebp,%ebp
mov    %r13,0x30(%rsp)
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %eax,(%rsp)
mov    %r13,%rdi
mov    %r14,%rsi
mov    0x18(%rsp),%rdx
mov    0x8(%rsp),%rcx
mov    %r14,%r13
mov    %eax,%r14d
mov    %ebx,%r8d
mov    %ebp,%r9d
call   1030 <boundaryCell@plt>
mov    %r14d,%eax
mov    %r13,%r14
mov    0x30(%rsp),%r13
add    $0x1,%ebx
cmp    %ebx,%r12d
jne    12f0 <treatBoundary+0x1e0>
add    $0x1,%ebp
cmp    %r12d,%ebp
jne    12e0 <treatBoundary+0x1d0>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @treatBoundary(double* %0, i32* %1, double* %2, i32 %3) {
%5 = add i32 %3, 2
%6 = icmp sgt i32 %3, -2
br i1 %6, label %7, label %13
7: ; preds = %4
%8 = call i32 @llvm.smax.i32(i32 %5, i32 1)
br label %9
9: ; preds = %23, %7
%10 = phi i32 [ 0, %7 ], [ %24, %23 ]
br label %18
11: ; preds = %23
%12 = icmp slt i32 %3, 1
br i1 %12, label %13, label %15
13: ; preds = %4, %11
%14 = add nsw i32 %3, 1
br label %47
15: ; preds = %11
%16 = add nuw i32 %3, 1
%17 = call i32 @llvm.smax.i32(i32 %5, i32 1)
br label %26
18: ; preds = %9, %18
%19 = phi i32 [ %21, %18 ], [ 0, %9 ]
%20 = tail call i32 @boundaryCell(double* %0, i32* %1, double* %2, i32 %3, i32 %19, i32 %10, i32 0)
%21 = add nuw nsw i32 %19, 1
%22 = icmp eq i32 %21, %8
br i1 %22, label %23, label %18
23: ; preds = %18
%24 = add nuw nsw i32 %10, 1
%25 = icmp eq i32 %24, %8
br i1 %25, label %11, label %9
26: ; preds = %44, %15
%27 = phi i32 [ 1, %15 ], [ %45, %44 ]
br label %28
28: ; preds = %26, %28
%29 = phi i32 [ %31, %28 ], [ 0, %26 ]
%30 = tail call i32 @boundaryCell(double* %0, i32* %1, double* %2, i32 %3, i32 %29, i32 0, i32 %27)
%31 = add nuw nsw i32 %29, 1
%32 = icmp eq i32 %31, %17
br i1 %32, label %33, label %28
33: ; preds = %28, %33
%34 = phi i32 [ %37, %33 ], [ 1, %28 ]
%35 = tail call i32 @boundaryCell(double* %0, i32* %1, double* %2, i32 %3, i32 0, i32 %34, i32 %27)
%36 = tail call i32 @boundaryCell(double* %0, i32* %1, double* %2, i32 %3, i32 %16, i32 %34, i32 %27)
%37 = add nuw i32 %34, 1
%38 = icmp eq i32 %34, %3
br i1 %38, label %39, label %33
39: ; preds = %33, %39
%40 = phi i32 [ %42, %39 ], [ 0, %33 ]
%41 = tail call i32 @boundaryCell(double* %0, i32* %1, double* %2, i32 %3, i32 %40, i32 %16, i32 %27)
%42 = add nuw nsw i32 %40, 1
%43 = icmp eq i32 %42, %17
br i1 %43, label %44, label %39
44: ; preds = %39
%45 = add nuw i32 %27, 1
%46 = icmp eq i32 %27, %3
br i1 %46, label %47, label %26
47: ; preds = %44, %13
%48 = phi i32 [ %14, %13 ], [ %16, %44 ]
br i1 %6, label %49, label %61
49: ; preds = %47
%50 = call i32 @llvm.smax.i32(i32 %5, i32 1)
br label %51
51: ; preds = %58, %49
%52 = phi i32 [ 0, %49 ], [ %59, %58 ]
br label %53
53: ; preds = %51, %53
%54 = phi i32 [ %56, %53 ], [ 0, %51 ]
%55 = tail call i32 @boundaryCell(double* %0, i32* %1, double* %2, i32 %3, i32 %54, i32 %52, i32 %48)
%56 = add nuw nsw i32 %54, 1
%57 = icmp eq i32 %56, %50
br i1 %57, label %58, label %53
58: ; preds = %53
%59 = add nuw nsw i32 %52, 1
%60 = icmp eq i32 %59, %50
br i1 %60, label %61, label %51
61: ; preds = %58, %47
ret void
}