ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 这段汇编代码用C语言表示是什么样的：

```asm
<RandomFunc>:
  endbr64
  mov    (%rdi),%rax
  mov    0x8(%rdi),%rdx
  shr    $0x3,%rax
  or     $0x61bab5,%rax
  test   %rdx,%rdx
  je     L1
  mov    %eax,%ecx
  and    $0x6,%ecx
  or     $0x1,%ecx
  shr    %cl,%rax
  cmp    $0x2,%rdx
  jbe    L1
  mov    %eax,%ecx
  and    $0x6,%ecx
  or     $0x1,%ecx
  shr    %cl,%rax
  cmp    $0x4,%rdx
  jbe    L1
  mov    $0x4,%edi
L33:
  cmp    %rdi,%rax
  jbe    L12
  mov    %eax,%ecx
  and    $0x6,%ecx
  or     $0x1,%ecx
  shr    %cl,%rax
L12:
  add    $0x2,%rdi
  cmp    %rdi,%rdx
  ja     L33
L1:
  and    $0x205b028,%eax
  mov    %rax,(%rsi)
  ret
```

assistant: ```c
void RandomFunc(unsigned long input[1], unsigned long output[1]) {
  unsigned long state[1];
  unsigned long local1;
  char copy12;
  unsigned short copy13;
  unsigned short copy14;
  unsigned short copy15;
  unsigned short copy16;
  {
    state[0UL] = (input[0UL] | 51238316UL) >> 3UL;
    local1 = 0UL;
    while (local1 < input[1UL]) {
      if (state[0UL] > local1) {
        if (state[0UL] > local1) {
          state[local1] = state[0UL] >> ((state[0UL] & 7UL) | 1UL);
        } else {
          copy12 = *((char *)(&state[local1]) + 7);
          *((char *)(&state[local1]) + 7) = *((char *)(&state[local1]) + 5);
          *((char *)(&state[local1]) + 5) = copy12;
          copy13 = *((unsigned short *)(&state[0UL]) + 2);
          *((unsigned short *)(&state[0UL]) + 2) = *((unsigned short *)(&state[0UL]) + 3);
          *((unsigned short *)(&state[0UL]) + 3) = copy13;
        }
      } else if (state[0UL] <= local1) {
        copy14 = *((unsigned short *)(&state[local1]) + 0);
        *((unsigned short *)(&state[local1]) + 0) = *((unsigned short *)(&state[local1]) + 2);
        *((unsigned short *)(&state[local1]) + 2) = copy14;
        copy14 = *((unsigned short *)(&state[local1]) + 2);
        *((unsigned short *)(&state[local1]) + 2) = *((unsigned short *)(&state[local1]) + 3);
        *((unsigned short *)(&state[local1]) + 3) = copy14;
        copy15 = *((unsigned short *)(&state[local1]) + 2);
        *((unsigned short *)(&state[local1]) + 2) = *((unsigned short *)(&state[local1]) + 3);
        *((unsigned short *)(&state[local1]) + 3) = copy15;
      } else {
        state[local1] |= state[0UL];
        copy16 = *((unsigned short *)(&state[local1]) + 0);
        *((unsigned short *)(&state[local1]) + 0) = *((unsigned short *)(&state[local1]) + 3);
        *((unsigned short *)(&state[local1]) + 3) = copy16;
        copy16 = *((unsigned short *)(&state[local1]) + 3);
        *((unsigned short *)(&state[local1]) + 3) = *((unsigned short *)(&state[local1]) + 1);
        *((unsigned short *)(&state[local1]) + 1) = copy16;
      }
      local1 += 2UL;
    }
    output[0UL] = (state[0UL] & 536195496UL) & 34582586UL;
  }
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<distanceTo>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    -0x18(%rbp),%rax
  movsd  (%rax),%xmm0
  mov    -0x20(%rbp),%rax
  movsd  (%rax),%xmm2
  movapd %xmm0,%xmm1
  subsd  %xmm2,%xmm1
  mov    -0x18(%rbp),%rax
  movsd  (%rax),%xmm0
  mov    -0x20(%rbp),%rax
  movsd  (%rax),%xmm2
  subsd  %xmm2,%xmm0
  mulsd  %xmm0,%xmm1
  mov    -0x18(%rbp),%rax
  add    $0x8,%rax
  movsd  (%rax),%xmm0
  mov    -0x20(%rbp),%rax
  add    $0x8,%rax
  movsd  (%rax),%xmm3
  movapd %xmm0,%xmm2
  subsd  %xmm3,%xmm2
  mov    -0x18(%rbp),%rax
  add    $0x8,%rax
  movsd  (%rax),%xmm0
  mov    -0x20(%rbp),%rax
  add    $0x8,%rax
  movsd  (%rax),%xmm3
  subsd  %xmm3,%xmm0
  mulsd  %xmm2,%xmm0
  addsd  %xmm0,%xmm1
  mov    -0x18(%rbp),%rax
  add    $0x10,%rax
  movsd  (%rax),%xmm0
  mov    -0x20(%rbp),%rax
  add    $0x10,%rax
  movsd  (%rax),%xmm3
  movapd %xmm0,%xmm2
  subsd  %xmm3,%xmm2
  mov    -0x18(%rbp),%rax
  add    $0x10,%rax
  movsd  (%rax),%xmm0
  mov    -0x20(%rbp),%rax
  add    $0x10,%rax
  movsd  (%rax),%xmm3
  subsd  %xmm3,%xmm0
  mulsd  %xmm2,%xmm0
  addsd  %xmm0,%xmm1
  movq   %xmm1,%rax
  movq   %rax,%xmm0
  call   <sqrt@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x8(%rbp)
  movsd  -0x8(%rbp),%xmm0
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  leave
  ret
```

