#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*/ gzclearerr(int /*<<< orphan*/);
int /*<<< orphan*/ gzclose(int /*<<< orphan*/);
char *gzerror(int /*<<< orphan*/, int *);
int /*<<< orphan*/ printf(char *, ...);
void testgzerr(gzFile file) {
  int errn;
  const char *error = gzerror(file, &errn);
  if (errn == 0)
    printf("gzerror(): %d:%s\n", errn, error);
  gzclearerr(file);
  error = gzerror(file, &errn);
  if (errn != 0)
    printf("gzclearerr(): Error\n");
  gzclose(file);
}


x86 assembly (clang, -O0):
<testgzerr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rsi
call   1060 <gzerror@plt>
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    117a <testgzerr+0x3a>
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x4(%rbp),%edi
call   1040 <gzclearerr@plt>
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rsi
call   1060 <gzerror@plt>
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     11aa <testgzerr+0x6a>
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x4(%rbp),%edi
call   1030 <gzclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testgzerr>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
lea    0xc(%rsp),%rsi
call   1070 <gzerror@plt>
cmpl   $0x0,0xc(%rsp)
jne    117b <testgzerr+0x2b>
lea    0xe91(%rip),%rdi
xor    %esi,%esi
mov    %rax,%rdx
xor    %eax,%eax
call   1060 <printf@plt>
mov    %ebx,%edi
call   1050 <gzclearerr@plt>
lea    0xc(%rsp),%rsi
mov    %ebx,%edi
call   1070 <gzerror@plt>
cmpl   $0x0,0xc(%rsp)
je     11a1 <testgzerr+0x51>
lea    0xe76(%rip),%rdi
call   1040 <puts@plt>
mov    %ebx,%edi
call   1030 <gzclose@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"gzerror(): %d:%s\0A\00"
@.str.1 = [21 x i8] c"gzclearerr(): Error\0A\00"
define void @testgzerr(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = call i8* @gzerror(i32 %5, i32* %3)
store i8* %6, i8** %4
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %1
%10 = load i32, i32* %3
%11 = load i8*, i8** %4
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %10, i8* %11)
br label %13
13: ; preds = %9, %1
%14 = load i32, i32* %2
%15 = call i32 @gzclearerr(i32 %14)
%16 = load i32, i32* %2
%17 = call i8* @gzerror(i32 %16, i32* %3)
store i8* %17, i8** %4
%18 = load i32, i32* %3
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %13
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %22
22: ; preds = %20, %13
%23 = load i32, i32* %2
%24 = call i32 @gzclose(i32 %23)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"gzerror(): %d:%s\0A\00"
@str = [20 x i8] c"gzclearerr(): Error\00"
define void @testgzerr(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i8* @gzerror(i32 %0, i32* %2)
%5 = load i32, i32* %2
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 0, i8* %4)
br label %9
9: ; preds = %7, %1
%10 = call i32 @gzclearerr(i32 %0)
%11 = call i8* @gzerror(i32 %0, i32* %2)
%12 = load i32, i32* %2
%13 = icmp eq i32 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %9
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
br label %16
16: ; preds = %14, %9
%17 = call i32 @gzclose(i32 %0)
ret void
}