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

```asm
<orgfx_vga_set_videomode>:
  endbr64
  push   %rbx
  mov    %edx,%ebx
  cmp    $0x280,%edi
  jne    L47
  cmp    $0x1e0,%esi
  je     L24
L47:
  cmp    $0x320,%edi
  jne    L5
  cmp    $0x258,%esi
  jne    L5
  xor    %eax,%eax
  call   <Set800x600_60@plt>
  movzbl %bl,%edi
  pop    %rbx
  jmp    1080 <orgfx_set_colordepth@plt>
  nopw   0x0(%rax,%rax,1)
L24:
  xor    %eax,%eax
  call   <Set640x480_60@plt>
  movzbl %bl,%edi
  pop    %rbx
  jmp    1080 <orgfx_set_colordepth@plt>
L5:
  cmp    $0x400,%edi
  jne    L24
  cmp    $0x300,%esi
  jne    L24
  xor    %eax,%eax
  call   <Set1024x768_60@plt>
  movzbl %bl,%edi
  pop    %rbx
  jmp    1080 <orgfx_set_colordepth@plt>
```

assistant: ```c
void orgfx_vga_set_videomode(unsigned int width, unsigned int height, unsigned char bpp) {
  if (width == 640 && height == 480)
    Set640x480_60();
  else if (width == 800 && height == 600)
    Set800x600_60();
  else if (width == 1024 && height == 768)
    Set1024x768_60();
  else
    Set640x480_60();
  orgfx_set_colordepth(bpp);
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<sliceMatrix>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  movl   $0x0,-0xc(%rbp)
  movl   $0x0,-0x8(%rbp)
  jmp    L25
L11:
  movl   $0x0,-0x4(%rbp)
  jmp    L30
L10:
  mov    -0xc(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0xc(%rbp)
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    -0x8(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,8),%rcx
  mov    -0x18(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rdx),%rcx
  mov    -0x4(%rbp),%edx
  movslq %edx,%rdx
  shl    $0x3,%rdx
  add    %rcx,%rdx
  mov    (%rax),%rax
  mov    %rax,(%rdx)
  addl   $0x1,-0x4(%rbp)
L30:
  cmpl   $0x7,-0x4(%rbp)
  jle    L10
  addl   $0x1,-0x8(%rbp)
L25:
  cmpl   $0x7,-0x8(%rbp)
  jle    L11
  nop
  nop
  pop    %rbp
  ret
```

assistant: ```c
void sliceMatrix(double ***threadData, double **data) {
  int k = 0;
  for (int i = 0; i < 8; i++) {
    for (int j = 0; j < 64 / 8; j++) {
      threadData[i][j] = data[k++];
    }
  }
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<sliceMatrix>:
  endbr64
  mov    $0x0,%r8d
L11:
  mov    $0x0,%eax
L5:
  mov    (%rsi,%rax,1),%rcx
  mov    (%rdi),%rdx
  mov    %rcx,(%rdx,%rax,1)
  add    $0x8,%rax
  cmp    $0x40,%rax
  jne    L5
  add    $0x8,%r8d
  add    $0x8,%rdi
  add    $0x40,%rsi
  cmp    $0x40,%r8d
  jne    L11
  ret
```

assistant: ```c
void sliceMatrix(double ***threadData, double **data) {
  int k = 0;
  for (int i = 0; i < 8; i++) {
    for (int j = 0; j < 64 / 8; j++) {
      threadData[i][j] = data[k++];
    }
  }
}
```
user: Translate the below assembly code into C programming language:

```asm
<sliceMatrix>:
  endbr64
  xor    %r8d,%r8d
  nopw   0x0(%rax,%rax,1)
L1:
  mov    (%rdi),%rcx
  xor    %eax,%eax
  nopl   (%rax)
L19:
  mov    (%rsi,%rax,1),%rdx
  mov    %rdx,(%rcx,%rax,1)
  add    $0x8,%rax
  cmp    $0x40,%rax
  jne    L19
  add    $0x8,%r8d
  add    $0x8,%rdi
  add    $0x40,%rsi
  cmp    $0x40,%r8d
  jne    L1
  ret
```