assistant: ```c
double distanceTo(double *center, double *points) {
  double r = sqrt((center[0] - points[0]) * (center[0] - points[0]) + (center[1] - points[1]) * (center[1] - points[1]) + (center[2] - points[2]) * (center[2] - points[2]));
  return r;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<distanceTo>:
  endbr64
  movsd  (%rdi),%xmm0
  subsd  (%rsi),%xmm0
  movsd  0x8(%rdi),%xmm2
  subsd  0x8(%rsi),%xmm2
  movsd  0x10(%rdi),%xmm1
  subsd  0x10(%rsi),%xmm1
  mulsd  %xmm0,%xmm0
  mulsd  %xmm2,%xmm2
  addsd  %xmm2,%xmm0
  mulsd  %xmm1,%xmm1
  addsd  %xmm1,%xmm0
  pxor   %xmm1,%xmm1
  ucomisd %xmm0,%xmm1
  ja     L7
  sqrtsd %xmm0,%xmm0
  ret
L7:
  sub    $0x8,%rsp
  call   <sqrt@plt>
  add    $0x8,%rsp
  ret
```

assistant: ```c
double distanceTo(double *center, double *points) {
  double r = sqrt((center[0] - points[0]) * (center[0] - points[0]) + (center[1] - points[1]) * (center[1] - points[1]) + (center[2] - points[2]) * (center[2] - points[2]));
  return r;
}
```
user: What is the c source code of the assembly code below:

```asm
<distanceTo>:
  endbr64
  movsd  (%rdi),%xmm0
  movsd  0x8(%rdi),%xmm2
  subsd  (%rsi),%xmm0
  subsd  0x8(%rsi),%xmm2
  movsd  0x10(%rdi),%xmm1
  subsd  0x10(%rsi),%xmm1
  mulsd  %xmm0,%xmm0
  mulsd  %xmm2,%xmm2
  mulsd  %xmm1,%xmm1
  addsd  %xmm2,%xmm0
  addsd  %xmm1,%xmm0
  pxor   %xmm1,%xmm1
  ucomisd %xmm0,%xmm1
  ja     L2
  sqrtsd %xmm0,%xmm0
  ret
L2:
  jmp    1050 <sqrt@plt>
```

