ylfeng/ReF-Decompile-dataset huggingface dataset:
user: What would the C source look like for the assembly code provided here:

```asm
<escape_json_attr>:
  endbr64
  push   %r15
  push   %r14
  mov    %rdx,%r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  test   %esi,%esi
  jle    L96
  movslq %esi,%rsi
  mov    %rdi,%r15
  lea    D38(%rip),%r13
  lea    (%rdi,%rsi,1),%rbx
  lea    D1(%rip),%r12
  lea    D6(%rip),%rbp
  jmp    L147
  nopw   0x0(%rax,%rax,1)
L91:
  cmp    $0xa,%cl
  jne    L65
  mov    %r14,%rdi
  mov    $0x2,%edx
  lea    D2(%rip),%rsi
  add    $0x2,%r14
  call   <memcpy@plt>
L81:
  add    $0x1,%r15
  cmp    %r15,%rbx
  je     L96
L147:
  movzbl (%r15),%ecx
  cmp    $0x22,%cl
  je     L117
  jg     L126
  cmp    $0x9,%cl
  jne    L91
  mov    %r14,%rdi
  mov    $0x2,%edx
  mov    %rbp,%rsi
  add    $0x1,%r15
  call   <memcpy@plt>
  add    $0x2,%r14
  cmp    %r15,%rbx
  jne    L147
L96:
  movb   $0x0,(%r14)
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L126:
  cmp    $0x5c,%cl
  jne    L65
  mov    %r14,%rdi
  mov    $0x2,%edx
  mov    %r12,%rsi
  add    $0x2,%r14
  call   <memcpy@plt>
  jmp    L81
  nopl   0x0(%rax,%rax,1)
L117:
  mov    %r14,%rdi
  mov    $0x2,%edx
  mov    %r13,%rsi
  add    $0x2,%r14
  call   <memcpy@plt>
  jmp    L81
  nopl   0x0(%rax)
L65:
  cmp    $0x1f,%cl
  jbe    L137
  cmp    $0x7f,%cl
  je     L137
  mov    %cl,(%r14)
  add    $0x1,%r14
  jmp    L81
  cs nopw 0x0(%rax,%rax,1)
L137:
  mov    %r14,%rdi
  lea    D13(%rip),%rdx
  mov    $0x7,%esi
  add    $0x6,%r14
  call   <snprintf@plt>
  jmp    L81
```

tool_calls: name: read_data
arguments: data_label: D38
data_type: string
name: read_data
arguments: data_label: D1
data_type: string
name: read_data
arguments: data_label: D6
data_type: string
name: read_data
arguments: data_label: D2
data_type: string
name: read_data
arguments: data_label: D13
data_type: string

tool: D38: \"

tool: D1: \\

tool: D6: \t

tool: D2: \n

tool: D13: \u%04x