assistant: ```c
void sliceMatrix(double ***threadData, double **data) {
  int k = 0;
  for (int i = 0; i < 8; i++) {
    for (int j = 0; j < 64 / 8; j++) {
      threadData[i][j] = data[k++];
    }
  }
}
```
user: 下面的汇编指令对应的C源代码是什么:

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

assistant: ```c
int strptrcmp(const void *ap, const void *bp) {
  const char *a = *(const char **)ap;
  const char *b = *(const char **)bp;
  return strcmp(a, b);
}
```
user: What is the c source code of the assembly code below:

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

assistant: ```c
int strptrcmp(const void *ap, const void *bp) {
  const char *a = *(const char **)ap;
  const char *b = *(const char **)bp;
  return strcmp(a, b);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<strptrcmp>:
  endbr64
  mov    (%rsi),%rsi
  mov    (%rdi),%rdi
  jmp    1050 <strcmp@plt>
```

assistant: ```c
int strptrcmp(const void *ap, const void *bp) {
  const char *a = *(const char **)ap;
  const char *b = *(const char **)bp;
  return strcmp(a, b);
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<strptrcmp>:
  endbr64
  mov    (%rsi),%rsi
  mov    (%rdi),%rdi
  jmp    1050 <strcmp@plt>
```

assistant: ```c
int strptrcmp(const void *ap, const void *bp) {
  const char *a = *(const char **)ap;
  const char *b = *(const char **)bp;
  return strcmp(a, b);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  nop
  mov    $0x0,%eax
  pop    %rbp
  ret
```

assistant: ```c
int main() {
  goto end;
end:
  return 0;
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<main>:
  endbr64
  mov    $0x0,%eax
  ret
```

assistant: ```c
int main() {
  goto end;
end:
  return 0;
}
```
user: Translate the below assembly code into C programming language:

```asm
<main>:
  endbr64
  xor    %eax,%eax
  ret
```

assistant: ```c
int main() {
  goto end;
end:
  return 0;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<main>:
  endbr64
  xor    %eax,%eax
  ret
```

assistant: ```c
int main() {
  goto end;
end:
  return 0;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<find_seq>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  movl   $0x0,-0x4(%rbp)
  jmp    L19
L3:
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%edx
  mov    -0x4(%rbp),%eax
  cltq
  lea    0x1(%rax),%rcx
  mov    -0x18(%rbp),%rax
  add    %rcx,%rax
  movzbl (%rax),%eax
  cmp    %al,%dl
  je     L18
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%edx
  mov    -0x4(%rbp),%eax
  cltq
  lea    0x2(%rax),%rcx
  mov    -0x18(%rbp),%rax
  add    %rcx,%rax
  movzbl (%rax),%eax
  cmp    %al,%dl
  jne    L18
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rax,%rdx
  mov    -0x20(%rbp),%rax
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <list_add@plt>
L18:
  addl   $0x1,-0x4(%rbp)
L19:
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0xff,%al
  je     L42
  mov    -0x4(%rbp),%eax
  cltq
  lea    0x2(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L3
L42:
  nop
  leave
  ret
```

assistant: ```c
void find_seq(char *s, struct node *list) {
  int i = 0;
  while (s[i] + 1 != '\0' && s[i + 2] != '\0') {
    if ((s[i] != s[i + 1]) && (s[i] == s[i + 2])) {
      list_add(s + i, list);
    }
    i++;
  }
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<find_seq>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbx
  mov    %rsi,%rbp
  movzbl (%rdi),%eax
  cmp    $0xff,%al
  jne    L16
L5:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
L7:
  add    $0x1,%rbx
  movzbl (%rbx),%eax
  cmp    $0xff,%al
  je     L5
L16:
  movzbl 0x2(%rbx),%edx
  test   %dl,%dl
  je     L5
  cmp    %al,0x1(%rbx)
  je     L7
  cmp    %al,%dl
  jne    L7
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <list_add@plt>
  jmp    L7
```

