user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<pci_read_configuration>:
  endbr64
  push   %r15
  lea    D8(%rip),%r15
  push   %r14
  push   %r13
  mov    %edi,%r13d
  mov    %r15,%rdi
  push   %r12
  push   %rbp
  mov    %esi,%ebp
  push   %rbx
  mov    %edx,%ebx
  sub    $0x228,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x218(%rsp)
  xor    %eax,%eax
  lea    0x10(%rsp),%r12
  lea    0xc(%rsp),%r14
  call   <options_get_string@plt>
  mov    %r12,%rdi
  mov    %ebx,%r9d
  mov    %ebp,%r8d
  lea    D32(%rip),%rsi
  mov    %rax,%rdx
  mov    %r13d,%ecx
  call   <sprintf@plt>
  mov    %r14,%rsi
  mov    %r12,%rdi
  call   <stat@plt>
  test   %rax,%rax
  je     L54
  mov    %r15,%rdi
  call   <options_get_string@plt>
  mov    %r12,%rdi
  mov    %ebx,%r9d
  mov    %ebp,%r8d
  lea    D25(%rip),%rsi
  mov    %rax,%rdx
  mov    %r13d,%ecx
  call   <sprintf@plt>
  mov    %r14,%rsi
  mov    %r12,%rdi
  call   <stat@plt>
  test   %rax,%rax
  jne    L46
L54:
  lea    D11(%rip),%rsi
  mov    %r12,%rdi
  call   <fopen@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L56
  mov    0xc(%rsp),%edi
  call   <malloc@plt>
  mov    0xc(%rsp),%esi
  mov    %rbp,%rcx
  mov    $0x1,%edx
  mov    %rax,%rdi
  mov    %rax,%r12
  call   <fread@plt>
  cmp    $0x1,%eax
  jne    L30
  mov    %rbp,%rdi
  call   <fclose@plt>
L59:
  mov    0x218(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L74
  add    $0x228,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  cs nopw 0x0(%rax,%rax,1)
L30:
  lea    D51(%rip),%rdi
  xor    %eax,%eax
  xor    %r12d,%r12d
  call   <log_errno@plt>
  jmp    L59
  nopl   0x0(%rax,%rax,1)
L46:
  xor    %r12d,%r12d
  jmp    L59
  nopl   (%rax)
L56:
  mov    %r12,%rsi
  lea    D33(%rip),%rdi
  xor    %eax,%eax
  xor    %r12d,%r12d
  call   <log_errno@plt>
  jmp    L59
L74:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: label: D8
type_infered: string
name: unpack_data
arguments: label: D32
type_infered: string
name: unpack_data
arguments: label: D25
type_infered: string
name: unpack_data
arguments: label: D11
type_infered: string
name: unpack_data
arguments: label: D51
type_infered: string
name: unpack_data
arguments: label: D33
type_infered: string

tool: D8: proc_pci_bus

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

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

tool: D11: r

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


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

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;
}
```