#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__;

/* Type definitions */
struct TYPE_4__ {
  void *opaque;
  void *zfree;
  void *zalloc;
};
typedef TYPE_1__ z_stream;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ Z_DEFAULT_COMPRESSION;
int /*<<< orphan*/ Z_DEFAULT_STRATEGY;
int /*<<< orphan*/ Z_DEFLATED;
void *Z_NULL;
int deflateInit2(TYPE_1__ *, int /*<<< orphan*/, int /*<<< orphan*/, int, int,
                 int /*<<< orphan*/);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int, char *,
                           int);
int /*<<< orphan*/ stderr;
void strm_init(z_stream *strm) {
  strm->zalloc = Z_NULL;
  strm->zfree = Z_NULL;
  strm->opaque = Z_NULL;
  {
    int status;
    status = deflateInit2(strm, Z_DEFAULT_COMPRESSION, Z_DEFLATED, 15 | 16, 8,
                          Z_DEFAULT_STRATEGY);
    if (status < 0) {
      fprintf(stderr, "%s:%d: %s returned a bad status of %d.\n",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/hbuyse/c_programming_class/refs/heads/"
              "master/zlib/src/main.c",
              42,
              "deflateInit2(strm, Z_DEFAULT_COMPRESSION, Z_DEFLATED, "
              "windowBits | GZIP_ENCODING, 8, Z_DEFAULT_STRATEGY)",
              status);
      exit(EXIT_FAILURE);
    }
  };
}


