ylfeng/ReF-Decompile-dataset huggingface dataset:
user: Converte this assembly snippet into its equivalent C code:

```asm
<alloc_3d_char>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %edi,%ebp
  mov    %esi,%r14d
  mov    %edx,%ebx
  imul   %esi,%edi
  imul   %edx,%edi
  call   <malloc@plt>
  mov    %rax,%r15
  mov    %rax,0x10(%rsp)
  lea    0x0(,%rbp,8),%edi
  call   <malloc@plt>
  mov    %rax,0x18(%rsp)
  test   %r15,%r15
  je     L65
  test   %rax,%rax
  je     L65
  test   %ebp,%ebp
  jle    L84
  lea    0x0(,%r14,8),%edi
  mov    %edi,0x8(%rsp)
  mov    %ebx,%edi
  imul   %r14d,%edi
  mov    %edi,0xc(%rsp)
  mov    %rax,%r12
  mov    %ebp,%ebp
  lea    (%rax,%rbp,8),%r15
  lea    -0x1(%r14),%eax
  lea    0x8(,%rax,8),%rbp
  mov    $0x0,%r13d
  movslq %ebx,%rbx
  jmp    L60
L77:
  add    $0x8,%r12
  add    0xc(%rsp),%r13d
  cmp    %r15,%r12
  je     L84
L60:
  mov    0x8(%rsp),%edi
  call   <malloc@plt>
  mov    %r12,%rsi
  mov    %rax,(%r12)
  test   %rax,%rax
  je     L0
  test   %r14d,%r14d
  jle    L77
  movslq %r13d,%rdx
  add    0x10(%rsp),%rdx
  mov    $0x0,%eax
L13:
  mov    (%rsi),%rcx
  mov    %rdx,(%rcx,%rax,1)
  add    $0x8,%rax
  add    %rbx,%rdx
  cmp    %rbp,%rax
  jne    L13
  jmp    L77
L65:
  movq   $0x0,0x18(%rsp)
  jmp    L84
L0:
  mov    %rax,0x18(%rsp)
L84:
  mov    0x18(%rsp),%rax
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
char ***alloc_3d_char(int ndim1, int ndim2, int ndim3) {
  char *space = malloc(ndim1 * ndim2 * ndim3 * sizeof(char));
  char ***array3 = malloc(ndim1 * sizeof(char **));
  int i, j;
  if (space == NULL || array3 == NULL)
    return NULL;
  for (j = 0; j < ndim1; j++) {
    array3[j] = malloc(ndim2 * sizeof(char *));
    if (array3[j] == NULL)
      return NULL;
    for (i = 0; i < ndim2; i++)
      array3[j][i] = space + j * (ndim3 * ndim2) + i * ndim3;
  }
  return array3;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<alloc_3d_char>:
  endbr64
  push   %r15
  mov    %edx,%r15d
  push   %r14
  push   %r13
  mov    %edi,%r13d
  mov    %r13d,%edi
  push   %r12
  imul   %esi,%edi
  push   %rbp
  push   %rbx
  mov    %esi,%ebx
  imul   %edx,%edi
  sub    $0x28,%rsp
  call   <malloc@plt>
  lea    0x0(,%r13,8),%edi
  mov    %rax,0x10(%rsp)
  mov    %rax,%r14
  call   <malloc@plt>
  mov    %rax,0x18(%rsp)
  test   %r14,%r14
  je     L69
  test   %rax,%rax
  je     L69
  test   %r13d,%r13d
  jle    L74
  mov    %r15d,%ecx
  mov    %rax,%rbp
  lea    (%rax,%r13,8),%rax
  xor    %r14d,%r14d
  imul   %ebx,%ecx
  mov    %rax,0x8(%rsp)
  lea    -0x1(%rbx),%eax
  movslq %r15d,%r13
  lea    0x0(,%rbx,8),%r12d
  lea    0x8(,%rax,8),%r15
  mov    %ecx,0x4(%rsp)
  nopl   0x0(%rax,%rax,1)
L66:
  mov    %r12d,%edi
  call   <malloc@plt>
  mov    %rax,0x0(%rbp)
  test   %rax,%rax
  je     L69
  test   %ebx,%ebx
  jle    L18
  movslq %r14d,%rdx
  lea    (%rax,%r15,1),%rdi
  add    0x10(%rsp),%rdx
  nopl   0x0(%rax)
L60:
  mov    %rdx,(%rax)
  add    $0x8,%rax
  add    %r13,%rdx
  cmp    %rdi,%rax
  jne    L60
L18:
  add    $0x8,%rbp
  add    0x4(%rsp),%r14d
  cmp    0x8(%rsp),%rbp
  jne    L66
L74:
  mov    0x18(%rsp),%rax
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L69:
  movq   $0x0,0x18(%rsp)
  jmp    L74
```

