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

```asm
<main>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x1a0,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x198(%rsp)
  xor    %eax,%eax
  mov    $0x4,%edi
  call   <malloc@plt>
  mov    %rax,%r13
  mov    $0x4,%edi
  call   <malloc@plt>
  mov    %rax,%rbp
  mov    $0x4,%edi
  call   <malloc@plt>
  mov    %rax,%rbx
  mov    $0x190,%edi
  call   <malloc@plt>
  mov    %rax,%r12
  mov    %rsp,%r14
  mov    $0xffffffff,%esi
  mov    %r14,%rdi
  call   <read_element@plt>
  mov    $0x64,%esi
  mov    %r14,%rdi
  call   <read_element@plt>
  mov    $0xffffffff,%esi
  mov    %r12,%rdi
  call   <read_element@plt>
  mov    $0x64,%esi
  mov    %r12,%rdi
  call   <read_element@plt>
  mov    %rbp,%rdi
  call   <free@plt>
  movl   $0x11,0x0(%rbp)
  movl   $0x11,(%rbx)
  mov    %rbx,%rdi
  call   <free@plt>
  mov    %r13,%rdi
  call   <free@plt>
  mov    0x198(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L3
  mov    $0x0,%eax
  add    $0x1a0,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L3:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int main() {
  int *free_twice = malloc(sizeof(int));
  int *use_after_free = malloc(sizeof(int));
  int *never_free = malloc(sizeof(int));
  int array1[100];
  int *array2 = malloc(100 * sizeof(int));
  read_element(array1, -1);
  read_element(array1, 100);
  read_element(array2, -1);
  read_element(array2, 100);
  free(use_after_free);
  *use_after_free = 17;
  *never_free = 17;
  free(never_free);
  free(free_twice);
  return 0;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<main>:
  endbr64
  push   %r14
  mov    $0x4,%edi
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x1a0,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x198(%rsp)
  xor    %eax,%eax
  mov    %rsp,%r14
  call   <malloc@plt>
  mov    $0x4,%edi
  mov    %rax,%r13
  call   <malloc@plt>
  mov    $0x4,%edi
  mov    %rax,%rbx
  call   <malloc@plt>
  mov    $0x190,%edi
  mov    %rax,%rbp
  call   <malloc@plt>
  mov    $0xffffffff,%esi
  mov    %r14,%rdi
  mov    %rax,%r12
  call   <read_element@plt>
  mov    $0x64,%esi
  mov    %r14,%rdi
  call   <read_element@plt>
  mov    $0xffffffff,%esi
  mov    %r12,%rdi
  call   <read_element@plt>
  mov    $0x64,%esi
  mov    %r12,%rdi
  call   <read_element@plt>
  mov    %rbx,%rdi
  call   <free@plt>
  movl   $0x11,(%rbx)
  mov    %rbp,%rdi
  movl   $0x11,0x0(%rbp)
  call   <free@plt>
  mov    %r13,%rdi
  call   <free@plt>
  mov    0x198(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L0
  add    $0x1a0,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L0:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int main() {
  int *free_twice = malloc(sizeof(int));
  int *use_after_free = malloc(sizeof(int));
  int *never_free = malloc(sizeof(int));
  int array1[100];
  int *array2 = malloc(100 * sizeof(int));
  read_element(array1, -1);
  read_element(array1, 100);
  read_element(array2, -1);
  read_element(array2, 100);
  free(use_after_free);
  *use_after_free = 17;
  *never_free = 17;
  free(never_free);
  free(free_twice);
  return 0;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<main>:
  endbr64
  push   %r14
  mov    $0x4,%edi
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x1a0,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x198(%rsp)
  xor    %eax,%eax
  mov    %rsp,%r14
  call   <malloc@plt>
  mov    $0x4,%edi
  mov    %rax,%r13
  call   <malloc@plt>
  mov    $0x4,%edi
  mov    %rax,%rbx
  call   <malloc@plt>
  mov    $0x190,%edi
  mov    %rax,%rbp
  call   <malloc@plt>
  mov    $0xffffffff,%esi
  mov    %r14,%rdi
  mov    %rax,%r12
  call   <read_element@plt>
  mov    $0x64,%esi
  mov    %r14,%rdi
  call   <read_element@plt>
  mov    $0xffffffff,%esi
  mov    %r12,%rdi
  call   <read_element@plt>
  mov    $0x64,%esi
  mov    %r12,%rdi
  call   <read_element@plt>
  mov    %rbx,%rdi
  call   <free@plt>
  movl   $0x11,(%rbx)
  mov    %rbp,%rdi
  movl   $0x11,0x0(%rbp)
  call   <free@plt>
  mov    %r13,%rdi
  call   <free@plt>
  mov    0x198(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L2
  add    $0x1a0,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L2:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int main() {
  int *free_twice = malloc(sizeof(int));
  int *use_after_free = malloc(sizeof(int));
  int *never_free = malloc(sizeof(int));
  int array1[100];
  int *array2 = malloc(100 * sizeof(int));
  read_element(array1, -1);
  read_element(array1, 100);
  read_element(array2, -1);
  read_element(array2, 100);
  free(use_after_free);
  *use_after_free = 17;
  *never_free = 17;
  free(never_free);
  free(free_twice);
  return 0;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<msd>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x218,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x208(%rsp)
  xor    %eax,%eax
  mov    $0x0,%esi
  mov    $0x0,%edi
  call   <set_interface@plt>
  mov    $0x0,%ebp
  lea    D43(%rip),%r14
  lea    D30(%rip),%r13
  lea    D3(%rip),%r12
  lea    D39(%rip),%r15
L8:
  mov    %ebp,%esi
  mov    %r14,%rdi
  call   <printf@plt>
  mov    %rsp,%rbx
  mov    $0x200,%edx
  mov    $0x0,%esi
  mov    %rbx,%rdi
  call   <memset@plt>
  mov    $0x4,%edx
  mov    %r13,%rsi
  mov    %rbx,%rdi
  call   <memcpy@plt>
  movl   $0x12330984,0x4(%rsp)
  movb   $0x24,0x8(%rsp)
  movb   $0x80,0xc(%rsp)
  movb   $0x6,0xe(%rsp)
  movb   $0x12,0xf(%rsp)
  movb   $0x24,0x13(%rsp)
  mov    %r12,%rdx
  mov    $0x1f,%esi
  mov    %rbx,%rdi
  call   <hex@plt>
  mov    $0x1f,%edx
  mov    %rbx,%rsi
  mov    $0x1,%edi
  call   <send_bulk@plt>
  test   %rax,%rax
  js     L14
  mov    $0x200,%edx
  mov    $0x0,%esi
  mov    %rbx,%rdi
  call   <memset@plt>
  mov    $0x24,%edx
  mov    %rbx,%rsi
  mov    $0x1,%edi
  call   <recv_bulk@plt>
  mov    %eax,%esi
  mov    %r15,%rdx
  mov    %rbx,%rdi
  call   <hex@plt>
  mov    $0x200,%edx
  mov    $0x0,%esi
  mov    %rbx,%rdi
  call   <memset@plt>
  mov    $0x24,%edx
  mov    %rbx,%rsi
  mov    $0x1,%edi
  call   <recv_bulk@plt>
  mov    %eax,%esi
  lea    D21(%rip),%rdx
  mov    %rbx,%rdi
  call   <hex@plt>
  mov    $0x249f0,%edi
  call   <usleep@plt>
  add    $0x1,%ebp
  cmp    $0x3,%ebp
  jne    L8
L14:
  mov    0x208(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L23
  add    $0x218,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L23:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: label: D43
datatype: string
name: extract_symbolic_data
arguments: label: D30
datatype: string
name: extract_symbolic_data
arguments: label: D3
datatype: string
name: extract_symbolic_data
arguments: label: D39
datatype: string
name: extract_symbolic_data
arguments: label: D21
datatype: string

tool: D43: i=%d


tool: D30: USBC

tool: D3: intquery req

tool: D39: inquiry result

tool: D21: inquiry sense?

assistant: ```c
void msd() {
  unsigned InEndPt = 1;
  unsigned OutEndPt = 1;
  unsigned char abBuf[512];
  int i;
  set_interface(0, 0);
  for (i = 0; i < 3; i++) {
    printf("i=%d\n", i);
    memset(abBuf, 0, sizeof(abBuf));
    memcpy(abBuf, "USBC", 4);
    *(uint32_t *)(&abBuf[4]) = 0x12330984;
    abBuf[8] = 0x24;
    abBuf[0xc] = 0x80;
    abBuf[0xe] = 0x06;
    abBuf[0x0f] = 0x12;
    abBuf[0x13] = 0x24;
    hex(abBuf, 31, "intquery req");
    if (send_bulk(OutEndPt, abBuf, 31) < 0)
      return;
    memset(abBuf, 0, sizeof(abBuf));
    int cb = recv_bulk(InEndPt, abBuf, 36);
    hex(abBuf, cb, "inquiry result");
    memset(abBuf, 0, sizeof(abBuf));
    cb = recv_bulk(InEndPt, abBuf, 36);
    hex(abBuf, cb, "inquiry sense?");
    usleep(150000);
  }
}
```
user: Translate the below assembly code into C programming language:

```asm
<msd>:
  endbr64
  push   %r15
  xor    %esi,%esi
  xor    %edi,%edi
  lea    D38(%rip),%r15
  push   %r14
  xor    %r14d,%r14d
  push   %r13
  lea    D41(%rip),%r13
  push   %r12
  lea    D13(%rip),%r12
  push   %rbp
  lea    D46(%rip),%rbp
  push   %rbx
  sub    $0x218,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x208(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rbx
  call   <set_interface@plt>
L18:
  mov    %r14d,%esi
  mov    %r13,%rdi
  call   <printf@plt>
  xor    %esi,%esi
  mov    $0x200,%edx
  mov    %rbx,%rdi
  call   <memset@plt>
  mov    $0x4,%edx
  mov    %r12,%rsi
  mov    %rbx,%rdi
  call   <memcpy@plt>
  mov    $0x1206,%eax
  mov    %rbp,%rdx
  mov    %rbx,%rdi
  mov    $0x1f,%esi
  movl   $0x12330984,0x4(%rsp)
  movb   $0x24,0x8(%rsp)
  movb   $0x80,0xc(%rsp)
  mov    %ax,0xe(%rsp)
  movb   $0x24,0x13(%rsp)
  call   <hex@plt>
  mov    $0x1f,%edx
  mov    %rbx,%rsi
  mov    $0x1,%edi
  call   <send_bulk@plt>
  test   %rax,%rax
  js     L1
  mov    $0x200,%edx
  xor    %esi,%esi
  mov    %rbx,%rdi
  add    $0x1,%r14d
  call   <memset@plt>
  mov    $0x24,%edx
  mov    %rbx,%rsi
  mov    $0x1,%edi
  call   <recv_bulk@plt>
  mov    %r15,%rdx
  mov    %rbx,%rdi
  mov    %eax,%esi
  call   <hex@plt>
  mov    $0x200,%edx
  xor    %esi,%esi
  mov    %rbx,%rdi
  call   <memset@plt>
  mov    $0x24,%edx
  mov    %rbx,%rsi
  mov    $0x1,%edi
  call   <recv_bulk@plt>
  lea    D12(%rip),%rdx
  mov    %rbx,%rdi
  mov    %eax,%esi
  call   <hex@plt>
  mov    $0x249f0,%edi
  call   <usleep@plt>
  cmp    $0x3,%r14d
  jne    L18
L1:
  mov    0x208(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L5
  add    $0x218,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L5:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_label: D38
type_guessed: string
name: disassemble_data
arguments: data_label: D41
type_guessed: string
name: disassemble_data
arguments: data_label: D13
type_guessed: string
name: disassemble_data
arguments: data_label: D46
type_guessed: string
name: disassemble_data
arguments: data_label: D12
type_guessed: string

tool: D38: inquiry result

tool: D41: i=%d


tool: D13: USBC

tool: D46: intquery req

tool: D12: inquiry sense?

assistant: ```c
void msd() {
  unsigned InEndPt = 1;
  unsigned OutEndPt = 1;
  unsigned char abBuf[512];
  int i;
  set_interface(0, 0);
  for (i = 0; i < 3; i++) {
    printf("i=%d\n", i);
    memset(abBuf, 0, sizeof(abBuf));
    memcpy(abBuf, "USBC", 4);
    *(uint32_t *)(&abBuf[4]) = 0x12330984;
    abBuf[8] = 0x24;
    abBuf[0xc] = 0x80;
    abBuf[0xe] = 0x06;
    abBuf[0x0f] = 0x12;
    abBuf[0x13] = 0x24;
    hex(abBuf, 31, "intquery req");
    if (send_bulk(OutEndPt, abBuf, 31) < 0)
      return;
    memset(abBuf, 0, sizeof(abBuf));
    int cb = recv_bulk(InEndPt, abBuf, 36);
    hex(abBuf, cb, "inquiry result");
    memset(abBuf, 0, sizeof(abBuf));
    cb = recv_bulk(InEndPt, abBuf, 36);
    hex(abBuf, cb, "inquiry sense?");
    usleep(150000);
  }
}
```
user: What is the c source code of the assembly code below?

```asm
<msd>:
  endbr64
  push   %r15
  xor    %esi,%esi
  xor    %edi,%edi
  lea    D28(%rip),%r15
  push   %r14
  xor    %r14d,%r14d
  push   %r13
  lea    D26(%rip),%r13
  push   %r12
  lea    D20(%rip),%r12
  push   %rbp
  lea    D18(%rip),%rbp
  push   %rbx
  sub    $0x218,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x208(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rbx
  call   <set_interface@plt>
L18:
  mov    %r14d,%esi
  mov    %r13,%rdi
  call   <printf@plt>
  xor    %esi,%esi
  mov    $0x200,%edx
  mov    %rbx,%rdi
  call   <memset@plt>
  mov    $0x4,%edx
  mov    %r12,%rsi
  mov    %rbx,%rdi
  call   <memcpy@plt>
  mov    $0x1206,%eax
  mov    %rbp,%rdx
  mov    %rbx,%rdi
  mov    $0x1f,%esi
  movl   $0x12330984,0x4(%rsp)
  movb   $0x24,0x8(%rsp)
  movb   $0x80,0xc(%rsp)
  mov    %ax,0xe(%rsp)
  movb   $0x24,0x13(%rsp)
  call   <hex@plt>
  mov    $0x1f,%edx
  mov    %rbx,%rsi
  mov    $0x1,%edi
  call   <send_bulk@plt>
  test   %rax,%rax
  js     L22
  mov    $0x200,%edx
  xor    %esi,%esi
  mov    %rbx,%rdi
  add    $0x1,%r14d
  call   <memset@plt>
  mov    $0x24,%edx
  mov    %rbx,%rsi
  mov    $0x1,%edi
  call   <recv_bulk@plt>
  mov    %r15,%rdx
  mov    %rbx,%rdi
  mov    %eax,%esi
  call   <hex@plt>
  mov    $0x200,%edx
  xor    %esi,%esi
  mov    %rbx,%rdi
  call   <memset@plt>
  mov    $0x24,%edx
  mov    %rbx,%rsi
  mov    $0x1,%edi
  call   <recv_bulk@plt>
  lea    D33(%rip),%rdx
  mov    %rbx,%rdi
  mov    %eax,%esi
  call   <hex@plt>
  mov    $0x249f0,%edi
  call   <usleep@plt>
  cmp    $0x3,%r14d
  jne    L18
L22:
  mov    0x208(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L19
  add    $0x218,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L19:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: tag: D28
datatype: string
name: read_data
arguments: tag: D26
datatype: string
name: read_data
arguments: tag: D20
datatype: string
name: read_data
arguments: tag: D18
datatype: string
name: read_data
arguments: tag: D33
datatype: string

tool: D28: inquiry result

tool: D26: i=%d


tool: D20: USBC

tool: D18: intquery req

tool: D33: inquiry sense?

assistant: ```c
void msd() {
  unsigned InEndPt = 1;
  unsigned OutEndPt = 1;
  unsigned char abBuf[512];
  int i;
  set_interface(0, 0);
  for (i = 0; i < 3; i++) {
    printf("i=%d\n", i);
    memset(abBuf, 0, sizeof(abBuf));
    memcpy(abBuf, "USBC", 4);
    *(uint32_t *)(&abBuf[4]) = 0x12330984;
    abBuf[8] = 0x24;
    abBuf[0xc] = 0x80;
    abBuf[0xe] = 0x06;
    abBuf[0x0f] = 0x12;
    abBuf[0x13] = 0x24;
    hex(abBuf, 31, "intquery req");
    if (send_bulk(OutEndPt, abBuf, 31) < 0)
      return;
    memset(abBuf, 0, sizeof(abBuf));
    int cb = recv_bulk(InEndPt, abBuf, 36);
    hex(abBuf, cb, "inquiry result");
    memset(abBuf, 0, sizeof(abBuf));
    cb = recv_bulk(InEndPt, abBuf, 36);
    hex(abBuf, cb, "inquiry sense?");
    usleep(150000);
  }
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<timespec_add>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  mov    %rdi,-0x20(%rbp)
  mov    %rsi,-0x28(%rbp)
  mov    -0x20(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%edx
  mov    -0x28(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x10(%rbp)
  mov    -0xc(%rbp),%edx
  mov    -0x24(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0xc(%rbp)
  mov    -0x10(%rbp),%eax
  cmp    $0x3b9ac9ff,%eax
  jle    L9
  mov    -0xc(%rbp),%ecx
  mov    -0x10(%rbp),%eax
  movslq %eax,%rdx
  imul   $0x44b82fa1,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x1c,%edx
  sar    $0x1f,%eax
  mov    %eax,%esi
  mov    %edx,%eax
  sub    %esi,%eax
  add    %ecx,%eax
  mov    %eax,-0xc(%rbp)
  mov    -0x10(%rbp),%edx
  movslq %edx,%rax
  imul   $0x44b82fa1,%rax,%rax
  shr    $0x20,%rax
  sar    $0x1c,%eax
  mov    %edx,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%eax
  imul   $0x3b9aca00,%eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  mov    %eax,-0x10(%rbp)
L9:
  mov    -0x10(%rbp),%eax
  test   %eax,%eax
  jns    L15
  mov    -0x10(%rbp),%eax
  movslq %eax,%rdx
  imul   $0x44b82fa1,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x1c,%edx
  sar    $0x1f,%eax
  sub    %edx,%eax
  add    $0x1,%eax
  movslq %eax,%rbx
  mov    -0x10(%rbp),%eax
  mov    %eax,%edx
  mov    %ebx,%eax
  imul   $0x3b9aca00,%eax,%eax
  add    %edx,%eax
  mov    %eax,-0x10(%rbp)
  mov    -0xc(%rbp),%eax
  mov    %ebx,%edx
  sub    %edx,%eax
  mov    %eax,-0xc(%rbp)
L15:
  mov    -0x10(%rbp),%rax
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

assistant: ```c
struct timespec timespec_add(const struct timespec ts1, const struct timespec ts2) {
  register struct timespec result = ts1;
  register long sec;
  result.tv_nsec += ts2.tv_nsec;
  result.tv_sec += ts2.tv_sec;
  if (result.tv_nsec >= (1000 * 1000 * 1000)) {
    result.tv_sec += result.tv_nsec / (1000 * 1000 * 1000);
    result.tv_nsec %= (1000 * 1000 * 1000);
  }
  if (result.tv_nsec < 0) {
    sec = 1 + -(result.tv_nsec / (1000 * 1000 * 1000));
    result.tv_nsec += (1000 * 1000 * 1000) * sec;
    result.tv_sec -= sec;
  }
  return result;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<timespec_add>:
  endbr64
  lea    (%rsi,%rdi,1),%eax
  sar    $0x20,%rsi
  sar    $0x20,%rdi
  add    %edi,%esi
  cmp    $0x3b9ac9ff,%eax
  jle    L9
  movslq %eax,%rdx
  imul   $0x44b82fa1,%rdx,%rdx
  sar    $0x3c,%rdx
  mov    %eax,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%edx
  add    %edx,%esi
  imul   $0x3b9aca00,%edx,%edx
  sub    %edx,%eax
L3:
  shl    $0x20,%rsi
  mov    %eax,%eax
  or     %rsi,%rax
  ret
L9:
  test   %eax,%eax
  jns    L3
  movslq %eax,%rcx
  imul   $0x44b82fa1,%rcx,%rcx
  sar    $0x3c,%rcx
  cltd
  sub    %ecx,%edx
  add    $0x1,%edx
  imul   $0x3b9aca00,%edx,%ecx
  add    %ecx,%eax
  sub    %edx,%esi
  jmp    L3
```

assistant: ```c
struct timespec timespec_add(const struct timespec ts1, const struct timespec ts2) {
  register struct timespec result = ts1;
  register long sec;
  result.tv_nsec += ts2.tv_nsec;
  result.tv_sec += ts2.tv_sec;
  if (result.tv_nsec >= (1000 * 1000 * 1000)) {
    result.tv_sec += result.tv_nsec / (1000 * 1000 * 1000);
    result.tv_nsec %= (1000 * 1000 * 1000);
  }
  if (result.tv_nsec < 0) {
    sec = 1 + -(result.tv_nsec / (1000 * 1000 * 1000));
    result.tv_nsec += (1000 * 1000 * 1000) * sec;
    result.tv_sec -= sec;
  }
  return result;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<timespec_add>:
  endbr64
  lea    (%rsi,%rdi,1),%eax
  sar    $0x20,%rsi
  sar    $0x20,%rdi
  add    %edi,%esi
  cmp    $0x3b9ac9ff,%eax
  jle    L19
  movslq %eax,%rdx
  mov    %eax,%ecx
  imul   $0x44b82fa1,%rdx,%rdx
  sar    $0x1f,%ecx
  sar    $0x3c,%rdx
  sub    %ecx,%edx
  add    %edx,%esi
  imul   $0x3b9aca00,%edx,%edx
  sub    %edx,%eax
L0:
  shl    $0x20,%rsi
  mov    %eax,%eax
  or     %rsi,%rax
  ret
  nopl   0x0(%rax)
L19:
  test   %eax,%eax
  jns    L0
  movslq %eax,%rcx
  cltd
  imul   $0x44b82fa1,%rcx,%rcx
  sar    $0x3c,%rcx
  sub    %ecx,%edx
  add    $0x1,%edx
  imul   $0x3b9aca00,%edx,%ecx
  sub    %edx,%esi
  shl    $0x20,%rsi
  add    %ecx,%eax
  mov    %eax,%eax
  or     %rsi,%rax
  ret
```

assistant: ```c
struct timespec timespec_add(const struct timespec ts1, const struct timespec ts2) {
  register struct timespec result = ts1;
  register long sec;
  result.tv_nsec += ts2.tv_nsec;
  result.tv_sec += ts2.tv_sec;
  if (result.tv_nsec >= (1000 * 1000 * 1000)) {
    result.tv_sec += result.tv_nsec / (1000 * 1000 * 1000);
    result.tv_nsec %= (1000 * 1000 * 1000);
  }
  if (result.tv_nsec < 0) {
    sec = 1 + -(result.tv_nsec / (1000 * 1000 * 1000));
    result.tv_nsec += (1000 * 1000 * 1000) * sec;
    result.tv_sec -= sec;
  }
  return result;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<timespec_add>:
  endbr64
  movq   %rsi,%xmm0
  movq   %rdi,%xmm1
  lea    (%rsi,%rdi,1),%ecx
  sar    $0x20,%rsi
  paddd  %xmm1,%xmm0
  sar    $0x20,%rdi
  add    %edi,%esi
  movd   %xmm0,%eax
  pshufd $0xe5,%xmm0,%xmm2
  movd   %xmm2,%r8d
  cmp    $0x3b9ac9ff,%eax
  jle    L7
  movslq %eax,%rdx
  movd   %xmm0,%ecx
  imul   $0x44b82fa1,%rdx,%rdx
  sar    $0x1f,%ecx
  sar    $0x3c,%rdx
  sub    %ecx,%edx
  imul   $0x3b9aca00,%edx,%ecx
  add    %r8d,%edx
  movd   %edx,%xmm3
  sub    %ecx,%eax
  movd   %eax,%xmm0
  punpckldq %xmm3,%xmm0
L12:
  movq   %xmm0,%rax
  ret
  nopl   0x0(%rax,%rax,1)
L7:
  test   %eax,%eax
  jns    L12
  movslq %eax,%rdx
  sar    $0x1f,%eax
  imul   $0x44b82fa1,%rdx,%rdx
  sar    $0x3c,%rdx
  sub    %edx,%eax
  lea    0x1(%rax),%edx
  imul   $0x3b9aca00,%edx,%eax
  sub    %edx,%esi
  movd   %esi,%xmm4
  add    %ecx,%eax
  movd   %eax,%xmm0
  punpckldq %xmm4,%xmm0
  movq   %xmm0,%rax
  ret
```

assistant: ```c
struct timespec timespec_add(const struct timespec ts1, const struct timespec ts2) {
  register struct timespec result = ts1;
  register long sec;
  result.tv_nsec += ts2.tv_nsec;
  result.tv_sec += ts2.tv_sec;
  if (result.tv_nsec >= (1000 * 1000 * 1000)) {
    result.tv_sec += result.tv_nsec / (1000 * 1000 * 1000);
    result.tv_nsec %= (1000 * 1000 * 1000);
  }
  if (result.tv_nsec < 0) {
    sec = 1 + -(result.tv_nsec / (1000 * 1000 * 1000));
    result.tv_nsec += (1000 * 1000 * 1000) * sec;
    result.tv_sec -= sec;
  }
  return result;
}
```
user: Translate the below assembly code into C programming language:

```asm
<HibernateTamperIOEnable>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %esi,-0x18(%rbp)
  mov    $0x400fc410,%eax
  mov    (%rax),%rax
  mov    %eax,-0x8(%rbp)
  mov    -0x14(%rbp),%eax
  shl    $0x3,%eax
  mov    $0xf,%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  not    %eax
  and    -0x8(%rbp),%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x18(%rbp),%eax
  or     $0x1,%eax
  mov    %eax,%edx
  mov    -0x14(%rbp),%eax
  shl    $0x3,%eax
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  or     -0x4(%rbp),%eax
  or     %eax,-0x8(%rbp)
  mov    $0x400fc360,%eax
  mov    $0xa3359554,%esi
  mov    %rsi,(%rax)
  mov    $0x0,%eax
  call   <_HibernateWriteComplete@plt>
  mov    $0x400fc410,%edx
  mov    -0x8(%rbp),%eax
  cltq
  mov    %rax,(%rdx)
  mov    $0x0,%eax
  call   <_HibernateWriteComplete@plt>
  mov    $0x400fc360,%eax
  movq   $0x0,(%rax)
  mov    $0x0,%eax
  call   <_HibernateWriteComplete@plt>
  nop
  leave
  ret
```

assistant: ```c
void HibernateTamperIOEnable(uint32_t ui32Input, uint32_t ui32Config) {
  uint32_t ui32Temp, ui32Mask;
  ;
  ui32Temp = (*((volatile unsigned long *)(0x400FC410)));
  ui32Mask = (ui32Temp & (~((0x00000008 | 0x00000004 | 0x00000002 | 0x00000001) << (ui32Input << 3))));
  ui32Temp |= (ui32Mask | ((ui32Config | 0x00000001) << (ui32Input << 3)));
  (*((volatile unsigned long *)(0x400FC360))) = 0xA3359554;
  _HibernateWriteComplete();
  (*((volatile unsigned long *)(0x400FC410))) = ui32Temp;
  _HibernateWriteComplete();
  (*((volatile unsigned long *)(0x400FC360))) = 0;
  _HibernateWriteComplete();
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<HibernateTamperIOEnable>:
  endbr64
  push   %rbx
  mov    0x400fc410,%rax
  lea    0x0(,%rdi,8),%ecx
  or     $0x1,%esi
  mov    %esi,%ebx
  shl    %cl,%ebx
  or     %eax,%ebx
  mov    $0xa3359554,%eax
  mov    %rax,0x400fc360
  mov    $0x0,%eax
  call   <_HibernateWriteComplete@plt>
  movslq %ebx,%rbx
  mov    %rbx,0x400fc410
  mov    $0x0,%eax
  call   <_HibernateWriteComplete@plt>
  movq   $0x0,0x400fc360
  mov    $0x0,%eax
  call   <_HibernateWriteComplete@plt>
  pop    %rbx
  ret
```

assistant: ```c
void HibernateTamperIOEnable(uint32_t ui32Input, uint32_t ui32Config) {
  uint32_t ui32Temp, ui32Mask;
  ;
  ui32Temp = (*((volatile unsigned long *)(0x400FC410)));
  ui32Mask = (ui32Temp & (~((0x00000008 | 0x00000004 | 0x00000002 | 0x00000001) << (ui32Input << 3))));
  ui32Temp |= (ui32Mask | ((ui32Config | 0x00000001) << (ui32Input << 3)));
  (*((volatile unsigned long *)(0x400FC360))) = 0xA3359554;
  _HibernateWriteComplete();
  (*((volatile unsigned long *)(0x400FC410))) = ui32Temp;
  _HibernateWriteComplete();
  (*((volatile unsigned long *)(0x400FC360))) = 0;
  _HibernateWriteComplete();
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<HibernateTamperIOEnable>:
  endbr64
  or     $0x1,%esi
  push   %rbx
  lea    0x0(,%rdi,8),%ecx
  mov    0x400fc410,%rax
  mov    %esi,%ebx
  shl    %cl,%ebx
  or     %eax,%ebx
  mov    $0xa3359554,%eax
  mov    %rax,0x400fc360
  movslq %ebx,%rbx
  xor    %eax,%eax
  call   <_HibernateWriteComplete@plt>
  mov    %rbx,0x400fc410
  xor    %eax,%eax
  call   <_HibernateWriteComplete@plt>
  xor    %eax,%eax
  movq   $0x0,0x400fc360
  pop    %rbx
  jmp    1050 <_HibernateWriteComplete@plt>
```

assistant: ```c
void HibernateTamperIOEnable(uint32_t ui32Input, uint32_t ui32Config) {
  uint32_t ui32Temp, ui32Mask;
  ;
  ui32Temp = (*((volatile unsigned long *)(0x400FC410)));
  ui32Mask = (ui32Temp & (~((0x00000008 | 0x00000004 | 0x00000002 | 0x00000001) << (ui32Input << 3))));
  ui32Temp |= (ui32Mask | ((ui32Config | 0x00000001) << (ui32Input << 3)));
  (*((volatile unsigned long *)(0x400FC360))) = 0xA3359554;
  _HibernateWriteComplete();
  (*((volatile unsigned long *)(0x400FC410))) = ui32Temp;
  _HibernateWriteComplete();
  (*((volatile unsigned long *)(0x400FC360))) = 0;
  _HibernateWriteComplete();
}
```