#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 */

/* Type definitions */
typedef int /*<<< orphan*/ *gzFile;

/* Variables and functions */
char const *ZLIB_VERSION;
scalar_t__ errno;
int /*<<< orphan*/ *gzopen(char const *, char const *);
int /*<<< orphan*/ my_err(char *, char *, int, char const *, char const *, ...);
int /*<<< orphan*/ my_warn(char *, char const *, ...);
scalar_t__ strcmp(char const *, char *);
int /*<<< orphan*/ strerror(scalar_t__);
int /*<<< orphan*/ util_str_ends_with(char const *, char *);
char *zlibVersion();
gzFile util_must_gzopen(const char *path, const char *mode) {
  gzFile f;
  if (strcmp(ZLIB_VERSION, zlibVersion()) != 0) {
    my_warn("zlib compilation (%s) and runtime (%s) versions do not match.\n",
            ZLIB_VERSION, zlibVersion());
  }
  if ((strcmp(mode, "wb") == 0) && !util_str_ends_with(path, ".gz")) {
    my_warn("%s:%d: file '%s' does not end with '.gz' but "
            "opening with gzopen anyway\n",
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/bmvdgeijn/WASP/refs/heads/master/snp2h5/"
            "util.c",
            1064, path);
  }
  errno = 0;
  f = gzopen(path, mode);
  if (f == NULL) {
    if (errno) {
      my_err("%s:%d: error opening file '%s' in mode '%s': %s",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/bmvdgeijn/WASP/refs/heads/master/"
             "snp2h5/util.c",
             1074, path, mode, strerror(errno));
    } else {
      my_err("%s:%d: error opening file '%s' in mode '%s'",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/bmvdgeijn/WASP/refs/heads/master/"
             "snp2h5/util.c",
             1077, path, mode);
    }
  }
  return f;
}


