#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 *file_get_cache_home();
int /*<<< orphan*/ free(char *);
char *str_printf(char *, char *, char *, char const *);
char *_cache_file(const char *name) {
  char *cache_dir = file_get_cache_home();
  char *result;
  if (!cache_dir) {
    return NULL;
  }
  result = str_printf("%s"
                      "/"
                      "%s"
                      "/"
                      "%s",
                      cache_dir, "aacs", name);
  (free(cache_dir), cache_dir = NULL);
  return result;
}


x86 assembly (clang, -O0):
<_cache_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <file_get_cache_home@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    115f <_cache_file+0x2f>
movq   $0x0,-0x8(%rbp)
jmp    1197 <_cache_file+0x67>
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rcx
lea    0xe92(%rip),%rdi
lea    0xe94(%rip),%rdx
call   1050 <str_printf@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_cache_file>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %eax,%eax
call   1040 <file_get_cache_home@plt>
test   %rax,%rax
je     116f <_cache_file+0x3f>
mov    %rax,%rbx
lea    0xeb3(%rip),%rdi
lea    0xeb5(%rip),%rdx
mov    %rax,%rsi
mov    %r14,%rcx
call   1050 <str_printf@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rax
jmp    1171 <_cache_file+0x41>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%s/%s/%s\00"
@.str.1 = [5 x i8] c"aacs\00"
define i8* @_cache_file(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
%6 = call i8* (...) @file_get_cache_home()
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %10, label %9
9: ; preds = %1
store i8* null, i8** %2
br label %17
10: ; preds = %1
%11 = load i8*, i8** %4
%12 = load i8*, i8** %3
%13 = call i8* @str_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %12)
store i8* %13, i8** %5
%14 = load i8*, i8** %4
%15 = call i32 @free(i8* %14)
store i8* null, i8** %4
%16 = load i8*, i8** %5
store i8* %16, i8** %2
br label %17
17: ; preds = %10, %9
%18 = load i8*, i8** %2
ret i8* %18
}

LLVM IR (-O2):
@.str = [9 x i8] c"%s/%s/%s\00"
@.str.1 = [5 x i8] c"aacs\00"
define i8* @_cache_file(i8* %0) {
%2 = tail call i8* (...) @file_get_cache_home()
%3 = icmp eq i8* %2, null
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = tail call i8* @str_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%6 = tail call i32 @free(i8* %2)
br label %7
7: ; preds = %1, %4
%8 = phi i8* [ %5, %4 ], [ null, %1 ]
ret i8* %8
}