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

```asm
<l_addMom2wm>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r12
  push   %rbx
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %edx,-0x24(%rbp)
  cmpq   $0x0,-0x20(%rbp)
  je     L69
  cmpl   $0x0,-0x24(%rbp)
  jne    L55
  mov    $0x1,%r12d
  jmp    L35
L102:
  movslq %r12d,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%ebx
  test   %ebx,%ebx
  jns    L99
  mov    %ebx,%eax
  neg    %eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    %ebx,%eax
  neg    %eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x18(%rbp),%rax
  add    %rcx,%rax
  add    $0x1,%edx
  mov    %edx,(%rax)
  jmp    L117
L99:
  movslq %ebx,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  movslq %ebx,%rax
  lea    0x0(,%rax,4),%rcx
  mov    -0x18(%rbp),%rax
  add    %rcx,%rax
  sub    $0x1,%edx
  mov    %edx,(%rax)
L117:
  add    $0x1,%r12d
L35:
  mov    -0x20(%rbp),%rax
  mov    (%rax),%eax
  cmp    %eax,%r12d
  jle    L102
  jmp    L65
L55:
  mov    $0x1,%r12d
  jmp    L38
L115:
  movslq %r12d,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%ebx
  test   %ebx,%ebx
  jns    L16
  mov    %ebx,%eax
  neg    %eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    %ebx,%eax
  neg    %eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x18(%rbp),%rax
  add    %rcx,%rax
  sub    $0x1,%edx
  mov    %edx,(%rax)
  jmp    L100
L16:
  movslq %ebx,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  movslq %ebx,%rax
  lea    0x0(,%rax,4),%rcx
  mov    -0x18(%rbp),%rax
  add    %rcx,%rax
  add    $0x1,%edx
  mov    %edx,(%rax)
L100:
  add    $0x1,%r12d
L38:
  mov    -0x20(%rbp),%rax
  mov    (%rax),%eax
  cmp    %eax,%r12d
  jle    L115
  jmp    L65
L69:
  nop
L65:
  pop    %rbx
  pop    %r12
  pop    %rbp
  ret
```

assistant: ```c
void l_addMom2wm(int *wm, int *i2, int s) {
  register int i, v;
  if (i2 == NULL)
    return;
  if (s == 0)
    for (i = 1; i <= *i2; i++) {
      v = i2[i];
      if (v < 0)
        wm[-v] += 1;
      else
        wm[v] -= 1;
    }
  else
    for (i = 1; i <= *i2; i++) {
      v = i2[i];
      if (v < 0)
        wm[-v] -= 1;
      else
        wm[v] += 1;
    }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<l_addMom2wm>:
  endbr64
  mov    %rdi,%rcx
  test   %rsi,%rsi
  je     L62
  test   %edx,%edx
  je     L11
  mov    $0x1,%edx
  cmpl   $0x0,(%rsi)
  jg     L1
  ret
L11:
  cmpl   $0x0,(%rsi)
  jle    L62
  mov    $0x1,%edx
  jmp    L14
L95:
  neg    %eax
  cltq
  addl   $0x1,(%rcx,%rax,4)
L78:
  add    $0x1,%rdx
  cmp    %edx,(%rsi)
  jl     L65
L14:
  mov    (%rsi,%rdx,4),%eax
  test   %eax,%eax
  js     L95
  cltq
  subl   $0x1,(%rcx,%rax,4)
  jmp    L78
L65:
  ret
L38:
  neg    %eax
  cltq
  subl   $0x1,(%rcx,%rax,4)
L72:
  add    $0x1,%rdx
  cmp    %edx,(%rsi)
  jl     L62
L1:
  mov    (%rsi,%rdx,4),%eax
  test   %eax,%eax
  js     L38
  cltq
  addl   $0x1,(%rcx,%rax,4)
  jmp    L72
L62:
  ret
```

