user: Translate the below assembly code into C programming language:

```asm
<pci_read_configuration>:
  endbr64
  push   %r15
  lea    D26(%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    D45(%rip),%rsi
  mov    %rax,%rdx
  mov    %r13d,%ecx
  call   <sprintf@plt>
  mov    %r14,%rsi
  mov    %r12,%rdi
  call   <stat@plt>
  test   %rax,%rax
  je     L9
  mov    %r15,%rdi
  call   <options_get_string@plt>
  mov    %r12,%rdi
  mov    %ebx,%r9d
  mov    %ebp,%r8d
  lea    D58(%rip),%rsi
  mov    %rax,%rdx
  mov    %r13d,%ecx
  call   <sprintf@plt>
  mov    %r14,%rsi
  mov    %r12,%rdi
  call   <stat@plt>
  test   %rax,%rax
  jne    L78
L9:
  lea    D42(%rip),%rsi
  mov    %r12,%rdi
  call   <fopen@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L7
  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    L77
  mov    %rbp,%rdi
  call   <fclose@plt>
L17:
  mov    0x218(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L13
  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)
L77:
  lea    D23(%rip),%rdi
  xor    %eax,%eax
  xor    %r12d,%r12d
  call   <log_errno@plt>
  jmp    L17
  nopl   0x0(%rax,%rax,1)
L78:
  xor    %r12d,%r12d
  jmp    L17
  nopl   (%rax)
L7:
  mov    %r12,%rsi
  lea    D43(%rip),%rdi
  xor    %eax,%eax
  xor    %r12d,%r12d
  call   <log_errno@plt>
  jmp    L17
L13:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_label: D26
type: string
name: parse_data
arguments: data_label: D45
type: string
name: parse_data
arguments: data_label: D58
type: string
name: parse_data
arguments: data_label: D42
type: string
name: parse_data
arguments: data_label: D23
type: string
name: parse_data
arguments: data_label: D43
type: string

tool: D26: proc_pci_bus

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

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

tool: D42: r

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


tool: D43: 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;
}
```