#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_mkKindH(char *kindIndexType, char *numKinds) {
  size_t length =
      strlen("/****************************************************************"
             "************/\n/*   PERVASIVE KIND                               "
             "                          */ "
             "\n/"
             "*****************************************************************"
             "***********/ \n") +
      strlen(kindIndexType) + strlen(numKinds) +
      strlen("//pervasive kind data type                                       "
             "             \ntypedef struct                                    "
             "                             \n{                                 "
             "                                             \n    char         "
             "*name;                                                        \n "
             "   TwoBytes     arity;                                           "
             "             \n} PERV_KindData;                                  "
             "                           \n\n") +
      strlen("//pervasive kind data table (array)                              "
             "             \nextern PERV_KindData    "
             "PERV_kindDataTab[PERV_KIND_NUM];                     \n\n") +
      strlen("//pervasive kind data access function                            "
             "             \nPERV_KindData PERV_getKindData(int index);        "
             "                           \n\n") +
      strlen("//pervasive kind table copy function (used in module space "
             "initialization)    \n//this functiion relies on the assumption "
             "that the pervasive kind data         \n//has the same structure "
             "as that of the run-time kind symbol table entries.    \nvoid "
             "PERV_copyKindDataTab(PERV_KindData* dst);                        "
             "       \n\n");
  char *kindH = UTIL_mallocStr(length);
  strcpy(kindH, "/*************************************************************"
                "***************/\n/*   PERVASIVE KIND                         "
                "                                */ "
                "\n/"
                "**************************************************************"
                "**************/ \n");
  strcat(kindH, kindIndexType);
  strcat(kindH, numKinds);
  strcat(
      kindH,
      "//pervasive kind data type                                              "
      "      \ntypedef struct                                                  "
      "               \n{                                                      "
      "                        \n    char         *name;                       "
      "                                 \n    TwoBytes     arity;              "
      "                                          \n} PERV_KindData;            "
      "                                                 \n\n");
  strcat(kindH, "//pervasive kind data table (array)                           "
                "                \nextern PERV_KindData    "
                "PERV_kindDataTab[PERV_KIND_NUM];                     \n\n");
  strcat(kindH, "//pervasive kind data access function                         "
                "                \nPERV_KindData PERV_getKindData(int index);  "
                "                                 \n\n");
  strcat(kindH, "//pervasive kind table copy function (used in module space "
                "initialization)    \n//this functiion relies on the "
                "assumption that the pervasive kind data         \n//has the "
                "same structure as that of the run-time kind symbol table "
                "entries.    \nvoid PERV_copyKindDataTab(PERV_KindData* dst);  "
                "                             \n\n");
  return kindH;
}


