ylfeng/ReF-Decompile-dataset huggingface dataset:
user: What would the C source look like for the assembly code provided here:

```asm
<fast_sqrt>:
  endbr64
  mov    $0x40000000,%edx
  cmp    $0x3fffffff,%edi
  jg     L17
  nopl   0x0(%rax)
L34:
  sar    $0x2,%edx
  cmp    %edx,%edi
  jl     L34
  test   %edx,%edx
  je     L19
L17:
  xor    %eax,%eax
  nopl   (%rax)
L43:
  lea    (%rax,%rdx,1),%ecx
  cmp    %edi,%ecx
  jg     L25
  lea    (%rax,%rdx,2),%eax
  sub    %ecx,%edi
  sar    %eax
  sar    $0x2,%edx
  jne    L43
  ret
  nopl   0x0(%rax)
L25:
  sar    %eax
  sar    $0x2,%edx
  jne    L43
  ret
  nopl   0x0(%rax,%rax,1)
L19:
  xor    %eax,%eax
  ret
```

assistant: ```c
int fast_sqrt(int x) {
  int res = 0;
  int one = 1 << 30;
  int resone;
  while (one > x)
    one >>= 2;
  while (one != 0) {
    resone = res + one;
    if (x >= resone) {
      x -= resone;
      res += one << 1;
    }
    res >>= 1;
    one >>= 2;
  }
  return res;
}
```
user: Translate the below assembly code into C programming language:

```asm
<__towctrans_l>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %edi,-0x4(%rbp)
  mov    %rsi,-0x10(%rbp)
  mov    %edx,-0x8(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  jne    L4
  mov    -0x4(%rbp),%eax
  jmp    L8
L4:
  mov    -0x10(%rbp),%rax
  mov    -0x4(%rbp),%edx
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <wctrans_table_lookup@plt>
L8:
  leave
  ret
```

assistant: ```c
wint_t __towctrans_l(wint_t wc, wctrans_t desc, __locale_t locale) {
  if (desc == (wctrans_t)0)
    return wc;
  return wctrans_table_lookup((const char *)desc, wc);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<__towctrans_l>:
  endbr64
  mov    %edi,%eax
  test   %rsi,%rsi
  jne    L2
  ret
L2:
  sub    $0x8,%rsp
  mov    %rsi,%rdi
  mov    %eax,%esi
  call   <wctrans_table_lookup@plt>
  add    $0x8,%rsp
  ret
```

assistant: ```c
wint_t __towctrans_l(wint_t wc, wctrans_t desc, __locale_t locale) {
  if (desc == (wctrans_t)0)
    return wc;
  return wctrans_table_lookup((const char *)desc, wc);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<__towctrans_l>:
  endbr64
  mov    %edi,%eax
  mov    %rsi,%rdi
  test   %rsi,%rsi
  jne    L4
  ret
  nop
L4:
  mov    %eax,%esi
  jmp    1050 <wctrans_table_lookup@plt>
```

assistant: ```c
wint_t __towctrans_l(wint_t wc, wctrans_t desc, __locale_t locale) {
  if (desc == (wctrans_t)0)
    return wc;
  return wctrans_table_lookup((const char *)desc, wc);
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<__towctrans_l>:
  endbr64
  mov    %edi,%eax
  mov    %rsi,%rdi
  test   %rsi,%rsi
  jne    L0
  ret
  nop
L0:
  mov    %eax,%esi
  jmp    1050 <wctrans_table_lookup@plt>
```

