user: 请将以下的汇编代码转换成C语言代码：

```asm
<micro_apply_bitmask>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x88,%rsp
  mov    %rdi,-0xa8(%rbp)
  mov    %esi,-0xac(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  mov    %rsp,%rax
  mov    %rax,%rbx
  mov    -0xac(%rbp),%eax
  imul   %eax,%eax
  movslq %eax,%rdx
  sub    $0x1,%rdx
  mov    %rdx,-0x80(%rbp)
  movslq %eax,%rdx
  mov    %rdx,%r14
  mov    $0x0,%r15d
  movslq %eax,%rdx
  mov    %rdx,%r12
  mov    $0x0,%r13d
  cltq
  mov    $0x10,%edx
  sub    $0x1,%rdx
  add    %rdx,%rax
  mov    $0x10,%edi
  mov    $0x0,%edx
  div    %rdi
  imul   $0x10,%rax,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rcx
  mov    %rsp,%rdx
  sub    %rcx,%rdx
L252:
  cmp    %rdx,%rsp
  je     L334
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L252
L334:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  mov    %rax,%rdx
  and    $0xfff,%edx
  test   %rdx,%rdx
  je     L144
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L144:
  mov    %rsp,%rax
  add    $0x0,%rax
  mov    %rax,-0x78(%rbp)
  mov    -0xac(%rbp),%eax
  imul   %eax,%eax
  movslq %eax,%rdx
  sub    $0x1,%rdx
  mov    %rdx,-0x70(%rbp)
  movslq %eax,%rdx
  mov    %rdx,%r10
  mov    $0x0,%r11d
  movslq %eax,%rdx
  mov    %rdx,%r8
  mov    $0x0,%r9d
  cltq
  mov    $0x10,%edx
  sub    $0x1,%rdx
  add    %rdx,%rax
  mov    $0x10,%edi
  mov    $0x0,%edx
  div    %rdi
  imul   $0x10,%rax,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rcx
  mov    %rsp,%rdx
  sub    %rcx,%rdx
L37:
  cmp    %rdx,%rsp
  je     L64
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L37
L64:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  mov    %rax,%rdx
  and    $0xfff,%edx
  test   %rdx,%rdx
  je     L233
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L233:
  mov    %rsp,%rax
  add    $0x0,%rax
  mov    %rax,-0x68(%rbp)
  movl   $0x0,-0x94(%rbp)
  jmp    L238
L115:
  movl   $0x0,-0x90(%rbp)
  jmp    L325
L21:
  mov    -0x90(%rbp),%eax
  imul   -0xac(%rbp),%eax
  mov    %eax,%edx
  mov    -0x94(%rbp),%eax
  add    %edx,%eax
  mov    -0x78(%rbp),%rdx
  cltq
  movb   $0x0,(%rdx,%rax,1)
  mov    -0x90(%rbp),%eax
  imul   -0xac(%rbp),%eax
  mov    %eax,%edx
  mov    -0x94(%rbp),%eax
  add    %edx,%eax
  movslq %eax,%rdx
  mov    -0xa8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0xf0,%eax
  test   %eax,%eax
  jne    L24
  mov    -0x90(%rbp),%eax
  and    $0x1,%eax
  test   %eax,%eax
  jne    L62
  mov    -0x90(%rbp),%eax
  imul   -0xac(%rbp),%eax
  mov    %eax,%edx
  mov    -0x94(%rbp),%eax
  add    %edx,%eax
  mov    -0x78(%rbp),%rdx
  cltq
  movzbl (%rdx,%rax,1),%edx
  mov    -0x90(%rbp),%eax
  imul   -0xac(%rbp),%eax
  mov    %eax,%ecx
  mov    -0x94(%rbp),%eax
  add    %ecx,%eax
  lea    0x1(%rdx),%ecx
  mov    -0x78(%rbp),%rdx
  cltq
  mov    %cl,(%rdx,%rax,1)
L62:
  mov    -0x90(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,%esi
  mov    -0x94(%rbp),%eax
  movslq %eax,%rdx
  imul   $0x55555556,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x1f,%eax
  mov    %eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  add    %esi,%eax
  and    $0x1,%eax
  test   %eax,%eax
  jne    L58
  mov    -0x90(%rbp),%eax
  imul   -0xac(%rbp),%eax
  mov    %eax,%edx
  mov    -0x94(%rbp),%eax
  add    %edx,%eax
  mov    -0x78(%rbp),%rdx
  cltq
  movzbl (%rdx,%rax,1),%edx
  mov    -0x90(%rbp),%eax
  imul   -0xac(%rbp),%eax
  mov    %eax,%ecx
  mov    -0x94(%rbp),%eax
  add    %ecx,%eax
  lea    0x2(%rdx),%ecx
  mov    -0x78(%rbp),%rdx
  cltq
  mov    %cl,(%rdx,%rax,1)
L58:
  mov    -0x90(%rbp),%eax
  imul   -0x94(%rbp),%eax
  mov    %eax,%esi
  mov    -0x90(%rbp),%eax
  imul   -0x94(%rbp),%eax
  mov    %eax,%edx
  movslq %edx,%rax
  imul   $0x55555556,%rax,%rax
  shr    $0x20,%rax
  mov    %edx,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%eax
  mov    %eax,%ecx
  add    %ecx,%ecx
  add    %eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  add    %esi,%eax
  and    $0x1,%eax
  test   %eax,%eax
  jne    L109
  mov    -0x90(%rbp),%eax
  imul   -0xac(%rbp),%eax
  mov    %eax,%edx
  mov    -0x94(%rbp),%eax
  add    %edx,%eax
  mov    -0x78(%rbp),%rdx
  cltq
  movzbl (%rdx,%rax,1),%edx
  mov    -0x90(%rbp),%eax
  imul   -0xac(%rbp),%eax
  mov    %eax,%ecx
  mov    -0x94(%rbp),%eax
  add    %ecx,%eax
  lea    0x4(%rdx),%ecx
  mov    -0x78(%rbp),%rdx
  cltq
  mov    %cl,(%rdx,%rax,1)
L109:
  mov    -0x90(%rbp),%edx
  mov    -0x94(%rbp),%eax
  add    %edx,%eax
  mov    %eax,%esi
  mov    -0x90(%rbp),%eax
  imul   -0x94(%rbp),%eax
  mov    %eax,%edx
  movslq %edx,%rax
  imul   $0x55555556,%rax,%rax
  shr    $0x20,%rax
  mov    %edx,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%eax
  mov    %eax,%ecx
  add    %ecx,%ecx
  add    %eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  add    %esi,%eax
  and    $0x1,%eax
  test   %eax,%eax
  jne    L24
  mov    -0x90(%rbp),%eax
  imul   -0xac(%rbp),%eax
  mov    %eax,%edx
  mov    -0x94(%rbp),%eax
  add    %edx,%eax
  mov    -0x78(%rbp),%rdx
  cltq
  movzbl (%rdx,%rax,1),%edx
  mov    -0x90(%rbp),%eax
  imul   -0xac(%rbp),%eax
  mov    %eax,%ecx
  mov    -0x94(%rbp),%eax
  add    %ecx,%eax
  lea    0x8(%rdx),%ecx
  mov    -0x78(%rbp),%rdx
  cltq
  mov    %cl,(%rdx,%rax,1)
L24:
  addl   $0x1,-0x90(%rbp)
L325:
  mov    -0x90(%rbp),%eax
  cmp    -0xac(%rbp),%eax
  jl     L21
  addl   $0x1,-0x94(%rbp)
L238:
  mov    -0x94(%rbp),%eax
  cmp    -0xac(%rbp),%eax
  jl     L115
  movl   $0x0,-0x94(%rbp)
  jmp    L34
L312:
  movl   $0x0,-0x90(%rbp)
  jmp    L261
L331:
  mov    -0x90(%rbp),%eax
  imul   -0xac(%rbp),%eax
  mov    %eax,%edx
  mov    -0x94(%rbp),%eax
  add    %edx,%eax
  movslq %eax,%rdx
  mov    -0xa8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0x1,%eax
  test   %eax,%eax
  je     L114
  movb   $0xff,-0x95(%rbp)
  jmp    L214
L114:
  movb   $0x0,-0x95(%rbp)
L214:
  mov    -0x90(%rbp),%eax
  imul   -0xac(%rbp),%eax
  mov    %eax,%edx
  mov    -0x94(%rbp),%eax
  add    %edx,%eax
  mov    -0x78(%rbp),%rdx
  cltq
  movzbl (%rdx,%rax,1),%eax
  mov    -0x90(%rbp),%edx
  mov    %edx,%ecx
  imul   -0xac(%rbp),%ecx
  mov    -0x94(%rbp),%edx
  lea    (%rcx,%rdx,1),%esi
  xor    -0x95(%rbp),%al
  mov    %eax,%ecx
  mov    -0x68(%rbp),%rdx
  movslq %esi,%rax
  mov    %cl,(%rdx,%rax,1)
  addl   $0x1,-0x90(%rbp)
L261:
  mov    -0x90(%rbp),%eax
  cmp    -0xac(%rbp),%eax
  jl     L331
  addl   $0x1,-0x94(%rbp)
L34:
  mov    -0x94(%rbp),%eax
  cmp    -0xac(%rbp),%eax
  jl     L312
  movl   $0x0,-0x8c(%rbp)
  jmp    L52
L319:
  mov    -0x8c(%rbp),%edx
  mov    -0xac(%rbp),%ecx
  mov    -0x68(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <micro_evaluate@plt>
  mov    -0x8c(%rbp),%edx
  movslq %edx,%rdx
  mov    %eax,-0x60(%rbp,%rdx,4)
  addl   $0x1,-0x8c(%rbp)
L52:
  cmpl   $0x7,-0x8c(%rbp)
  jle    L319
  movl   $0x0,-0x84(%rbp)
  mov    -0x60(%rbp),%eax
  mov    %eax,-0x88(%rbp)
  movl   $0x1,-0x8c(%rbp)
  jmp    L211
L38:
  mov    -0x8c(%rbp),%eax
  cltq
  mov    -0x60(%rbp,%rax,4),%eax
  cmp    %eax,-0x88(%rbp)
  jge    L9
  mov    -0x8c(%rbp),%eax
  mov    %eax,-0x84(%rbp)
  mov    -0x8c(%rbp),%eax
  cltq
  mov    -0x60(%rbp,%rax,4),%eax
  mov    %eax,-0x88(%rbp)
L9:
  addl   $0x1,-0x8c(%rbp)
L211:
  cmpl   $0x3,-0x8c(%rbp)
  jle    L38
  movl   $0x0,-0x94(%rbp)
  jmp    L164
L70:
  movl   $0x0,-0x90(%rbp)
  jmp    L7
L209:
  mov    -0x90(%rbp),%eax
  imul   -0xac(%rbp),%eax
  mov    %eax,%edx
  mov    -0x94(%rbp),%eax
  add    %edx,%eax
  mov    -0x78(%rbp),%rdx
  cltq
  movzbl (%rdx,%rax,1),%eax
  movzbl %al,%edx
  mov    -0x84(%rbp),%eax
  mov    %eax,%ecx
  sar    %cl,%edx
  mov    %edx,%eax
  and    $0x1,%eax
  test   %eax,%eax
  je     L206
  mov    -0x90(%rbp),%eax
  imul   -0xac(%rbp),%eax
  mov    %eax,%edx
  mov    -0x94(%rbp),%eax
  add    %edx,%eax
  movslq %eax,%rdx
  mov    -0xa8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0x1,%eax
  test   %eax,%eax
  je     L205
  mov    -0x90(%rbp),%eax
  imul   -0xac(%rbp),%eax
  mov    %eax,%edx
  mov    -0x94(%rbp),%eax
  add    %edx,%eax
  movslq %eax,%rdx
  mov    -0xa8(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  jmp    L206
L205:
  mov    -0x90(%rbp),%eax
  imul   -0xac(%rbp),%eax
  mov    %eax,%edx
  mov    -0x94(%rbp),%eax
  add    %edx,%eax
  movslq %eax,%rdx
  mov    -0xa8(%rbp),%rax
  add    %rdx,%rax
  movb   $0x1,(%rax)
L206:
  addl   $0x1,-0x90(%rbp)
L7:
  mov    -0x90(%rbp),%eax
  cmp    -0xac(%rbp),%eax
  jl     L209
  addl   $0x1,-0x94(%rbp)
L164:
  mov    -0x94(%rbp),%eax
  cmp    -0xac(%rbp),%eax
  jl     L70
  mov    -0x84(%rbp),%eax
  mov    %rbx,%rsp
  mov    -0x38(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L332
  call   <__stack_chk_fail@plt>
L332:
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
```

