user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<init_flag>:
  endbr64
  push   %r15
  mov    %ecx,%r15d
  push   %r14
  mov    %esi,%r14d
  push   %r13
  push   %r12
  push   %rbp
  mov    %edx,%ebp
  push   %rbx
  mov    %r8,%rbx
  sub    $0x48,%rsp
  mov    %edx,0x28(%rsp)
  mov    %ecx,0x4(%rsp)
  mov    %r9d,0x2c(%rsp)
  call   <read_pgm@plt>
  mov    %rax,0x20(%rsp)
  lea    0x1(%rbp),%eax
  mov    %eax,0x3c(%rsp)
  lea    0x1(%r15),%eax
  mov    %eax,0x38(%rsp)
  test   %r15d,%r15d
  jle    L408
  mov    0x28(%rsp),%ecx
  test   %ecx,%ecx
  jle    L297
  test   %r14d,%r14d
  jle    L297
  movslq 0x3c(%rsp),%rax
  mov    $0x1,%r13d
  movq   $0x4,0x18(%rsp)
  mov    %r13d,0x10(%rsp)
  mov    %rbx,%r13
  mov    %r14d,%ebx
  mov    %ecx,%r14d
  lea    -0x8(,%rax,8),%rax
  mov    %rax,0x30(%rsp)
L239:
  mov    0x30(%rsp),%rax
  mov    $0x1,%r15d
  mov    %rax,0x8(%rsp)
  mov    %r13,%rax
  mov    %r14d,%r13d
  mov    %rax,%r14
  nopl   0x0(%rax)
L357:
  mov    %r14,%rax
  mov    $0x1,%ebp
  mov    %ebx,%r14d
  mov    %r13d,%ebx
  mov    %rax,%r13
  nopl   0x0(%rax)
L373:
  mov    0x8(%rsp),%rdx
  mov    0x0(%r13,%rbp,8),%rax
  sub    $0x8,%rsp
  mov    %ebp,%esi
  mov    0x20(%rsp),%r12
  mov    %ebx,%r9d
  mov    %r14d,%r8d
  add    $0x1,%rbp
  add    (%rax,%rdx,1),%r12
  mov    0xc(%rsp),%eax
  mov    %r15d,%edx
  push   %rax
  mov    0x20(%rsp),%ecx
  mov    0x30(%rsp),%rdi
  call   <createflag@plt>
  mov    %eax,(%r12)
  pop    %r9
  pop    %r10
  cmp    %ebp,%r14d
  jge    L373
  mov    %r13,%rax
  add    $0x1,%r15d
  mov    %ebx,%r13d
  subq   $0x8,0x8(%rsp)
  mov    %r14d,%ebx
  mov    %rax,%r14
  cmp    %r15d,%r13d
  jge    L357
  addl   $0x1,0x10(%rsp)
  mov    %r13d,%r14d
  mov    %rax,%r13
  mov    0x10(%rsp),%eax
  addq   $0x4,0x18(%rsp)
  cmp    %eax,0x4(%rsp)
  jge    L239
  mov    %ebx,%r14d
  mov    %r13,%rbx
L297:
  movslq 0x28(%rsp),%rax
  mov    %r14d,0x18(%rsp)
  xor    %edx,%edx
  mov    0x90(%rsp),%r15d
  lea    0x8(,%rax,8),%r13
  movslq %r14d,%rax
  mov    0x88(%rsp),%r14d
  mov    %r13,0x8(%rsp)
  lea    0x8(%rbx,%rax,8),%r12
  mov    %rbx,%r13
  mov    %rdx,%rbx
  nopl   (%rax)
