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

```asm
<mfm_get_kv>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x30(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x1c(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x18(%rbp)
  movl   $0x0,-0x14(%rbp)
  jmp    L16
L85:
  subl   $0x1,-0x1c(%rbp)
  subl   $0x1,-0x18(%rbp)
  mov    -0x1c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  mov    -0x18(%rbp),%edx
  movslq %edx,%rcx
  mov    -0x8(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rdx),%edx
  movzbl %dl,%edx
  sub    %edx,%eax
  mov    %eax,-0x14(%rbp)
L16:
  cmpl   $0x0,-0x1c(%rbp)
  je     L55
  cmpl   $0x0,-0x18(%rbp)
  je     L55
  cmpl   $0x0,-0x14(%rbp)
  je     L85
L55:
  cmpl   $0x0,-0x14(%rbp)
  jne    L61
  mov    -0x18(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jg     L61
  mov    $0x0,%eax
  jmp    L40
L61:
  cmpl   $0x0,-0x14(%rbp)
  jne    L10
  mov    -0x18(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jle    L10
  mov    $0xffffffff,%eax
  jmp    L40
L10:
  mov    -0x14(%rbp),%eax
L40:
  leave
  ret
```

assistant: ```c
int mfm_get_kv(const void *one, const void *two) {
  unsigned char *s1 = (unsigned char *)one;
  unsigned char *s2 = ((unsigned char **)two)[0];
  int l1 = strlen(s1);
  int l2 = strlen(s2);
  int res = 0;
  while (l1 && l2 && !res) {
    l1--;
    l2--;
    res = (int)s1[l1] - (int)s2[l2];
  }
  if (!res && l2 <= l1) {
    return 0;
  } else if (!res && l2 > l1) {
    return -1;
  }
  return res;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<mfm_get_kv>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%r12
  mov    (%rsi),%rbx
  call   <strlen@plt>
  mov    %eax,%ebp
  mov    %rbx,%rdi
  call   <strlen@plt>
  test   %ebp,%ebp
  je     L36
  test   %eax,%eax
  je     L36
  lea    -0x1(%rax),%edx
  movslq %edx,%rdx
  mov    %ebp,%esi
  movslq %ebp,%rbp
  cltq
  sub    %rax,%rbp
  add    %rbp,%r12
L77:
  mov    %edx,%r8d
  movzbl (%r12,%rdx,1),%eax
  movzbl (%rbx,%rdx,1),%edi
  sub    $0x1,%esi
  setne  %cl
  test   %edx,%edx
  setne  %r9b
  and    %r9d,%ecx
  sub    %edi,%eax
  sete   %dil
  sub    $0x1,%rdx
  test   %dil,%cl
  jne    L77
L26:
  test   %eax,%eax
  sete   %dl
  cmp    %r8d,%esi
  jl     L56
  test   %dl,%dl
  je     L56
  mov    $0x0,%eax
L38:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L36:
  mov    %eax,%r8d
  mov    %ebp,%esi
  mov    $0x0,%eax
  jmp    L26
L56:
  cmp    %r8d,%esi
  jge    L38
  test   %dl,%dl
  mov    $0xffffffff,%edx
  cmovne %edx,%eax
  jmp    L38
```

