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

```asm
<opera_mem>:
  endbr64
  push   %r15
  push   %r14
  mov    %r8d,%r14d
  push   %r13
  mov    %rcx,%r13
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  mov    %edi,%ebp
  push   %rbx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  test   %esi,%esi
  je     L26
  test   %rcx,%rcx
  je     L132
L66:
  movslq %r14d,%r15
  mov    %r13,%rbx
  lea    0x10(%rsp),%r13
  mov    %r15,%rax
  shr    $0x2,%rax
  and    $0x3,%r14d
  lea    0x1(%rax),%rdx
  mov    %r14d,0xc(%rsp)
  cmove  %rax,%rdx
  xor    %r14d,%r14d
  mov    %rdx,(%rsp)
  jmp    L37
  nopw   0x0(%rax,%rax,1)
L125:
  mov    0xc(%rsp),%edx
  mov    %r13,%rsi
  mov    %rbx,%rdi
  call   <memcpy@plt>
L129:
  add    $0x1,%r14
  add    $0x4,%rbx
L37:
  cmp    (%rsp),%r14
  je     L120
  lea    (%r12,%r14,4),%rsi
  mov    $0x4,%ecx
  mov    %r13,%rdx
  mov    %ebp,%edi
  call   <getdata@plt>
  cmp    %r14,%r15
  jl     L125
  mov    $0x4,%edx
  mov    %r13,%rsi
  mov    %rbx,%rdi
  call   <memcpy@plt>
  jmp    L129
  nopw   0x0(%rax,%rax,1)
L120:
  mov    $0x1,%eax
L122:
  mov    0x28(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L158
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L26:
  and    $0xfffffffc,%r8d
  movslq %r8d,%r8
  lea    (%r8,%rdx,1),%rsi
  and    $0x3,%r14d
  je     L30
  lea    0x10(%rsp),%rbx
  mov    $0x4,%ecx
  mov    %r8,(%rsp)
  lea    0x4(%r8),%r15
  mov    %rbx,%rdx
  call   <getdata@plt>
  mov    (%rsp),%r8
  xor    %eax,%eax
  lea    0x0(%r13,%r8,1),%rsi
L106:
  mov    %eax,%edx
  add    $0x1,%eax
  movzbl (%rsi,%rdx,1),%ecx
  mov    %cl,(%rbx,%rdx,1)
  cmp    %r14d,%eax
  jb     L106
L84:
  shr    $0x2,%r8
  mov    %r13,%r14
  xor    %r13d,%r13d
  shr    $0x2,%r15
  mov    %r8,(%rsp)
  jne    L167
  jmp    L120
  nopl   0x0(%rax)
L86:
  mov    %r14,%rdx
  mov    %ebp,%edi
  call   <putdata@plt>
L121:
  add    $0x1,%r13
  add    $0x4,%r14
  cmp    %r13,%r15
  je     L120
L167:
  lea    (%r12,%r13,4),%rsi
  mov    $0x4,%ecx
  cmp    (%rsp),%r13
  jne    L86
  mov    %rbx,%rdx
  mov    %ebp,%edi
  call   <putdata@plt>
  jmp    L121
  xchg   %ax,%ax
L132:
  mov    %r8d,%edi
  call   <malloc@plt>
  mov    %rax,%r8
  xor    %eax,%eax
  test   %r8,%r8
  je     L122
  mov    %r8,%r13
  jmp    L66
  xchg   %ax,%ax
L30:
  lea    0x10(%rsp),%rbx
  mov    $0x4,%ecx
  mov    %r8,(%rsp)
  mov    %rbx,%rdx
  call   <getdata@plt>
  mov    (%rsp),%r8
  mov    %r8,%r15
  jmp    L84
L158:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int opera_mem(pid_t target, int mode, long addr, unsigned char *bytes, int numbytes) {
  unsigned char buff[16];
  long cont, endpadd, startcopy;
  if (mode == 0) {
    startcopy = (numbytes / sizeof(int)) * sizeof(int);
    endpadd = (numbytes % sizeof(int) == 0 ? startcopy : startcopy + sizeof(int));
    getdata(target, addr + startcopy, buff, sizeof(int));
    for (cont = 0; cont < numbytes % sizeof(int); cont++) {
      buff[cont] = bytes[startcopy + cont];
    }
    for (cont = 0; cont < endpadd / sizeof(int); cont++) {
      if (cont == (startcopy / sizeof(int))) {
        putdata(target, (cont * sizeof(int)) + addr, buff, sizeof(int));
      } else {
        putdata(target, (cont * sizeof(int)) + addr, bytes + (cont * sizeof(int)), sizeof(int));
      }
    }
    return 1;
  } else {
    if (bytes == NULL) {
      bytes = (unsigned char *)malloc(sizeof(char) * numbytes);
      if (bytes == NULL)
        return 0;
    }
    for (cont = 0; cont < (numbytes % sizeof(int) == 0 ? numbytes / sizeof(int) : (numbytes / sizeof(int)) + 1); cont++) {
      getdata(target, addr + (cont * sizeof(int)), buff, sizeof(int));
      if (cont > numbytes)
        memcpy(bytes + (cont * sizeof(int)), buff, (numbytes % sizeof(int)));
      else
        memcpy(bytes + (cont * sizeof(int)), buff, sizeof(int));
    }
    return 1;
  }
}
```