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

```asm
<IPS_create>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %rdx,-0x48(%rbp)
  mov    %ecx,-0x4c(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  cmpq   $0x0,-0x38(%rbp)
  je     L127
  cmpq   $0x0,-0x40(%rbp)
  je     L127
  cmpq   $0x0,-0x48(%rbp)
  jne    L35
L127:
  mov    $0xffffffff,%eax
  jmp    L109
L35:
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <rewind@plt>
  mov    -0x40(%rbp),%rax
  mov    %rax,%rdi
  call   <rewind@plt>
  mov    -0x48(%rbp),%rax
  mov    %rax,%rdi
  call   <rewind@plt>
  mov    -0x48(%rbp),%rax
  mov    %rax,%rcx
  mov    $0x1,%edx
  mov    $0x5,%esi
  lea    D22(%rip),%rax
  mov    %rax,%rdi
  call   <fwrite@plt>
  cmp    $0x1,%eax
  je     L98
  mov    $0xfffffff6,%eax
  jmp    L109
L98:
  mov    $0x10,%esi
  mov    $0x2,%edi
  call   <pow@plt>
  cwtl
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x20(%rbp)
  movq   $0x0,-0x18(%rbp)
  movw   $0x0,-0x26(%rbp)
  movl   $0x0,-0x24(%rbp)
  jmp    L136
L121:
  nop
L82:
  mov    -0x40(%rbp),%rax
  mov    %rax,%rdi
  call   <fgetc@plt>
  mov    %al,-0x27(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <fgetc@plt>
  cmp    %al,-0x27(%rbp)
  jne    L22
  mov    -0x40(%rbp),%rax
  mov    %rax,%rdi
  call   <feof@plt>
  test   %rax,%rax
  jne    L22
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <feof@plt>
  test   %rax,%rax
  je     L82
L22:
  mov    -0x40(%rbp),%rax
  mov    %rax,%rdi
  call   <feof@plt>
  test   %rax,%rax
  jne    L136
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <feof@plt>
  test   %rax,%rax
  je     L77
  jmp    L136
L77:
  mov    -0x40(%rbp),%rax
  mov    %rax,%rdi
  call   <ftell@plt>
  sub    $0x1,%eax
  cltq
  mov    %rax,-0x18(%rbp)
  movzwl -0x26(%rbp),%eax
  mov    %eax,%edx
  add    $0x1,%edx
  mov    %dx,-0x26(%rbp)
  movswq %ax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rax,%rdx
  movzbl -0x27(%rbp),%eax
  mov    %al,(%rdx)
  jmp    L7
L208:
  movzwl -0x26(%rbp),%eax
  mov    %eax,%edx
  add    $0x1,%edx
  mov    %dx,-0x26(%rbp)
  movswq %ax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rax,%rdx
  movzbl -0x27(%rbp),%eax
  mov    %al,(%rdx)
  mov    $0x10,%esi
  mov    $0x2,%edi
  call   <pow@plt>
  cmp    %ax,-0x26(%rbp)
  jg     L132
L7:
  mov    -0x40(%rbp),%rax
  mov    %rax,%rdi
  call   <fgetc@plt>
  mov    %al,-0x27(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <fgetc@plt>
  cmp    %al,-0x27(%rbp)
  jne    L208
  jmp    L99
L132:
  nop
L99:
  movswl -0x26(%rbp),%esi
  movswl -0x26(%rbp),%ecx
  mov    -0x18(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  mov    %esi,%r8d
  mov    %rax,%rsi
  lea    D16(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    -0x18(%rbp),%rax
  sar    $0x10,%rax
  mov    %al,-0xb(%rbp)
  mov    -0x18(%rbp),%rax
  sar    $0x8,%rax
  mov    %al,-0xa(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %al,-0x9(%rbp)
  movswl -0x26(%rbp),%eax
  sar    $0x8,%eax
  mov    %al,-0xd(%rbp)
  movzwl -0x26(%rbp),%eax
  mov    %al,-0xc(%rbp)
  mov    -0x48(%rbp),%rdx
  lea    -0xb(%rbp),%rax
  mov    %rdx,%rcx
  mov    $0x1,%edx
  mov    $0x3,%esi
  mov    %rax,%rdi
  call   <fwrite@plt>
  mov    -0x48(%rbp),%rdx
  lea    -0xd(%rbp),%rax
  mov    %rdx,%rcx
  mov    $0x1,%edx
  mov    $0x2,%esi
  mov    %rax,%rdi
  call   <fwrite@plt>
  movswl -0x26(%rbp),%esi
  mov    -0x48(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  mov    %rdx,%rcx
  mov    $0x1,%edx
  mov    %rax,%rdi
  call   <fwrite@plt>
  movw   $0x0,-0x26(%rbp)
  addl   $0x1,-0x24(%rbp)
L136:
  mov    -0x40(%rbp),%rax
  mov    %rax,%rdi
  call   <feof@plt>
  test   %rax,%rax
  jne    L44
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <feof@plt>
  test   %rax,%rax
  je     L121
L44:
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x48(%rbp),%rax
  mov    %rax,%rcx
  mov    $0x1,%edx
  mov    $0x3,%esi
  lea    D14(%rip),%rax
  mov    %rax,%rdi
  call   <fwrite@plt>
  cmp    $0x1,%eax
  je     L54
  mov    $0xffffffec,%eax
  jmp    L109
L54:
  mov    -0x24(%rbp),%eax
L109:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L80
  call   <__stack_chk_fail@plt>
L80:
  leave
  ret
```

tool_calls: name: parse_data
arguments: data_label: D22
type_infered: string
name: parse_data
arguments: data_label: D16
type_infered: string
name: parse_data
arguments: data_label: D14
type_infered: string

tool: D22: PATCH

tool: D16: Patch: Offset: %d (%08X), Length: %d(%04X)


tool: D14: EOF

assistant: ```c
int IPS_create(FILE *original, FILE *modified, FILE *patch, int use_rle) {
  if (!original || !modified || !patch)
    return -1;
  rewind(original);
  rewind(modified);
  rewind(patch);
  if (fwrite("PATCH", 5, 1, patch) != 1) {
    return -10;
  }
  char *buffer = (char *)malloc(pow(2, 16));
  long patch_offset = 0;
  short buffer_size = 0;
  int patch_count = 0;
  char c;
  while (!feof(modified) && !feof(original)) {
    while ((c = fgetc(modified)) == fgetc(original) && !feof(modified) && !feof(original))
      ;
    if (feof(modified) || feof(original)) {
      continue;
    }
    patch_offset = ftell(modified) - 1;
    buffer[buffer_size++] = c;
    while ((c = fgetc(modified)) != fgetc(original)) {
      buffer[buffer_size++] = c;
      if (buffer_size > pow(2, 16)) {
        break;
      }
    }
    printf("Patch: Offset: %d (%08X), Length: %d(%04X)\n", patch_offset, patch_offset, buffer_size, buffer_size);
    char offset_value[3] = {(patch_offset & 0x00ff0000) >> 16, (patch_offset & 0x0000ff00) >> 8, (patch_offset & 0x000000ff)};
    char size_value[2] = {(buffer_size & 0xff00) >> 8, (buffer_size & 0x00ff)};
    fwrite(offset_value, 3, 1, patch);
    fwrite(size_value, 2, 1, patch);
    fwrite(buffer, buffer_size, 1, patch);
    buffer_size = 0;
    patch_count++;
  }
  free(buffer);
  if (fwrite("EOF", 3, 1, patch) != 1) {
    return -20;
  }
  return patch_count;
}
```