#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 */
int /*<<< orphan*/ Z_NULL;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ gzopen(char const *, char const *);
int /*<<< orphan*/ stderr;
gzFile getGz(const char *fname, const char *mode) {
  gzFile fp = Z_NULL;
  if (Z_NULL == (fp = gzopen(fname, mode))) {
    fprintf(stderr, "\t-> Error opening gzFile handle for file:%s exiting\n",
            fname);
    exit(0);
  }
  return fp;
}


x86 assembly (clang, -O0):
<getGz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e91(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    0x2e85(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <gzopen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
mov    %ecx,-0x14(%rbp)
cmp    %ecx,%eax
jne    1195 <getGz+0x65>
mov    0x2e64(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe77(%rip),%rsi
call   1030 <fprintf@plt>
xor    %edi,%edi
call   1050 <exit@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getGz>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2e9b(%rip),%rax
mov    (%rax),%ebp
call   1040 <gzopen@plt>
cmp    %eax,%ebp
je     114f <getGz+0x1f>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    0x2e8a(%rip),%rax
mov    (%rax),%edi
lea    0xea1(%rip),%rsi
mov    %rbx,%rdx
call   1030 <fprintf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@Z_NULL = global i32 0
@stderr = global i32 0
@.str = [53 x i8] c"\09-> Error opening gzFile handle for file:%s exiting\0A\00"
define i32 @getGz(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 i32, i32* @Z_NULL
store i32 %6, i32* %5
%7 = load i32, i32* @Z_NULL
%8 = load i8*, i8** %3
%9 = load i8*, i8** %4
%10 = call i32 @gzopen(i8* %8, i8* %9)
store i32 %10, i32* %5
%11 = icmp eq i32 %7, %10
br i1 %11, label %12, label %17
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = load i8*, i8** %3
%15 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = call i32 @exit(i32 0)
unreachable
17: ; preds = %2
%18 = load i32, i32* %5
ret i32 %18
}

LLVM IR (-O2):
@Z_NULL = global i32 0
@stderr = global i32 0
@.str = [53 x i8] c"\09-> Error opening gzFile handle for file:%s exiting\0A\00"
define i32 @getGz(i8* %0, i8* %1) {
%3 = load i32, i32* @Z_NULL
%4 = tail call i32 @gzopen(i8* %0, i8* %1)
%5 = icmp eq i32 %3, %4
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i8* %0)
%9 = tail call i32 @exit(i32 0)
unreachable
10: ; preds = %2
ret i32 %4
}