user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<pci_read_configuration>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x228,%rsp
  mov    %edi,%ebx
  mov    %esi,%ebp
  mov    %edx,%r12d
  mov    %fs:0x28,%rax
  mov    %rax,0x218(%rsp)
  xor    %eax,%eax
  lea    D56(%rip),%rdi
  call   <options_get_string@plt>
  mov    %rax,%rdx
  lea    0x10(%rsp),%r13
  mov    %r12d,%r9d
  mov    %ebp,%r8d
  mov    %ebx,%ecx
  lea    D15(%rip),%rsi
  mov    %r13,%rdi
  call   <sprintf@plt>
  lea    0xc(%rsp),%rsi
  mov    %r13,%rdi
  call   <stat@plt>
  test   %rax,%rax
  je     L60
  lea    D56(%rip),%rdi
  call   <options_get_string@plt>
  mov    %rax,%rdx
  mov    %r12d,%r9d
  mov    %ebp,%r8d
  mov    %ebx,%ecx
  lea    D1(%rip),%rsi
  mov    %r13,%rdi
  call   <sprintf@plt>
  lea    0xc(%rsp),%rsi
  mov    %r13,%rdi
  call   <stat@plt>
  test   %rax,%rax
  jne    L34
L60:
  lea    0x10(%rsp),%rdi
  lea    D42(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L77
  mov    0xc(%rsp),%edi
  call   <malloc@plt>
  mov    %rax,%rbp
  mov    %rbx,%rcx
  mov    $0x1,%edx
  mov    0xc(%rsp),%esi
  mov    %rax,%rdi
  call   <fread@plt>
  cmp    $0x1,%eax
  jne    L37
  mov    %rbx,%rdi
  call   <fclose@plt>
L30:
  mov    0x218(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L40
  mov    %rbp,%rax
  add    $0x228,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L77:
  lea    0x10(%rsp),%rsi
  lea    D17(%rip),%rdi
  mov    $0x0,%eax
  call   <log_errno@plt>
  mov    %rbx,%rbp
  jmp    L30
L37:
  lea    D63(%rip),%rdi
  mov    $0x0,%eax
  call   <log_errno@plt>
  mov    $0x0,%ebp
  jmp    L30
L34:
  mov    $0x0,%ebp
  jmp    L30
L40:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_tag: D56
type: string
name: retrieve_data
arguments: data_tag: D15
type: string
name: retrieve_data
arguments: data_tag: D1
type: string
name: retrieve_data
arguments: data_tag: D42
type: string
name: retrieve_data
arguments: data_tag: D17
type: string
name: retrieve_data
arguments: data_tag: D63
type: string

tool: D56: proc_pci_bus

tool: D15: %s/%02x_%02x.%d

tool: D1: %s/%02x/%02x.%d

tool: D42: r

tool: D17: Unable to read PCI configuration data from %s

tool: D63: Unable to read the CPU PCI configuration data. You may not have the necessary user privileges, please retry with administrator root privileges.


assistant: ```c
void *pci_read_configuration(int bus, int device, int function) {
  struct stat st;
  char buf[512];
  sprintf(buf, "%s/%02x_%02x.%d", options_get_string("proc_pci_bus"), bus, device, function);
  if (stat(buf, &st) != 0) {
    sprintf(buf, "%s/%02x/%02x.%d", options_get_string("proc_pci_bus"), bus, device, function);
    if (stat(buf, &st) != 0) {
      return NULL;
    }
  }
  FILE *f = fopen(buf, "r");
  if (!f) {
    log_errno("Unable to read PCI configuration data from %s", buf);
    return NULL;
  }
  void *data = malloc(st.st_size);
  int n = fread(data, st.st_size, 1, f);
  if (n != 1) {
    log_errno("Unable to read the CPU PCI configuration data. You may not "
              "have the necessary user privileges, please retry with "
              "administrator root privileges.\n");
    return NULL;
  }
  fclose(f);
  return data;
}
```