assistant: ```c
char ***alloc_3d_char(int ndim1, int ndim2, int ndim3) {
  char *space = malloc(ndim1 * ndim2 * ndim3 * sizeof(char));
  char ***array3 = malloc(ndim1 * sizeof(char **));
  int i, j;
  if (space == NULL || array3 == NULL)
    return NULL;
  for (j = 0; j < ndim1; j++) {
    array3[j] = malloc(ndim2 * sizeof(char *));
    if (array3[j] == NULL)
      return NULL;
    for (i = 0; i < ndim2; i++)
      array3[j][i] = space + j * (ndim3 * ndim2) + i * ndim3;
  }
  return array3;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<sb_compat_status_code>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x14(%rbp)
  mov    -0x14(%rbp),%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  pop    %rbp
  ret
```

assistant: ```c
int sb_compat_status_code(int waitstatus) {
  int rv = waitstatus;
  return rv;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<sb_compat_status_code>:
  endbr64
  mov    %edi,%eax
  ret
```

assistant: ```c
int sb_compat_status_code(int waitstatus) {
  int rv = waitstatus;
  return rv;
}
```
user: Translate the below assembly code into C programming language:

```asm
<sb_compat_status_code>:
  endbr64
  mov    %edi,%eax
  ret
```

assistant: ```c
int sb_compat_status_code(int waitstatus) {
  int rv = waitstatus;
  return rv;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<sb_compat_status_code>:
  endbr64
  mov    %edi,%eax
  ret
```

assistant: ```c
int sb_compat_status_code(int waitstatus) {
  int rv = waitstatus;
  return rv;
}
```
user: What is the c source code of the assembly code below?

```asm
<lcd_contrast>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %edi,-0x14(%rbp)
  cmpl   $0x0,-0x14(%rbp)
  jns    L14
  movl   $0x28,-0x4(%rbp)
  jmp    L2
L14:
  mov    -0x14(%rbp),%eax
  mov    %eax,-0x4(%rbp)
L2:
  mov    -0x4(%rbp),%eax
  mov    %eax,%edi
  call   <st7036_contrast@plt>
  nop
  leave
  ret
```

assistant: ```c
void lcd_contrast(int c) {
  int con;
  if (c < 0)
    con = 40;
  else
    con = c;
  st7036_contrast(con);
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<lcd_contrast>:
  endbr64
  sub    $0x8,%rsp
  test   %edi,%edi
  mov    $0x28,%eax
  cmovs  %eax,%edi
  call   <st7036_contrast@plt>
  add    $0x8,%rsp
  ret
```

assistant: ```c
void lcd_contrast(int c) {
  int con;
  if (c < 0)
    con = 40;
  else
    con = c;
  st7036_contrast(con);
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<lcd_contrast>:
  endbr64
  test   %edi,%edi
  mov    $0x28,%eax
  cmovs  %eax,%edi
  jmp    1050 <st7036_contrast@plt>
```

assistant: ```c
void lcd_contrast(int c) {
  int con;
  if (c < 0)
    con = 40;
  else
    con = c;
  st7036_contrast(con);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<lcd_contrast>:
  endbr64
  test   %edi,%edi
  mov    $0x28,%eax
  cmovs  %eax,%edi
  jmp    1050 <st7036_contrast@plt>
```

assistant: ```c
void lcd_contrast(int c) {
  int con;
  if (c < 0)
    con = 40;
  else
    con = c;
  st7036_contrast(con);
}
```
user: Translate the below assembly code into C programming language:

```asm
<acpt_puts>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x8(%rbp)
  mov    -0x8(%rbp),%edx
  mov    -0x20(%rbp),%rcx
  mov    -0x18(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <acpt_write@plt>
  mov    %eax,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  leave
  ret
```

assistant: ```c
int acpt_puts(BIO *bp, const char *str) {
  int n, ret;
  n = strlen(str);
  ret = acpt_write(bp, str, n);
  return (ret);
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<acpt_puts>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbp
  mov    %rsi,%rbx
  mov    %rsi,%rdi
  call   <strlen@plt>
  mov    %eax,%edx
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  call   <acpt_write@plt>
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
int acpt_puts(BIO *bp, const char *str) {
  int n, ret;
  n = strlen(str);
  ret = acpt_write(bp, str, n);
  return (ret);
}
```
user: What is the c source code of the assembly code below:

```asm
<acpt_puts>:
  endbr64
  push   %r12
  mov    %rdi,%r12
  mov    %rsi,%rdi
  push   %rbp
  mov    %rsi,%rbp
  sub    $0x8,%rsp
  call   <strlen@plt>
  add    $0x8,%rsp
  mov    %rbp,%rsi
  mov    %r12,%rdi
  pop    %rbp
  mov    %eax,%edx
  pop    %r12
  jmp    1070 <acpt_write@plt>
```

assistant: ```c
int acpt_puts(BIO *bp, const char *str) {
  int n, ret;
  n = strlen(str);
  ret = acpt_write(bp, str, n);
  return (ret);
}
```
user: What is the c source code of the assembly code below?

```asm
<acpt_puts>:
  endbr64
  push   %r12
  mov    %rdi,%r12
  mov    %rsi,%rdi
  push   %rbp
  mov    %rsi,%rbp
  sub    $0x8,%rsp
  call   <strlen@plt>
  add    $0x8,%rsp
  mov    %rbp,%rsi
  mov    %r12,%rdi
  pop    %rbp
  mov    %eax,%edx
  pop    %r12
  jmp    1070 <acpt_write@plt>
```

assistant: ```c
int acpt_puts(BIO *bp, const char *str) {
  int n, ret;
  n = strlen(str);
  ret = acpt_write(bp, str, n);
  return (ret);
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<IniAf>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    $0x0,%edi
  call   <AfDrvSw@plt>
  mov    $0x20,%esi
  mov    $0x81,%edi
  call   <RegWriteA@plt>
  mov    $0x0,%esi
  mov    $0x83,%edi
  call   <RegWriteA@plt>
  mov    $0x80,%esi
  mov    $0x84,%edi
  call   <RegWriteA@plt>
  mov    $0x0,%esi
  mov    $0x90,%edi
  call   <RegWriteA@plt>
  mov    $0x80,%esi
  mov    $0x88,%edi
  call   <RegWriteA@plt>
  mov    $0x0,%esi
  mov    $0x82,%edi
  call   <RegWriteA@plt>
  mov    $0x0,%esi
  mov    $0x85,%edi
  call   <RegWriteA@plt>
  mov    $0x1,%esi
  mov    $0x91,%edi
  call   <RegWriteA@plt>
  mov    $0x20,%esi
  mov    $0x99,%edi
  call   <RegWriteA@plt>
  mov    $0x40,%esi
  mov    $0xa1,%edi
  call   <RegWriteA@plt>
  lea    -0x9(%rbp),%rax
  mov    %rax,%rsi
  mov    $0x250,%edi
  call   <RegReadA@plt>
  movzbl -0x9(%rbp),%eax
  and    $0x7f,%eax
  mov    %al,-0x9(%rbp)
  movzbl -0x9(%rbp),%eax
  movzbl %al,%eax
  mov    %eax,%esi
  mov    $0x250,%edi
  call   <RegWriteA@plt>
  mov    $0x0,%esi
  mov    $0x264,%edi
  call   <RegWriteA@plt>
  mov    $0x0,%esi
  mov    $0x302,%edi
  call   <RegWriteA@plt>
  mov    $0x7fff,%esi
  mov    $0x396,%edi
  call   <RamWriteA@plt>
  mov    $0x75fe,%esi
  mov    $0x398,%edi
  call   <RamWriteA@plt>
  mov    $0x7f32,%esi
  mov    $0x39a,%edi
  call   <RamWriteA@plt>
  mov    $0xf1,%esi
  mov    $0x303,%edi
  call   <RegWriteA@plt>
  mov    $0x0,%esi
  mov    $0x304,%edi
  call   <RamWriteA@plt>
  movzbl -0x9(%rbp),%eax
  or     $0xffffff80,%eax
  mov    %al,-0x9(%rbp)
  movzbl -0x9(%rbp),%eax
  movzbl %al,%eax
  mov    %eax,%esi
  mov    $0x250,%edi
  call   <RegWriteA@plt>
  mov    $0x5,%esi
  mov    $0x264,%edi
  call   <RegWriteA@plt>
  mov    $0x1,%edi
  call   <AfDrvSw@plt>
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L0
  call   <__stack_chk_fail@plt>
L0:
  leave
  ret
```