assistant: ```c
double distanceTo(double *center, double *points) {
  double r = sqrt((center[0] - points[0]) * (center[0] - points[0]) + (center[1] - points[1]) * (center[1] - points[1]) + (center[2] - points[2]) * (center[2] - points[2]));
  return r;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<distanceTo>:
  endbr64
  movsd  (%rdi),%xmm0
  movsd  0x8(%rdi),%xmm2
  subsd  (%rsi),%xmm0
  subsd  0x8(%rsi),%xmm2
  movsd  0x10(%rdi),%xmm1
  subsd  0x10(%rsi),%xmm1
  mulsd  %xmm0,%xmm0
  mulsd  %xmm2,%xmm2
  mulsd  %xmm1,%xmm1
  addsd  %xmm2,%xmm0
  addsd  %xmm1,%xmm0
  pxor   %xmm1,%xmm1
  ucomisd %xmm0,%xmm1
  ja     L3
  sqrtsd %xmm0,%xmm0
  ret
L3:
  jmp    1050 <sqrt@plt>
```

assistant: ```c
double distanceTo(double *center, double *points) {
  double r = sqrt((center[0] - points[0]) * (center[0] - points[0]) + (center[1] - points[1]) * (center[1] - points[1]) + (center[2] - points[2]) * (center[2] - points[2]));
  return r;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<morsi_closing>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %edx,-0x24(%rbp)
  mov    %ecx,-0x28(%rbp)
  mov    %r8,-0x30(%rbp)
  mov    -0x24(%rbp),%eax
  imul   -0x28(%rbp),%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edi
  call   <xmalloc@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x30(%rbp),%rdi
  mov    -0x28(%rbp),%ecx
  mov    -0x24(%rbp),%edx
  mov    -0x20(%rbp),%rsi
  mov    -0x8(%rbp),%rax
  mov    %rdi,%r8
  mov    %rax,%rdi
  call   <morsi_dilation@plt>
  mov    -0x30(%rbp),%rdi
  mov    -0x28(%rbp),%ecx
  mov    -0x24(%rbp),%edx
  mov    -0x8(%rbp),%rsi
  mov    -0x18(%rbp),%rax
  mov    %rdi,%r8
  mov    %rax,%rdi
  call   <morsi_erosion@plt>
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  nop
  leave
  ret
```

assistant: ```c
void morsi_closing(float *y, float *x, int w, int h, int *e) {
  float *t = xmalloc(w * h * sizeof *t);
  morsi_dilation(t, x, w, h, e);
  morsi_erosion(y, t, w, h, e);
  free(t);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<morsi_closing>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%r14
  mov    %rsi,%r15
  mov    %edx,%ebp
  mov    %ecx,%r12d
  mov    %r8,%r13
  mov    %edx,%edi
  imul   %ecx,%edi
  shl    $0x2,%edi
  call   <xmalloc@plt>
  mov    %rax,%rbx
  mov    %r13,%r8
  mov    %r12d,%ecx
  mov    %ebp,%edx
  mov    %r15,%rsi
  mov    %rax,%rdi
  call   <morsi_dilation@plt>
  mov    %r13,%r8
  mov    %r12d,%ecx
  mov    %ebp,%edx
  mov    %rbx,%rsi
  mov    %r14,%rdi
  call   <morsi_erosion@plt>
  mov    %rbx,%rdi
  call   <free@plt>
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void morsi_closing(float *y, float *x, int w, int h, int *e) {
  float *t = xmalloc(w * h * sizeof *t);
  morsi_dilation(t, x, w, h, e);
  morsi_erosion(y, t, w, h, e);
  free(t);
}
```
user: What is the c source code of the assembly code below:

```asm
<morsi_closing>:
  endbr64
  push   %r15
  mov    %rsi,%r15
  push   %r14
  mov    %rdi,%r14
  mov    %edx,%edi
  push   %r13
  imul   %ecx,%edi
  mov    %ecx,%r13d
  push   %r12
  mov    %edx,%r12d
  push   %rbp
  push   %rbx
  shl    $0x2,%edi
  mov    %r8,%rbx
  sub    $0x8,%rsp
  call   <xmalloc@plt>
  mov    %rbx,%r8
  mov    %r13d,%ecx
  mov    %r12d,%edx
  mov    %rax,%rbp
  mov    %r15,%rsi
  mov    %rax,%rdi
  call   <morsi_dilation@plt>
  mov    %r14,%rdi
  mov    %rbx,%r8
  mov    %r13d,%ecx
  mov    %r12d,%edx
  mov    %rbp,%rsi
  call   <morsi_erosion@plt>
  add    $0x8,%rsp
  mov    %rbp,%rdi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1080 <free@plt>
```

assistant: ```c
void morsi_closing(float *y, float *x, int w, int h, int *e) {
  float *t = xmalloc(w * h * sizeof *t);
  morsi_dilation(t, x, w, h, e);
  morsi_erosion(y, t, w, h, e);
  free(t);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<morsi_closing>:
  endbr64
  push   %r15
  mov    %rsi,%r15
  push   %r14
  mov    %rdi,%r14
  mov    %edx,%edi
  push   %r13
  imul   %ecx,%edi
  mov    %ecx,%r13d
  push   %r12
  mov    %edx,%r12d
  push   %rbp
  push   %rbx
  shl    $0x2,%edi
  mov    %r8,%rbx
  sub    $0x8,%rsp
  call   <xmalloc@plt>
  mov    %rbx,%r8
  mov    %r13d,%ecx
  mov    %r12d,%edx
  mov    %rax,%rbp
  mov    %r15,%rsi
  mov    %rax,%rdi
  call   <morsi_dilation@plt>
  mov    %r14,%rdi
  mov    %rbx,%r8
  mov    %r13d,%ecx
  mov    %r12d,%edx
  mov    %rbp,%rsi
  call   <morsi_erosion@plt>
  add    $0x8,%rsp
  mov    %rbp,%rdi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1080 <free@plt>
```

assistant: ```c
void morsi_closing(float *y, float *x, int w, int h, int *e) {
  float *t = xmalloc(w * h * sizeof *t);
  morsi_dilation(t, x, w, h, e);
  morsi_erosion(y, t, w, h, e);
  free(t);
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<execve>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    -0x28(%rbp),%rcx
  mov    -0x20(%rbp),%rdx
  mov    -0x18(%rbp),%rsi
  mov    D5(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,%edi
  call   <syscall_3@plt>
  mov    %eax,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  leave
  ret
```

assistant: ```c
int execve(const char *filename, char *const argv[], char *const envp[]) {
  int ret;
  ret = syscall_3(SYS_execve, ((long)(filename)), ((long)(argv)), ((long)(envp)));
  return ret;
}
```
user: Translate the below assembly code into C programming language:

```asm
<execve>:
  endbr64
  sub    $0x8,%rsp
  mov    %rdx,%rcx
  mov    %rsi,%rdx
  mov    %rdi,%rsi
  mov    D3(%rip),%rax
  mov    (%rax),%edi
  call   <syscall_3@plt>
  add    $0x8,%rsp
  ret
```

assistant: ```c
int execve(const char *filename, char *const argv[], char *const envp[]) {
  int ret;
  ret = syscall_3(SYS_execve, ((long)(filename)), ((long)(argv)), ((long)(envp)));
  return ret;
}
```
user: What is the c source code of the assembly code below?

```asm
<execve>:
  endbr64
  mov    D5(%rip),%rax
  mov    %rdx,%rcx
  mov    %rsi,%rdx
  mov    %rdi,%rsi
  mov    (%rax),%edi
  jmp    1050 <syscall_3@plt>
```