assistant: ```c
void find_seq(char *s, struct node *list) {
  int i = 0;
  while (s[i] + 1 != '\0' && s[i + 2] != '\0') {
    if ((s[i] != s[i + 1]) && (s[i] == s[i + 2])) {
      list_add(s + i, list);
    }
    i++;
  }
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<find_seq>:
  endbr64
  movzbl (%rdi),%eax
  cmp    $0xff,%al
  je     L66
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x8,%rsp
  jmp    L25
  nopl   0x0(%rax)
L24:
  movzbl 0x1(%rbx),%eax
  add    $0x1,%rbx
  cmp    $0xff,%al
  je     L17
L25:
  movzbl 0x2(%rbx),%edx
  test   %dl,%dl
  je     L17
  cmp    %al,0x1(%rbx)
  je     L24
  cmp    %al,%dl
  jne    L24
  mov    %rbx,%rdi
  mov    %rbp,%rsi
  add    $0x1,%rbx
  call   <list_add@plt>
  movzbl (%rbx),%eax
  cmp    $0xff,%al
  jne    L25
L17:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
L66:
  ret
```

assistant: ```c
void find_seq(char *s, struct node *list) {
  int i = 0;
  while (s[i] + 1 != '\0' && s[i + 2] != '\0') {
    if ((s[i] != s[i + 1]) && (s[i] == s[i + 2])) {
      list_add(s + i, list);
    }
    i++;
  }
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<find_seq>:
  endbr64
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x8,%rsp
  movzbl (%rdi),%eax
  cmp    $0xff,%al
  je     L15
  nopw   0x0(%rax,%rax,1)
L31:
  movzbl 0x2(%rbx),%edx
  test   %dl,%dl
  je     L15
  cmp    %al,0x1(%rbx)
  je     L33
  cmp    %al,%dl
  je     L24
L33:
  movzbl 0x1(%rbx),%eax
  add    $0x1,%rbx
  cmp    $0xff,%al
  jne    L31
L15:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
  nopl   0x0(%rax)
L24:
  mov    %rbx,%rdi
  mov    %rbp,%rsi
  add    $0x1,%rbx
  call   <list_add@plt>
  movzbl (%rbx),%eax
  cmp    $0xff,%al
  jne    L31
  jmp    L15
```

assistant: ```c
void find_seq(char *s, struct node *list) {
  int i = 0;
  while (s[i] + 1 != '\0' && s[i + 2] != '\0') {
    if ((s[i] != s[i + 1]) && (s[i] == s[i + 2])) {
      list_add(s + i, list);
    }
    i++;
  }
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x120,%rsp
  mov    %edi,-0x114(%rbp)
  mov    %rsi,-0x120(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x110(%rbp),%rax
  prefetchnta (%rax)
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L7
  call   <__stack_chk_fail@plt>
L7:
  leave
  ret
```

assistant: ```c
int main(int argc, char **argv) {
  char data[256];
  __builtin_prefetch(&data[0], 0, 0);
  return 0;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<main>:
  endbr64
  sub    $0x118,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x108(%rsp)
  xor    %eax,%eax
  prefetchnta (%rsp)
  mov    0x108(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L6
  mov    $0x0,%eax
  add    $0x118,%rsp
  ret
L6:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int main(int argc, char **argv) {
  char data[256];
  __builtin_prefetch(&data[0], 0, 0);
  return 0;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<main>:
  endbr64
  sub    $0x118,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x108(%rsp)
  xor    %eax,%eax
  prefetchnta (%rsp)
  mov    0x108(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L6
  xor    %eax,%eax
  add    $0x118,%rsp
  ret
L6:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int main(int argc, char **argv) {
  char data[256];
  __builtin_prefetch(&data[0], 0, 0);
  return 0;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<main>:
  endbr64
  sub    $0x118,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x108(%rsp)
  xor    %eax,%eax
  prefetchnta (%rsp)
  mov    0x108(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L9
  xor    %eax,%eax
  add    $0x118,%rsp
  ret
L9:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int main(int argc, char **argv) {
  char data[256];
  __builtin_prefetch(&data[0], 0, 0);
  return 0;
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<json_utf8_seq_length>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,%eax
  mov    %al,-0x4(%rbp)
  movzbl -0x4(%rbp),%eax
  test   %al,%al
  js     L65
  mov    $0x1,%eax
  jmp    L46
L65:
  movzbl -0x4(%rbp),%eax
  and    $0xe0,%eax
  cmp    $0xc0,%eax
  jne    L72
  mov    $0x2,%eax
  jmp    L46
L72:
  movzbl -0x4(%rbp),%eax
  and    $0xf0,%eax
  cmp    $0xe0,%eax
  jne    L38
  mov    $0x3,%eax
  jmp    L46
L38:
  movzbl -0x4(%rbp),%eax
  and    $0xf8,%eax
  cmp    $0xf0,%eax
  jne    L31
  mov    $0x4,%eax
  jmp    L46
L31:
  mov    $0xfffffffe,%eax
L46:
  pop    %rbp
  ret
```