L254:
  mov    0x0(%r13),%rax
  lea    0x0(,%rbx,4),%rbp
  mov    %r14d,%edi
  add    $0x1,%rbx
  mov    (%rax),%rsi
  add    %rbp,%rsi
  mov    %rsi,0x10(%rsp)
  call   <getwallbit@plt>
  mov    0x10(%rsp),%rsi
  mov    0x8(%rsp),%rcx
  mov    %r15d,%edi
  mov    %eax,(%rsi)
  mov    0x0(%r13),%rax
  mov    (%rax,%rcx,1),%rsi
  add    %rbp,%rsi
  mov    %rsi,0x10(%rsp)
  call   <getwallbit@plt>
  mov    0x10(%rsp),%rsi
  mov    %r14d,%edi
  mov    %eax,(%rsi)
  mov    (%r12),%rax
  mov    (%rax),%rsi
  add    %rbp,%rsi
  mov    %rsi,0x10(%rsp)
  call   <getwallbit@plt>
  mov    0x10(%rsp),%rsi
  mov    0x8(%rsp),%rcx
  mov    %r15d,%edi
  mov    %eax,(%rsi)
  mov    (%r12),%rax
  add    (%rax,%rcx,1),%rbp
  call   <getwallbit@plt>
  mov    %eax,0x0(%rbp)
  cmp    %ebx,0x38(%rsp)
  jge    L254
  mov    0x18(%rsp),%r14d
  mov    %r13,%rbx
L364:
  mov    0x3c(%rsp),%edi
  test   %edi,%edi
  js     L333
  movslq 0x38(%rsp),%rax
  mov    %r14d,0x10(%rsp)
  xor    %ebp,%ebp
  mov    0xa0(%rsp),%r15d
  lea    0x0(,%rax,4),%r13
  movslq %r14d,%rax
  mov    0x98(%rsp),%r14d
  lea    0x8(%rbx,%rax,8),%r12
  cs nopw 0x0(%rax,%rax,1)
L386:
  mov    (%rbx),%rax
  mov    %r15d,%edi
  mov    (%rax,%rbp,8),%rcx
  mov    %rcx,0x8(%rsp)
  call   <getwallbit@plt>
  mov    0x8(%rsp),%rcx
  mov    %r14d,%edi
  mov    %eax,(%rcx)
  mov    (%rbx),%rax
  mov    (%rax,%rbp,8),%rcx
  add    %r13,%rcx
  mov    %rcx,0x8(%rsp)
  call   <getwallbit@plt>
  mov    0x8(%rsp),%rcx
  mov    %r15d,%edi
  mov    %eax,(%rcx)
  mov    (%r12),%rax
  mov    (%rax,%rbp,8),%rcx
  mov    %rcx,0x8(%rsp)
  call   <getwallbit@plt>
  mov    0x8(%rsp),%rcx
  mov    %r14d,%edi
  mov    %eax,(%rcx)
  mov    (%r12),%rax
  mov    (%rax,%rbp,8),%rcx
  add    $0x1,%rbp
  add    %r13,%rcx
  mov    %rcx,0x8(%rsp)
  call   <getwallbit@plt>
  mov    0x8(%rsp),%rcx
  mov    %eax,(%rcx)
  lea    -0x1(%rbp),%eax
  cmp    0x28(%rsp),%eax
  jle    L386
  mov    0x10(%rsp),%r14d
L333:
  cmp    $0xffffffff,%r14d
  jl     L133
  movslq 0x28(%rsp),%rax
  movslq 0x38(%rsp),%rbp
  mov    %r14d,0x10(%rsp)
  mov    %rbx,%r14
  mov    0x88(%rsp),%r15d
  mov    0x90(%rsp),%ebx
  xor    %r13d,%r13d
  lea    0x8(,%rax,8),%r12
  shl    $0x2,%rbp
  nopl   0x0(%rax)