assistant: ```c
int mfm_get_kv(const void *one, const void *two) {
  unsigned char *s1 = (unsigned char *)one;
  unsigned char *s2 = ((unsigned char **)two)[0];
  int l1 = strlen(s1);
  int l2 = strlen(s2);
  int res = 0;
  while (l1 && l2 && !res) {
    l1--;
    l2--;
    res = (int)s1[l1] - (int)s2[l2];
  }
  if (!res && l2 <= l1) {
    return 0;
  } else if (!res && l2 > l1) {
    return -1;
  }
  return res;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<mfm_get_kv>:
  endbr64
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  push   %rbx
  mov    (%rsi),%rbp
  call   <strlen@plt>
  mov    %rbp,%rdi
  mov    %eax,%ebx
  call   <strlen@plt>
  test   %ebx,%ebx
  je     L71
  test   %eax,%eax
  je     L71
  lea    -0x1(%rax),%edx
  movslq %ebx,%rsi
  cltq
  mov    %rsi,%rcx
  sub    %rax,%rsi
  movslq %edx,%rdx
  lea    (%r12,%rsi,1),%r8
  nopw   0x0(%rax,%rax,1)
L34:
  movzbl (%r8,%rdx,1),%eax
  movzbl 0x0(%rbp,%rdx,1),%edi
  mov    %edx,%esi
  sub    %edi,%eax
  sub    $0x1,%ecx
  je     L11
  test   %edx,%edx
  je     L11
  sub    $0x1,%rdx
  test   %eax,%eax
  je     L34
L36:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax)
L11:
  test   %eax,%eax
  sete   %dl
L13:
  cmp    %ecx,%esi
  jg     L60
  test   %dl,%dl
  je     L15
  pop    %rbx
  xor    %eax,%eax
  pop    %rbp
  pop    %r12
  ret
L15:
  cmp    %ecx,%esi
  jle    L36
L60:
  test   %dl,%dl
  mov    $0xffffffff,%edx
  cmovne %edx,%eax
  jmp    L36
L71:
  mov    %eax,%esi
  mov    %ebx,%ecx
  mov    $0x1,%edx
  xor    %eax,%eax
  jmp    L13
```

assistant: ```c
int mfm_get_kv(const void *one, const void *two) {
  unsigned char *s1 = (unsigned char *)one;
  unsigned char *s2 = ((unsigned char **)two)[0];
  int l1 = strlen(s1);
  int l2 = strlen(s2);
  int res = 0;
  while (l1 && l2 && !res) {
    l1--;
    l2--;
    res = (int)s1[l1] - (int)s2[l2];
  }
  if (!res && l2 <= l1) {
    return 0;
  } else if (!res && l2 > l1) {
    return -1;
  }
  return res;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<mfm_get_kv>:
  endbr64
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  push   %rbx
  mov    (%rsi),%rbp
  call   <strlen@plt>
  mov    %rbp,%rdi
  mov    %eax,%ebx
  call   <strlen@plt>
  test   %ebx,%ebx
  je     L49
  test   %eax,%eax
  je     L49
  lea    -0x1(%rax),%edx
  movslq %ebx,%rsi
  cltq
  mov    %rsi,%rcx
  sub    %rax,%rsi
  movslq %edx,%rdx
  lea    (%r12,%rsi,1),%r8
  nopw   0x0(%rax,%rax,1)
L33:
  movzbl (%r8,%rdx,1),%eax
  movzbl 0x0(%rbp,%rdx,1),%edi
  mov    %edx,%esi
  sub    %edi,%eax
  sub    $0x1,%ecx
  je     L79
  test   %edx,%edx
  je     L79
  sub    $0x1,%rdx
  test   %eax,%eax
  je     L33
L81:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax)
L79:
  test   %eax,%eax
  sete   %dl
L24:
  cmp    %ecx,%esi
  jg     L56
  test   %dl,%dl
  je     L31
  pop    %rbx
  xor    %eax,%eax
  pop    %rbp
  pop    %r12
  ret
L31:
  cmp    %ecx,%esi
  jle    L81
L56:
  test   %dl,%dl
  mov    $0xffffffff,%edx
  cmovne %edx,%eax
  jmp    L81
L49:
  mov    %eax,%esi
  mov    %ebx,%ecx
  mov    $0x1,%edx
  xor    %eax,%eax
  jmp    L24
```

assistant: ```c
int mfm_get_kv(const void *one, const void *two) {
  unsigned char *s1 = (unsigned char *)one;
  unsigned char *s2 = ((unsigned char **)two)[0];
  int l1 = strlen(s1);
  int l2 = strlen(s2);
  int res = 0;
  while (l1 && l2 && !res) {
    l1--;
    l2--;
    res = (int)s1[l1] - (int)s2[l2];
  }
  if (!res && l2 <= l1) {
    return 0;
  } else if (!res && l2 > l1) {
    return -1;
  }
  return res;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<rtrim>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L20
  mov    -0x18(%rbp),%rax
  jmp    L9
L20:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cltq
  lea    -0x1(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x8(%rbp)
  jmp    L18
L11:
  mov    -0x8(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  movb   $0x0,(%rax)
L18:
  mov    -0x8(%rbp),%rax
  cmp    -0x18(%rbp),%rax
  je     L30
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x20,%al
  je     L11
L30:
  mov    -0x18(%rbp),%rax
L9:
  leave
  ret
```

