// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x26e5
jmp 0x2704
leaq 0x8b6c(%rip), %rdi      # 0xb258
leaq 0x8a25(%rip), %rsi      # 0xb118
movl $0x10, %edx
leaq 0x8b66(%rip), %rcx      # 0xb265
callq 0x2120
movq -0x8(%rbp), %rax
cmpq $0x0, (%rax)
je 0x2710
jmp 0x272f
leaq 0x8b79(%rip), %rdi      # 0xb290
leaq 0x89fa(%rip), %rsi      # 0xb118
movl $0x11, %edx
leaq 0x8b3b(%rip), %rcx      # 0xb265
callq 0x2120
movq -0x8(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jbe 0x273c
jmp 0x275b
leaq 0x8b60(%rip), %rdi      # 0xb2a3
leaq 0x89ce(%rip), %rsi      # 0xb118
movl $0x12, %edx
leaq 0x8b0f(%rip), %rcx      # 0xb265
callq 0x2120
movq $0x0, -0x18(%rbp)
movl $0x1, %edi
movl $0x10, %esi
callq 0x2130
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x277f
jmp 0x279e
leaq 0x8b2c(%rip), %rdi      # 0xb2b2
leaq 0x898b(%rip), %rsi      # 0xb118
movl $0x18, %edx
leaq 0x8acc(%rip), %rcx      # 0xb265
callq 0x2120
movl $0x1, %edi
movl $0x70, %esi
callq 0x2130
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x27ba
jmp 0x27d9
leaq 0x8af8(%rip), %rdi      # 0xb2b9
leaq 0x8950(%rip), %rsi      # 0xb118
movl $0x1b, %edx
leaq 0x8a91(%rip), %rcx      # 0xb265
callq 0x2120
movq -0x28(%rbp), %rdi
movl 0xc9a5(%rip), %esi      # 0xf188
leaq 0x8ad4(%rip), %rdx      # 0xb2be
movl $0x70, %ecx
callq 0x2040
movl %eax, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
jne 0x27ff
jmp 0x281e
leaq 0x8abf(%rip), %rdi      # 0xb2c5
leaq 0x890b(%rip), %rsi      # 0xb118
movl $0x1e, %edx
leaq 0x8a4c(%rip), %rcx      # 0xb265
callq 0x2120
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movl %eax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
cmpl $0x0, 0x20(%rax)
jne 0x28d4
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
addq %rax, %rsi
callq 0x2308
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x2876
jmp 0x2895
leaq 0x8a54(%rip), %rdi      # 0xb2d1
leaq 0x8894(%rip), %rsi      # 0xb118
movl $0x27, %edx
leaq 0x89d5(%rip), %rcx      # 0xb265
callq 0x2120
movq -0x30(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rcx
addq -0x18(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movl %eax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
addq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x28(%rbp), %rdi
movl $0x4, %esi
callq 0x20d0
movl %eax, -0xc(%rbp)
cmpl $-0x2, -0xc(%rbp)
je 0x28ed
jmp 0x290c
leaq 0x89e1(%rip), %rdi      # 0xb2d5
leaq 0x881d(%rip), %rsi      # 0xb118
movl $0x30, %edx
leaq 0x895e(%rip), %rcx      # 0xb265
callq 0x2120
jmp 0x290e
movq -0x28(%rbp), %rax
cmpl $0x0, 0x8(%rax)
ja 0x283d
movq -0x28(%rbp), %rax
movq 0x28(%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x28(%rbp), %rdi
callq 0x2100
movq -0x28(%rbp), %rdi
callq 0x22f8
movq -0x20(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)