#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
char *gzerror(int /*<<< orphan*/, int *);
int gzputs(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void GZ_WRITE(gzFile fd, char *s) {
  int n = gzputs(fd, s);
  if (n > 0)
    return;
  if (*s == '\0')
    return;
  const char *errmsg = gzerror(fd, &n);
  {
    fprintf(stderr, "\nERROR: ");
    fprintf(stderr, "%s.\n", errmsg);
    fprintf(stderr, "\n");
  };
  exit(2);
}


x86 assembly (clang, -O0):
<GZ_WRITE>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <gzputs@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    116d <GZ_WRITE+0x2d>
jmp    11e5 <GZ_WRITE+0xa5>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1182 <GZ_WRITE+0x42>
jmp    11e5 <GZ_WRITE+0xa5>
mov    -0x4(%rbp),%edi
lea    -0x14(%rbp),%rsi
call   1050 <gzerror@plt>
mov    %rax,-0x20(%rbp)
mov    0x2e47(%rip),%rax
mov    (%rax),%edi
lea    0xe5e(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e30(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xe4c(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e15(%rip),%rax
mov    (%rax),%edi
lea    0xe38(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    $0x2,%edi
call   1060 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GZ_WRITE>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
call   1040 <gzputs@plt>
mov    %eax,0x4(%rsp)
test   %eax,%eax
jg     115a <GZ_WRITE+0x1a>
cmpb   $0x0,(%rbx)
jne    1161 <GZ_WRITE+0x21>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0x4(%rsp),%rsi
mov    %ebp,%edi
call   1050 <gzerror@plt>
mov    %rax,%rbx
mov    0x2e69(%rip),%rbp
mov    0x0(%rbp),%edi
lea    0xe7f(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    0x0(%rbp),%edi
lea    0xe77(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    0x0(%rbp),%edi
lea    0xe66(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0x2,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [9 x i8] c"\0AERROR: \00"
@.str.1 = [5 x i8] c"%s.\0A\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @GZ_WRITE(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%7 = load i32, i32* %3
%8 = load i8*, i8** %4
%9 = call i32 @gzputs(i32 %7, i8* %8)
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %2
br label %30
13: ; preds = %2
%14 = load i8*, i8** %4
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %13
br label %30
19: ; preds = %13
%20 = load i32, i32* %3
%21 = call i8* @gzerror(i32 %20, i32* %5)
store i8* %21, i8** %6
%22 = load i32, i32* @stderr
%23 = call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%24 = load i32, i32* @stderr
%25 = load i8*, i8** %6
%26 = call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %25)
%27 = load i32, i32* @stderr
%28 = call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%29 = call i32 @exit(i32 2)
unreachable
30: ; preds = %18, %12
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [9 x i8] c"\0AERROR: \00"
@.str.1 = [5 x i8] c"%s.\0A\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @GZ_WRITE(i32 %0, i8* %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @gzputs(i32 %0, i8* %1)
store i32 %5, i32* %3
%6 = icmp sgt i32 %5, 0
br i1 %6, label %19, label %7
7: ; preds = %2
%8 = load i8, i8* %1
%9 = icmp eq i8 %8, 0
br i1 %9, label %19, label %10
10: ; preds = %7
%11 = call i8* @gzerror(i32 %0, i32* %3)
%12 = load i32, i32* @stderr
%13 = call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%14 = load i32, i32* @stderr
%15 = call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%16 = load i32, i32* @stderr
%17 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%18 = call i32 @exit(i32 2)
unreachable
19: ; preds = %7, %2
ret void
}