assistant: ```c
char *rtrim(char *str) {
  char *s;
  if (str[0] == '\0')
    return str;
  s = &str[strlen(str) - 1];
  while (s != str && *s == ' ')
    *s-- = '\0';
  return str;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<rtrim>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  cmpb   $0x0,(%rdi)
  jne    L39
L19:
  mov    %rbx,%rax
  pop    %rbx
  ret
L39:
  call   <strlen@plt>
  cltq
  lea    -0x1(%rbx,%rax,1),%rax
  cmp    %rax,%rbx
  je     L19
L48:
  cmpb   $0x20,(%rax)
  jne    L19
  sub    $0x1,%rax
  movb   $0x0,0x1(%rax)
  cmp    %rax,%rbx
  jne    L48
  jmp    L19
```

assistant: ```c
char *rtrim(char *str) {
  char *s;
  if (str[0] == '\0')
    return str;
  s = &str[strlen(str) - 1];
  while (s != str && *s == ' ')
    *s-- = '\0';
  return str;
}
```
user: What is the c source code of the assembly code below?

```asm
<rtrim>:
  endbr64
  cmpb   $0x0,(%rdi)
  push   %r12
  mov    %rdi,%r12
  jne    L9
L44:
  mov    %r12,%rax
  pop    %r12
  ret
  nopl   0x0(%rax)
L9:
  call   <strlen@plt>
  cltq
  lea    -0x1(%r12,%rax,1),%rax
  cmp    %rax,%r12
  jne    L1
  jmp    L44
  nopl   0x0(%rax,%rax,1)
L23:
  sub    $0x1,%rax
  movb   $0x0,0x1(%rax)
  cmp    %rax,%r12
  je     L44
L1:
  cmpb   $0x20,(%rax)
  je     L23
  mov    %r12,%rax
  pop    %r12
  ret
```

assistant: ```c
char *rtrim(char *str) {
  char *s;
  if (str[0] == '\0')
    return str;
  s = &str[strlen(str) - 1];
  while (s != str && *s == ' ')
    *s-- = '\0';
  return str;
}
```
user: Translate the below assembly code into C programming language:

```asm
<rtrim>:
  endbr64
  cmpb   $0x0,(%rdi)
  push   %r12
  mov    %rdi,%r12
  jne    L48
L28:
  mov    %r12,%rax
  pop    %r12
  ret
  nopl   0x0(%rax)
L48:
  call   <strlen@plt>
  cltq
  lea    -0x1(%r12,%rax,1),%rax
  cmp    %rax,%r12
  jne    L32
  jmp    L28
  nopl   0x0(%rax,%rax,1)
L8:
  sub    $0x1,%rax
  movb   $0x0,0x1(%rax)
  cmp    %rax,%r12
  je     L28
L32:
  cmpb   $0x20,(%rax)
  je     L8
  mov    %r12,%rax
  pop    %r12
  ret
```