assistant: ```c
wint_t __towctrans_l(wint_t wc, wctrans_t desc, __locale_t locale) {
  if (desc == (wctrans_t)0)
    return wc;
  return wctrans_table_lookup((const char *)desc, wc);
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<page_write>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %edx,-0x28(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x24(%rbp),%eax
  shr    $0x8,%eax
  and    $0x7,%eax
  or     $0x50,%eax
  mov    %eax,-0x18(%rbp)
  movl   $0x0,-0x20(%rbp)
  jmp    L48
L31:
  mov    -0x20(%rbp),%eax
  shl    $0x3,%eax
  mov    -0x24(%rbp),%edx
  mov    %eax,%ecx
  shr    %cl,%edx
  mov    %edx,%eax
  mov    %eax,%edx
  mov    -0x20(%rbp),%eax
  mov    %dl,-0x11(%rbp,%rax,1)
  addl   $0x1,-0x20(%rbp)
L48:
  cmpl   $0x0,-0x20(%rbp)
  je     L31
  addl   $0x1,-0x28(%rbp)
  jmp    L56
L3:
  mov    -0x20(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,%edx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%edx
  mov    -0x20(%rbp),%eax
  mov    %dl,-0x11(%rbp,%rax,1)
  addl   $0x1,-0x20(%rbp)
L56:
  mov    -0x20(%rbp),%eax
  cmp    -0x28(%rbp),%eax
  jb     L3
  movl   $0x0,-0x1c(%rbp)
L67:
  mov    -0x28(%rbp),%edx
  lea    -0x11(%rbp),%rcx
  mov    -0x18(%rbp),%eax
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <at24c_iic_write_@plt>
  mov    %eax,-0x20(%rbp)
  mov    -0x1c(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x1c(%rbp)
  cmp    $0x2710,%eax
  jle    L43
  mov    $0x0,%eax
  jmp    L18
L43:
  cmpl   $0x0,-0x20(%rbp)
  je     L67
  mov    -0x20(%rbp),%eax
  sub    $0x1,%eax
L18:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L51
  call   <__stack_chk_fail@plt>
L51:
  leave
  ret
```