assistant: ```c
void IniAf(void) {
  unsigned char UcStbb0;
  AfDrvSw(0x00);
  RegWriteA(0x0081, 0x20);
  RegWriteA(0x0083, 0x00);
  RegWriteA(0x0084, 0x80);
  RegWriteA(0x0090, 0x00);
  RegWriteA(0x0088, 0x80);
  RegWriteA(0x0082, 0x00);
  RegWriteA(0x0085, 0x00);
  RegWriteA(0x0091, 0x01);
  RegWriteA(0x0099, 0x20);
  RegWriteA(0x00A1, 0x40);
  RegReadA(0x0250, &UcStbb0);
  UcStbb0 &= 0x7F;
  RegWriteA(0x0250, UcStbb0);
  RegWriteA(0x0264, 0x00);
  RegWriteA(0x0302, 0x00);
  RamWriteA(0x0396, 0x7FFF);
  RamWriteA(0x0398, 0x75FE);
  RamWriteA(0x039A, 0x7F32);
  RegWriteA(0x0303, 0xF1);
  RamWriteA(0x0304, 0x0000);
  UcStbb0 |= 0x80;
  RegWriteA(0x0250, UcStbb0);
  RegWriteA(0x0264, 0x05);
  AfDrvSw(0x01);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<IniAf>:
  endbr64
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    $0x0,%edi
  call   <AfDrvSw@plt>
  mov    $0x20,%esi
  mov    $0x81,%edi
  call   <RegWriteA@plt>
  mov    $0x0,%esi
  mov    $0x83,%edi
  call   <RegWriteA@plt>
  mov    $0x80,%esi
  mov    $0x84,%edi
  call   <RegWriteA@plt>
  mov    $0x0,%esi
  mov    $0x90,%edi
  call   <RegWriteA@plt>
  mov    $0x80,%esi
  mov    $0x88,%edi
  call   <RegWriteA@plt>
  mov    $0x0,%esi
  mov    $0x82,%edi
  call   <RegWriteA@plt>
  mov    $0x0,%esi
  mov    $0x85,%edi
  call   <RegWriteA@plt>
  mov    $0x1,%esi
  mov    $0x91,%edi
  call   <RegWriteA@plt>
  mov    $0x20,%esi
  mov    $0x99,%edi
  call   <RegWriteA@plt>
  mov    $0x40,%esi
  mov    $0xa1,%edi
  call   <RegWriteA@plt>
  lea    0x7(%rsp),%rsi
  mov    $0x250,%edi
  call   <RegReadA@plt>
  movzbl 0x7(%rsp),%esi
  and    $0x7f,%esi
  mov    %sil,0x7(%rsp)
  movzbl %sil,%esi
  mov    $0x250,%edi
  call   <RegWriteA@plt>
  mov    $0x0,%esi
  mov    $0x264,%edi
  call   <RegWriteA@plt>
  mov    $0x0,%esi
  mov    $0x302,%edi
  call   <RegWriteA@plt>
  mov    $0x7fff,%esi
  mov    $0x396,%edi
  call   <RamWriteA@plt>
  mov    $0x75fe,%esi
  mov    $0x398,%edi
  call   <RamWriteA@plt>
  mov    $0x7f32,%esi
  mov    $0x39a,%edi
  call   <RamWriteA@plt>
  mov    $0xf1,%esi
  mov    $0x303,%edi
  call   <RegWriteA@plt>
  mov    $0x0,%esi
  mov    $0x304,%edi
  call   <RamWriteA@plt>
  movzbl 0x7(%rsp),%esi
  or     $0xffffff80,%esi
  mov    %sil,0x7(%rsp)
  movzbl %sil,%esi
  mov    $0x250,%edi
  call   <RegWriteA@plt>
  mov    $0x5,%esi
  mov    $0x264,%edi
  call   <RegWriteA@plt>
  mov    $0x1,%edi
  call   <AfDrvSw@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L5
  add    $0x18,%rsp
  ret
L5:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void IniAf(void) {
  unsigned char UcStbb0;
  AfDrvSw(0x00);
  RegWriteA(0x0081, 0x20);
  RegWriteA(0x0083, 0x00);
  RegWriteA(0x0084, 0x80);
  RegWriteA(0x0090, 0x00);
  RegWriteA(0x0088, 0x80);
  RegWriteA(0x0082, 0x00);
  RegWriteA(0x0085, 0x00);
  RegWriteA(0x0091, 0x01);
  RegWriteA(0x0099, 0x20);
  RegWriteA(0x00A1, 0x40);
  RegReadA(0x0250, &UcStbb0);
  UcStbb0 &= 0x7F;
  RegWriteA(0x0250, UcStbb0);
  RegWriteA(0x0264, 0x00);
  RegWriteA(0x0302, 0x00);
  RamWriteA(0x0396, 0x7FFF);
  RamWriteA(0x0398, 0x75FE);
  RamWriteA(0x039A, 0x7F32);
  RegWriteA(0x0303, 0xF1);
  RamWriteA(0x0304, 0x0000);
  UcStbb0 |= 0x80;
  RegWriteA(0x0250, UcStbb0);
  RegWriteA(0x0264, 0x05);
  AfDrvSw(0x01);
}
```
user: What is the c source code of the assembly code below:

```asm
<IniAf>:
  endbr64
  sub    $0x18,%rsp
  xor    %edi,%edi
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  call   <AfDrvSw@plt>
  mov    $0x20,%esi
  mov    $0x81,%edi
  call   <RegWriteA@plt>
  xor    %esi,%esi
  mov    $0x83,%edi
  call   <RegWriteA@plt>
  mov    $0x80,%esi
  mov    $0x84,%edi
  call   <RegWriteA@plt>
  xor    %esi,%esi
  mov    $0x90,%edi
  call   <RegWriteA@plt>
  mov    $0x80,%esi
  mov    $0x88,%edi
  call   <RegWriteA@plt>
  xor    %esi,%esi
  mov    $0x82,%edi
  call   <RegWriteA@plt>
  xor    %esi,%esi
  mov    $0x85,%edi
  call   <RegWriteA@plt>
  mov    $0x1,%esi
  mov    $0x91,%edi
  call   <RegWriteA@plt>
  mov    $0x20,%esi
  mov    $0x99,%edi
  call   <RegWriteA@plt>
  mov    $0x40,%esi
  mov    $0xa1,%edi
  call   <RegWriteA@plt>
  lea    0x7(%rsp),%rsi
  mov    $0x250,%edi
  call   <RegReadA@plt>
  movzbl 0x7(%rsp),%esi
  mov    $0x250,%edi
  and    $0x7f,%esi
  mov    %sil,0x7(%rsp)
  movzbl %sil,%esi
  call   <RegWriteA@plt>
  xor    %esi,%esi
  mov    $0x264,%edi
  call   <RegWriteA@plt>
  xor    %esi,%esi
  mov    $0x302,%edi
  call   <RegWriteA@plt>
  mov    $0x7fff,%esi
  mov    $0x396,%edi
  call   <RamWriteA@plt>
  mov    $0x75fe,%esi
  mov    $0x398,%edi
  call   <RamWriteA@plt>
  mov    $0x7f32,%esi
  mov    $0x39a,%edi
  call   <RamWriteA@plt>
  mov    $0xf1,%esi
  mov    $0x303,%edi
  call   <RegWriteA@plt>
  xor    %esi,%esi
  mov    $0x304,%edi
  call   <RamWriteA@plt>
  movzbl 0x7(%rsp),%esi
  mov    $0x250,%edi
  or     $0xffffff80,%esi
  mov    %sil,0x7(%rsp)
  movzbl %sil,%esi
  call   <RegWriteA@plt>
  mov    $0x264,%edi
  mov    $0x5,%esi
  call   <RegWriteA@plt>
  mov    $0x1,%edi
  call   <AfDrvSw@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L6
  add    $0x18,%rsp
  ret
L6:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void IniAf(void) {
  unsigned char UcStbb0;
  AfDrvSw(0x00);
  RegWriteA(0x0081, 0x20);
  RegWriteA(0x0083, 0x00);
  RegWriteA(0x0084, 0x80);
  RegWriteA(0x0090, 0x00);
  RegWriteA(0x0088, 0x80);
  RegWriteA(0x0082, 0x00);
  RegWriteA(0x0085, 0x00);
  RegWriteA(0x0091, 0x01);
  RegWriteA(0x0099, 0x20);
  RegWriteA(0x00A1, 0x40);
  RegReadA(0x0250, &UcStbb0);
  UcStbb0 &= 0x7F;
  RegWriteA(0x0250, UcStbb0);
  RegWriteA(0x0264, 0x00);
  RegWriteA(0x0302, 0x00);
  RamWriteA(0x0396, 0x7FFF);
  RamWriteA(0x0398, 0x75FE);
  RamWriteA(0x039A, 0x7F32);
  RegWriteA(0x0303, 0xF1);
  RamWriteA(0x0304, 0x0000);
  UcStbb0 |= 0x80;
  RegWriteA(0x0250, UcStbb0);
  RegWriteA(0x0264, 0x05);
  AfDrvSw(0x01);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<IniAf>:
  endbr64
  sub    $0x18,%rsp
  xor    %edi,%edi
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  call   <AfDrvSw@plt>
  mov    $0x20,%esi
  mov    $0x81,%edi
  call   <RegWriteA@plt>
  xor    %esi,%esi
  mov    $0x83,%edi
  call   <RegWriteA@plt>
  mov    $0x80,%esi
  mov    $0x84,%edi
  call   <RegWriteA@plt>
  xor    %esi,%esi
  mov    $0x90,%edi
  call   <RegWriteA@plt>
  mov    $0x80,%esi
  mov    $0x88,%edi
  call   <RegWriteA@plt>
  xor    %esi,%esi
  mov    $0x82,%edi
  call   <RegWriteA@plt>
  xor    %esi,%esi
  mov    $0x85,%edi
  call   <RegWriteA@plt>
  mov    $0x1,%esi
  mov    $0x91,%edi
  call   <RegWriteA@plt>
  mov    $0x20,%esi
  mov    $0x99,%edi
  call   <RegWriteA@plt>
  mov    $0x40,%esi
  mov    $0xa1,%edi
  call   <RegWriteA@plt>
  lea    0x7(%rsp),%rsi
  mov    $0x250,%edi
  call   <RegReadA@plt>
  movzbl 0x7(%rsp),%esi
  mov    $0x250,%edi
  and    $0x7f,%esi
  mov    %sil,0x7(%rsp)
  movzbl %sil,%esi
  call   <RegWriteA@plt>
  xor    %esi,%esi
  mov    $0x264,%edi
  call   <RegWriteA@plt>
  xor    %esi,%esi
  mov    $0x302,%edi
  call   <RegWriteA@plt>
  mov    $0x7fff,%esi
  mov    $0x396,%edi
  call   <RamWriteA@plt>
  mov    $0x75fe,%esi
  mov    $0x398,%edi
  call   <RamWriteA@plt>
  mov    $0x7f32,%esi
  mov    $0x39a,%edi
  call   <RamWriteA@plt>
  mov    $0xf1,%esi
  mov    $0x303,%edi
  call   <RegWriteA@plt>
  xor    %esi,%esi
  mov    $0x304,%edi
  call   <RamWriteA@plt>
  movzbl 0x7(%rsp),%esi
  mov    $0x250,%edi
  or     $0xffffff80,%esi
  mov    %sil,0x7(%rsp)
  movzbl %sil,%esi
  call   <RegWriteA@plt>
  mov    $0x264,%edi
  mov    $0x5,%esi
  call   <RegWriteA@plt>
  mov    $0x1,%edi
  call   <AfDrvSw@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L0
  add    $0x18,%rsp
  ret
L0:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void IniAf(void) {
  unsigned char UcStbb0;
  AfDrvSw(0x00);
  RegWriteA(0x0081, 0x20);
  RegWriteA(0x0083, 0x00);
  RegWriteA(0x0084, 0x80);
  RegWriteA(0x0090, 0x00);
  RegWriteA(0x0088, 0x80);
  RegWriteA(0x0082, 0x00);
  RegWriteA(0x0085, 0x00);
  RegWriteA(0x0091, 0x01);
  RegWriteA(0x0099, 0x20);
  RegWriteA(0x00A1, 0x40);
  RegReadA(0x0250, &UcStbb0);
  UcStbb0 &= 0x7F;
  RegWriteA(0x0250, UcStbb0);
  RegWriteA(0x0264, 0x00);
  RegWriteA(0x0302, 0x00);
  RamWriteA(0x0396, 0x7FFF);
  RamWriteA(0x0398, 0x75FE);
  RamWriteA(0x039A, 0x7F32);
  RegWriteA(0x0303, 0xF1);
  RamWriteA(0x0304, 0x0000);
  UcStbb0 |= 0x80;
  RegWriteA(0x0250, UcStbb0);
  RegWriteA(0x0264, 0x05);
  AfDrvSw(0x01);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<gcd>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %edi,-0x4(%rbp)
  mov    %esi,-0x8(%rbp)
  cmpl   $0x0,-0x4(%rbp)
  je     L39
  mov    -0x4(%rbp),%eax
  cmp    -0x8(%rbp),%eax
  jne    L45
L39:
  mov    -0x8(%rbp),%eax
  jmp    L34
L45:
  cmpl   $0x0,-0x8(%rbp)
  jne    L36
  mov    -0x4(%rbp),%eax
  jmp    L34
L36:
  mov    -0x4(%rbp),%eax
  cmp    -0x8(%rbp),%eax
  jge    L52
  mov    -0x8(%rbp),%eax
  cltd
  idivl  -0x4(%rbp)
  mov    -0x4(%rbp),%eax
  mov    %eax,%esi
  mov    %edx,%edi
  call   <gcd>
  jmp    L34
L52:
  mov    -0x4(%rbp),%eax
  cltd
  idivl  -0x8(%rbp)
  mov    -0x8(%rbp),%eax
  mov    %eax,%esi
  mov    %edx,%edi
  call   <gcd>
L34:
  leave
  ret
```

