#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*/ my_err(char *, char *, int, char const *);
scalar_t__ util_file_exists(char const *);
int /*<<< orphan*/ util_must_gzopen(char const *, char *);
gzFile util_check_gzopen(const char *path) {
  if (util_file_exists(path)) {
    my_err("%s:%d: output file already exists: %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",
           1092, path);
  }
  return util_must_gzopen(path, "wb");
}


x86 assembly (clang, -O0):
<util_check_gzopen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <util_file_exists@plt>
cmp    $0x0,%rax
je     116b <util_check_gzopen+0x3b>
mov    -0x8(%rbp),%rcx
lea    0xea6(%rip),%rdi
lea    0xec5(%rip),%rsi
mov    $0x444,%edx
call   1050 <my_err@plt>
mov    -0x8(%rbp),%rdi
lea    0xf39(%rip),%rsi
call   1040 <util_must_gzopen@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<util_check_gzopen>:
push   %rbx
mov    %rdi,%rbx
call   1030 <util_file_exists@plt>
test   %rax,%rax
je     1159 <util_check_gzopen+0x29>
lea    0xebb(%rip),%rdi
lea    0xeda(%rip),%rsi
mov    $0x444,%edx
mov    %rbx,%rcx
call   1050 <my_err@plt>
lea    0xf4f(%rip),%rsi
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <util_must_gzopen@plt>

LLVM IR (-O0):
@.str = [38 x i8] c"%s:%d: output file already exists: %s\00"
@.str.1 = [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"
@.str.2 = [3 x i8] c"wb\00"
define i32 @util_check_gzopen(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @util_file_exists(i8* %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i32 @my_err(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str.1, i64 0, i64 0), i32 1092, i8* %7)
br label %9
9: ; preds = %6, %1
%10 = load i8*, i8** %2
%11 = call i32 @util_must_gzopen(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
ret i32 %11
}

LLVM IR (-O2):
@.str = [38 x i8] c"%s:%d: output file already exists: %s\00"
@.str.1 = [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"
@.str.2 = [3 x i8] c"wb\00"
define i32 @util_check_gzopen(i8* %0) {
%2 = tail call i64 @util_file_exists(i8* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @my_err(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str.1, i64 0, i64 0), i32 1092, i8* %0)
br label %6
6: ; preds = %4, %1
%7 = tail call i32 @util_must_gzopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
ret i32 %7
}