L292:
  mov    (%r14,%r13,8),%rax
  mov    %r15d,%edi
  mov    (%rax),%rcx
  mov    %rcx,0x8(%rsp)
  call   <getwallbit@plt>
  mov    0x8(%rsp),%rcx
  mov    %ebx,%edi
  mov    %eax,(%rcx)
  mov    (%r14,%r13,8),%rax
  mov    (%rax,%r12,1),%rcx
  mov    %rcx,0x8(%rsp)
  call   <getwallbit@plt>
  mov    0x8(%rsp),%rcx
  mov    %r15d,%edi
  mov    %eax,(%rcx)
  mov    (%r14,%r13,8),%rax
  mov    (%rax),%rcx
  add    %rbp,%rcx
  mov    %rcx,0x8(%rsp)
  call   <getwallbit@plt>
  mov    0x8(%rsp),%rcx
  mov    %ebx,%edi
  mov    %eax,(%rcx)
  mov    (%r14,%r13,8),%rax
  add    $0x1,%r13
  mov    (%rax,%r12,1),%rcx
  add    %rbp,%rcx
  mov    %rcx,0x8(%rsp)
  call   <getwallbit@plt>
  mov    0x8(%rsp),%rcx
  mov    %eax,(%rcx)
  lea    -0x1(%r13),%eax
  cmp    0x10(%rsp),%eax
  jle    L292
  mov    %r14,%rbx
  mov    0x10(%rsp),%r14d
L133:
  test   %r14d,%r14d
  jle    L11
  movslq 0x4(%rsp),%rax
  mov    0x28(%rsp),%esi
  lea    0x0(,%rax,4),%r13
  lea    0x4(%r13),%r12
  test   %esi,%esi
  jle    L231
  movl   $0x1,0x8(%rsp)
  lea    0x8(%rbx),%r15
  mov    %rbx,0x18(%rsp)
  mov    %r14d,0x10(%rsp)
  mov    %r15,%r14
  nop
L5:
  xor    %ebx,%ebx
  mov    %r14,%r15
  jmp    L273
  nopw   0x0(%rax,%rax,1)
L366:
  xor    %edi,%edi
  call   <getwallbit@plt>
  mov    $0xc,%esi
  mov    $0x2,%edi
  mov    %eax,%ebp
  mov    (%r15),%rax
  mov    (%rax,%rbx,8),%rax
  mov    0x4(%rax),%r14d
  call   <pow2@plt>
  mov    %eax,%r8d
  mov    (%r15),%rax
  mov    (%rax,%rbx,8),%rcx
  mov    %r8d,%eax
  shl    $0x4,%eax
  sub    %r8d,%eax
  and    %r14d,%eax
  add    %ebp,%eax
  mov    %eax,(%rcx)
L116:
  mov    $0xc,%esi
  mov    $0x2,%edi
  call   <pow2@plt>
  mov    $0xd,%esi
  mov    $0x2,%edi
  mov    %eax,%ebp
  call   <pow2@plt>
  mov    %eax,%r8d
  mov    (%r15),%rax
  xor    %r8d,%ebp
  mov    (%rax,%rbx,8),%rax
  and    (%rax,%r13,1),%ebp
  jne    L190
  xor    %edi,%edi
  call   <getwallbit@plt>
  mov    $0xc,%esi
  mov    $0x2,%edi
  mov    %eax,%ebp
  mov    (%r15),%rax
  mov    (%rax,%rbx,8),%rax
  mov    (%rax,%r13,1),%r14d
  call   <pow2@plt>
  mov    %eax,%r8d
  mov    (%r15),%rax
  mov    (%rax,%rbx,8),%rcx
  mov    %r8d,%eax
  shl    $0x4,%eax
  sub    %r8d,%eax
  and    %r14d,%eax
  add    %ebp,%eax
  mov    %eax,(%rcx,%r12,1)
  lea    0x1(%rbx),%eax
  cmp    %eax,0x28(%rsp)
  jl     L313