x86 assembly (clang, -O0):
<strm_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e85(%rip),%rax
mov    (%rax),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x10(%rax)
mov    0x2e73(%rip),%rax
mov    (%rax),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    0x2e61(%rip),%rax
mov    (%rax),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rdi
mov    0x2e54(%rip),%rax
mov    (%rax),%esi
mov    0x2e53(%rip),%rax
mov    (%rax),%edx
mov    0x2e22(%rip),%rax
mov    (%rax),%r9d
mov    $0x1f,%ecx
mov    $0x8,%r8d
call   1050 <deflateInit2@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    11e8 <strm_init+0xb8>
mov    0x2e2b(%rip),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%r9d
lea    0xe3e(%rip),%rsi
lea    0xe5f(%rip),%rdx
mov    $0x2a,%ecx
lea    0xeea(%rip),%r8
call   1030 <fprintf@plt>
mov    0x2ddf(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strm_init>:
push   %rax
mov    0x2e90(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x10(%rdi)
mov    %rax,0x8(%rdi)
mov    %rax,(%rdi)
mov    0x2e83(%rip),%rax
mov    (%rax),%esi
mov    0x2e82(%rip),%rax
mov    (%rax),%edx
mov    0x2e51(%rip),%rax
mov    (%rax),%r9d
mov    $0x1f,%ecx
mov    $0x8,%r8d
call   1050 <deflateInit2@plt>
test   %eax,%eax
js     1178 <strm_init+0x48>
pop    %rax
ret
mov    0x2e61(%rip),%rcx
mov    (%rcx),%edi
lea    0xe78(%rip),%rsi
lea    0xe99(%rip),%rdx
lea    0xf29(%rip),%r8
mov    $0x2a,%ecx
mov    %eax,%r9d
call   1030 <fprintf@plt>
mov    0x2e16(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
%struct.TYPE_4__ = type { i8*, i8*, i8* }
@Z_NULL = global i8* null
@Z_DEFAULT_COMPRESSION = global i32 0
@Z_DEFLATED = global i32 0
@Z_DEFAULT_STRATEGY = global i32 0
@stderr = global i32 0
@.str = [40 x i8] c"%s:%d: %s returned a bad status of %d.\0A\00"
@.str.1 = [151 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/hbuyse/c_programming_class/refs/heads/master/zlib/src/main.c\00"
@.str.2 = [105 x i8] c"deflateInit2(strm, Z_DEFAULT_COMPRESSION, Z_DEFLATED, windowBits | GZIP_ENCODING, 8, Z_DEFAULT_STRATEGY)\00"
@EXIT_FAILURE = global i32 0
define void @strm_init(%struct.TYPE_4__* %0) {
%2 = alloca %struct.TYPE_4__*
%3 = alloca i32
store %struct.TYPE_4__* %0, %struct.TYPE_4__** %2
%4 = load i8*, i8** @Z_NULL
%5 = load %struct.TYPE_4__*, %struct.TYPE_4__** %2
%6 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %5, i32 0, i32 2
store i8* %4, i8** %6
%7 = load i8*, i8** @Z_NULL
%8 = load %struct.TYPE_4__*, %struct.TYPE_4__** %2
%9 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %8, i32 0, i32 1
store i8* %7, i8** %9
%10 = load i8*, i8** @Z_NULL
%11 = load %struct.TYPE_4__*, %struct.TYPE_4__** %2
%12 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %11, i32 0, i32 0
store i8* %10, i8** %12
%13 = load %struct.TYPE_4__*, %struct.TYPE_4__** %2
%14 = load i32, i32* @Z_DEFAULT_COMPRESSION
%15 = load i32, i32* @Z_DEFLATED
%16 = load i32, i32* @Z_DEFAULT_STRATEGY
%17 = call i32 @deflateInit2(%struct.TYPE_4__* %13, i32 %14, i32 %15, i32 31, i32 8, i32 %16)
store i32 %17, i32* %3
%18 = load i32, i32* %3
%19 = icmp slt i32 %18, 0
br i1 %19, label %20, label %26
20: ; preds = %1
%21 = load i32, i32* @stderr
%22 = load i32, i32* %3
%23 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([151 x i8], [151 x i8]* @.str.1, i64 0, i64 0), i32 42, i8* getelementptr inbounds ([105 x i8], [105 x i8]* @.str.2, i64 0, i64 0), i32 %22)
%24 = load i32, i32* @EXIT_FAILURE
%25 = call i32 @exit(i32 %24)
unreachable
26: ; preds = %1
ret void
}

LLVM IR (-O2):
%struct.TYPE_4__ = type { i8*, i8*, i8* }
@Z_NULL = global i8* null
@Z_DEFAULT_COMPRESSION = global i32 0
@Z_DEFLATED = global i32 0
@Z_DEFAULT_STRATEGY = global i32 0
@stderr = global i32 0
@.str = [40 x i8] c"%s:%d: %s returned a bad status of %d.\0A\00"
@.str.1 = [151 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/hbuyse/c_programming_class/refs/heads/master/zlib/src/main.c\00"
@.str.2 = [105 x i8] c"deflateInit2(strm, Z_DEFAULT_COMPRESSION, Z_DEFLATED, windowBits | GZIP_ENCODING, 8, Z_DEFAULT_STRATEGY)\00"
@EXIT_FAILURE = global i32 0
define void @strm_init(%struct.TYPE_4__* %0) {
%2 = load i8*, i8** @Z_NULL
%3 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %0, i64 0, i32 2
store i8* %2, i8** %3
%4 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %0, i64 0, i32 1
store i8* %2, i8** %4
%5 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %0, i64 0, i32 0
store i8* %2, i8** %5
%6 = load i32, i32* @Z_DEFAULT_COMPRESSION
%7 = load i32, i32* @Z_DEFLATED
%8 = load i32, i32* @Z_DEFAULT_STRATEGY
%9 = tail call i32 @deflateInit2(%struct.TYPE_4__* %0, i32 %6, i32 %7, i32 31, i32 8, i32 %8)
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %16
11: ; preds = %1
%12 = load i32, i32* @stderr
%13 = tail call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([151 x i8], [151 x i8]* @.str.1, i64 0, i64 0), i32 42, i8* getelementptr inbounds ([105 x i8], [105 x i8]* @.str.2, i64 0, i64 0), i32 %9)
%14 = load i32, i32* @EXIT_FAILURE
%15 = tail call i32 @exit(i32 %14)
unreachable
16: ; preds = %1
ret void
}