assistant: ```c
void l_addMom2wm(int *wm, int *i2, int s) {
  register int i, v;
  if (i2 == NULL)
    return;
  if (s == 0)
    for (i = 1; i <= *i2; i++) {
      v = i2[i];
      if (v < 0)
        wm[-v] += 1;
      else
        wm[v] -= 1;
    }
  else
    for (i = 1; i <= *i2; i++) {
      v = i2[i];
      if (v < 0)
        wm[-v] -= 1;
      else
        wm[v] += 1;
    }
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<l_addMom2wm>:
  endbr64
  mov    %rsi,%rcx
  test   %rsi,%rsi
  je     L41
  mov    (%rsi),%eax
  test   %edx,%edx
  jne    L20
  test   %eax,%eax
  jle    L41
  mov    $0x1,%edx
  jmp    L87
  nopl   (%rax)
L48:
  subl   $0x1,(%rdi,%rax,4)
  add    $0x1,%rdx
  cmp    %edx,(%rcx)
  jl     L55
L87:
  movslq (%rcx,%rdx,4),%rax
  test   %eax,%eax
  jns    L48
  neg    %eax
  add    $0x1,%rdx
  cltq
  addl   $0x1,(%rdi,%rax,4)
  cmp    %edx,(%rcx)
  jge    L87
L55:
  ret
  nopl   (%rax)
L41:
  ret
  nopl   0x0(%rax)
L20:
  mov    $0x1,%edx
  test   %eax,%eax
  jg     L30
  jmp    L83
  nopl   0x0(%rax,%rax,1)
L52:
  addl   $0x1,(%rdi,%rax,4)
L42:
  add    $0x1,%rdx
  cmp    %edx,(%rcx)
  jl     L41
L30:
  movslq (%rcx,%rdx,4),%rax
  test   %eax,%eax
  jns    L52
  neg    %eax
  cltq
  subl   $0x1,(%rdi,%rax,4)
  jmp    L42
  xchg   %ax,%ax
L83:
  ret
```

assistant: ```c
void l_addMom2wm(int *wm, int *i2, int s) {
  register int i, v;
  if (i2 == NULL)
    return;
  if (s == 0)
    for (i = 1; i <= *i2; i++) {
      v = i2[i];
      if (v < 0)
        wm[-v] += 1;
      else
        wm[v] -= 1;
    }
  else
    for (i = 1; i <= *i2; i++) {
      v = i2[i];
      if (v < 0)
        wm[-v] -= 1;
      else
        wm[v] += 1;
    }
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<l_addMom2wm>:
  endbr64
  mov    %rsi,%rcx
  test   %rsi,%rsi
  je     L83
  mov    (%rsi),%eax
  test   %edx,%edx
  jne    L36
  test   %eax,%eax
  jle    L83
  mov    $0x1,%edx
  nopl   0x0(%rax,%rax,1)
L30:
  movslq (%rcx,%rdx,4),%rax
  test   %eax,%eax
  js     L65
  subl   $0x1,(%rdi,%rax,4)
  add    $0x1,%rdx
  cmp    %edx,(%rcx)
  jge    L30
  ret
  nopl   (%rax)
L36:
  mov    $0x1,%edx
  test   %eax,%eax
  jle    L6
  nopl   0x0(%rax)
L52:
  movslq (%rcx,%rdx,4),%rax
  test   %eax,%eax
  js     L88
  addl   $0x1,(%rdi,%rax,4)
  add    $0x1,%rdx
  cmp    %edx,(%rcx)
  jge    L52
L83:
  ret
  nopl   (%rax)
L65:
  neg    %eax
  add    $0x1,%rdx
  cltq
  addl   $0x1,(%rdi,%rax,4)
  cmp    %edx,(%rcx)
  jge    L30
  ret
  nopl   0x0(%rax)
L88:
  neg    %eax
  add    $0x1,%rdx
  cltq
  subl   $0x1,(%rdi,%rax,4)
  cmp    %edx,(%rcx)
  jge    L52
  ret
  nopl   0x0(%rax)
L6:
  ret
```

