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

```asm
<get_pkgname>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  mov    $0x200,%edi
  call   <malloc@plt>
  xor    %esi,%esi
  mov    $0x200,%edx
  mov    %rax,%rdi
  mov    %rax,%r12
  call   <memset@plt>
  test   %rbx,%rbx
  je     L31
L29:
  xor    %eax,%eax
  jmp    L48
L26:
  mov    %dl,(%r12,%rax,1)
  add    $0x1,%rax
  cmp    $0x200,%rax
  je     L35
L48:
  movzbl (%rbx,%rax,1),%edx
  lea    -0x2d(%rdx),%ecx
  cmp    $0x1,%cl
  ja     L26
L35:
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax)
L31:
  xor    %esi,%esi
  xor    %edi,%edi
  call   <getcwd@plt>
  mov    $0x2f,%esi
  mov    %rax,%rbp
  mov    %rax,%rdi
  call   <strrchr@plt>
  mov    %rbp,%rdi
  lea    0x1(%rax),%rbx
  call   <free@plt>
  jmp    L29
```

assistant: ```c
char *get_pkgname(char *pkgname) {
  int i;
  char *name = malloc(sizeof(char) * 512);
  memset(name, 0, 512);
  if (!pkgname) {
    char *cwd = getcwd(NULL, 0);
    pkgname = strrchr(cwd, '/');
    pkgname++;
    free(cwd);
  }
  for (i = 0; i < 512; ++i) {
    if (pkgname[i] == '-' || pkgname[i] == '.')
      break;
    else
      name[i] = pkgname[i];
  }
  return name;
}
```
user: Translate the below assembly code into C programming language:

```asm
<get_pkgname>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  mov    $0x200,%edi
  call   <malloc@plt>
  xor    %esi,%esi
  mov    $0x200,%edx
  mov    %rax,%rdi
  mov    %rax,%r12
  call   <memset@plt>
  test   %rbx,%rbx
  je     L29
L49:
  xor    %eax,%eax
  jmp    L14
L18:
  mov    %dl,(%r12,%rax,1)
  add    $0x1,%rax
  cmp    $0x200,%rax
  je     L34
L14:
  movzbl (%rbx,%rax,1),%edx
  lea    -0x2d(%rdx),%ecx
  cmp    $0x1,%cl
  ja     L18
L34:
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax)
L29:
  xor    %esi,%esi
  xor    %edi,%edi
  call   <getcwd@plt>
  mov    $0x2f,%esi
  mov    %rax,%rbp
  mov    %rax,%rdi
  call   <strrchr@plt>
  mov    %rbp,%rdi
  lea    0x1(%rax),%rbx
  call   <free@plt>
  jmp    L49
```

assistant: ```c
char *get_pkgname(char *pkgname) {
  int i;
  char *name = malloc(sizeof(char) * 512);
  memset(name, 0, 512);
  if (!pkgname) {
    char *cwd = getcwd(NULL, 0);
    pkgname = strrchr(cwd, '/');
    pkgname++;
    free(cwd);
  }
  for (i = 0; i < 512; ++i) {
    if (pkgname[i] == '-' || pkgname[i] == '.')
      break;
    else
      name[i] = pkgname[i];
  }
  return name;
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0xc(%rbp),%rax
  mov    %rax,%rsi
  lea    D12(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  mov    -0xc(%rbp),%eax
  mov    %eax,%esi
  lea    D9(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L9
  call   <__stack_chk_fail@plt>
L9:
  leave
  ret
```

tool_calls: name: unpack_data
arguments: label: D12
type_infered: string
name: unpack_data
arguments: label: D9
type_infered: string

tool: D12: %d

tool: D9: %d


