#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 *UTIL_mallocStr(size_t);
char *UTIL_upperCase(char *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
size_t strlen(char *);
char *C_mkIndexName(char *name) {
  char *nameUC = UTIL_upperCase(name);
  size_t length = strlen(nameUC) + strlen("PERV_") + strlen("_INDEX");
  char *indexName = UTIL_mallocStr(length);
  strcpy(indexName, "PERV_");
  strcat(indexName, nameUC);
  free(nameUC);
  strcat(indexName, "_INDEX");
  return indexName;
}


x86 assembly (clang, -O0):
<C_mkIndexName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <UTIL_upperCase@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,-0x30(%rbp)
lea    0xe73(%rip),%rdi
call   1050 <strlen@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
lea    0xe5f(%rip),%rdi
call   1050 <strlen@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1070 <UTIL_mallocStr@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe2e(%rip),%rsi
call   1040 <strcpy@plt>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1080 <strcat@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
lea    0xe0e(%rip),%rsi
call   1080 <strcat@plt>
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<C_mkIndexName>:
push   %r14
push   %rbx
push   %rax
call   1060 <UTIL_upperCase@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1050 <strlen@plt>
lea    0xb(%rax),%rdi
call   1070 <UTIL_mallocStr@plt>
mov    %rax,%rbx
lea    0xe79(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1080 <strcat@plt>
mov    %r14,%rdi
call   1030 <free@plt>
lea    0xe5d(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcat@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [6 x i8] c"PERV_\00"
@.str.1 = [7 x i8] c"_INDEX\00"
define i8* @C_mkIndexName(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = call i8* @UTIL_upperCase(i8* %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = call i64 @strlen(i8* %8)
%10 = call i64 @strlen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%11 = add i64 %9, %10
%12 = call i64 @strlen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%13 = add i64 %11, %12
store i64 %13, i64* %4
%14 = load i64, i64* %4
%15 = call i8* @UTIL_mallocStr(i64 %14)
store i8* %15, i8** %5
%16 = load i8*, i8** %5
%17 = call i32 @strcpy(i8* %16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%18 = load i8*, i8** %5
%19 = load i8*, i8** %3
%20 = call i32 @strcat(i8* %18, i8* %19)
%21 = load i8*, i8** %3
%22 = call i32 @free(i8* %21)
%23 = load i8*, i8** %5
%24 = call i32 @strcat(i8* %23, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%25 = load i8*, i8** %5
ret i8* %25
}

LLVM IR (-O2):
@.str = [6 x i8] c"PERV_\00"
@.str.1 = [7 x i8] c"_INDEX\00"
define i8* @C_mkIndexName(i8* %0) {
%2 = tail call i8* @UTIL_upperCase(i8* %0)
%3 = tail call i64 @strlen(i8* dereferenceable(1) %2)
%4 = add i64 %3, 11
%5 = tail call i8* @UTIL_mallocStr(i64 %4)
%6 = tail call i32 @strcpy(i8* %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @strcat(i8* %5, i8* %2)
%8 = tail call i32 @free(i8* %2)
%9 = tail call i32 @strcat(i8* %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
ret i8* %5
}