assistant: ```c
void escape_json_attr(const char *buf, int src_len, char *out) {
  char *o = out;
  const char *b;
  int i;
  for (i = 0, b = buf; i < src_len; ++i, ++b) {
    unsigned char c = *b;
    switch (c) {
    case '"':
      memcpy(o, "\\\"", ((sizeof("\\\"") / sizeof("\\\""[0])) - 1));
      o += ((sizeof("\\\"") / sizeof("\\\""[0])) - 1);
      break;
    case '\\':
      memcpy(o, "\\\\", ((sizeof("\\\\") / sizeof("\\\\"[0])) - 1));
      o += ((sizeof("\\\\") / sizeof("\\\\"[0])) - 1);
      break;
    case '\t':
      memcpy(o, "\\t", ((sizeof("\\t") / sizeof("\\t"[0])) - 1));
      o += ((sizeof("\\t") / sizeof("\\t"[0])) - 1);
      break;
    case '\n':
      memcpy(o, "\\n", ((sizeof("\\n") / sizeof("\\n"[0])) - 1));
      o += ((sizeof("\\n") / sizeof("\\n"[0])) - 1);
      break;
    default:
      if ((c < 0x20) || (c == 0x7f)) {
        snprintf(o, 7, "\\u%04x", c);
        o += 6;
      } else {
        *o++ = c;
      }
      break;
    }
  }
  *o = '\0';
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<output>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0xd0,%rsp
  mov    %rdx,-0xd0(%rbp)
  mov    %rcx,-0x98(%rbp)
  mov    %r8,-0x90(%rbp)
  mov    %r9,-0x88(%rbp)
  test   %al,%al
  je     L16
  movaps %xmm0,-0x80(%rbp)
  movaps %xmm1,-0x70(%rbp)
  movaps %xmm2,-0x60(%rbp)
  movaps %xmm3,-0x50(%rbp)
  movaps %xmm4,-0x40(%rbp)
  movaps %xmm5,-0x30(%rbp)
  movaps %xmm6,-0x20(%rbp)
  movaps %xmm7,-0x10(%rbp)
L16:
  mov    %edi,%eax
  mov    %al,-0xc4(%rbp)
  mov    %esi,%eax
  mov    %al,-0xc8(%rbp)
  movl   $0x0,-0xb8(%rbp)
  movzbl -0xc4(%rbp),%eax
  and    -0xc8(%rbp),%al
  test   %al,%al
  je     L10
  movl   $0x1,-0xb8(%rbp)
  mov    -0xd0(%rbp),%rdx
  mov    -0xb4(%rbp),%eax
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <va_start@plt>
  mov    -0xb4(%rbp),%edx
  mov    -0xd0(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <vprintf@plt>
  mov    -0xb4(%rbp),%eax
  mov    %eax,%edi
  call   <va_end@plt>
L10:
  mov    -0xb8(%rbp),%eax
  leave
  ret
```

