#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 */
scalar_t__ Z_OK;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ gzclose(int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void fastq_close(gzFile fd) {
  if (gzclose(fd) != Z_OK) {
    {
      fprintf(stderr, "\nERROR: ");
      fprintf(stderr, "unable to close file descriptor");
      fprintf(stderr, "\n");
    };
    exit(2);
  }
}


x86 assembly (clang, -O0):
<fastq_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <gzclose@plt>
mov    0x2ea6(%rip),%rcx
cmp    (%rcx),%rax
je     119c <fastq_close+0x6c>
mov    0x2e7e(%rip),%rax
mov    (%rax),%edi
lea    0xe9d(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
lea    0xe91(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e54(%rip),%rax
mov    (%rax),%edi
lea    0xe9c(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x2,%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fastq_close>:
push   %rbx
call   1030 <gzclose@plt>
mov    0x2eb3(%rip),%rcx
cmp    (%rcx),%rax
jne    1144 <fastq_close+0x14>
pop    %rbx
ret
mov    0x2e8d(%rip),%rbx
mov    (%rbx),%edi
lea    0xeac(%rip),%rsi
call   1040 <fprintf@plt>
mov    (%rbx),%edi
lea    0xea7(%rip),%rsi
call   1040 <fprintf@plt>
mov    (%rbx),%edi
lea    0xeb9(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x2,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@Z_OK = global i64 0
@stderr = global i32 0
@.str = [9 x i8] c"\0AERROR: \00"
@.str.1 = [32 x i8] c"unable to close file descriptor\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @fastq_close(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @gzclose(i32 %3)
%5 = load i64, i64* @Z_OK
%6 = icmp ne i64 %4, %5
br i1 %6, label %7, label %15
7: ; preds = %1
%8 = load i32, i32* @stderr
%9 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* @stderr
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 @exit(i32 2)
unreachable
15: ; preds = %1
ret void
}

LLVM IR (-O2):
@Z_OK = global i64 0
@stderr = global i32 0
@.str = [9 x i8] c"\0AERROR: \00"
@.str.1 = [32 x i8] c"unable to close file descriptor\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @fastq_close(i32 %0) {
%2 = tail call i64 @gzclose(i32 %0)
%3 = load i64, i64* @Z_OK
%4 = icmp eq i64 %2, %3
br i1 %4, label %13, label %5
5: ; preds = %1
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%10 = load i32, i32* @stderr
%11 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%12 = tail call i32 @exit(i32 2)
unreachable
13: ; preds = %1
ret void
}