assistant: ```c
int json_utf8_seq_length(unsigned char start_byte) {
  if ((start_byte & 0x80) == 0x00) {
    return 1;
  } else if ((start_byte & 0xe0) == 0xc0) {
    return 2;
  } else if ((start_byte & 0xf0) == 0xe0) {
    return 3;
  } else if ((start_byte & 0xf8) == 0xf0) {
    return 4;
  } else {
    return (-2);
  }
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<json_utf8_seq_length>:
  endbr64
  mov    $0x1,%eax
  test   %dil,%dil
  jns    L25
  mov    %edi,%eax
  and    $0xffffffe0,%eax
  cmp    $0xc0,%al
  je     L6
  mov    %edi,%eax
  and    $0xfffffff0,%eax
  cmp    $0xe0,%al
  je     L27
  and    $0xfffffff8,%edi
  cmp    $0xf0,%dil
  mov    $0x4,%eax
  mov    $0xfffffffe,%edx
  cmovne %edx,%eax
  ret
L6:
  mov    $0x2,%eax
  ret
L27:
  mov    $0x3,%eax
L25:
  ret
```

assistant: ```c
int json_utf8_seq_length(unsigned char start_byte) {
  if ((start_byte & 0x80) == 0x00) {
    return 1;
  } else if ((start_byte & 0xe0) == 0xc0) {
    return 2;
  } else if ((start_byte & 0xf0) == 0xe0) {
    return 3;
  } else if ((start_byte & 0xf8) == 0xf0) {
    return 4;
  } else {
    return (-2);
  }
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<json_utf8_seq_length>:
  endbr64
  mov    $0x1,%eax
  test   %dil,%dil
  jns    L29
  mov    %edi,%eax
  and    $0xffffffe0,%eax
  cmp    $0xc0,%al
  je     L19
  mov    %edi,%eax
  and    $0xfffffff0,%eax
  cmp    $0xe0,%al
  je     L8
  and    $0xfffffff8,%edi
  mov    $0xfffffffe,%edx
  mov    $0x4,%eax
  cmp    $0xf0,%dil
  cmovne %edx,%eax
  ret
  nopl   (%rax)
L8:
  mov    $0x3,%eax
L29:
  ret
  xchg   %ax,%ax
L19:
  mov    $0x2,%eax
  ret
```

assistant: ```c
int json_utf8_seq_length(unsigned char start_byte) {
  if ((start_byte & 0x80) == 0x00) {
    return 1;
  } else if ((start_byte & 0xe0) == 0xc0) {
    return 2;
  } else if ((start_byte & 0xf0) == 0xe0) {
    return 3;
  } else if ((start_byte & 0xf8) == 0xf0) {
    return 4;
  } else {
    return (-2);
  }
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<json_utf8_seq_length>:
  endbr64
  mov    $0x1,%eax
  test   %dil,%dil
  jns    L1
  mov    %edi,%eax
  and    $0xffffffe0,%eax
  cmp    $0xc0,%al
  je     L9
  mov    %edi,%eax
  and    $0xfffffff0,%eax
  cmp    $0xe0,%al
  je     L16
  and    $0xfffffff8,%edi
  mov    $0xfffffffe,%edx
  mov    $0x4,%eax
  cmp    $0xf0,%dil
  cmovne %edx,%eax
  ret
  nopl   (%rax)
L16:
  mov    $0x3,%eax
L1:
  ret
  xchg   %ax,%ax
L9:
  mov    $0x2,%eax
  ret
```

