#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);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
size_t strlen(char *);
char *C_mkKindC(char *kindTab) {
  size_t length =
      strlen("/****************************************************************"
             "************/\n/*   PERVASIVE KIND                               "
             "                          */ "
             "\n/"
             "*****************************************************************"
             "***********/ \n") +
      strlen(kindTab) +
      strlen(
          "PERV_KindData PERV_getKindData(int index)                           "
          "          \n{                                                       "
          "                       \n    return PERV_kindDataTab[index];        "
          "                                    \n}                             "
          "                                               \n\n") +
      strlen("void PERV_copyKindDataTab(PERV_KindData* dst)                    "
             "             \n{                                                 "
             "                             \n    //this way of copy relies on "
             "the assumption that the pervasive kind data   \n    //has the "
             "same structure as that of the run-time kind symbol table "
             "entries.\n    memcpy((void*)dst, (void*)PERV_kindDataTab,        "
             "                        \n           sizeof(PERV_KindData) * "
             "PERV_KIND_NUM);                             \n}                  "
             "                                                          \n\n");
  char *kindC = UTIL_mallocStr(length);
  strcpy(kindC, "/*************************************************************"
                "***************/\n/*   PERVASIVE KIND                         "
                "                                */ "
                "\n/"
                "**************************************************************"
                "**************/ \n");
  strcat(kindC, kindTab);
  strcat(kindC,
         "PERV_KindData PERV_getKindData(int index)                            "
         "         \n{                                                         "
         "                     \n    return PERV_kindDataTab[index];           "
         "                                 \n}                                 "
         "                                           \n\n");
  strcat(kindC,
         "void PERV_copyKindDataTab(PERV_KindData* dst)                        "
         "         \n{                                                         "
         "                     \n    //this way of copy relies on the "
         "assumption that the pervasive kind data   \n    //has the same "
         "structure as that of the run-time kind symbol table entries.\n    "
         "memcpy((void*)dst, (void*)PERV_kindDataTab,                          "
         "      \n           sizeof(PERV_KindData) * PERV_KIND_NUM);           "
         "                  \n}                                                "
         "                            \n\n");
  return kindC;
}


x86 assembly (clang, -O0):
<C_mkKindC>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xead(%rip),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
lea    0xf76(%rip),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
lea    0x109b(%rip),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <UTIL_mallocStr@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe41(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1060 <strcat@plt>
mov    -0x18(%rbp),%rdi
lea    0xf14(%rip),%rsi
call   1060 <strcat@plt>
mov    -0x18(%rbp),%rdi
lea    0x1043(%rip),%rsi
call   1060 <strcat@plt>
mov    -0x18(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<C_mkKindC>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x45b(%rax),%rdi
call   1050 <UTIL_mallocStr@plt>
mov    %rax,%rbx
lea    0xe9e(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <strcat@plt>
lea    0xf74(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcat@plt>
lea    0x10a4(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcat@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [240 x i8] c"/****************************************************************************/\0A/* PERVASIVE KIND */ \0A/****************************************************************************/ \0A\00"
@.str.1 = [319 x i8] c"PERV_KindData PERV_getKindData(int index) \0A{ \0A return PERV_kindDataTab[index]; \0A} \0A\0A\00"
@.str.2 = [559 x i8] c"void PERV_copyKindDataTab(PERV_KindData* dst) \0A{ \0A //this way of copy relies on the assumption that the pervasive kind data \0A //has the same structure as that of the run-time kind symbol table entries.\0A memcpy((void*)dst, (void*)PERV_kindDataTab, \0A sizeof(PERV_KindData) * PERV_KIND_NUM); \0A} \0A\0A\00"
define i8* @C_mkKindC(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8*
store i8* %0, i8** %2
%5 = call i64 @strlen(i8* getelementptr inbounds ([240 x i8], [240 x i8]* @.str, i64 0, i64 0))
%6 = load i8*, i8** %2
%7 = call i64 @strlen(i8* %6)
%8 = add i64 %5, %7
%9 = call i64 @strlen(i8* getelementptr inbounds ([319 x i8], [319 x i8]* @.str.1, i64 0, i64 0))
%10 = add i64 %8, %9
%11 = call i64 @strlen(i8* getelementptr inbounds ([559 x i8], [559 x i8]* @.str.2, i64 0, i64 0))
%12 = add i64 %10, %11
store i64 %12, i64* %3
%13 = load i64, i64* %3
%14 = call i8* @UTIL_mallocStr(i64 %13)
store i8* %14, i8** %4
%15 = load i8*, i8** %4
%16 = call i32 @strcpy(i8* %15, i8* getelementptr inbounds ([240 x i8], [240 x i8]* @.str, i64 0, i64 0))
%17 = load i8*, i8** %4
%18 = load i8*, i8** %2
%19 = call i32 @strcat(i8* %17, i8* %18)
%20 = load i8*, i8** %4
%21 = call i32 @strcat(i8* %20, i8* getelementptr inbounds ([319 x i8], [319 x i8]* @.str.1, i64 0, i64 0))
%22 = load i8*, i8** %4
%23 = call i32 @strcat(i8* %22, i8* getelementptr inbounds ([559 x i8], [559 x i8]* @.str.2, i64 0, i64 0))
%24 = load i8*, i8** %4
ret i8* %24
}

LLVM IR (-O2):
@.str = [240 x i8] c"/****************************************************************************/\0A/* PERVASIVE KIND */ \0A/****************************************************************************/ \0A\00"
@.str.1 = [319 x i8] c"PERV_KindData PERV_getKindData(int index) \0A{ \0A return PERV_kindDataTab[index]; \0A} \0A\0A\00"
@.str.2 = [559 x i8] c"void PERV_copyKindDataTab(PERV_KindData* dst) \0A{ \0A //this way of copy relies on the assumption that the pervasive kind data \0A //has the same structure as that of the run-time kind symbol table entries.\0A memcpy((void*)dst, (void*)PERV_kindDataTab, \0A sizeof(PERV_KindData) * PERV_KIND_NUM); \0A} \0A\0A\00"
define i8* @C_mkKindC(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add i64 %2, 1115
%4 = tail call i8* @UTIL_mallocStr(i64 %3)
%5 = tail call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([240 x i8], [240 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @strcat(i8* %4, i8* %0)
%7 = tail call i32 @strcat(i8* %4, i8* getelementptr inbounds ([319 x i8], [319 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 @strcat(i8* %4, i8* getelementptr inbounds ([559 x i8], [559 x i8]* @.str.2, i64 0, i64 0))
ret i8* %4
}