assistant: ```c
int output(char id, char maschera, const char *formato, ...) {
  int ret = 0;
  va_list lista;
  if (id & maschera) {
    ret = 1;
    va_start(lista, formato);
    vprintf(formato, lista);
    va_end(lista);
  }
  return ret;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<output>:
  endbr64
  mov    $0x0,%eax
  test   %dil,%sil
  jne    L6
  ret
L6:
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdx,%rbx
  mov    %rdx,%rsi
  mov    $0x0,%ebp
  mov    %ebp,%edi
  call   <va_start@plt>
  mov    %ebp,%esi
  mov    %rbx,%rdi
  call   <vprintf@plt>
  mov    %ebp,%edi
  call   <va_end@plt>
  mov    $0x1,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
int output(char id, char maschera, const char *formato, ...) {
  int ret = 0;
  va_list lista;
  if (id & maschera) {
    ret = 1;
    va_start(lista, formato);
    vprintf(formato, lista);
    va_end(lista);
  }
  return ret;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<output>:
  endbr64
  test   %dil,%sil
  jne    L1
  xor    %eax,%eax
  ret
  nopl   0x0(%rax)
L1:
  push   %r12
  xor    %r12d,%r12d
  mov    %rdx,%rsi
  push   %rbp
  mov    %r12d,%edi
  mov    %rdx,%rbp
  sub    $0x8,%rsp
  call   <va_start@plt>
  mov    %r12d,%esi
  mov    %rbp,%rdi
  call   <vprintf@plt>
  mov    %r12d,%edi
  call   <va_end@plt>
  add    $0x8,%rsp
  mov    $0x1,%eax
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
int output(char id, char maschera, const char *formato, ...) {
  int ret = 0;
  va_list lista;
  if (id & maschera) {
    ret = 1;
    va_start(lista, formato);
    vprintf(formato, lista);
    va_end(lista);
  }
  return ret;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<output>:
  endbr64
  test   %dil,%sil
  jne    L8
  xor    %eax,%eax
  ret
  nopl   0x0(%rax)
L8:
  push   %r12
  xor    %r12d,%r12d
  mov    %rdx,%rsi
  push   %rbp
  mov    %r12d,%edi
  mov    %rdx,%rbp
  sub    $0x8,%rsp
  call   <va_start@plt>
  mov    %r12d,%esi
  mov    %rbp,%rdi
  call   <vprintf@plt>
  mov    %r12d,%edi
  call   <va_end@plt>
  add    $0x8,%rsp
  mov    $0x1,%eax
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
int output(char id, char maschera, const char *formato, ...) {
  int ret = 0;
  va_list lista;
  if (id & maschera) {
    ret = 1;
    va_start(lista, formato);
    vprintf(formato, lista);
    va_end(lista);
  }
  return ret;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<rkchunk>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  movl   $0x0,-0xc(%rbp)
  mov    D20(%rip),%eax
  test   %eax,%eax
  jne    L118
  movl   $0x1f,D20(%rip)
  movl   $0x1,-0x4(%rbp)
  movl   $0x0,-0x10(%rbp)
  jmp    L102
L39:
  mov    D20(%rip),%eax
  mov    -0x4(%rbp),%edx
  imul   %edx,%eax
  mov    %eax,-0x4(%rbp)
  addl   $0x1,-0x10(%rbp)
L102:
  cmpl   $0x1e,-0x10(%rbp)
  jle    L39
  movl   $0x0,-0x10(%rbp)
  jmp    L11
L97:
  mov    -0x10(%rbp),%eax
  imul   -0x4(%rbp),%eax
  mov    -0x10(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  lea    D46(%rip),%rdx
  mov    %eax,(%rcx,%rdx,1)
  addl   $0x1,-0x10(%rbp)
L11:
  cmpl   $0xff,-0x10(%rbp)
  jle    L97
L118:
  movl   $0x0,-0x8(%rbp)
  jmp    L89
L100:
  mov    D20(%rip),%eax
  imul   -0xc(%rbp),%eax
  mov    %eax,%edx
  mov    -0x8(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x18(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%rax
  add    %edx,%eax
  mov    %eax,-0xc(%rbp)
  addl   $0x1,-0x8(%rbp)
L89:
  cmpl   $0x1f,-0x8(%rbp)
  jg     L62
  mov    -0x8(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jl     L100
  jmp    L62
L70:
  mov    -0x8(%rbp),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x100(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  lea    0x0(,%rax,4),%rdx
  lea    D46(%rip),%rax
  mov    (%rdx,%rax,1),%ecx
  mov    -0xc(%rbp),%eax
  sub    %ecx,%eax
  mov    %eax,%edx
  mov    D20(%rip),%eax
  imul   %edx,%eax
  mov    %eax,%ecx
  mov    -0x8(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  add    %ecx,%eax
  mov    %eax,-0xc(%rbp)
  addl   $0x1,-0x8(%rbp)
  cmpl   $0x7ff,-0x8(%rbp)
  jle    L34
  mov    -0xc(%rbp),%eax
  cltd
  shr    $0x14,%edx
  add    %edx,%eax
  and    $0xfff,%eax
  sub    %edx,%eax
  cmp    $0x1,%eax
  je     L125
L34:
  cmpl   $0x1fff,-0x8(%rbp)
  jle    L62
L125:
  mov    -0x8(%rbp),%eax
  cltq
  jmp    L112
L62:
  mov    -0x8(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jl     L70
  mov    -0x8(%rbp),%eax
  cltq
L112:
  pop    %rbp
  ret
```

