ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 请从给定的汇编指令推导出C源代码:

```asm
<bfpos>:
  endbr64
  push   %r15
  mov    %rsi,%r15
  push   %r14
  mov    %rdi,%r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  call   <bfsize@plt>
  mov    %r15,%rdi
  mov    %eax,%ebx
  call   <bfsize@plt>
  sub    %eax,%ebx
  mov    %ebx,0xc(%rsp)
  js     L11
  mov    %eax,%r13d
  xor    %r12d,%r12d
  nopl   (%rax)
L37:
  lea    (%r12,%r13,1),%edx
  mov    %r12d,%esi
  mov    %r14,%rdi
  call   <bfsub@plt>
  xor    %edx,%edx
  mov    %r15,%rsi
  mov    %rax,%rdi
  mov    %rax,%rbp
  call   <bfcmp@plt>
  mov    %rbp,%rdi
  mov    %eax,%ebx
  call   <bfdel@plt>
  test   %ebx,%ebx
  je     L10
  add    $0x1,%r12d
  cmp    %r12d,0xc(%rsp)
  jge    L37
  mov    $0xffffffff,%r12d
L10:
  add    $0x18,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L11:
  mov    $0xfffffffe,%r12d
  jmp    L10
```

assistant: ```c
int bfpos(const struct bitfield *haystack, const struct bitfield *needle) {
  unsigned int heystack_size = bfsize(haystack);
  unsigned int needle_size = bfsize(needle);
  int i;
  int diff = heystack_size - needle_size;
  if (diff < 0) {
    return -2;
  }
  for (i = 0; i <= diff; i++) {
    struct bitfield *needle_candidate = bfsub(haystack, i, needle_size + i);
    unsigned int result;
    result = bfcmp(needle_candidate, needle, NULL);
    bfdel(needle_candidate);
    if (result == 0) {
      return i;
    }
  }
  return -1;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<S_layer>:
  endbr64
  mov    %rdi,%rax
  mov    (%rdi),%r11d
  mov    0x4(%rdi),%r9d
  mov    0x8(%rdi),%r10d
  mov    0xc(%rdi),%r8d
  mov    %r11d,%edi
  and    %r10d,%edi
  xor    0x10(%rax),%edi
  mov    %edi,(%rax)
  mov    %r10d,%ecx
  and    0x10(%rax),%ecx
  xor    0x18(%rax),%ecx
  mov    %ecx,0x8(%rax)
  mov    %r9d,%esi
  and    %r8d,%esi
  xor    0x14(%rax),%esi
  mov    %esi,0x4(%rax)
  mov    %r8d,%edx
  and    0x14(%rax),%edx
  xor    0x1c(%rax),%edx
  mov    %edx,0xc(%rax)
  and    %ecx,%edi
  xor    %r11d,%edi
  mov    %edi,0x10(%rax)
  and    %edi,%ecx
  xor    %r10d,%ecx
  mov    %ecx,0x18(%rax)
  and    %edx,%esi
  mov    %esi,%ecx
  xor    %r9d,%ecx
  mov    %ecx,0x14(%rax)
  and    %ecx,%edx
  xor    %r8d,%edx
  mov    %edx,0x1c(%rax)
  ret
```

