user: 请从给定的汇编指令推导出C源代码：

```asm
<fill_var>:
  endbr64
  push   %r15
  push   %r14
  mov    %rcx,%r14
  mov    $0x40,%ecx
  push   %r13
  xor    %r13d,%r13d
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  xor    %ebx,%ebx
  sub    $0x498,%rsp
  mov    %edi,0xc(%rsp)
  lea    0x280(%rsp),%rdi
  mov    %fs:0x28,%rax
  mov    %rax,0x488(%rsp)
  xor    %eax,%eax
  mov    %rdi,(%rsp)
  rep stos %rax,%es:(%rdi)
  movb   $0x0,(%rdi)
  jmp    L98
  nopl   0x0(%rax,%rax,1)
L4:
  movslq %r13d,%rdx
  add    $0x1,%r13d
  mov    %al,0x280(%rsp,%rdx,1)
L69:
  add    $0x1,%ebx
L98:
  mov    %rbp,%rdi
  call   <strlen@plt>
  cmp    %ebx,%eax
  jl     L187
  movslq %ebx,%r15
  movzbl 0x0(%rbp,%r15,1),%eax
  cmp    $0x3c,%al
  jne    L4
  lea    0x1(%rbx),%eax
  movslq %eax,%rdx
  movzbl 0x0(%rbp,%rdx,1),%edx
  cmp    $0x25,%dl
  je     L176
  movslq %r13d,%rcx
  mov    %eax,%ebx
  movb   $0x3c,0x280(%rsp,%rcx,1)
  lea    0x1(%r13),%ecx
  add    $0x2,%r13d
  movslq %ecx,%rcx
  mov    %dl,0x280(%rsp,%rcx,1)
  jmp    L69
  nopw   0x0(%rax,%rax,1)
L176:
  lea    0x2(%rbx),%ecx
  movslq %ecx,%rax
  mov    %ecx,0x8(%rsp)
  movzbl 0x0(%rbp,%rax,1),%edx
  cmp    $0x24,%dl
  je     L47
  movslq %r13d,%rax
  mov    %ecx,%ebx
  movb   $0x3c,0x280(%rsp,%rax,1)
  lea    0x1(%r13),%eax
  cltq
  movb   $0x25,0x280(%rsp,%rax,1)
  lea    0x2(%r13),%eax
  add    $0x3,%r13d
  cltq
  mov    %dl,0x280(%rsp,%rax,1)
  jmp    L69
L187:
  mov    (%rsp),%rsi
  mov    %rbp,%rdi
  call   <strcpy@plt>
  mov    0x488(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L175
  add    $0x498,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L47:
  mov    0xc(%rsp),%ecx
  test   %ecx,%ecx
  je     L212
  lea    0x3(%rbx),%eax
  cltq
  movzbl 0x0(%rbp,%rax,1),%edx
  cmp    $0x25,%dl
  je     L119
L24:
  lea    0xe0(%rsp),%r13
  mov    $0xfffffffe,%esi
  mov    %r13,%rdi
  sub    %ebx,%esi
  sub    %r15,%rdi
  xchg   %ax,%ax
L244:
  mov    %dl,-0x3(%rdi,%rax,1)
  mov    %eax,%r8d
  lea    (%rsi,%rax,1),%ecx
  add    $0x1,%rax
  movzbl 0x0(%rbp,%rax,1),%edx
  cmp    $0x25,%dl
  jne    L244
  mov    0xc(%rsp),%edx
  movslq %ecx,%rbx
  mov    %r8d,0x8(%rsp)
  lea    0x1(%rcx),%r15d
  movb   $0x0,0xe0(%rsp,%rbx,1)
  test   %edx,%edx
  je     L139
L16:
  movslq %r15d,%r15
  mov    %r14,%rdi
  movb   $0x3d,0xe0(%rsp,%rbx,1)
  lea    0x10(%rsp),%rbx
  movb   $0x0,0xe0(%rsp,%r15,1)
  lea    0x1b0(%rsp),%r15
  call   <rewind@plt>
  jmp    L111
  nopl   0x0(%rax,%rax,1)
L209:
  mov    %r14,%rdi
  call   <feof@plt>
  cmp    $0x1,%eax
  je     L138
L111:
  mov    $0xc8,%esi
  mov    %rbx,%rdi
  mov    %r14,%rdx
  call   <fgets@plt>
  mov    %r13,%rsi
  mov    %rbx,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L209
  mov    %rbx,%rdi
  mov    %r15,%rsi
  call   <getentry@plt>
  mov    %r14,%rdi
  call   <feof@plt>
  cmp    $0x1,%eax
  jne    L111
L138:
  mov    %r12,%rdi
  call   <rewind@plt>
  jmp    L168
  nopw   0x0(%rax,%rax,1)
L250:
  mov    %r12,%rdi
  call   <feof@plt>
  cmp    $0x1,%eax
  je     L199
L168:
  mov    $0xc8,%esi
  mov    %rbx,%rdi
  mov    %r12,%rdx
  call   <fgets@plt>
  mov    %r13,%rsi
  mov    %rbx,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L250
  mov    %rbx,%rdi
  mov    %r15,%rsi
  call   <getentry@plt>
  mov    %r12,%rdi
  call   <feof@plt>
  cmp    $0x1,%eax
  jne    L168
L199:
  mov    0xc(%rsp),%eax
  mov    %r15,%rsi
  test   %eax,%eax
  je     L132
  mov    (%rsp),%rdi
  call   <strcat@plt>
L129:
  mov    (%rsp),%rdi
  call   <strlen@plt>
  mov    0x8(%rsp),%ebx
  mov    %eax,%r13d
  add    $0x2,%ebx
  jmp    L69
L212:
  lea    D58(%rip),%rdi
  call   <puts@plt>
  lea    0x3(%rbx),%eax
  cltq
  movzbl 0x0(%rbp,%rax,1),%edx
  cmp    $0x25,%dl
  jne    L24
  movb   $0x0,0xe0(%rsp)
  mov    $0x1,%r15d
  lea    0xe0(%rsp),%r13
  xor    %ebx,%ebx
L139:
  mov    %r13,%rsi
  lea    D5(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  lea    D45(%rip),%rdi
  call   <puts@plt>
  jmp    L16
L132:
  lea    D41(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  lea    D50(%rip),%rdi
  call   <puts@plt>
  mov    (%rsp),%rbx
  mov    %r15,%rsi
  mov    %rbx,%rdi
  call   <strcat@plt>
  mov    %rbx,%rsi
  lea    D1(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L129
L119:
  movb   $0x0,0xe0(%rsp)
  mov    $0x1,%r15d
  lea    0xe0(%rsp),%r13
  xor    %ebx,%ebx
  jmp    L16
L175:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_label: D58
type_guessed: string
name: read_data
arguments: data_label: D5
type_guessed: string
name: read_data
arguments: data_label: D45
type_guessed: string
name: read_data
arguments: data_label: D41
type_guessed: string
name: read_data
arguments: data_label: D50
type_guessed: string
name: read_data
arguments: data_label: D1
type_guessed: string

tool: D58: found fact ... looking for factname

tool: D5: found factname: %s


tool: D45: looking for factvalue

tool: D41: found factvalue: %s


tool: D50: adding fact to buffer

tool: D1: current buffer: %s


assistant: ```c
void fill_var(int debug, char buffer[512], FILE *fact, FILE *commonfact) {
  int i, n, count;
  char tmpbuffer[512];
  char allfacts[200];
  char factname[200];
  char factvalue[200];
  int counter;
  for (i = 0; i <= 512; i++)
    tmpbuffer[i] = 0;
  for (i = 0, n = 0; i <= strlen(buffer); i++, n++) {
    if (buffer[i] != '<') {
      tmpbuffer[n] = buffer[i];
      continue;
    }
    if (buffer[++i] != '%') {
      tmpbuffer[n++] = '<';
      tmpbuffer[n] = buffer[i];
      continue;
    }
    if (buffer[++i] != '$') {
      tmpbuffer[n++] = '<';
      tmpbuffer[n++] = '%';
      tmpbuffer[n] = buffer[i];
      continue;
    }
    if (debug == 0)
      printf("found fact ... looking for factname\n");
    for (counter = 0; buffer[++i] != '%'; counter++) {
      factname[counter] = buffer[i];
    }
    factname[counter] = '\0';
    if (debug == 0) {
      printf("found factname: %s\n", factname);
      printf("looking for factvalue\n");
    }
    factname[counter++] = '=';
    factname[counter] = '\0';
    rewind(commonfact);
    do {
      fgets(allfacts, 200, commonfact);
      if (strstr(allfacts, factname) != 0)
        getentry(allfacts, factvalue);
    } while (feof(commonfact) != 1);
    rewind(fact);
    do {
      fgets(allfacts, 200, fact);
      if (strstr(allfacts, factname) != 0) {
        getentry(allfacts, factvalue);
      }
    } while (feof(fact) != 1);
    if (debug == 0) {
      printf("found factvalue: %s\n", factvalue);
      printf("adding fact to buffer\n");
    }
    strcat(tmpbuffer, factvalue);
    if (debug == 0)
      printf("current buffer: %s\n", tmpbuffer);
    n = strlen(tmpbuffer) - 1;
    i++;
  }
  strcpy(buffer, tmpbuffer);
}
```