assistant: ```c
char *rtrim(char *str) {
  char *s;
  if (str[0] == '\0')
    return str;
  s = &str[strlen(str) - 1];
  while (s != str && *s == ' ')
    *s-- = '\0';
  return str;
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<RandomFunc>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x28(%rbp),%rax
  mov    (%rax),%eax
  add    $0x136ff696,%eax
  mov    %eax,-0xc(%rbp)
  movl   $0x0,-0x10(%rbp)
  jmp    L20
L33:
  lea    -0xc(%rbp),%rdx
  mov    -0x10(%rbp),%eax
  shl    $0x2,%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0x11(%rbp)
  lea    -0xc(%rbp),%rdx
  mov    -0x10(%rbp),%eax
  shl    $0x2,%rax
  add    %rdx,%rax
  add    $0x3,%rax
  lea    -0xc(%rbp),%rcx
  mov    -0x10(%rbp),%edx
  shl    $0x2,%rdx
  add    %rcx,%rdx
  movzbl (%rax),%eax
  mov    %al,(%rdx)
  lea    -0xc(%rbp),%rdx
  mov    -0x10(%rbp),%eax
  shl    $0x2,%rax
  add    %rdx,%rax
  lea    0x3(%rax),%rdx
  movzbl -0x11(%rbp),%eax
  mov    %al,(%rdx)
  mov    -0x10(%rbp),%eax
  mov    -0xc(%rbp,%rax,4),%edx
  mov    -0xc(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0xc(%rbp)
  addl   $0x2,-0x10(%rbp)
L20:
  cmpl   $0x0,-0x10(%rbp)
  je     L33
  movl   $0x0,-0x10(%rbp)
  jmp    L34
L1:
  mov    -0xc(%rbp),%edx
  mov    -0x10(%rbp),%eax
  mov    -0xc(%rbp,%rax,4),%eax
  add    %edx,%eax
  mov    %eax,-0xc(%rbp)
  mov    -0x10(%rbp),%eax
  mov    -0xc(%rbp,%rax,4),%edx
  mov    -0xc(%rbp),%eax
  add    %eax,%edx
  mov    -0x10(%rbp),%eax
  mov    %edx,-0xc(%rbp,%rax,4)
  addl   $0x2,-0x10(%rbp)
L34:
  cmpl   $0x0,-0x10(%rbp)
  je     L1
  mov    -0xc(%rbp),%eax
  lea    0x5ca83cf8(%rax),%edx
  mov    -0x30(%rbp),%rax
  mov    %edx,(%rax)
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L18
  call   <__stack_chk_fail@plt>
L18:
  leave
  ret
```

assistant: ```c
void RandomFunc(unsigned int input[1], unsigned int output[1]) {
  unsigned int state[1];
  unsigned int local1;
  char copy11;
  {
    state[0UL] = (input[0UL] + 51238316UL) + 274866410U;
    local1 = 0UL;
    while (local1 < 1UL) {
      copy11 = *((char *)(&state[local1]) + 0);
      *((char *)(&state[local1]) + 0) = *((char *)(&state[local1]) + 3);
      *((char *)(&state[local1]) + 3) = copy11;
      state[0UL] = state[local1] + state[0UL];
      local1 += 2UL;
    }
    local1 = 0UL;
    while (local1 < 1UL) {
      state[0UL] += state[local1];
      state[local1] += state[0UL];
      local1 += 2UL;
    }
    output[0UL] = (state[0UL] + 468445703UL) + 1086083825U;
  }
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<RandomFunc>:
  endbr64
  mov    (%rdi),%eax
  add    $0x136ff696,%eax
  mov    %eax,%edx
  mov    %eax,%ecx
  sar    $0x18,%ecx
  mov    %cl,%dl
  shl    $0x18,%eax
  and    $0xffffff,%edx
  or     %eax,%edx
  lea    0x5ca83cf8(,%rdx,8),%eax
  mov    %eax,(%rsi)
  ret
```

assistant: ```c
void RandomFunc(unsigned int input[1], unsigned int output[1]) {
  unsigned int state[1];
  unsigned int local1;
  char copy11;
  {
    state[0UL] = (input[0UL] + 51238316UL) + 274866410U;
    local1 = 0UL;
    while (local1 < 1UL) {
      copy11 = *((char *)(&state[local1]) + 0);
      *((char *)(&state[local1]) + 0) = *((char *)(&state[local1]) + 3);
      *((char *)(&state[local1]) + 3) = copy11;
      state[0UL] = state[local1] + state[0UL];
      local1 += 2UL;
    }
    local1 = 0UL;
    while (local1 < 1UL) {
      state[0UL] += state[local1];
      state[local1] += state[0UL];
      local1 += 2UL;
    }
    output[0UL] = (state[0UL] + 468445703UL) + 1086083825U;
  }
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<RandomFunc>:
  endbr64
  mov    (%rdi),%eax
  add    $0x136ff696,%eax
  mov    %eax,%ecx
  mov    %eax,%edx
  shl    $0x18,%eax
  sar    $0x18,%ecx
  mov    %cl,%dl
  and    $0xffffff,%edx
  or     %eax,%edx
  lea    0x5ca83cf8(,%rdx,8),%eax
  mov    %eax,(%rsi)
  ret
```

