#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 */

/* Variables and functions */
int /*<<< orphan*/ abort_safe_block();
int /*<<< orphan*/ errno;
char *mktemp(char *);
scalar_t__ string_is_empty(char *);
int /*<<< orphan*/ tap_error_errno_at(char *, int /*<<< orphan*/, char *, int);
char *safe_mktemp(char *tmplate) {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
  char *filename = mktemp(tmplate);
#pragma GCC diagnostic pop
  if (string_is_empty(filename)) {
    tap_error_errno_at(
        ("mktemp()"), (errno),
        "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/picotm/picotm/refs/heads/master/tests/"
        "libsafeblk/safe_stdlib.c",
        87);
    abort_safe_block();
  }
  return filename;
}


x86 assembly (clang, -O0):
<safe_mktemp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <mktemp@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <string_is_empty@plt>
cmp    $0x0,%rax
je     1194 <safe_mktemp+0x54>
mov    0x2e6d(%rip),%rax
mov    (%rax),%esi
lea    0xe84(%rip),%rdi
lea    0xe86(%rip),%rdx
mov    $0x57,%ecx
call   1040 <tap_error_errno_at@plt>
mov    $0x0,%al
call   1030 <abort_safe_block@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<safe_mktemp>:
push   %rbx
call   1060 <mktemp@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <string_is_empty@plt>
test   %rax,%rax
je     117e <safe_mktemp+0x3e>
mov    0x2e83(%rip),%rax
mov    (%rax),%esi
lea    0xe9a(%rip),%rdi
lea    0xe9c(%rip),%rdx
mov    $0x57,%ecx
call   1040 <tap_error_errno_at@plt>
xor    %eax,%eax
call   1030 <abort_safe_block@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"mktemp()\00"
@errno = global i32 0
@.str.1 = [153 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/picotm/picotm/refs/heads/master/tests/libsafeblk/safe_stdlib.c\00"
define i8* @safe_mktemp(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @mktemp(i8* %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = call i64 @string_is_empty(i8* %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %1
%10 = load i32, i32* @errno
%11 = call i32 @tap_error_errno_at(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %10, i8* getelementptr inbounds ([153 x i8], [153 x i8]* @.str.1, i64 0, i64 0), i32 87)
%12 = call i32 (...) @abort_safe_block()
br label %13
13: ; preds = %9, %1
%14 = load i8*, i8** %3
ret i8* %14
}

LLVM IR (-O2):
@.str = [9 x i8] c"mktemp()\00"
@errno = global i32 0
@.str.1 = [153 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/picotm/picotm/refs/heads/master/tests/libsafeblk/safe_stdlib.c\00"
define i8* @safe_mktemp(i8* %0) {
%2 = tail call i8* @mktemp(i8* %0)
%3 = tail call i64 @string_is_empty(i8* %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %9, label %5
5: ; preds = %1
%6 = load i32, i32* @errno
%7 = tail call i32 @tap_error_errno_at(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %6, i8* getelementptr inbounds ([153 x i8], [153 x i8]* @.str.1, i64 0, i64 0), i32 87)
%8 = tail call i32 (...) @abort_safe_block()
br label %9
9: ; preds = %5, %1
ret i8* %2
}