L273:
  mov    $0xc,%esi
  mov    $0x2,%edi
  add    $0x1,%rbx
  call   <pow2@plt>
  mov    $0xd,%esi
  mov    $0x2,%edi
  mov    %eax,%ebp
  call   <pow2@plt>
  mov    %eax,%r8d
  mov    (%r15),%rax
  xor    %r8d,%ebp
  mov    (%rax,%rbx,8),%rax
  and    0x4(%rax),%ebp
  je     L366
  mov    0xa0(%rsp),%edi
  call   <getwallbit@plt>
  mov    %eax,%r8d
  mov    (%r15),%rax
  mov    (%rax,%rbx,8),%rcx
  mov    0x4(%rcx),%eax
  and    $0x3,%eax
  lea    -0x3(%rax,%r8,1),%eax
  mov    %eax,(%rcx)
  jmp    L116
  nopw   0x0(%rax,%rax,1)
L190:
  mov    0x98(%rsp),%edi
  call   <getwallbit@plt>
  mov    %eax,%r8d
  mov    (%r15),%rax
  mov    (%rax,%rbx,8),%rcx
  mov    (%rcx,%r13,1),%eax
  and    $0xc,%eax
  lea    -0xc(%rax,%r8,1),%eax
  mov    %eax,(%rcx,%r12,1)
  lea    0x1(%rbx),%eax
  cmp    %eax,0x28(%rsp)
  jge    L273
L313:
  mov    %r15,%r14
  addl   $0x1,0x8(%rsp)
  mov    0x8(%rsp),%eax
  add    $0x8,%r14
  cmp    %eax,0x10(%rsp)
  jge    L5
  movslq 0x10(%rsp),%rax
  mov    0x18(%rsp),%rbx
  mov    %rax,%r14
L309:
  shl    $0x3,%rax
  lea    (%rbx,%rax,1),%rcx
  lea    0x8(%rbx,%rax,1),%rax
  mov    %rax,0x8(%rsp)
  mov    0x4(%rsp),%eax
  test   %eax,%eax
  jle    L8
  mov    %r14d,0x18(%rsp)
  xor    %edx,%edx
  mov    %rcx,%r14
  nopw   0x0(%rax,%rax,1)
L305:
  lea    0x1(%rdx),%rax
  xor    %r15d,%r15d
  mov    %rax,0x10(%rsp)
  lea    0x0(,%rax,8),%r12
  jmp    L156
  nopl   0x0(%rax)
L202:
  xor    %edi,%edi
  call   <getwallbit@plt>
  mov    $0xc,%esi
  mov    $0x2,%edi
  mov    %eax,%r13d
  mov    0x8(%rbx),%rax
  mov    (%rax,%r12,1),%rax
  mov    (%rax,%rbp,4),%r15d
  call   <pow2@plt>
  mov    %eax,%r8d
  mov    (%rbx),%rax
  mov    (%rax,%r12,1),%rdx
  mov    %r8d,%eax
  shl    $0x4,%eax
  sub    %r8d,%eax
  and    %r15d,%eax
  add    %r13d,%eax
  mov    %eax,(%rdx,%rbp,4)
L76:
  mov    $0xc,%esi
  mov    $0x2,%edi
  call   <pow2@plt>
  mov    $0xd,%esi
  mov    $0x2,%edi
  mov    %eax,%r13d
  call   <pow2@plt>
  mov    %eax,%r8d
  mov    (%r14),%rax
  xor    %r8d,%r13d
  mov    (%rax,%r12,1),%rax
  and    (%rax,%rbp,4),%r13d
  jne    L158
  xor    %edi,%edi
  call   <getwallbit@plt>
  mov    $0xc,%esi
  mov    $0x2,%edi
  mov    %eax,%r13d
  mov    (%r14),%rax
  mov    (%rax,%r12,1),%rax
  mov    (%rax,%rbp,4),%r15d
  call   <pow2@plt>
  mov    %eax,%r8d
  mov    0x8(%rsp),%rax
  mov    (%rax),%rax
  mov    (%rax,%r12,1),%rdx
  mov    %r8d,%eax
  shl    $0x4,%eax
  sub    %r8d,%eax
  and    %r15d,%eax
  mov    %rbp,%r15
  add    %r13d,%eax
  mov    %eax,(%rdx,%rbp,4)
  lea    0x1(%rbp),%eax
  cmp    %eax,0x4(%rsp)
  jl     L196
