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

```asm
<init_flag>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %esi,0x2c(%rsp)
  mov    %edx,%ebx
  mov    %edx,0x8(%rsp)
  mov    %ecx,%ebp
  mov    %ecx,0x20(%rsp)
  mov    %r8,%r14
  mov    %r9d,0x28(%rsp)
  call   <read_pgm@plt>
  mov    %rax,0x18(%rsp)
  movl   $0x1,0xc(%rsp)
  lea    0x1(%rbx),%eax
  mov    %eax,0x24(%rsp)
  test   %ebp,%ebp
  jle    L467
  mov    $0x4,%r15d
  mov    %r15,0x10(%rsp)
  mov    0x2c(%rsp),%ebp
  mov    0x20(%rsp),%r15d
  jmp    L52
L418:
  mov    0x24(%rsp),%r13d
  sub    (%rsp),%r13d
  movslq %r13d,%r13
  shl    $0x3,%r13
  mov    $0x1,%ebx
L398:
  mov    (%r14,%rbx,8),%rax
  mov    0x10(%rsp),%r12
  add    (%rax,%r13,1),%r12
  sub    $0x8,%rsp
  push   %r15
  mov    0x18(%rsp),%r9d
  mov    %ebp,%r8d
  mov    0x1c(%rsp),%ecx
  mov    0x10(%rsp),%edx
  mov    %ebx,%esi
  mov    0x28(%rsp),%rdi
  call   <createflag@plt>
  mov    %eax,(%r12)
  add    $0x1,%rbx
  add    $0x10,%rsp
  cmp    %ebx,%ebp
  jge    L398
L4:
  addl   $0x1,(%rsp)
  mov    (%rsp),%eax
  cmp    %eax,0x8(%rsp)
  jl     L219
L90:
  test   %ebp,%ebp
  jg     L418
  jmp    L4
L219:
  addl   $0x1,0xc(%rsp)
  mov    0xc(%rsp),%eax
  addq   $0x4,0x10(%rsp)
  cmp    %eax,%r15d
  jl     L298
L52:
  movl   $0x1,(%rsp)
  cmpl   $0x0,0x8(%rsp)
  jg     L90
  jmp    L219
L467:
  mov    0x20(%rsp),%eax
  add    $0x1,%eax
  mov    %eax,(%rsp)
  js     L101
  jmp    L240
L459:
  mov    0x90(%rsp),%edi
  call   <getwallbit@plt>
  mov    %eax,%ecx
  mov    (%r15),%rax
  mov    (%rax,%rbx,8),%rdx
  mov    0x4(%rdx),%eax
  and    $0x3,%eax
  lea    -0x3(%rax,%rcx,1),%eax
  mov    %eax,(%rdx)
  jmp    L77
L305:
  mov    0x88(%rsp),%edi
  call   <getwallbit@plt>
  mov    %eax,%ecx
  mov    (%r12),%rax
  mov    (%rax,%rbx,8),%rdx
  mov    (%rdx,%r14,1),%eax
  and    $0xc,%eax
  lea    -0xc(%rax,%rcx,1),%eax
  mov    (%rsp),%rcx
  mov    %eax,(%rdx,%rcx,1)
L426:
  add    $0x1,%rbp
  lea    0x1(%rbp),%eax
  cmp    0x8(%rsp),%eax
  jg     L244
L57:
  mov    $0xc,%esi
  mov    $0x2,%edi
  call   <pow2@plt>
  mov    %eax,%r13d
  mov    $0xd,%esi
  mov    $0x2,%edi
  call   <pow2@plt>
  mov    %eax,%edx
  mov    %r15,%r12
  lea    0x1(%rbp),%rbx
  mov    (%r15),%rax
  mov    (%rax,%rbx,8),%rax
  xor    %edx,%r13d
  and    0x4(%rax),%r13d
  jne    L459
  mov    $0x0,%edi
  call   <getwallbit@plt>
  mov    %eax,0xc(%rsp)
  mov    (%r15),%rax
  mov    (%rax,%rbx,8),%rax
  mov    0x4(%rax),%r13d
  mov    $0xc,%esi
  mov    $0x2,%edi
  call   <pow2@plt>
  mov    %eax,%edx
  mov    (%r15),%rax
  mov    (%rax,%rbx,8),%rcx
  mov    %edx,%eax
  shl    $0x4,%eax
  sub    %edx,%eax
  and    %r13d,%eax
  add    0xc(%rsp),%eax
  mov    %eax,(%rcx)
L77:
  mov    $0xc,%esi
  mov    $0x2,%edi
  call   <pow2@plt>
  mov    %eax,%r13d
  mov    $0xd,%esi
  mov    $0x2,%edi
  call   <pow2@plt>
  mov    %eax,%edx
  mov    (%r12),%rax
  mov    (%rax,%rbx,8),%rax
  xor    %edx,%r13d
  and    (%rax,%r14,1),%r13d
  jne    L305
  mov    $0x0,%edi
  call   <getwallbit@plt>
  mov    %eax,0xc(%rsp)
  mov    (%r12),%rax
  mov    (%rax,%rbx,8),%rax
  mov    (%rax,%r14,1),%r13d
  mov    $0xc,%esi
  mov    $0x2,%edi
  call   <pow2@plt>
  mov    %eax,%edx
  mov    (%r12),%rax
  mov    (%rax,%rbx,8),%rcx
  mov    %edx,%eax
  shl    $0x4,%eax
  sub    %edx,%eax
  and    %r13d,%eax
  add    0xc(%rsp),%eax
  mov    (%rsp),%rdi
  mov    %eax,(%rcx,%rdi,1)
  jmp    L426
L244:
  addl   $0x1,0x10(%rsp)
  mov    0x10(%rsp),%eax
  add    $0x8,%r15
  cmp    %eax,0x2c(%rsp)
  jl     L3
L390:
  mov    $0x0,%ebp
  cmpl   $0x0,0x8(%rsp)
  jg     L57
  jmp    L244
L348:
  mov    0x28(%rsp),%edi
  call   <getwallbit@plt>
  mov    %eax,%r13d
  mov    $0xa,%esi
  mov    $0x2,%edi
  call   <pow2@plt>
  lea    0x0(,%rax,4),%edx
  sub    %edx,%eax
  add    %r13d,%eax
  mov    %eax,0xc(%rsp)
  mov    0x8(%r14),%rax
  mov    (%rax,%rbx,1),%rax
  mov    (%rax,%rbp,4),%r13d
  mov    $0xa,%esi
  mov    $0x2,%edi
  call   <pow2@plt>
  mov    (%r14),%rdx
  mov    (%rdx,%rbx,1),%rdx
  lea    (%rax,%rax,2),%eax
  and    %r13d,%eax
  add    0xc(%rsp),%eax
  mov    %eax,(%rdx,%rbp,4)
  jmp    L447
L22:
  mov    0x70(%rsp),%edi
  call   <getwallbit@plt>
  mov    %eax,%r13d
  mov    $0x8,%esi
  mov    $0x2,%edi
  call   <pow2@plt>
  lea    0x0(,%rax,4),%edx
  sub    %edx,%eax
  add    %r13d,%eax
  mov    %eax,0xc(%rsp)
  mov    (%r15),%rax
  mov    (%rax,%rbx,1),%rax
  mov    (%rax,%rbp,4),%r13d
  mov    $0x8,%esi
  mov    $0x2,%edi
  call   <pow2@plt>
  mov    (%rsp),%rcx
  mov    (%rcx),%rdx
  mov    (%rdx,%rbx,1),%rdx
  lea    (%rax,%rax,2),%eax
  and    %r13d,%eax
  add    0xc(%rsp),%eax
  mov    %eax,(%rdx,%rbp,4)
L253:
  add    $0x1,%r12
  lea    0x1(%r12),%eax
  cmp    0x20(%rsp),%eax
  jg     L432
L51:
  mov    $0xc,%esi
  mov    $0x2,%edi
  call   <pow2@plt>
  mov    %eax,%r13d
  mov    $0xd,%esi
  mov    $0x2,%edi
  call   <pow2@plt>
  mov    %eax,%edx
  lea    0x1(%r12),%rbp
  mov    0x8(%r14),%rax
  mov    (%rax,%rbx,1),%rax
  xor    %edx,%r13d
  and    0x4(%rax,%r12,4),%r13d
  jne    L348
  mov    $0x0,%edi
  call   <getwallbit@plt>
  mov    %eax,0xc(%rsp)
  mov    0x8(%r14),%rax
  mov    (%rax,%rbx,1),%rax
  mov    (%rax,%rbp,4),%r13d
  mov    $0xc,%esi
  mov    $0x2,%edi
  call   <pow2@plt>
  mov    %eax,%edx
  mov    (%r14),%rax
  mov    (%rax,%rbx,1),%rcx
  mov    %edx,%eax
  shl    $0x4,%eax
  sub    %edx,%eax
  and    %r13d,%eax
  add    0xc(%rsp),%eax
  mov    %eax,(%rcx,%rbp,4)
L447:
  mov    $0xc,%esi
  mov    $0x2,%edi
  call   <pow2@plt>
  mov    %eax,%r13d
  mov    $0xd,%esi
  mov    $0x2,%edi
  call   <pow2@plt>
  mov    %eax,%edx
  mov    (%r15),%rax
  mov    (%rax,%rbx,1),%rax
  xor    %edx,%r13d
  and    (%rax,%rbp,4),%r13d
  jne    L22
  mov    $0x0,%edi
  call   <getwallbit@plt>
  mov    %eax,0xc(%rsp)
  mov    (%r15),%rax
  mov    (%rax,%rbx,1),%rax
  mov    (%rax,%rbp,4),%r13d
  mov    $0xc,%esi
  mov    $0x2,%edi
  call   <pow2@plt>
  mov    %eax,%edx
  mov    (%rsp),%rcx
  mov    (%rcx),%rax
  mov    (%rax,%rbx,1),%rcx
  mov    %edx,%eax
  shl    $0x4,%eax
  sub    %edx,%eax
  and    %r13d,%eax
  add    0xc(%rsp),%eax
  mov    %eax,(%rcx,%rbp,4)
  jmp    L253
L432:
  addq   $0x1,0x10(%rsp)
  mov    0x10(%rsp),%rax
  add    $0x1,%eax
  cmp    0x8(%rsp),%eax
  jg     L337
L32:
  mov    0x10(%rsp),%rax
  lea    0x8(,%rax,8),%rbx
  mov    $0x0,%r12d
  cmpl   $0x0,0x20(%rsp)
  jg     L51
  jmp    L432
L337:
  cmpl   $0x0,0x2c(%rsp)
  jle    L179
L31:
  movslq 0x8(%rsp),%r15
  shl    $0x3,%r15
  lea    0x8(%r15),%rax
  mov    %rax,(%rsp)
  lea    0x8(%r14),%r13
  movl   $0x1,0xc(%rsp)
  jmp    L233
L252:
  mov    0x78(%rsp),%edi
  call   <getwallbit@plt>
  mov    %eax,%ecx
  mov    0x0(%r13),%rax
  mov    (%rax),%rdx
  mov    0x8(%rax),%rax
  mov    (%rax,%rbx,4),%eax
  and    $0xc0,%eax
  lea    -0xc0(%rax,%rcx,1),%eax
  mov    %eax,(%rdx,%rbx,4)
  jmp    L216
L208:
  mov    0x80(%rsp),%edi
  call   <getwallbit@plt>
  mov    %eax,%ecx
  mov    0x0(%rbp),%rax
  mov    (%rsp),%rdi
  mov    (%rax,%rdi,1),%rdx
  mov    (%rax,%r15,1),%rax
  mov    (%rax,%rbx,4),%eax
  and    $0x30,%eax
  lea    -0x30(%rax,%rcx,1),%eax
  mov    %eax,(%rdx,%rbx,4)
L266:
  add    $0x1,%r12
  lea    0x1(%r12),%eax
  cmp    %eax,0x20(%rsp)
  jl     L172
L455:
  mov    $0xc,%esi
  mov    $0x2,%edi
  call   <pow2@plt>
  mov    %eax,%r14d
  mov    $0xd,%esi
  mov    $0x2,%edi
  call   <pow2@plt>
  mov    %eax,%edx
  mov    %r13,%rbp
  lea    0x1(%r12),%rbx
  mov    0x0(%r13),%rax
  mov    0x8(%rax),%rax
  xor    %edx,%r14d
  and    0x4(%rax,%r12,4),%r14d
  jne    L252
  mov    $0x0,%edi
  call   <getwallbit@plt>
  mov    %eax,0x8(%rsp)
  mov    0x0(%r13),%rax
  mov    0x8(%rax),%rax
  mov    (%rax,%rbx,4),%r14d
  mov    $0xc,%esi
  mov    $0x2,%edi
  call   <pow2@plt>
  mov    %eax,%edx
  mov    0x0(%r13),%rax
  mov    (%rax),%rcx
  mov    %edx,%eax
  shl    $0x4,%eax
  sub    %edx,%eax
  and    %r14d,%eax
  add    0x8(%rsp),%eax
  mov    %eax,(%rcx,%rbx,4)
L216:
  mov    $0xc,%esi
  mov    $0x2,%edi
  call   <pow2@plt>
  mov    %eax,%r14d
  mov    $0xd,%esi
  mov    $0x2,%edi
  call   <pow2@plt>
  mov    %eax,%edx
  mov    0x0(%rbp),%rax
  mov    (%rax,%r15,1),%rax
  xor    %edx,%r14d
  and    (%rax,%rbx,4),%r14d
  jne    L208
  mov    $0x0,%edi
  call   <getwallbit@plt>
  mov    %eax,0x8(%rsp)
  mov    0x0(%rbp),%rax
  mov    (%rax,%r15,1),%rax
  mov    (%rax,%rbx,4),%r14d
  mov    $0xc,%esi
  mov    $0x2,%edi
  call   <pow2@plt>
  mov    %eax,%edx
  mov    0x0(%rbp),%rax
  mov    (%rsp),%rcx
  mov    (%rax,%rcx,1),%rcx
  mov    %edx,%eax
  shl    $0x4,%eax
  sub    %edx,%eax
  and    %r14d,%eax
  add    0x8(%rsp),%eax
  mov    %eax,(%rcx,%rbx,4)
  jmp    L266
L172:
  addl   $0x1,0xc(%rsp)
  mov    0xc(%rsp),%eax
  add    $0x8,%r13
  cmp    %eax,0x2c(%rsp)
  jl     L179
L233:
  mov    $0x0,%r12d
  cmpl   $0x0,0x20(%rsp)
  jg     L455
  jmp    L172
L3:
  mov    0x18(%rsp),%r14
  cmpl   $0x0,0x8(%rsp)
  jle    L31
L439:
  movslq 0x2c(%rsp),%rax
  shl    $0x3,%rax
  lea    (%r14,%rax,1),%r15
  lea    0x8(%r14,%rax,1),%rax
  mov    %rax,(%rsp)
  movq   $0x0,0x10(%rsp)
  jmp    L32
L12:
  cmpl   $0x0,0x8(%rsp)
  jg     L439
L179:
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L298:
  mov    0x20(%rsp),%eax
  add    $0x1,%eax
  mov    %eax,(%rsp)
L240:
  movslq 0x8(%rsp),%rax
  lea    0x8(,%rax,8),%r15
  movslq 0x2c(%rsp),%rax
  lea    0x8(%r14,%rax,8),%r12
  mov    $0x0,%r13d
L137:
  lea    0x0(,%r13,4),%rbx
  mov    (%r14),%rax
  mov    %rbx,%rbp
  add    (%rax),%rbp
  mov    0x78(%rsp),%edi
  call   <getwallbit@plt>
  mov    %eax,0x0(%rbp)
  mov    (%r14),%rax
  mov    %rbx,%rbp
  add    (%rax,%r15,1),%rbp
  mov    0x80(%rsp),%edi
  call   <getwallbit@plt>
  mov    %eax,0x0(%rbp)
  mov    (%r12),%rax
  mov    %rbx,%rbp
  add    (%rax),%rbp
  mov    0x78(%rsp),%edi
  call   <getwallbit@plt>
  mov    %eax,0x0(%rbp)
  mov    (%r12),%rax
  add    (%rax,%r15,1),%rbx
  mov    0x80(%rsp),%edi
  call   <getwallbit@plt>
  mov    %eax,(%rbx)
  add    $0x1,%r13
  cmp    %r13d,(%rsp)
  jge    L137
L101:
  cmpl   $0xffffffff,0x8(%rsp)
  jl     L14
  movslq 0x20(%rsp),%rax
  lea    0x4(,%rax,4),%r12
  movslq 0x2c(%rsp),%rax
  lea    0x8(%r14,%rax,8),%rbp
  mov    $0x0,%ebx
  mov    0x90(%rsp),%r13d
L402:
  mov    (%r14),%rax
  mov    (%rax,%rbx,8),%r15
  mov    %r13d,%edi
  call   <getwallbit@plt>
  mov    %eax,(%r15)
  mov    (%r14),%rax
  mov    %r12,%r15
  add    (%rax,%rbx,8),%r15
  mov    0x88(%rsp),%edi
  call   <getwallbit@plt>
  mov    %eax,(%r15)
  mov    0x0(%rbp),%rax
  mov    (%rax,%rbx,8),%r15
  mov    %r13d,%edi
  call   <getwallbit@plt>
  mov    %eax,(%r15)
  mov    0x0(%rbp),%rax
  mov    %r12,%r15
  add    (%rax,%rbx,8),%r15
  mov    0x88(%rsp),%edi
  call   <getwallbit@plt>
  mov    %eax,(%r15)
  add    $0x1,%rbx
  lea    -0x1(%rbx),%eax
  cmp    %eax,0x8(%rsp)
  jge    L402
L14:
  cmpl   $0xffffffff,0x2c(%rsp)
  jl     L312
  movslq 0x8(%rsp),%rax
  lea    0x8(,%rax,8),%r12
  movslq 0x20(%rsp),%rax
  lea    0x4(,%rax,4),%rbp
  mov    $0x0,%ebx
  mov    0x80(%rsp),%r13d
L129:
  mov    (%r14,%rbx,8),%rax
  mov    (%rax),%r15
  mov    0x78(%rsp),%edi
  call   <getwallbit@plt>
  mov    %eax,(%r15)
  mov    (%r14,%rbx,8),%rax
  mov    (%rax,%r12,1),%r15
  mov    %r13d,%edi
  call   <getwallbit@plt>
  mov    %eax,(%r15)
  mov    (%r14,%rbx,8),%rax
  mov    %rbp,%r15
  add    (%rax),%r15
  mov    0x78(%rsp),%edi
  call   <getwallbit@plt>
  mov    %eax,(%r15)
  mov    (%r14,%rbx,8),%rax
  mov    %rbp,%r15
  add    (%rax,%r12,1),%r15
  mov    %r13d,%edi
  call   <getwallbit@plt>
  mov    %eax,(%r15)
  add    $0x1,%rbx
  lea    -0x1(%rbx),%eax
  cmp    %eax,0x2c(%rsp)
  jge    L129
L312:
  cmpl   $0x0,0x2c(%rsp)
  jle    L12
  movslq 0x20(%rsp),%rax
  shl    $0x2,%rax
  lea    0x4(%rax),%rcx
  mov    %rcx,(%rsp)
  lea    0x8(%r14),%r15
  movl   $0x1,0x10(%rsp)
  mov    %r14,0x18(%rsp)
  mov    %rax,%r14
  jmp    L390
```

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));
      }
    }
  }
}
```