ylfeng/ReF-Decompile-dataset huggingface dataset:
user: Translate the below assembly code into C programming language:

```asm
<utf8_len>:
  endbr64
  movzbl (%rdi),%edx
  mov    $0x1,%eax
  test   %dl,%dl
  js     L15
L0:
  ret
  nopl   0x0(%rax)
L15:
  mov    %edx,%ecx
  mov    $0x4,%eax
  and    $0xfffffff0,%ecx
  cmp    $0xf0,%cl
  je     L0
  mov    %edx,%ecx
  mov    $0x3,%eax
  and    $0xffffffe0,%ecx
  cmp    $0xe0,%cl
  je     L0
  and    $0xffffffc0,%edx
  xor    %eax,%eax
  cmp    $0xc0,%dl
  setne  %al
  lea    0x2(%rax,%rax,2),%eax
  ret
```

assistant: ```c
__attribute__((always_)) int utf8_len(char *buf, int len) {
  unsigned char *ptr;
  int ret;
  ptr = (unsigned char *)buf;
  if (((*ptr) <= 0x7F)) {
    ret = 1;
  } else if (((*ptr) & 0xF0) == 0xF0) {
    ret = 4;
  } else if (((*ptr) & 0xE0) == 0xE0) {
    ret = 3;
  } else if (((*ptr) & 0xC0) == 0xC0) {
    ret = 2;
  } else {
    ret = 5;
  }
  return ret;
}
```
user: What is the c source code of the assembly code below:

```asm
<exception_report>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %esi,-0x28(%rbp)
  mov    %edx,-0x2c(%rbp)
  mov    %ecx,-0x30(%rbp)
  movq   $0x3c000020,-0x10(%rbp)
  movq   $0x3c000000,-0x8(%rbp)
  cmpl   $0x7,-0x24(%rbp)
  ja     L36
  mov    -0x24(%rbp),%eax
  lea    0x0(,%rax,4),%rdx
  lea    D24(%rip),%rax
  mov    (%rdx,%rax,1),%eax
  cltq
  lea    D24(%rip),%rdx
  add    %rdx,%rax
  notrack jmp *%rax
  lea    D72(%rip),%rax
  mov    %rax,-0x18(%rbp)
  jmp    L90
  lea    D81(%rip),%rax
  mov    %rax,-0x18(%rbp)
  jmp    L90
  lea    D25(%rip),%rax
  mov    %rax,-0x18(%rbp)
  jmp    L90
  lea    D50(%rip),%rax
  mov    %rax,-0x18(%rbp)
  jmp    L90
  lea    D65(%rip),%rax
  mov    %rax,-0x18(%rbp)
  jmp    L90
L36:
  lea    D34(%rip),%rax
  mov    %rax,-0x18(%rbp)
L90:
  mov    -0x10(%rbp),%rax
  movl   $0xa,(%rax)
  mov    -0x10(%rbp),%rax
  movl   $0x9,(%rax)
  jmp    L20
L48:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%edx
  mov    -0x10(%rbp),%rax
  mov    %edx,(%rax)
  addq   $0x1,-0x18(%rbp)
L20:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L48
  lea    D2(%rip),%rax
  mov    %rax,-0x18(%rbp)
  jmp    L87
L88:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%edx
  mov    -0x10(%rbp),%rax
  mov    %edx,(%rax)
  addq   $0x1,-0x18(%rbp)
L87:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L88
  mov    -0x8(%rbp),%rax
  mov    -0x28(%rbp),%edx
  mov    %edx,(%rax)
  mov    -0x8(%rbp),%rax
  mov    -0x2c(%rbp),%edx
  mov    %edx,(%rax)
  mov    -0x8(%rbp),%rax
  mov    -0x30(%rbp),%edx
  mov    %edx,(%rax)
  mov    -0x10(%rbp),%rax
  movl   $0xa,(%rax)
  mov    $0x0,%eax
  call   <halt@plt>
  nop
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: tag: D72
type: string
name: disassemble_data
arguments: tag: D81
type: string
name: disassemble_data
arguments: tag: D25
type: string
name: disassemble_data
arguments: tag: D50
type: string
name: disassemble_data
arguments: tag: D65
type: string
name: disassemble_data
arguments: tag: D34
type: string
name: disassemble_data
arguments: tag: D2
type: string

tool: D72: interrupt - CAUSE.IV != 0

tool: D81: addr error load

tool: D25: addr error store

tool: D50: instr bus error

tool: D65: data bus error

tool: D34: exception

tool: D2:  (cause, epc, badAddr)


assistant: ```c
void exception_report(int code, int cause, int epc, int badVAddr) {
  int volatile *S = (int *)(0x3c000000 + 1 * 0x00000020);
  int volatile *P = (int *)0x3c000000;
  char *i;
  switch (code) {
  case 0:
    i = "interrupt - CAUSE.IV != 0";
    break;
  case 4:
    i = "addr error load";
    break;
  case 5:
    i = "addr error store";
    break;
  case 6:
    i = "instr bus error";
    break;
  case 7:
    i = "data bus error";
    break;
  default:
    i = "exception";
  }
  *S = '\n';
  *S = '\t';
  while (*i != '\0') {
    *S = *i;
    i++;
  }
  i = " (cause, epc, badAddr)\n";
  while (*i != '\0') {
    *S = *i;
    i++;
  }
  *P = cause;
  *P = epc;
  *P = badVAddr;
  *S = '\n';
  halt();
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<exception_report>:
  endbr64
  sub    $0x8,%rsp
  mov    %edx,%r8d
  cmp    $0x7,%edi
  ja     L66
  mov    %edi,%edi
  lea    D21(%rip),%rdx
  movslq (%rdx,%rdi,4),%rax
  add    %rdx,%rax
  notrack jmp *%rax
  lea    D44(%rip),%rdx
  jmp    L6
  lea    D45(%rip),%rdx
L6:
  movl   $0xa,0x3c000020
  movl   $0x9,0x3c000020
  movzbl (%rdx),%eax
L17:
  movsbl %al,%eax
  mov    %eax,0x3c000020
  add    $0x1,%rdx
  movzbl (%rdx),%eax
  test   %al,%al
  jne    L17
  lea    D75(%rip),%rdx
  mov    $0x20,%eax
L70:
  movsbl %al,%eax
  mov    %eax,0x3c000020
  add    $0x1,%rdx
  movzbl (%rdx),%eax
  test   %al,%al
  jne    L70
  mov    %esi,0x3c000000
  mov    %r8d,0x3c000000
  mov    %ecx,0x3c000000
  movl   $0xa,0x3c000020
  call   <halt@plt>
  add    $0x8,%rsp
  ret
L66:
  lea    D9(%rip),%rdx
  jmp    L6
  movl   $0xa,0x3c000020
  movl   $0x9,0x3c000020
  lea    D13(%rip),%rdx
  mov    $0x69,%eax
  jmp    L17
  lea    D23(%rip),%rdx
  jmp    L6
  lea    D24(%rip),%rdx
  jmp    L6
```

tool_calls: name: parse_data
arguments: data_label: D44
type_guessed: string
name: parse_data
arguments: data_label: D45
type_guessed: string
name: parse_data
arguments: data_label: D75
type_guessed: string
name: parse_data
arguments: data_label: D9
type_guessed: string
name: parse_data
arguments: data_label: D13
type_guessed: string
name: parse_data
arguments: data_label: D23
type_guessed: string
name: parse_data
arguments: data_label: D24
type_guessed: string

tool: D44: addr error store

tool: D45: data bus error

tool: D75:  (cause, epc, badAddr)


tool: D9: exception

tool: D13: interrupt - CAUSE.IV != 0

tool: D23: addr error load

tool: D24: instr bus error

assistant: ```c
void exception_report(int code, int cause, int epc, int badVAddr) {
  int volatile *S = (int *)(0x3c000000 + 1 * 0x00000020);
  int volatile *P = (int *)0x3c000000;
  char *i;
  switch (code) {
  case 0:
    i = "interrupt - CAUSE.IV != 0";
    break;
  case 4:
    i = "addr error load";
    break;
  case 5:
    i = "addr error store";
    break;
  case 6:
    i = "instr bus error";
    break;
  case 7:
    i = "data bus error";
    break;
  default:
    i = "exception";
  }
  *S = '\n';
  *S = '\t';
  while (*i != '\0') {
    *S = *i;
    i++;
  }
  i = " (cause, epc, badAddr)\n";
  while (*i != '\0') {
    *S = *i;
    i++;
  }
  *P = cause;
  *P = epc;
  *P = badVAddr;
  *S = '\n';
  halt();
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<exception_report>:
  endbr64
  mov    %edx,%r8d
  cmp    $0x7,%edi
  ja     L59
  lea    D40(%rip),%rdx
  mov    %edi,%edi
  movslq (%rdx,%rdi,4),%rax
  add    %rdx,%rax
  notrack jmp *%rax
  nop
L59:
  lea    D32(%rip),%rdx
L33:
  movl   $0xa,0x3c000020
  movl   $0x9,0x3c000020
  movsbl (%rdx),%eax
L54:
  add    $0x1,%rdx
  mov    %eax,0x3c000020
  movsbl (%rdx),%eax
  test   %al,%al
  jne    L54
  lea    D36(%rip),%rdx
  mov    $0x20,%eax
  xchg   %ax,%ax
L60:
  add    $0x1,%rdx
  mov    %eax,0x3c000020
  movsbl (%rdx),%eax
  test   %al,%al
  jne    L60
  mov    %esi,0x3c000000
  mov    %r8d,0x3c000000
  mov    %ecx,0x3c000000
  movl   $0xa,0x3c000020
  jmp    1050 <halt@plt>
  nopl   0x0(%rax,%rax,1)
  movl   $0xa,0x3c000020
  lea    D61(%rip),%rdx
  mov    $0x69,%eax
  movl   $0x9,0x3c000020
  jmp    L54
  nopw   0x0(%rax,%rax,1)
  lea    D66(%rip),%rdx
  jmp    L33
  nopl   0x0(%rax)
  lea    D30(%rip),%rdx
  jmp    L33
  nopl   0x0(%rax)
  lea    D63(%rip),%rdx
  jmp    L33
  nopl   0x0(%rax)
  lea    D7(%rip),%rdx
  jmp    L33
```

tool_calls: name: unpack_data
arguments: tag: D32
type_infered: string
name: unpack_data
arguments: tag: D36
type_infered: string
name: unpack_data
arguments: tag: D61
type_infered: string
name: unpack_data
arguments: tag: D66
type_infered: string
name: unpack_data
arguments: tag: D30
type_infered: string
name: unpack_data
arguments: tag: D63
type_infered: string
name: unpack_data
arguments: tag: D7
type_infered: string

tool: D32: exception

tool: D36:  (cause, epc, badAddr)


tool: D61: interrupt - CAUSE.IV != 0

tool: D66: addr error load

tool: D30: data bus error

tool: D63: instr bus error

tool: D7: addr error store

assistant: ```c
void exception_report(int code, int cause, int epc, int badVAddr) {
  int volatile *S = (int *)(0x3c000000 + 1 * 0x00000020);
  int volatile *P = (int *)0x3c000000;
  char *i;
  switch (code) {
  case 0:
    i = "interrupt - CAUSE.IV != 0";
    break;
  case 4:
    i = "addr error load";
    break;
  case 5:
    i = "addr error store";
    break;
  case 6:
    i = "instr bus error";
    break;
  case 7:
    i = "data bus error";
    break;
  default:
    i = "exception";
  }
  *S = '\n';
  *S = '\t';
  while (*i != '\0') {
    *S = *i;
    i++;
  }
  i = " (cause, epc, badAddr)\n";
  while (*i != '\0') {
    *S = *i;
    i++;
  }
  *P = cause;
  *P = epc;
  *P = badVAddr;
  *S = '\n';
  halt();
}
```
user: Translate the below assembly code into C programming language:

```asm
<exception_report>:
  endbr64
  mov    %edx,%r8d
  cmp    $0x7,%edi
  ja     L60
  lea    D13(%rip),%rdx
  mov    %edi,%edi
  movslq (%rdx,%rdi,4),%rax
  add    %rdx,%rax
  notrack jmp *%rax
  nop
L60:
  lea    D65(%rip),%rdx
L79:
  movl   $0xa,0x3c000020
  movl   $0x9,0x3c000020
  movsbl (%rdx),%eax
L12:
  add    $0x1,%rdx
  mov    %eax,0x3c000020
  movsbl (%rdx),%eax
  test   %al,%al
  jne    L12
  lea    D77(%rip),%rdx
  mov    $0x20,%eax
  xchg   %ax,%ax
L14:
  add    $0x1,%rdx
  mov    %eax,0x3c000020
  movsbl (%rdx),%eax
  test   %al,%al
  jne    L14
  mov    %esi,0x3c000000
  mov    %r8d,0x3c000000
  mov    %ecx,0x3c000000
  movl   $0xa,0x3c000020
  jmp    1050 <halt@plt>
  nopl   0x0(%rax,%rax,1)
  movl   $0xa,0x3c000020
  lea    D76(%rip),%rdx
  mov    $0x69,%eax
  movl   $0x9,0x3c000020
  jmp    L12
  nopw   0x0(%rax,%rax,1)
  lea    D45(%rip),%rdx
  jmp    L79
  nopl   0x0(%rax)
  lea    D26(%rip),%rdx
  jmp    L79
  nopl   0x0(%rax)
  lea    D43(%rip),%rdx
  jmp    L79
  nopl   0x0(%rax)
  lea    D75(%rip),%rdx
  jmp    L79
```

tool_calls: name: disassemble_data
arguments: data_tag: D65
data_type: string
name: disassemble_data
arguments: data_tag: D77
data_type: string
name: disassemble_data
arguments: data_tag: D76
data_type: string
name: disassemble_data
arguments: data_tag: D45
data_type: string
name: disassemble_data
arguments: data_tag: D26
data_type: string
name: disassemble_data
arguments: data_tag: D43
data_type: string
name: disassemble_data
arguments: data_tag: D75
data_type: string

tool: D65: exception

tool: D77:  (cause, epc, badAddr)


tool: D76: interrupt - CAUSE.IV != 0

tool: D45: addr error load

tool: D26: data bus error

tool: D43: instr bus error

tool: D75: addr error store

assistant: ```c
void exception_report(int code, int cause, int epc, int badVAddr) {
  int volatile *S = (int *)(0x3c000000 + 1 * 0x00000020);
  int volatile *P = (int *)0x3c000000;
  char *i;
  switch (code) {
  case 0:
    i = "interrupt - CAUSE.IV != 0";
    break;
  case 4:
    i = "addr error load";
    break;
  case 5:
    i = "addr error store";
    break;
  case 6:
    i = "instr bus error";
    break;
  case 7:
    i = "data bus error";
    break;
  default:
    i = "exception";
  }
  *S = '\n';
  *S = '\t';
  while (*i != '\0') {
    *S = *i;
    i++;
  }
  i = " (cause, epc, badAddr)\n";
  while (*i != '\0') {
    *S = *i;
    i++;
  }
  *P = cause;
  *P = epc;
  *P = badVAddr;
  *S = '\n';
  halt();
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<addfd>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %esi,-0x18(%rbp)
  mov    %edx,-0x1c(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x18(%rbp),%eax
  mov    %eax,-0xc(%rbp)
  mov    D11(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x10(%rbp)
  cmpl   $0x0,-0x1c(%rbp)
  je     L6
  mov    -0x10(%rbp),%edx
  mov    D26(%rip),%rax
  mov    (%rax),%eax
  or     %edx,%eax
  mov    %eax,-0x10(%rbp)
L6:
  mov    D9(%rip),%rax
  mov    (%rax),%esi
  lea    -0x10(%rbp),%rcx
  mov    -0x18(%rbp),%edx
  mov    -0x14(%rbp),%eax
  mov    %eax,%edi
  call   <epoll_ctl@plt>
  mov    -0x18(%rbp),%eax
  mov    %eax,%edi
  call   <setnonblocking@plt>
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L16
  call   <__stack_chk_fail@plt>
L16:
  leave
  ret
```

assistant: ```c
void addfd(int epollfd, int fd, int enable_et) {
  struct epoll_event event;
  event.data.fd = fd;
  event.events = EPOLLIN;
  if (enable_et)
    event.events |= EPOLLET;
  epoll_ctl(epollfd, EPOLL_CTL_ADD, fd, &event);
  setnonblocking(fd);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<addfd>:
  endbr64
  push   %rbx
  sub    $0x10,%rsp
  mov    %esi,%ebx
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    %esi,0x4(%rsp)
  mov    D24(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,(%rsp)
  test   %edx,%edx
  je     L4
  mov    D1(%rip),%rdx
  or     (%rdx),%eax
  mov    %eax,(%rsp)
L4:
  mov    %rsp,%rcx
  mov    %ebx,%edx
  mov    D22(%rip),%rax
  mov    (%rax),%esi
  call   <epoll_ctl@plt>
  mov    %ebx,%edi
  call   <setnonblocking@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L8
  add    $0x10,%rsp
  pop    %rbx
  ret
L8:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void addfd(int epollfd, int fd, int enable_et) {
  struct epoll_event event;
  event.data.fd = fd;
  event.events = EPOLLIN;
  if (enable_et)
    event.events |= EPOLLET;
  epoll_ctl(epollfd, EPOLL_CTL_ADD, fd, &event);
  setnonblocking(fd);
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<addfd>:
  endbr64
  push   %rbp
  mov    %esi,%ebp
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    D13(%rip),%rax
  mov    %esi,0x4(%rsp)
  mov    (%rax),%eax
  mov    %eax,(%rsp)
  test   %edx,%edx
  je     L7
  mov    D28(%rip),%rdx
  or     (%rdx),%eax
  mov    %eax,(%rsp)
L7:
  mov    D14(%rip),%rax
  mov    %rsp,%rcx
  mov    %ebp,%edx
  mov    (%rax),%esi
  call   <epoll_ctl@plt>
  mov    %ebp,%edi
  call   <setnonblocking@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L0
  add    $0x10,%rsp
  pop    %rbp
  ret
L0:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void addfd(int epollfd, int fd, int enable_et) {
  struct epoll_event event;
  event.data.fd = fd;
  event.events = EPOLLIN;
  if (enable_et)
    event.events |= EPOLLET;
  epoll_ctl(epollfd, EPOLL_CTL_ADD, fd, &event);
  setnonblocking(fd);
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<addfd>:
  endbr64
  push   %rbp
  movd   %esi,%xmm1
  mov    %esi,%ebp
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  mov    D20(%rip),%rax
  mov    (%rax),%eax
  movd   %eax,%xmm0
  punpckldq %xmm1,%xmm0
  movq   %xmm0,(%rsp)
  test   %edx,%edx
  je     L9
  mov    D25(%rip),%rdx
  or     (%rdx),%eax
  mov    %eax,(%rsp)
L9:
  mov    D8(%rip),%rax
  mov    %rsp,%rcx
  mov    %ebp,%edx
  mov    (%rax),%esi
  call   <epoll_ctl@plt>
  mov    %ebp,%edi
  call   <setnonblocking@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L1
  add    $0x10,%rsp
  pop    %rbp
  ret
L1:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void addfd(int epollfd, int fd, int enable_et) {
  struct epoll_event event;
  event.data.fd = fd;
  event.events = EPOLLIN;
  if (enable_et)
    event.events |= EPOLLET;
  epoll_ctl(epollfd, EPOLL_CTL_ADD, fd, &event);
  setnonblocking(fd);
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<swapstk>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  lea    D9(%rip),%rax
  mov    %rax,%rdi
  call   <debug_ol@plt>
  lea    D33(%rip),%rax
  mov    %rax,%rdi
  call   <ol@plt>
  lea    D16(%rip),%rax
  mov    %rax,%rdi
  call   <ol@plt>
  lea    D23(%rip),%rax
  mov    %rax,%rdi
  call   <ol@plt>
  nop
  pop    %rbp
  ret
```

tool_calls: name: read_data
arguments: data_label: D9
data_type: string
name: read_data
arguments: data_label: D33
data_type: string
name: read_data
arguments: data_label: D16
data_type: string
name: read_data
arguments: data_label: D23
data_type: string

tool: D9: ; swapstk

tool: D33: pulx

tool: D16: xgdx

tool: D23: pshx

assistant: ```c
swapstk() {
  debug_ol("; swapstk");
  ol("pulx");
  ol("xgdx");
  ol("pshx");
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<swapstk>:
  endbr64
  sub    $0x8,%rsp
  lea    D11(%rip),%rdi
  call   <debug_ol@plt>
  lea    D18(%rip),%rdi
  call   <ol@plt>
  lea    D10(%rip),%rdi
  call   <ol@plt>
  lea    D28(%rip),%rdi
  call   <ol@plt>
  add    $0x8,%rsp
  ret
```

tool_calls: name: read_data
arguments: data_tag: D11
type: string
name: read_data
arguments: data_tag: D18
type: string
name: read_data
arguments: data_tag: D10
type: string
name: read_data
arguments: data_tag: D28
type: string

tool: D11: ; swapstk

tool: D18: pulx

tool: D10: xgdx

tool: D28: pshx

assistant: ```c
swapstk() {
  debug_ol("; swapstk");
  ol("pulx");
  ol("xgdx");
  ol("pshx");
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<swapstk>:
  endbr64
  sub    $0x8,%rsp
  lea    D0(%rip),%rdi
  call   <debug_ol@plt>
  lea    D34(%rip),%rdi
  call   <ol@plt>
  lea    D7(%rip),%rdi
  call   <ol@plt>
  lea    D13(%rip),%rdi
  add    $0x8,%rsp
  jmp    1070 <ol@plt>
```

tool_calls: name: disassemble_data
arguments: data_label: D0
data_type: string
name: disassemble_data
arguments: data_label: D34
data_type: string
name: disassemble_data
arguments: data_label: D7
data_type: string
name: disassemble_data
arguments: data_label: D13
data_type: string

tool: D0: ; swapstk

tool: D34: pulx

tool: D7: xgdx

tool: D13: pshx

assistant: ```c
swapstk() {
  debug_ol("; swapstk");
  ol("pulx");
  ol("xgdx");
  ol("pshx");
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<swapstk>:
  endbr64
  sub    $0x8,%rsp
  lea    D30(%rip),%rdi
  call   <debug_ol@plt>
  lea    D14(%rip),%rdi
  call   <ol@plt>
  lea    D8(%rip),%rdi
  call   <ol@plt>
  lea    D35(%rip),%rdi
  add    $0x8,%rsp
  jmp    1070 <ol@plt>
```

tool_calls: name: read_data
arguments: data_tag: D30
datatype: string
name: read_data
arguments: data_tag: D14
datatype: string
name: read_data
arguments: data_tag: D8
datatype: string
name: read_data
arguments: data_tag: D35
datatype: string

tool: D30: ; swapstk

tool: D14: pulx

tool: D8: xgdx

tool: D35: pshx

assistant: ```c
swapstk() {
  debug_ol("; swapstk");
  ol("pulx");
  ol("xgdx");
  ol("pshx");
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<USBIntEnableControl>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %edi,-0x4(%rbp)
  mov    %esi,-0x8(%rbp)
  cmpl   $0x40050000,-0x4(%rbp)
  sete   %al
  movzbl %al,%eax
  mov    %eax,%edi
  call   <ASSERT@plt>
  mov    -0x8(%rbp),%eax
  and    $0xfffffc00,%eax
  test   %eax,%eax
  sete   %al
  movzbl %al,%eax
  mov    %eax,%edi
  call   <ASSERT@plt>
  mov    -0x8(%rbp),%eax
  movzbl %al,%eax
  test   %eax,%eax
  je     L19
  mov    -0x4(%rbp),%eax
  add    $0xb,%eax
  cltq
  mov    (%rax),%eax
  mov    -0x4(%rbp),%edx
  add    $0xb,%edx
  movslq %edx,%rdx
  or     -0x8(%rbp),%eax
  mov    %eax,(%rdx)
L19:
  mov    -0x8(%rbp),%eax
  and    $0x100,%eax
  test   %eax,%eax
  je     L15
  mov    -0x4(%rbp),%eax
  add    $0x408,%eax
  cltq
  movl   $0x1,(%rax)
L15:
  mov    -0x8(%rbp),%eax
  and    $0x200,%eax
  test   %eax,%eax
  je     L29
  mov    $0x40050448,%eax
  movl   $0x1,(%rax)
L29:
  nop
  leave
  ret
```

assistant: ```c
void USBIntEnableControl(uint32_t ui32Base, uint32_t ui32Flags) {
  ASSERT(ui32Base == 0x40050000);
  ASSERT((ui32Flags & (~0x000003FF)) == 0);
  if (ui32Flags & 0x000000FF) {
    (*((volatile uint8_t *)(ui32Base + 0x0000000B))) |= ui32Flags;
  }
  if (ui32Flags & 0x00000100) {
    (*((volatile uint32_t *)(ui32Base + 0x00000408))) = 0x00000001;
  }
  if (ui32Flags & 0x00000200) {
    (*((volatile uint32_t *)(0x40050000 + 0x00000448))) = 0x00000001;
  }
}
```
user: Translate the below assembly code into C programming language:

```asm
<USBIntEnableControl>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %edi,%ebp
  mov    %esi,%ebx
  cmp    $0x40050000,%edi
  sete   %dil
  movzbl %dil,%edi
  call   <ASSERT@plt>
  test   $0xfffffc00,%ebx
  sete   %dil
  movzbl %dil,%edi
  call   <ASSERT@plt>
  test   %bl,%bl
  je     L16
  lea    0xb(%rbp),%eax
  cltq
  mov    (%rax),%edx
  or     %ebx,%edx
  mov    %edx,(%rax)
L16:
  test   $0x1,%bh
  je     L19
  add    $0x408,%ebp
  movslq %ebp,%rbp
  movl   $0x1,0x0(%rbp)
L19:
  test   $0x2,%bh
  je     L17
  movl   $0x1,0x40050448
L17:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
void USBIntEnableControl(uint32_t ui32Base, uint32_t ui32Flags) {
  ASSERT(ui32Base == 0x40050000);
  ASSERT((ui32Flags & (~0x000003FF)) == 0);
  if (ui32Flags & 0x000000FF) {
    (*((volatile uint8_t *)(ui32Base + 0x0000000B))) |= ui32Flags;
  }
  if (ui32Flags & 0x00000100) {
    (*((volatile uint32_t *)(ui32Base + 0x00000408))) = 0x00000001;
  }
  if (ui32Flags & 0x00000200) {
    (*((volatile uint32_t *)(0x40050000 + 0x00000448))) = 0x00000001;
  }
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<USBIntEnableControl>:
  endbr64
  push   %rbp
  mov    %edi,%ebp
  push   %rbx
  mov    %esi,%ebx
  sub    $0x8,%rsp
  cmp    $0x40050000,%edi
  sete   %dil
  movzbl %dil,%edi
  call   <ASSERT@plt>
  xor    %edi,%edi
  test   $0xfffffc00,%ebx
  sete   %dil
  call   <ASSERT@plt>
  test   %bl,%bl
  je     L10
  lea    0xb(%rbp),%eax
  cltq
  mov    (%rax),%edx
  or     %ebx,%edx
  mov    %edx,(%rax)
L10:
  test   $0x1,%bh
  je     L26
  add    $0x408,%ebp
  movslq %ebp,%rbp
  movl   $0x1,0x0(%rbp)
L26:
  and    $0x2,%bh
  je     L0
  movl   $0x1,0x40050448
L0:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
void USBIntEnableControl(uint32_t ui32Base, uint32_t ui32Flags) {
  ASSERT(ui32Base == 0x40050000);
  ASSERT((ui32Flags & (~0x000003FF)) == 0);
  if (ui32Flags & 0x000000FF) {
    (*((volatile uint8_t *)(ui32Base + 0x0000000B))) |= ui32Flags;
  }
  if (ui32Flags & 0x00000100) {
    (*((volatile uint32_t *)(ui32Base + 0x00000408))) = 0x00000001;
  }
  if (ui32Flags & 0x00000200) {
    (*((volatile uint32_t *)(0x40050000 + 0x00000448))) = 0x00000001;
  }
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<USBIntEnableControl>:
  endbr64
  push   %rbp
  mov    %edi,%ebp
  push   %rbx
  mov    %esi,%ebx
  sub    $0x8,%rsp
  cmp    $0x40050000,%edi
  sete   %dil
  movzbl %dil,%edi
  call   <ASSERT@plt>
  xor    %edi,%edi
  test   $0xfffffc00,%ebx
  sete   %dil
  call   <ASSERT@plt>
  test   %bl,%bl
  je     L26
  lea    0xb(%rbp),%eax
  cltq
  mov    (%rax),%edx
  or     %ebx,%edx
  mov    %edx,(%rax)
L26:
  test   $0x1,%bh
  je     L20
  add    $0x408,%ebp
  movslq %ebp,%rbp
  movl   $0x1,0x0(%rbp)
L20:
  and    $0x2,%bh
  je     L0
  movl   $0x1,0x40050448
L0:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
void USBIntEnableControl(uint32_t ui32Base, uint32_t ui32Flags) {
  ASSERT(ui32Base == 0x40050000);
  ASSERT((ui32Flags & (~0x000003FF)) == 0);
  if (ui32Flags & 0x000000FF) {
    (*((volatile uint8_t *)(ui32Base + 0x0000000B))) |= ui32Flags;
  }
  if (ui32Flags & 0x00000100) {
    (*((volatile uint32_t *)(ui32Base + 0x00000408))) = 0x00000001;
  }
  if (ui32Flags & 0x00000200) {
    (*((volatile uint32_t *)(0x40050000 + 0x00000448))) = 0x00000001;
  }
}
```