assistant: ```c
int micro_apply_bitmask(unsigned char *grid, int size) {
  int x, y;
  unsigned char p;
  int pattern, value[8];
  int best_val, best_pattern;
  unsigned char mask[size * size];
  unsigned char eval[size * size];
  for (x = 0; x < size; x++) {
    for (y = 0; y < size; y++) {
      mask[(y * size) + x] = 0x00;
      if (!(grid[(y * size) + x] & 0xf0)) {
        if ((y & 1) == 0) {
          mask[(y * size) + x] += 0x01;
        }
        if ((((y / 2) + (x / 3)) & 1) == 0) {
          mask[(y * size) + x] += 0x02;
        }
        if (((((y * x) & 1) + ((y * x) % 3)) & 1) == 0) {
          mask[(y * size) + x] += 0x04;
        }
        if (((((y + x) & 1) + ((y * x) % 3)) & 1) == 0) {
          mask[(y * size) + x] += 0x08;
        }
      }
    }
  }
  for (x = 0; x < size; x++) {
    for (y = 0; y < size; y++) {
      if (grid[(y * size) + x] & 0x01) {
        p = 0xff;
      } else {
        p = 0x00;
      }
      eval[(y * size) + x] = mask[(y * size) + x] ^ p;
    }
  }
  for (pattern = 0; pattern < 8; pattern++) {
    value[pattern] = micro_evaluate(eval, size, pattern);
  }
  best_pattern = 0;
  best_val = value[0];
  for (pattern = 1; pattern < 4; pattern++) {
    if (value[pattern] > best_val) {
      best_pattern = pattern;
      best_val = value[pattern];
    }
  }
  for (x = 0; x < size; x++) {
    for (y = 0; y < size; y++) {
      if (mask[(y * size) + x] & (0x01 << best_pattern)) {
        if (grid[(y * size) + x] & 0x01) {
          grid[(y * size) + x] = 0x00;
        } else {
          grid[(y * size) + x] = 0x01;
        }
      }
    }
  }
  return best_pattern;
}
```