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

```asm
<Mali_test_reg>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %edi,%ebx
  mov    %esi,%ebp
  mov    %edx,%r12d
  mov    %ecx,%r14d
  mov    %r8d,%r13d
  mov    %r9d,%r15d
  call   <Mali_RdReg@plt>
  cmp    %r15d,%eax
  jne    L29
  cmpl   $0x0,0x40(%rsp)
  jne    L58
  mov    %r13d,%ecx
  mov    %r12d,%edx
  mov    %ebp,%esi
  mov    %ebx,%edi
  call   <Mali_WrReg@plt>
  mov    %r12d,%edx
  mov    %ebp,%esi
  mov    %ebx,%edi
  call   <Mali_RdReg@plt>
  and    %r14d,%eax
  mov    %r13d,%ecx
  and    %r14d,%ecx
  cmp    %ecx,%eax
  jne    L54
  and    $0x12345678,%r13d
  mov    %r13d,%ecx
  mov    %r12d,%edx
  mov    %ebp,%esi
  mov    %ebx,%edi
  call   <Mali_WrReg@plt>
  mov    %r12d,%edx
  mov    %ebp,%esi
  mov    %ebx,%edi
  call   <Mali_RdReg@plt>
  and    %r14d,%eax
  and    %r14d,%r13d
  cmp    %eax,%r13d
  jne    L22
L58:
  shl    $0x1c,%ebx
  shl    $0x10,%ebp
  lea    (%rbx,%rbp,1),%esi
  add    %r12d,%esi
  mov    0x48(%rsp),%rdx
  lea    D10(%rip),%rdi
  mov    $0x0,%eax
  call   <printk@plt>
  mov    $0x0,%eax
L19:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L29:
  shl    $0x1c,%ebx
  shl    $0x10,%ebp
  lea    (%rbx,%rbp,1),%esi
  add    %r12d,%esi
  mov    0x48(%rsp),%r8
  mov    %r15d,%ecx
  mov    %eax,%edx
  lea    D34(%rip),%rdi
  mov    $0x0,%eax
  call   <printk@plt>
  mov    $0xffffffff,%eax
  jmp    L19
L54:
  shl    $0x1c,%ebx
  shl    $0x10,%ebp
  lea    (%rbx,%rbp,1),%esi
  add    %r12d,%esi
  mov    0x48(%rsp),%r8
  mov    %eax,%edx
  lea    D5(%rip),%rdi
  mov    $0x0,%eax
  call   <printk@plt>
  mov    $0xfffffffe,%eax
  jmp    L19
L22:
  shl    $0x1c,%ebx
  shl    $0x10,%ebp
  lea    (%rbx,%rbp,1),%esi
  add    %r12d,%esi
  mov    0x48(%rsp),%r8
  mov    %r13d,%ecx
  mov    %eax,%edx
  lea    D5(%rip),%rdi
  mov    $0x0,%eax
  call   <printk@plt>
  mov    $0xfffffffe,%eax
  jmp    L19
```

tool_calls: name: read_data
arguments: data_label: D10
data_type: string
name: read_data
arguments: data_label: D34
data_type: string
name: read_data
arguments: data_label: D5
data_type: string

tool: D10: Register %08x:  for %s  Success!


tool: D34: FAILURE: Wrong reset value. Addr: 0x%08x Value: 0x%08x Expected: 0x%08x for %s


tool: D5: FAILURE: Wrong value. Addr: 0x%08x Value: 0x%08x Expected: 0x%08x for %s


assistant: ```c
int Mali_test_reg(int unit, int core, int regnum, int read_mask, int write_mask, int reset_value, int access, char *reg_str) {
  int value = Mali_RdReg(unit, core, regnum);
  if (value != reset_value) {
    printk("FAILURE: Wrong reset value. Addr: 0x%08x Value: 0x%08x Expected: 0x%08x for %s\n", (unit << 28) + (core << 16) + regnum, value, reset_value, reg_str);
    return -1;
  }
  if (access == 0) {
    Mali_WrReg(unit, core, regnum, (0xffffffff & write_mask));
    value = Mali_RdReg(unit, core, regnum) & read_mask;
    if (value != (0xffffffff & write_mask & read_mask)) {
      printk("FAILURE: Wrong value. Addr: 0x%08x Value: 0x%08x Expected: 0x%08x for %s\n", (unit << 28) + (core << 16) + regnum, value, (0xffffffff & write_mask & read_mask), reg_str);
      return -2;
    }
    Mali_WrReg(unit, core, regnum, (0x12345678 & write_mask));
    value = Mali_RdReg(unit, core, regnum) & read_mask;
    if (value != (0x12345678 & write_mask & read_mask)) {
      printk("FAILURE: Wrong value. Addr: 0x%08x Value: 0x%08x Expected: 0x%08x for %s\n", (unit << 28) + (core << 16) + regnum, value, (0x12345678 & write_mask & read_mask), reg_str);
      return -2;
    }
  }
  printk("Register %08x:  for %s  Success!\n", (unit << 28) + (core << 16) + regnum, reg_str);
  return 0;
}
```