#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*/ d_assign(char *, char *);
int /*<<< orphan*/ d_doabort(char *, int, char *, char *);
int /*<<< orphan*/ free(char *);
char *tempnam(int /*<<< orphan*/ *, char *);
void generate_temp_file(char *filename) {
  char *name = (tempnam((NULL), ("make_doc_tmp.")));
  if (!name) {
    (d_doabort("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/tsteinholz/CPP-SRHS/refs/"
               "heads/master/Libraries/allegro5-5.1/docs/scripts/make_doc.c",
               182, ("could not generate temporary file name"), ("")));
  }
  d_assign(filename, name);
  free(name);
}


x86 assembly (clang, -O0):
<generate_temp_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xea9(%rip),%rsi
call   1050 <tempnam@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    118a <generate_temp_file+0x4a>
lea    0xe9c(%rip),%rdi
mov    $0xb6,%esi
lea    0xf3f(%rip),%rdx
lea    0xe88(%rip),%rcx
call   1040 <d_doabort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <d_assign@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generate_temp_file>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
lea    0xeb2(%rip),%rsi
xor    %edi,%edi
call   1050 <tempnam@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    117c <generate_temp_file+0x3c>
lea    0xeaa(%rip),%rdi
lea    0xf52(%rip),%rdx
lea    0xe9b(%rip),%rcx
mov    $0xb6,%esi
call   1040 <d_doabort@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <d_assign@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"make_doc_tmp.\00"
@.str.1 = [175 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/tsteinholz/CPP-SRHS/refs/heads/master/Libraries/allegro5-5.1/docs/scripts/make_doc.c\00"
@.str.2 = [39 x i8] c"could not generate temporary file name\00"
@.str.3 = [1 x i8] zeroinitializer
define void @generate_temp_file(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = call i8* @tempnam(i32* null, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
store i8* %4, i8** %3
%5 = load i8*, i8** %3
%6 = icmp ne i8* %5, null
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = call i32 @d_doabort(i8* getelementptr inbounds ([175 x i8], [175 x i8]* @.str.1, i64 0, i64 0), i32 182, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
br label %9
9: ; preds = %7, %1
%10 = load i8*, i8** %2
%11 = load i8*, i8** %3
%12 = call i32 @d_assign(i8* %10, i8* %11)
%13 = load i8*, i8** %3
%14 = call i32 @free(i8* %13)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"make_doc_tmp.\00"
@.str.1 = [175 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/tsteinholz/CPP-SRHS/refs/heads/master/Libraries/allegro5-5.1/docs/scripts/make_doc.c\00"
@.str.2 = [39 x i8] c"could not generate temporary file name\00"
@.str.3 = [1 x i8] zeroinitializer
define void @generate_temp_file(i8* %0) {
%2 = tail call i8* @tempnam(i32* null, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @d_doabort(i8* getelementptr inbounds ([175 x i8], [175 x i8]* @.str.1, i64 0, i64 0), i32 182, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
%7 = tail call i32 @d_assign(i8* %0, i8* %2)
%8 = tail call i32 @free(i8* %2)
ret void
}