assistant: ```c
unsigned page_write(unsigned addr, char *buf, unsigned nbyte) {
  unsigned cnt, dev;
  char tmp[1u + 8u];
  dev = (0xau << 3) | ((addr >> (1u * 8)) & 0x7);
  for (cnt = 0; cnt < 1u; ++cnt) {
    tmp[cnt] = (char)(addr >> (cnt * 8));
  }
  for (nbyte += 1u; cnt < nbyte; ++cnt) {
    tmp[cnt] = buf[cnt - 1u];
  }
  int retry = 0;
  do {
    cnt = at24c_iic_write_(dev, tmp, nbyte);
    if (retry++ > 10000)
      return 0;
  } while (cnt < 1u);
  return (cnt - 1u);
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<page_write>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  mov    %edi,%r12d
  shr    $0x8,%r12d
  and    $0x7,%r12d
  or     $0x50,%r12d
  mov    %dil,0xf(%rsp)
  lea    0x1(%rdx),%ebp
  cmp    $0x1,%ebp
  jbe    L32
  mov    $0x1,%eax
L40:
  movzbl -0x1(%rsi,%rax,1),%edx
  mov    %dl,0xf(%rsp,%rax,1)
  add    $0x1,%rax
  cmp    %eax,%ebp
  ja     L40
L32:
  lea    0xf(%rsp),%rsi
  mov    %ebp,%edx
  mov    %r12d,%edi
  call   <at24c_iic_write_@plt>
  mov    $0x2711,%ebx
  lea    0xf(%rsp),%r13
L9:
  test   %eax,%eax
  jne    L23
  mov    %ebp,%edx
  mov    %r13,%rsi
  mov    %r12d,%edi
  call   <at24c_iic_write_@plt>
  sub    $0x1,%ebx
  jne    L9
  jmp    L19
L23:
  lea    -0x1(%rax),%ebx
L19:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L31
  mov    %ebx,%eax
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L31:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
unsigned page_write(unsigned addr, char *buf, unsigned nbyte) {
  unsigned cnt, dev;
  char tmp[1u + 8u];
  dev = (0xau << 3) | ((addr >> (1u * 8)) & 0x7);
  for (cnt = 0; cnt < 1u; ++cnt) {
    tmp[cnt] = (char)(addr >> (cnt * 8));
  }
  for (nbyte += 1u; cnt < nbyte; ++cnt) {
    tmp[cnt] = buf[cnt - 1u];
  }
  int retry = 0;
  do {
    cnt = at24c_iic_write_(dev, tmp, nbyte);
    if (retry++ > 10000)
      return 0;
  } while (cnt < 1u);
  return (cnt - 1u);
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<page_write>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  lea    0x1(%rdx),%ebp
  push   %rbx
  mov    %edi,%ebx
  shr    $0x8,%ebx
  and    $0x7,%ebx
  sub    $0x28,%rsp
  or     $0x50,%ebx
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  mov    %dil,0xf(%rsp)
  cmp    $0x1,%ebp
  jbe    L16
  lea    0x10(%rsp),%rdi
  mov    %edx,%edx
  call   <memcpy@plt>
L16:
  lea    0xf(%rsp),%r12
  mov    %ebp,%edx
  mov    %ebx,%edi
  mov    $0x2711,%r13d
  mov    %r12,%rsi
  call   <at24c_iic_write_@plt>
  jmp    L24
  nopl   0x0(%rax,%rax,1)
L13:
  mov    %ebp,%edx
  mov    %r12,%rsi
  mov    %ebx,%edi
  call   <at24c_iic_write_@plt>
  sub    $0x1,%r13d
  je     L1
L24:
  test   %eax,%eax
  je     L13
  lea    -0x1(%rax),%r13d
L1:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L5
  add    $0x28,%rsp
  mov    %r13d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L5:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
unsigned page_write(unsigned addr, char *buf, unsigned nbyte) {
  unsigned cnt, dev;
  char tmp[1u + 8u];
  dev = (0xau << 3) | ((addr >> (1u * 8)) & 0x7);
  for (cnt = 0; cnt < 1u; ++cnt) {
    tmp[cnt] = (char)(addr >> (cnt * 8));
  }
  for (nbyte += 1u; cnt < nbyte; ++cnt) {
    tmp[cnt] = buf[cnt - 1u];
  }
  int retry = 0;
  do {
    cnt = at24c_iic_write_(dev, tmp, nbyte);
    if (retry++ > 10000)
      return 0;
  } while (cnt < 1u);
  return (cnt - 1u);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<page_write>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  lea    0x1(%rdx),%ebp
  push   %rbx
  mov    %edi,%ebx
  shr    $0x8,%ebx
  and    $0x7,%ebx
  sub    $0x28,%rsp
  or     $0x50,%ebx
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  mov    %dil,0xf(%rsp)
  cmp    $0x1,%ebp
  jbe    L42
  lea    0x10(%rsp),%rdi
  mov    %edx,%edx
  call   <memcpy@plt>
L42:
  lea    0xf(%rsp),%r12
  mov    %ebp,%edx
  mov    %ebx,%edi
  mov    $0x2711,%r13d
  mov    %r12,%rsi
  call   <at24c_iic_write_@plt>
  jmp    L7
  nopl   0x0(%rax,%rax,1)
L45:
  mov    %ebp,%edx
  mov    %r12,%rsi
  mov    %ebx,%edi
  call   <at24c_iic_write_@plt>
  sub    $0x1,%r13d
  je     L26
L7:
  test   %eax,%eax
  je     L45
  lea    -0x1(%rax),%r13d
L26:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L20
  add    $0x28,%rsp
  mov    %r13d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L20:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
unsigned page_write(unsigned addr, char *buf, unsigned nbyte) {
  unsigned cnt, dev;
  char tmp[1u + 8u];
  dev = (0xau << 3) | ((addr >> (1u * 8)) & 0x7);
  for (cnt = 0; cnt < 1u; ++cnt) {
    tmp[cnt] = (char)(addr >> (cnt * 8));
  }
  for (nbyte += 1u; cnt < nbyte; ++cnt) {
    tmp[cnt] = buf[cnt - 1u];
  }
  int retry = 0;
  do {
    cnt = at24c_iic_write_(dev, tmp, nbyte);
    if (retry++ > 10000)
      return 0;
  } while (cnt < 1u);
  return (cnt - 1u);
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    $0x0,%eax
  call   <RunTests@plt>
  mov    $0x0,%eax
  pop    %rbp
  ret
```

assistant: ```c
int main(void) {
  RunTests();
  return 0;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x0,%eax
  call   <RunTests@plt>
  mov    $0x0,%eax
  add    $0x8,%rsp
  ret
```

assistant: ```c
int main(void) {
  RunTests();
  return 0;
}
```
user: Translate the below assembly code into C programming language:

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  xor    %eax,%eax
  call   <RunTests@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  ret
