ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<swap>:
  endbr64
  mov    (%rdi),%eax
  mov    (%rsi),%edx
  mov    %edx,(%rdi)
  mov    %eax,(%rsi)
  ret
```

assistant: ```c
void swap(int *i1, int *i2) {
  int tmp = *i1;
  *i1 = *i2;
  *i2 = tmp;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<swap>:
  endbr64
  mov    (%rdi),%eax
  mov    (%rsi),%edx
  mov    %edx,(%rdi)
  mov    %eax,(%rsi)
  ret
```

assistant: ```c
void swap(int *i1, int *i2) {
  int tmp = *i1;
  *i1 = *i2;
  *i2 = tmp;
}
```
user: Translate the below assembly code into C programming language:

```asm
<get_rand>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x10(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <gettimeofday@plt>
  mov    -0x10(%rbp),%eax
  imul   $0xf4240,%eax,%eax
  mov    %eax,%edx
  mov    -0xc(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x14(%rbp),%eax
  mov    %eax,%edi
  call   <srand@plt>
  mov    $0x0,%eax
  call   <rand@plt>
  cltd
  idivl  -0x24(%rbp)
  mov    %edx,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L8
  call   <__stack_chk_fail@plt>
L8:
  leave
  ret
```

assistant: ```c
int get_rand(int maxnum) {
  struct timeval tv;
  unsigned int seed;
  gettimeofday(&tv, NULL);
  seed = tv.tv_sec * 1000000 + tv.tv_usec;
  srand(seed);
  return (rand() % maxnum);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<get_rand>:
  endbr64
  push   %rbx
  sub    $0x10,%rsp
  mov    %edi,%ebx
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rdi
  mov    $0x0,%esi
  call   <gettimeofday@plt>
  imul   $0xf4240,(%rsp),%edi
  add    0x4(%rsp),%edi
  call   <srand@plt>
  mov    $0x0,%eax
  call   <rand@plt>
  cltd
  idiv   %ebx
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L5
  mov    %edx,%eax
  add    $0x10,%rsp
  pop    %rbx
  ret
L5:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int get_rand(int maxnum) {
  struct timeval tv;
  unsigned int seed;
  gettimeofday(&tv, NULL);
  seed = tv.tv_sec * 1000000 + tv.tv_usec;
  srand(seed);
  return (rand() % maxnum);
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<get_rand>:
  endbr64
  push   %rbx
  xor    %esi,%esi
  mov    %edi,%ebx
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rdi
  call   <gettimeofday@plt>
  imul   $0xf4240,(%rsp),%edi
  add    0x4(%rsp),%edi
  call   <srand@plt>
  xor    %eax,%eax
  call   <rand@plt>
  cltd
  idiv   %ebx
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L1
  add    $0x10,%rsp
  mov    %edx,%eax
  pop    %rbx
  ret
L1:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int get_rand(int maxnum) {
  struct timeval tv;
  unsigned int seed;
  gettimeofday(&tv, NULL);
  seed = tv.tv_sec * 1000000 + tv.tv_usec;
  srand(seed);
  return (rand() % maxnum);
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<get_rand>:
  endbr64
  push   %rbx
  xor    %esi,%esi
  mov    %edi,%ebx
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rdi
  call   <gettimeofday@plt>
  imul   $0xf4240,(%rsp),%edi
  add    0x4(%rsp),%edi
  call   <srand@plt>
  xor    %eax,%eax
  call   <rand@plt>
  cltd
  idiv   %ebx
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L1
  add    $0x10,%rsp
  mov    %edx,%eax
  pop    %rbx
  ret
L1:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int get_rand(int maxnum) {
  struct timeval tv;
  unsigned int seed;
  gettimeofday(&tv, NULL);
  seed = tv.tv_sec * 1000000 + tv.tv_usec;
  srand(seed);
  return (rand() % maxnum);
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %rsi,-0x20(%rbp)
  movl   $0x1,-0x4(%rbp)
  jmp    L22
L10:
  mov    -0x4(%rbp),%eax
  add    $0x1,%eax
  cmp    %eax,-0x14(%rbp)
  jle    L4
  lea    D19(%rip),%rax
  jmp    L20
L4:
  lea    D17(%rip),%rax
L20:
  mov    -0x4(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,8),%rcx
  mov    -0x20(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rdx),%rcx
  mov    %rax,%rdx
  mov    %rcx,%rsi
  lea    D7(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  addl   $0x1,-0x4(%rbp)
L22:
  mov    -0x4(%rbp),%eax
  cmp    -0x14(%rbp),%eax
  jl     L10
  mov    $0x0,%edi
  call   <exit@plt>
  mov    $0x0,%eax
  leave
  ret
```

tool_calls: name: parse_data
arguments: data_label: D19
type: string
name: parse_data
arguments: data_label: D17
type: string
name: parse_data
arguments: data_label: D7
type: string

tool: D19:  

tool: D17: 


tool: D7: %s%s

assistant: ```c
int main(int argc, char *argv[]) {
  int i;
  for (i = 1; i < argc; i++)
    printf("%s%s", argv[i], i + 1 < argc ? " " : "\n");
  exit(0);
}
```
user: What is the c source code of the assembly code below:

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  cmp    $0x1,%edi
  jle    L12
  mov    %edi,%ebp
  mov    %rsi,%r13
  lea    0x8(%rsi),%rbx
  lea    -0x2(%rdi),%eax
  lea    (%rbx,%rax,8),%r12
  lea    D14(%rip),%r15
  lea    D5(%rip),%r14
L9:
  cmp    %r12,%rbx
  je     L8
  mov    %r15,%rdx
  mov    (%rbx),%rsi
  mov    %r14,%rdi
  call   <printf@plt>
  add    $0x8,%rbx
  jmp    L9
L8:
  sub    $0x1,%ebp
  movslq %ebp,%rbp
  mov    0x0(%r13,%rbp,8),%rsi
  lea    D1(%rip),%rdx
  lea    D5(%rip),%rdi
  call   <printf@plt>
L12:
  mov    $0x0,%edi
  call   <exit@plt>
  mov    $0x0,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: disassemble_data
arguments: tag: D14
type: string
name: disassemble_data
arguments: tag: D5
type: string
name: disassemble_data
arguments: tag: D1
type: string

tool: D14:  

tool: D5: %s%s

tool: D1: 


assistant: ```c
int main(int argc, char *argv[]) {
  int i;
  for (i = 1; i < argc; i++)
    printf("%s%s", argv[i], i + 1 < argc ? " " : "\n");
  exit(0);
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<main>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  cmp    $0x1,%edi
  jle    L27
  lea    0x8(%rsi),%rbx
  lea    -0x2(%rdi),%eax
  lea    0x10(%rsi,%rax,8),%rbp
  add    $0x8,%rbx
  mov    -0x8(%rbx),%rsi
  lea    D19(%rip),%r12
  lea    D1(%rip),%r13
  cmp    %rbp,%rbx
  je     L4
  nopw   0x0(%rax,%rax,1)
L21:
  mov    %r13,%rdx
  mov    %r12,%rdi
  add    $0x8,%rbx
  call   <printf@plt>
  mov    -0x8(%rbx),%rsi
  cmp    %rbp,%rbx
  jne    L21
L4:
  lea    D20(%rip),%rdx
  mov    %r12,%rdi
  call   <printf@plt>
L27:
  xor    %edi,%edi
  call   <exit@plt>
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

tool_calls: name: parse_data
arguments: data_tag: D19
data_type: string
name: parse_data
arguments: data_tag: D1
data_type: string
name: parse_data
arguments: data_tag: D20
data_type: string

tool: D19: %s%s

tool: D1:  

tool: D20: 


assistant: ```c
int main(int argc, char *argv[]) {
  int i;
  for (i = 1; i < argc; i++)
    printf("%s%s", argv[i], i + 1 < argc ? " " : "\n");
  exit(0);
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<main>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  cmp    $0x1,%edi
  jle    L21
  mov    %rsi,%rax
  lea    D9(%rip),%rbp
  mov    0x8(%rsi),%rsi
  cmp    $0x2,%edi
  je     L27
  lea    -0x3(%rdi),%edx
  lea    0x10(%rax),%rbx
  lea    0x18(%rax,%rdx,8),%r13
  lea    D4(%rip),%r12
  lea    D9(%rip),%rbp
L20:
  mov    %r12,%rdx
  mov    %rbp,%rdi
  add    $0x8,%rbx
  call   <printf@plt>
  mov    -0x8(%rbx),%rsi
  cmp    %r13,%rbx
  jne    L20
L27:
  lea    D3(%rip),%rdx
  mov    %rbp,%rdi
  call   <printf@plt>
L21:
  xor    %edi,%edi
  call   <exit@plt>
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

tool_calls: name: retrieve_data
arguments: data_tag: D9
data_type: string
name: retrieve_data
arguments: data_tag: D4
data_type: string
name: retrieve_data
arguments: data_tag: D3
data_type: string

tool: D9: %s%s

tool: D4:  

tool: D3: 


assistant: ```c
int main(int argc, char *argv[]) {
  int i;
  for (i = 1; i < argc; i++)
    printf("%s%s", argv[i], i + 1 < argc ? " " : "\n");
  exit(0);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<symlinkat>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    -0x1c(%rbp),%eax
  mov    %eax,%edi
  call   <dir_mutex_lock@plt>
  mov    -0x28(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <symlink@plt>
  mov    %eax,-0x4(%rbp)
  mov    $0x0,%eax
  call   <dir_mutex_unlock@plt>
  mov    -0x4(%rbp),%eax
  leave
  ret
```

assistant: ```c
int symlinkat(const char *oldpath, int newdirfd, const char *newpath) {
  int rc;
  dir_mutex_lock(newdirfd);
  rc = symlink(oldpath, newpath);
  dir_mutex_unlock();
  return rc;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<symlinkat>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbx
  mov    %esi,%edi
  mov    %rdx,%rbp
  call   <dir_mutex_lock@plt>
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <symlink@plt>
  mov    %eax,%ebx
  mov    $0x0,%eax
  call   <dir_mutex_unlock@plt>
  mov    %ebx,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
int symlinkat(const char *oldpath, int newdirfd, const char *newpath) {
  int rc;
  dir_mutex_lock(newdirfd);
  rc = symlink(oldpath, newpath);
  dir_mutex_unlock();
  return rc;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<symlinkat>:
  endbr64
  push   %r12
  mov    %rdi,%r12
  mov    %esi,%edi
  push   %rbp
  mov    %rdx,%rbp
  sub    $0x8,%rsp
  call   <dir_mutex_lock@plt>
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <symlink@plt>
  mov    %eax,%r12d
  xor    %eax,%eax
  call   <dir_mutex_unlock@plt>
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
int symlinkat(const char *oldpath, int newdirfd, const char *newpath) {
  int rc;
  dir_mutex_lock(newdirfd);
  rc = symlink(oldpath, newpath);
  dir_mutex_unlock();
  return rc;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<symlinkat>:
  endbr64
  push   %r12
  mov    %rdi,%r12
  mov    %esi,%edi
  push   %rbp
  mov    %rdx,%rbp
  sub    $0x8,%rsp
  call   <dir_mutex_lock@plt>
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <symlink@plt>
  mov    %eax,%r12d
  xor    %eax,%eax
  call   <dir_mutex_unlock@plt>
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
int symlinkat(const char *oldpath, int newdirfd, const char *newpath) {
  int rc;
  dir_mutex_lock(newdirfd);
  rc = symlink(oldpath, newpath);
  dir_mutex_unlock();
  return rc;
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<maximum>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x4(%rbp)
  mov    %esi,-0x8(%rbp)
  mov    -0x4(%rbp),%eax
  cmp    -0x8(%rbp),%eax
  jge    L6
  mov    -0x8(%rbp),%eax
  jmp    L15
L6:
  mov    -0x4(%rbp),%eax
L15:
  pop    %rbp
  ret
```

assistant: ```c
int maximum(int a, int b) {
  if (a < b) {
    return b;
  } else {
    return a;
  }
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<maximum>:
  endbr64
  cmp    %esi,%edi
  mov    %esi,%eax
  cmovge %edi,%eax
  ret
```

assistant: ```c
int maximum(int a, int b) {
  if (a < b) {
    return b;
  } else {
    return a;
  }
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<maximum>:
  endbr64
  cmp    %esi,%edi
  mov    %esi,%eax
  cmovge %edi,%eax
  ret
```

assistant: ```c
int maximum(int a, int b) {
  if (a < b) {
    return b;
  } else {
    return a;
  }
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<maximum>:
  endbr64
  cmp    %esi,%edi
  mov    %esi,%eax
  cmovge %edi,%eax
  ret
```

assistant: ```c
int maximum(int a, int b) {
  if (a < b) {
    return b;
  } else {
    return a;
  }
}
```
user: What is the c source code of the assembly code below:

```asm
<_RGB8_to_YVU420>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %edx,-0xc(%rsp)
  mov    %edx,%r12d
  imul   %esi,%r12d
  lea    0x3(%r12),%ebx
  test   %r12d,%r12d
  cmovns %r12d,%ebx
  sar    $0x2,%ebx
  add    %r12d,%ebx
  test   %edx,%edx
  jle    L63
  mov    %rdi,%rbp
  mov    %esi,%r10d
  mov    %rcx,%r13
  lea    -0x1(%rsi),%eax
  lea    0x3(%rax,%rax,2),%rax
  shl    $0x2,%rax
  mov    %rax,-0x8(%rsp)
  movl   $0x0,-0x10(%rsp)
  mov    $0x0,%r9d
  jmp    L46
L66:
  add    $0x1,%ecx
  add    $0x4,%rdi
  cmp    %ecx,%r10d
  je     L56
L73:
  mov    (%rax),%esi
  mov    0x4(%rax),%r8d
  mov    0x8(%rax),%r11d
  add    $0xc,%rax
  imul   $0x42,%r11d,%edx
  mov    %r8d,%r14d
  shl    $0x7,%r14d
  add    %r8d,%r14d
  add    %r14d,%edx
  lea    (%rsi,%rsi,4),%r14d
  lea    (%r14,%r14,4),%r14d
  lea    0x80(%rdx,%r14,1),%edx
  sar    $0x8,%edx
  add    $0x10,%edx
  mov    %edx,(%rdi)
  mov    %ecx,%edx
  or     %r9d,%edx
  test   $0x1,%dl
  jne    L66
  movslq %ebx,%r14
  imul   $0xffffffda,%r11d,%edx
  imul   $0xffffffb6,%r8d,%r15d
  add    %r15d,%edx
  imul   $0x70,%esi,%r15d
  lea    0x80(%rdx,%r15,1),%edx
  sar    $0x8,%edx
  sub    $0xffffff80,%edx
  mov    %edx,0x0(%r13,%r14,4)
  movslq %r12d,%rdx
  imul   $0x70,%r11d,%r11d
  imul   $0xffffffa2,%r8d,%r8d
  add    %r8d,%r11d
  imul   $0xffffffee,%esi,%esi
  lea    0x80(%r11,%rsi,1),%esi
  sar    $0x8,%esi
  sub    $0xffffff80,%esi
  mov    %esi,0x0(%r13,%rdx,4)
  lea    0x1(%rbx),%ebx
  lea    0x1(%r12),%r12d
  jmp    L66
L56:
  add    -0x8(%rsp),%rbp
  add    %ecx,-0x10(%rsp)
L49:
  add    $0x1,%r9d
  cmp    %r9d,-0xc(%rsp)
  je     L63
L46:
  test   %r10d,%r10d
  jle    L49
  movslq -0x10(%rsp),%rax
  lea    0x0(%r13,%rax,4),%rdi
  mov    %rbp,%rax
  mov    $0x0,%ecx
  jmp    L73
L63:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void _RGB8_to_YVU420(const uint8_t *rgb, int width, int height, uint8_t *yuv) {
  const uint8_t *rgb_current = rgb;
  int x, y, yi = 0;
  const int num_pixels = width * height;
  int vi = num_pixels;
  int ui = num_pixels + num_pixels / 4;
  for (y = 0; y < height; y++) {
    for (x = 0; x < width; x++) {
      const uint32_t b = rgb_current[0];
      const uint32_t g = rgb_current[1];
      const uint32_t r = rgb_current[2];
      rgb_current += 3;
      yuv[yi++] = (uint8_t)((66 * r + 129 * g + 25 * b + 128) >> 8) + 16;
      if ((x % 2) == 0 && (y % 2) == 0) {
        yuv[ui++] = (uint8_t)((-38 * r - 74 * g + 112 * b + 128) >> 8) + 128;
        yuv[vi++] = (uint8_t)((112 * r - 94 * g - 18 * b + 128) >> 8) + 128;
      }
    }
  }
}
```
user: Translate the below assembly code into C programming language:

```asm
<_RGB8_to_YVU420>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  mov    %edx,%r12d
  imul   %esi,%r12d
  push   %rbp
  push   %rbx
  test   %r12d,%r12d
  lea    0x3(%r12),%ebx
  cmovns %r12d,%ebx
  mov    %edx,-0xc(%rsp)
  sar    $0x2,%ebx
  add    %r12d,%ebx
  test   %edx,%edx
  jle    L51
  lea    -0x1(%rsi),%eax
  mov    %rdi,%rbp
  mov    %esi,%r10d
  mov    %rcx,%r13
  lea    0x3(%rax,%rax,2),%rax
  movl   $0x0,-0x10(%rsp)
  xor    %r9d,%r9d
  shl    $0x2,%rax
  mov    %rax,-0x8(%rsp)
  nopl   0x0(%rax,%rax,1)
L13:
  test   %r10d,%r10d
  jle    L3
  movslq -0x10(%rsp),%rax
  xor    %ecx,%ecx
  lea    0x0(%r13,%rax,4),%rdi
  mov    %rbp,%rax
  jmp    L5
  nopw   0x0(%rax,%rax,1)
L25:
  add    $0x1,%ecx
  add    $0x4,%rdi
  cmp    %ecx,%r10d
  je     L48
L5:
  mov    0x4(%rax),%r8d
  mov    0x8(%rax),%r11d
  add    $0xc,%rax
  mov    -0xc(%rax),%esi
  imul   $0x42,%r11d,%edx
  mov    %r8d,%r14d
  shl    $0x7,%r14d
  add    %r8d,%r14d
  add    %r14d,%edx
  lea    (%rsi,%rsi,4),%r14d
  lea    (%r14,%r14,4),%r14d
  lea    0x80(%rdx,%r14,1),%edx
  sar    $0x8,%edx
  add    $0x10,%edx
  mov    %edx,(%rdi)
  mov    %ecx,%edx
  or     %r9d,%edx
  and    $0x1,%edx
  jne    L25
  imul   $0xffffffb6,%r8d,%r15d
  movslq %ebx,%r14
  add    $0x1,%ecx
  add    $0x1,%ebx
  imul   $0xffffffda,%r11d,%edx
  add    $0x4,%rdi
  imul   $0x70,%r11d,%r11d
  imul   $0xffffffa2,%r8d,%r8d
  add    %r15d,%edx
  imul   $0x70,%esi,%r15d
  imul   $0xffffffee,%esi,%esi
  add    %r8d,%r11d
  lea    0x80(%rdx,%r15,1),%edx
  sar    $0x8,%edx
  lea    0x80(%r11,%rsi,1),%esi
  sub    $0xffffff80,%edx
  sar    $0x8,%esi
  mov    %edx,0x0(%r13,%r14,4)
  sub    $0xffffff80,%esi
  movslq %r12d,%rdx
  add    $0x1,%r12d
  mov    %esi,0x0(%r13,%rdx,4)
  cmp    %ecx,%r10d
  jne    L5
L48:
  add    %r10d,-0x10(%rsp)
  add    -0x8(%rsp),%rbp
L3:
  add    $0x1,%r9d
  cmp    %r9d,-0xc(%rsp)
  jne    L13
L51:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void _RGB8_to_YVU420(const uint8_t *rgb, int width, int height, uint8_t *yuv) {
  const uint8_t *rgb_current = rgb;
  int x, y, yi = 0;
  const int num_pixels = width * height;
  int vi = num_pixels;
  int ui = num_pixels + num_pixels / 4;
  for (y = 0; y < height; y++) {
    for (x = 0; x < width; x++) {
      const uint32_t b = rgb_current[0];
      const uint32_t g = rgb_current[1];
      const uint32_t r = rgb_current[2];
      rgb_current += 3;
      yuv[yi++] = (uint8_t)((66 * r + 129 * g + 25 * b + 128) >> 8) + 16;
      if ((x % 2) == 0 && (y % 2) == 0) {
        yuv[ui++] = (uint8_t)((-38 * r - 74 * g + 112 * b + 128) >> 8) + 128;
        yuv[vi++] = (uint8_t)((112 * r - 94 * g - 18 * b + 128) >> 8) + 128;
      }
    }
  }
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<_RGB8_to_YVU420>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  mov    %edx,%r12d
  imul   %esi,%r12d
  push   %rbp
  push   %rbx
  test   %r12d,%r12d
  lea    0x3(%r12),%ebx
  cmovns %r12d,%ebx
  mov    %edx,-0xc(%rsp)
  sar    $0x2,%ebx
  add    %r12d,%ebx
  test   %edx,%edx
  jle    L26
  mov    %esi,%r10d
  test   %esi,%esi
  jle    L26
  movslq %esi,%rax
  mov    %rdi,%rbp
  mov    %rcx,%r13
  xor    %r9d,%r9d
  lea    (%rax,%rax,2),%rax
  movl   $0x0,-0x10(%rsp)
  shl    $0x2,%rax
  mov    %rax,-0x8(%rsp)
  nop
L35:
  movslq -0x10(%rsp),%rax
  xor    %ecx,%ecx
  lea    0x0(%r13,%rax,4),%rdi
  mov    %rbp,%rax
  jmp    L50
  nopl   0x0(%rax)
L40:
  add    $0x1,%ecx
  add    $0x4,%rdi
  cmp    %ecx,%r10d
  je     L24
L50:
  mov    0x4(%rax),%r8d
  mov    0x8(%rax),%r11d
  add    $0xc,%rax
  mov    -0xc(%rax),%esi
  imul   $0x42,%r11d,%edx
  mov    %r8d,%r14d
  shl    $0x7,%r14d
  add    %r8d,%r14d
  add    %r14d,%edx
  lea    (%rsi,%rsi,4),%r14d
  lea    (%r14,%r14,4),%r14d
  lea    0x80(%rdx,%r14,1),%edx
  sar    $0x8,%edx
  add    $0x10,%edx
  mov    %edx,(%rdi)
  mov    %ecx,%edx
  or     %r9d,%edx
  and    $0x1,%edx
  jne    L40
  imul   $0xffffffb6,%r8d,%r15d
  movslq %ebx,%r14
  add    $0x1,%ecx
  add    $0x1,%ebx
  imul   $0xffffffda,%r11d,%edx
  add    $0x4,%rdi
  imul   $0x70,%r11d,%r11d
  imul   $0xffffffa2,%r8d,%r8d
  add    %r15d,%edx
  imul   $0x70,%esi,%r15d
  imul   $0xffffffee,%esi,%esi
  add    %r8d,%r11d
  lea    0x80(%rdx,%r15,1),%edx
  sar    $0x8,%edx
  lea    0x80(%r11,%rsi,1),%esi
  sub    $0xffffff80,%edx
  sar    $0x8,%esi
  mov    %edx,0x0(%r13,%r14,4)
  sub    $0xffffff80,%esi
  movslq %r12d,%rdx
  add    $0x1,%r12d
  mov    %esi,0x0(%r13,%rdx,4)
  cmp    %ecx,%r10d
  jne    L50
L24:
  add    %r10d,-0x10(%rsp)
  add    -0x8(%rsp),%rbp
  add    $0x1,%r9d
  cmp    %r9d,-0xc(%rsp)
  jne    L35
L26:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void _RGB8_to_YVU420(const uint8_t *rgb, int width, int height, uint8_t *yuv) {
  const uint8_t *rgb_current = rgb;
  int x, y, yi = 0;
  const int num_pixels = width * height;
  int vi = num_pixels;
  int ui = num_pixels + num_pixels / 4;
  for (y = 0; y < height; y++) {
    for (x = 0; x < width; x++) {
      const uint32_t b = rgb_current[0];
      const uint32_t g = rgb_current[1];
      const uint32_t r = rgb_current[2];
      rgb_current += 3;
      yuv[yi++] = (uint8_t)((66 * r + 129 * g + 25 * b + 128) >> 8) + 16;
      if ((x % 2) == 0 && (y % 2) == 0) {
        yuv[ui++] = (uint8_t)((-38 * r - 74 * g + 112 * b + 128) >> 8) + 128;
        yuv[vi++] = (uint8_t)((112 * r - 94 * g - 18 * b + 128) >> 8) + 128;
      }
    }
  }
}
```
user: What is the c source code of the assembly code below?

```asm
<ts_sub>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    %rsi,-0x10(%rbp)
  mov    -0x8(%rbp),%rax
  mov    0x8(%rax),%rdx
  mov    -0x10(%rbp),%rax
  mov    0x8(%rax),%rax
  sub    %rax,%rdx
  mov    -0x8(%rbp),%rax
  mov    %rdx,0x8(%rax)
  mov    -0x8(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x10(%rbp),%rax
  mov    (%rax),%rax
  sub    %rax,%rdx
  mov    -0x8(%rbp),%rax
  mov    %rdx,(%rax)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <ts_normalize@plt>
  nop
  leave
  ret
```

assistant: ```c
void ts_sub(struct timespec *const t, struct timespec const *const s) {
  t->tv_sec -= s->tv_sec;
  t->tv_nsec -= s->tv_nsec;
  ts_normalize(t);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<ts_sub>:
  endbr64
  sub    $0x8,%rsp
  mov    0x8(%rsi),%rax
  sub    %rax,0x8(%rdi)
  mov    (%rsi),%rax
  sub    %rax,(%rdi)
  call   <ts_normalize@plt>
  add    $0x8,%rsp
  ret
```

assistant: ```c
void ts_sub(struct timespec *const t, struct timespec const *const s) {
  t->tv_sec -= s->tv_sec;
  t->tv_nsec -= s->tv_nsec;
  ts_normalize(t);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<ts_sub>:
  endbr64
  mov    0x8(%rsi),%rax
  sub    %rax,0x8(%rdi)
  mov    (%rsi),%rax
  sub    %rax,(%rdi)
  jmp    1050 <ts_normalize@plt>
```

assistant: ```c
void ts_sub(struct timespec *const t, struct timespec const *const s) {
  t->tv_sec -= s->tv_sec;
  t->tv_nsec -= s->tv_nsec;
  ts_normalize(t);
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<ts_sub>:
  endbr64
  movdqu (%rsi),%xmm1
  movdqu (%rdi),%xmm0
  psubq  %xmm1,%xmm0
  movups %xmm0,(%rdi)
  jmp    1050 <ts_normalize@plt>
```

assistant: ```c
void ts_sub(struct timespec *const t, struct timespec const *const s) {
  t->tv_sec -= s->tv_sec;
  t->tv_nsec -= s->tv_nsec;
  ts_normalize(t);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<spaces>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %edi,-0x14(%rbp)
  mov    D54(%rip),%eax
  cmp    %eax,-0x14(%rbp)
  jle    L31
  mov    D6(%rip),%rax
  test   %rax,%rax
  je     L56
  mov    D6(%rip),%rax
  mov    %rax,%rdi
  call   <free@plt>
L56:
  mov    -0x14(%rbp),%eax
  add    $0x1,%eax
  cltq
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,D37(%rip)
  mov    D37(%rip),%rax
  test   %rax,%rax
  jne    L22
  mov    $0x0,%eax
  jmp    L38
L22:
  mov    D37(%rip),%rdx
  mov    -0x14(%rbp),%eax
  cltq
  lea    (%rdx,%rax,1),%rbx
  jmp    L34
L55:
  sub    $0x1,%rbx
  movb   $0x20,(%rbx)
L34:
  mov    D37(%rip),%rax
  cmp    %rax,%rbx
  jne    L55
  mov    -0x14(%rbp),%eax
  mov    %eax,D37(%rip)
  mov    D37(%rip),%rdx
  mov    -0x14(%rbp),%eax
  cltq
  add    %rdx,%rax
  movb   $0x0,(%rax)
L31:
  mov    D37(%rip),%rcx
  mov    D37(%rip),%eax
  cltq
  mov    -0x14(%rbp),%edx
  movslq %edx,%rdx
  sub    %rdx,%rax
  add    %rcx,%rax
L38:
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

assistant: ```c
const char *spaces(count)
int count;
{
  register char *t;
  static char *buf;
  static int maxsize;
  if (count > maxsize) {
    if (buf) {
      free(buf);
    }
    buf = malloc(count + 1);
    if (buf == (char *)0)
      return 0;
    for (t = buf + count; t != buf;) {
      *--t = ' ';
    }
    maxsize = count;
    buf[count] = '\0';
  }
  return (const char *)(buf + maxsize - count);
}
```