assistant: ```c
void S_layer(uint8_t *data) {
  uint8_t temp[4];
  temp[0] = data[0];
  temp[1] = data[1];
  temp[2] = data[2];
  temp[3] = data[3];
  data[0] &= data[2];
  data[0] ^= data[4];
  data[2] &= data[4];
  data[2] ^= data[6];
  data[1] &= data[3];
  data[1] ^= data[5];
  data[3] &= data[5];
  data[3] ^= data[7];
  data[4] = data[0];
  data[5] = data[1];
  data[6] = data[2];
  data[7] = data[3];
  data[4] &= data[6];
  data[4] ^= temp[0];
  data[6] &= data[4];
  data[6] ^= temp[2];
  data[5] &= data[7];
  data[5] ^= temp[1];
  data[7] &= data[5];
  data[7] ^= temp[3];
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<S_layer>:
  endbr64
  mov    %rdi,%rax
  mov    (%rdi),%r11d
  mov    0x8(%rdi),%r10d
  mov    0x10(%rax),%ecx
  mov    0xc(%rdi),%r8d
  mov    0x4(%rdi),%r9d
  mov    %r11d,%edi
  mov    0x14(%rax),%edx
  and    %r10d,%edi
  and    %r10d,%ecx
  xor    0x10(%rax),%edi
  xor    0x18(%rax),%ecx
  mov    %edi,(%rax)
  and    %ecx,%edi
  mov    %r9d,%esi
  and    %r8d,%edx
  xor    %r11d,%edi
  xor    0x1c(%rax),%edx
  mov    %ecx,0x8(%rax)
  and    %r8d,%esi
  and    %edi,%ecx
  xor    0x14(%rax),%esi
  mov    %edx,0xc(%rax)
  xor    %r10d,%ecx
  mov    %esi,0x4(%rax)
  and    %edx,%esi
  mov    %ecx,0x18(%rax)
  mov    %esi,%ecx
  xor    %r9d,%ecx
  mov    %edi,0x10(%rax)
  and    %ecx,%edx
  mov    %ecx,0x14(%rax)
  xor    %r8d,%edx
  mov    %edx,0x1c(%rax)
  ret
```

assistant: ```c
void S_layer(uint8_t *data) {
  uint8_t temp[4];
  temp[0] = data[0];
  temp[1] = data[1];
  temp[2] = data[2];
  temp[3] = data[3];
  data[0] &= data[2];
  data[0] ^= data[4];
  data[2] &= data[4];
  data[2] ^= data[6];
  data[1] &= data[3];
  data[1] ^= data[5];
  data[3] &= data[5];
  data[3] ^= data[7];
  data[4] = data[0];
  data[5] = data[1];
  data[6] = data[2];
  data[7] = data[3];
  data[4] &= data[6];
  data[4] ^= temp[0];
  data[6] &= data[4];
  data[6] ^= temp[2];
  data[5] &= data[7];
  data[5] ^= temp[1];
  data[7] &= data[5];
  data[7] ^= temp[3];
}
```
user: Translate the below assembly code into C programming language:

```asm
<S_layer>:
  endbr64
  mov    0x8(%rdi),%eax
  mov    0xc(%rdi),%ecx
  mov    (%rdi),%edx
  mov    0x4(%rdi),%esi
  mov    0x18(%rdi),%r9d
  mov    0x1c(%rdi),%r8d
  and    %eax,%edx
  and    %ecx,%esi
  and    0x10(%rdi),%eax
  and    0x14(%rdi),%ecx
  xor    0x10(%rdi),%edx
  xor    0x14(%rdi),%esi
  xor    %eax,%r9d
  xor    %ecx,%r8d
  and    %r9d,%edx
  and    %r8d,%esi
  movdqu (%rdi),%xmm3
  movdqu 0x8(%rdi),%xmm2
  movdqu 0x10(%rdi),%xmm4
  movd   %edx,%xmm1
  movd   %esi,%xmm5
  movd   %eax,%xmm0
  movd   %ecx,%xmm6
  punpckldq %xmm5,%xmm1
  pand   %xmm3,%xmm2
  punpckldq %xmm6,%xmm0
  pxor   %xmm4,%xmm2
  punpcklqdq %xmm1,%xmm0
  movdqa %xmm4,%xmm1
  movups %xmm2,(%rdi)
  shufps $0x4e,%xmm3,%xmm1
  pxor   %xmm1,%xmm0
  pand   %xmm2,%xmm0
  pxor   %xmm3,%xmm0
  movups %xmm0,0x10(%rdi)
  ret
```