assistant: ```c
size_t rkchunk(uint8_t *buf, uint64_t len) {
  int i;
  uint64_t hash = 0;
  uint64_t off;
  uint64_t b_n;
  static uint64_t b = 0;
  static uint64_t saved[256];
  if (!b) {
    b = 31;
    b_n = 1;
    for (i = 0; i < (32 - 1); i++) {
      b_n *= b;
    }
    for (i = 0; i < 256; i++) {
      saved[i] = i * b_n;
    }
  }
  for (off = 0; (off < 32) && (off < len); off++) {
    hash = hash * b + (uint64_t)buf[off];
  }
  while (off < len) {
    hash = (hash - saved[buf[off - 32]]) * b + buf[off];
    off++;
    if (((off >= 2048) && ((hash % 4096) == 1)) || (off >= 8192))
      return off;
  }
  return off;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<rkchunk>:
  endbr64
  mov    %rdi,%r8
  mov    %esi,%edi
  cmpl   $0x0,D20(%rip)
  jne    L84
  movl   $0x1f,D20(%rip)
  mov    $0x1f,%edx
  mov    $0x1,%ecx
L3:
  mov    %ecx,%eax
  shl    $0x5,%eax
  sub    %ecx,%eax
  mov    %eax,%ecx
  sub    $0x1,%edx
  jne    L3
  lea    D25(%rip),%rax
  lea    0x400(%rax),%rsi
L26:
  mov    %edx,(%rax)
  add    %ecx,%edx
  add    $0x4,%rax
  cmp    %rsi,%rax
  jne    L26
L84:
  test   %edi,%edi
  jle    L96
  mov    D20(%rip),%r9d
  mov    $0x1,%edx
  mov    $0x0,%ecx
L1:
  imul   %r9d,%ecx
  add    -0x8(%r8,%rdx,8),%ecx
  mov    %edx,%eax
  add    $0x1,%rdx
  cmp    $0x1f,%eax
  jg     L8
  cmp    %eax,%edi
  jg     L1
L8:
  movslq %eax,%rdx
  lea    (%r8,%rdx,8),%rsi
  lea    D25(%rip),%r10
  jmp    L28
L103:
  add    $0x8,%rsi
  cmp    $0x1fff,%eax
  jg     L100
L28:
  cmp    %edi,%eax
  jge    L56
  mov    -0x100(%rsi),%rdx
  sub    (%r10,%rdx,4),%ecx
  mov    %ecx,%edx
  imul   %r9d,%edx
  add    (%rsi),%edx
  mov    %edx,%ecx
  add    $0x1,%eax
  cmp    $0x7ff,%eax
  jle    L103
  mov    %edx,%r8d
  sar    $0x1f,%r8d
  shr    $0x14,%r8d
  add    %r8d,%edx
  and    $0xfff,%edx
  sub    %r8d,%edx
  cmp    $0x1,%edx
  jne    L103
L100:
  cltq
  ret
L96:
  mov    $0x0,%eax
L56:
  cltq
  ret
```

assistant: ```c
size_t rkchunk(uint8_t *buf, uint64_t len) {
  int i;
  uint64_t hash = 0;
  uint64_t off;
  uint64_t b_n;
  static uint64_t b = 0;
  static uint64_t saved[256];
  if (!b) {
    b = 31;
    b_n = 1;
    for (i = 0; i < (32 - 1); i++) {
      b_n *= b;
    }
    for (i = 0; i < 256; i++) {
      saved[i] = i * b_n;
    }
  }
  for (off = 0; (off < 32) && (off < len); off++) {
    hash = hash * b + (uint64_t)buf[off];
  }
  while (off < len) {
    hash = (hash - saved[buf[off - 32]]) * b + buf[off];
    off++;
    if (((off >= 2048) && ((hash % 4096) == 1)) || (off >= 8192))
      return off;
  }
  return off;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<rkchunk>:
  endbr64
  mov    D2(%rip),%eax
  mov    %esi,%r8d
  test   %eax,%eax
  jne    L39
  movl   $0x1f,D2(%rip)
  mov    $0x1f,%edx
  mov    $0x1,%eax
  nopl   (%rax)
L64:
  mov    %eax,%ecx
  shl    $0x5,%ecx
  sub    %eax,%ecx
  mov    %ecx,%eax
  sub    $0x1,%edx
  jne    L64
  lea    D43(%rip),%rax
  lea    0x400(%rax),%rsi
  nopl   0x0(%rax)
L112:
  mov    %edx,(%rax)
  add    $0x4,%rax
  add    %ecx,%edx
  cmp    %rax,%rsi
  jne    L112
L39:
  test   %r8d,%r8d
  jle    L61
  mov    D2(%rip),%r9d
  mov    $0x1,%eax
  xor    %edx,%edx
  nopl   0x0(%rax)
L116:
  mov    %eax,%r10d
  imul   %r9d,%edx
  mov    %eax,%esi
  add    -0x8(%rdi,%rax,8),%edx
  add    $0x1,%rax
  cmp    $0x1f,%r10d
  jg     L69
  cmp    %r10d,%r8d
  jg     L116
L69:
  cmp    %esi,%r8d
  jle    L41
  lea    0x1(%rsi),%ecx
  sub    $0x1,%r8d
  add    $0x2,%esi
  sub    %r10d,%r8d
  movslq %esi,%rsi
  movslq %ecx,%rcx
  add    %r8,%rsi
  lea    D43(%rip),%r8
  jmp    L97
L95:
  add    $0x1,%rcx
  cmp    %rcx,%rsi
  je     L52
L97:
  mov    -0x108(%rdi,%rcx,8),%rax
  sub    (%r8,%rax,4),%edx
  movslq %ecx,%rax
  imul   %r9d,%edx
  add    -0x8(%rdi,%rcx,8),%edx
  cmp    $0x7ff,%ecx
  jle    L95
  mov    %edx,%r10d
  and    $0x80000fff,%r10d
  cmp    $0x1,%r10d
  je     L52
  cmp    $0x2000,%eax
  jne    L95
  mov    $0x2000,%eax
  ret
  nopl   (%rax)
L52:
  ret
L61:
  xor    %eax,%eax
  ret
L41:
  movslq %esi,%rax
  ret
```