assistant: ```c
int execve(const char *filename, char *const argv[], char *const envp[]) {
  int ret;
  ret = syscall_3(SYS_execve, ((long)(filename)), ((long)(argv)), ((long)(envp)));
  return ret;
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<execve>:
  endbr64
  mov    D0(%rip),%rax
  mov    %rdx,%rcx
  mov    %rsi,%rdx
  mov    %rdi,%rsi
  mov    (%rax),%edi
  jmp    1050 <syscall_3@plt>
```

assistant: ```c
int execve(const char *filename, char *const argv[], char *const envp[]) {
  int ret;
  ret = syscall_3(SYS_execve, ((long)(filename)), ((long)(argv)), ((long)(envp)));
  return ret;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<disk_write>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x250,%rsp
  mov    %rdi,-0x238(%rbp)
  mov    %esi,-0x23c(%rbp)
  mov    %edx,-0x240(%rbp)
  mov    %ecx,-0x244(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x240(%rbp),%edx
  mov    -0x244(%rbp),%eax
  add    %edx,%eax
  lea    0x1ff(%rax),%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  sar    $0x9,%eax
  mov    %eax,-0x224(%rbp)
  mov    -0x240(%rbp),%edx
  mov    -0x244(%rbp),%eax
  add    %edx,%eax
  and    $0x1ff,%eax
  test   %eax,%eax
  je     L72
  addl   $0x1,-0x224(%rbp)
L72:
  movl   $0x0,-0x21c(%rbp)
  movl   $0x0,-0x220(%rbp)
  jmp    L41
L30:
  mov    -0x23c(%rbp),%edx
  lea    -0x210(%rbp),%rax
  mov    %edx,%ecx
  mov    $0x1,%edx
  mov    %rax,%rsi
  mov    $0x0,%edi
  call   <ata_read@plt>
  cmpl   $0x0,-0x220(%rbp)
  jne    L21
  mov    -0x240(%rbp),%eax
  jmp    L39
L21:
  mov    $0x0,%eax
L39:
  mov    %eax,-0x218(%rbp)
  mov    -0x244(%rbp),%eax
  sub    -0x21c(%rbp),%eax
  mov    %eax,%edx
  mov    -0x218(%rbp),%eax
  add    %edx,%eax
  cmp    $0x200,%eax
  jle    L49
  mov    $0x200,%eax
  sub    -0x218(%rbp),%eax
  jmp    L65
L49:
  mov    -0x244(%rbp),%eax
  sub    -0x21c(%rbp),%eax
L65:
  mov    %eax,-0x214(%rbp)
  mov    -0x21c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x238(%rbp),%rax
  lea    (%rdx,%rax,1),%rsi
  mov    -0x218(%rbp),%eax
  cltq
  lea    -0x210(%rbp),%rdx
  lea    (%rdx,%rax,1),%rcx
  mov    -0x214(%rbp),%eax
  mov    %eax,%edx
  mov    %rcx,%rdi
  call   <memcpy@plt>
  mov    -0x214(%rbp),%eax
  add    %eax,-0x21c(%rbp)
  mov    -0x23c(%rbp),%edx
  mov    -0x220(%rbp),%eax
  add    %eax,%edx
  lea    -0x210(%rbp),%rax
  mov    %edx,%ecx
  mov    $0x1,%edx
  mov    %rax,%rsi
  mov    $0x0,%edi
  call   <ata_write@plt>
  addl   $0x1,-0x220(%rbp)
L41:
  mov    -0x220(%rbp),%eax
  cmp    -0x224(%rbp),%eax
  jl     L30
  mov    -0x21c(%rbp),%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L2
  call   <__stack_chk_fail@plt>
L2:
  leave
  ret
```