assistant: ```c
void RandomFunc(unsigned int input[1], unsigned int output[1]) {
  unsigned int state[1];
  unsigned int local1;
  char copy11;
  {
    state[0UL] = (input[0UL] + 51238316UL) + 274866410U;
    local1 = 0UL;
    while (local1 < 1UL) {
      copy11 = *((char *)(&state[local1]) + 0);
      *((char *)(&state[local1]) + 0) = *((char *)(&state[local1]) + 3);
      *((char *)(&state[local1]) + 3) = copy11;
      state[0UL] = state[local1] + state[0UL];
      local1 += 2UL;
    }
    local1 = 0UL;
    while (local1 < 1UL) {
      state[0UL] += state[local1];
      state[local1] += state[0UL];
      local1 += 2UL;
    }
    output[0UL] = (state[0UL] + 468445703UL) + 1086083825U;
  }
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<RandomFunc>:
  endbr64
  mov    (%rdi),%eax
  add    $0x136ff696,%eax
  mov    %eax,%ecx
  mov    %eax,%edx
  shl    $0x18,%eax
  sar    $0x18,%ecx
  mov    %cl,%dl
  and    $0xffffff,%edx
  or     %eax,%edx
  lea    0x5ca83cf8(,%rdx,8),%eax
  mov    %eax,(%rsi)
  ret
```

assistant: ```c
void RandomFunc(unsigned int input[1], unsigned int output[1]) {
  unsigned int state[1];
  unsigned int local1;
  char copy11;
  {
    state[0UL] = (input[0UL] + 51238316UL) + 274866410U;
    local1 = 0UL;
    while (local1 < 1UL) {
      copy11 = *((char *)(&state[local1]) + 0);
      *((char *)(&state[local1]) + 0) = *((char *)(&state[local1]) + 3);
      *((char *)(&state[local1]) + 3) = copy11;
      state[0UL] = state[local1] + state[0UL];
      local1 += 2UL;
    }
    local1 = 0UL;
    while (local1 < 1UL) {
      state[0UL] += state[local1];
      state[local1] += state[0UL];
      local1 += 2UL;
    }
    output[0UL] = (state[0UL] + 468445703UL) + 1086083825U;
  }
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<RandomFunc>:
  endbr64
  movzwl (%rdi),%eax
  shl    $0x7,%eax
  and    $0xb500,%eax
  sar    %eax
  mov    $0x0,%edx
  mov    %al,%dh
  movsbl %ah,%eax
  mov    %al,%dl
  or     $0xaf9,%dx
  mov    %dx,(%rsi)
  ret
```

assistant: ```c
void RandomFunc(unsigned short input[1], unsigned short output[1]) {
  unsigned short state[1];
  char copy12;
  char copy13;
  char copy15;
  {
    state[0UL] = (input[0UL] & 914778474UL) << (unsigned short)7;
    if ((state[0UL] >> (unsigned short)1) & (unsigned short)1) {
      if ((state[0UL] >> (unsigned short)1) & (unsigned short)1) {
        if ((state[0UL] >> (unsigned short)4) & (unsigned short)1) {
          copy12 = *((char *)(&state[0UL]) + 1);
          *((char *)(&state[0UL]) + 1) = *((char *)(&state[0UL]) + 0);
          *((char *)(&state[0UL]) + 0) = copy12;
          copy12 = *((char *)(&state[0UL]) + 0);
          *((char *)(&state[0UL]) + 0) = *((char *)(&state[0UL]) + 1);
          *((char *)(&state[0UL]) + 1) = copy12;
        } else {
          state[0UL] >>= ((state[0UL] >> (unsigned short)3) & (unsigned short)7) | 1UL;
          copy13 = *((char *)(&state[0UL]) + 0);
          *((char *)(&state[0UL]) + 0) = *((char *)(&state[0UL]) + 1);
          *((char *)(&state[0UL]) + 1) = copy13;
        }
      } else {
        state[0UL] >>= ((state[0UL] >> (unsigned short)1) & (unsigned short)7) | 1UL;
      }
    } else {
      state[0UL] >>= (state[0UL] & (unsigned short)7) | 1UL;
      copy15 = *((char *)(&state[0UL]) + 1);
      *((char *)(&state[0UL]) + 1) = *((char *)(&state[0UL]) + 0);
      *((char *)(&state[0UL]) + 0) = copy15;
    }
    output[0UL] = state[0UL] | 136252153UL;
  }
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<RandomFunc>:
  endbr64
  movzwl (%rdi),%eax
  xor    %edx,%edx
  shl    $0x7,%eax
  and    $0xb500,%eax
  sar    %eax
  mov    %al,%dh
  movsbl %ah,%eax
  mov    %al,%dl
  or     $0xaf9,%dx
  mov    %dx,(%rsi)
  ret
```

