user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<packEx>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %r8,%r13
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  mov    %edx,%ebp
  push   %rbx
  mov    %r9,%rbx
  lea    D33(%rip),%r9
  sub    $0x48,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  cmp    $0x1,%ecx
  mov    %edx,0x14(%rsp)
  setg   %r8b
  movzbl %r8b,%r8d
  call   <out@plt>
  test   %eax,%eax
  je     L271
  lea    D33(%rip),%r14
  mov    %r13,%rsi
  mov    %r14,%rdi
  call   <in@plt>
  test   %rax,%rax
  je     L271
  mov    (%rbx),%r15d
  pxor   %xmm0,%xmm0
  movups %xmm0,0x28(%rsp)
  lea    0x1(%r15),%eax
  and    $0xfffffffd,%eax
  je     L132
L109:
  cmp    $0xffffffff,%r15d
  je     L269
  cmpl   $0x2,(%rbx)
  je     L269
  mov    0x28(%rsp),%r9
  mov    0x14(%rsp),%edx
  movl   $0x0,(%rbx)
  test   %r9,%r9
  je     L209
  mov    0x18(%rsp),%ecx
  cmp    %ecx,%edx
  jg     L79
L209:
  lea    D29(%rip),%rdi
  xor    %eax,%eax
  mov    %edx,(%rsp)
  mov    %r12,%r15
  mov    %r9,0x8(%rsp)
  call   <printf@plt>
  mov    (%rsp),%edx
  pxor   %xmm0,%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2ss %ebp,%xmm1
  mov    %ebp,%esi
  mov    $0x1,%eax
  cvtsi2sd %edx,%xmm0
  mulsd  D15(%rip),%xmm0
  lea    D70(%rip),%rdi
  cvtss2sd %xmm1,%xmm1
  divsd  %xmm1,%xmm0
  call   <printf@plt>
  mov    (%rsp),%edx
  mov    0x8(%rsp),%r9
  mov    %edx,0x0(%r13)
L256:
  cmp    %r15,%r9
  je     L37
  test   %r9,%r9
  je     L37
  mov    %r9,%rdi
  call   <free@plt>
L37:
  mov    0x30(%rsp),%rdi
  test   %rdi,%rdi
  je     L210
  cmp    %r15,%rdi
  je     L210
  call   <free@plt>
L210:
  mov    %r14,%rdi
  call   <remove@plt>
  lea    D30(%rip),%rdi
  call   <remove@plt>
L215:
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L211
  add    $0x48,%rsp
  mov    %r15,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L132:
  lea    D30(%rip),%rsi
  mov    %r14,%rdi
  call   <appack@plt>
  test   %eax,%eax
  je     L109
  lea    0x18(%rsp),%rsi
  lea    D30(%rip),%rdi
  call   <in@plt>
  mov    %rax,0x28(%rsp)
  jmp    L109
  nopw   0x0(%rax,%rax,1)
L271:
  movl   $0x0,0x0(%r13)
  xor    %r15d,%r15d
  jmp    L215
  nopl   (%rax)
L269:
  lea    D30(%rip),%rsi
  mov    %r14,%rdi
  xor    %r15d,%r15d
  call   <lz4wpack@plt>
  test   %eax,%eax
  jne    L50
L220:
  mov    0x28(%rsp),%r9
  mov    0x14(%rsp),%edx
  movl   $0x0,(%rbx)
  test   %r9,%r9
  je     L223
  mov    0x18(%rsp),%ecx
  cmp    %ecx,%edx
  jle    L223
  movl   $0x1,(%rbx)
  test   %r15,%r15
  je     L128
  mov    0x1c(%rsp),%r10d
  cmp    %ecx,%r10d
  jge    L128
L117:
  movl   $0x2,(%rbx)
  lea    D79(%rip),%rdi
  xor    %eax,%eax
  mov    %r9,0x8(%rsp)
  mov    %r10d,(%rsp)
  call   <printf@plt>
  mov    (%rsp),%r10d
  pxor   %xmm0,%xmm0
  mov    %ebp,%esi
  pxor   %xmm1,%xmm1
  lea    D70(%rip),%rdi
  mov    $0x1,%eax
  cvtsi2sd %r10d,%xmm0
  mulsd  D15(%rip),%xmm0
  mov    %r10d,%edx
  cvtsi2ss %ebp,%xmm1
  cvtss2sd %xmm1,%xmm1
  divsd  %xmm1,%xmm0
  call   <printf@plt>
  mov    (%rsp),%r10d
  test   %r12,%r12
  mov    0x8(%rsp),%r9
  mov    %r10d,0x0(%r13)
  je     L256
  cmp    %r15,%r12
  je     L256