assistant: ```c
int gcd(int a, int b) {
  if (a == 0 || a == b)
    return b;
  if (b == 0)
    return a;
  if (a < b)
    return gcd(b % a, a);
  return gcd(a % b, b);
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<gcd>:
  endbr64
  test   %edi,%edi
  je     L8
  cmp    %esi,%edi
  je     L8
  mov    %edi,%eax
  test   %esi,%esi
  je     L30
  sub    $0x8,%rsp
  cmp    %esi,%edi
  jl     L47
  cltd
  idiv   %esi
  mov    %edx,%edi
  call   <gcd>
L43:
  add    $0x8,%rsp
  ret
L47:
  mov    %esi,%eax
  cltd
  idiv   %edi
  mov    %edi,%esi
  mov    %edx,%edi
  call   <gcd>
  jmp    L43
L8:
  mov    %esi,%eax
  ret
L30:
  ret
```

assistant: ```c
int gcd(int a, int b) {
  if (a == 0 || a == b)
    return b;
  if (b == 0)
    return a;
  if (a < b)
    return gcd(b % a, a);
  return gcd(a % b, b);
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<gcd>:
  endbr64
  cmp    %esi,%edi
  je     L55
  test   %edi,%edi
  je     L55
  test   %esi,%esi
  je     L71
L77:
  cmp    %esi,%edi
  jge    L18
L39:
  mov    %esi,%eax
  cltd
  idiv   %edi
  mov    %edx,%eax
  test   %edx,%edx
  je     L71
  cmp    %edi,%edx
  je     L71
  test   %edi,%edi
  je     L7
  mov    %edi,%esi
  mov    %edx,%edi
  cmp    %esi,%edi
  jl     L39
L18:
  mov    %edi,%eax
  cltd
  idiv   %esi
  mov    %edx,%edi
  test   %edx,%edx
  je     L55
  cmp    %esi,%edx
  jne    L77
L55:
  mov    %esi,%eax
  ret
  nopl   0x0(%rax)
L71:
  mov    %edi,%eax
L7:
  ret
```

