ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 下面的汇编指令对应的C源代码是什么：

```asm
<osmo_conv_gen_metrics_k5_n4>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdx,%rbx
  mov    %rcx,%rbp
  mov    %r8d,%r12d
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  mov    %rsp,%r13
  mov    %r13,%rcx
  mov    %rsi,%rdx
  mov    %rdi,%rsi
  mov    $0x10,%edi
  call   <gen_branch_metrics_n4@plt>
  mov    %r12d,%r8d
  mov    %rbp,%rcx
  mov    %r13,%rdx
  mov    %rbx,%rsi
  mov    $0x10,%edi
  call   <gen_path_metrics@plt>
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L8
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L8:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
__attribute__((visibility("hidden"))) void osmo_conv_gen_metrics_k5_n4(const int8_t *seq, const int16_t *out, int16_t *sums, int16_t *paths, int norm) {
  int16_t metrics[8];
  gen_branch_metrics_n4(16, seq, out, metrics);
  gen_path_metrics(16, sums, metrics, paths, norm);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<osmo_conv_gen_metrics_k5_n4>:
  endbr64
  push   %r13
  push   %r12
  mov    %rcx,%r12
  push   %rbp
  mov    %rdx,%rbp
  mov    %rsi,%rdx
  mov    %rdi,%rsi
  push   %rbx
  mov    $0x10,%edi
  mov    %r8d,%ebx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  mov    %rsp,%r13
  mov    %r13,%rcx
  call   <gen_branch_metrics_n4@plt>
  mov    %ebx,%r8d
  mov    %r12,%rcx
  mov    %r13,%rdx
  mov    %rbp,%rsi
  mov    $0x10,%edi
  call   <gen_path_metrics@plt>
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L6
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L6:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
__attribute__((visibility("hidden"))) void osmo_conv_gen_metrics_k5_n4(const int8_t *seq, const int16_t *out, int16_t *sums, int16_t *paths, int norm) {
  int16_t metrics[8];
  gen_branch_metrics_n4(16, seq, out, metrics);
  gen_path_metrics(16, sums, metrics, paths, norm);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<osmo_conv_gen_metrics_k5_n4>:
  endbr64
  push   %r13
  push   %r12
  mov    %rcx,%r12
  push   %rbp
  mov    %rdx,%rbp
  mov    %rsi,%rdx
  mov    %rdi,%rsi
  push   %rbx
  mov    $0x10,%edi
  mov    %r8d,%ebx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  mov    %rsp,%r13
  mov    %r13,%rcx
  call   <gen_branch_metrics_n4@plt>
  mov    %ebx,%r8d
  mov    %r12,%rcx
  mov    %r13,%rdx
  mov    %rbp,%rsi
  mov    $0x10,%edi
  call   <gen_path_metrics@plt>
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L9
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L9:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
__attribute__((visibility("hidden"))) void osmo_conv_gen_metrics_k5_n4(const int8_t *seq, const int16_t *out, int16_t *sums, int16_t *paths, int norm) {
  int16_t metrics[8];
  gen_branch_metrics_n4(16, seq, out, metrics);
  gen_path_metrics(16, sums, metrics, paths, norm);
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<my_strlen>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  movl   $0x0,-0x4(%rbp)
  jmp    L19
L9:
  addl   $0x1,-0x4(%rbp)
L19:
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L9
  mov    -0x4(%rbp),%eax
  pop    %rbp
  ret
```

assistant: ```c
int my_strlen(char const *str) {
  int i;
  i = 0;
  while (str[i] != '\0')
    i++;
  return (i);
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<my_strlen>:
  endbr64
  cmpb   $0x0,(%rdi)
  je     L16
  mov    $0x1,%eax
L4:
  mov    %eax,%edx
  add    $0x1,%rax
  cmpb   $0x0,-0x1(%rdi,%rax,1)
  jne    L4
L25:
  mov    %edx,%eax
  ret
L16:
  mov    $0x0,%edx
  jmp    L25
```