x86 assembly (clang, -O0):
<C_mkKindH>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea9(%rip),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x50(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x50(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x48(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
lea    0xf5b(%rip),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x40(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
lea    0x1120(%rip),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
lea    0x11a5(%rip),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
lea    0x122a(%rip),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <UTIL_mallocStr@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xdf2(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1060 <strcat@plt>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <strcat@plt>
mov    -0x20(%rbp),%rdi
lea    0xeb8(%rip),%rsi
call   1060 <strcat@plt>
mov    -0x20(%rbp),%rdi
lea    0x1087(%rip),%rsi
call   1060 <strcat@plt>
mov    -0x20(%rbp),%rdi
lea    0x1116(%rip),%rsi
call   1060 <strcat@plt>
mov    -0x20(%rbp),%rdi
lea    0x11a5(%rip),%rsi
call   1060 <strcat@plt>
mov    -0x20(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<C_mkKindH>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
call   1040 <strlen@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1040 <strlen@plt>
lea    (%rbx,%rax,1),%rdi
add    $0x547,%rdi
call   1050 <UTIL_mallocStr@plt>
mov    %rax,%rbx
lea    0xe8b(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <strcat@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <strcat@plt>
lea    0xf56(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcat@plt>
lea    0x1126(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcat@plt>
lea    0x11b6(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcat@plt>
lea    0x1246(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcat@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [240 x i8] c"/****************************************************************************/\0A/* PERVASIVE KIND */ \0A/****************************************************************************/ \0A\00"
@.str.1 = [479 x i8] c"//pervasive kind data type \0Atypedef struct \0A{ \0A char *name; \0A TwoBytes arity; \0A} PERV_KindData; \0A\0A\00"
@.str.2 = [159 x i8] c"//pervasive kind data table (array) \0Aextern PERV_KindData PERV_kindDataTab[PERV_KIND_NUM]; \0A\0A\00"
@.str.3 = [159 x i8] c"//pervasive kind data access function \0APERV_KindData PERV_getKindData(int index); \0A\0A\00"
@.str.4 = [319 x i8] c"//pervasive kind table copy function (used in module space initialization) \0A//this functiion relies on the assumption that the pervasive kind data \0A//has the same structure as that of the run-time kind symbol table entries. \0Avoid PERV_copyKindDataTab(PERV_KindData* dst); \0A\0A\00"
define i8* @C_mkKindH(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = call i64 @strlen(i8* getelementptr inbounds ([240 x i8], [240 x i8]* @.str, i64 0, i64 0))
%8 = load i8*, i8** %3
%9 = call i64 @strlen(i8* %8)
%10 = add i64 %7, %9
%11 = load i8*, i8** %4
%12 = call i64 @strlen(i8* %11)
%13 = add i64 %10, %12
%14 = call i64 @strlen(i8* getelementptr inbounds ([479 x i8], [479 x i8]* @.str.1, i64 0, i64 0))
%15 = add i64 %13, %14
%16 = call i64 @strlen(i8* getelementptr inbounds ([159 x i8], [159 x i8]* @.str.2, i64 0, i64 0))
%17 = add i64 %15, %16
%18 = call i64 @strlen(i8* getelementptr inbounds ([159 x i8], [159 x i8]* @.str.3, i64 0, i64 0))
%19 = add i64 %17, %18
%20 = call i64 @strlen(i8* getelementptr inbounds ([319 x i8], [319 x i8]* @.str.4, i64 0, i64 0))
%21 = add i64 %19, %20
store i64 %21, i64* %5
%22 = load i64, i64* %5
%23 = call i8* @UTIL_mallocStr(i64 %22)
store i8* %23, i8** %6
%24 = load i8*, i8** %6
%25 = call i32 @strcpy(i8* %24, i8* getelementptr inbounds ([240 x i8], [240 x i8]* @.str, i64 0, i64 0))
%26 = load i8*, i8** %6
%27 = load i8*, i8** %3
%28 = call i32 @strcat(i8* %26, i8* %27)
%29 = load i8*, i8** %6
%30 = load i8*, i8** %4
%31 = call i32 @strcat(i8* %29, i8* %30)
%32 = load i8*, i8** %6
%33 = call i32 @strcat(i8* %32, i8* getelementptr inbounds ([479 x i8], [479 x i8]* @.str.1, i64 0, i64 0))
%34 = load i8*, i8** %6
%35 = call i32 @strcat(i8* %34, i8* getelementptr inbounds ([159 x i8], [159 x i8]* @.str.2, i64 0, i64 0))
%36 = load i8*, i8** %6
%37 = call i32 @strcat(i8* %36, i8* getelementptr inbounds ([159 x i8], [159 x i8]* @.str.3, i64 0, i64 0))
%38 = load i8*, i8** %6
%39 = call i32 @strcat(i8* %38, i8* getelementptr inbounds ([319 x i8], [319 x i8]* @.str.4, i64 0, i64 0))
%40 = load i8*, i8** %6
ret i8* %40
}

LLVM IR (-O2):
@.str = [240 x i8] c"/****************************************************************************/\0A/* PERVASIVE KIND */ \0A/****************************************************************************/ \0A\00"
@.str.1 = [479 x i8] c"//pervasive kind data type \0Atypedef struct \0A{ \0A char *name; \0A TwoBytes arity; \0A} PERV_KindData; \0A\0A\00"
@.str.2 = [159 x i8] c"//pervasive kind data table (array) \0Aextern PERV_KindData PERV_kindDataTab[PERV_KIND_NUM]; \0A\0A\00"
@.str.3 = [159 x i8] c"//pervasive kind data access function \0APERV_KindData PERV_getKindData(int index); \0A\0A\00"
@.str.4 = [319 x i8] c"//pervasive kind table copy function (used in module space initialization) \0A//this functiion relies on the assumption that the pervasive kind data \0A//has the same structure as that of the run-time kind symbol table entries. \0Avoid PERV_copyKindDataTab(PERV_KindData* dst); \0A\0A\00"
define i8* @C_mkKindH(i8* %0, i8* %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%5 = add i64 %3, 1351
%6 = add i64 %5, %4
%7 = tail call i8* @UTIL_mallocStr(i64 %6)
%8 = tail call i32 @strcpy(i8* %7, i8* getelementptr inbounds ([240 x i8], [240 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @strcat(i8* %7, i8* %0)
%10 = tail call i32 @strcat(i8* %7, i8* %1)
%11 = tail call i32 @strcat(i8* %7, i8* getelementptr inbounds ([479 x i8], [479 x i8]* @.str.1, i64 0, i64 0))
%12 = tail call i32 @strcat(i8* %7, i8* getelementptr inbounds ([159 x i8], [159 x i8]* @.str.2, i64 0, i64 0))
%13 = tail call i32 @strcat(i8* %7, i8* getelementptr inbounds ([159 x i8], [159 x i8]* @.str.3, i64 0, i64 0))
%14 = tail call i32 @strcat(i8* %7, i8* getelementptr inbounds ([319 x i8], [319 x i8]* @.str.4, i64 0, i64 0))
ret i8* %7
}