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

```asm
<strupr>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x14(%rbp)
  movl   $0x0,-0x18(%rbp)
  jmp    L19
L3:
  mov    -0x18(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    -0x18(%rbp),%edx
  movslq %edx,%rcx
  mov    -0x28(%rbp),%rdx
  lea    (%rcx,%rdx,1),%rbx
  mov    %eax,%edi
  call   <toupper@plt>
  mov    %al,(%rbx)
  addl   $0x1,-0x18(%rbp)
L19:
  mov    -0x18(%rbp),%eax
  cmp    -0x14(%rbp),%eax
  jl     L3
  mov    -0x28(%rbp),%rax
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

assistant: ```c
char *strupr(char *ioString) {
  int i;
  int theLength = (int)strlen(ioString);
  for (i = 0; i < theLength; ++i) {
    ioString[i] = toupper(ioString[i]);
  }
  return ioString;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<strupr>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%r12
  call   <strlen@plt>
  test   %eax,%eax
  jle    L1
  mov    %r12,%rbx
  lea    -0x1(%rax),%eax
  lea    0x1(%r12,%rax,1),%rbp
L0:
  movsbl (%rbx),%edi
  call   <toupper@plt>
  mov    %al,(%rbx)
  add    $0x1,%rbx
  cmp    %rbp,%rbx
  jne    L0
L1:
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
char *strupr(char *ioString) {
  int i;
  int theLength = (int)strlen(ioString);
  for (i = 0; i < theLength; ++i) {
    ioString[i] = toupper(ioString[i]);
  }
  return ioString;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<strupr>:
  endbr64
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  push   %rbx
  call   <strlen@plt>
  test   %eax,%eax
  jle    L7
  sub    $0x1,%eax
  mov    %r12,%rbx
  lea    0x1(%r12,%rax,1),%rbp
  nop
L16:
  movsbl (%rbx),%edi
  add    $0x1,%rbx
  call   <toupper@plt>
  mov    %al,-0x1(%rbx)
  cmp    %rbp,%rbx
  jne    L16
L7:
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
char *strupr(char *ioString) {
  int i;
  int theLength = (int)strlen(ioString);
  for (i = 0; i < theLength; ++i) {
    ioString[i] = toupper(ioString[i]);
  }
  return ioString;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<strupr>:
  endbr64
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  push   %rbx
  call   <strlen@plt>
  test   %eax,%eax
  jle    L9
  sub    $0x1,%eax
  mov    %r12,%rbx
  lea    0x1(%r12,%rax,1),%rbp
  nop
L14:
  movsbl (%rbx),%edi
  add    $0x1,%rbx
  call   <toupper@plt>
  mov    %al,-0x1(%rbx)
  cmp    %rbp,%rbx
  jne    L14
L9:
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
char *strupr(char *ioString) {
  int i;
  int theLength = (int)strlen(ioString);
  for (i = 0; i < theLength; ++i) {
    ioString[i] = toupper(ioString[i]);
  }
  return ioString;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<uint_bytes_follow>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,%eax
  mov    %al,-0x4(%rbp)
  cmpb   $0x17,-0x4(%rbp)
  jbe    L23
  cmpb   $0x1b,-0x4(%rbp)
  jbe    L29
L23:
  mov    $0x0,%eax
  jmp    L15
L29:
  movzbl -0x4(%rbp),%eax
  sub    $0x18,%eax
  cltq
  lea    D5(%rip),%rdx
  movzbl (%rax,%rdx,1),%eax
L15:
  pop    %rbp
  ret
```

assistant: ```c
unsigned char uint_bytes_follow(unsigned char additional_info) {
  if (additional_info < 24 || additional_info > 27) {
    return 0;
  }
  static const unsigned char BYTES_FOLLOW[] = {1, 2, 4, 8};
  return BYTES_FOLLOW[additional_info - 24];
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<uint_bytes_follow>:
  endbr64
  lea    -0x18(%rdi),%edx
  mov    $0x0,%eax
  cmp    $0x3,%dl
  ja     L3
  movzbl %dil,%edi
  sub    $0x18,%edi
  movslq %edi,%rdi
  lea    D2(%rip),%rax
  movzbl (%rax,%rdi,1),%eax
L3:
  ret
```

assistant: ```c
unsigned char uint_bytes_follow(unsigned char additional_info) {
  if (additional_info < 24 || additional_info > 27) {
    return 0;
  }
  static const unsigned char BYTES_FOLLOW[] = {1, 2, 4, 8};
  return BYTES_FOLLOW[additional_info - 24];
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<uint_bytes_follow>:
  endbr64
  lea    -0x18(%rdi),%edx
  xor    %eax,%eax
  cmp    $0x3,%dl
  ja     L8
  movzbl %dil,%edi
  lea    D0(%rip),%rax
  sub    $0x18,%edi
  movslq %edi,%rdi
  movzbl (%rax,%rdi,1),%eax
L8:
  ret
```

assistant: ```c
unsigned char uint_bytes_follow(unsigned char additional_info) {
  if (additional_info < 24 || additional_info > 27) {
    return 0;
  }
  static const unsigned char BYTES_FOLLOW[] = {1, 2, 4, 8};
  return BYTES_FOLLOW[additional_info - 24];
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<uint_bytes_follow>:
  endbr64
  lea    -0x18(%rdi),%edx
  xor    %eax,%eax
  cmp    $0x3,%dl
  ja     L0
  movzbl %dil,%edi
  lea    D7(%rip),%rax
  sub    $0x18,%edi
  movslq %edi,%rdi
  movzbl (%rax,%rdi,1),%eax
L0:
  ret
```

assistant: ```c
unsigned char uint_bytes_follow(unsigned char additional_info) {
  if (additional_info < 24 || additional_info > 27) {
    return 0;
  }
  static const unsigned char BYTES_FOLLOW[] = {1, 2, 4, 8};
  return BYTES_FOLLOW[additional_info - 24];
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<i430hx_map>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %edi,-0x4(%rbp)
  mov    %esi,-0x8(%rbp)
  mov    %edx,-0xc(%rbp)
  mov    -0xc(%rbp),%eax
  and    $0x3,%eax
  cmp    $0x3,%eax
  je     L18
  cmp    $0x3,%eax
  jg     L27
  cmp    $0x2,%eax
  je     L5
  cmp    $0x2,%eax
  jg     L27
  test   %eax,%eax
  je     L99
  cmp    $0x1,%eax
  je     L34
  jmp    L27
L99:
  mov    -0x8(%rbp),%ecx
  mov    -0x4(%rbp),%eax
  mov    $0x22,%edx
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <mem_set_mem_state@plt>
  jmp    L27
L34:
  mov    -0x8(%rbp),%ecx
  mov    -0x4(%rbp),%eax
  mov    $0x12,%edx
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <mem_set_mem_state@plt>
  jmp    L27
L5:
  mov    -0x8(%rbp),%ecx
  mov    -0x4(%rbp),%eax
  mov    $0x21,%edx
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <mem_set_mem_state@plt>
  jmp    L27
L18:
  mov    -0x8(%rbp),%ecx
  mov    -0x4(%rbp),%eax
  mov    $0x11,%edx
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <mem_set_mem_state@plt>
  nop
L27:
  mov    $0x0,%eax
  call   <flushmmucache_nopc@plt>
  nop
  leave
  ret
```

assistant: ```c
void i430hx_map(uint32_t addr, uint32_t size, int state) {
  switch (state & 3) {
  case 0:
    mem_set_mem_state(addr, size, 0x20 | 0x02);
    break;
  case 1:
    mem_set_mem_state(addr, size, 0x10 | 0x02);
    break;
  case 2:
    mem_set_mem_state(addr, size, 0x20 | 0x01);
    break;
  case 3:
    mem_set_mem_state(addr, size, 0x10 | 0x01);
    break;
  }
  flushmmucache_nopc();
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<i430hx_map>:
  endbr64
  sub    $0x8,%rsp
  and    $0x3,%edx
  cmp    $0x2,%edx
  je     L22
  jg     L54
  test   %edx,%edx
  je     L26
  cmp    $0x1,%edx
  jne    L59
  mov    $0x12,%edx
  call   <mem_set_mem_state@plt>
  jmp    L59
L26:
  mov    $0x22,%edx
  call   <mem_set_mem_state@plt>
L59:
  mov    $0x0,%eax
  call   <flushmmucache_nopc@plt>
  add    $0x8,%rsp
  ret
L22:
  mov    $0x21,%edx
  call   <mem_set_mem_state@plt>
  jmp    L59
L54:
  mov    $0x11,%edx
  call   <mem_set_mem_state@plt>
  jmp    L59
```

assistant: ```c
void i430hx_map(uint32_t addr, uint32_t size, int state) {
  switch (state & 3) {
  case 0:
    mem_set_mem_state(addr, size, 0x20 | 0x02);
    break;
  case 1:
    mem_set_mem_state(addr, size, 0x10 | 0x02);
    break;
  case 2:
    mem_set_mem_state(addr, size, 0x20 | 0x01);
    break;
  case 3:
    mem_set_mem_state(addr, size, 0x10 | 0x01);
    break;
  }
  flushmmucache_nopc();
}
```
user: What is the c source code of the assembly code below?

```asm
<i430hx_map>:
  endbr64
  and    $0x3,%edx
  sub    $0x8,%rsp
  cmp    $0x2,%edx
  je     L2
  cmp    $0x3,%edx
  je     L27
  cmp    $0x1,%edx
  je     L6
  mov    $0x22,%edx
  call   <mem_set_mem_state@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  jmp    1070 <flushmmucache_nopc@plt>
  nop
L2:
  mov    $0x21,%edx
  call   <mem_set_mem_state@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  jmp    1070 <flushmmucache_nopc@plt>
  nopl   (%rax)
L6:
  mov    $0x12,%edx
  call   <mem_set_mem_state@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  jmp    1070 <flushmmucache_nopc@plt>
  nopl   (%rax)
L27:
  mov    $0x11,%edx
  call   <mem_set_mem_state@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  jmp    1070 <flushmmucache_nopc@plt>
```

assistant: ```c
void i430hx_map(uint32_t addr, uint32_t size, int state) {
  switch (state & 3) {
  case 0:
    mem_set_mem_state(addr, size, 0x20 | 0x02);
    break;
  case 1:
    mem_set_mem_state(addr, size, 0x10 | 0x02);
    break;
  case 2:
    mem_set_mem_state(addr, size, 0x20 | 0x01);
    break;
  case 3:
    mem_set_mem_state(addr, size, 0x10 | 0x01);
    break;
  }
  flushmmucache_nopc();
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<i430hx_map>:
  endbr64
  and    $0x3,%edx
  sub    $0x8,%rsp
  cmp    $0x2,%edx
  je     L11
  cmp    $0x3,%edx
  je     L10
  cmp    $0x1,%edx
  je     L25
  mov    $0x22,%edx
  call   <mem_set_mem_state@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  jmp    1070 <flushmmucache_nopc@plt>
  nop
L11:
  mov    $0x21,%edx
  call   <mem_set_mem_state@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  jmp    1070 <flushmmucache_nopc@plt>
  nopl   (%rax)
L25:
  mov    $0x12,%edx
  call   <mem_set_mem_state@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  jmp    1070 <flushmmucache_nopc@plt>
  nopl   (%rax)
L10:
  mov    $0x11,%edx
  call   <mem_set_mem_state@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  jmp    1070 <flushmmucache_nopc@plt>
```

assistant: ```c
void i430hx_map(uint32_t addr, uint32_t size, int state) {
  switch (state & 3) {
  case 0:
    mem_set_mem_state(addr, size, 0x20 | 0x02);
    break;
  case 1:
    mem_set_mem_state(addr, size, 0x10 | 0x02);
    break;
  case 2:
    mem_set_mem_state(addr, size, 0x20 | 0x01);
    break;
  case 3:
    mem_set_mem_state(addr, size, 0x10 | 0x01);
    break;
  }
  flushmmucache_nopc();
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<FlashUnlockBypassReset>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    $0x90,%esi
  mov    $0x0,%edi
  call   <FlashWrite@plt>
  mov    $0x0,%esi
  mov    $0x0,%edi
  call   <FlashWrite@plt>
  nop
  pop    %rbp
  ret
```

assistant: ```c
void FlashUnlockBypassReset(void) {
  FlashWrite((0x0), (0x0090));
  FlashWrite((0x0), (0x0000));
}
```
user: Translate the below assembly code into C programming language:

```asm
<FlashUnlockBypassReset>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x90,%esi
  mov    $0x0,%edi
  call   <FlashWrite@plt>
  mov    $0x0,%esi
  mov    $0x0,%edi
  call   <FlashWrite@plt>
  add    $0x8,%rsp
  ret
```

assistant: ```c
void FlashUnlockBypassReset(void) {
  FlashWrite((0x0), (0x0090));
  FlashWrite((0x0), (0x0000));
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<FlashUnlockBypassReset>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x90,%esi
  xor    %edi,%edi
  call   <FlashWrite@plt>
  xor    %esi,%esi
  xor    %edi,%edi
  add    $0x8,%rsp
  jmp    1050 <FlashWrite@plt>
```

assistant: ```c
void FlashUnlockBypassReset(void) {
  FlashWrite((0x0), (0x0090));
  FlashWrite((0x0), (0x0000));
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<FlashUnlockBypassReset>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x90,%esi
  xor    %edi,%edi
  call   <FlashWrite@plt>
  xor    %esi,%esi
  xor    %edi,%edi
  add    $0x8,%rsp
  jmp    1050 <FlashWrite@plt>
```

assistant: ```c
void FlashUnlockBypassReset(void) {
  FlashWrite((0x0), (0x0090));
  FlashWrite((0x0), (0x0000));
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<str_clear>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  movl   $0x0,-0x8(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x4(%rbp)
  movl   $0x0,-0xc(%rbp)
  jmp    L2
L13:
  mov    -0xc(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0xc(%rbp)
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
L2:
  mov    -0xc(%rbp),%eax
  cmp    -0x4(%rbp),%eax
  jle    L13
  mov    -0x8(%rbp),%eax
  leave
  ret
```

assistant: ```c
int str_clear(char str[]) {
  int err = 0;
  int i;
  int str_length = strlen(str);
  for (i = 0; i <= str_length; str[i++] = '\0')
    ;
  return err;
}
```
user: What is the c source code of the assembly code below?

```asm
<str_clear>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  call   <strlen@plt>
  test   %eax,%eax
  js     L10
  mov    %rbx,%rdx
  mov    %eax,%eax
  lea    0x1(%rbx,%rax,1),%rax
L14:
  movb   $0x0,(%rdx)
  add    $0x1,%rdx
  cmp    %rax,%rdx
  jne    L14
L10:
  mov    $0x0,%eax
  pop    %rbx
  ret
```

assistant: ```c
int str_clear(char str[]) {
  int err = 0;
  int i;
  int str_length = strlen(str);
  for (i = 0; i <= str_length; str[i++] = '\0')
    ;
  return err;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<str_clear>:
  endbr64
  push   %rbp
  mov    %rdi,%rbp
  call   <strlen@plt>
  test   %eax,%eax
  js     L9
  cltq
  xor    %esi,%esi
  mov    %rbp,%rdi
  lea    0x1(%rax),%rdx
  call   <memset@plt>
L9:
  xor    %eax,%eax
  pop    %rbp
  ret
```

assistant: ```c
int str_clear(char str[]) {
  int err = 0;
  int i;
  int str_length = strlen(str);
  for (i = 0; i <= str_length; str[i++] = '\0')
    ;
  return err;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<str_clear>:
  endbr64
  push   %rbp
  mov    %rdi,%rbp
  call   <strlen@plt>
  test   %eax,%eax
  js     L8
  cltq
  xor    %esi,%esi
  mov    %rbp,%rdi
  lea    0x1(%rax),%rdx
  call   <memset@plt>
L8:
  xor    %eax,%eax
  pop    %rbp
  ret
```

assistant: ```c
int str_clear(char str[]) {
  int err = 0;
  int i;
  int str_length = strlen(str);
  for (i = 0; i <= str_length; str[i++] = '\0')
    ;
  return err;
}
```
user: Translate the below assembly code into C programming language:

```asm
<mkdtemp>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <gen_tempname@plt>
  test   %rax,%rax
  je     L16
  mov    $0x0,%eax
  jmp    L6
L16:
  mov    -0x8(%rbp),%rax
L6:
  leave
  ret
```

assistant: ```c
char *mkdtemp(char *template) {
  if (gen_tempname(template))
    return NULL;
  else
    return template;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<mkdtemp>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  call   <gen_tempname@plt>
  test   %rax,%rax
  mov    $0x0,%eax
  cmove  %rbx,%rax
  pop    %rbx
  ret
```

assistant: ```c
char *mkdtemp(char *template) {
  if (gen_tempname(template))
    return NULL;
  else
    return template;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<mkdtemp>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  call   <gen_tempname@plt>
  test   %rax,%rax
  mov    $0x0,%eax
  cmove  %rbx,%rax
  pop    %rbx
  ret
```

assistant: ```c
char *mkdtemp(char *template) {
  if (gen_tempname(template))
    return NULL;
  else
    return template;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<mkdtemp>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  call   <gen_tempname@plt>
  test   %rax,%rax
  mov    $0x0,%eax
  cmove  %rbx,%rax
  pop    %rbx
  ret
```

assistant: ```c
char *mkdtemp(char *template) {
  if (gen_tempname(template))
    return NULL;
  else
    return template;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<sg_1000_io_write>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %edi,-0x4(%rbp)
  mov    %esi,-0x8(%rbp)
  cmpl   $0x3f,-0x4(%rbp)
  jle    L32
  cmpl   $0x7f,-0x4(%rbp)
  jg     L32
  mov    -0x8(%rbp),%eax
  mov    %eax,%edi
  call   <sn76489_data_write@plt>
  jmp    L66
L32:
  cmpl   $0x7f,-0x4(%rbp)
  jle    L66
  cmpl   $0xbf,-0x4(%rbp)
  jg     L66
  mov    -0x4(%rbp),%eax
  and    $0x1,%eax
  test   %eax,%eax
  jne    L44
  mov    -0x8(%rbp),%eax
  mov    %eax,%edi
  call   <tms9928a_data_write@plt>
  jmp    L66
L44:
  mov    -0x8(%rbp),%eax
  mov    %eax,%edi
  call   <tms9928a_control_write@plt>
L66:
  nop
  leave
  ret
```

assistant: ```c
void sg_1000_io_write(uint8_t addr, uint8_t data) {
  if (addr >= 0x40 && addr <= 0x7f) {
    sn76489_data_write(data);
  } else if (addr >= 0x80 && addr <= 0xbf) {
    if ((addr & 0x01) == 0x00) {
      tms9928a_data_write(data);
    } else {
      tms9928a_control_write(data);
    }
  }
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<sg_1000_io_write>:
  endbr64
  sub    $0x8,%rsp
  lea    -0x40(%rdi),%edx
  cmp    $0x3f,%edx
  jbe    L27
  mov    %edi,%eax
  lea    -0x80(%rdi),%edx
  cmp    $0x3f,%edx
  ja     L41
  test   $0x1,%al
  jne    L32
  mov    %esi,%edi
  call   <tms9928a_data_write@plt>
  jmp    L41
L27:
  mov    %esi,%edi
  call   <sn76489_data_write@plt>
L41:
  add    $0x8,%rsp
  ret
L32:
  mov    %esi,%edi
  call   <tms9928a_control_write@plt>
  jmp    L41
```

assistant: ```c
void sg_1000_io_write(uint8_t addr, uint8_t data) {
  if (addr >= 0x40 && addr <= 0x7f) {
    sn76489_data_write(data);
  } else if (addr >= 0x80 && addr <= 0xbf) {
    if ((addr & 0x01) == 0x00) {
      tms9928a_data_write(data);
    } else {
      tms9928a_control_write(data);
    }
  }
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<sg_1000_io_write>:
  endbr64
  mov    %edi,%eax
  mov    %esi,%edi
  lea    -0x40(%rax),%edx
  cmp    $0x3f,%edx
  jbe    L10
  lea    -0x80(%rax),%edx
  cmp    $0x3f,%edx
  ja     L25
  test   $0x1,%al
  jne    L16
  jmp    1090 <tms9928a_data_write@plt>
  nopl   0x0(%rax)
L25:
  ret
  nopl   0x0(%rax)
L10:
  jmp    1070 <sn76489_data_write@plt>
  nopl   (%rax)
L16:
  jmp    1080 <tms9928a_control_write@plt>
```

assistant: ```c
void sg_1000_io_write(uint8_t addr, uint8_t data) {
  if (addr >= 0x40 && addr <= 0x7f) {
    sn76489_data_write(data);
  } else if (addr >= 0x80 && addr <= 0xbf) {
    if ((addr & 0x01) == 0x00) {
      tms9928a_data_write(data);
    } else {
      tms9928a_control_write(data);
    }
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<sg_1000_io_write>:
  endbr64
  mov    %edi,%eax
  mov    %esi,%edi
  lea    -0x40(%rax),%edx
  cmp    $0x3f,%edx
  jbe    L4
  lea    -0x80(%rax),%edx
  cmp    $0x3f,%edx
  ja     L29
  test   $0x1,%al
  jne    L19
  jmp    1090 <tms9928a_data_write@plt>
  nopl   0x0(%rax)
L29:
  ret
  nopl   0x0(%rax)
L4:
  jmp    1070 <sn76489_data_write@plt>
  nopl   (%rax)
L19:
  jmp    1080 <tms9928a_control_write@plt>
```

assistant: ```c
void sg_1000_io_write(uint8_t addr, uint8_t data) {
  if (addr >= 0x40 && addr <= 0x7f) {
    sn76489_data_write(data);
  } else if (addr >= 0x80 && addr <= 0xbf) {
    if ((addr & 0x01) == 0x00) {
      tms9928a_data_write(data);
    } else {
      tms9928a_control_write(data);
    }
  }
}
```
user: What is the c source code of the assembly code below:

```asm
<tlv_find_data>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  mov    %edx,-0x20(%rbp)
  mov    %rcx,-0x28(%rbp)
  mov    -0x20(%rbp),%edx
  mov    -0x1c(%rbp),%ecx
  mov    -0x18(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <tlv_find_param@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <tlv_get_length@plt>
  mov    -0x28(%rbp),%rdx
  mov    %eax,(%rdx)
  mov    -0x8(%rbp),%rax
  add    $0x10,%rax
  leave
  ret
```

assistant: ```c
uint8_t *tlv_find_data(uint8_t *p_tlv, uint16_t i_type, uint16_t n, uint16_t *pi_length) {
  uint8_t *p_tlv_n = tlv_find_param(p_tlv, i_type, n);
  *pi_length = tlv_get_length(p_tlv_n);
  return p_tlv_n + 4;
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<tlv_find_data>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rcx,%rbp
  call   <tlv_find_param@plt>
  mov    %rax,%rbx
  mov    %rax,%rdi
  call   <tlv_get_length@plt>
  mov    %eax,0x0(%rbp)
  lea    0x10(%rbx),%rax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
uint8_t *tlv_find_data(uint8_t *p_tlv, uint16_t i_type, uint16_t n, uint16_t *pi_length) {
  uint8_t *p_tlv_n = tlv_find_param(p_tlv, i_type, n);
  *pi_length = tlv_get_length(p_tlv_n);
  return p_tlv_n + 4;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<tlv_find_data>:
  endbr64
  push   %rbp
  mov    %rcx,%rbp
  push   %rbx
  sub    $0x8,%rsp
  call   <tlv_find_param@plt>
  mov    %rax,%rdi
  mov    %rax,%rbx
  call   <tlv_get_length@plt>
  mov    %eax,0x0(%rbp)
  add    $0x8,%rsp
  lea    0x10(%rbx),%rax
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
uint8_t *tlv_find_data(uint8_t *p_tlv, uint16_t i_type, uint16_t n, uint16_t *pi_length) {
  uint8_t *p_tlv_n = tlv_find_param(p_tlv, i_type, n);
  *pi_length = tlv_get_length(p_tlv_n);
  return p_tlv_n + 4;
}
```
user: What is the c source code of the assembly code below?

```asm
<tlv_find_data>:
  endbr64
  push   %rbp
  mov    %rcx,%rbp
  push   %rbx
  sub    $0x8,%rsp
  call   <tlv_find_param@plt>
  mov    %rax,%rdi
  mov    %rax,%rbx
  call   <tlv_get_length@plt>
  mov    %eax,0x0(%rbp)
  add    $0x8,%rsp
  lea    0x10(%rbx),%rax
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
uint8_t *tlv_find_data(uint8_t *p_tlv, uint16_t i_type, uint16_t n, uint16_t *pi_length) {
  uint8_t *p_tlv_n = tlv_find_param(p_tlv, i_type, n);
  *pi_length = tlv_get_length(p_tlv_n);
  return p_tlv_n + 4;
}
```