assistant: ```c
int gcd(int a, int b) {
  if (a == 0 || a == b)
    return b;
  if (b == 0)
    return a;
  if (a < b)
    return gcd(b % a, a);
  return gcd(a % b, b);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<gcd>:
  endbr64
  cmp    %esi,%edi
  je     L3
  test   %edi,%edi
  je     L3
  test   %esi,%esi
  je     L19
L79:
  cmp    %esi,%edi
  jge    L17
L20:
  mov    %esi,%eax
  cltd
  idiv   %edi
  mov    %edx,%eax
  test   %edx,%edx
  je     L19
  cmp    %edi,%edx
  je     L19
  test   %edi,%edi
  je     L81
  mov    %edi,%esi
  mov    %edx,%edi
  cmp    %esi,%edi
  jl     L20
L17:
  mov    %edi,%eax
  cltd
  idiv   %esi
  mov    %edx,%edi
  test   %edx,%edx
  je     L3
  cmp    %esi,%edx
  jne    L79
L3:
  mov    %esi,%eax
  ret
  nopl   0x0(%rax)
L19:
  mov    %edi,%eax
L81:
  ret
```

assistant: ```c
int gcd(int a, int b) {
  if (a == 0 || a == b)
    return b;
  if (b == 0)
    return a;
  if (a < b)
    return gcd(b % a, a);
  return gcd(a % b, b);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<tm_hash>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  movq   $0x1505,-0x8(%rbp)
  jmp    L14
L4:
  mov    -0x8(%rbp),%rax
  shl    $0x5,%rax
  mov    %rax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rax,%rdx
  mov    -0xc(%rbp),%eax
  cltq
  add    %rdx,%rax
  mov    %rax,-0x8(%rbp)
L14:
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,-0xc(%rbp)
  cmpl   $0x0,-0xc(%rbp)
  jne    L4
  cmpl   $0x0,-0x1c(%rbp)
  je     L10
  mov    -0x1c(%rbp),%ecx
  mov    -0x8(%rbp),%rax
  mov    $0x0,%edx
  div    %rcx
  mov    %rdx,%rax
  jmp    L7
L10:
  mov    -0x8(%rbp),%rax
L7:
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  pop    %rbp
  ret
```

