#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*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ *mktemp(char *);
int /*<<< orphan*/ sprintf(char *, char *);
int /*<<< orphan*/ stderr;
int open_iso(const char *path) {
  int ret = 0;
  char template[256] = {'\0'};
  sprintf(template, "/tmp/ISO-XXXXXX");
  if (mktemp(template) == NULL) {
    fprintf(stderr, "ERROR: failed to make temporaty filename!\n");
    ret = -1;
    goto end;
  }
end:
  return ret;
}


x86 assembly (clang, -O0):
<open_iso>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    -0x110(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1030 <memset@plt>
lea    -0x110(%rbp),%rdi
lea    0xe89(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x110(%rbp),%rdi
call   1060 <mktemp@plt>
cmp    $0x0,%rax
jne    11b3 <open_iso+0x73>
mov    0x2e47(%rip),%rax
mov    (%rax),%edi
lea    0xe6e(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0xffffffff,-0xc(%rbp)
jmp    11b8 <open_iso+0x78>
jmp    11b8 <open_iso+0x78>
mov    -0xc(%rbp),%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<open_iso>:
sub    $0x108,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movups 0xe6c(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
call   1040 <mktemp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
je     11b2 <open_iso+0x92>
add    $0x108,%rsp
ret
mov    0x2e27(%rip),%rax
mov    (%rax),%edi
lea    0xe4e(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%eax
add    $0x108,%rsp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"/tmp/ISO-XXXXXX\00"
@stderr = global i32 0
@.str.1 = [43 x i8] c"ERROR: failed to make temporaty filename!\0A\00"
define i32 @open_iso(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca [256 x i8]
store i8* %0, i8** %2
store i32 0, i32* %3
%5 = bitcast [256 x i8]* %4 to i8*
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%7 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%9 = call i32* @mktemp(i8* %8)
%10 = icmp eq i32* %9, null
br i1 %10, label %11, label %14
11: ; preds = %1
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
br label %15
14: ; preds = %1
br label %15
15: ; preds = %14, %11
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
@.str = [16 x i8] c"/tmp/ISO-XXXXXX\00"
@stderr = global i32 0
@.str.1 = [43 x i8] c"ERROR: failed to make temporaty filename!\0A\00"
define i32 @open_iso(i8* nocapture readnone %0) {
%2 = alloca [256 x i8]
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 16
%5 = call i32* @mktemp(i8* %3)
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i32, i32* @stderr
%9 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %1, %7
%11 = phi i32 [ -1, %7 ], [ 0, %1 ]
ret i32 %11
}