#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 */
scalar_t__ mkdtemp(char *);
int /*<<< orphan*/ strcat(char *, char *);
int strlen(char *);
int pyi_test_temp_path(char *buff) {
  if (buff[strlen(buff) - 1] != '/') {
    strcat(buff, "/");
  }
  strcat(buff, "_MEIXXXXXX");
  if (mkdtemp(buff)) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<pyi_test_temp_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2f,%eax
je     1176 <pyi_test_temp_path+0x46>
mov    -0x10(%rbp),%rdi
lea    0xe8f(%rip),%rsi
call   1050 <strcat@plt>
mov    -0x10(%rbp),%rdi
lea    0xe81(%rip),%rsi
call   1050 <strcat@plt>
mov    -0x10(%rbp),%rdi
call   1040 <mkdtemp@plt>
cmp    $0x0,%rax
je     11a5 <pyi_test_temp_path+0x75>
movl   $0x1,-0x4(%rbp)
jmp    11ac <pyi_test_temp_path+0x7c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pyi_test_temp_path>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
cltq
cmpb   $0x2f,-0x1(%rax,%rbx,1)
je     1151 <pyi_test_temp_path+0x21>
lea    0xeb7(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcat@plt>
lea    0xeaa(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcat@plt>
mov    %rbx,%rdi
call   1040 <mkdtemp@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"/\00"
@.str.1 = [11 x i8] c"_MEIXXXXXX\00"
define i32 @pyi_test_temp_path(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @strlen(i8* %5)
%7 = sub nsw i32 %6, 1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %4, i64 %8
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 47
br i1 %12, label %13, label %16
13: ; preds = %1
%14 = load i8*, i8** %3
%15 = call i32 @strcat(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %16
16: ; preds = %13, %1
%17 = load i8*, i8** %3
%18 = call i32 @strcat(i8* %17, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%19 = load i8*, i8** %3
%20 = call i64 @mkdtemp(i8* %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %16
store i32 1, i32* %2
br label %24
23: ; preds = %16
store i32 0, i32* %2
br label %24
24: ; preds = %23, %22
%25 = load i32, i32* %2
ret i32 %25
}

LLVM IR (-O2):
@.str = [2 x i8] c"/\00"
@.str.1 = [11 x i8] c"_MEIXXXXXX\00"
define i32 @pyi_test_temp_path(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, -1
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 47
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %1
%11 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%12 = tail call i64 @mkdtemp(i8* %0)
%13 = icmp ne i64 %12, 0
%14 = zext i1 %13 to i32
ret i32 %14
}