#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 */
char *__get_home_dir();
char *malloc(scalar_t__);
char *strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
char *__psh_history_path() {
  char *home;
  char *path;
  home = __get_home_dir();
  path = malloc(strlen(home) + 14);
  if (!path)
    return NULL;
  strcpy(path, home);
  path = strcat(path, "/.psh_history");
  return path;
}


x86 assembly (clang, -O0):
<__psh_history_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1060 <__get_home_dir@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0xe,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1194 <__psh_history_path+0x44>
movq   $0x0,-0x8(%rbp)
jmp    11bd <__psh_history_path+0x6d>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rdi
lea    0xe54(%rip),%rsi
call   1070 <strcat@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__psh_history_path>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1060 <__get_home_dir@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1040 <strlen@plt>
lea    0xe(%rax),%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1197 <__psh_history_path+0x57>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
movabs $0x69685f6873702e2f,%rcx
5f 68 69
mov    %rcx,(%rbx,%rax,1)
movabs $0x79726f74736968,%rcx
mov    %rcx,0x6(%rbx,%rax,1)
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [14 x i8] c"/.psh_history\00"
define i8* @__psh_history_path() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i8*
%4 = call i8* (...) @__get_home_dir()
store i8* %4, i8** %2
%5 = load i8*, i8** %2
%6 = call i64 @strlen(i8* %5)
%7 = add nsw i64 %6, 14
%8 = call i8* @malloc(i64 %7)
store i8* %8, i8** %3
%9 = load i8*, i8** %3
%10 = icmp ne i8* %9, null
br i1 %10, label %12, label %11
11: ; preds = %0
store i8* null, i8** %1
br label %19
12: ; preds = %0
%13 = load i8*, i8** %3
%14 = load i8*, i8** %2
%15 = call i32 @strcpy(i8* %13, i8* %14)
%16 = load i8*, i8** %3
%17 = call i8* @strcat(i8* %16, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
store i8* %17, i8** %3
%18 = load i8*, i8** %3
store i8* %18, i8** %1
br label %19
19: ; preds = %12, %11
%20 = load i8*, i8** %1
ret i8* %20
}

LLVM IR (-O2):
@.str = [14 x i8] c"/.psh_history\00"
define i8* @__psh_history_path() {
%1 = tail call i8* (...) @__get_home_dir()
%2 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%3 = add nsw i64 %2, 14
%4 = tail call i8* @malloc(i64 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %10, label %6
6: ; preds = %0
%7 = tail call i32 @strcpy(i8* %4, i8* %1)
%8 = tail call i64 @strlen(i8* %4)
%9 = getelementptr i8, i8* %4, i64 %8
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(14) %9, i8* align 1 dereferenceable(14) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i64 14, i1 false)
br label %10
10: ; preds = %0, %6
ret i8* %4
}