L156:
  mov    $0xc,%esi
  mov    $0x2,%edi
  lea    0x1(%r15),%rbp
  call   <pow2@plt>
  mov    $0xd,%esi
  mov    $0x2,%edi
  mov    %eax,%r13d
  call   <pow2@plt>
  mov    %eax,%r8d
  mov    0x8(%rbx),%rax
  xor    %r8d,%r13d
  mov    (%rax,%r12,1),%rax
  and    0x4(%rax,%r15,4),%r13d
  je     L202
  mov    0x2c(%rsp),%edi
  call   <getwallbit@plt>
  mov    $0xa,%esi
  mov    $0x2,%edi
  mov    %eax,%r13d
  call   <pow2@plt>
  mov    $0xa,%esi
  mov    $0x2,%edi
  lea    0x0(,%rax,4),%edx
  sub    %edx,%eax
  add    %eax,%r13d
  mov    0x8(%rbx),%rax
  mov    (%rax,%r12,1),%rax
  mov    (%rax,%rbp,4),%r15d
  call   <pow2@plt>
  mov    (%rbx),%rdx
  lea    (%rax,%rax,2),%eax
  mov    (%rdx,%r12,1),%rdx
  and    %r15d,%eax
  add    %r13d,%eax
  mov    %eax,(%rdx,%rbp,4)
  jmp    L76
  cs nopw 0x0(%rax,%rax,1)
L158:
  mov    0x80(%rsp),%edi
  call   <getwallbit@plt>
  mov    $0x8,%esi
  mov    $0x2,%edi
  mov    %eax,%r13d
  call   <pow2@plt>
  mov    $0x8,%esi
  mov    $0x2,%edi
  lea    0x0(,%rax,4),%edx
  sub    %edx,%eax
  add    %eax,%r13d
  mov    (%r14),%rax
  mov    (%rax,%r12,1),%rax
  mov    (%rax,%rbp,4),%r15d
  call   <pow2@plt>
  mov    0x8(%rsp),%rcx
  lea    (%rax,%rax,2),%eax
  mov    (%rcx),%rdx
  and    %r15d,%eax
  mov    %rbp,%r15
  add    %r13d,%eax
  mov    (%rdx,%r12,1),%rdx
  mov    %eax,(%rdx,%rbp,4)
  lea    0x1(%rbp),%eax
  cmp    %eax,0x4(%rsp)
  jge    L156
L196:
  mov    0x10(%rsp),%rdx
  lea    0x1(%rdx),%eax
  cmp    %eax,0x28(%rsp)
  jge    L305
  movslq 0x28(%rsp),%r12
  mov    0x18(%rsp),%r14d
  shl    $0x3,%r12
  lea    0x8(%r12),%rax
  mov    %rax,%rcx
  test   %r14d,%r14d
  jle    L8
L79:
  movl   $0x1,0x8(%rsp)
  lea    0x8(%rbx),%r15
  mov    %rcx,%r13
  mov    %r14d,0x10(%rsp)
  mov    %r15,%r14
  nopl   0x0(%rax)
L38:
  xor    %r15d,%r15d
  jmp    L177
L415:
  xor    %edi,%edi
  call   <getwallbit@plt>
  mov    $0xc,%esi
  mov    $0x2,%edi
  mov    %eax,%ebp
  mov    (%r14),%rax
  mov    0x8(%rax),%rax
  mov    (%rax,%rbx,4),%r15d
  call   <pow2@plt>
  mov    %eax,%r8d
  mov    (%r14),%rax
  mov    (%rax),%rcx
  mov    %r8d,%eax
  shl    $0x4,%eax
  sub    %r8d,%eax
  and    %r15d,%eax
  add    %ebp,%eax
  mov    %eax,(%rcx,%rbx,4)
