#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*/ free(char *);
char *malloc(int);
char *script_config_get_dir();
int /*<<< orphan*/ snprintf(char *, int, char *, char *);
int strlen(char *);
char *script_config_get_xml_filename() {
  char *path, *filename;
  int length;
  path = script_config_get_dir();
  length = strlen(path) + 64;
  filename = malloc(length);
  if (filename)
    snprintf(filename, length, "%s/plugins.xml.gz", path);
  free(path);
  return filename;
}


x86 assembly (clang, -O0):
<script_config_get_xml_filename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1040 <script_config_get_dir@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
add    $0x40,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1070 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11a0 <script_config_get_xml_filename+0x50>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x8(%rbp),%rcx
lea    0xe65(%rip),%rdx
call   1060 <snprintf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<script_config_get_xml_filename>:
push   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
call   1040 <script_config_get_dir@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1050 <strlen@plt>
mov    %eax,%ebp
add    $0x40,%ebp
mov    %ebp,%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     118e <script_config_get_xml_filename+0x3e>
lea    0xe7f(%rip),%rdx
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14,%rcx
call   1060 <snprintf@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [18 x i8] c"%s/plugins.xml.gz\00"
define i8* @script_config_get_xml_filename() {
%1 = tail call i8* (...) @script_config_get_dir()
%2 = tail call i32 @strlen(i8* %1)
%3 = add nsw i32 %2, 64
%4 = tail call i8* @malloc(i32 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %0
%7 = tail call i32 @snprintf(i8* %4, i32 %3, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %1)
br label %8
8: ; preds = %6, %0
%9 = tail call i32 @free(i8* %1)
ret i8* %4
}