```

assistant: ```c
int main(void) {
  RunTests();
  return 0;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  xor    %eax,%eax
  call   <RunTests@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  ret
```

assistant: ```c
int main(void) {
  RunTests();
  return 0;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<f2>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  movl   $0x0,-0x4(%rbp)
  jmp    L0
L13:
  mov    -0x4(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rax,%rdx
  mov    -0x4(%rbp),%eax
  mov    %eax,(%rdx)
  addl   $0x1,-0x4(%rbp)
L0:
  cmpl   $0x63,-0x4(%rbp)
  jle    L13
  nop
  nop
  pop    %rbp
  ret
```

assistant: ```c
void f2(int *x) {
  int i;
#pragma omp parallel for simd ordered
  for (i = 0; i < 100; i++)
#pragma omp ordered threads simd
    x[i / 2] = i;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<f2>:
  endbr64
  mov    $0x0,%edx
L6:
  mov    %edx,%eax
  shr    $0x1f,%eax
  add    %edx,%eax
  sar    %eax
  cltq
  mov    %edx,(%rdi,%rax,4)
  add    $0x1,%edx
  cmp    $0x64,%edx
  jne    L6
  ret
```

assistant: ```c
void f2(int *x) {
  int i;
#pragma omp parallel for simd ordered
  for (i = 0; i < 100; i++)
#pragma omp ordered threads simd
    x[i / 2] = i;
}
```
user: Translate the below assembly code into C programming language:

```asm
<f2>:
  endbr64
  xor    %eax,%eax
  cs nopw 0x0(%rax,%rax,1)
L5:
  mov    %eax,%edx
  sar    %edx
  movslq %edx,%rdx
  mov    %eax,(%rdi,%rdx,4)
  add    $0x1,%eax
  cmp    $0x64,%eax
  jne    L5
  ret
```

assistant: ```c
void f2(int *x) {
  int i;
#pragma omp parallel for simd ordered
  for (i = 0; i < 100; i++)
#pragma omp ordered threads simd
    x[i / 2] = i;
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<f2>:
  endbr64
  xor    %eax,%eax
  cs nopw 0x0(%rax,%rax,1)
L7:
  mov    %eax,%edx
  sar    %edx
  movslq %edx,%rdx
  mov    %eax,(%rdi,%rdx,4)
  add    $0x1,%eax
  cmp    $0x64,%eax
  jne    L7
  ret
```

assistant: ```c
void f2(int *x) {
  int i;
#pragma omp parallel for simd ordered
  for (i = 0; i < 100; i++)
#pragma omp ordered threads simd
    x[i / 2] = i;
}
```
user: Translate the below assembly code into C programming language:

```asm
<right_rotate>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    %esi,-0xc(%rbp)
  mov    %edx,-0x10(%rbp)
  mov    -0x10(%rbp),%eax
  sub    -0xc(%rbp),%eax
  mov    %eax,%edx
  mov    -0x8(%rbp),%rax
  mov    $0x1,%esi
  mov    %rax,%rdi
  call   <reverse@plt>
  mov    -0x10(%rbp),%eax
  sub    -0xc(%rbp),%eax
  lea    0x1(%rax),%ecx
  mov    -0x10(%rbp),%edx
  mov    -0x8(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <reverse@plt>
  mov    -0x10(%rbp),%edx
  mov    -0x8(%rbp),%rax
  mov    $0x1,%esi
  mov    %rax,%rdi
  call   <reverse@plt>
  nop
  leave
  ret
```

assistant: ```c
void right_rotate(int *a, int num, int n) {
  reverse(a, 1, n - num);
  reverse(a, n - num + 1, n);
  reverse(a, 1, n);
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<right_rotate>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  mov    %edx,%ebp
  mov    %edx,%r12d
  sub    %esi,%r12d
  mov    %r12d,%edx
  mov    $0x1,%esi
  call   <reverse@plt>
  lea    0x1(%r12),%esi
  mov    %ebp,%edx
  mov    %rbx,%rdi
  call   <reverse@plt>
  mov    %ebp,%edx
  mov    $0x1,%esi
  mov    %rbx,%rdi
  call   <reverse@plt>
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
void right_rotate(int *a, int num, int n) {
  reverse(a, 1, n - num);
  reverse(a, n - num + 1, n);
  reverse(a, 1, n);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<right_rotate>:
  endbr64
  push   %r12
  mov    %edx,%r12d
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %edx,%ebx
  sub    %esi,%ebx
  mov    $0x1,%esi
  mov    %ebx,%edx
  call   <reverse@plt>
  lea    0x1(%rbx),%esi
  mov    %r12d,%edx
  mov    %rbp,%rdi
  call   <reverse@plt>
  pop    %rbx
  mov    %r12d,%edx
  mov    %rbp,%rdi
  mov    $0x1,%esi
  pop    %rbp
  pop    %r12
  jmp    1050 <reverse@plt>
```

assistant: ```c
void right_rotate(int *a, int num, int n) {
  reverse(a, 1, n - num);
  reverse(a, n - num + 1, n);
  reverse(a, 1, n);
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<right_rotate>:
  endbr64
  push   %r12
  mov    %edx,%r12d
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %edx,%ebx
  sub    %esi,%ebx
  mov    $0x1,%esi
  mov    %ebx,%edx
  call   <reverse@plt>
  lea    0x1(%rbx),%esi
  mov    %r12d,%edx
  mov    %rbp,%rdi
  call   <reverse@plt>
  pop    %rbx
  mov    %r12d,%edx
  mov    %rbp,%rdi
  mov    $0x1,%esi
  pop    %rbp
  pop    %r12
  jmp    1050 <reverse@plt>
```

assistant: ```c
void right_rotate(int *a, int num, int n) {
  reverse(a, 1, n - num);
  reverse(a, n - num + 1, n);
  reverse(a, 1, n);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<EEPROMBlockLock>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %edi,-0x4(%rbp)
  mov    $0x400af000,%eax
  mov    (%rax),%eax
  sar    $0x10,%eax
  and    $0x7ff,%eax
  cmp    %eax,-0x4(%rbp)
  setl   %al
  movzbl %al,%eax
  mov    %eax,%edi
  call   <ASSERT@plt>
  mov    $0x400af004,%edx
  mov    -0x4(%rbp),%eax
  mov    %eax,(%rdx)
  mov    $0x400af020,%eax
  movl   $0xffffffff,(%rax)
  mov    $0x400af020,%eax
  mov    (%rax),%eax
  leave
  ret
```

assistant: ```c
uint32_t EEPROMBlockLock(uint32_t ui32Block) {
  ASSERT(ui32Block < ((((*((volatile uint32_t *)(0x400AF000)))) & 0x07FF0000) >> 16));
  (*((volatile uint32_t *)(0x400AF004))) = ui32Block;
  (*((volatile uint32_t *)(0x400AF020))) = 0xFFFFFFFF;
  return ((*((volatile uint32_t *)(0x400AF020))));
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<EEPROMBlockLock>:
  endbr64
  push   %rbx
  mov    %edi,%ebx
  mov    0x400af000,%eax
  sar    $0x10,%eax
  and    $0x7ff,%eax
  cmp    %edi,%eax
  setg   %dil
  movzbl %dil,%edi
  call   <ASSERT@plt>
  mov    %ebx,0x400af004
  movl   $0xffffffff,0x400af020
  mov    0x400af020,%eax
  pop    %rbx
  ret
```

assistant: ```c
uint32_t EEPROMBlockLock(uint32_t ui32Block) {
  ASSERT(ui32Block < ((((*((volatile uint32_t *)(0x400AF000)))) & 0x07FF0000) >> 16));
  (*((volatile uint32_t *)(0x400AF004))) = ui32Block;
  (*((volatile uint32_t *)(0x400AF020))) = 0xFFFFFFFF;
  return ((*((volatile uint32_t *)(0x400AF020))));
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<EEPROMBlockLock>:
  endbr64
  push   %rbx
  mov    0x400af000,%eax
  mov    %edi,%ebx
  xor    %edi,%edi
  sar    $0x10,%eax
  and    $0x7ff,%eax
  cmp    %ebx,%eax
  setg   %dil
  call   <ASSERT@plt>
  mov    %ebx,0x400af004
  movl   $0xffffffff,0x400af020
  pop    %rbx
  mov    0x400af020,%eax
  ret
```

assistant: ```c
uint32_t EEPROMBlockLock(uint32_t ui32Block) {
  ASSERT(ui32Block < ((((*((volatile uint32_t *)(0x400AF000)))) & 0x07FF0000) >> 16));
  (*((volatile uint32_t *)(0x400AF004))) = ui32Block;
  (*((volatile uint32_t *)(0x400AF020))) = 0xFFFFFFFF;
  return ((*((volatile uint32_t *)(0x400AF020))));
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<EEPROMBlockLock>:
  endbr64
  push   %rbx
  mov    0x400af000,%eax
  mov    %edi,%ebx
  xor    %edi,%edi
  sar    $0x10,%eax
  and    $0x7ff,%eax
  cmp    %ebx,%eax
  setg   %dil
  call   <ASSERT@plt>
  mov    %ebx,0x400af004
  movl   $0xffffffff,0x400af020
  pop    %rbx
  mov    0x400af020,%eax
  ret
```

assistant: ```c
uint32_t EEPROMBlockLock(uint32_t ui32Block) {
  ASSERT(ui32Block < ((((*((volatile uint32_t *)(0x400AF000)))) & 0x07FF0000) >> 16));
  (*((volatile uint32_t *)(0x400AF004))) = ui32Block;
  (*((volatile uint32_t *)(0x400AF020))) = 0xFFFFFFFF;
  return ((*((volatile uint32_t *)(0x400AF020))));
}
```
user: Translate the below assembly code into C programming language:

```asm
<strnicmp>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %edx,-0x24(%rbp)
  cmpl   $0x0,-0x24(%rbp)
  jne    L136
  mov    $0x0,%eax
  jmp    L112
L136:
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  movzbl (%rax),%eax
  mov    %al,-0x2(%rbp)
  movsbl -0x2(%rbp),%eax
  mov    %eax,%edi
  call   <islower@plt>
  test   %eax,%eax
  je     L17
  movsbl -0x2(%rbp),%eax
  mov    %eax,%edi
  call   <toupper@plt>
  mov    %al,-0x2(%rbp)
L17:
  mov    -0x20(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x20(%rbp)
  movzbl (%rax),%eax
  mov    %al,-0x1(%rbp)
  movsbl -0x1(%rbp),%eax
  mov    %eax,%edi
  call   <islower@plt>
  test   %eax,%eax
  je     L13
  movsbl -0x1(%rbp),%eax
  mov    %eax,%edi
  call   <toupper@plt>
  mov    %al,-0x1(%rbp)
L13:
  movzbl -0x2(%rbp),%eax
  cmp    -0x1(%rbp),%al
  jne    L113
  cmpb   $0x0,-0x2(%rbp)
  je     L113
  cmpb   $0x0,-0x1(%rbp)
  je     L113
  subl   $0x1,-0x24(%rbp)
  cmpl   $0x0,-0x24(%rbp)
  jg     L136
L113:
  cmpl   $0x0,-0x24(%rbp)
  je     L44
  movzbl -0x2(%rbp),%eax
  cmp    -0x1(%rbp),%al
  jne    L21
L44:
  mov    $0x0,%eax
  jmp    L112
L21:
  cmpb   $0x0,-0x2(%rbp)
  je     L33
  movzbl -0x2(%rbp),%eax
  cmp    -0x1(%rbp),%al
  jge    L38
L33:
  mov    $0x1,%eax
  jmp    L112
L38:
  mov    $0xffffffff,%eax
L112:
  leave
  ret
```

assistant: ```c
int strnicmp(s1, s2, n)
char *s1;
char *s2;
int n;
{
  char c1, c2;
  if (n == 0)
    return 0;
  do {
    c1 = *s1++;
    if (islower(c1))
      c1 = toupper(c1);
    c2 = *s2++;
    if (islower(c2))
      c2 = toupper(c2);
  } while (c1 == c2 && c1 && c2 && --n > 0);
  if (n == 0 || c1 == c2)
    return 0;
  if (c1 == '\0' || c1 < c2)
    return 1;
  return -1;
}
```
user: Translate the below assembly code into C programming language:

```asm
<strnicmp>:
  endbr64
  mov    %edx,%eax
  test   %edx,%edx
  je     L22
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%r14
  mov    %edx,%r12d
  mov    %rsi,%r13
  jmp    L34
L88:
  mov    %r15d,%edi
  call   <toupper@plt>
  mov    %eax,%ebp
L36:
  cmp    %bpl,%bl
  sete   %al
  test   %bpl,%bpl
  setne  %dl
  test   %al,%dl
  je     L116
  test   %bl,%bl
  je     L116
  sub    $0x1,%r12d
  add    $0x1,%r13
  test   %r12d,%r12d
  jle    L5
L34:
  add    $0x1,%r14
  movzbl -0x1(%r14),%ebx
  movsbl %bl,%ebp
  mov    %ebp,%edi
  call   <islower@plt>
  test   %eax,%eax
  je     L65
  mov    %ebp,%edi
  call   <toupper@plt>
  mov    %eax,%ebx
L65:
  movzbl 0x0(%r13),%ebp
  movsbl %bpl,%r15d
  mov    %r15d,%edi
  call   <islower@plt>
  test   %eax,%eax
  je     L36
  jmp    L88
L5:
  mov    $0x0,%eax
  jmp    L47
L116:
  test   %r12d,%r12d
  je     L58
  test   %al,%al
  jne    L58
  test   %bl,%bl
  je     L64
  mov    $0xffffffff,%eax
  cmp    %bpl,%bl
  jl     L64
L47:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L64:
  mov    $0x1,%eax
  jmp    L47
L58:
  mov    $0x0,%eax
  jmp    L47
L22:
  ret
```

assistant: ```c
int strnicmp(s1, s2, n)
char *s1;
char *s2;
int n;
{
  char c1, c2;
  if (n == 0)
    return 0;
  do {
    c1 = *s1++;
    if (islower(c1))
      c1 = toupper(c1);
    c2 = *s2++;
    if (islower(c2))
      c2 = toupper(c2);
  } while (c1 == c2 && c1 && c2 && --n > 0);
  if (n == 0 || c1 == c2)
    return 0;
  if (c1 == '\0' || c1 < c2)
    return 1;
  return -1;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<strnicmp>:
  endbr64
  push   %r15
  xor    %eax,%eax
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rsi,0x8(%rsp)
  test   %edx,%edx
  je     L73
  mov    %rdi,%r13
  mov    %edx,%r14d
  mov    %rsi,%r12
  jmp    L64
  nopl   0x0(%rax,%rax,1)
L88:
  test   %bl,%bl
  je     L65
  mov    0x8(%rsp),%eax
  sub    %r12d,%eax
  add    %r14d,%eax
  test   %eax,%eax
  jle    L20
L64:
  movsbl 0x0(%r13),%ebp
  add    $0x1,%r13
  mov    %ebp,%edi
  mov    %ebp,%ebx
  call   <islower@plt>
  test   %eax,%eax
  je     L94
  mov    %ebp,%edi
  call   <toupper@plt>
  mov    %eax,%ebx
L94:
  movsbl (%r12),%r15d
  add    $0x1,%r12
  mov    %r15d,%edi
  mov    %r15d,%ebp
  call   <islower@plt>
  test   %eax,%eax
  je     L54
  mov    %r15d,%edi
  call   <toupper@plt>
  mov    %eax,%ebp
L54:
  cmp    %bpl,%bl
  je     L88
L18:
  test   %bl,%bl
  je     L84
  mov    $0xffffffff,%eax
  cmp    %bpl,%bl
  jl     L84
L73:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L65:
  cmp    %bpl,%bl
  jne    L18
L20:
  add    $0x18,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  xchg   %ax,%ax
L84:
  add    $0x18,%rsp
  mov    $0x1,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
int strnicmp(s1, s2, n)
char *s1;
char *s2;
int n;
{
  char c1, c2;
  if (n == 0)
    return 0;
  do {
    c1 = *s1++;
    if (islower(c1))
      c1 = toupper(c1);
    c2 = *s2++;
    if (islower(c2))
      c2 = toupper(c2);
  } while (c1 == c2 && c1 && c2 && --n > 0);
  if (n == 0 || c1 == c2)
    return 0;
  if (c1 == '\0' || c1 < c2)
    return 1;
  return -1;
}
```