assistant: ```c
size_t rkchunk(uint8_t *buf, uint64_t len) {
  int i;
  uint64_t hash = 0;
  uint64_t off;
  uint64_t b_n;
  static uint64_t b = 0;
  static uint64_t saved[256];
  if (!b) {
    b = 31;
    b_n = 1;
    for (i = 0; i < (32 - 1); i++) {
      b_n *= b;
    }
    for (i = 0; i < 256; i++) {
      saved[i] = i * b_n;
    }
  }
  for (off = 0; (off < 32) && (off < len); off++) {
    hash = hash * b + (uint64_t)buf[off];
  }
  while (off < len) {
    hash = (hash - saved[buf[off - 32]]) * b + buf[off];
    off++;
    if (((off >= 2048) && ((hash % 4096) == 1)) || (off >= 8192))
      return off;
  }
  return off;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<PWMGenConfigure>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    %rsi,-0x10(%rbp)
  mov    %rdx,-0x18(%rbp)
  cmpq   $0x40028000,-0x8(%rbp)
  je     L17
  cmpq   $0x40029000,-0x8(%rbp)
  jne    L47
L17:
  mov    $0x1,%eax
  jmp    L21
L47:
  mov    $0x0,%eax
L21:
  mov    %eax,%edi
  call   <DEBUG_ASSERT@plt>
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <PWMGenValid@plt>
  mov    %eax,%edi
  call   <DEBUG_ASSERT@plt>
  mov    -0x8(%rbp),%rax
  add    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  mov    (%rax),%rax
  and    $0xfffffffffff80001,%rax
  mov    %rax,%rdx
  mov    -0x10(%rbp),%rax
  or     -0x18(%rbp),%rdx
  mov    %rdx,(%rax)
  mov    -0x18(%rbp),%rax
  and    $0x2,%eax
  test   %rax,%rax
  je     L25
  mov    -0x10(%rbp),%rax
  add    $0x20,%rax
  movq   $0xb0,(%rax)
  mov    -0x10(%rbp),%rax
  add    $0x24,%rax
  movq   $0xb00,(%rax)
  jmp    L36
L25:
  mov    -0x10(%rbp),%rax
  add    $0x20,%rax
  movq   $0x8c,(%rax)
  mov    -0x10(%rbp),%rax
  add    $0x24,%rax
  movq   $0x80c,(%rax)
L36:
  nop
  leave
  ret
```

