user: What would the C source look like for the assembly code provided here:

```asm
<encode_file>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  lea    -0x10000(%rsp),%r11
L38:
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  cmp    %r11,%rsp
  jne    L38
  sub    $0x48,%rsp
  mov    %rdi,%r15
  mov    %esi,%ebp
  mov    %rdx,0x18(%rsp)
  mov    %rcx,%r13
  mov    %r9,%r12
  mov    %r8w,0x16(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x10038(%rsp)
  xor    %eax,%eax
  movl   $0x0,0x2c(%rsp)
  test   %r9,%r9
  je     L96
  mov    $0x3,%edx
  mov    $0x1,%esi
  lea    D18(%rip),%rdi
  call   <fwrite@plt>
  mov    %ebp,%ebx
  sar    $0x8,%ebx
  movzbl (%r12),%eax
  mov    %r12,%rdx
  mov    $0x0,%ecx
  test   %al,%al
  je     L131
L44:
  xor    %eax,%ecx
  add    $0x1,%rdx
  movzbl (%rdx),%eax
  test   %al,%al
  jne    L44
L131:
  movzbl %cl,%edi
  mov    %r13,%rsi
  call   <fputc@plt>
  mov    %ebx,%edx
  xor    (%r12),%dl
  cmpb   $0x1,0x1(%r12)
  mov    %r12,%rbx
  sbb    $0xffffffffffffffff,%rbx
  mov    %ebp,%ecx
  xor    (%rbx),%cl
L248:
  movzbl %cl,%ecx
  movzbl %dl,%edx
  lea    D16(%rip),%rsi
  mov    %r13,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  lea    0x30(%rsp),%rax
  lea    0x10030(%rsp),%rdx
L71:
  movb   $0x0,(%rax)
  add    $0x1,%rax
  cmp    %rdx,%rax
  jne    L71
  mov    $0x0,%ebp
  jmp    L233
L98:
  mov    %r12,%rbx
L264:
  cltq
  movzbl 0x30(%rsp,%rax,1),%edx
  xor    (%rbx),%dl
  mov    %dl,0x30(%rsp,%rax,1)
  add    $0x1,%ecx
  movzbl %cl,%eax
  cmp    %esi,%eax
  jg     L298
L277:
  cmpb   $0x0,0x1(%rbx)
  je     L98
  add    $0x1,%rbx
  jmp    L264
L39:
  movl   $0x0,0x2c(%rsp)
  lea    0x2c(%rsp),%rbp
L246:
  mov    0x18(%rsp),%r12
  mov    %r12,%rdi
  call   <getc@plt>
  mov    %eax,%ebx
  cmp    $0xffffffff,%eax
  je     L89
  mov    %r12,%rdi
  call   <getc@plt>
  cmp    $0xffffffff,%eax
  je     L89
  mov    %bl,%r14b
  mov    %r14d,%ebx
  mov    %al,%bh
  mov    %ebx,%r14d
  movzwl %bx,%eax
  mov    (%r15,%rax,8),%rcx
  lea    0x30(%rsp),%rsi
  mov    %rbp,%rdx
  mov    %r13,%rdi
  call   <write_bits@plt>
  test   %rax,%rax
  je     L246
  mov    $0x1,%eax
  jmp    L307
L89:
  mov    0x80000(%r15),%rcx
  lea    0x2c(%rsp),%rdx
  lea    0x30(%rsp),%rsi
  mov    %r13,%rdi
  call   <write_bits@plt>
  mov    %rax,%rdx
  mov    $0x1,%eax
  test   %rdx,%rdx
  jne    L307
  mov    0x2c(%rsp),%edx
  mov    $0x0,%eax
  test   %edx,%edx
  jle    L307
  lea    0x7(%rdx),%ebx
  cmovns %edx,%ebx
  sar    $0x3,%ebx
  add    $0x1,%ebx
  lea    0x30(%rsp),%rdi
  mov    %r13,%rcx
  mov    %ebx,%edx
  mov    $0x1,%esi
  call   <fwrite@plt>
  cmp    %ebx,%eax
  setne  %al
  movzbl %al,%eax
  jmp    L307
L274:
  mov    $0x1,%eax
L307:
  mov    0x10038(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L290
  add    $0x10048,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L28:
  mov    $0x1,%eax
  jmp    L307
L203:
  mov    $0x1,%eax
  jmp    L307
L16:
  movsbl %dh,%ecx
  movsbl %cl,%ecx
  movsbl %dl,%edx
  lea    D16(%rip),%rsi
  mov    %r13,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  movl   $0x0,0x2c(%rsp)
  mov    (%r15,%rbp,8),%rcx
  lea    0x2c(%rsp),%rdx
  lea    0x30(%rsp),%rsi
  mov    %r13,%rdi
  call   <write_bits@plt>
  test   %rax,%rax
  jne    L203
  movzbl 0x2c(%rsp),%edi
  mov    %r13,%rsi
  call   <fputc@plt>
L298:
  mov    0x2c(%rsp),%edx
  lea    0x7(%rdx),%eax
  test   %edx,%edx
  cmovns %edx,%eax
  sar    $0x3,%eax
  add    $0x1,%eax
  lea    0x30(%rsp),%rdi
  mov    %r13,%rcx
  mov    %eax,0x8(%rsp)
  mov    %eax,%edx
  mov    $0x1,%esi
  call   <fwrite@plt>
  cmp    0x8(%rsp),%eax
  jne    L28
L201:
  add    $0x1,%rbp
  cmp    $0x10001,%rbp
  je     L39
L233:
  cmpq   $0x0,(%r15,%rbp,8)
  je     L201
  cmp    $0x10000,%ebp
  movzwl 0x16(%rsp),%edx
  cmovne %ebp,%edx
  mov    %edx,%r14d
  test   %r12,%r12
  je     L16
  mov    %r12,%rax
  cmpb   $0x0,0x1(%rbx)
  je     L70
  lea    0x1(%rbx),%rax
L70:
  mov    %r14d,%edx
  xor    (%rax),%dl
  mov    %dl,%r14b
  mov    %r12,0x8(%rsp)
  cmpb   $0x0,0x1(%rax)
  je     L241
  add    $0x1,%rax
  mov    %rax,0x8(%rsp)
L241:
  mov    %r14d,%eax
  movsbl %ah,%ecx
  mov    0x8(%rsp),%rax
  xor    (%rax),%cl
  mov    %r14d,%eax
  mov    %cl,%ah
  mov    %eax,%r14d
  movsbl %cl,%ecx
  movsbl %dl,%edx
  lea    D16(%rip),%rsi
  mov    %r13,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  movl   $0x0,0x2c(%rsp)
  mov    (%r15,%rbp,8),%rcx
  lea    0x2c(%rsp),%rdx
  lea    0x30(%rsp),%rsi
  mov    %r13,%rdi
  call   <write_bits@plt>
  test   %rax,%rax
  jne    L274
  mov    %r12,%rbx
  mov    0x8(%rsp),%rax
  cmpb   $0x0,0x1(%rax)
  je     L132
  mov    %rax,%rbx
  add    $0x1,%rbx
L132:
  movzbl 0x2c(%rsp),%edi
  movsbl (%rbx),%eax
  xor    %eax,%edi
  mov    %r13,%rsi
  call   <fputc@plt>
  mov    0x2c(%rsp),%eax
  lea    0x7(%rax),%esi
  test   %eax,%eax
  cmovns %eax,%esi
  sar    $0x3,%esi
  cmp    $0xfffffff9,%eax
  jl     L298
  mov    $0x0,%ecx
  mov    $0x0,%eax
  jmp    L277
L96:
  mov    $0x3,%edx
  mov    $0x1,%esi
  lea    D6(%rip),%rdi
  call   <fwrite@plt>
  mov    %ebp,%ecx
  mov    %ebp,%eax
  movzbl %ah,%edx
  mov    %r12,%rbx
  jmp    L248
L290:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: label: D18
data_type: string
name: extract_symbolic_data
arguments: label: D16
data_type: string
name: extract_symbolic_data
arguments: label: D6
data_type: string

tool: D18: hz1

tool: D16: %c%c

tool: D6: hz0

assistant: ```c
int encode_file(char **table, int n, FILE *f, FILE *f2, unsigned short tw, char *key) {
  char bitbuf[65536];
  int i, bits = 0;
  unsigned char cl, ch;
  int cx[2];
  union {
    char c[2];
    unsigned short word;
  } u;
  char *enc = key;
  fprintf(f2, "%s", (key ? "hz1" : "hz0"));
  cl = (unsigned char)(n & 0x00ff);
  ch = (unsigned char)(n >> 8);
  if (key) {
    unsigned char cs;
    for (cs = 0; *enc; enc++)
      cs ^= *enc;
    fprintf(f2, "%c", cs);
    enc = key;
    ch ^= *enc;
    if ((*(++enc)) == '\0')
      enc = key;
    cl ^= *enc;
  }
  fprintf(f2, "%c%c", ch, cl);
  for (i = 0; i < 65536; i++)
    bitbuf[i] = '\0';
  for (i = 0; i < 65536 + 1; i++)
    if (table[i]) {
      int nmemb;
      u.word = (unsigned short)i;
      if (i == 65536)
        u.word = tw;
      if (key) {
        if (*(++enc) == '\0')
          enc = key;
        u.c[0] ^= *enc;
        if (*(++enc) == '\0')
          enc = key;
        u.c[1] ^= *enc;
      }
      fprintf(f2, "%c%c", u.c[0], u.c[1]);
      bits = 0;
      if (write_bits(f2, bitbuf, &bits, table[i]) != 0)
        return 1;
      if (key) {
        if (*(++enc) == '\0')
          enc = key;
        fprintf(f2, "%c", ((unsigned char)bits) ^ *enc);
        for (cl = 0; cl <= bits / 8; cl++) {
          if (*(++enc) == '\0')
            enc = key;
          bitbuf[cl] ^= *enc;
        }
      } else
        fprintf(f2, "%c", (unsigned char)bits);
      nmemb = bits / 8 + 1;
      if (fwrite(bitbuf, sizeof(char), bits / 8 + 1, f2) != nmemb)
        return 1;
    }
  bits = 0;
  while ((cx[0] = getc(f)) != -1 && (cx[1] = getc(f)) != -1) {
    u.c[0] = cx[0];
    u.c[1] = cx[1];
    if (write_bits(f2, bitbuf, &bits, table[u.word]) != 0)
      return 1;
  }
  if (write_bits(f2, bitbuf, &bits, table[65536]) != 0)
    return 1;
  if (bits > 0) {
    int nmemb = bits / 8 + 1;
    if (fwrite(bitbuf, sizeof(char), nmemb, f2) != nmemb)
      return 1;
  }
  return 0;
}
```