assistant: ```c
int disk_write(char *source, int start_block_index, int offset, int num_bytes) {
  int blocks_needed = ((offset + num_bytes) / 512);
  if (((offset + num_bytes) % 512) != 0) {
    blocks_needed++;
  }
  char block_buffer[512];
  int blocks_read_in;
  int memcpy_offset;
  int bytes_written = 0;
  int bytes_to_write;
  for (blocks_read_in = 0; blocks_read_in < blocks_needed; blocks_read_in++) {
    ata_read(0, block_buffer, 1, start_block_index);
    memcpy_offset = blocks_read_in == 0 ? offset : 0;
    bytes_to_write = ((num_bytes - bytes_written) + memcpy_offset) > 512 ? 512 - memcpy_offset : num_bytes - bytes_written;
    memcpy(block_buffer + memcpy_offset, source + bytes_written, bytes_to_write);
    bytes_written += bytes_to_write;
    ata_write(0, block_buffer, 1, start_block_index + blocks_read_in);
  }
  return bytes_written;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<disk_write>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x228,%rsp
  mov    %rdi,(%rsp)
  mov    %edx,0xc(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x218(%rsp)
  xor    %eax,%eax
  lea    (%rdx,%rcx,1),%eax
  lea    0x1ff(%rax),%edx
  test   %eax,%eax
  cmovns %eax,%edx
  sar    $0x9,%edx
  and    $0x1ff,%eax
  cmp    $0x1,%eax
  sbb    $0xffffffff,%edx
  mov    %edx,0x8(%rsp)
  mov    $0x0,%ebp
  test   %edx,%edx
  jle    L39
  mov    %esi,%r15d
  mov    %ecx,%r14d
  lea    0x10(%rsp),%rsi
  mov    %r15d,%ecx
  mov    $0x1,%edx
  mov    $0x0,%edi
  call   <ata_read@plt>
  mov    0xc(%rsp),%edi
  mov    $0x0,%ebp
  mov    $0x0,%r12d
L29:
  mov    %r14d,%ebx
  sub    %ebp,%ebx
  add    %edi,%ebx
  mov    $0x200,%eax
  sub    %edi,%eax
  mov    %r14d,%edx
  sub    %ebp,%edx
  cmp    $0x201,%ebx
  cmovl  %edx,%eax
  mov    %eax,%ebx
  movslq %ebp,%rsi
  add    (%rsp),%rsi
  lea    0x10(%rsp),%r13
  movslq %edi,%rdi
  add    %r13,%rdi
  mov    %eax,%edx
  call   <memcpy@plt>
  add    %ebx,%ebp
  lea    (%r12,%r15,1),%ecx
  mov    $0x1,%edx
  mov    %r13,%rsi
  mov    $0x0,%edi
  call   <ata_write@plt>
  add    $0x1,%r12d
  cmp    %r12d,0x8(%rsp)
  je     L39
  lea    0x10(%rsp),%rsi
  mov    %r15d,%ecx
  mov    $0x1,%edx
  mov    $0x0,%edi
  call   <ata_read@plt>
  test   %r12d,%r12d
  mov    $0x0,%edi
  cmove  0xc(%rsp),%edi
  jmp    L29
L39:
  mov    0x218(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L17
  mov    %ebp,%eax
  add    $0x228,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L17:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int disk_write(char *source, int start_block_index, int offset, int num_bytes) {
  int blocks_needed = ((offset + num_bytes) / 512);
  if (((offset + num_bytes) % 512) != 0) {
    blocks_needed++;
  }
  char block_buffer[512];
  int blocks_read_in;
  int memcpy_offset;
  int bytes_written = 0;
  int bytes_to_write;
  for (blocks_read_in = 0; blocks_read_in < blocks_needed; blocks_read_in++) {
    ata_read(0, block_buffer, 1, start_block_index);
    memcpy_offset = blocks_read_in == 0 ? offset : 0;
    bytes_to_write = ((num_bytes - bytes_written) + memcpy_offset) > 512 ? 512 - memcpy_offset : num_bytes - bytes_written;
    memcpy(block_buffer + memcpy_offset, source + bytes_written, bytes_to_write);
    bytes_written += bytes_to_write;
    ata_write(0, block_buffer, 1, start_block_index + blocks_read_in);
  }
  return bytes_written;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<disk_write>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x238,%rsp
  mov    %rdi,0x8(%rsp)
  mov    %edx,0x14(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x228(%rsp)
  xor    %eax,%eax
  lea    (%rdx,%rcx,1),%eax
  test   %eax,%eax
  lea    0x1ff(%rax),%r14d
  cmovns %eax,%r14d
  and    $0x1ff,%eax
  sar    $0x9,%r14d
  cmp    $0x1,%eax
  sbb    $0xffffffff,%r14d
  mov    %r14d,0x10(%rsp)
  test   %r14d,%r14d
  jle    L7
  movslq %edx,%rax
  mov    %esi,%r13d
  mov    %ecx,%r12d
  xor    %r15d,%r15d
  mov    %rax,0x18(%rsp)
  xor    %ebx,%ebx
  lea    0x20(%rsp),%rbp
  jmp    L18
  nopl   0x0(%rax)
L36:
  mov    %r14d,%r15d
L18:
  xor    %edi,%edi
  mov    %r13d,%ecx
  mov    $0x1,%edx
  mov    %rbp,%rsi
  call   <ata_read@plt>
  mov    %rbp,%rdi
  xor    %eax,%eax
  test   %ebx,%ebx
  jne    L29
  mov    0x18(%rsp),%rax
  lea    0x0(%rbp,%rax,1),%rdi
  mov    0x14(%rsp),%eax
L29:
  mov    %r12d,%edx
  mov    %r12d,%r14d
  sub    %r15d,%edx
  lea    (%rdx,%rax,1),%ecx
  cmp    $0x200,%ecx
  jle    L20
  mov    $0x200,%edx
  sub    %eax,%edx
  lea    (%rdx,%r15,1),%r14d
L20:
  movslq %r15d,%rsi
  add    0x8(%rsp),%rsi
  call   <memcpy@plt>
  lea    0x0(%r13,%rbx,1),%ecx
  mov    %rbp,%rsi
  xor    %edi,%edi
  mov    $0x1,%edx
  add    $0x1,%ebx
  call   <ata_write@plt>
  cmp    %ebx,0x10(%rsp)
  jne    L36
L12:
  mov    0x228(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L33
  add    $0x238,%rsp
  mov    %r14d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L7:
  xor    %r14d,%r14d
  jmp    L12
L33:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int disk_write(char *source, int start_block_index, int offset, int num_bytes) {
  int blocks_needed = ((offset + num_bytes) / 512);
  if (((offset + num_bytes) % 512) != 0) {
    blocks_needed++;
  }
  char block_buffer[512];
  int blocks_read_in;
  int memcpy_offset;
  int bytes_written = 0;
  int bytes_to_write;
  for (blocks_read_in = 0; blocks_read_in < blocks_needed; blocks_read_in++) {
    ata_read(0, block_buffer, 1, start_block_index);
    memcpy_offset = blocks_read_in == 0 ? offset : 0;
    bytes_to_write = ((num_bytes - bytes_written) + memcpy_offset) > 512 ? 512 - memcpy_offset : num_bytes - bytes_written;
    memcpy(block_buffer + memcpy_offset, source + bytes_written, bytes_to_write);
    bytes_written += bytes_to_write;
    ata_write(0, block_buffer, 1, start_block_index + blocks_read_in);
  }
  return bytes_written;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<disk_write>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x238,%rsp
  mov    %edx,0x14(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x228(%rsp)
  xor    %eax,%eax
  lea    (%rdx,%rcx,1),%eax
  test   %eax,%eax
  lea    0x1ff(%rax),%r14d
  cmovns %eax,%r14d
  and    $0x1ff,%eax
  sar    $0x9,%r14d
  cmp    $0x1,%eax
  sbb    $0xffffffff,%r14d
  mov    %r14d,0xc(%rsp)
  test   %r14d,%r14d
  jle    L34
  movslq %edx,%rax
  mov    %rdi,%r15
  mov    %esi,%r12d
  mov    %ecx,%r13d
  mov    %rax,0x18(%rsp)
  xor    %r14d,%r14d
  xor    %ebx,%ebx
  lea    0x20(%rsp),%rbp
  nopl   (%rax)
L37:
  xor    %edi,%edi
  mov    %r12d,%ecx
  mov    $0x1,%edx
  mov    %rbp,%rsi
  call   <ata_read@plt>
  mov    %rbp,%rdi
  xor    %eax,%eax
  test   %ebx,%ebx
  jne    L66
  mov    0x18(%rsp),%rax
  lea    0x0(%rbp,%rax,1),%rdi
  mov    0x14(%rsp),%eax
L66:
  mov    %r13d,%edx
  sub    %r14d,%edx
  lea    (%rdx,%rax,1),%ecx
  cmp    $0x200,%ecx
  jle    L81
  mov    $0x200,%edx
  movslq %r14d,%rsi
  sub    %eax,%edx
  add    %r15,%rsi
  lea    (%rdx,%r14,1),%r9d
  mov    %r9d,0x10(%rsp)
  call   <memcpy@plt>
  lea    (%r12,%rbx,1),%ecx
  xor    %edi,%edi
  mov    $0x1,%edx
  mov    %rbp,%rsi
  add    $0x1,%ebx
  call   <ata_write@plt>
  cmp    %ebx,0xc(%rsp)
  mov    0x10(%rsp),%r9d
  je     L75
  mov    %r9d,%r14d
  jmp    L37
  nopl   0x0(%rax,%rax,1)
L81:
  movslq %r14d,%rsi
  add    %r15,%rsi
  call   <memcpy@plt>
  lea    (%rbx,%r12,1),%ecx
  mov    $0x1,%edx
  xor    %edi,%edi
  mov    %rbp,%rsi
  add    $0x1,%ebx
  call   <ata_write@plt>
  cmp    %ebx,0xc(%rsp)
  je     L61
  mov    %r13d,%r14d
  jmp    L37
  nopw   0x0(%rax,%rax,1)
L61:
  mov    %r13d,%r9d
L75:
  mov    0x228(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L54
  add    $0x238,%rsp
  mov    %r9d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L34:
  xor    %r9d,%r9d
  jmp    L75
L54:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int disk_write(char *source, int start_block_index, int offset, int num_bytes) {
  int blocks_needed = ((offset + num_bytes) / 512);
  if (((offset + num_bytes) % 512) != 0) {
    blocks_needed++;
  }
  char block_buffer[512];
  int blocks_read_in;
  int memcpy_offset;
  int bytes_written = 0;
  int bytes_to_write;
  for (blocks_read_in = 0; blocks_read_in < blocks_needed; blocks_read_in++) {
    ata_read(0, block_buffer, 1, start_block_index);
    memcpy_offset = blocks_read_in == 0 ? offset : 0;
    bytes_to_write = ((num_bytes - bytes_written) + memcpy_offset) > 512 ? 512 - memcpy_offset : num_bytes - bytes_written;
    memcpy(block_buffer + memcpy_offset, source + bytes_written, bytes_to_write);
    bytes_written += bytes_to_write;
    ata_write(0, block_buffer, 1, start_block_index + blocks_read_in);
  }
  return bytes_written;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<cmd_sta_reset_default>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    %rsi,-0x10(%rbp)
  mov    %rdx,-0x18(%rbp)
  mov    -0x18(%rbp),%rdx
  mov    -0x10(%rbp),%rcx
  mov    -0x8(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <cmd_sta_p2p_reset@plt>
  leave
  ret
```

assistant: ```c
int cmd_sta_reset_default(struct sigma_dut *dut, struct sigma_conn *conn, struct sigma_cmd *cmd) {
  int cmd_sta_p2p_reset(struct sigma_dut * dut, struct sigma_conn * conn, struct sigma_cmd * cmd);
  return cmd_sta_p2p_reset(dut, conn, cmd);
}
```