#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ make_temp(char *);
int /*<<< orphan*/ printf(char *);
int main(void) {
  char good_template[] = "/tmp/dirXXXXXX";
  char *bad_template = "/tmp/dirXXXXXX";
  printf("trying to create first temp file...\n");
  make_temp(good_template);
  printf("trying to create second temp file...\n");
  make_temp(bad_template);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x13(%rbp)
mov    0xeb8(%rip),%eax
mov    %eax,-0xb(%rbp)
mov    0xeb2(%rip),%ax
mov    %ax,-0x7(%rbp)
mov    0xeaa(%rip),%al
mov    %al,-0x5(%rbp)
lea    0xe92(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
lea    -0x13(%rbp),%rdi
call   1050 <make_temp@plt>
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1050 <make_temp@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movabs $0x58585858585872,%rax
mov    %rax,0x7(%rsp)
movabs $0x7269642f706d742f,%rax
64 69 72
mov    %rax,(%rsp)
lea    0xea7(%rip),%rbx
lea    0xeaf(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rdi
call   1050 <make_temp@plt>
lea    0xebf(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1050 <make_temp@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@__const.main.good_template = [15 x i8] c"/tmp/dirXXXXXX\00"
@.str = [15 x i8] c"/tmp/dirXXXXXX\00"
@.str.1 = [37 x i8] c"trying to create first temp file...\0A\00"
@.str.2 = [38 x i8] c"trying to create second temp file...\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [15 x i8]
%3 = alloca i8*
store i32 0, i32* %1
%4 = bitcast [15 x i8]* %2 to i8*
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8** %3
%5 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
%6 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%7 = call i32 @make_temp(i8* %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0))
%9 = load i8*, i8** %3
%10 = call i32 @make_temp(i8* %9)
%11 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [15 x i8] c"/tmp/dirXXXXXX\00"
@str = [36 x i8] c"trying to create first temp file...\00"
@str.3 = [37 x i8] c"trying to create second temp file...\00"
define i32 @main() {
%1 = alloca [15 x i8]
%2 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
%4 = call i32 @make_temp(i8* %2)
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.3, i64 0, i64 0))
%6 = call i32 @make_temp(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @exit(i32 0)
unreachable
}