assistant: ```c
void S_layer(uint8_t *data) {
  uint8_t temp[4];
  temp[0] = data[0];
  temp[1] = data[1];
  temp[2] = data[2];
  temp[3] = data[3];
  data[0] &= data[2];
  data[0] ^= data[4];
  data[2] &= data[4];
  data[2] ^= data[6];
  data[1] &= data[3];
  data[1] ^= data[5];
  data[3] &= data[5];
  data[3] ^= data[7];
  data[4] = data[0];
  data[5] = data[1];
  data[6] = data[2];
  data[7] = data[3];
  data[4] &= data[6];
  data[4] ^= temp[0];
  data[6] &= data[4];
  data[6] ^= temp[2];
  data[5] &= data[7];
  data[5] ^= temp[1];
  data[7] &= data[5];
  data[7] ^= temp[3];
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<matchData>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  cmpq   $0x4,-0x20(%rbp)
  jbe    L32
  mov    -0x18(%rbp),%rcx
  lea    -0xd(%rbp),%rax
  mov    $0x5,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
  lea    -0xd(%rbp),%rax
  lea    D3(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L20
  lea    -0xd(%rbp),%rax
  lea    D5(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L32
L20:
  mov    $0x1,%eax
  jmp    L49
L32:
  mov    $0x0,%eax
L49:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L40
  call   <__stack_chk_fail@plt>
L40:
  leave
  ret
```

tool_calls: name: read_data
arguments: data_label: D3
datatype: string
name: read_data
arguments: data_label: D5
datatype: string

tool: D3: HELO

tool: D5: EHLO

