ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<xrop3_32_0_1>:
  endbr64
  movzbl %dil,%eax
  mov    %eax,%edi
  shl    $0x8,%edi
  or     %eax,%edi
  not    %edi
  and    %edi,%esi
  movzbl %sil,%eax
  ret
```

assistant: ```c
unsigned xrop3_32_0_1(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  unsigned stk3;
  stk3 = ~S;
  stk2 = T & stk3;
  stk1 = D & stk2;
  return (stk1 & S) | (stk1 & (~T)) | (T & (~S) & D);
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<rnd8lfsr>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  jne    L11
  movq   $0x1,-0x18(%rbp)
  jmp    L21
L11:
  mov    -0x18(%rbp),%rax
  shr    $0x2,%rax
  xor    -0x18(%rbp),%rax
  mov    %rax,%rdx
  mov    -0x18(%rbp),%rax
  shr    $0x3,%rax
  xor    %rax,%rdx
  mov    -0x18(%rbp),%rax
  shr    $0x4,%rax
  xor    %rdx,%rax
  and    $0x1,%eax
  mov    %rax,-0x8(%rbp)
  mov    -0x18(%rbp),%rax
  shr    %rax
  mov    %rax,%rdx
  mov    -0x8(%rbp),%rax
  shl    $0x7,%rax
  or     %rdx,%rax
  mov    %rax,-0x18(%rbp)
  cmpq   $0x1,-0x18(%rbp)
  jne    L21
  movq   $0x0,-0x18(%rbp)
L21:
  mov    -0x18(%rbp),%rax
  pop    %rbp
  ret
```

assistant: ```c
unsigned long long int rnd8lfsr(unsigned long long int x) {
  unsigned long long int bit;
  if (x == 0) {
    x = 1;
  } else {
    bit = ((x >> 0) ^ (x >> 2) ^ (x >> 3) ^ (x >> 4)) & 1;
    x = (x >> 1) | (bit << 7);
    if (x == 1)
      x = 0;
  }
  return x;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<rnd8lfsr>:
  endbr64
  mov    $0x1,%eax
  test   %rdi,%rdi
  je     L6
  mov    %rdi,%rax
  shr    %rax
  mov    %rdi,%rdx
  shr    $0x2,%rdx
  mov    %rdi,%rcx
  shr    $0x3,%rcx
  xor    %rcx,%rdx
  xor    %rdi,%rdx
  shr    $0x4,%rdi
  xor    %rdi,%rdx
  shl    $0x7,%rdx
  movzbl %dl,%edx
  or     %rdx,%rax
  cmp    $0x1,%rax
  mov    $0x0,%edx
  cmove  %rdx,%rax
L6:
  ret
```

assistant: ```c
unsigned long long int rnd8lfsr(unsigned long long int x) {
  unsigned long long int bit;
  if (x == 0) {
    x = 1;
  } else {
    bit = ((x >> 0) ^ (x >> 2) ^ (x >> 3) ^ (x >> 4)) & 1;
    x = (x >> 1) | (bit << 7);
    if (x == 1)
      x = 0;
  }
  return x;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<rnd8lfsr>:
  endbr64
  mov    $0x1,%eax
  test   %rdi,%rdi
  je     L6
  mov    %rdi,%rdx
  mov    %rdi,%rcx
  mov    %rdi,%rax
  shr    $0x2,%rdx
  shr    $0x3,%rcx
  xor    %rcx,%rdx
  shr    %rax
  xor    %rdi,%rdx
  shr    $0x4,%rdi
  xor    %rdi,%rdx
  shl    $0x7,%rdx
  movzbl %dl,%edx
  or     %rdx,%rax
  xor    %edx,%edx
  cmp    $0x1,%rax
  cmove  %rdx,%rax
L6:
  ret
```

assistant: ```c
unsigned long long int rnd8lfsr(unsigned long long int x) {
  unsigned long long int bit;
  if (x == 0) {
    x = 1;
  } else {
    bit = ((x >> 0) ^ (x >> 2) ^ (x >> 3) ^ (x >> 4)) & 1;
    x = (x >> 1) | (bit << 7);
    if (x == 1)
      x = 0;
  }
  return x;
}
```
user: What is the c source code of the assembly code below?

```asm
<rnd8lfsr>:
  endbr64
  mov    $0x1,%eax
  test   %rdi,%rdi
  je     L3
  mov    %rdi,%rdx
  mov    %rdi,%rcx
  mov    %rdi,%rax
  shr    $0x2,%rdx
  shr    $0x3,%rcx
  xor    %rcx,%rdx
  shr    %rax
  xor    %rdi,%rdx
  shr    $0x4,%rdi
  xor    %rdi,%rdx
  shl    $0x7,%rdx
  movzbl %dl,%edx
  or     %rdx,%rax
  xor    %edx,%edx
  cmp    $0x1,%rax
  cmove  %rdx,%rax
L3:
  ret
```

assistant: ```c
unsigned long long int rnd8lfsr(unsigned long long int x) {
  unsigned long long int bit;
  if (x == 0) {
    x = 1;
  } else {
    bit = ((x >> 0) ^ (x >> 2) ^ (x >> 3) ^ (x >> 4)) & 1;
    x = (x >> 1) | (bit << 7);
    if (x == 1)
      x = 0;
  }
  return x;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<HelpText>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  mov    %rsi,%rdx
  lea    D9(%rip),%rsi
  mov    $0x0,%eax
  call   <fprintf@plt>
  mov    %rbx,%rcx
  mov    $0x3a,%edx
  mov    $0x1,%esi
  lea    D34(%rip),%rdi
  call   <fwrite@plt>
  mov    %rbx,%rcx
  mov    $0x2e,%edx
  mov    $0x1,%esi
  lea    D5(%rip),%rdi
  call   <fwrite@plt>
  mov    %rbx,%rcx
  mov    $0x2c,%edx
  mov    $0x1,%esi
  lea    D28(%rip),%rdi
  call   <fwrite@plt>
  mov    %rbx,%rcx
  mov    $0x43,%edx
  mov    $0x1,%esi
  lea    D12(%rip),%rdi
  call   <fwrite@plt>
  mov    %rbx,%rcx
  mov    $0x37,%edx
  mov    $0x1,%esi
  lea    D99(%rip),%rdi
  call   <fwrite@plt>
  mov    %rbx,%rcx
  mov    $0x2d,%edx
  mov    $0x1,%esi
  lea    D69(%rip),%rdi
  call   <fwrite@plt>
  mov    %rbx,%rcx
  mov    $0x33,%edx
  mov    $0x1,%esi
  lea    D35(%rip),%rdi
  call   <fwrite@plt>
  mov    %rbx,%rcx
  mov    $0x38,%edx
  mov    $0x1,%esi
  lea    D83(%rip),%rdi
  call   <fwrite@plt>
  mov    %rbx,%rcx
  mov    $0x2f,%edx
  mov    $0x1,%esi
  lea    D73(%rip),%rdi
  call   <fwrite@plt>
  pop    %rbx
  ret
```

tool_calls: name: parse_data
arguments: data_tag: D9
type: string
name: parse_data
arguments: data_tag: D34
type: string
name: parse_data
arguments: data_tag: D5
type: string
name: parse_data
arguments: data_tag: D28
type: string
name: parse_data
arguments: data_tag: D12
type: string
name: parse_data
arguments: data_tag: D99
type: string
name: parse_data
arguments: data_tag: D69
type: string
name: parse_data
arguments: data_tag: D35
type: string
name: parse_data
arguments: data_tag: D83
type: string
name: parse_data
arguments: data_tag: D73
type: string

tool: D9: %s: [options] [infile [outfile]] ...


tool: D34: Utility to expand tabs and ensure consistent line endings


tool: D5: options for tab2space vers: 6th February 2003


tool: D28:   -help or -h     display this help message


tool: D12:   -dos  or -crlf  set line ends to CRLF (PC-DOS/Windows - default)


tool: D99:   -mac  or -cr    set line ends to CR (classic Mac OS)


tool: D69:   -unix or -lf    set line ends to LF (Unix)


tool: D35:   -tabs           preserve tabs, e.g. for Makefile


tool: D83:   -t<n>           set tabs to <n> (default is 4) spaces


tool: D73: 
Note this utility doesn't map spaces to tabs!


assistant: ```c
void HelpText(FILE *errout, char *prog) {
  fprintf(errout, "%s: [options] [infile [outfile]] ...\n", prog);
  fprintf(errout, "Utility to expand tabs and ensure consistent line endings\n");
  fprintf(errout, "options for tab2space vers: 6th February 2003\n");
  fprintf(errout, "  -help or -h     display this help message\n");
  fprintf(errout, "  -dos  or -crlf  set line ends to CRLF (PC-DOS/Windows - default)\n");
  fprintf(errout, "  -mac  or -cr    set line ends to CR (classic Mac OS)\n");
  fprintf(errout, "  -unix or -lf    set line ends to LF (Unix)\n");
  fprintf(errout, "  -tabs           preserve tabs, e.g. for Makefile\n");
  fprintf(errout, "  -t<n>           set tabs to <n> (default is 4) spaces\n");
  fprintf(errout, "\nNote this utility doesn't map spaces to tabs!\n");
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<HelpText>:
  endbr64
  push   %r12
  mov    %rsi,%rdx
  mov    %rdi,%r12
  lea    D54(%rip),%rsi
  xor    %eax,%eax
  call   <fprintf@plt>
  mov    %r12,%rcx
  mov    $0x3a,%edx
  mov    $0x1,%esi
  lea    D87(%rip),%rdi
  call   <fwrite@plt>
  mov    %r12,%rcx
  mov    $0x2e,%edx
  mov    $0x1,%esi
  lea    D27(%rip),%rdi
  call   <fwrite@plt>
  mov    %r12,%rcx
  mov    $0x2c,%edx
  mov    $0x1,%esi
  lea    D9(%rip),%rdi
  call   <fwrite@plt>
  mov    %r12,%rcx
  mov    $0x43,%edx
  mov    $0x1,%esi
  lea    D13(%rip),%rdi
  call   <fwrite@plt>
  mov    %r12,%rcx
  mov    $0x37,%edx
  mov    $0x1,%esi
  lea    D64(%rip),%rdi
  call   <fwrite@plt>
  mov    %r12,%rcx
  mov    $0x2d,%edx
  mov    $0x1,%esi
  lea    D31(%rip),%rdi
  call   <fwrite@plt>
  mov    %r12,%rcx
  mov    $0x33,%edx
  mov    $0x1,%esi
  lea    D94(%rip),%rdi
  call   <fwrite@plt>
  mov    %r12,%rcx
  mov    $0x38,%edx
  mov    $0x1,%esi
  lea    D35(%rip),%rdi
  call   <fwrite@plt>
  mov    %r12,%rcx
  pop    %r12
  mov    $0x2f,%edx
  mov    $0x1,%esi
  lea    D70(%rip),%rdi
  jmp    1070 <fwrite@plt>
```

tool_calls: name: retrieve_data
arguments: label: D54
type: string
name: retrieve_data
arguments: label: D87
type: string
name: retrieve_data
arguments: label: D27
type: string
name: retrieve_data
arguments: label: D9
type: string
name: retrieve_data
arguments: label: D13
type: string
name: retrieve_data
arguments: label: D64
type: string
name: retrieve_data
arguments: label: D31
type: string
name: retrieve_data
arguments: label: D94
type: string
name: retrieve_data
arguments: label: D35
type: string
name: retrieve_data
arguments: label: D70
type: string

tool: D54: %s: [options] [infile [outfile]] ...


tool: D87: Utility to expand tabs and ensure consistent line endings


tool: D27: options for tab2space vers: 6th February 2003


tool: D9:   -help or -h     display this help message


tool: D13:   -dos  or -crlf  set line ends to CRLF (PC-DOS/Windows - default)


tool: D64:   -mac  or -cr    set line ends to CR (classic Mac OS)


tool: D31:   -unix or -lf    set line ends to LF (Unix)


tool: D94:   -tabs           preserve tabs, e.g. for Makefile


tool: D35:   -t<n>           set tabs to <n> (default is 4) spaces


tool: D70: 
Note this utility doesn't map spaces to tabs!


assistant: ```c
void HelpText(FILE *errout, char *prog) {
  fprintf(errout, "%s: [options] [infile [outfile]] ...\n", prog);
  fprintf(errout, "Utility to expand tabs and ensure consistent line endings\n");
  fprintf(errout, "options for tab2space vers: 6th February 2003\n");
  fprintf(errout, "  -help or -h     display this help message\n");
  fprintf(errout, "  -dos  or -crlf  set line ends to CRLF (PC-DOS/Windows - default)\n");
  fprintf(errout, "  -mac  or -cr    set line ends to CR (classic Mac OS)\n");
  fprintf(errout, "  -unix or -lf    set line ends to LF (Unix)\n");
  fprintf(errout, "  -tabs           preserve tabs, e.g. for Makefile\n");
  fprintf(errout, "  -t<n>           set tabs to <n> (default is 4) spaces\n");
  fprintf(errout, "\nNote this utility doesn't map spaces to tabs!\n");
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<HelpText>:
  endbr64
  push   %r12
  mov    %rsi,%rdx
  mov    %rdi,%r12
  lea    D44(%rip),%rsi
  xor    %eax,%eax
  call   <fprintf@plt>
  mov    %r12,%rcx
  mov    $0x3a,%edx
  mov    $0x1,%esi
  lea    D19(%rip),%rdi
  call   <fwrite@plt>
  mov    %r12,%rcx
  mov    $0x2e,%edx
  mov    $0x1,%esi
  lea    D70(%rip),%rdi
  call   <fwrite@plt>
  mov    %r12,%rcx
  mov    $0x2c,%edx
  mov    $0x1,%esi
  lea    D25(%rip),%rdi
  call   <fwrite@plt>
  mov    %r12,%rcx
  mov    $0x43,%edx
  mov    $0x1,%esi
  lea    D91(%rip),%rdi
  call   <fwrite@plt>
  mov    %r12,%rcx
  mov    $0x37,%edx
  mov    $0x1,%esi
  lea    D58(%rip),%rdi
  call   <fwrite@plt>
  mov    %r12,%rcx
  mov    $0x2d,%edx
  mov    $0x1,%esi
  lea    D8(%rip),%rdi
  call   <fwrite@plt>
  mov    %r12,%rcx
  mov    $0x33,%edx
  mov    $0x1,%esi
  lea    D10(%rip),%rdi
  call   <fwrite@plt>
  mov    %r12,%rcx
  mov    $0x38,%edx
  mov    $0x1,%esi
  lea    D24(%rip),%rdi
  call   <fwrite@plt>
  mov    %r12,%rcx
  pop    %r12
  mov    $0x2f,%edx
  mov    $0x1,%esi
  lea    D81(%rip),%rdi
  jmp    1070 <fwrite@plt>
```

tool_calls: name: retrieve_data
arguments: data_tag: D44
type: string
name: retrieve_data
arguments: data_tag: D19
type: string
name: retrieve_data
arguments: data_tag: D70
type: string
name: retrieve_data
arguments: data_tag: D25
type: string
name: retrieve_data
arguments: data_tag: D91
type: string
name: retrieve_data
arguments: data_tag: D58
type: string
name: retrieve_data
arguments: data_tag: D8
type: string
name: retrieve_data
arguments: data_tag: D10
type: string
name: retrieve_data
arguments: data_tag: D24
type: string
name: retrieve_data
arguments: data_tag: D81
type: string

tool: D44: %s: [options] [infile [outfile]] ...


tool: D19: Utility to expand tabs and ensure consistent line endings


tool: D70: options for tab2space vers: 6th February 2003


tool: D25:   -help or -h     display this help message


tool: D91:   -dos  or -crlf  set line ends to CRLF (PC-DOS/Windows - default)


tool: D58:   -mac  or -cr    set line ends to CR (classic Mac OS)


tool: D8:   -unix or -lf    set line ends to LF (Unix)


tool: D10:   -tabs           preserve tabs, e.g. for Makefile


tool: D24:   -t<n>           set tabs to <n> (default is 4) spaces


tool: D81: 
Note this utility doesn't map spaces to tabs!


assistant: ```c
void HelpText(FILE *errout, char *prog) {
  fprintf(errout, "%s: [options] [infile [outfile]] ...\n", prog);
  fprintf(errout, "Utility to expand tabs and ensure consistent line endings\n");
  fprintf(errout, "options for tab2space vers: 6th February 2003\n");
  fprintf(errout, "  -help or -h     display this help message\n");
  fprintf(errout, "  -dos  or -crlf  set line ends to CRLF (PC-DOS/Windows - default)\n");
  fprintf(errout, "  -mac  or -cr    set line ends to CR (classic Mac OS)\n");
  fprintf(errout, "  -unix or -lf    set line ends to LF (Unix)\n");
  fprintf(errout, "  -tabs           preserve tabs, e.g. for Makefile\n");
  fprintf(errout, "  -t<n>           set tabs to <n> (default is 4) spaces\n");
  fprintf(errout, "\nNote this utility doesn't map spaces to tabs!\n");
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<CmpChar>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %edi,%edx
  mov    %esi,%eax
  mov    %dl,-0x14(%rbp)
  mov    %al,-0x18(%rbp)
  movsbl -0x14(%rbp),%eax
  mov    %eax,%edi
  call   <isupper@plt>
  test   %rax,%rax
  je     L59
  movsbl -0x14(%rbp),%eax
  mov    %eax,%edi
  call   <tolower@plt>
  jmp    L10
L59:
  movzbl -0x14(%rbp),%eax
L10:
  mov    %al,-0x2(%rbp)
  movsbl -0x18(%rbp),%eax
  mov    %eax,%edi
  call   <isupper@plt>
  test   %rax,%rax
  je     L23
  movsbl -0x18(%rbp),%eax
  mov    %eax,%edi
  call   <tolower@plt>
  jmp    L54
L23:
  movzbl -0x18(%rbp),%eax
L54:
  mov    %al,-0x1(%rbp)
  movzbl -0x2(%rbp),%eax
  cmp    -0x1(%rbp),%al
  je     L20
  mov    $0x0,%eax
  jmp    L41
L20:
  mov    $0x1,%eax
L41:
  leave
  ret
```

assistant: ```c
int CmpChar(char a, char b) {
  char a_, b_;
  a_ = isupper(a) ? tolower(a) : a;
  b_ = isupper(b) ? tolower(b) : b;
  if (a_ != b_)
    return 0;
  return 1;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<CmpChar>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %esi,%ebx
  mov    %edi,%r13d
  mov    %esi,%r12d
  movsbl %dil,%ebp
  mov    %ebp,%edi
  call   <isupper@plt>
  test   %rax,%rax
  jne    L0
L7:
  movsbl %bl,%ebx
  mov    %ebx,%edi
  call   <isupper@plt>
  test   %rax,%rax
  jne    L22
L5:
  cmp    %r12b,%r13b
  sete   %al
  movzbl %al,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L0:
  mov    %ebp,%edi
  call   <tolower@plt>
  mov    %eax,%r13d
  jmp    L7
L22:
  mov    %ebx,%edi
  call   <tolower@plt>
  mov    %eax,%r12d
  jmp    L5
```

assistant: ```c
int CmpChar(char a, char b) {
  char a_, b_;
  a_ = isupper(a) ? tolower(a) : a;
  b_ = isupper(b) ? tolower(b) : b;
  if (a_ != b_)
    return 0;
  return 1;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<CmpChar>:
  endbr64
  push   %r13
  mov    %edi,%r13d
  push   %r12
  mov    %esi,%r12d
  push   %rbp
  movsbl %dil,%ebp
  push   %rbx
  mov    %ebp,%edi
  mov    %esi,%ebx
  sub    $0x8,%rsp
  call   <isupper@plt>
  test   %rax,%rax
  jne    L18
  movsbl %bl,%ebp
  mov    %ebp,%edi
  call   <isupper@plt>
  test   %rax,%rax
  jne    L10
L25:
  xor    %eax,%eax
  cmp    %r12b,%r13b
  sete   %al
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax,%rax,1)
L18:
  mov    %ebp,%edi
  movsbl %bl,%ebp
  call   <tolower@plt>
  mov    %ebp,%edi
  mov    %eax,%r13d
  call   <isupper@plt>
  test   %rax,%rax
  je     L25
L10:
  mov    %ebp,%edi
  call   <tolower@plt>
  mov    %eax,%r12d
  jmp    L25
```

assistant: ```c
int CmpChar(char a, char b) {
  char a_, b_;
  a_ = isupper(a) ? tolower(a) : a;
  b_ = isupper(b) ? tolower(b) : b;
  if (a_ != b_)
    return 0;
  return 1;
}
```
user: Translate the below assembly code into C programming language:

```asm
<CmpChar>:
  endbr64
  push   %r13
  mov    %edi,%r13d
  push   %r12
  mov    %esi,%r12d
  push   %rbp
  movsbl %dil,%ebp
  push   %rbx
  mov    %ebp,%edi
  mov    %esi,%ebx
  sub    $0x8,%rsp
  call   <isupper@plt>
  test   %rax,%rax
  jne    L0
  movsbl %bl,%ebp
  mov    %ebp,%edi
  call   <isupper@plt>
  test   %rax,%rax
  jne    L36
L22:
  xor    %eax,%eax
  cmp    %r12b,%r13b
  sete   %al
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax,%rax,1)
L0:
  mov    %ebp,%edi
  movsbl %bl,%ebp
  call   <tolower@plt>
  mov    %ebp,%edi
  mov    %eax,%r13d
  call   <isupper@plt>
  test   %rax,%rax
  je     L22
L36:
  mov    %ebp,%edi
  call   <tolower@plt>
  mov    %eax,%r12d
  jmp    L22
```

assistant: ```c
int CmpChar(char a, char b) {
  char a_, b_;
  a_ = isupper(a) ? tolower(a) : a;
  b_ = isupper(b) ? tolower(b) : b;
  if (a_ != b_)
    return 0;
  return 1;
}
```
user: What is the c source code of the assembly code below?

```asm
<arikkei_ucs2_utf8_strcpy>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  movl   $0x0,-0x4(%rbp)
  jmp    L11
L36:
  mov    -0x18(%rbp),%rax
  movzwl (%rax),%eax
  cmp    $0x7f,%ax
  ja     L10
  mov    -0x18(%rbp),%rax
  movzwl (%rax),%ecx
  mov    -0x4(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x4(%rbp)
  mov    %eax,%edx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    %ecx,%edx
  mov    %dl,(%rax)
  jmp    L24
L10:
  mov    -0x18(%rbp),%rax
  movzwl (%rax),%eax
  cmp    $0x7ff,%ax
  ja     L14
  mov    -0x18(%rbp),%rax
  movzwl (%rax),%eax
  shr    $0x6,%ax
  mov    %eax,%ecx
  mov    -0x4(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x4(%rbp)
  mov    %eax,%edx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  or     $0xffffffc0,%ecx
  mov    %ecx,%edx
  mov    %dl,(%rax)
  mov    -0x18(%rbp),%rax
  movzwl (%rax),%eax
  and    $0x3f,%eax
  or     $0xffffff80,%eax
  mov    %eax,%ecx
  mov    -0x4(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x4(%rbp)
  mov    %eax,%edx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    %ecx,%edx
  mov    %dl,(%rax)
  jmp    L24
L14:
  mov    -0x18(%rbp),%rax
  movzwl (%rax),%eax
  shr    $0xc,%ax
  mov    %eax,%ecx
  mov    -0x4(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x4(%rbp)
  mov    %eax,%edx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  or     $0xffffffe0,%ecx
  mov    %ecx,%edx
  mov    %dl,(%rax)
  mov    -0x18(%rbp),%rax
  movzwl (%rax),%eax
  shr    $0x6,%ax
  and    $0x3f,%eax
  or     $0xffffff80,%eax
  mov    %eax,%ecx
  mov    -0x4(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x4(%rbp)
  mov    %eax,%edx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    %ecx,%edx
  mov    %dl,(%rax)
  mov    -0x18(%rbp),%rax
  movzwl (%rax),%eax
  and    $0x3f,%eax
  or     $0xffffff80,%eax
  mov    %eax,%ecx
  mov    -0x4(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x4(%rbp)
  mov    %eax,%edx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    %ecx,%edx
  mov    %dl,(%rax)
L24:
  addq   $0x2,-0x18(%rbp)
L11:
  mov    -0x18(%rbp),%rax
  movzwl (%rax),%eax
  test   %ax,%ax
  jne    L36
  mov    -0x4(%rbp),%edx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    -0x4(%rbp),%eax
  pop    %rbp
  ret
```

assistant: ```c
unsigned int arikkei_ucs2_utf8_strcpy(const unsigned short *s, unsigned char *d) {
  unsigned int dp;
  dp = 0;
  while (*s) {
    if (*s < 0x80) {
      d[dp++] = (unsigned char)*s;
    } else if (*s < 0x800) {
      d[dp++] = 0xc0 | (unsigned char)(*s >> 6);
      d[dp++] = 0x80 | (*s & 0x3f);
    } else {
      d[dp++] = 0xe0 | (*s >> 12);
      d[dp++] = 0x80 | ((*s >> 6) & 0x3f);
      d[dp++] = 0x80 | (*s & 0x3f);
    }
    s += 1;
  }
  d[dp] = 0;
  return dp;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<arikkei_ucs2_utf8_strcpy>:
  endbr64
  mov    %rdi,%rdx
  movzwl (%rdi),%eax
  test   %ax,%ax
  je     L64
  mov    $0x0,%ecx
  jmp    L13
L62:
  cmp    $0x7ff,%ax
  ja     L51
  lea    0x1(%rcx),%edi
  mov    %ecx,%r8d
  shr    $0x6,%ax
  or     $0xffffffc0,%eax
  mov    %al,(%rsi,%r8,1)
  add    $0x2,%ecx
  mov    %edi,%edi
  movzbl (%rdx),%eax
  and    $0x3f,%eax
  or     $0xffffff80,%eax
  mov    %al,(%rsi,%rdi,1)
L47:
  add    $0x2,%rdx
  movzwl (%rdx),%eax
  test   %ax,%ax
  je     L1
L13:
  cmp    $0x7f,%ax
  ja     L62
  mov    %ecx,%edi
  mov    %al,(%rsi,%rdi,1)
  lea    0x1(%rcx),%ecx
  jmp    L47
L51:
  mov    %ecx,%edi
  shr    $0xc,%ax
  or     $0xffffffe0,%eax
  mov    %al,(%rsi,%rdi,1)
  lea    0x2(%rcx),%edi
  lea    0x1(%rcx),%r8d
  movzwl (%rdx),%eax
  shr    $0x6,%ax
  and    $0x3f,%eax
  or     $0xffffff80,%eax
  mov    %al,(%rsi,%r8,1)
  add    $0x3,%ecx
  mov    %edi,%edi
  movzbl (%rdx),%eax
  and    $0x3f,%eax
  or     $0xffffff80,%eax
  mov    %al,(%rsi,%rdi,1)
  jmp    L47
L64:
  mov    $0x0,%ecx
L1:
  mov    %ecx,%eax
  movb   $0x0,(%rsi,%rax,1)
  mov    %ecx,%eax
  ret
```

assistant: ```c
unsigned int arikkei_ucs2_utf8_strcpy(const unsigned short *s, unsigned char *d) {
  unsigned int dp;
  dp = 0;
  while (*s) {
    if (*s < 0x80) {
      d[dp++] = (unsigned char)*s;
    } else if (*s < 0x800) {
      d[dp++] = 0xc0 | (unsigned char)(*s >> 6);
      d[dp++] = 0x80 | (*s & 0x3f);
    } else {
      d[dp++] = 0xe0 | (*s >> 12);
      d[dp++] = 0x80 | ((*s >> 6) & 0x3f);
      d[dp++] = 0x80 | (*s & 0x3f);
    }
    s += 1;
  }
  d[dp] = 0;
  return dp;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<arikkei_ucs2_utf8_strcpy>:
  endbr64
  mov    %rdi,%rdx
  xor    %r8d,%r8d
  mov    %rsi,%rdi
  movzwl (%rdx),%eax
  test   %ax,%ax
  jne    L11
  jmp    L53
  nopw   0x0(%rax,%rax,1)
L13:
  mov    %al,(%rcx)
  mov    %esi,%r8d
L32:
  movzwl 0x2(%rdx),%eax
  add    $0x2,%rdx
  test   %ax,%ax
  je     L63
L11:
  mov    %r8d,%ecx
  lea    0x1(%r8),%esi
  add    %rdi,%rcx
  cmp    $0x7f,%ax
  jbe    L13
  add    %rdi,%rsi
  lea    0x2(%r8),%r9d
  cmp    $0x7ff,%ax
  ja     L27
  shr    $0x6,%ax
  add    $0x2,%rdx
  mov    %r9d,%r8d
  or     $0xffffffc0,%eax
  mov    %al,(%rcx)
  movzbl -0x2(%rdx),%eax
  and    $0x3f,%eax
  or     $0xffffff80,%eax
  mov    %al,(%rsi)
  movzwl (%rdx),%eax
  test   %ax,%ax
  jne    L11
L63:
  mov    %r8d,%eax
  add    %rax,%rdi
L53:
  movb   $0x0,(%rdi)
  mov    %r8d,%eax
  ret
L27:
  shr    $0xc,%ax
  add    $0x3,%r8d
  or     $0xffffffe0,%eax
  mov    %al,(%rcx)
  movzwl (%rdx),%eax
  shr    $0x6,%ax
  and    $0x3f,%eax
  or     $0xffffff80,%eax
  mov    %al,(%rsi)
  movzbl (%rdx),%eax
  and    $0x3f,%eax
  or     $0xffffff80,%eax
  mov    %al,(%rdi,%r9,1)
  jmp    L32
```

assistant: ```c
unsigned int arikkei_ucs2_utf8_strcpy(const unsigned short *s, unsigned char *d) {
  unsigned int dp;
  dp = 0;
  while (*s) {
    if (*s < 0x80) {
      d[dp++] = (unsigned char)*s;
    } else if (*s < 0x800) {
      d[dp++] = 0xc0 | (unsigned char)(*s >> 6);
      d[dp++] = 0x80 | (*s & 0x3f);
    } else {
      d[dp++] = 0xe0 | (*s >> 12);
      d[dp++] = 0x80 | ((*s >> 6) & 0x3f);
      d[dp++] = 0x80 | (*s & 0x3f);
    }
    s += 1;
  }
  d[dp] = 0;
  return dp;
}
```