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

```asm
<rot13>:
  endbr64
  movzbl (%rdi),%eax
  test   %al,%al
  je     L33
  push   %rbp
  lea    D8(%rip),%rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x8,%rsp
  jmp    L29
  nopl   (%rax)
L61:
  cmp    $0x6d,%esi
  jle    L64
  lea    -0xd(%rsi),%eax
  cmp    $0x7b,%esi
  cmovl  %eax,%esi
L77:
  mov    %rbp,%rdi
  add    $0x1,%rbx
  call   <printf@plt>
  movzbl (%rbx),%eax
  test   %al,%al
  je     L60
L29:
  movsbl %al,%esi
  cmp    $0x60,%al
  jg     L61
  cmp    $0x40,%esi
  jle    L77
  cmp    $0x4d,%esi
  jle    L64
  lea    -0xd(%rsi),%eax
  cmp    $0x5b,%esi
  cmovl  %eax,%esi
  jmp    L77
  nopl   (%rax)
L64:
  add    $0xd,%esi
  jmp    L77
  nopl   (%rax)
L60:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
  nop
L33:
  ret
```

tool_calls: name: unpack_data
arguments: data_label: D8
type_infered: string

tool: D8: %c

assistant: ```c
void rot13(char *s) {
  char *p = s;
  while (*p) {
    int c = *p;
    if (c >= 'a') {
      if (c <= 'm') {
        c = c + 13;
      } else if (c <= 'z') {
        c = c - 13;
      }
    } else if (c >= 'A') {
      if (c <= 'M') {
        c = c + 13;
      } else if (c <= 'Z') {
        c = c - 13;
      }
    }
    printf("%c", c);
    p = p + 1;
  }
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<Scan_string>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    %rcx,-0x30(%rbp)
  movl   $0x1,-0x4(%rbp)
  jmp    L30
L38:
  mov    -0x4(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    -0x28(%rbp),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L11
  mov    -0x4(%rbp),%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  jmp    L5
L11:
  addl   $0x1,-0x4(%rbp)
L30:
  mov    -0x14(%rbp),%eax
  sub    $0x1,%eax
  cmp    %eax,-0x4(%rbp)
  jl     L38
  mov    -0x30(%rbp),%rax
L5:
  leave
  ret
```

