#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_table_name(char *, char *);
int /*<<< orphan*/ piece(char *, char, char *, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
char *strdup(char *);
char *get_full_attribute_name(char *application_name, char *folder_name,
                              char *attribute_name) {
  char full_attribute_name[512];
  if (folder_name && *folder_name) {
    char tmp[512];
    piece(tmp, ',', folder_name, 0);
    sprintf(full_attribute_name, "%s.%s", get_table_name(application_name, tmp),
            attribute_name);
  } else {
    strcpy(full_attribute_name, attribute_name);
  }
  return strdup(full_attribute_name);
}


x86 assembly (clang, -O0):
<get_full_attribute_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11d6 <get_full_attribute_name+0x86>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11d6 <get_full_attribute_name+0x86>
lea    -0x420(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x2c,%esi
xor    %ecx,%ecx
call   1060 <piece@plt>
lea    -0x220(%rbp),%rax
mov    %rax,-0x428(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x420(%rbp),%rsi
call   1040 <get_table_name@plt>
mov    -0x428(%rbp),%rdi
mov    %rax,%rdx
mov    -0x18(%rbp),%rcx
lea    0xe34(%rip),%rsi
call   1050 <sprintf@plt>
jmp    11e6 <get_full_attribute_name+0x96>
lea    -0x220(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x220(%rbp),%rdi
call   1070 <strdup@plt>
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_full_attribute_name>:
push   %r15
push   %r14
push   %rbx
sub    $0x400,%rsp
mov    %rdx,%rbx
test   %rsi,%rsi
je     11a8 <get_full_attribute_name+0x58>
mov    %rsi,%rdx
cmpb   $0x0,(%rsi)
je     11a8 <get_full_attribute_name+0x58>
mov    %rdi,%r14
lea    0x200(%rsp),%r15
mov    %r15,%rdi
mov    $0x2c,%esi
xor    %ecx,%ecx
call   1060 <piece@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <get_table_name@plt>
lea    0xe68(%rip),%rsi
mov    %rsp,%rdi
mov    %rax,%rdx
mov    %rbx,%rcx
call   1050 <sprintf@plt>
jmp    11b3 <get_full_attribute_name+0x63>
mov    %rsp,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    %rsp,%rdi
call   1070 <strdup@plt>
add    $0x400,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%s.%s\00"
define i8* @get_full_attribute_name(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca [512 x i8]
%8 = alloca [512 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %26
11: ; preds = %3
%12 = load i8*, i8** %5
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %26
16: ; preds = %11
%17 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 0
%18 = load i8*, i8** %5
%19 = call i32 @piece(i8* %17, i8 signext 44, i8* %18, i32 0)
%20 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%21 = load i8*, i8** %4
%22 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 0
%23 = call i8* @get_table_name(i8* %21, i8* %22)
%24 = load i8*, i8** %6
%25 = call i32 @sprintf(i8* %20, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %23, i8* %24)
br label %30
26: ; preds = %11, %3
%27 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%28 = load i8*, i8** %6
%29 = call i32 @strcpy(i8* %27, i8* %28)
br label %30
30: ; preds = %26, %16
%31 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%32 = call i8* @strdup(i8* %31)
ret i8* %32
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s.%s\00"
define noalias i8* @get_full_attribute_name(i8* %0, i8* %1, i8* %2) {
%4 = alloca [512 x i8]
%5 = alloca [512 x i8]
%6 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%7 = icmp eq i8* %1, null
br i1 %7, label %16, label %8
8: ; preds = %3
%9 = load i8, i8* %1
%10 = icmp eq i8 %9, 0
br i1 %10, label %16, label %11
11: ; preds = %8
%12 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%13 = call i32 @piece(i8* %12, i8 signext 44, i8* %1, i32 0)
%14 = call i8* @get_table_name(i8* %0, i8* %12)
%15 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %14, i8* %2)
br label %18
16: ; preds = %8, %3
%17 = call i32 @strcpy(i8* %6, i8* %2)
br label %18
18: ; preds = %16, %11
%19 = call i8* @strdup(i8* %6)
ret i8* %19
}