assistant: ```c
int my_strlen(char const *str) {
  int i;
  i = 0;
  while (str[i] != '\0')
    i++;
  return (i);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<my_strlen>:
  endbr64
  cmpb   $0x0,(%rdi)
  je     L17
  mov    $0x1,%eax
  xchg   %ax,%ax
L1:
  mov    %eax,%r8d
  add    $0x1,%rax
  cmpb   $0x0,-0x1(%rdi,%rax,1)
  jne    L1
  mov    %r8d,%eax
  ret
  nopw   0x0(%rax,%rax,1)
L17:
  xor    %r8d,%r8d
  mov    %r8d,%eax
  ret
```

assistant: ```c
int my_strlen(char const *str) {
  int i;
  i = 0;
  while (str[i] != '\0')
    i++;
  return (i);
}
```
user: Translate the below assembly code into C programming language:

```asm
<my_strlen>:
  endbr64
  cmpb   $0x0,(%rdi)
  je     L10
  mov    $0x1,%eax
  xchg   %ax,%ax
L8:
  mov    %eax,%r8d
  add    $0x1,%rax
  cmpb   $0x0,-0x1(%rdi,%rax,1)
  jne    L8
  mov    %r8d,%eax
  ret
  nopw   0x0(%rax,%rax,1)
L10:
  xor    %r8d,%r8d
  mov    %r8d,%eax
  ret
```

assistant: ```c
int my_strlen(char const *str) {
  int i;
  i = 0;
  while (str[i] != '\0')
    i++;
  return (i);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<ft_putendl>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movb   $0xa,-0x9(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <ft_strlen@plt>
  mov    %eax,%edx
  mov    -0x18(%rbp),%rax
  mov    %rax,%rsi
  mov    $0x1,%edi
  call   <write@plt>
  lea    -0x9(%rbp),%rax
  mov    $0x1,%edx
  mov    %rax,%rsi
  mov    $0x1,%edi
  call   <write@plt>
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L7
  call   <__stack_chk_fail@plt>
L7:
  leave
  ret
```

assistant: ```c
void ft_putendl(char *str) {
  char endl;
  endl = '\n';
  write(1, str, ft_strlen(str));
  write(1, &endl, 1);
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<ft_putendl>:
  endbr64
  push   %rbx
  sub    $0x10,%rsp
  mov    %rdi,%rbx
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  movb   $0xa,0x7(%rsp)
  call   <ft_strlen@plt>
  mov    %eax,%edx
  mov    %rbx,%rsi
  mov    $0x1,%edi
  call   <write@plt>
  lea    0x7(%rsp),%rsi
  mov    $0x1,%edx
  mov    $0x1,%edi
  call   <write@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L0
  add    $0x10,%rsp
  pop    %rbx
  ret
L0:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void ft_putendl(char *str) {
  char endl;
  endl = '\n';
  write(1, str, ft_strlen(str));
  write(1, &endl, 1);
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<ft_putendl>:
  endbr64
  push   %rbp
  mov    %rdi,%rbp
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  movb   $0xa,0x7(%rsp)
  call   <ft_strlen@plt>
  mov    %rbp,%rsi
  mov    $0x1,%edi
  mov    %eax,%edx
  call   <write@plt>
  lea    0x7(%rsp),%rsi
  mov    $0x1,%edx
  mov    $0x1,%edi
  call   <write@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L5
  add    $0x10,%rsp
  pop    %rbp
  ret
L5:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void ft_putendl(char *str) {
  char endl;
  endl = '\n';
  write(1, str, ft_strlen(str));
  write(1, &endl, 1);
}
```
user: What is the c source code of the assembly code below:

```asm
<ft_putendl>:
  endbr64
  push   %rbp
  mov    %rdi,%rbp
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  movb   $0xa,0x7(%rsp)
  call   <ft_strlen@plt>
  mov    %rbp,%rsi
  mov    $0x1,%edi
  mov    %eax,%edx
  call   <write@plt>
  lea    0x7(%rsp),%rsi
  mov    $0x1,%edx
  mov    $0x1,%edi
  call   <write@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L2
  add    $0x10,%rsp
  pop    %rbp
  ret
L2:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void ft_putendl(char *str) {
  char endl;
  endl = '\n';
  write(1, str, ft_strlen(str));
  write(1, &endl, 1);
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<reduce_double_grid_address>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  movl   $0x0,-0x14(%rbp)
  jmp    L10
L8:
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  add    %eax,%eax
  mov    %eax,%ecx
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    -0x14(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,8),%rsi
  mov    -0x28(%rbp),%rdx
  lea    (%rsi,%rdx,1),%rbx
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <mat_modulo_l@plt>
  mov    %rax,(%rbx)
  addl   $0x1,-0x14(%rbp)
L10:
  cmpl   $0x2,-0x14(%rbp)
  jle    L8
  nop
  nop
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

assistant: ```c
void reduce_double_grid_address(long address_double[3], const long D_diag[3]) {
  int i;
  for (i = 0; i < 3; i++) {
    address_double[i] = mat_modulo_l(address_double[i], 2 * D_diag[i]);
  }
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<reduce_double_grid_address>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbp
  mov    %rsi,%r12
  mov    $0x0,%ebx
L1:
  mov    (%r12,%rbx,1),%eax
  lea    (%rax,%rax,1),%esi
  mov    0x0(%rbp,%rbx,1),%rdi
  call   <mat_modulo_l@plt>
  mov    %rax,0x0(%rbp,%rbx,1)
  add    $0x8,%rbx
  cmp    $0x18,%rbx
  jne    L1
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
void reduce_double_grid_address(long address_double[3], const long D_diag[3]) {
  int i;
  for (i = 0; i < 3; i++) {
    address_double[i] = mat_modulo_l(address_double[i], 2 * D_diag[i]);
  }
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<reduce_double_grid_address>:
  endbr64
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  xor    %ebx,%ebx
L8:
  mov    (%r12,%rbx,1),%eax
  mov    0x0(%rbp,%rbx,1),%rdi
  lea    (%rax,%rax,1),%esi
  call   <mat_modulo_l@plt>
  mov    %rax,0x0(%rbp,%rbx,1)
  add    $0x8,%rbx
  cmp    $0x18,%rbx
  jne    L8
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
void reduce_double_grid_address(long address_double[3], const long D_diag[3]) {
  int i;
  for (i = 0; i < 3; i++) {
    address_double[i] = mat_modulo_l(address_double[i], 2 * D_diag[i]);
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<reduce_double_grid_address>:
  endbr64
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  xor    %ebx,%ebx
L7:
  mov    (%r12,%rbx,1),%eax
  mov    0x0(%rbp,%rbx,1),%rdi
  lea    (%rax,%rax,1),%esi
  call   <mat_modulo_l@plt>
  mov    %rax,0x0(%rbp,%rbx,1)
  add    $0x8,%rbx
  cmp    $0x18,%rbx
  jne    L7
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
void reduce_double_grid_address(long address_double[3], const long D_diag[3]) {
  int i;
  for (i = 0; i < 3; i++) {
    address_double[i] = mat_modulo_l(address_double[i], 2 * D_diag[i]);
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<foo>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %edi,-0x4(%rbp)
  cmpl   $0x0,-0x4(%rbp)
  je     L5
  mov    -0x4(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,%edi
  call   <bar@plt>
  jmp    L6
L5:
  nop
L6:
  leave
  ret
```

assistant: ```c
void foo(int n) {
  if (!n)
    return;
  bar(n - 1);
}
```
user: What is the c source code of the assembly code below?

```asm
<foo>:
  endbr64
  test   %edi,%edi
  jne    L8
  ret
L8:
  sub    $0x8,%rsp
  sub    $0x1,%edi
  call   <bar@plt>
  add    $0x8,%rsp
  ret
```

assistant: ```c
void foo(int n) {
  if (!n)
    return;
  bar(n - 1);
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<foo>:
  endbr64
  test   %edi,%edi
  jne    L1
  ret
  nopl   0x0(%rax)
L1:
  sub    $0x1,%edi
  jmp    1050 <bar@plt>
```

assistant: ```c
void foo(int n) {
  if (!n)
    return;
  bar(n - 1);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<foo>:
  endbr64
  test   %edi,%edi
  jne    L1
  ret
  nopl   0x0(%rax)
L1:
  sub    $0x1,%edi
  jmp    1050 <bar@plt>
```

assistant: ```c
void foo(int n) {
  if (!n)
    return;
  bar(n - 1);
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<attribute_list>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    %esi,-0xc(%rbp)
  mov    -0xc(%rbp),%edx
  mov    -0x8(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <attrib@plt>
  mov    %eax,-0xc(%rbp)
  jmp    L9
L8:
  mov    -0x8(%rbp),%rax
  mov    $0x5,%esi
  mov    %rax,%rdi
  call   <eat@plt>
  mov    -0xc(%rbp),%edx
  mov    -0x8(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <attrib@plt>
  mov    %eax,-0xc(%rbp)
L9:
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <peek@plt>
  cmp    $0x5,%eax
  je     L8
  mov    -0xc(%rbp),%eax
  leave
  ret
```

assistant: ```c
unsigned int attribute_list(struct compile_state *state, unsigned type) {
  type = attrib(state, type);
  while (peek(state) == 5) {
    eat(state, 5);
    type = attrib(state, type);
  }
  return type;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<attribute_list>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbp
  call   <attrib@plt>
  mov    %eax,%ebx
  jmp    L13
L6:
  mov    $0x5,%esi
  mov    %rbp,%rdi
  call   <eat@plt>
  mov    %ebx,%esi
  mov    %rbp,%rdi
  call   <attrib@plt>
  mov    %eax,%ebx
L13:
  mov    %rbp,%rdi
  call   <peek@plt>
  cmp    $0x5,%eax
  je     L6
  mov    %ebx,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
unsigned int attribute_list(struct compile_state *state, unsigned type) {
  type = attrib(state, type);
  while (peek(state) == 5) {
    eat(state, 5);
    type = attrib(state, type);
  }
  return type;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<attribute_list>:
  endbr64
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x8,%rsp
  call   <attrib@plt>
  mov    %eax,%ebp
  jmp    L3
  cs nopw 0x0(%rax,%rax,1)
L11:
  mov    $0x5,%esi
  mov    %rbx,%rdi
  call   <eat@plt>
  mov    %ebp,%esi
  mov    %rbx,%rdi
  call   <attrib@plt>
  mov    %eax,%ebp
L3:
  mov    %rbx,%rdi
  call   <peek@plt>
  cmp    $0x5,%eax
  je     L11
  add    $0x8,%rsp
  mov    %ebp,%eax
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
unsigned int attribute_list(struct compile_state *state, unsigned type) {
  type = attrib(state, type);
  while (peek(state) == 5) {
    eat(state, 5);
    type = attrib(state, type);
  }
  return type;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<attribute_list>:
  endbr64
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x8,%rsp
  call   <attrib@plt>
  mov    %eax,%ebp
  jmp    L10
  cs nopw 0x0(%rax,%rax,1)
L11:
  mov    $0x5,%esi
  mov    %rbx,%rdi
  call   <eat@plt>
  mov    %ebp,%esi
  mov    %rbx,%rdi
  call   <attrib@plt>
  mov    %eax,%ebp
L10:
  mov    %rbx,%rdi
  call   <peek@plt>
  cmp    $0x5,%eax
  je     L11
  add    $0x8,%rsp
  mov    %ebp,%eax
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
unsigned int attribute_list(struct compile_state *state, unsigned type) {
  type = attrib(state, type);
  while (peek(state) == 5) {
    eat(state, 5);
    type = attrib(state, type);
  }
  return type;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<_spi_compute_dlybct>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %esi,-0x18(%rbp)
  mov    -0x18(%rbp),%eax
  mov    %eax,%edi
  call   <pmc_get_peripheral_clock@plt>
  mov    %eax,%eax
  imul   $0x431bde83,%rax,%rax
  shr    $0x20,%rax
  shr    $0xd,%eax
  imul   -0x14(%rbp),%eax
  mov    %eax,%eax
  imul   $0x51eb851f,%rax,%rax
  shr    $0x20,%rax
  shr    $0x5,%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  mov    %eax,%edi
  call   <SPI_CSR_DLYBCT@plt>
  leave
  ret
```

assistant: ```c
uint32_t _spi_compute_dlybct(uint32_t delay, uint32_t periph_id) {
  uint32_t dlybct = ((pmc_get_peripheral_clock(periph_id) / 31250u) * delay) / 100;
  return SPI_CSR_DLYBCT(dlybct);
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<_spi_compute_dlybct>:
  endbr64
  push   %rbx
  mov    %edi,%ebx
  mov    %esi,%edi
  call   <pmc_get_peripheral_clock@plt>
  mov    %eax,%edi
  imul   $0x431bde83,%rdi,%rdi
  shr    $0x2d,%rdi
  imul   %ebx,%edi
  imul   $0x51eb851f,%rdi,%rdi
  shr    $0x25,%rdi
  call   <SPI_CSR_DLYBCT@plt>
  pop    %rbx
  ret
```

assistant: ```c
uint32_t _spi_compute_dlybct(uint32_t delay, uint32_t periph_id) {
  uint32_t dlybct = ((pmc_get_peripheral_clock(periph_id) / 31250u) * delay) / 100;
  return SPI_CSR_DLYBCT(dlybct);
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<_spi_compute_dlybct>:
  endbr64
  push   %rbx
  mov    %edi,%ebx
  mov    %esi,%edi
  call   <pmc_get_peripheral_clock@plt>
  mov    %eax,%edi
  imul   $0x431bde83,%rdi,%rdi
  shr    $0x2d,%rdi
  imul   %ebx,%edi
  pop    %rbx
  imul   $0x51eb851f,%rdi,%rdi
  shr    $0x25,%rdi
  jmp    1070 <SPI_CSR_DLYBCT@plt>
```

assistant: ```c
uint32_t _spi_compute_dlybct(uint32_t delay, uint32_t periph_id) {
  uint32_t dlybct = ((pmc_get_peripheral_clock(periph_id) / 31250u) * delay) / 100;
  return SPI_CSR_DLYBCT(dlybct);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<_spi_compute_dlybct>:
  endbr64
  push   %rbx
  mov    %edi,%ebx
  mov    %esi,%edi
  call   <pmc_get_peripheral_clock@plt>
  mov    %eax,%edi
  imul   $0x431bde83,%rdi,%rdi
  shr    $0x2d,%rdi
  imul   %ebx,%edi
  pop    %rbx
  imul   $0x51eb851f,%rdi,%rdi
  shr    $0x25,%rdi
  jmp    1070 <SPI_CSR_DLYBCT@plt>
```

assistant: ```c
uint32_t _spi_compute_dlybct(uint32_t delay, uint32_t periph_id) {
  uint32_t dlybct = ((pmc_get_peripheral_clock(periph_id) / 31250u) * delay) / 100;
  return SPI_CSR_DLYBCT(dlybct);
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<GrOffScreen4BPPLineDrawV>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  mov    %edx,-0x20(%rbp)
  mov    %ecx,-0x24(%rbp)
  mov    %r8d,-0x28(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  add    $0x4,%rax
  mov    (%rax),%eax
  add    $0x1,%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,-0xc(%rbp)
  mov    -0xc(%rbp),%eax
  imul   -0x20(%rbp),%eax
  mov    %eax,%edx
  mov    -0x1c(%rbp),%eax
  mov    %eax,%ecx
  shr    $0x1f,%ecx
  add    %ecx,%eax
  sar    %eax
  add    %edx,%eax
  add    $0x6,%eax
  cltq
  add    $0x30,%rax
  shl    $0x2,%rax
  add    %rax,-0x8(%rbp)
  mov    -0x1c(%rbp),%eax
  and    $0x1,%eax
  test   %eax,%eax
  je     L48
  jmp    L33
L19:
  mov    -0x8(%rbp),%rax
  mov    (%rax),%eax
  and    $0xf0,%eax
  or     -0x28(%rbp),%eax
  mov    %eax,%edx
  mov    -0x8(%rbp),%rax
  mov    %edx,(%rax)
  mov    -0xc(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rax,-0x8(%rbp)
  addl   $0x1,-0x20(%rbp)
L33:
  mov    -0x20(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jle    L19
  jmp    L43
L48:
  shll   $0x4,-0x28(%rbp)
  jmp    L41
L9:
  mov    -0x8(%rbp),%rax
  mov    (%rax),%eax
  and    $0xf,%eax
  or     -0x28(%rbp),%eax
  mov    %eax,%edx
  mov    -0x8(%rbp),%rax
  mov    %edx,(%rax)
  mov    -0xc(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rax,-0x8(%rbp)
  addl   $0x1,-0x20(%rbp)
L41:
  mov    -0x20(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jle    L9
L43:
  nop
  pop    %rbp
  ret
```

assistant: ```c
void GrOffScreen4BPPLineDrawV(void *pvDisplayData, int32_t i32X, int32_t i32Y1, int32_t i32Y2, uint32_t ui32Value) {
  uint8_t *pui8Data;
  int32_t i32BytesPerRow;
  ;
  pui8Data = (uint8_t *)pvDisplayData;
  i32BytesPerRow = (*(uint16_t *)(pui8Data + 1) + 1) / 2;
  pui8Data += (i32BytesPerRow * i32Y1) + (i32X / 2) + 6 + (16 * 3);
  if (i32X & 1) {
    while (i32Y1 <= i32Y2) {
      *pui8Data = (*pui8Data & 0xf0) | ui32Value;
      pui8Data += i32BytesPerRow;
      i32Y1++;
    }
  } else {
    ui32Value <<= 4;
    while (i32Y1 <= i32Y2) {
      *pui8Data = (*pui8Data & 0x0f) | ui32Value;
      pui8Data += i32BytesPerRow;
      i32Y1++;
    }
  }
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<GrOffScreen4BPPLineDrawV>:
  endbr64
  mov    %rdi,%r10
  mov    %esi,%r9d
  mov    %ecx,%edi
  mov    0x4(%r10),%eax
  add    $0x1,%eax
  mov    %eax,%esi
  shr    $0x1f,%esi
  add    %eax,%esi
  sar    %esi
  mov    %esi,%eax
  imul   %edx,%eax
  mov    %r9d,%ecx
  shr    $0x1f,%ecx
  add    %r9d,%ecx
  sar    %ecx
  add    %ecx,%eax
  cltq
  lea    0xd8(%r10,%rax,4),%rax
  test   $0x1,%r9b
  je     L46
  cmp    %edi,%edx
  jg     L3
  movslq %esi,%rsi
  shl    $0x2,%rsi
  add    $0x1,%edi
L25:
  mov    (%rax),%ecx
  and    $0xf0,%ecx
  or     %r8d,%ecx
  mov    %ecx,(%rax)
  add    %rsi,%rax
  add    $0x1,%edx
  cmp    %edx,%edi
  jne    L25
  ret
L46:
  shl    $0x4,%r8d
  cmp    %edi,%edx
  jg     L3
  movslq %esi,%rsi
  shl    $0x2,%rsi
  add    $0x1,%edi
L11:
  mov    (%rax),%ecx
  and    $0xf,%ecx
  or     %r8d,%ecx
  mov    %ecx,(%rax)
  add    %rsi,%rax
  add    $0x1,%edx
  cmp    %edi,%edx
  jne    L11
L3:
  ret
```

assistant: ```c
void GrOffScreen4BPPLineDrawV(void *pvDisplayData, int32_t i32X, int32_t i32Y1, int32_t i32Y2, uint32_t ui32Value) {
  uint8_t *pui8Data;
  int32_t i32BytesPerRow;
  ;
  pui8Data = (uint8_t *)pvDisplayData;
  i32BytesPerRow = (*(uint16_t *)(pui8Data + 1) + 1) / 2;
  pui8Data += (i32BytesPerRow * i32Y1) + (i32X / 2) + 6 + (16 * 3);
  if (i32X & 1) {
    while (i32Y1 <= i32Y2) {
      *pui8Data = (*pui8Data & 0xf0) | ui32Value;
      pui8Data += i32BytesPerRow;
      i32Y1++;
    }
  } else {
    ui32Value <<= 4;
    while (i32Y1 <= i32Y2) {
      *pui8Data = (*pui8Data & 0x0f) | ui32Value;
      pui8Data += i32BytesPerRow;
      i32Y1++;
    }
  }
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<GrOffScreen4BPPLineDrawV>:
  endbr64
  mov    %rdi,%r10
  mov    %esi,%r9d
  mov    %ecx,%edi
  mov    0x4(%r10),%eax
  mov    %r9d,%ecx
  shr    $0x1f,%ecx
  add    $0x1,%eax
  add    %r9d,%ecx
  mov    %eax,%esi
  sar    %ecx
  shr    $0x1f,%esi
  add    %eax,%esi
  sar    %esi
  mov    %esi,%eax
  imul   %edx,%eax
  add    %ecx,%eax
  and    $0x1,%r9d
  cltq
  lea    0xd8(%r10,%rax,4),%rax
  je     L24
  cmp    %edi,%edx
  jg     L46
  movslq %esi,%rsi
  add    $0x1,%edi
  shl    $0x2,%rsi
  nopl   0x0(%rax)
L13:
  mov    (%rax),%ecx
  add    $0x1,%edx
  and    $0xf0,%ecx
  or     %r8d,%ecx
  mov    %ecx,(%rax)
  add    %rsi,%rax
  cmp    %edi,%edx
  jne    L13
  ret
  nopl   0x0(%rax,%rax,1)
L24:
  shl    $0x4,%r8d
  cmp    %edi,%edx
  jg     L46
  movslq %esi,%rsi
  add    $0x1,%edi
  shl    $0x2,%rsi
  nopw   0x0(%rax,%rax,1)
L14:
  mov    (%rax),%ecx
  add    $0x1,%edx
  and    $0xf,%ecx
  or     %r8d,%ecx
  mov    %ecx,(%rax)
  add    %rsi,%rax
  cmp    %edx,%edi
  jne    L14
L46:
  ret
```

assistant: ```c
void GrOffScreen4BPPLineDrawV(void *pvDisplayData, int32_t i32X, int32_t i32Y1, int32_t i32Y2, uint32_t ui32Value) {
  uint8_t *pui8Data;
  int32_t i32BytesPerRow;
  ;
  pui8Data = (uint8_t *)pvDisplayData;
  i32BytesPerRow = (*(uint16_t *)(pui8Data + 1) + 1) / 2;
  pui8Data += (i32BytesPerRow * i32Y1) + (i32X / 2) + 6 + (16 * 3);
  if (i32X & 1) {
    while (i32Y1 <= i32Y2) {
      *pui8Data = (*pui8Data & 0xf0) | ui32Value;
      pui8Data += i32BytesPerRow;
      i32Y1++;
    }
  } else {
    ui32Value <<= 4;
    while (i32Y1 <= i32Y2) {
      *pui8Data = (*pui8Data & 0x0f) | ui32Value;
      pui8Data += i32BytesPerRow;
      i32Y1++;
    }
  }
}
```