assistant: ```c
int json_utf8_seq_length(unsigned char start_byte) {
  if ((start_byte & 0x80) == 0x00) {
    return 1;
  } else if ((start_byte & 0xe0) == 0xc0) {
    return 2;
  } else if ((start_byte & 0xf0) == 0xe0) {
    return 3;
  } else if ((start_byte & 0xf8) == 0xf0) {
    return 4;
  } else {
    return (-2);
  }
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<input_map_c2>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,%eax
  mov    %al,-0x4(%rbp)
  cmpb   $0x62,-0x4(%rbp)
  jne    L6
  mov    $0x1,%eax
  jmp    L20
L6:
  cmpb   $0x63,-0x4(%rbp)
  jne    L24
  mov    $0x2,%eax
  jmp    L20
L24:
  mov    $0x0,%eax
L20:
  pop    %rbp
  ret
```

assistant: ```c
int input_map_c2(char c) {
  if (c == 'b')
    return 1;
  else if (c == 'c')
    return 2;
  else
    return 0;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<input_map_c2>:
  endbr64
  mov    $0x1,%eax
  cmp    $0x62,%dil
  je     L8
  cmp    $0x63,%dil
  sete   %al
  movzbl %al,%eax
  add    %eax,%eax
L8:
  ret
```

assistant: ```c
int input_map_c2(char c) {
  if (c == 'b')
    return 1;
  else if (c == 'c')
    return 2;
  else
    return 0;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<input_map_c2>:
  endbr64
  mov    $0x1,%eax
  cmp    $0x62,%dil
  je     L2
  xor    %eax,%eax
  cmp    $0x63,%dil
  sete   %al
  add    %eax,%eax
L2:
  ret
```

assistant: ```c
int input_map_c2(char c) {
  if (c == 'b')
    return 1;
  else if (c == 'c')
    return 2;
  else
    return 0;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<input_map_c2>:
  endbr64
  mov    $0x1,%eax
  cmp    $0x62,%dil
  je     L1
  xor    %eax,%eax
  cmp    $0x63,%dil
  sete   %al
  add    %eax,%eax
L1:
  ret
```

assistant: ```c
int input_map_c2(char c) {
  if (c == 'b')
    return 1;
  else if (c == 'c')
    return 2;
  else
    return 0;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<utf32_to_8>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x4(%rbp)
  mov    %rsi,-0x10(%rbp)
  cmpl   $0x7f,-0x4(%rbp)
  jg     L45
  mov    -0x10(%rbp),%rax
  mov    -0x4(%rbp),%edx
  mov    %edx,(%rax)
  mov    $0x1,%eax
  jmp    L74
L45:
  cmpl   $0x7ff,-0x4(%rbp)
  jg     L69
  mov    -0x4(%rbp),%eax
  sar    $0x6,%eax
  and    $0x1f,%eax
  or     $0xc0,%al
  mov    %eax,%edx
  mov    -0x10(%rbp),%rax
  mov    %edx,(%rax)
  mov    -0x4(%rbp),%eax
  and    $0x3f,%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%rax
  add    $0x4,%rax
  or     $0x80,%dl
  mov    %edx,(%rax)
  mov    $0x2,%eax
  jmp    L74
L69:
  cmpl   $0xffff,-0x4(%rbp)
  jg     L44
  mov    -0x4(%rbp),%eax
  sar    $0xc,%eax
  and    $0xf,%eax
  or     $0xe0,%al
  mov    %eax,%edx
  mov    -0x10(%rbp),%rax
  mov    %edx,(%rax)
  mov    -0x4(%rbp),%eax
  sar    $0x6,%eax
  and    $0x3f,%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%rax
  add    $0x4,%rax
  or     $0x80,%dl
  mov    %edx,(%rax)
  mov    -0x4(%rbp),%eax
  and    $0x3f,%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%rax
  add    $0x8,%rax
  or     $0x80,%dl
  mov    %edx,(%rax)
  mov    $0x3,%eax
  jmp    L74
L44:
  cmpl   $0x10ffff,-0x4(%rbp)
  jg     L79
  mov    -0x4(%rbp),%eax
  sar    $0x12,%eax
  and    $0x7,%eax
  or     $0xf0,%al
  mov    %eax,%edx
  mov    -0x10(%rbp),%rax
  mov    %edx,(%rax)
  mov    -0x4(%rbp),%eax
  sar    $0xc,%eax
  and    $0x3f,%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%rax
  add    $0x4,%rax
  or     $0x80,%dl
  mov    %edx,(%rax)
  mov    -0x4(%rbp),%eax
  sar    $0x6,%eax
  and    $0x3f,%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%rax
  add    $0x8,%rax
  or     $0x80,%dl
  mov    %edx,(%rax)
  mov    -0x4(%rbp),%eax
  and    $0x3f,%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%rax
  add    $0xc,%rax
  or     $0x80,%dl
  mov    %edx,(%rax)
  mov    $0x4,%eax
  jmp    L74
L79:
  mov    $0x0,%eax
L74:
  pop    %rbp
  ret
```

