// File: /workspace/github_c_makefile_star2_O3/tomcatzh[P]RealityBenchmark/zlib_bench.c
// Function: deflateContent
static CONTENTS *deflateContent(const CONTENTS *data) {
  assert(data != NULL);
  assert(data->body != NULL);
  assert(data->size > 0);

  int ret;
  size_t bufSize = 0;

  CONTENTS *result = calloc(1, sizeof(CONTENTS));
  assert(result);

  z_stream *strm = (z_stream *)calloc(1, sizeof(z_stream));
  assert(strm);

  ret = deflateInit(strm, level);
  assert(ret == Z_OK);

  strm->avail_in = data->size;
  strm->next_in = data->body;

  do {
    if (strm->avail_out == 0) {
      unsigned char *ptr =
        (unsigned char *)realloc(result->body, bufSize + data->size * 2);
      assert(ptr);

      result->body = ptr;
      strm->next_out = ptr + bufSize;
      strm->avail_out = data->size * 2;
      bufSize += data->size;
    }
    
    ret = deflate(strm, Z_FINISH);
    assert(ret != Z_STREAM_ERROR);
  } while (strm->avail_in > 0);

  result->size = strm->total_out;

  (void)deflateEnd(strm);
  free(strm);

  return result;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
testq %rdi, %rdi
je 0x27e9
movq %rdi, %rbx
cmpq $0x0, (%rdi)
je 0x2808
cmpq $0x0, 0x8(%rbx)
je 0x2827
movl $0x1, %edi
movl $0x10, %esi
callq 0x2120
testq %rax, %rax
je 0x2846
movq %rax, %r14
movl $0x1, %edi
movl $0x70, %esi
callq 0x2120
testq %rax, %rax
je 0x2865
movq %rax, %r15
movl 0x8a70(%rip), %esi      # 0xb170
leaq 0x4b03(%rip), %rdx      # 0x720a
movq %rax, %rdi
movl $0x70, %ecx
callq 0x2040
testl %eax, %eax
jne 0x2884
movl 0x8(%rbx), %eax
movl %eax, 0x8(%r15)
movq (%rbx), %rax
movq %rax, (%r15)
xorl %r12d, %r12d
xorl %r13d, %r13d
cmpl $0x0, 0x20(%r15)
jne 0x276d
movq 0x8(%rbx), %rax
leaq (,%rax,2), %rsi
addq %r13, %rsi
movq %r12, %rdi
callq 0x22d8
testq %rax, %rax
je 0x27ca
movq %rax, %r12
movq %rax, (%r14)
addq %r13, %rax
movq %rax, 0x18(%r15)
movq 0x8(%rbx), %rax
leal (%rax,%rax), %ecx
movl %ecx, 0x20(%r15)
addq %rax, %r13
movq %r15, %rdi
movl $0x4, %esi
callq 0x20d0
cmpl $-0x2, %eax
je 0x27ab
cmpl $0x0, 0x8(%r15)
jne 0x272f
movq 0x28(%r15), %rax
movq %rax, 0x8(%r14)
movq %r15, %rdi
callq 0x20f0
movq %r15, %rdi
callq 0x22c8
movq %r14, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x4a6f(%rip), %rdi      # 0x7221
leaq 0x48ab(%rip), %rsi      # 0x7064
leaq 0x49f1(%rip), %rcx      # 0x71b1
movl $0x30, %edx
callq 0x2110
leaq 0x4a4c(%rip), %rdi      # 0x721d
leaq 0x488c(%rip), %rsi      # 0x7064
leaq 0x49d2(%rip), %rcx      # 0x71b1
movl $0x27, %edx
callq 0x2110
leaq 0x49b4(%rip), %rdi      # 0x71a4
leaq 0x486d(%rip), %rsi      # 0x7064
leaq 0x49b3(%rip), %rcx      # 0x71b1
movl $0x10, %edx
callq 0x2110
leaq 0x49cd(%rip), %rdi      # 0x71dc
leaq 0x484e(%rip), %rsi      # 0x7064
leaq 0x4994(%rip), %rcx      # 0x71b1
movl $0x11, %edx
callq 0x2110
leaq 0x49c1(%rip), %rdi      # 0x71ef
leaq 0x482f(%rip), %rsi      # 0x7064
leaq 0x4975(%rip), %rcx      # 0x71b1
movl $0x12, %edx
callq 0x2110
leaq 0x49b1(%rip), %rdi      # 0x71fe
leaq 0x4810(%rip), %rsi      # 0x7064
leaq 0x4956(%rip), %rcx      # 0x71b1
movl $0x18, %edx
callq 0x2110
leaq 0x4999(%rip), %rdi      # 0x7205
leaq 0x47f1(%rip), %rsi      # 0x7064
leaq 0x4937(%rip), %rcx      # 0x71b1
movl $0x1b, %edx
callq 0x2110
leaq 0x4986(%rip), %rdi      # 0x7211
leaq 0x47d2(%rip), %rsi      # 0x7064
leaq 0x4918(%rip), %rcx      # 0x71b1
movl $0x1e, %edx
callq 0x2110