assistant: ```c
char *Scan_string(int argc, char **argv, char *flag, char *value) {
  int i;
  for (i = 1; i < argc - 1; i++)
    if (strcmp(argv[i], flag) == 0)
      return (argv[i + 1]);
  return (value);
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<Scan_string>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rcx,%r14
  cmp    $0x2,%edi
  jle    L37
  mov    %rsi,%rbp
  mov    %rdx,%r12
  lea    -0x3(%rdi),%r13d
  add    $0x2,%r13
  mov    $0x1,%ebx
L34:
  mov    0x0(%rbp,%rbx,8),%rdi
  mov    %r12,%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L21
  add    $0x1,%rbx
  cmp    %r13,%rbx
  jne    L34
  jmp    L37
L21:
  mov    0x8(%rbp,%rbx,8),%r14
L37:
  mov    %r14,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

assistant: ```c
char *Scan_string(int argc, char **argv, char *flag, char *value) {
  int i;
  for (i = 1; i < argc - 1; i++)
    if (strcmp(argv[i], flag) == 0)
      return (argv[i + 1]);
  return (value);
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<Scan_string>:
  endbr64
  push   %r14
  push   %r13
  mov    %rcx,%r13
  push   %r12
  push   %rbp
  push   %rbx
  cmp    $0x2,%edi
  jle    L6
  lea    -0x3(%rdi),%r12d
  mov    %rsi,%r14
  mov    %rdx,%rbp
  mov    $0x1,%ebx
  add    $0x2,%r12
  jmp    L38
  nopl   0x0(%rax)
L13:
  add    $0x1,%rbx
  cmp    %r12,%rbx
  je     L6
L38:
  mov    (%r14,%rbx,8),%rdi
  mov    %rbp,%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L13
  mov    0x8(%r14,%rbx,8),%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   0x0(%rax,%rax,1)
L6:
  pop    %rbx
  mov    %r13,%rax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

assistant: ```c
char *Scan_string(int argc, char **argv, char *flag, char *value) {
  int i;
  for (i = 1; i < argc - 1; i++)
    if (strcmp(argv[i], flag) == 0)
      return (argv[i + 1]);
  return (value);
}
```
user: Translate the below assembly code into C programming language:

```asm
<Scan_string>:
  endbr64
  push   %r14
  push   %r13
  mov    %rcx,%r13
  push   %r12
  push   %rbp
  push   %rbx
  cmp    $0x2,%edi
  jle    L4
  lea    -0x3(%rdi),%r12d
  mov    %rsi,%r14
  mov    %rdx,%rbp
  mov    $0x1,%ebx
  add    $0x2,%r12
  jmp    L1
  nopl   0x0(%rax)
L37:
  add    $0x1,%rbx
  cmp    %r12,%rbx
  je     L4
L1:
  mov    (%r14,%rbx,8),%rdi
  mov    %rbp,%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L37
  mov    0x8(%r14,%rbx,8),%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   0x0(%rax,%rax,1)
L4:
  pop    %rbx
  mov    %r13,%rax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

assistant: ```c
char *Scan_string(int argc, char **argv, char *flag, char *value) {
  int i;
  for (i = 1; i < argc - 1; i++)
    if (strcmp(argv[i], flag) == 0)
      return (argv[i + 1]);
  return (value);
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<_increase_tknsize>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %rdx,-0x38(%rbp)
  movl   $0x0,-0x14(%rbp)
  movq   $0x0,-0x10(%rbp)
  mov    -0x28(%rbp),%rax
  shr    $0xc,%rax
  add    $0x1,%rax
  shl    $0xc,%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x30(%rbp),%rax
  mov    (%rax),%rax
  mov    -0x8(%rbp),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <realloc@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  jne    L7
  movl   $0x1,-0x14(%rbp)
  jmp    L3
L7:
  mov    -0x30(%rbp),%rax
  mov    -0x10(%rbp),%rdx
  mov    %rdx,(%rax)
  mov    -0x38(%rbp),%rax
  mov    -0x8(%rbp),%rdx
  mov    %rdx,(%rax)
L3:
  mov    -0x14(%rbp),%eax
  leave
  ret
```

assistant: ```c
int _increase_tknsize(size_t len, void **p, size_t *nlen) {
  int rc = 0;
  do {
    void *tp = NULL;
    size_t tlen = (len / (4 * 1024) + 1) * (4 * 1024);
    if (!(tp = realloc(*p, tlen))) {
      rc = 1;
      break;
    }
    *p = tp;
    *nlen = tlen;
  } while (0);
  return rc;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<_increase_tknsize>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rsi,%rbx
  mov    %rdx,%rbp
  and    $0xfffffffffffff000,%rdi
  lea    0x1000(%rdi),%r12
  mov    %r12,%rsi
  mov    (%rbx),%rdi
  call   <realloc@plt>
  test   %rax,%rax
  je     L4
  mov    %rax,(%rbx)
  mov    %r12,0x0(%rbp)
  mov    $0x0,%eax
L15:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L4:
  mov    $0x1,%eax
  jmp    L15
```

assistant: ```c
int _increase_tknsize(size_t len, void **p, size_t *nlen) {
  int rc = 0;
  do {
    void *tp = NULL;
    size_t tlen = (len / (4 * 1024) + 1) * (4 * 1024);
    if (!(tp = realloc(*p, tlen))) {
      rc = 1;
      break;
    }
    *p = tp;
    *nlen = tlen;
  } while (0);
  return rc;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<_increase_tknsize>:
  endbr64
  push   %r12
  and    $0xfffffffffffff000,%rdi
  push   %rbp
  lea    0x1000(%rdi),%r12
  mov    %rdx,%rbp
  push   %rbx
  mov    %rsi,%rbx
  mov    %r12,%rsi
  mov    (%rbx),%rdi
  call   <realloc@plt>
  test   %rax,%rax
  je     L16
  mov    %rax,(%rbx)
  xor    %eax,%eax
  mov    %r12,0x0(%rbp)
L6:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L16:
  mov    $0x1,%eax
  jmp    L6
```

assistant: ```c
int _increase_tknsize(size_t len, void **p, size_t *nlen) {
  int rc = 0;
  do {
    void *tp = NULL;
    size_t tlen = (len / (4 * 1024) + 1) * (4 * 1024);
    if (!(tp = realloc(*p, tlen))) {
      rc = 1;
      break;
    }
    *p = tp;
    *nlen = tlen;
  } while (0);
  return rc;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<_increase_tknsize>:
  endbr64
  push   %r12
  and    $0xfffffffffffff000,%rdi
  push   %rbp
  lea    0x1000(%rdi),%r12
  mov    %rdx,%rbp
  push   %rbx
  mov    %rsi,%rbx
  mov    %r12,%rsi
  mov    (%rbx),%rdi
  call   <realloc@plt>
  test   %rax,%rax
  je     L3
  mov    %rax,(%rbx)
  xor    %eax,%eax
  mov    %r12,0x0(%rbp)
L1:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L3:
  mov    $0x1,%eax
  jmp    L1
```

assistant: ```c
int _increase_tknsize(size_t len, void **p, size_t *nlen) {
  int rc = 0;
  do {
    void *tp = NULL;
    size_t tlen = (len / (4 * 1024) + 1) * (4 * 1024);
    if (!(tp = realloc(*p, tlen))) {
      rc = 1;
      break;
    }
    *p = tp;
    *nlen = tlen;
  } while (0);
  return rc;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  movl   $0x0,-0x4(%rbp)
  jmp    L38
L7:
  mov    -0x4(%rbp),%eax
  and    $0x1,%eax
  test   %eax,%eax
  jne    L20
  mov    -0x4(%rbp),%eax
  imul   %eax,%eax
  mov    %eax,%ecx
  mov    -0x4(%rbp),%edx
  mov    -0x4(%rbp),%eax
  mov    %eax,%esi
  lea    D7(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  jmp    L35
L20:
  nop
L35:
  addl   $0x1,-0x4(%rbp)
L38:
  cmpl   $0x63,-0x4(%rbp)
  jle    L7
  mov    $0x0,%eax
  leave
  ret
```

tool_calls: name: parse_data
arguments: label: D7
type_infered: string

tool: D7: %d*%d=%d


assistant: ```c
int main() {
  int i = 0;
  for (; i < 100; i++) {
    if (i % 2) {
      continue;
    }
    printf("%d*%d=%d\n", i, i, i * i);
  }
  return 0;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<main>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    $0x0,%ebx
  lea    D4(%rip),%rbp
  jmp    L17
L23:
  add    $0x1,%ebx
  cmp    $0x64,%ebx
  je     L20
L17:
  test   $0x1,%bl
  jne    L23
  mov    %ebx,%ecx
  imul   %ebx,%ecx
  mov    %ebx,%edx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  call   <printf@plt>
  jmp    L23
L20:
  mov    $0x0,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

tool_calls: name: unpack_data
arguments: label: D4
type: string

tool: D4: %d*%d=%d


assistant: ```c
int main() {
  int i = 0;
  for (; i < 100; i++) {
    if (i % 2) {
      continue;
    }
    printf("%d*%d=%d\n", i, i, i * i);
  }
  return 0;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<main>:
  endbr64
  push   %rbp
  lea    D4(%rip),%rbp
  push   %rbx
  xor    %ebx,%ebx
  sub    $0x8,%rsp
  nopl   0x0(%rax,%rax,1)
L12:
  test   $0x1,%bl
  jne    L1
  mov    %ebx,%ecx
  mov    %ebx,%edx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  imul   %ebx,%ecx
  call   <printf@plt>
L1:
  add    $0x1,%ebx
  cmp    $0x64,%ebx
  jne    L12
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  ret
```

tool_calls: name: extract_symbolic_data
arguments: label: D4
type_guessed: string

tool: D4: %d*%d=%d


assistant: ```c
int main() {
  int i = 0;
  for (; i < 100; i++) {
    if (i % 2) {
      continue;
    }
    printf("%d*%d=%d\n", i, i, i * i);
  }
  return 0;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<main>:
  endbr64
  push   %rbp
  lea    D1(%rip),%rbp
  push   %rbx
  xor    %ebx,%ebx
  sub    $0x8,%rsp
  nopl   0x0(%rax,%rax,1)
L4:
  test   $0x1,%bl
  jne    L16
  mov    %ebx,%ecx
  mov    %ebx,%edx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  imul   %ebx,%ecx
  call   <printf@plt>
L16:
  add    $0x1,%ebx
  cmp    $0x64,%ebx
  jne    L4
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  ret
```

tool_calls: name: disassemble_data
arguments: data_label: D1
type_guessed: string

tool: D1: %d*%d=%d


assistant: ```c
int main() {
  int i = 0;
  for (; i < 100; i++) {
    if (i % 2) {
      continue;
    }
    printf("%d*%d=%d\n", i, i, i * i);
  }
  return 0;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x4(%rbp)
  mov    %rsi,-0x10(%rbp)
  mov    D9(%rip),%rax
  mov    (%rax),%eax
  pop    %rbp
  ret
```

assistant: ```c
int main(int argc, char **argv) {
  return EXIT_FAILURE;
  return EXIT_SUCCESS;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<main>:
  endbr64
  mov    D0(%rip),%rax
  mov    (%rax),%eax
  ret
```

assistant: ```c
int main(int argc, char **argv) {
  return EXIT_FAILURE;
  return EXIT_SUCCESS;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<main>:
  endbr64
  mov    D3(%rip),%rax
  mov    (%rax),%eax
  ret
```

assistant: ```c
int main(int argc, char **argv) {
  return EXIT_FAILURE;
  return EXIT_SUCCESS;
}
```
user: Translate the below assembly code into C programming language:

```asm
<main>:
  endbr64
  mov    D1(%rip),%rax
  mov    (%rax),%eax
  ret
```

assistant: ```c
int main(int argc, char **argv) {
  return EXIT_FAILURE;
  return EXIT_SUCCESS;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    $0x0,%eax
  call   <check_vect@plt>
  mov    $0x80,%edi
  call   <main1@plt>
  pop    %rbp
  ret
```

assistant: ```c
int main(void) {
  check_vect();
  return main1(128);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x0,%eax
  call   <check_vect@plt>
  mov    $0x80,%edi
  call   <main1@plt>
  add    $0x8,%rsp
  ret
```

assistant: ```c
int main(void) {
  check_vect();
  return main1(128);
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  xor    %eax,%eax
  call   <check_vect@plt>
  mov    $0x80,%edi
  add    $0x8,%rsp
  jmp    1060 <main1@plt>
```

assistant: ```c
int main(void) {
  check_vect();
  return main1(128);
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  xor    %eax,%eax
  call   <check_vect@plt>
  mov    $0x80,%edi
  add    $0x8,%rsp
  jmp    1060 <main1@plt>
```

assistant: ```c
int main(void) {
  check_vect();
  return main1(128);
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<osdGridBufferConstrainRect>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    %rcx,-0x30(%rbp)
  mov    %r8d,-0x34(%rbp)
  mov    %r9d,-0x38(%rbp)
  mov    -0x28(%rbp),%rax
  mov    (%rax),%eax
  test   %eax,%eax
  jns    L30
  mov    -0x18(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x28(%rbp),%rax
  mov    (%rax),%eax
  add    %eax,%edx
  mov    -0x18(%rbp),%rax
  mov    %edx,(%rax)
  mov    -0x28(%rbp),%rax
  mov    (%rax),%eax
  neg    %eax
  mov    %eax,%edx
  mov    -0x28(%rbp),%rax
  mov    %edx,(%rax)
L30:
  mov    -0x30(%rbp),%rax
  mov    (%rax),%eax
  test   %eax,%eax
  jns    L56
  mov    -0x20(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x30(%rbp),%rax
  mov    (%rax),%eax
  add    %eax,%edx
  mov    -0x20(%rbp),%rax
  mov    %edx,(%rax)
  mov    -0x30(%rbp),%rax
  mov    (%rax),%eax
  neg    %eax
  mov    %eax,%edx
  mov    -0x30(%rbp),%rax
  mov    %edx,(%rax)
L56:
  mov    -0x18(%rbp),%rax
  mov    (%rax),%eax
  test   %eax,%eax
  jns    L22
  mov    -0x28(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x18(%rbp),%rax
  mov    (%rax),%eax
  sub    %eax,%edx
  mov    -0x28(%rbp),%rax
  mov    %edx,(%rax)
  mov    -0x18(%rbp),%rax
  movl   $0x0,(%rax)
L22:
  mov    -0x20(%rbp),%rax
  mov    (%rax),%eax
  test   %eax,%eax
  jns    L58
  mov    -0x30(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x20(%rbp),%rax
  mov    (%rax),%eax
  add    %eax,%edx
  mov    -0x30(%rbp),%rax
  mov    %edx,(%rax)
  mov    -0x20(%rbp),%rax
  movl   $0x0,(%rax)
L58:
  mov    -0x18(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x28(%rbp),%rax
  mov    (%rax),%eax
  add    %edx,%eax
  mov    %eax,-0x10(%rbp)
  mov    -0x10(%rbp),%eax
  sub    -0x34(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0xc(%rbp)
  cmpl   $0x0,-0xc(%rbp)
  jle    L44
  mov    -0x28(%rbp),%rax
  mov    (%rax),%eax
  sub    -0xc(%rbp),%eax
  mov    %eax,%edx
  mov    -0x28(%rbp),%rax
  mov    %edx,(%rax)
L44:
  mov    -0x20(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x30(%rbp),%rax
  mov    (%rax),%eax
  add    %edx,%eax
  mov    %eax,-0x8(%rbp)
  mov    -0x8(%rbp),%eax
  sub    -0x38(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x4(%rbp)
  cmpl   $0x0,-0x4(%rbp)
  jle    L55
  mov    -0x30(%rbp),%rax
  mov    (%rax),%eax
  sub    -0x4(%rbp),%eax
  mov    %eax,%edx
  mov    -0x30(%rbp),%rax
  mov    %edx,(%rax)
L55:
  nop
  pop    %rbp
  ret
```

assistant: ```c
void osdGridBufferConstrainRect(int *x, int *y, int *w, int *h, int totalWidth, int totalHeight) {
  if (*w < 0) {
    *x += *w;
    *w = -*w;
  }
  if (*h < 0) {
    *y += *h;
    *h = -*h;
  }
  if (*x < 0) {
    *w -= *x;
    *x = 0;
  }
  if (*y < 0) {
    *h += *y;
    *y = 0;
  }
  int maxX = *x + *w;
  int extraWidth = maxX - totalWidth + 1;
  if (extraWidth > 0) {
    *w -= extraWidth;
  }
  int maxY = *y + *h;
  int extraHeight = maxY - totalHeight + 1;
  if (extraHeight > 0) {
    *h -= extraHeight;
  }
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<osdGridBufferConstrainRect>:
  endbr64
  mov    %rcx,%rax
  mov    (%rdx),%ecx
  test   %ecx,%ecx
  js     L13
L38:
  mov    (%rax),%ecx
  test   %ecx,%ecx
  js     L23
L58:
  mov    (%rdi),%ecx
  test   %ecx,%ecx
  js     L4
L12:
  mov    (%rsi),%ecx
  test   %ecx,%ecx
  js     L83
L15:
  mov    (%rdx),%r10d
  mov    %r10d,%ecx
  add    (%rdi),%ecx
  sub    %r8d,%ecx
  add    $0x1,%ecx
  test   %ecx,%ecx
  jle    L2
  sub    %ecx,%r10d
  mov    %r10d,(%rdx)
L2:
  mov    (%rax),%ecx
  mov    %ecx,%edx
  add    (%rsi),%edx
  sub    %r9d,%edx
  add    $0x1,%edx
  test   %edx,%edx
  jle    L64
  sub    %edx,%ecx
  mov    %ecx,(%rax)
L64:
  ret
L13:
  add    %ecx,(%rdi)
  negl   (%rdx)
  jmp    L38
L23:
  add    %ecx,(%rsi)
  negl   (%rax)
  jmp    L58
L4:
  sub    %ecx,(%rdx)
  movl   $0x0,(%rdi)
  jmp    L12
L83:
  add    %ecx,(%rax)
  movl   $0x0,(%rsi)
  jmp    L15
```

assistant: ```c
void osdGridBufferConstrainRect(int *x, int *y, int *w, int *h, int totalWidth, int totalHeight) {
  if (*w < 0) {
    *x += *w;
    *w = -*w;
  }
  if (*h < 0) {
    *y += *h;
    *h = -*h;
  }
  if (*x < 0) {
    *w -= *x;
    *x = 0;
  }
  if (*y < 0) {
    *h += *y;
    *y = 0;
  }
  int maxX = *x + *w;
  int extraWidth = maxX - totalWidth + 1;
  if (extraWidth > 0) {
    *w -= extraWidth;
  }
  int maxY = *y + *h;
  int extraHeight = maxY - totalHeight + 1;
  if (extraHeight > 0) {
    *h -= extraHeight;
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<osdGridBufferConstrainRect>:
  endbr64
  mov    %rcx,%rax
  mov    (%rdx),%ecx
  test   %ecx,%ecx
  jns    L26
  add    %ecx,(%rdi)
  negl   (%rdx)
L26:
  mov    (%rax),%ecx
  test   %ecx,%ecx
  jns    L56
  add    %ecx,(%rsi)
  negl   (%rax)
L56:
  mov    (%rdi),%ecx
  test   %ecx,%ecx
  jns    L38
  sub    %ecx,(%rdx)
  movl   $0x0,(%rdi)
L38:
  mov    (%rsi),%ecx
  test   %ecx,%ecx
  jns    L22
  add    %ecx,(%rax)
  movl   $0x0,(%rsi)
L22:
  mov    (%rdx),%r10d
  mov    (%rdi),%ecx
  add    %r10d,%ecx
  sub    %r8d,%ecx
  add    $0x1,%ecx
  test   %ecx,%ecx
  jle    L14
  sub    %ecx,%r10d
  mov    %r10d,(%rdx)
L14:
  mov    (%rax),%ecx
  mov    (%rsi),%edx
  add    %ecx,%edx
  sub    %r9d,%edx
  add    $0x1,%edx
  test   %edx,%edx
  jle    L12
  sub    %edx,%ecx
  mov    %ecx,(%rax)
L12:
  ret
```

assistant: ```c
void osdGridBufferConstrainRect(int *x, int *y, int *w, int *h, int totalWidth, int totalHeight) {
  if (*w < 0) {
    *x += *w;
    *w = -*w;
  }
  if (*h < 0) {
    *y += *h;
    *h = -*h;
  }
  if (*x < 0) {
    *w -= *x;
    *x = 0;
  }
  if (*y < 0) {
    *h += *y;
    *y = 0;
  }
  int maxX = *x + *w;
  int extraWidth = maxX - totalWidth + 1;
  if (extraWidth > 0) {
    *w -= extraWidth;
  }
  int maxY = *y + *h;
  int extraHeight = maxY - totalHeight + 1;
  if (extraHeight > 0) {
    *h -= extraHeight;
  }
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<osdGridBufferConstrainRect>:
  endbr64
  mov    (%rdx),%eax
  mov    %rdi,%r10
  mov    %rsi,%rdi
  mov    %rdx,%rsi
  test   %eax,%eax
  jns    L58
  add    %eax,(%r10)
  negl   (%rdx)
L58:
  mov    (%rcx),%eax
  test   %eax,%eax
  jns    L36
  add    %eax,(%rdi)
  negl   (%rcx)
L36:
  mov    (%r10),%edx
  test   %edx,%edx
  jns    L34
  sub    %edx,(%rsi)
  xor    %edx,%edx
  movl   $0x0,(%r10)
L34:
  mov    (%rdi),%eax
  test   %eax,%eax
  jns    L53
  add    %eax,(%rcx)
  xor    %eax,%eax
  movl   $0x0,(%rdi)
  mov    (%r10),%edx
L53:
  mov    (%rsi),%r10d
  add    %r10d,%edx
  sub    %r8d,%edx
  add    $0x1,%edx
  test   %edx,%edx
  jle    L13
  sub    %edx,%r10d
  mov    %r10d,(%rsi)
  mov    (%rdi),%eax
L13:
  mov    (%rcx),%edx
  add    %edx,%eax
  sub    %r9d,%eax
  add    $0x1,%eax
  test   %eax,%eax
  jle    L8
  sub    %eax,%edx
  mov    %edx,(%rcx)
L8:
  ret
```

assistant: ```c
void osdGridBufferConstrainRect(int *x, int *y, int *w, int *h, int totalWidth, int totalHeight) {
  if (*w < 0) {
    *x += *w;
    *w = -*w;
  }
  if (*h < 0) {
    *y += *h;
    *h = -*h;
  }
  if (*x < 0) {
    *w -= *x;
    *x = 0;
  }
  if (*y < 0) {
    *h += *y;
    *y = 0;
  }
  int maxX = *x + *w;
  int extraWidth = maxX - totalWidth + 1;
  if (extraWidth > 0) {
    *w -= extraWidth;
  }
  int maxY = *y + *h;
  int extraHeight = maxY - totalHeight + 1;
  if (extraHeight > 0) {
    *h -= extraHeight;
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<yesno>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    D16(%rip),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L223
  mov    D16(%rip),%rax
  mov    %rax,-0x10(%rbp)
  jmp    L78
L89:
  mov    -0x10(%rbp),%rax
  mov    $0x27,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  je     L122
  mov    -0x8(%rbp),%rax
  sub    -0x10(%rbp),%rax
  mov    %eax,%edx
  mov    -0x10(%rbp),%rcx
  mov    -0x18(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  jne    L101
  mov    $0x1,%eax
  jmp    L69
L101:
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,-0x10(%rbp)
L78:
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L89
  jmp    L223
L122:
  nop
L223:
  mov    D33(%rip),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L11
  mov    D33(%rip),%rax
  mov    %rax,-0x10(%rbp)
  jmp    L190
L55:
  mov    -0x10(%rbp),%rax
  mov    $0x27,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  je     L105
  mov    -0x8(%rbp),%rax
  sub    -0x10(%rbp),%rax
  mov    %eax,%edx
  mov    -0x10(%rbp),%rcx
  mov    -0x18(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  jne    L46
  mov    $0x0,%eax
  jmp    L69
L46:
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,-0x10(%rbp)
L190:
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L55
  jmp    L11
L105:
  nop
L11:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x31,%al
  je     L189
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x79,%al
  je     L189
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x59,%al
  je     L189
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x74,%al
  je     L189
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x54,%al
  je     L189
  mov    -0x18(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x6e,%al
  jne    L141
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x6f,%al
  je     L189
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x4f,%al
  jne    L141
L189:
  mov    $0x1,%eax
  jmp    L69
L141:
  mov    $0x0,%eax
L69:
  leave
  ret
```

assistant: ```c
int yesno(char *value) {
  extern char yes_chars[];
  extern char no_chars[];
  char *p, *p2;
  if (*yes_chars) {
    p = yes_chars;
    while (*p) {
      if (!(p2 = strchr(p, '\'')))
        break;
      if (!strncmp(value, p, (int)(p2 - p)))
        return 1;
      p = p2 + 1;
    }
  }
  if (*no_chars) {
    p = no_chars;
    while (*p) {
      if (!(p2 = strchr(p, '\'')))
        break;
      if (!strncmp(value, p, (int)(p2 - p)))
        return 0;
      p = p2 + 1;
    }
  }
  if ((value[0] == '1') || (value[0] == 'y') || (value[0] == 'Y') || (value[0] == 't') || (value[0] == 'T') || ((value[1] == 'n') && ((value[0] == 'o') || (value[0] == 'O'))))
    return 1;
  else
    return 0;
}
```