assistant: ```c
int main() {
  int n;
  scanf("%d", &n);
  printf("%d\n", n);
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<main>:
  endbr64
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    0x4(%rsp),%rsi
  lea    D18(%rip),%rdi
  call   <scanf@plt>
  mov    0x4(%rsp),%esi
  lea    D16(%rip),%rdi
  call   <printf@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L4
  mov    $0x0,%eax
  add    $0x18,%rsp
  ret
L4:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_label: D18
type: string
name: read_data
arguments: data_label: D16
type: string

tool: D18: %d

tool: D16: %d


assistant: ```c
int main() {
  int n;
  scanf("%d", &n);
  printf("%d\n", n);
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<main>:
  endbr64
  sub    $0x18,%rsp
  lea    D18(%rip),%rdi
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    0x4(%rsp),%rsi
  call   <scanf@plt>
  mov    0x4(%rsp),%esi
  lea    D5(%rip),%rdi
  call   <printf@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L8
  xor    %eax,%eax
  add    $0x18,%rsp
  ret
L8:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_label: D18
data_type: string
name: unpack_data
arguments: data_label: D5
data_type: string

tool: D18: %d

tool: D5: %d


assistant: ```c
int main() {
  int n;
  scanf("%d", &n);
  printf("%d\n", n);
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<main>:
  endbr64
  sub    $0x18,%rsp
  lea    D17(%rip),%rdi
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    0x4(%rsp),%rsi
  call   <scanf@plt>
  mov    0x4(%rsp),%esi
  lea    D19(%rip),%rdi
  call   <printf@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L6
  xor    %eax,%eax
  add    $0x18,%rsp
  ret
L6:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_label: D17
type_guessed: string
name: disassemble_data
arguments: data_label: D19
type_guessed: string

tool: D17: %d

tool: D19: %d


assistant: ```c
int main() {
  int n;
  scanf("%d", &n);
  printf("%d\n", n);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<write_data>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %edx,-0x18(%rbp)
  movl   $0x0,-0x4(%rbp)
L42:
  mov    -0x18(%rbp),%edx
  mov    -0x20(%rbp),%rsi
  mov    -0x14(%rbp),%eax
  mov    $0x0,%ecx
  mov    %eax,%edi
  call   <send@plt>
  mov    %eax,-0x4(%rbp)
  cmpl   $0xffffffff,-0x4(%rbp)
  jne    L23
  mov    D37(%rip),%rax
  mov    (%rax),%rdx
  mov    D9(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  je     L42
L23:
  cmpl   $0x0,-0x4(%rbp)
  jns    L60
  mov    D37(%rip),%rax
  mov    (%rax),%rdx
  mov    D12(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  je     L41
  mov    D37(%rip),%rax
  mov    (%rax),%rdx
  mov    D7(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  je     L41
  mov    $0xffffffff,%eax
  jmp    L32
L41:
  mov    $0x0,%eax
  jmp    L32
L60:
  mov    -0x4(%rbp),%eax
L32:
  leave
  ret
```

assistant: ```c
int write_data(int fd, uint8_t *bytes, int len) {
  ssize_t n = 0;
  do {
    n = send(fd, bytes, len, 0);
  } while (n == -1 && errno == EINTR);
  if (n < 0) {
    if (errno != EAGAIN && errno != EWOULDBLOCK) {
      return -1;
    }
    return 0;
  } else {
    return (int)n;
  }
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<write_data>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %edi,%r12d
  mov    %rsi,%rbp
  mov    %edx,%ebx
L36:
  mov    $0x0,%ecx
  mov    %ebx,%edx
  mov    %rbp,%rsi
  mov    %r12d,%edi
  call   <send@plt>
  cmp    $0xffffffff,%eax
  jne    L6
  mov    D47(%rip),%rdx
  mov    D4(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,(%rdx)
  je     L36
L40:
  mov    D47(%rip),%rax
  mov    (%rax),%rdx
  mov    $0x0,%eax
  mov    D35(%rip),%rcx
  cmp    (%rcx),%rdx
  je     L1
  mov    D41(%rip),%rax
  cmp    %rdx,(%rax)
  setne  %al
  movzbl %al,%eax
  neg    %eax
L1:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L6:
  test   %eax,%eax
  jns    L1
  jmp    L40
```

assistant: ```c
int write_data(int fd, uint8_t *bytes, int len) {
  ssize_t n = 0;
  do {
    n = send(fd, bytes, len, 0);
  } while (n == -1 && errno == EINTR);
  if (n < 0) {
    if (errno != EAGAIN && errno != EWOULDBLOCK) {
      return -1;
    }
    return 0;
  } else {
    return (int)n;
  }
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<write_data>:
  endbr64
  push   %r12
  mov    %edi,%r12d
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    %edx,%ebx
  jmp    L25
  nopw   0x0(%rax,%rax,1)
L37:
  mov    D39(%rip),%rax
  mov    (%rax),%rdx
  mov    D44(%rip),%rax
  cmp    (%rax),%rdx
  jne    L47
L25:
  xor    %ecx,%ecx
  mov    %ebx,%edx
  mov    %rbp,%rsi
  mov    %r12d,%edi
  call   <send@plt>
  cmp    $0xffffffff,%eax
  je     L37
  test   %eax,%eax
  js     L6
L28:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L6:
  mov    D39(%rip),%rax
  mov    (%rax),%rdx
  nopl   (%rax)
L47:
  mov    D14(%rip),%rcx
  xor    %eax,%eax
  cmp    %rdx,(%rcx)
  je     L28
  mov    D19(%rip),%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  cmp    %rdx,(%rax)
  setne  %al
  movzbl %al,%eax
  neg    %eax
  ret
```

assistant: ```c
int write_data(int fd, uint8_t *bytes, int len) {
  ssize_t n = 0;
  do {
    n = send(fd, bytes, len, 0);
  } while (n == -1 && errno == EINTR);
  if (n < 0) {
    if (errno != EAGAIN && errno != EWOULDBLOCK) {
      return -1;
    }
    return 0;
  } else {
    return (int)n;
  }
}
```
user: What is the c source code of the assembly code below?

```asm
<write_data>:
  endbr64
  push   %r12
  mov    %edi,%r12d
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    %edx,%ebx
  jmp    L45
  nopw   0x0(%rax,%rax,1)
L31:
  mov    D14(%rip),%rax
  mov    (%rax),%rdx
  mov    D2(%rip),%rax
  cmp    (%rax),%rdx
  jne    L13
L45:
  xor    %ecx,%ecx
  mov    %ebx,%edx
  mov    %rbp,%rsi
  mov    %r12d,%edi
  call   <send@plt>
  cmp    $0xffffffff,%eax
  je     L31
  test   %eax,%eax
  js     L49
L33:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L49:
  mov    D14(%rip),%rax
  mov    (%rax),%rdx
  nopl   (%rax)
L13:
  mov    D48(%rip),%rcx
  xor    %eax,%eax
  cmp    %rdx,(%rcx)
  je     L33
  mov    D30(%rip),%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  cmp    %rdx,(%rax)
  setne  %al
  movzbl %al,%eax
  neg    %eax
  ret
```

assistant: ```c
int write_data(int fd, uint8_t *bytes, int len) {
  ssize_t n = 0;
  do {
    n = send(fd, bytes, len, 0);
  } while (n == -1 && errno == EINTR);
  if (n < 0) {
    if (errno != EAGAIN && errno != EWOULDBLOCK) {
      return -1;
    }
    return 0;
  } else {
    return (int)n;
  }
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<set_pmu_motion_img>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    $0xe204,%edx
  mov    $0x17,%esi
  mov    $0x8,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  call   <delay@plt>
  mov    $0xe204,%edx
  mov    $0x17,%esi
  mov    $0x8,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  call   <delay@plt>
  mov    $0xe242,%edx
  mov    $0x18,%esi
  mov    $0x8,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  call   <delay@plt>
  mov    $0x2228,%edx
  mov    $0x19,%esi
  mov    $0x8,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  call   <delay@plt>
  mov    $0x2890,%edx
  mov    $0x1a,%esi
  mov    $0x8,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  call   <delay@plt>
  mov    $0xe224,%edx
  mov    $0x15,%esi
  mov    $0x8,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  call   <delay@plt>
  mov    $0xeab6,%edx
  mov    $0x16,%esi
  mov    $0x8,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  call   <delay@plt>
  mov    $0xeae,%edx
  mov    $0x5,%esi
  mov    $0x8,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  call   <delay@plt>
  mov    $0xaae,%edx
  mov    $0x5,%esi
  mov    $0x8,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  call   <delay@plt>
  mov    $0x1,%edx
  mov    $0x36,%esi
  mov    $0x8,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  call   <delay@plt>
  mov    $0x9f4,%edx
  mov    $0x37,%esi
  mov    $0x8,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  call   <delay@plt>
  nop
  pop    %rbp
  ret
```

assistant: ```c
void set_pmu_motion_img(void) {
  mbus_remote_register_write(0x8, 0x17, ((3 << 14) | (1 << 13) | (1 << 9) | (0 << 5) | (4)));
  delay(200);
  mbus_remote_register_write(0x8, 0x17, ((3 << 14) | (1 << 13) | (1 << 9) | (0 << 5) | (4)));
  delay(200);
  mbus_remote_register_write(0x8, 0x18, ((3 << 14) | (1 << 13) | (1 << 9) | (2 << 5) | (2)));
  delay(200);
  mbus_remote_register_write(0x8, 0x19, ((1 << 13) | (1 << 9) | (1 << 5) | (8)));
  delay(200);
  mbus_remote_register_write(0x8, 0x1A, ((1 << 13) | (4 << 9) | (4 << 5) | (16)));
  delay(200);
  mbus_remote_register_write(0x8, 0x15, ((0 << 19) | (0 << 18) | (0 << 17) | (3 << 14) | (1 << 13) | (1 << 9) | (1 << 5) | (4)));
  delay(200);
  mbus_remote_register_write(0x8, 0x16, ((0 << 19) | (0 << 18) | (0 << 17) | (3 << 14) | (1 << 13) | (5 << 9) | (5 << 5) | (22)));
  delay(200);
  mbus_remote_register_write(0x8, 0x05, ((1 << 11) | (1 << 10) | (1 << 9) | (0 << 8) | (1 << 7) | (46)));
  delay(200);
  mbus_remote_register_write(0x8, 0x05, ((1 << 11) | (0 << 10) | (1 << 9) | (0 << 8) | (1 << 7) | (46)));
  delay(200);
  mbus_remote_register_write(0x8, 0x36, 0x000001);
  delay(200);
  mbus_remote_register_write(0x8, 0x37, 0x009F4);
  delay(200);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<set_pmu_motion_img>:
  endbr64
  sub    $0x8,%rsp
  mov    $0xe204,%edx
  mov    $0x17,%esi
  mov    $0x8,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  call   <delay@plt>
  mov    $0xe204,%edx
  mov    $0x17,%esi
  mov    $0x8,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  call   <delay@plt>
  mov    $0xe242,%edx
  mov    $0x18,%esi
  mov    $0x8,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  call   <delay@plt>
  mov    $0x2228,%edx
  mov    $0x19,%esi
  mov    $0x8,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  call   <delay@plt>
  mov    $0x2890,%edx
  mov    $0x1a,%esi
  mov    $0x8,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  call   <delay@plt>
  mov    $0xe224,%edx
  mov    $0x15,%esi
  mov    $0x8,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  call   <delay@plt>
  mov    $0xeab6,%edx
  mov    $0x16,%esi
  mov    $0x8,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  call   <delay@plt>
  mov    $0xeae,%edx
  mov    $0x5,%esi
  mov    $0x8,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  call   <delay@plt>
  mov    $0xaae,%edx
  mov    $0x5,%esi
  mov    $0x8,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  call   <delay@plt>
  mov    $0x1,%edx
  mov    $0x36,%esi
  mov    $0x8,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  call   <delay@plt>
  mov    $0x9f4,%edx
  mov    $0x37,%esi
  mov    $0x8,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  call   <delay@plt>
  add    $0x8,%rsp
  ret
```

assistant: ```c
void set_pmu_motion_img(void) {
  mbus_remote_register_write(0x8, 0x17, ((3 << 14) | (1 << 13) | (1 << 9) | (0 << 5) | (4)));
  delay(200);
  mbus_remote_register_write(0x8, 0x17, ((3 << 14) | (1 << 13) | (1 << 9) | (0 << 5) | (4)));
  delay(200);
  mbus_remote_register_write(0x8, 0x18, ((3 << 14) | (1 << 13) | (1 << 9) | (2 << 5) | (2)));
  delay(200);
  mbus_remote_register_write(0x8, 0x19, ((1 << 13) | (1 << 9) | (1 << 5) | (8)));
  delay(200);
  mbus_remote_register_write(0x8, 0x1A, ((1 << 13) | (4 << 9) | (4 << 5) | (16)));
  delay(200);
  mbus_remote_register_write(0x8, 0x15, ((0 << 19) | (0 << 18) | (0 << 17) | (3 << 14) | (1 << 13) | (1 << 9) | (1 << 5) | (4)));
  delay(200);
  mbus_remote_register_write(0x8, 0x16, ((0 << 19) | (0 << 18) | (0 << 17) | (3 << 14) | (1 << 13) | (5 << 9) | (5 << 5) | (22)));
  delay(200);
  mbus_remote_register_write(0x8, 0x05, ((1 << 11) | (1 << 10) | (1 << 9) | (0 << 8) | (1 << 7) | (46)));
  delay(200);
  mbus_remote_register_write(0x8, 0x05, ((1 << 11) | (0 << 10) | (1 << 9) | (0 << 8) | (1 << 7) | (46)));
  delay(200);
  mbus_remote_register_write(0x8, 0x36, 0x000001);
  delay(200);
  mbus_remote_register_write(0x8, 0x37, 0x009F4);
  delay(200);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<set_pmu_motion_img>:
  endbr64
  sub    $0x8,%rsp
  mov    $0xe204,%edx
  mov    $0x17,%esi
  mov    $0x8,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  call   <delay@plt>
  mov    $0xe204,%edx
  mov    $0x17,%esi
  mov    $0x8,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  call   <delay@plt>
  mov    $0xe242,%edx
  mov    $0x18,%esi
  mov    $0x8,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  call   <delay@plt>
  mov    $0x2228,%edx
  mov    $0x19,%esi
  mov    $0x8,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  call   <delay@plt>
  mov    $0x2890,%edx
  mov    $0x1a,%esi
  mov    $0x8,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  call   <delay@plt>
  mov    $0xe224,%edx
  mov    $0x15,%esi
  mov    $0x8,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  call   <delay@plt>
  mov    $0xeab6,%edx
  mov    $0x16,%esi
  mov    $0x8,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  call   <delay@plt>
  mov    $0xeae,%edx
  mov    $0x5,%esi
  mov    $0x8,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  call   <delay@plt>
  mov    $0xaae,%edx
  mov    $0x5,%esi
  mov    $0x8,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  call   <delay@plt>
  mov    $0x1,%edx
  mov    $0x36,%esi
  mov    $0x8,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  call   <delay@plt>
  mov    $0x8,%edi
  mov    $0x9f4,%edx
  mov    $0x37,%esi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  add    $0x8,%rsp
  jmp    1070 <delay@plt>
```

assistant: ```c
void set_pmu_motion_img(void) {
  mbus_remote_register_write(0x8, 0x17, ((3 << 14) | (1 << 13) | (1 << 9) | (0 << 5) | (4)));
  delay(200);
  mbus_remote_register_write(0x8, 0x17, ((3 << 14) | (1 << 13) | (1 << 9) | (0 << 5) | (4)));
  delay(200);
  mbus_remote_register_write(0x8, 0x18, ((3 << 14) | (1 << 13) | (1 << 9) | (2 << 5) | (2)));
  delay(200);
  mbus_remote_register_write(0x8, 0x19, ((1 << 13) | (1 << 9) | (1 << 5) | (8)));
  delay(200);
  mbus_remote_register_write(0x8, 0x1A, ((1 << 13) | (4 << 9) | (4 << 5) | (16)));
  delay(200);
  mbus_remote_register_write(0x8, 0x15, ((0 << 19) | (0 << 18) | (0 << 17) | (3 << 14) | (1 << 13) | (1 << 9) | (1 << 5) | (4)));
  delay(200);
  mbus_remote_register_write(0x8, 0x16, ((0 << 19) | (0 << 18) | (0 << 17) | (3 << 14) | (1 << 13) | (5 << 9) | (5 << 5) | (22)));
  delay(200);
  mbus_remote_register_write(0x8, 0x05, ((1 << 11) | (1 << 10) | (1 << 9) | (0 << 8) | (1 << 7) | (46)));
  delay(200);
  mbus_remote_register_write(0x8, 0x05, ((1 << 11) | (0 << 10) | (1 << 9) | (0 << 8) | (1 << 7) | (46)));
  delay(200);
  mbus_remote_register_write(0x8, 0x36, 0x000001);
  delay(200);
  mbus_remote_register_write(0x8, 0x37, 0x009F4);
  delay(200);
}
```
user: Translate the below assembly code into C programming language:

```asm
<set_pmu_motion_img>:
  endbr64
  sub    $0x8,%rsp
  mov    $0xe204,%edx
  mov    $0x17,%esi
  mov    $0x8,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  call   <delay@plt>
  mov    $0xe204,%edx
  mov    $0x17,%esi
  mov    $0x8,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  call   <delay@plt>
  mov    $0xe242,%edx
  mov    $0x18,%esi
  mov    $0x8,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  call   <delay@plt>
  mov    $0x2228,%edx
  mov    $0x19,%esi
  mov    $0x8,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  call   <delay@plt>
  mov    $0x2890,%edx
  mov    $0x1a,%esi
  mov    $0x8,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  call   <delay@plt>
  mov    $0xe224,%edx
  mov    $0x15,%esi
  mov    $0x8,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  call   <delay@plt>
  mov    $0xeab6,%edx
  mov    $0x16,%esi
  mov    $0x8,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  call   <delay@plt>
  mov    $0xeae,%edx
  mov    $0x5,%esi
  mov    $0x8,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  call   <delay@plt>
  mov    $0xaae,%edx
  mov    $0x5,%esi
  mov    $0x8,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  call   <delay@plt>
  mov    $0x1,%edx
  mov    $0x36,%esi
  mov    $0x8,%edi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  call   <delay@plt>
  mov    $0x8,%edi
  mov    $0x9f4,%edx
  mov    $0x37,%esi
  call   <mbus_remote_register_write@plt>
  mov    $0xc8,%edi
  add    $0x8,%rsp
  jmp    1070 <delay@plt>
```

assistant: ```c
void set_pmu_motion_img(void) {
  mbus_remote_register_write(0x8, 0x17, ((3 << 14) | (1 << 13) | (1 << 9) | (0 << 5) | (4)));
  delay(200);
  mbus_remote_register_write(0x8, 0x17, ((3 << 14) | (1 << 13) | (1 << 9) | (0 << 5) | (4)));
  delay(200);
  mbus_remote_register_write(0x8, 0x18, ((3 << 14) | (1 << 13) | (1 << 9) | (2 << 5) | (2)));
  delay(200);
  mbus_remote_register_write(0x8, 0x19, ((1 << 13) | (1 << 9) | (1 << 5) | (8)));
  delay(200);
  mbus_remote_register_write(0x8, 0x1A, ((1 << 13) | (4 << 9) | (4 << 5) | (16)));
  delay(200);
  mbus_remote_register_write(0x8, 0x15, ((0 << 19) | (0 << 18) | (0 << 17) | (3 << 14) | (1 << 13) | (1 << 9) | (1 << 5) | (4)));
  delay(200);
  mbus_remote_register_write(0x8, 0x16, ((0 << 19) | (0 << 18) | (0 << 17) | (3 << 14) | (1 << 13) | (5 << 9) | (5 << 5) | (22)));
  delay(200);
  mbus_remote_register_write(0x8, 0x05, ((1 << 11) | (1 << 10) | (1 << 9) | (0 << 8) | (1 << 7) | (46)));
  delay(200);
  mbus_remote_register_write(0x8, 0x05, ((1 << 11) | (0 << 10) | (1 << 9) | (0 << 8) | (1 << 7) | (46)));
  delay(200);
  mbus_remote_register_write(0x8, 0x36, 0x000001);
  delay(200);
  mbus_remote_register_write(0x8, 0x37, 0x009F4);
  delay(200);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<vflip_smatrix>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    %rcx,-0x30(%rbp)
  mov    %r8,-0x38(%rbp)
  mov    %r9,-0x40(%rbp)
  mov    -0x20(%rbp),%rax
  mov    %eax,%edx
  mov    -0x28(%rbp),%rax
  add    %edx,%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x20(%rbp),%rax
  mov    %eax,-0xc(%rbp)
  jmp    L0
L32:
  mov    -0x30(%rbp),%rax
  mov    %eax,-0x8(%rbp)
  jmp    L17
L11:
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x8(%rbp),%eax
  cltq
  add    %rax,%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x4(%rbp),%eax
  sub    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x8(%rbp),%eax
  cltq
  add    %rax,%rax
  add    %rax,%rdx
  movzwl (%rcx),%eax
  mov    %ax,(%rdx)
  addl   $0x1,-0x8(%rbp)
L17:
  mov    -0x8(%rbp),%eax
  cltq
  cmp    %rax,-0x38(%rbp)
  jge    L11
  addl   $0x1,-0xc(%rbp)
L0:
  mov    -0xc(%rbp),%eax
  cltq
  cmp    %rax,-0x28(%rbp)
  jge    L32
  nop
  nop
  pop    %rbp
  ret
```

assistant: ```c
void vflip_smatrix(short **S, long nrl, long nrh, long ncl, long nch, short **D) {
  int i, j, n = nrl + nrh;
  for (i = nrl; i <= nrh; i++) {
    for (j = ncl; j <= nch; j++) {
      D[n - i][j] = S[i][j];
    }
  }
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<vflip_smatrix>:
  endbr64
  mov    %rcx,%rax
  movslq %esi,%rcx
  cmp    %rcx,%rdx
  jl     L8
  push   %r12
  push   %rbp
  push   %rbx
  mov    %r8,%rbx
  mov    %edx,%r11d
  lea    (%rdi,%rcx,8),%rsi
  lea    0x8(%rdi,%rdx,8),%r12
  movslq %eax,%rbp
  add    %rbp,%rbp
  lea    0x2(%r8,%r8,1),%r10
  movslq %eax,%r8
L17:
  cmp    %r8,%rbx
  jl     L7
  movslq %r11d,%rax
  lea    (%r9,%rax,8),%rdi
  mov    %rbp,%rax
L28:
  mov    (%rsi),%rdx
  movzwl (%rdx,%rax,1),%ecx
  mov    (%rdi),%rdx
  mov    %cx,(%rdx,%rax,1)
  add    $0x2,%rax
  cmp    %r10,%rax
  jne    L28
L7:
  add    $0x8,%rsi
  sub    $0x1,%r11d
  cmp    %r12,%rsi
  jne    L17
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L8:
  ret
```

assistant: ```c
void vflip_smatrix(short **S, long nrl, long nrh, long ncl, long nch, short **D) {
  int i, j, n = nrl + nrh;
  for (i = nrl; i <= nrh; i++) {
    for (j = ncl; j <= nch; j++) {
      D[n - i][j] = S[i][j];
    }
  }
}
```