x86 assembly (clang, -O0):
<util_must_gzopen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e51(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    $0x0,%al
call   1060 <zlibVersion@plt>
mov    -0x20(%rbp),%rdi
mov    %rax,%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     11d5 <util_must_gzopen+0x65>
mov    0x2e26(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    $0x0,%al
call   1060 <zlibVersion@plt>
mov    -0x28(%rbp),%rsi
mov    %rax,%rdx
lea    0xe32(%rip),%rdi
mov    $0x0,%al
call   1090 <my_warn@plt>
mov    -0x10(%rbp),%rdi
lea    0xe5f(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1226 <util_must_gzopen+0xb6>
mov    -0x8(%rbp),%rdi
lea    0xe48(%rip),%rsi
call   1030 <util_str_ends_with@plt>
cmp    $0x0,%eax
jne    1226 <util_must_gzopen+0xb6>
mov    -0x8(%rbp),%rcx
lea    0xe33(%rip),%rdi
lea    0xe75(%rip),%rsi
mov    $0x428,%edx
mov    $0x0,%al
call   1090 <my_warn@plt>
mov    0x2db3(%rip),%rax
movq   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <gzopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    12d1 <util_must_gzopen+0x161>
mov    0x2d89(%rip),%rax
cmpq   $0x0,(%rax)
je     12aa <util_must_gzopen+0x13a>
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    0x2d68(%rip),%rax
mov    (%rax),%rdi
call   1070 <strerror@plt>
mov    -0x38(%rbp),%rcx
mov    -0x30(%rbp),%r8
mov    %eax,%r9d
lea    0xe86(%rip),%rdi
lea    0xdf6(%rip),%rsi
mov    $0x432,%edx
mov    $0x0,%al
call   1080 <my_err@plt>
jmp    12cc <util_must_gzopen+0x15c>
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%r8
lea    0xe8f(%rip),%rdi
lea    0xdcf(%rip),%rsi
mov    $0x435,%edx
mov    $0x0,%al
call   1080 <my_err@plt>
jmp    12d1 <util_must_gzopen+0x161>
mov    -0x18(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<util_must_gzopen>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%r14
mov    0x2e53(%rip),%r12
mov    (%r12),%rbx
xor    %eax,%eax
call   1060 <zlibVersion@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11bf <util_must_gzopen+0x4f>
mov    (%r12),%rbx
xor    %eax,%eax
call   1060 <zlibVersion@plt>
lea    0xe4e(%rip),%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1090 <my_warn@plt>
lea    0xe79(%rip),%rsi
mov    %r15,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    1203 <util_must_gzopen+0x93>
lea    0xe68(%rip),%rsi
mov    %r14,%rdi
call   1030 <util_str_ends_with@plt>
test   %eax,%eax
jne    1203 <util_must_gzopen+0x93>
lea    0xe59(%rip),%rdi
lea    0xe9b(%rip),%rsi
mov    $0x428,%edx
mov    %r14,%rcx
xor    %eax,%eax
call   1090 <my_warn@plt>
mov    0x2dd6(%rip),%r12
movq   $0x0,(%r12)
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <gzopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1278 <util_must_gzopen+0x108>
mov    (%r12),%rdi
test   %rdi,%rdi
je     1258 <util_must_gzopen+0xe8>
call   1070 <strerror@plt>
lea    0xede(%rip),%rdi
lea    0xe4e(%rip),%rsi
mov    $0x432,%edx
mov    %r14,%rcx
mov    %r15,%r8
mov    %eax,%r9d
xor    %eax,%eax
call   1080 <my_err@plt>
jmp    1278 <util_must_gzopen+0x108>
lea    0xee9(%rip),%rdi
lea    0xe29(%rip),%rsi
mov    $0x435,%edx
mov    %r14,%rcx
mov    %r15,%r8
xor    %eax,%eax
call   1080 <my_err@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@ZLIB_VERSION = global i8* null
@.str = [63 x i8] c"zlib compilation (%s) and runtime (%s) versions do not match.\0A\00"
@.str.1 = [3 x i8] c"wb\00"
@.str.2 = [4 x i8] c".gz\00"
@.str.3 = [73 x i8] c"%s:%d: file '%s' does not end with '.gz' but opening with gzopen anyway\0A\00"
@.str.4 = [137 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bmvdgeijn/WASP/refs/heads/master/snp2h5/util.c\00"
@errno = global i64 0
@.str.5 = [48 x i8] c"%s:%d: error opening file '%s' in mode '%s': %s\00"
@.str.6 = [44 x i8] c"%s:%d: error opening file '%s' in mode '%s'\00"
define i32* @util_must_gzopen(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** @ZLIB_VERSION
%7 = call i8* (...) @zlibVersion()
%8 = call i64 @strcmp(i8* %6, i8* %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = load i8*, i8** @ZLIB_VERSION
%12 = call i8* (...) @zlibVersion()
%13 = call i32 (i8*, i8*, ...) @my_warn(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0), i8* %11, i8* %12)
br label %14
14: ; preds = %10, %2
%15 = load i8*, i8** %4
%16 = call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %25
18: ; preds = %14
%19 = load i8*, i8** %3
%20 = call i32 @util_str_ends_with(i8* %19, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%21 = icmp ne i32 %20, 0
br i1 %21, label %25, label %22
22: ; preds = %18
%23 = load i8*, i8** %3
%24 = call i32 (i8*, i8*, ...) @my_warn(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str.4, i64 0, i64 0), i32 1064, i8* %23)
br label %25
25: ; preds = %22, %18, %14
store i64 0, i64* @errno
%26 = load i8*, i8** %3
%27 = load i8*, i8** %4
%28 = call i32* @gzopen(i8* %26, i8* %27)
store i32* %28, i32** %5
%29 = load i32*, i32** %5
%30 = icmp eq i32* %29, null
br i1 %30, label %31, label %45
31: ; preds = %25
%32 = load i64, i64* @errno
%33 = icmp ne i64 %32, 0
br i1 %33, label %34, label %40
34: ; preds = %31
%35 = load i8*, i8** %3
%36 = load i8*, i8** %4
%37 = load i64, i64* @errno
%38 = call i32 @strerror(i64 %37)
%39 = call i32 (i8*, i8*, i32, i8*, i8*, ...) @my_err(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str.4, i64 0, i64 0), i32 1074, i8* %35, i8* %36, i32 %38)
br label %44
40: ; preds = %31
%41 = load i8*, i8** %3
%42 = load i8*, i8** %4
%43 = call i32 (i8*, i8*, i32, i8*, i8*, ...) @my_err(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str.4, i64 0, i64 0), i32 1077, i8* %41, i8* %42)
br label %44
44: ; preds = %40, %34
br label %45
45: ; preds = %44, %25
%46 = load i32*, i32** %5
ret i32* %46
}

LLVM IR (-O2):
@ZLIB_VERSION = global i8* null
@.str = [63 x i8] c"zlib compilation (%s) and runtime (%s) versions do not match.\0A\00"
@.str.1 = [3 x i8] c"wb\00"
@.str.2 = [4 x i8] c".gz\00"
@.str.3 = [73 x i8] c"%s:%d: file '%s' does not end with '.gz' but opening with gzopen anyway\0A\00"
@.str.4 = [137 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bmvdgeijn/WASP/refs/heads/master/snp2h5/util.c\00"
@errno = global i64 0
@.str.5 = [48 x i8] c"%s:%d: error opening file '%s' in mode '%s': %s\00"
@.str.6 = [44 x i8] c"%s:%d: error opening file '%s' in mode '%s'\00"
define i32* @util_must_gzopen(i8* %0, i8* %1) {
%3 = load i8*, i8** @ZLIB_VERSION
%4 = tail call i8* (...) @zlibVersion()
%5 = tail call i64 @strcmp(i8* %3, i8* %4)
%6 = icmp eq i64 %5, 0
br i1 %6, label %11, label %7
7: ; preds = %2
%8 = load i8*, i8** @ZLIB_VERSION
%9 = tail call i8* (...) @zlibVersion()
%10 = tail call i32 (i8*, i8*, ...) @my_warn(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %9)
br label %11
11: ; preds = %7, %2
%12 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %11
%15 = tail call i32 @util_str_ends_with(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = tail call i32 (i8*, i8*, ...) @my_warn(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str.4, i64 0, i64 0), i32 1064, i8* %0)
br label %19
19: ; preds = %17, %14, %11
store i64 0, i64* @errno
%20 = tail call i32* @gzopen(i8* %0, i8* %1)
%21 = icmp eq i32* %20, null
br i1 %21, label %22, label %30
22: ; preds = %19
%23 = load i64, i64* @errno
%24 = icmp eq i64 %23, 0
br i1 %24, label %28, label %25
25: ; preds = %22
%26 = tail call i32 @strerror(i64 %23)
%27 = tail call i32 (i8*, i8*, i32, i8*, i8*, ...) @my_err(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str.4, i64 0, i64 0), i32 1074, i8* %0, i8* %1, i32 %26)
br label %30
28: ; preds = %22
%29 = tail call i32 (i8*, i8*, i32, i8*, i8*, ...) @my_err(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str.4, i64 0, i64 0), i32 1077, i8* %0, i8* %1)
br label %30
30: ; preds = %25, %28, %19
ret i32* %20
}