assistant: ```c
unsigned tm_hash(const char *str, unsigned table_size) {
  unsigned long hash = 5381;
  int c;
  while (c = *str++)
    hash = ((hash << 5) + hash) + c;
  hash = table_size > 0 ? hash % table_size : hash;
  return hash;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<tm_hash>:
  endbr64
  lea    0x1(%rdi),%rcx
  movzbl (%rdi),%eax
  test   %al,%al
  je     L16
  mov    $0x1505,%edx
L25:
  mov    %rdx,%rdi
  shl    $0x5,%rdi
  add    %rdi,%rdx
  movsbq %al,%rax
  add    %rax,%rdx
  add    $0x1,%rcx
  movzbl -0x1(%rcx),%eax
  test   %al,%al
  jne    L25
L7:
  test   %esi,%esi
  je     L37
  mov    %esi,%esi
  mov    %rdx,%rax
  mov    $0x0,%edx
  div    %rsi
L37:
  mov    %edx,%eax
  ret
L16:
  mov    $0x1505,%edx
  jmp    L7
```

assistant: ```c
unsigned tm_hash(const char *str, unsigned table_size) {
  unsigned long hash = 5381;
  int c;
  while (c = *str++)
    hash = ((hash << 5) + hash) + c;
  hash = table_size > 0 ? hash % table_size : hash;
  return hash;
}
```