assistant: ```c
void PWMGenConfigure(unsigned long ulBase, unsigned long ulGen, unsigned long ulConfig) {
  DEBUG_ASSERT((ulBase == 0x40028000) || (ulBase == 0x40029000));
  DEBUG_ASSERT(PWMGenValid(ulGen));
  ulGen = ((ulBase) + (ulGen));
  (*((volatile unsigned long *)(ulGen + 0x00000000))) = (((*((volatile unsigned long *)(ulGen + 0x00000000))) & ~(0x00000002 | 0x00000004 | 0x00040000 | 0x00020000 | 0x00010000 | 0x0000C000 | 0x00003000 | 0x00000C00 | 0x00000300 | 0x000000C0 | 0x00000008 | 0x00000010 | 0x00000020)) | ulConfig);
  if (ulConfig & 0x00000002) {
    (*((volatile unsigned long *)(ulGen + 0x00000020))) = (0x00000030 | 0x00000080);
    (*((volatile unsigned long *)(ulGen + 0x00000024))) = (0x00000300 | 0x00000800);
  } else {
    (*((volatile unsigned long *)(ulGen + 0x00000020))) = (0x0000000C | 0x00000080);
    (*((volatile unsigned long *)(ulGen + 0x00000024))) = (0x0000000C | 0x00000800);
  }
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<PWMGenConfigure>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  mov    %rsi,%r12
  mov    %rdx,%rbp
  mov    %rdi,%rax
  and    $0xef,%ah
  cmp    $0x40028000,%rax
  sete   %dil
  movzbl %dil,%edi
  call   <DEBUG_ASSERT@plt>
  mov    %r12,%rdi
  call   <PWMGenValid@plt>
  mov    %eax,%edi
  call   <DEBUG_ASSERT@plt>
  lea    (%rbx,%r12,1),%rax
  mov    (%rax),%rdx
  and    $0xfffffffffff80001,%rdx
  or     %rbp,%rdx
  mov    %rdx,(%rax)
  test   $0x2,%bpl
  je     L11
  movq   $0xb0,0x20(%rax)
  movq   $0xb00,0x24(%rax)
L3:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L11:
  movq   $0x8c,0x20(%rax)
  movq   $0x80c,0x24(%rax)
  jmp    L3
```

assistant: ```c
void PWMGenConfigure(unsigned long ulBase, unsigned long ulGen, unsigned long ulConfig) {
  DEBUG_ASSERT((ulBase == 0x40028000) || (ulBase == 0x40029000));
  DEBUG_ASSERT(PWMGenValid(ulGen));
  ulGen = ((ulBase) + (ulGen));
  (*((volatile unsigned long *)(ulGen + 0x00000000))) = (((*((volatile unsigned long *)(ulGen + 0x00000000))) & ~(0x00000002 | 0x00000004 | 0x00040000 | 0x00020000 | 0x00010000 | 0x0000C000 | 0x00003000 | 0x00000C00 | 0x00000300 | 0x000000C0 | 0x00000008 | 0x00000010 | 0x00000020)) | ulConfig);
  if (ulConfig & 0x00000002) {
    (*((volatile unsigned long *)(ulGen + 0x00000020))) = (0x00000030 | 0x00000080);
    (*((volatile unsigned long *)(ulGen + 0x00000024))) = (0x00000300 | 0x00000800);
  } else {
    (*((volatile unsigned long *)(ulGen + 0x00000020))) = (0x0000000C | 0x00000080);
    (*((volatile unsigned long *)(ulGen + 0x00000024))) = (0x0000000C | 0x00000800);
  }
}
```
user: What is the c source code of the assembly code below?