assistant: ```c
int matchData(unsigned char *data, size_t length) {
  if (length > 4) {
    char buf[5];
    strncpy(buf, (char *)data, sizeof(buf));
    if (strcmp(buf, "HELO") == 0 || strcmp(buf, "EHLO") == 0)
      return 1;
  }
  return 0;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<matchData>:
  endbr64
  push   %rbx
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  cmp    $0x4,%rsi
  ja     L34
L37:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L46
  add    $0x10,%rsp
  pop    %rbx
  ret
L34:
  lea    0x3(%rsp),%rbx
  mov    $0x5,%edx
  mov    %rdi,%rsi
  mov    %rbx,%rdi
  call   <strncpy@plt>
  lea    D8(%rip),%rsi
  mov    %rbx,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L51
L54:
  mov    $0x1,%eax
  jmp    L37
L51:
  mov    %rbx,%rdi
  lea    D3(%rip),%rsi
  call   <strcmp@plt>
  mov    %rax,%rdx
  mov    $0x0,%eax
  test   %rdx,%rdx
  jne    L37
  jmp    L54
L46:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D8
datatype: string
name: extract_symbolic_data
arguments: data_label: D3
datatype: string

tool: D8: HELO

tool: D3: EHLO

assistant: ```c
int matchData(unsigned char *data, size_t length) {
  if (length > 4) {
    char buf[5];
    strncpy(buf, (char *)data, sizeof(buf));
    if (strcmp(buf, "HELO") == 0 || strcmp(buf, "EHLO") == 0)
      return 1;
  }
  return 0;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<matchData>:
  endbr64
  push   %r12
  xor    %r12d,%r12d
  push   %rbp
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  cmp    $0x4,%rsi
  ja     L4
L57:
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L44
  add    $0x18,%rsp
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  ret
  nop
L4:
  lea    0x3(%rsp),%rbp
  mov    %rdi,%rsi
  mov    $0x5,%edx
  mov    %rbp,%rdi
  call   <strncpy@plt>
  lea    D10(%rip),%rsi
  mov    %rbp,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L7
L37:
  mov    $0x1,%r12d
  jmp    L57
  nopl   0x0(%rax)
L7:
  lea    D18(%rip),%rsi
  mov    %rbp,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L57
  jmp    L37
L44:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: tag: D10
type_infered: string
name: extract_symbolic_data
arguments: tag: D18
type_infered: string

tool: D10: HELO

tool: D18: EHLO

assistant: ```c
int matchData(unsigned char *data, size_t length) {
  if (length > 4) {
    char buf[5];
    strncpy(buf, (char *)data, sizeof(buf));
    if (strcmp(buf, "HELO") == 0 || strcmp(buf, "EHLO") == 0)
      return 1;
  }
  return 0;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<matchData>:
  endbr64
  push   %r12
  xor    %r12d,%r12d
  push   %rbp
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  cmp    $0x4,%rsi
  ja     L9
L34:
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L11
  add    $0x18,%rsp
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  ret
  nop
L9:
  lea    0x3(%rsp),%rbp
  mov    %rdi,%rsi
  mov    $0x5,%edx
  mov    %rbp,%rdi
  call   <strncpy@plt>
  lea    D11(%rip),%rsi
  mov    %rbp,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L26
L27:
  mov    $0x1,%r12d
  jmp    L34
  nopl   0x0(%rax)
L26:
  lea    D12(%rip),%rsi
  mov    %rbp,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L34
  jmp    L27
L11:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: label: D11
type_infered: string
name: read_data
arguments: label: D12
type_infered: string

tool: D11: HELO

tool: D12: EHLO

assistant: ```c
int matchData(unsigned char *data, size_t length) {
  if (length > 4) {
    char buf[5];
    strncpy(buf, (char *)data, sizeof(buf));
    if (strcmp(buf, "HELO") == 0 || strcmp(buf, "EHLO") == 0)
      return 1;
  }
  return 0;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<set_pmu_sleep_clk_init>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    $0xe202,%edx
  mov    $0x17,%esi
  mov    $0x6,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x64,%edi
  call   <delay@plt>
  mov    $0xe202,%edx
  mov    $0x17,%esi
  mov    $0x6,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x64,%edi
  call   <delay@plt>
  mov    $0x2202,%edx
  mov    $0x19,%esi
  mov    $0x6,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x64,%edi
  call   <delay@plt>
  mov    $0xe204,%edx
  mov    $0x15,%esi
  mov    $0x6,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x64,%edi
  call   <delay@plt>
  mov    $0xe228,%edx
  mov    $0x18,%esi
  mov    $0x6,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x64,%edi
  call   <delay@plt>
  mov    $0x2228,%edx
  mov    $0x1a,%esi
  mov    $0x6,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x64,%edi
  call   <delay@plt>
  mov    $0xe228,%edx
  mov    $0x16,%esi
  mov    $0x6,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x64,%edi
  call   <delay@plt>
  mov    $0xab8,%edx
  mov    $0x5,%esi
  mov    $0x6,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x64,%edi
  call   <delay@plt>
  mov    $0x1,%edx
  mov    $0x36,%esi
  mov    $0x6,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x64,%edi
  call   <delay@plt>
  nop
  pop    %rbp
  ret
```

assistant: ```c
void set_pmu_sleep_clk_init() {
  mbus_remote_register_write(0x6, 0x17, ((3 << 14) | (1 << 13) | (1 << 9) | (0 << 5) | (2)));
  delay(100);
  mbus_remote_register_write(0x6, 0x17, ((3 << 14) | (1 << 13) | (1 << 9) | (0 << 5) | (2)));
  delay(100);
  mbus_remote_register_write(0x6, 0x19, ((1 << 13) | (1 << 9) | (0 << 5) | (2)));
  delay(100);
  mbus_remote_register_write(0x6, 0x15, ((0 << 19) | (0 << 18) | (0 << 17) | (3 << 14) | (1 << 13) | (1 << 9) | (0 << 5) | (4)));
  delay(100);
  mbus_remote_register_write(0x6, 0x18, ((3 << 14) | (1 << 13) | (1 << 9) | (1 << 5) | (8)));
  delay(100);
  mbus_remote_register_write(0x6, 0x1A, ((1 << 13) | (1 << 9) | (1 << 5) | (8)));
  delay(100);
  mbus_remote_register_write(0x6, 0x16, ((0 << 19) | (0 << 18) | (0 << 17) | (3 << 14) | (1 << 13) | (1 << 9) | (1 << 5) | (8)));
  delay(100);
  mbus_remote_register_write(0x6, 0x05, ((1 << 11) | (0 << 10) | (1 << 9) | (0 << 8) | (1 << 7) | (56)));
  delay(100);
  mbus_remote_register_write(0x6, 0x36, 0x000001);
  delay(100);
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<set_pmu_sleep_clk_init>:
  endbr64
  sub    $0x8,%rsp
  mov    $0xe202,%edx
  mov    $0x17,%esi
  mov    $0x6,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x64,%edi
  call   <delay@plt>
  mov    $0xe202,%edx
  mov    $0x17,%esi
  mov    $0x6,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x64,%edi
  call   <delay@plt>
  mov    $0x2202,%edx
  mov    $0x19,%esi
  mov    $0x6,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x64,%edi
  call   <delay@plt>
  mov    $0xe204,%edx
  mov    $0x15,%esi
  mov    $0x6,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x64,%edi
  call   <delay@plt>
  mov    $0xe228,%edx
  mov    $0x18,%esi
  mov    $0x6,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x64,%edi
  call   <delay@plt>
  mov    $0x2228,%edx
  mov    $0x1a,%esi
  mov    $0x6,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x64,%edi
  call   <delay@plt>
  mov    $0xe228,%edx
  mov    $0x16,%esi
  mov    $0x6,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x64,%edi
  call   <delay@plt>
  mov    $0xab8,%edx
  mov    $0x5,%esi
  mov    $0x6,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x64,%edi
  call   <delay@plt>
  mov    $0x1,%edx
  mov    $0x36,%esi
  mov    $0x6,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x64,%edi
  call   <delay@plt>
  add    $0x8,%rsp
  ret
```

assistant: ```c
void set_pmu_sleep_clk_init() {
  mbus_remote_register_write(0x6, 0x17, ((3 << 14) | (1 << 13) | (1 << 9) | (0 << 5) | (2)));
  delay(100);
  mbus_remote_register_write(0x6, 0x17, ((3 << 14) | (1 << 13) | (1 << 9) | (0 << 5) | (2)));
  delay(100);
  mbus_remote_register_write(0x6, 0x19, ((1 << 13) | (1 << 9) | (0 << 5) | (2)));
  delay(100);
  mbus_remote_register_write(0x6, 0x15, ((0 << 19) | (0 << 18) | (0 << 17) | (3 << 14) | (1 << 13) | (1 << 9) | (0 << 5) | (4)));
  delay(100);
  mbus_remote_register_write(0x6, 0x18, ((3 << 14) | (1 << 13) | (1 << 9) | (1 << 5) | (8)));
  delay(100);
  mbus_remote_register_write(0x6, 0x1A, ((1 << 13) | (1 << 9) | (1 << 5) | (8)));
  delay(100);
  mbus_remote_register_write(0x6, 0x16, ((0 << 19) | (0 << 18) | (0 << 17) | (3 << 14) | (1 << 13) | (1 << 9) | (1 << 5) | (8)));
  delay(100);
  mbus_remote_register_write(0x6, 0x05, ((1 << 11) | (0 << 10) | (1 << 9) | (0 << 8) | (1 << 7) | (56)));
  delay(100);
  mbus_remote_register_write(0x6, 0x36, 0x000001);
  delay(100);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<set_pmu_sleep_clk_init>:
  endbr64
  sub    $0x8,%rsp
  mov    $0xe202,%edx
  mov    $0x17,%esi
  mov    $0x6,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x64,%edi
  call   <delay@plt>
  mov    $0xe202,%edx
  mov    $0x17,%esi
  mov    $0x6,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x64,%edi
  call   <delay@plt>
  mov    $0x2202,%edx
  mov    $0x19,%esi
  mov    $0x6,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x64,%edi
  call   <delay@plt>
  mov    $0xe204,%edx
  mov    $0x15,%esi
  mov    $0x6,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x64,%edi
  call   <delay@plt>
  mov    $0xe228,%edx
  mov    $0x18,%esi
  mov    $0x6,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x64,%edi
  call   <delay@plt>
  mov    $0x2228,%edx
  mov    $0x1a,%esi
  mov    $0x6,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x64,%edi
  call   <delay@plt>
  mov    $0xe228,%edx
  mov    $0x16,%esi
  mov    $0x6,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x64,%edi
  call   <delay@plt>
  mov    $0xab8,%edx
  mov    $0x5,%esi
  mov    $0x6,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x64,%edi
  call   <delay@plt>
  mov    $0x6,%edi
  mov    $0x1,%edx
  mov    $0x36,%esi
  call   <mbus_remote_register_write@plt>
  mov    $0x64,%edi
  add    $0x8,%rsp
  jmp    1070 <delay@plt>
```

assistant: ```c
void set_pmu_sleep_clk_init() {
  mbus_remote_register_write(0x6, 0x17, ((3 << 14) | (1 << 13) | (1 << 9) | (0 << 5) | (2)));
  delay(100);
  mbus_remote_register_write(0x6, 0x17, ((3 << 14) | (1 << 13) | (1 << 9) | (0 << 5) | (2)));
  delay(100);
  mbus_remote_register_write(0x6, 0x19, ((1 << 13) | (1 << 9) | (0 << 5) | (2)));
  delay(100);
  mbus_remote_register_write(0x6, 0x15, ((0 << 19) | (0 << 18) | (0 << 17) | (3 << 14) | (1 << 13) | (1 << 9) | (0 << 5) | (4)));
  delay(100);
  mbus_remote_register_write(0x6, 0x18, ((3 << 14) | (1 << 13) | (1 << 9) | (1 << 5) | (8)));
  delay(100);
  mbus_remote_register_write(0x6, 0x1A, ((1 << 13) | (1 << 9) | (1 << 5) | (8)));
  delay(100);
  mbus_remote_register_write(0x6, 0x16, ((0 << 19) | (0 << 18) | (0 << 17) | (3 << 14) | (1 << 13) | (1 << 9) | (1 << 5) | (8)));
  delay(100);
  mbus_remote_register_write(0x6, 0x05, ((1 << 11) | (0 << 10) | (1 << 9) | (0 << 8) | (1 << 7) | (56)));
  delay(100);
  mbus_remote_register_write(0x6, 0x36, 0x000001);
  delay(100);
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<set_pmu_sleep_clk_init>:
  endbr64
  sub    $0x8,%rsp
  mov    $0xe202,%edx
  mov    $0x17,%esi
  mov    $0x6,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x64,%edi
  call   <delay@plt>
  mov    $0xe202,%edx
  mov    $0x17,%esi
  mov    $0x6,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x64,%edi
  call   <delay@plt>
  mov    $0x2202,%edx
  mov    $0x19,%esi
  mov    $0x6,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x64,%edi
  call   <delay@plt>
  mov    $0xe204,%edx
  mov    $0x15,%esi
  mov    $0x6,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x64,%edi
  call   <delay@plt>
  mov    $0xe228,%edx
  mov    $0x18,%esi
  mov    $0x6,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x64,%edi
  call   <delay@plt>
  mov    $0x2228,%edx
  mov    $0x1a,%esi
  mov    $0x6,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x64,%edi
  call   <delay@plt>
  mov    $0xe228,%edx
  mov    $0x16,%esi
  mov    $0x6,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x64,%edi
  call   <delay@plt>
  mov    $0xab8,%edx
  mov    $0x5,%esi
  mov    $0x6,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0x64,%edi
  call   <delay@plt>
  mov    $0x6,%edi
  mov    $0x1,%edx
  mov    $0x36,%esi
  call   <mbus_remote_register_write@plt>
  mov    $0x64,%edi
  add    $0x8,%rsp
  jmp    1070 <delay@plt>
```

assistant: ```c
void set_pmu_sleep_clk_init() {
  mbus_remote_register_write(0x6, 0x17, ((3 << 14) | (1 << 13) | (1 << 9) | (0 << 5) | (2)));
  delay(100);
  mbus_remote_register_write(0x6, 0x17, ((3 << 14) | (1 << 13) | (1 << 9) | (0 << 5) | (2)));
  delay(100);
  mbus_remote_register_write(0x6, 0x19, ((1 << 13) | (1 << 9) | (0 << 5) | (2)));
  delay(100);
  mbus_remote_register_write(0x6, 0x15, ((0 << 19) | (0 << 18) | (0 << 17) | (3 << 14) | (1 << 13) | (1 << 9) | (0 << 5) | (4)));
  delay(100);
  mbus_remote_register_write(0x6, 0x18, ((3 << 14) | (1 << 13) | (1 << 9) | (1 << 5) | (8)));
  delay(100);
  mbus_remote_register_write(0x6, 0x1A, ((1 << 13) | (1 << 9) | (1 << 5) | (8)));
  delay(100);
  mbus_remote_register_write(0x6, 0x16, ((0 << 19) | (0 << 18) | (0 << 17) | (3 << 14) | (1 << 13) | (1 << 9) | (1 << 5) | (8)));
  delay(100);
  mbus_remote_register_write(0x6, 0x05, ((1 << 11) | (0 << 10) | (1 << 9) | (0 << 8) | (1 << 7) | (56)));
  delay(100);
  mbus_remote_register_write(0x6, 0x36, 0x000001);
  delay(100);
}
```
user: What is the c source code of the assembly code below:

```asm
<firstBadVersion>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x24(%rbp)
  movq   $0x1,-0x18(%rbp)
  mov    -0x24(%rbp),%eax
  cltq
  add    $0x1,%rax
  mov    %rax,-0x10(%rbp)
  jmp    L21
L26:
  mov    -0x18(%rbp),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  sar    %rax
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <isBadVersion@plt>
  test   %rax,%rax
  je     L19
  mov    -0x8(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  jmp    L21
L19:
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,-0x18(%rbp)
L21:
  mov    -0x18(%rbp),%rax
  cmp    -0x10(%rbp),%rax
  jl     L26
  mov    -0x18(%rbp),%rax
  leave
  ret
```

assistant: ```c
int firstBadVersion(int n) {
  long long left = 1, right = n + 1LL, mid;
  while (left < right) {
    mid = (left + right) >> 1;
    if (isBadVersion(mid))
      right = mid;
    else
      left = mid + 1;
  }
  return (int)left;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<firstBadVersion>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  movslq %edi,%rbp
  add    $0x1,%rbp
  cmp    $0x1,%rbp
  jle    L20
  mov    $0x1,%r12d
  jmp    L46
L21:
  mov    %rbx,%rbp
L18:
  cmp    %rbp,%r12
  jge    L12
L46:
  lea    (%r12,%rbp,1),%rbx
  sar    %rbx
  mov    %rbx,%rdi
  call   <isBadVersion@plt>
  test   %rax,%rax
  jne    L21
  lea    0x1(%rbx),%r12
  jmp    L18
L20:
  mov    $0x1,%r12d
L12:
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
int firstBadVersion(int n) {
  long long left = 1, right = n + 1LL, mid;
  while (left < right) {
    mid = (left + right) >> 1;
    if (isBadVersion(mid))
      right = mid;
    else
      left = mid + 1;
  }
  return (int)left;
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<firstBadVersion>:
  endbr64
  push   %r12
  push   %rbp
  movslq %edi,%rbp
  add    $0x1,%rbp
  push   %rbx
  cmp    $0x1,%rbp
  jle    L39
  mov    $0x1,%r12d
  jmp    L41
  nopl   (%rax)
L13:
  lea    0x1(%rbx),%r12
  cmp    %r12,%rbp
  jle    L28
L41:
  lea    (%r12,%rbp,1),%rbx
  sar    %rbx
  mov    %rbx,%rdi
  call   <isBadVersion@plt>
  test   %rax,%rax
  je     L13
  mov    %rbx,%rbp
  cmp    %r12,%rbp
  jg     L41
L28:
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   (%rax)
L39:
  pop    %rbx
  mov    $0x1,%eax
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
int firstBadVersion(int n) {
  long long left = 1, right = n + 1LL, mid;
  while (left < right) {
    mid = (left + right) >> 1;
    if (isBadVersion(mid))
      right = mid;
    else
      left = mid + 1;
  }
  return (int)left;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<firstBadVersion>:
  endbr64
  push   %r12
  movslq %edi,%r12
  add    $0x1,%r12
  push   %rbp
  push   %rbx
  cmp    $0x1,%r12
  jle    L37
  mov    $0x1,%ebp
  nopw   0x0(%rax,%rax,1)
L32:
  lea    0x0(%rbp,%r12,1),%rbx
  sar    %rbx
  mov    %rbx,%rdi
  call   <isBadVersion@plt>
  test   %rax,%rax
  jne    L30
  lea    0x1(%rbx),%rbp
  cmp    %r12,%rbp
  jl     L32
L9:
  mov    %ebp,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   (%rax)
L30:
  cmp    %rbp,%rbx
  jle    L9
  mov    %rbx,%r12
  jmp    L32
  nopw   0x0(%rax,%rax,1)
L37:
  pop    %rbx
  mov    $0x1,%eax
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
int firstBadVersion(int n) {
  long long left = 1, right = n + 1LL, mid;
  while (left < right) {
    mid = (left + right) >> 1;
    if (isBadVersion(mid))
      right = mid;
    else
      left = mid + 1;
  }
  return (int)left;
}
```