assistant: ```c
void RandomFunc(unsigned short input[1], unsigned short output[1]) {
  unsigned short state[1];
  char copy12;
  char copy13;
  char copy15;
  {
    state[0UL] = (input[0UL] & 914778474UL) << (unsigned short)7;
    if ((state[0UL] >> (unsigned short)1) & (unsigned short)1) {
      if ((state[0UL] >> (unsigned short)1) & (unsigned short)1) {
        if ((state[0UL] >> (unsigned short)4) & (unsigned short)1) {
          copy12 = *((char *)(&state[0UL]) + 1);
          *((char *)(&state[0UL]) + 1) = *((char *)(&state[0UL]) + 0);
          *((char *)(&state[0UL]) + 0) = copy12;
          copy12 = *((char *)(&state[0UL]) + 0);
          *((char *)(&state[0UL]) + 0) = *((char *)(&state[0UL]) + 1);
          *((char *)(&state[0UL]) + 1) = copy12;
        } else {
          state[0UL] >>= ((state[0UL] >> (unsigned short)3) & (unsigned short)7) | 1UL;
          copy13 = *((char *)(&state[0UL]) + 0);
          *((char *)(&state[0UL]) + 0) = *((char *)(&state[0UL]) + 1);
          *((char *)(&state[0UL]) + 1) = copy13;
        }
      } else {
        state[0UL] >>= ((state[0UL] >> (unsigned short)1) & (unsigned short)7) | 1UL;
      }
    } else {
      state[0UL] >>= (state[0UL] & (unsigned short)7) | 1UL;
      copy15 = *((char *)(&state[0UL]) + 1);
      *((char *)(&state[0UL]) + 1) = *((char *)(&state[0UL]) + 0);
      *((char *)(&state[0UL]) + 0) = copy15;
    }
    output[0UL] = state[0UL] | 136252153UL;
  }
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<RandomFunc>:
  endbr64
  movzwl (%rdi),%eax
  xor    %edx,%edx
  shl    $0x7,%eax
  and    $0xb500,%eax
  mov    %eax,%ecx
  shr    $0x9,%eax
  sar    %ecx
  mov    %al,%dl
  mov    %cl,%dh
  or     $0xaf9,%dx
  mov    %dx,(%rsi)
  ret
```