```asm
<PWMGenConfigure>:
  endbr64
  mov    %rdi,%rax
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  and    $0xef,%ah
  mov    %rdx,%rbp
  push   %rbx
  mov    %rdi,%rbx
  xor    %edi,%edi
  cmp    $0x40028000,%rax
  sete   %dil
  call   <DEBUG_ASSERT@plt>
  mov    %r12,%rdi
  call   <PWMGenValid@plt>
  mov    %eax,%edi
  call   <DEBUG_ASSERT@plt>
  lea    (%rbx,%r12,1),%rdi
  mov    (%rdi),%rax
  and    $0xfffffffffff80001,%rax
  or     %rbp,%rax
  and    $0x2,%ebp
  mov    %rax,(%rdi)
  je     L0
  movq   $0xb0,0x20(%rdi)
  movq   $0xb00,0x24(%rdi)
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax)
L0:
  movq   $0x8c,0x20(%rdi)
  movq   $0x80c,0x24(%rdi)
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
void PWMGenConfigure(unsigned long ulBase, unsigned long ulGen, unsigned long ulConfig) {
  DEBUG_ASSERT((ulBase == 0x40028000) || (ulBase == 0x40029000));
  DEBUG_ASSERT(PWMGenValid(ulGen));
  ulGen = ((ulBase) + (ulGen));
  (*((volatile unsigned long *)(ulGen + 0x00000000))) = (((*((volatile unsigned long *)(ulGen + 0x00000000))) & ~(0x00000002 | 0x00000004 | 0x00040000 | 0x00020000 | 0x00010000 | 0x0000C000 | 0x00003000 | 0x00000C00 | 0x00000300 | 0x000000C0 | 0x00000008 | 0x00000010 | 0x00000020)) | ulConfig);
  if (ulConfig & 0x00000002) {
    (*((volatile unsigned long *)(ulGen + 0x00000020))) = (0x00000030 | 0x00000080);
    (*((volatile unsigned long *)(ulGen + 0x00000024))) = (0x00000300 | 0x00000800);
  } else {
    (*((volatile unsigned long *)(ulGen + 0x00000020))) = (0x0000000C | 0x00000080);
    (*((volatile unsigned long *)(ulGen + 0x00000024))) = (0x0000000C | 0x00000800);
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<PWMGenConfigure>:
  endbr64
  mov    %rdi,%rax
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  and    $0xef,%ah
  mov    %rdx,%rbp
  push   %rbx
  mov    %rdi,%rbx
  xor    %edi,%edi
  cmp    $0x40028000,%rax
  sete   %dil
  call   <DEBUG_ASSERT@plt>
  mov    %r12,%rdi
  call   <PWMGenValid@plt>
  mov    %eax,%edi
  call   <DEBUG_ASSERT@plt>
  lea    (%rbx,%r12,1),%rdi
  mov    (%rdi),%rax
  and    $0xfffffffffff80001,%rax
  or     %rbp,%rax
  and    $0x2,%ebp
  mov    %rax,(%rdi)
  je     L8
  movq   $0xb0,0x20(%rdi)
  movq   $0xb00,0x24(%rdi)
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax)
L8:
  movq   $0x8c,0x20(%rdi)
  movq   $0x80c,0x24(%rdi)
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
void PWMGenConfigure(unsigned long ulBase, unsigned long ulGen, unsigned long ulConfig) {
  DEBUG_ASSERT((ulBase == 0x40028000) || (ulBase == 0x40029000));
  DEBUG_ASSERT(PWMGenValid(ulGen));
  ulGen = ((ulBase) + (ulGen));
  (*((volatile unsigned long *)(ulGen + 0x00000000))) = (((*((volatile unsigned long *)(ulGen + 0x00000000))) & ~(0x00000002 | 0x00000004 | 0x00040000 | 0x00020000 | 0x00010000 | 0x0000C000 | 0x00003000 | 0x00000C00 | 0x00000300 | 0x000000C0 | 0x00000008 | 0x00000010 | 0x00000020)) | ulConfig);
  if (ulConfig & 0x00000002) {
    (*((volatile unsigned long *)(ulGen + 0x00000020))) = (0x00000030 | 0x00000080);
    (*((volatile unsigned long *)(ulGen + 0x00000024))) = (0x00000300 | 0x00000800);
  } else {
    (*((volatile unsigned long *)(ulGen + 0x00000020))) = (0x0000000C | 0x00000080);
    (*((volatile unsigned long *)(ulGen + 0x00000024))) = (0x0000000C | 0x00000800);
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<crash>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0xd0,%rsp
  mov    %rdi,-0xc8(%rbp)
  mov    %rsi,-0xa8(%rbp)
  mov    %rdx,-0xa0(%rbp)
  mov    %rcx,-0x98(%rbp)
  mov    %r8,-0x90(%rbp)
  mov    %r9,-0x88(%rbp)
  test   %al,%al
  je     L2
  movaps %xmm0,-0x80(%rbp)
  movaps %xmm1,-0x70(%rbp)
  movaps %xmm2,-0x60(%rbp)
  movaps %xmm3,-0x50(%rbp)
  movaps %xmm4,-0x40(%rbp)
  movaps %xmm5,-0x30(%rbp)
  movaps %xmm6,-0x20(%rbp)
  movaps %xmm7,-0x10(%rbp)
L2:
  mov    -0xc8(%rbp),%rdx
  mov    -0xb4(%rbp),%eax
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <va_start@plt>
  mov    -0xb4(%rbp),%edx
  mov    -0xc8(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <vprintf@plt>
  mov    -0xb4(%rbp),%eax
  mov    %eax,%edi
  call   <va_end@plt>
  mov    D7(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,%edi
  call   <exit@plt>
  nop
  leave
  ret
```