L285:
  mov    $0xc,%esi
  mov    $0x2,%edi
  call   <pow2@plt>
  mov    $0xd,%esi
  mov    $0x2,%edi
  mov    %eax,%ebp
  call   <pow2@plt>
  mov    %eax,%r8d
  mov    (%r14),%rax
  xor    %r8d,%ebp
  mov    (%rax,%r12,1),%rax
  and    (%rax,%rbx,4),%ebp
  jne    L351
  xor    %edi,%edi
  call   <getwallbit@plt>
  mov    $0xc,%esi
  mov    $0x2,%edi
  mov    %eax,%ebp
  mov    (%r14),%rax
  mov    (%rax,%r12,1),%rax
  mov    (%rax,%rbx,4),%r15d
  call   <pow2@plt>
  mov    %eax,%r8d
  mov    (%r14),%rax
  mov    (%rax,%r13,1),%rcx
  mov    %r8d,%eax
  shl    $0x4,%eax
  sub    %r8d,%eax
  and    %r15d,%eax
  mov    %rbx,%r15
  add    %ebp,%eax
  mov    %eax,(%rcx,%rbx,4)
  lea    0x1(%rbx),%eax
  cmp    %eax,0x4(%rsp)
  jl     L108
L177:
  mov    $0xc,%esi
  mov    $0x2,%edi
  lea    0x1(%r15),%rbx
  call   <pow2@plt>
  mov    $0xd,%esi
  mov    $0x2,%edi
  mov    %eax,%ebp
  call   <pow2@plt>
  mov    %eax,%r8d
  mov    (%r14),%rax
  xor    %r8d,%ebp
  mov    0x8(%rax),%rax
  and    0x4(%rax,%r15,4),%ebp
  je     L415
  mov    0x88(%rsp),%edi
  call   <getwallbit@plt>
  mov    %eax,%r8d
  mov    (%r14),%rax
  mov    (%rax),%rcx
  mov    0x8(%rax),%rax
  mov    (%rax,%rbx,4),%eax
  and    $0xc0,%eax
  lea    -0xc0(%rax,%r8,1),%eax
  mov    %eax,(%rcx,%rbx,4)
  jmp    L285
  xchg   %ax,%ax
L351:
  mov    0x90(%rsp),%edi
  mov    %rbx,%r15
  call   <getwallbit@plt>
  mov    %eax,%r8d
  mov    (%r14),%rax
  mov    (%rax,%r13,1),%rcx
  mov    (%rax,%r12,1),%rax
  mov    (%rax,%rbx,4),%eax
  and    $0x30,%eax
  lea    -0x30(%rax,%r8,1),%eax
  mov    %eax,(%rcx,%rbx,4)
  lea    0x1(%rbx),%eax
  cmp    %eax,0x4(%rsp)
  jge    L177
L108:
  addl   $0x1,0x8(%rsp)
  add    $0x8,%r14
  mov    0x8(%rsp),%eax
  cmp    %eax,0x10(%rsp)
  jge    L38
L8:
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L408:
  mov    0x38(%rsp),%r8d
  test   %r8d,%r8d
  js     L364
  jmp    L297
  nopl   0x0(%rax)
L11:
  mov    0x28(%rsp),%ecx
  movslq %r14d,%rax
  test   %ecx,%ecx
  jg     L309
  jmp    L8
L231:
  movslq 0x28(%rsp),%r12
  mov    0x4(%rsp),%edx
  shl    $0x3,%r12
  lea    0x8(%r12),%rax
  mov    %rax,%rcx
  test   %edx,%edx
  jg     L79
  jmp    L8