L289:
  mov    %r12,%rdi
  mov    %r9,(%rsp)
  call   <free@plt>
  mov    (%rsp),%r9
  jmp    L256
  nopw   0x0(%rax,%rax,1)
L223:
  test   %r15,%r15
  je     L209
  mov    0x1c(%rsp),%r10d
  cmp    %edx,%r10d
  jl     L117
  jmp    L209
  nopl   0x0(%rax)
L79:
  movl   $0x1,(%rbx)
L128:
  lea    D62(%rip),%rdi
  xor    %eax,%eax
  mov    %r9,0x8(%rsp)
  mov    %ecx,(%rsp)
  call   <printf@plt>
  mov    (%rsp),%ecx
  pxor   %xmm0,%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2ss %ebp,%xmm1
  mov    %ebp,%esi
  mov    $0x1,%eax
  cvtsi2sd %ecx,%xmm0
  mulsd  D15(%rip),%xmm0
  mov    %ecx,%edx
  lea    D70(%rip),%rdi
  cvtss2sd %xmm1,%xmm1
  divsd  %xmm1,%xmm0
  call   <printf@plt>
  mov    (%rsp),%ecx
  test   %r12,%r12
  mov    0x8(%rsp),%r9
  mov    %ecx,0x0(%r13)
  je     L229
  mov    %r9,%r15
  cmp    %r9,%r12
  jne    L289
L229:
  mov    %r9,%r15
  jmp    L37
  nopl   0x0(%rax)
L50:
  lea    0x1c(%rsp),%rsi
  lea    D30(%rip),%rdi
  call   <in@plt>
  mov    %rax,0x30(%rsp)
  mov    %rax,%r15
  jmp    L220
L211:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: label: D33
type_infered: string
name: disassemble_data
arguments: label: D29
type_infered: string
name: disassemble_data
arguments: label: D15
type_infered: f64
name: disassemble_data
arguments: label: D70
type_infered: string
name: disassemble_data
arguments: label: D30
type_infered: string
name: disassemble_data
arguments: label: D79
type_infered: string
name: disassemble_data
arguments: label: D62
type_infered: string

tool: D33: pack.in

tool: D29: No compression, 

tool: D15: 100

tool: D70: original size = %d compressed to %d (%g %%)


tool: D30: pack.out

tool: D79: Packed with LZ4W, 

tool: D62: Packed with APLIB, 

assistant: ```c
unsigned char *packEx(unsigned char *data, int inOffset, int size, int intSize, int *outSize, int *method) {
  unsigned char *src;
  unsigned char *result;
  unsigned char *results[2 + 1];
  int sizes[2 + 1];
  int minSize;
  int autoSelect;
  int i;
  results[0] = data;
  sizes[0] = size;
  if (!out(data, inOffset, size, intSize, (intSize > 1) ? 1 : 0, "pack.in")) {
    *outSize = 0;
    return 0;
  }
  src = in("pack.in", outSize);
  if (src == 0) {
    *outSize = 0;
    return 0;
  }
  for (i = 1; i <= 2; i++)
    results[i] = 0;
  autoSelect = (*method == -1);
  for (i = 1; i <= 2; i++) {
    if (autoSelect || (*method == i)) {
      switch (i) {
      case 1:
        if (appack("pack.in", "pack.out"))
          results[1] = in("pack.out", &sizes[1]);
        break;
      case 2:
        if (lz4wpack("pack.in", "pack.out"))
          results[2] = in("pack.out", &sizes[2]);
        break;
      }
    }
  }
  minSize = sizes[0];
  result = results[0];
  *method = 0;
  for (i = 1; i <= 2; i++) {
    if (results[i] != 0) {
      if (sizes[i] < minSize) {
        minSize = sizes[i];
        result = results[i];
        *method = i;
      }
    }
  }
  switch (*method) {
  case 1:
    printf("Packed with APLIB, ");
    break;
  case 2:
    printf("Packed with LZ4W, ");
    break;
  default:
    printf("No compression, ");
  }
  printf("original size = %d compressed to %d (%g %%)\n", size, minSize, (minSize * 100.0) / (float)size);
  *outSize = minSize;
  for (i = 0; i <= 2; i++) {
    if ((results[i] != 0) && (results[i] != result))
      free(results[i]);
  }
  remove("pack.in");
  remove("pack.out");
  return result;
}
```