assistant: ```c
size_t utf32_to_8(uint32_t utf32, uint8_t *utf8) {
  if (utf32 < 0x80) {
    *utf8 = (uint8_t)utf32;
    return 1;
  }
  if (utf32 < 0x800) {
    utf8[0] = 0xc0 | ((utf32 & 0x07c0) >> 6);
    utf8[1] = 0x80 | (utf32 & 0x003f);
    return 2;
  }
  if (utf32 < 0x10000) {
    utf8[0] = 0xe0 | ((utf32 & 0xf000) >> 12);
    utf8[1] = 0x80 | ((utf32 & 0x0fc0) >> 6);
    utf8[2] = 0x80 | (utf32 & 0x003f);
    return 3;
  }
  if (utf32 < 0x110000) {
    utf8[0] = 0xf0 | ((utf32 & 0x1c0000) >> 18);
    utf8[1] = 0x80 | ((utf32 & 0x03f000) >> 12);
    utf8[2] = 0x80 | ((utf32 & 0x000fc0) >> 6);
    utf8[3] = 0x80 | (utf32 & 0x00003f);
    return 4;
  }
  return 0;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<utf32_to_8>:
  endbr64
  mov    %edi,%eax
  cmp    $0x7f,%edi
  jle    L22
  cmp    $0x7ff,%edi
  jle    L30
  cmp    $0xffff,%edi
  jle    L57
  mov    $0x0,%edx
  cmp    $0x10ffff,%edi
  jg     L15
  mov    %edi,%edx
  sar    $0x12,%edx
  or     $0xf0,%dl
  mov    %edx,(%rsi)
  mov    %edi,%edx
  sar    $0xc,%edx
  and    $0x3f,%edx
  or     $0x80,%dl
  mov    %edx,0x4(%rsi)
  mov    %edi,%edx
  sar    $0x6,%edx
  and    $0x3f,%edx
  or     $0x80,%dl
  mov    %edx,0x8(%rsi)
  and    $0x3f,%eax
  or     $0x80,%al
  mov    %eax,0xc(%rsi)
  mov    $0x4,%edx
  jmp    L15
L22:
  mov    %edi,(%rsi)
  mov    $0x1,%edx
L15:
  mov    %rdx,%rax
  ret
L30:
  mov    %edi,%edx
  sar    $0x6,%edx
  or     $0xc0,%dl
  mov    %edx,(%rsi)
  and    $0x3f,%eax
  or     $0x80,%al
  mov    %eax,0x4(%rsi)
  mov    $0x2,%edx
  jmp    L15
L57:
  mov    %edi,%edx
  sar    $0xc,%edx
  or     $0xe0,%dl
  mov    %edx,(%rsi)
  mov    %edi,%edx
  sar    $0x6,%edx
  and    $0x3f,%edx
  or     $0x80,%dl
  mov    %edx,0x4(%rsi)
  and    $0x3f,%eax
  or     $0x80,%al
  mov    %eax,0x8(%rsi)
  mov    $0x3,%edx
  jmp    L15
```

