#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 *C_mkEnum(char *, char *);
char *C_mkTypeDef(char *, char *);
char *UTIL_mallocStr(size_t);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
size_t strlen(char *);
char *C_mkKindIndexType(char *body) {
  char *enumText = C_mkEnum("PERV_KindIndexType", body);
  char *typeDefText = C_mkTypeDef(enumText, "PERV_KindIndexType");
  size_t length =
      strlen(typeDefText) +
      strlen("//indices for predefined sorts and type constructors\n");
  char *kindIndexType = UTIL_mallocStr(length);
  strcpy(kindIndexType,
         "//indices for predefined sorts and type constructors\n");
  strcat(kindIndexType, typeDefText);
  free(enumText);
  free(typeDefText);
  return kindIndexType;
}


x86 assembly (clang, -O0):
<C_mkKindIndexType>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xe79(%rip),%rdi
call   1090 <C_mkEnum@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe65(%rip),%rsi
call   1070 <C_mkTypeDef@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,-0x30(%rbp)
lea    0xe5b(%rip),%rdi
call   1050 <strlen@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1060 <UTIL_mallocStr@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xe30(%rip),%rsi
call   1040 <strcpy@plt>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1080 <strcat@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<C_mkKindIndexType>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rsi
lea    0xe81(%rip),%r14
mov    %r14,%rdi
call   1090 <C_mkEnum@plt>
mov    %rax,%r15
mov    %rax,%rdi
mov    %r14,%rsi
call   1070 <C_mkTypeDef@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1050 <strlen@plt>
lea    0x35(%rax),%rdi
call   1060 <UTIL_mallocStr@plt>
mov    %rax,%rbx
lea    0xe60(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1080 <strcat@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [19 x i8] c"PERV_KindIndexType\00"
@.str.1 = [54 x i8] c"//indices for predefined sorts and type constructors\0A\00"
define i8* @C_mkKindIndexType(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i8*
store i8* %0, i8** %2
%7 = load i8*, i8** %2
%8 = call i8* @C_mkEnum(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %7)
store i8* %8, i8** %3
%9 = load i8*, i8** %3
%10 = call i8* @C_mkTypeDef(i8* %9, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
store i8* %10, i8** %4
%11 = load i8*, i8** %4
%12 = call i64 @strlen(i8* %11)
%13 = call i64 @strlen(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0))
%14 = add i64 %12, %13
store i64 %14, i64* %5
%15 = load i64, i64* %5
%16 = call i8* @UTIL_mallocStr(i64 %15)
store i8* %16, i8** %6
%17 = load i8*, i8** %6
%18 = call i32 @strcpy(i8* %17, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0))
%19 = load i8*, i8** %6
%20 = load i8*, i8** %4
%21 = call i32 @strcat(i8* %19, i8* %20)
%22 = load i8*, i8** %3
%23 = call i32 @free(i8* %22)
%24 = load i8*, i8** %4
%25 = call i32 @free(i8* %24)
%26 = load i8*, i8** %6
ret i8* %26
}

LLVM IR (-O2):
@.str = [19 x i8] c"PERV_KindIndexType\00"
@.str.1 = [54 x i8] c"//indices for predefined sorts and type constructors\0A\00"
define i8* @C_mkKindIndexType(i8* %0) {
%2 = tail call i8* @C_mkEnum(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i8* @C_mkTypeDef(i8* %2, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%4 = tail call i64 @strlen(i8* dereferenceable(1) %3)
%5 = add i64 %4, 53
%6 = tail call i8* @UTIL_mallocStr(i64 %5)
%7 = tail call i32 @strcpy(i8* %6, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 @strcat(i8* %6, i8* %3)
%9 = tail call i32 @free(i8* %2)
%10 = tail call i32 @free(i8* %3)
ret i8* %6
}