assistant: ```c
void crash(const char *format, ...) {
  va_list ap;
  va_start(ap, format);
  vprintf(format, ap);
  va_end(ap);
  exit(EXIT_FAILURE);
}
```
user: What is the c source code of the assembly code below?

```asm
<crash>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbx
  mov    %rdi,%rsi
  mov    $0x0,%ebp
  mov    %ebp,%edi
  call   <va_start@plt>
  mov    %ebp,%esi
  mov    %rbx,%rdi
  call   <vprintf@plt>
  mov    %ebp,%edi
  call   <va_end@plt>
  mov    D1(%rip),%rax
  mov    (%rax),%edi
  call   <exit@plt>
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
void crash(const char *format, ...) {
  va_list ap;
  va_start(ap, format);
  vprintf(format, ap);
  va_end(ap);
  exit(EXIT_FAILURE);
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<crash>:
  endbr64
  push   %r12
  xor    %r12d,%r12d
  mov    %rdi,%rsi
  push   %rbp
  mov    %rdi,%rbp
  mov    %r12d,%edi
  sub    $0x8,%rsp
  call   <va_start@plt>
  mov    %r12d,%esi
  mov    %rbp,%rdi
  call   <vprintf@plt>
  mov    %r12d,%edi
  call   <va_end@plt>
  mov    D4(%rip),%rax
  mov    (%rax),%edi
  call   <exit@plt>
  add    $0x8,%rsp
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
void crash(const char *format, ...) {
  va_list ap;
  va_start(ap, format);
  vprintf(format, ap);
  va_end(ap);
  exit(EXIT_FAILURE);
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<crash>:
  endbr64
  push   %r12
  xor    %r12d,%r12d
  mov    %rdi,%rsi
  push   %rbp
  mov    %rdi,%rbp
  mov    %r12d,%edi
  sub    $0x8,%rsp
  call   <va_start@plt>
  mov    %r12d,%esi
  mov    %rbp,%rdi
  call   <vprintf@plt>
  mov    %r12d,%edi
  call   <va_end@plt>
  mov    D5(%rip),%rax
  mov    (%rax),%edi
  call   <exit@plt>
  add    $0x8,%rsp
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
void crash(const char *format, ...) {
  va_list ap;
  va_start(ap, format);
  vprintf(format, ap);
  va_end(ap);
  exit(EXIT_FAILURE);
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<be16toh>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0xc(%rbp),%rcx
  lea    -0x14(%rbp),%rax
  mov    $0x4,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <swap_n@plt>
  mov    -0xc(%rbp),%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L0
  call   <__stack_chk_fail@plt>
L0:
  leave
  ret
```

assistant: ```c
uint16_t be16toh(uint16_t in) {
  uint16_t out;
  swap_n(&in, &out, sizeof(out));
  return out;
}
```