#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 *getenv(char *);
scalar_t__ malloc(int);
char *strcat(char *, char *);
char *strcpy(char *, char *);
int strlen(char *);
char *extra_default_config_filename() {
  char *home_dir = NULL, *config_filename = NULL;
  int filename_len = 0;
  home_dir = getenv("HOME");
  filename_len = strlen(home_dir) + 22;
  config_filename = (char *)malloc(sizeof(char) * filename_len);
  config_filename = strcpy(config_filename, home_dir);
  config_filename = strcat(config_filename, "/.config/tint2/tint2rc");
  return config_filename;
}


x86 assembly (clang, -O0):
<extra_default_config_filename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movq   $0x0,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xe8a(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
add    $0x16,%eax
mov    %eax,-0x14(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <strcpy@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe48(%rip),%rsi
call   1070 <strcat@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extra_default_config_filename>:
push   %r14
push   %rbx
push   %rax
lea    0xeb5(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1050 <strlen@plt>
lea    0x16(%rax),%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
movabs $0x637232746e6974,%rcx
mov    %rcx,0xf(%rbx,%rax,1)
movups 0xe76(%rip),%xmm0
movups %xmm0,(%rbx,%rax,1)
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [5 x i8] c"HOME\00"
@.str.1 = [23 x i8] c"/.config/tint2/tint2rc\00"
define i8* @extra_default_config_filename() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i32
store i8* null, i8** %1
store i8* null, i8** %2
store i32 0, i32* %3
%4 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i8* %4, i8** %1
%5 = load i8*, i8** %1
%6 = call i32 @strlen(i8* %5)
%7 = add nsw i32 %6, 22
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = sext i32 %8 to i64
%10 = mul i64 1, %9
%11 = trunc i64 %10 to i32
%12 = call i64 @malloc(i32 %11)
%13 = inttoptr i64 %12 to i8*
store i8* %13, i8** %2
%14 = load i8*, i8** %2
%15 = load i8*, i8** %1
%16 = call i8* @strcpy(i8* %14, i8* %15)
store i8* %16, i8** %2
%17 = load i8*, i8** %2
%18 = call i8* @strcat(i8* %17, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
store i8* %18, i8** %2
%19 = load i8*, i8** %2
ret i8* %19
}

LLVM IR (-O2):
@.str = [5 x i8] c"HOME\00"
@.str.1 = [23 x i8] c"/.config/tint2/tint2rc\00"
define i8* @extra_default_config_filename() {
%1 = tail call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @strlen(i8* %1)
%3 = add nsw i32 %2, 22
%4 = tail call i64 @malloc(i32 %3)
%5 = inttoptr i64 %4 to i8*
%6 = tail call i8* @strcpy(i8* dereferenceable(1) %5, i8* dereferenceable(1) %1)
%7 = tail call i64 bitcast (i32 (i8*)* @strlen to i64 (i8*)*)(i8* %5)
%8 = getelementptr i8, i8* %5, i64 %7
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(23) %8, i8* align 1 dereferenceable(23) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i64 23, i1 false)
ret i8* %5
}