assistant: ```c
size_t utf32_to_8(uint32_t utf32, uint8_t *utf8) {
  if (utf32 < 0x80) {
    *utf8 = (uint8_t)utf32;
    return 1;
  }
  if (utf32 < 0x800) {
    utf8[0] = 0xc0 | ((utf32 & 0x07c0) >> 6);
    utf8[1] = 0x80 | (utf32 & 0x003f);
    return 2;
  }
  if (utf32 < 0x10000) {
    utf8[0] = 0xe0 | ((utf32 & 0xf000) >> 12);
    utf8[1] = 0x80 | ((utf32 & 0x0fc0) >> 6);
    utf8[2] = 0x80 | (utf32 & 0x003f);
    return 3;
  }
  if (utf32 < 0x110000) {
    utf8[0] = 0xf0 | ((utf32 & 0x1c0000) >> 18);
    utf8[1] = 0x80 | ((utf32 & 0x03f000) >> 12);
    utf8[2] = 0x80 | ((utf32 & 0x000fc0) >> 6);
    utf8[3] = 0x80 | (utf32 & 0x00003f);
    return 4;
  }
  return 0;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<utf32_to_8>:
  endbr64
  mov    %edi,%eax
  cmp    $0x7f,%edi
  jle    L35
  cmp    $0x7ff,%edi
  jle    L11
  cmp    $0xffff,%edi
  jle    L45
  xor    %r8d,%r8d
  cmp    $0x10ffff,%edi
  jle    L37
L3:
  mov    %r8,%rax
  ret
  nopw   0x0(%rax,%rax,1)
L35:
  mov    $0x1,%r8d
  mov    %edi,(%rsi)
  mov    %r8,%rax
  ret
  nopl   0x0(%rax)
L45:
  mov    %edi,%edx
  and    $0x3f,%eax
  mov    $0x3,%r8d
  sar    $0xc,%edx
  or     $0x80,%al
  or     $0xe0,%dl
  mov    %eax,0x8(%rsi)
  mov    %r8,%rax
  mov    %edx,(%rsi)
  mov    %edi,%edx
  sar    $0x6,%edx
  and    $0x3f,%edx
  or     $0x80,%dl
  mov    %edx,0x4(%rsi)
  ret
  nopw   0x0(%rax,%rax,1)
L11:
  mov    %edi,%edx
  and    $0x3f,%eax
  mov    $0x2,%r8d
  sar    $0x6,%edx
  or     $0x80,%al
  or     $0xc0,%dl
  mov    %eax,0x4(%rsi)
  mov    %r8,%rax
  mov    %edx,(%rsi)
  ret
  nopl   0x0(%rax)
L37:
  mov    %edi,%edx
  and    $0x3f,%eax
  mov    $0x4,%r8d
  sar    $0x12,%edx
  or     $0x80,%al
  or     $0xf0,%dl
  mov    %eax,0xc(%rsi)
  mov    %edx,(%rsi)
  mov    %edi,%edx
  sar    $0xc,%edx
  and    $0x3f,%edx
  or     $0x80,%dl
  mov    %edx,0x4(%rsi)
  mov    %edi,%edx
  sar    $0x6,%edx
  and    $0x3f,%edx
  or     $0x80,%dl
  mov    %edx,0x8(%rsi)
  jmp    L3
```

assistant: ```c
size_t utf32_to_8(uint32_t utf32, uint8_t *utf8) {
  if (utf32 < 0x80) {
    *utf8 = (uint8_t)utf32;
    return 1;
  }
  if (utf32 < 0x800) {
    utf8[0] = 0xc0 | ((utf32 & 0x07c0) >> 6);
    utf8[1] = 0x80 | (utf32 & 0x003f);
    return 2;
  }
  if (utf32 < 0x10000) {
    utf8[0] = 0xe0 | ((utf32 & 0xf000) >> 12);
    utf8[1] = 0x80 | ((utf32 & 0x0fc0) >> 6);
    utf8[2] = 0x80 | (utf32 & 0x003f);
    return 3;
  }
  if (utf32 < 0x110000) {
    utf8[0] = 0xf0 | ((utf32 & 0x1c0000) >> 18);
    utf8[1] = 0x80 | ((utf32 & 0x03f000) >> 12);
    utf8[2] = 0x80 | ((utf32 & 0x000fc0) >> 6);
    utf8[3] = 0x80 | (utf32 & 0x00003f);
    return 4;
  }
  return 0;
}
```