```

assistant: ```c
void init_flag(char *problem, int imax, int jmax, int kmax, int ***Flag, int wl, int wr, int wf, int wh, int wt, int wb) {
  int i, j, k;
  int **Pic = read_pgm(problem);
  for (k = 1; k < kmax + 1; k++) {
    for (int j = 1; j < jmax + 1; j++) {
      for (int i = 1; i < imax + 1; i++) {
        Flag[i][jmax + 1 - j][k] = createflag(Pic, i, j, k, imax, jmax, kmax);
      }
    }
  }
  for (k = 0; k < kmax + 2; k++) {
    Flag[0][0][k] = getwallbit(wf);
    Flag[0][jmax + 1][k] = getwallbit(wh);
    Flag[imax + 1][0][k] = getwallbit(wf);
    Flag[imax + 1][jmax + 1][k] = getwallbit(wh);
  }
  for (j = 0; j < jmax + 2; j++) {
    Flag[0][j][0] = getwallbit(wb);
    Flag[0][j][kmax + 1] = getwallbit(wt);
    Flag[imax + 1][j][0] = getwallbit(wb);
    Flag[imax + 1][j][kmax + 1] = getwallbit(wt);
  }
  for (i = 0; i < imax + 2; i++) {
    Flag[i][0][0] = getwallbit(wf);
    Flag[i][jmax + 1][0] = getwallbit(wh);
    Flag[i][0][kmax + 1] = getwallbit(wf);
    Flag[i][jmax + 1][kmax + 1] = getwallbit(wh);
  }
  for (i = 1; i <= imax; i++) {
    for (j = 1; j <= jmax; j++) {
      if ((Flag[i][j][1] & pow2(2, 12)) == (Flag[i][j][1] & pow2(2, 13))) {
        Flag[i][j][0] = getwallbit(0) + (Flag[i][j][1] & (pow2(2, 12) * 15));
      } else {
        Flag[i][j][0] = (getwallbit(wb) - 3) + (Flag[i][j][1] & 3);
      }
      if ((Flag[i][j][kmax] & pow2(2, 12)) == (Flag[i][j][kmax] & pow2(2, 13))) {
        Flag[i][j][kmax + 1] = getwallbit(0) + (Flag[i][j][kmax] & (pow2(2, 12) * 15));
      } else {
        Flag[i][j][kmax + 1] = (getwallbit(wt) - 12) + (Flag[i][j][kmax] & 12);
      }
    }
  }
  for (j = 1; j <= jmax; j++) {
    for (k = 1; k <= kmax; k++) {
      if ((Flag[1][j][k] & pow2(2, 12)) == (Flag[1][j][k] & pow2(2, 13))) {
        Flag[0][j][k] = getwallbit(0) + (Flag[1][j][k] & (pow2(2, 12) * 15));
      } else {
        Flag[0][j][k] = (getwallbit(wl) - 3 * pow2(2, 10)) + (Flag[1][j][k] & (3 * pow2(2, 10)));
      }
      if ((Flag[imax][j][k] & pow2(2, 12)) == (Flag[imax][j][k] & pow2(2, 13))) {
        Flag[imax + 1][j][k] = getwallbit(0) + (Flag[imax][j][k] & (pow2(2, 12) * 15));
      } else {
        Flag[imax + 1][j][k] = (getwallbit(wr) - 3 * pow2(2, 8)) + (Flag[imax][j][k] & (3 * pow2(2, 8)));
      }
    }
  }
  for (i = 1; i <= imax; i++) {
    for (k = 1; k <= kmax; k++) {
      if ((Flag[i][1][k] & pow2(2, 12)) == (Flag[i][1][k] & pow2(2, 13))) {
        Flag[i][0][k] = getwallbit(0) + (Flag[i][1][k] & (pow2(2, 12) * 15));
      } else {
        Flag[i][0][k] = (getwallbit(wf) - 64 * 3) + (Flag[i][1][k] & (64 * 3));
      }
      if ((Flag[i][jmax][k] & pow2(2, 12)) == (Flag[i][jmax][k] & pow2(2, 13))) {
        Flag[i][jmax + 1][k] = getwallbit(0) + (Flag[i][jmax][k] & (pow2(2, 12) * 15));
      } else {
        Flag[i][jmax + 1][k] = (getwallbit(wh) - 16 * 3) + (Flag[i][jmax][k] & (16 * 3));
      }
    }
  }
}
```