assistant: ```c
void l_addMom2wm(int *wm, int *i2, int s) {
  register int i, v;
  if (i2 == NULL)
    return;
  if (s == 0)
    for (i = 1; i <= *i2; i++) {
      v = i2[i];
      if (v < 0)
        wm[-v] += 1;
      else
        wm[v] -= 1;
    }
  else
    for (i = 1; i <= *i2; i++) {
      v = i2[i];
      if (v < 0)
        wm[-v] -= 1;
      else
        wm[v] += 1;
    }
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<read_data>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    -0x30(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <wait_drq@plt>
  movl   $0x0,-0x1c(%rbp)
  jmp    L15
L2:
  mov    -0x18(%rbp),%rbx
  lea    0x4(%rbx),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x28(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <read_reg16@plt>
  mov    %eax,(%rbx)
  addl   $0x1,-0x1c(%rbp)
L15:
  cmpl   $0xff,-0x1c(%rbp)
  jle    L2
  nop
  nop
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

assistant: ```c
void read_data(struct device *dev, void *buf) {
  int i;
  uint16_t *ptr = buf;
  wait_drq(dev);
  for (i = 0; i < 256; i++) {
    *ptr++ = read_reg16(dev, 0);
  }
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<read_data>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbp
  mov    %rsi,%rbx
  call   <wait_drq@plt>
  lea    0x400(%rbx),%r12
L4:
  add    $0x4,%rbx
  mov    $0x0,%esi
  mov    %rbp,%rdi
  call   <read_reg16@plt>
  mov    %eax,-0x4(%rbx)
  cmp    %rbx,%r12
  jne    L4
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
void read_data(struct device *dev, void *buf) {
  int i;
  uint16_t *ptr = buf;
  wait_drq(dev);
  for (i = 0; i < 256; i++) {
    *ptr++ = read_reg16(dev, 0);
  }
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<read_data>:
  endbr64
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %rsi,%rbx
  lea    0x400(%rbx),%r12
  call   <wait_drq@plt>
  nopw   0x0(%rax,%rax,1)
L1:
  xor    %esi,%esi
  mov    %rbp,%rdi
  add    $0x4,%rbx
  call   <read_reg16@plt>
  mov    %eax,-0x4(%rbx)
  cmp    %rbx,%r12
  jne    L1
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
void read_data(struct device *dev, void *buf) {
  int i;
  uint16_t *ptr = buf;
  wait_drq(dev);
  for (i = 0; i < 256; i++) {
    *ptr++ = read_reg16(dev, 0);
  }
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<read_data>:
  endbr64
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %rsi,%rbx
  lea    0x400(%rbx),%r12
  call   <wait_drq@plt>
  nopw   0x0(%rax,%rax,1)
L0:
  xor    %esi,%esi
  mov    %rbp,%rdi
  add    $0x4,%rbx
  call   <read_reg16@plt>
  mov    %eax,-0x4(%rbx)
  cmp    %r12,%rbx
  jne    L0
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
void read_data(struct device *dev, void *buf) {
  int i;
  uint16_t *ptr = buf;
  wait_drq(dev);
  for (i = 0; i < 256; i++) {
    *ptr++ = read_reg16(dev, 0);
  }
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<spin_a_while>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x14(%rbp)
  mov    %esi,-0x18(%rbp)
  mov    %edx,-0x1c(%rbp)
  movl   $0x0,-0x4(%rbp)
  jmp    L18
L10:
  addl   $0x1,-0x18(%rbp)
  mov    -0x18(%rbp),%eax
  add    %eax,-0x1c(%rbp)
  addl   $0x1,-0x4(%rbp)
L18:
  mov    -0x4(%rbp),%eax
  cmp    -0x14(%rbp),%eax
  jl     L10
  mov    -0x18(%rbp),%eax
  pop    %rbp
  ret
```

assistant: ```c
unsigned spin_a_while(int amt, unsigned a, unsigned b) {
  int i;
  for (i = 0; i < amt; i++) {
    a = a + 1;
    b = b + a;
  }
  return a;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<spin_a_while>:
  endbr64
  test   %edi,%edi
  jle    L7
  mov    $0x0,%edx
L12:
  add    $0x1,%edx
  cmp    %edx,%edi
  jne    L12
  lea    (%rdx,%rsi,1),%eax
  ret
L7:
  mov    %esi,%eax
  ret
```

assistant: ```c
unsigned spin_a_while(int amt, unsigned a, unsigned b) {
  int i;
  for (i = 0; i < amt; i++) {
    a = a + 1;
    b = b + a;
  }
  return a;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<spin_a_while>:
  endbr64
  lea    (%rdi,%rsi,1),%eax
  test   %edi,%edi
  cmovle %esi,%eax
  ret
```

assistant: ```c
unsigned spin_a_while(int amt, unsigned a, unsigned b) {
  int i;
  for (i = 0; i < amt; i++) {
    a = a + 1;
    b = b + a;
  }
  return a;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<spin_a_while>:
  endbr64
  lea    (%rdi,%rsi,1),%eax
  test   %edi,%edi
  cmovle %esi,%eax
  ret
```

assistant: ```c
unsigned spin_a_while(int amt, unsigned a, unsigned b) {
  int i;
  for (i = 0; i < amt; i++) {
    a = a + 1;
    b = b + a;
  }
  return a;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<cec_msg_clear_analogue_timer>:
  endbr64
  push   %rbp
  push   %rbx
  mov    %rdi,%rax
  mov    %ecx,%r11d
  mov    0x18(%rsp),%r10d
  mov    0x20(%rsp),%ecx
  mov    0x38(%rsp),%edi
  movl   $0xd,(%rax)
  mov    0x8(%rax),%rbx
  mov    D19(%rip),%rbp
  mov    0x0(%rbp),%ebp
  mov    %ebp,0x4(%rbx)
  mov    0x8(%rax),%rbx
  mov    %edx,0x8(%rbx)
  mov    0x8(%rax),%rdx
  mov    %r11d,0xc(%rdx)
  movslq %r8d,%rdx
  imul   $0x66666667,%rdx,%rdx
  sar    $0x22,%rdx
  mov    %r8d,%r11d
  sar    $0x1f,%r11d
  sub    %r11d,%edx
  mov    %edx,%r11d
  shl    $0x4,%r11d
  lea    (%rdx,%rdx,4),%edx
  add    %edx,%edx
  sub    %edx,%r8d
  mov    %r11d,%edx
  or     %r8d,%edx
  mov    0x8(%rax),%rbx
  mov    %edx,0x10(%rbx)
  mov    0x8(%rax),%r11
  movslq %r9d,%rdx
  imul   $0x66666667,%rdx,%rdx
  sar    $0x22,%rdx
  mov    %r9d,%r8d
  sar    $0x1f,%r8d
  sub    %r8d,%edx
  mov    %edx,%r8d
  shl    $0x4,%r8d
  lea    (%rdx,%rdx,4),%edx
  add    %edx,%edx
  sub    %edx,%r9d
  mov    %r8d,%edx
  or     %r9d,%edx
  mov    %edx,0x14(%r11)
  mov    0x8(%rax),%r9
  movslq %r10d,%rdx
  imul   $0x66666667,%rdx,%rdx
  sar    $0x22,%rdx
  mov    %r10d,%r8d
  sar    $0x1f,%r8d
  sub    %r8d,%edx
  mov    %edx,%r8d
  shl    $0x4,%r8d
  lea    (%rdx,%rdx,4),%edx
  add    %edx,%edx
  sub    %edx,%r10d
  mov    %r8d,%edx
  or     %r10d,%edx
  mov    %edx,0x18(%r9)
  mov    0x8(%rax),%r9
  movslq %ecx,%rdx
  imul   $0x66666667,%rdx,%rdx
  sar    $0x22,%rdx
  mov    %ecx,%r8d
  sar    $0x1f,%r8d
  sub    %r8d,%edx
  mov    %edx,%r8d
  shl    $0x4,%r8d
  lea    (%rdx,%rdx,4),%edx
  add    %edx,%edx
  sub    %edx,%ecx
  mov    %r8d,%edx
  or     %ecx,%edx
  mov    %edx,0x1c(%r9)
  mov    0x8(%rax),%rdx
  mov    0x28(%rsp),%ecx
  mov    %ecx,0x20(%rdx)
  mov    0x8(%rax),%rdx
  mov    0x30(%rsp),%ecx
  mov    %ecx,0x24(%rdx)
  mov    0x8(%rax),%rdx
  mov    %edi,%ecx
  sar    $0x8,%ecx
  mov    %ecx,0x28(%rdx)
  mov    0x8(%rax),%rdx
  and    $0xff,%edi
  mov    %edi,0x2c(%rdx)
  mov    0x8(%rax),%rdx
  mov    0x40(%rsp),%ecx
  mov    %ecx,0x30(%rdx)
  test   %esi,%esi
  je     L7
  mov    D0(%rip),%rdx
  mov    (%rdx),%esi
L7:
  mov    %esi,0x10(%rax)
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
void cec_msg_clear_analogue_timer(struct cec_msg *msg, int reply, __u8 day, __u8 month, __u8 start_hr, __u8 start_min, __u8 duration_hr, __u8 duration_min, __u8 recording_seq, __u8 ana_bcast_type, __u16 ana_freq, __u8 bcast_system) {
  msg->len = 13;
  msg->msg[1] = CEC_MSG_CLEAR_ANALOGUE_TIMER;
  msg->msg[2] = day;
  msg->msg[3] = month;
  msg->msg[4] = ((start_hr / 10) << 4) | (start_hr % 10);
  msg->msg[5] = ((start_min / 10) << 4) | (start_min % 10);
  msg->msg[6] = ((duration_hr / 10) << 4) | (duration_hr % 10);
  msg->msg[7] = ((duration_min / 10) << 4) | (duration_min % 10);
  msg->msg[8] = recording_seq;
  msg->msg[9] = ana_bcast_type;
  msg->msg[10] = ana_freq >> 8;
  msg->msg[11] = ana_freq & 0xff;
  msg->msg[12] = bcast_system;
  msg->reply = reply ? CEC_MSG_TIMER_CLEARED_STATUS : 0;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<cec_msg_clear_analogue_timer>:
  endbr64
  mov    0x8(%rdi),%rax
  push   %r12
  mov    %ecx,%r12d
  push   %rbx
  mov    D11(%rip),%rbx
  mov    0x18(%rsp),%r11d
  mov    0x20(%rsp),%ecx
  movl   $0xd,(%rdi)
  mov    (%rbx),%ebx
  mov    0x38(%rsp),%r10d
  mov    %edx,0x8(%rax)
  movslq %r8d,%rdx
  imul   $0x66666667,%rdx,%rdx
  mov    %r12d,0xc(%rax)
  mov    %ebx,0x4(%rax)
  mov    %r8d,%ebx
  sar    $0x1f,%ebx
  sar    $0x22,%rdx
  sub    %ebx,%edx
  mov    %edx,%ebx
  lea    (%rdx,%rdx,4),%edx
  add    %edx,%edx
  shl    $0x4,%ebx
  sub    %edx,%r8d
  movslq %r9d,%rdx
  imul   $0x66666667,%rdx,%rdx
  or     %r8d,%ebx
  mov    %r9d,%r8d
  sar    $0x1f,%r8d
  mov    %ebx,0x10(%rax)
  sar    $0x22,%rdx
  sub    %r8d,%edx
  mov    %edx,%r8d
  lea    (%rdx,%rdx,4),%edx
  shl    $0x4,%r8d
  add    %edx,%edx
  sub    %edx,%r9d
  mov    %r8d,%edx
  mov    %r11d,%r8d
  or     %r9d,%edx
  sar    $0x1f,%r8d
  mov    %edx,0x14(%rax)
  movslq %r11d,%rdx
  imul   $0x66666667,%rdx,%rdx
  sar    $0x22,%rdx
  sub    %r8d,%edx
  mov    %edx,%r8d
  lea    (%rdx,%rdx,4),%edx
  shl    $0x4,%r8d
  add    %edx,%edx
  sub    %edx,%r11d
  mov    %r8d,%edx
  mov    %ecx,%r8d
  or     %r11d,%edx
  sar    $0x1f,%r8d
  mov    %edx,0x18(%rax)
  movslq %ecx,%rdx
  imul   $0x66666667,%rdx,%rdx
  sar    $0x22,%rdx
  sub    %r8d,%edx
  mov    %edx,%r8d
  lea    (%rdx,%rdx,4),%edx
  add    %edx,%edx
  shl    $0x4,%r8d
  sub    %edx,%ecx
  mov    %r8d,%edx
  or     %ecx,%edx
  mov    %edx,0x1c(%rax)
  mov    0x28(%rsp),%edx
  mov    %edx,0x20(%rax)
  mov    0x30(%rsp),%edx
  mov    %edx,0x24(%rax)
  mov    %r10d,%edx
  sar    $0x8,%edx
  and    $0xff,%r10d
  mov    %edx,0x28(%rax)
  mov    0x40(%rsp),%edx
  mov    %r10d,0x2c(%rax)
  mov    %edx,0x30(%rax)
  test   %esi,%esi
  je     L4
  mov    D2(%rip),%rax
  mov    (%rax),%esi
L4:
  pop    %rbx
  pop    %r12
  mov    %esi,0x10(%rdi)
  ret
```

assistant: ```c
void cec_msg_clear_analogue_timer(struct cec_msg *msg, int reply, __u8 day, __u8 month, __u8 start_hr, __u8 start_min, __u8 duration_hr, __u8 duration_min, __u8 recording_seq, __u8 ana_bcast_type, __u16 ana_freq, __u8 bcast_system) {
  msg->len = 13;
  msg->msg[1] = CEC_MSG_CLEAR_ANALOGUE_TIMER;
  msg->msg[2] = day;
  msg->msg[3] = month;
  msg->msg[4] = ((start_hr / 10) << 4) | (start_hr % 10);
  msg->msg[5] = ((start_min / 10) << 4) | (start_min % 10);
  msg->msg[6] = ((duration_hr / 10) << 4) | (duration_hr % 10);
  msg->msg[7] = ((duration_min / 10) << 4) | (duration_min % 10);
  msg->msg[8] = recording_seq;
  msg->msg[9] = ana_bcast_type;
  msg->msg[10] = ana_freq >> 8;
  msg->msg[11] = ana_freq & 0xff;
  msg->msg[12] = bcast_system;
  msg->reply = reply ? CEC_MSG_TIMER_CLEARED_STATUS : 0;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<cec_msg_clear_analogue_timer>:
  endbr64
  movslq %r8d,%rax
  push   %r13
  mov    %ecx,%r13d
  mov    0x8(%rdi),%r10
  imul   $0x66666667,%rax,%rax
  push   %r12
  mov    %edx,%r12d
  movd   %r13d,%xmm1
  push   %rbx
  mov    %r8d,%ebx
  mov    0x20(%rsp),%r11d
  movd   %r12d,%xmm3
  sar    $0x1f,%ebx
  movl   $0xd,(%rdi)
  mov    0x28(%rsp),%ecx
  sar    $0x22,%rax
  mov    0x40(%rsp),%edx
  movd   0x30(%rsp),%xmm4
  sub    %ebx,%eax
  movd   0x48(%rsp),%xmm6
  mov    %eax,%ebx
  lea    (%rax,%rax,4),%eax
  add    %eax,%eax
  shl    $0x4,%ebx
  sub    %eax,%r8d
  mov    D10(%rip),%rax
  or     %r8d,%ebx
  mov    %r9d,%r8d
  movd   (%rax),%xmm0
  movslq %r9d,%rax
  sar    $0x1f,%r8d
  movd   %ebx,%xmm2
  imul   $0x66666667,%rax,%rax
  punpckldq %xmm2,%xmm1
  punpckldq %xmm3,%xmm0
  punpcklqdq %xmm1,%xmm0
  sar    $0x22,%rax
  movups %xmm0,0x4(%r10)
  sub    %r8d,%eax
  mov    %eax,%r8d
  lea    (%rax,%rax,4),%eax
  add    %eax,%eax
  shl    $0x4,%r8d
  sub    %eax,%r9d
  movslq %r11d,%rax
  imul   $0x66666667,%rax,%rax
  or     %r9d,%r8d
  movd   %r8d,%xmm0
  mov    %r11d,%r8d
  sar    $0x1f,%r8d
  sar    $0x22,%rax
  sub    %r8d,%eax
  mov    %eax,%r8d
  lea    (%rax,%rax,4),%eax
  add    %eax,%eax
  shl    $0x4,%r8d
  sub    %eax,%r11d
  movslq %ecx,%rax
  mov    %r8d,%r9d
  mov    %ecx,%r8d
  imul   $0x66666667,%rax,%rax
  sar    $0x1f,%r8d
  or     %r11d,%r9d
  movd   %r9d,%xmm5
  punpckldq %xmm5,%xmm0
  sar    $0x22,%rax
  sub    %r8d,%eax
  mov    %eax,%r8d
  lea    (%rax,%rax,4),%eax
  add    %eax,%eax
  shl    $0x4,%r8d
  sub    %eax,%ecx
  mov    %edx,%eax
  movzbl %dl,%edx
  or     %ecx,%r8d
  sar    $0x8,%eax
  movd   %r8d,%xmm1
  movd   %eax,%xmm7
  punpckldq %xmm4,%xmm1
  punpcklqdq %xmm1,%xmm0
  movd   0x38(%rsp),%xmm1
  movups %xmm0,0x14(%r10)
  movd   %edx,%xmm0
  punpckldq %xmm6,%xmm0
  punpckldq %xmm7,%xmm1
  punpcklqdq %xmm0,%xmm1
  movups %xmm1,0x24(%r10)
  test   %esi,%esi
  je     L2
  mov    D13(%rip),%rax
  mov    (%rax),%esi
L2:
  pop    %rbx
  pop    %r12
  mov    %esi,0x10(%rdi)
  pop    %r13
  ret
```

assistant: ```c
void cec_msg_clear_analogue_timer(struct cec_msg *msg, int reply, __u8 day, __u8 month, __u8 start_hr, __u8 start_min, __u8 duration_hr, __u8 duration_min, __u8 recording_seq, __u8 ana_bcast_type, __u16 ana_freq, __u8 bcast_system) {
  msg->len = 13;
  msg->msg[1] = CEC_MSG_CLEAR_ANALOGUE_TIMER;
  msg->msg[2] = day;
  msg->msg[3] = month;
  msg->msg[4] = ((start_hr / 10) << 4) | (start_hr % 10);
  msg->msg[5] = ((start_min / 10) << 4) | (start_min % 10);
  msg->msg[6] = ((duration_hr / 10) << 4) | (duration_hr % 10);
  msg->msg[7] = ((duration_min / 10) << 4) | (duration_min % 10);
  msg->msg[8] = recording_seq;
  msg->msg[9] = ana_bcast_type;
  msg->msg[10] = ana_freq >> 8;
  msg->msg[11] = ana_freq & 0xff;
  msg->msg[12] = bcast_system;
  msg->reply = reply ? CEC_MSG_TIMER_CLEARED_STATUS : 0;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<RandomFunc>:
  endbr64
  movzwl (%rdi),%eax
  add    $0x2cdb,%ax
  movzwl 0x2(%rdi),%edi
  test   %di,%di
  je     L10
  mov    $0x0,%edx
  jmp    L38
L19:
  lea    0x0(,%rax,8),%ecx
  and    $0x38,%ecx
  or     %ecx,%eax
L0:
  add    $0x1,%edx
  cmp    %dx,%di
  je     L10
L38:
  cmp    %dx,%ax
  je     L19
  lea    0x0(,%rax,8),%ecx
  and    $0x78,%ecx
  or     %ecx,%eax
  jmp    L0
L10:
  add    %eax,%eax
  mov    %ax,(%rsi)
  ret
```

assistant: ```c
void RandomFunc(unsigned short input[1], unsigned short output[1]) {
  unsigned short state[1];
  unsigned short local1;
  char copy12;
  {
    state[0UL] = input[0UL] + (unsigned short)11483;
    local1 = 0UL;
    while (local1 < input[1UL]) {
      if (state[0UL] == local1) {
        if (state[0UL] < local1) {
          state[local1] = state[0UL] + state[local1];
          state[local1] |= ((state[0UL] - state[local1]) & (unsigned short)31) << 4UL;
        } else {
          state[local1] |= ((state[0UL] + state[0UL]) & (unsigned short)15) << 2UL;
        }
      } else {
        state[0UL] |= (state[local1] & (unsigned short)15) << 3UL;
        copy12 = *((char *)(&state[local1]) + 1);
        *((char *)(&state[local1]) + 1) = *((char *)(&state[local1]) + 0);
        *((char *)(&state[local1]) + 0) = copy12;
        copy12 = *((char *)(&state[local1]) + 0);
        *((char *)(&state[local1]) + 0) = *((char *)(&state[local1]) + 1);
        *((char *)(&state[local1]) + 1) = copy12;
      }
      local1++;
    }
    output[0UL] = state[0UL] << (unsigned short)1;
  }
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<RandomFunc>:
  endbr64
  movzwl (%rdi),%eax
  movzwl 0x2(%rdi),%edi
  add    $0x2cdb,%ax
  test   %di,%di
  je     L21
  xor    %edx,%edx
  jmp    L38
  nopl   0x0(%rax,%rax,1)
L4:
  and    $0x78,%ecx
  add    $0x1,%edx
  or     %ecx,%eax
  cmp    %di,%dx
  je     L21
L38:
  lea    0x0(,%rax,8),%ecx
  cmp    %dx,%ax
  jne    L4
  and    $0x38,%ecx
  add    $0x1,%edx
  or     %ecx,%eax
  cmp    %di,%dx
  jne    L38
L21:
  add    %eax,%eax
  mov    %ax,(%rsi)
  ret
```

assistant: ```c
void RandomFunc(unsigned short input[1], unsigned short output[1]) {
  unsigned short state[1];
  unsigned short local1;
  char copy12;
  {
    state[0UL] = input[0UL] + (unsigned short)11483;
    local1 = 0UL;
    while (local1 < input[1UL]) {
      if (state[0UL] == local1) {
        if (state[0UL] < local1) {
          state[local1] = state[0UL] + state[local1];
          state[local1] |= ((state[0UL] - state[local1]) & (unsigned short)31) << 4UL;
        } else {
          state[local1] |= ((state[0UL] + state[0UL]) & (unsigned short)15) << 2UL;
        }
      } else {
        state[0UL] |= (state[local1] & (unsigned short)15) << 3UL;
        copy12 = *((char *)(&state[local1]) + 1);
        *((char *)(&state[local1]) + 1) = *((char *)(&state[local1]) + 0);
        *((char *)(&state[local1]) + 0) = copy12;
        copy12 = *((char *)(&state[local1]) + 0);
        *((char *)(&state[local1]) + 0) = *((char *)(&state[local1]) + 1);
        *((char *)(&state[local1]) + 1) = copy12;
      }
      local1++;
    }
    output[0UL] = state[0UL] << (unsigned short)1;
  }
}
```