#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*/ 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);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x13(%rbp)
mov    0xec8(%rip),%eax
mov    %eax,-0xb(%rbp)
mov    0xec2(%rip),%ax
mov    %ax,-0x7(%rbp)
mov    0xeba(%rip),%al
mov    %al,-0x5(%rbp)
lea    0xea2(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
lea    -0x13(%rbp),%rdi
call   1040 <make_temp@plt>
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1040 <make_temp@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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    0xeb7(%rip),%rbx
lea    0xebf(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rdi
call   1040 <make_temp@plt>
lea    0xecf(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1040 <make_temp@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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)
ret i32 0
}

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))
ret i32 0
}