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

```asm
<roll_3_xy>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %esi,%ebx
  cmp    $0x2,%edi
  je     L45
  jg     L46
  test   %edi,%edi
  je     L75
  cmp    $0x1,%edi
  jne    L79
  push   $0x1
  mov    $0x7,%r8d
  mov    $0x7,%r9d
  xor    %edx,%edx
  push   $0x1
  mov    $0x7,%ecx
  xor    %esi,%esi
  xor    %edi,%edi
  xor    %ebp,%ebp
  call   <box_apeak_xy@plt>
  mov    %ebx,%edi
  call   <delay_ms@plt>
  pop    %rdi
  pop    %r8
  cs nopw 0x0(%rax,%rax,1)
L29:
  push   $0x0
  mov    %ebp,%r8d
  xor    %ecx,%ecx
  xor    %edx,%edx
  push   $0x1
  mov    $0x7,%r9d
  mov    $0x3,%esi
  add    $0x1,%ebp
  mov    $0x3,%edi
  call   <box_apeak_xy@plt>
  push   $0x1
  mov    $0x7,%r8d
  xor    %edi,%edi
  push   $0x1
  sub    %ebp,%r8d
  xor    %edx,%edx
  mov    $0x7,%r9d
  mov    $0x7,%ecx
  mov    %ebp,%esi
  call   <box_apeak_xy@plt>
  add    $0x20,%rsp
  mov    %ebx,%edi
  call   <delay_ms@plt>
  cmp    $0x7,%ebp
  jne    L29
L79:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax,%rax,1)
L46:
  cmp    $0x3,%edi
  jne    L79
  push   $0x1
  xor    %edx,%edx
  mov    $0x7,%r9d
  mov    $0x7,%r8d
  push   $0x1
  mov    $0x7,%ecx
  xor    %esi,%esi
  xor    %edi,%edi
  mov    $0x7,%ebp
  mov    $0x8,%r12d
  call   <box_apeak_xy@plt>
  mov    %ebx,%edi
  call   <delay_ms@plt>
  pop    %rax
  pop    %rdx
  nopl   0x0(%rax)
L22:
  push   $0x0
  mov    %ebp,%r8d
  xor    %edx,%edx
  mov    $0x7,%r9d
  push   $0x1
  mov    $0x7,%ecx
  mov    $0x4,%esi
  mov    $0x4,%edi
  call   <box_apeak_xy@plt>
  push   $0x1
  mov    %ebp,%eax
  mov    %r12d,%esi
  push   $0x1
  sub    $0x1,%ebp
  xor    %edi,%edi
  sub    %eax,%esi
  xor    %edx,%edx
  mov    $0x7,%r9d
  mov    %ebp,%r8d
  mov    $0x7,%ecx
  call   <box_apeak_xy@plt>
  add    $0x20,%rsp
  mov    %ebx,%edi
  call   <delay_ms@plt>
  test   %ebp,%ebp
  jne    L22
  jmp    L79
  nopl   0x0(%rax)
L45:
  push   $0x1
  xor    %ecx,%ecx
  xor    %esi,%esi
  mov    $0x7,%r9d
  push   $0x1
  mov    $0x7,%r8d
  xor    %edx,%edx
  mov    $0x7,%edi
  xor    %ebp,%ebp
  call   <box_apeak_xy@plt>
  mov    %ebx,%edi
  call   <delay_ms@plt>
  pop    %rcx
  pop    %rsi
  nopl   0x0(%rax,%rax,1)
L74:
  push   $0x0
  mov    %ebp,%ecx
  xor    %edx,%edx
  mov    $0x7,%r9d
  push   $0x1
  mov    $0x7,%r8d
  mov    $0x4,%esi
  add    $0x1,%ebp
  mov    $0x3,%edi
  call   <box_apeak_xy@plt>
  push   $0x1
  mov    $0x7,%edi
  xor    %edx,%edx
  push   $0x1
  sub    %ebp,%edi
  xor    %esi,%esi
  mov    $0x7,%r9d
  mov    $0x7,%r8d
  mov    %ebp,%ecx
  call   <box_apeak_xy@plt>
  add    $0x20,%rsp
  mov    %ebx,%edi
  call   <delay_ms@plt>
  cmp    $0x7,%ebp
  jne    L74
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   (%rax)
L75:
  push   $0x1
  mov    $0x7,%r9d
  mov    $0x7,%r8d
  xor    %ecx,%ecx
  push   $0x1
  xor    %edx,%edx
  xor    %esi,%esi
  mov    $0x7,%edi
  mov    $0x7,%ebp
  mov    $0x8,%r12d
  call   <box_apeak_xy@plt>
  mov    %ebx,%edi
  call   <delay_ms@plt>
  pop    %r9
  pop    %r10
  cs nopw 0x0(%rax,%rax,1)
L53:
  push   $0x0
  xor    %r8d,%r8d
  mov    %ebp,%ecx
  xor    %edx,%edx
  push   $0x1
  mov    $0x7,%r9d
  mov    $0x3,%esi
  mov    $0x4,%edi
  call   <box_apeak_xy@plt>
  push   $0x1
  mov    %ebp,%eax
  mov    %r12d,%ecx
  push   $0x1
  sub    $0x1,%ebp
  sub    %eax,%ecx
  xor    %edx,%edx
  xor    %esi,%esi
  mov    %ebp,%edi
  mov    $0x7,%r9d
  mov    $0x7,%r8d
  call   <box_apeak_xy@plt>
  add    $0x20,%rsp
  mov    %ebx,%edi
  call   <delay_ms@plt>
  test   %ebp,%ebp
  jne    L53
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
void roll_3_xy(int n, int delay) {
  int i;
  switch (n) {
  case 1:
    for (i = 0; i < 8; i++) {
      box_apeak_xy(0, i, 0, 7, 7 - i, 7, 1, 1);
      delay_ms(delay);
      if (i < 7)
        box_apeak_xy(3, 3, 0, 0, i, 7, 1, 0);
    };
    break;
  case 2:
    for (i = 0; i < 8; i++) {
      box_apeak_xy(7 - i, 0, 0, i, 7, 7, 1, 1);
      delay_ms(delay);
      if (i < 7)
        box_apeak_xy(3, 4, 0, i, 7, 7, 1, 0);
    };
    break;
  case 3:
    for (i = 0; i < 8; i++) {
      box_apeak_xy(0, i, 0, 7, 7 - i, 7, 1, 1);
      delay_ms(delay);
      if (i < 7)
        box_apeak_xy(4, 4, 0, 7, 7 - i, 7, 1, 0);
    };
    break;
  case 0:
    for (i = 0; i < 8; i++) {
      box_apeak_xy(7 - i, 0, 0, i, 7, 7, 1, 1);
      delay_ms(delay);
      if (i < 7)
        box_apeak_xy(4, 3, 0, 7 - i, 0, 7, 1, 0);
    };
  }
}
```