assistant: ```c
void RandomFunc(unsigned short input[1], unsigned short output[1]) {
  unsigned short state[1];
  char copy12;
  char copy13;
  char copy15;
  {
    state[0UL] = (input[0UL] & 914778474UL) << (unsigned short)7;
    if ((state[0UL] >> (unsigned short)1) & (unsigned short)1) {
      if ((state[0UL] >> (unsigned short)1) & (unsigned short)1) {
        if ((state[0UL] >> (unsigned short)4) & (unsigned short)1) {
          copy12 = *((char *)(&state[0UL]) + 1);
          *((char *)(&state[0UL]) + 1) = *((char *)(&state[0UL]) + 0);
          *((char *)(&state[0UL]) + 0) = copy12;
          copy12 = *((char *)(&state[0UL]) + 0);
          *((char *)(&state[0UL]) + 0) = *((char *)(&state[0UL]) + 1);
          *((char *)(&state[0UL]) + 1) = copy12;
        } else {
          state[0UL] >>= ((state[0UL] >> (unsigned short)3) & (unsigned short)7) | 1UL;
          copy13 = *((char *)(&state[0UL]) + 0);
          *((char *)(&state[0UL]) + 0) = *((char *)(&state[0UL]) + 1);
          *((char *)(&state[0UL]) + 1) = copy13;
        }
      } else {
        state[0UL] >>= ((state[0UL] >> (unsigned short)1) & (unsigned short)7) | 1UL;
      }
    } else {
      state[0UL] >>= (state[0UL] & (unsigned short)7) | 1UL;
      copy15 = *((char *)(&state[0UL]) + 1);
      *((char *)(&state[0UL]) + 1) = *((char *)(&state[0UL]) + 0);
      *((char *)(&state[0UL]) + 0) = copy15;
    }
    output[0UL] = state[0UL] | 136252153UL;
  }
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<EMACConfigSet>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %edi,-0x4(%rbp)
  mov    %esi,-0x8(%rbp)
  mov    %edx,-0xc(%rbp)
  mov    %ecx,-0x10(%rbp)
  mov    -0x8(%rbp),%eax
  and    $0x85a08100,%eax
  test   %eax,%eax
  sete   %al
  movzbl %al,%eax
  mov    %eax,%edi
  call   <ASSERT@plt>
  cmpl   $0x0,-0x10(%rbp)
  je     L9
  cmpl   $0x3fff,-0x10(%rbp)
  jg     L19
  cmpl   $0x5f2,-0x10(%rbp)
  jle    L19
L9:
  mov    $0x1,%eax
  jmp    L42
L19:
  mov    $0x0,%eax
L42:
  mov    %eax,%edi
  call   <ASSERT@plt>
  mov    -0x4(%rbp),%eax
  cltq
  mov    (%rax),%eax
  and    $0x85a0810c,%eax
  or     -0x8(%rbp),%eax
  mov    -0x4(%rbp),%edx
  movslq %edx,%rdx
  or     $0x80,%ah
  mov    %eax,(%rdx)
  cmpl   $0x0,-0x10(%rbp)
  je     L37
  mov    -0x4(%rbp),%eax
  add    $0xdc,%eax
  cltq
  mov    %rax,%rdx
  mov    -0x10(%rbp),%eax
  or     $0x10000,%eax
  mov    %eax,(%rdx)
  jmp    L14
L37:
  mov    -0x4(%rbp),%eax
  add    $0xdc,%eax
  cltq
  mov    (%rax),%eax
  mov    -0x4(%rbp),%edx
  add    $0xdc,%edx
  movslq %edx,%rdx
  and    $0xfffeffff,%eax
  mov    %eax,(%rdx)
L14:
  mov    -0x4(%rbp),%eax
  add    $0xc18,%eax
  cltq
  mov    %rax,%rdx
  mov    -0xc(%rbp),%eax
  mov    %eax,(%rdx)
  nop
  leave
  ret
```

assistant: ```c
void EMACConfigSet(uint32_t ui32Base, uint32_t ui32Config, uint32_t ui32ModeFlags, uint32_t ui32RxMaxFrameSize) {
  ASSERT((ui32Config & ~((0x40000000 | 0x20000000 | 0x30000000 | 0x08000000 | 0x02000000 | 0x00400000 | 0x00100000 | 0x000E0000 | 0x00010000 | 0x00004000 | 0x00002000 | 0x00001000 | 0x00000800 | 0x00000400 | 0x00000200 | 0x00000080 | 0x00000060 | 0x00000010 | 0x00000003) | 0x00000008 | 0x00000004)) == 0);
  ASSERT(!ui32RxMaxFrameSize || ((ui32RxMaxFrameSize < 0x4000) && (ui32RxMaxFrameSize > 1522)));
  (*((volatile uint32_t *)(ui32Base + 0x00000000))) = (((*((volatile uint32_t *)(ui32Base + 0x00000000))) & ~(0x40000000 | 0x20000000 | 0x30000000 | 0x08000000 | 0x02000000 | 0x00400000 | 0x00100000 | 0x000E0000 | 0x00010000 | 0x00004000 | 0x00002000 | 0x00001000 | 0x00000800 | 0x00000400 | 0x00000200 | 0x00000080 | 0x00000060 | 0x00000010 | 0x00000003)) | ui32Config | 0x00008000);
  if (ui32RxMaxFrameSize) {
    (*((volatile uint32_t *)(ui32Base + 0x000000DC))) = ui32RxMaxFrameSize | 0x00010000;
  } else {
    (*((volatile uint32_t *)(ui32Base + 0x000000DC))) &= ~0x00010000;
  }
  (*((volatile uint32_t *)(ui32Base + 0x00000C18))) = ui32ModeFlags;
}
```