#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_mkConstH(char *constIndexType, char *numConsts, char *property) {
  size_t length =
      strlen("/****************************************************************"
             "***********/ \n/*   PERVASIVE CONSTANTS                          "
             "                         */  "
             "\n/"
             "*****************************************************************"
             "**********/\n\n") +
      strlen(constIndexType) + strlen(numConsts) +
      strlen("//pervasive const data type                                      "
             "             \ntypedef struct                                    "
             "                             \n{                                 "
             "                                             \n    char      "
             "*name;                                                           "
             "\n    TwoBytes  typeEnvSize;                                     "
             "                \n    TwoBytes  tskTabIndex;     //index to the "
             "type skeleton table              \n    TwoBytes  neededness;     "
             " //neededness (predicate constant)               \n    TwoBytes  "
             "univCount;                                                       "
             "\n    int       precedence;                                      "
             "                \n    int       fixity;                          "
             "                                \n} PERV_ConstData; \n\n") +
      strlen("//pervasive const data table (array)                             "
             "             \nextern PERV_ConstData    "
             "PERV_constDataTab[PERV_CONST_NUM]; \n\n") +
      strlen("//pervasive const 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_copyConstDataTab(PERV_ConstData* dst); \n\n") +
      strlen(property) +
      strlen(
          "//functions used by the simulator for interpreted goals             "
          "          \nBoolean PERV_isLogicSymb(int index);                    "
          "                       \nBoolean PERV_isPredSymb(int index); \n\n") +
      strlen("PERV_LogicSymbTypes PERV_logicSymb(int index); \n\n") +
      strlen("int PERV_predBuiltin(int index); \n\n");
  char *constH = UTIL_mallocStr(length);
  strcpy(constH, "/************************************************************"
                 "***************/ \n/*   PERVASIVE CONSTANTS                  "
                 "                                 */  "
                 "\n/"
                 "*************************************************************"
                 "**************/\n\n");
  strcat(constH, constIndexType);
  strcat(constH, numConsts);
  strcat(
      constH,
      "//pervasive const data type                                             "
      "      \ntypedef struct                                                  "
      "               \n{                                                      "
      "                        \n    char      *name;                          "
      "                                 \n    TwoBytes  typeEnvSize;           "
      "                                          \n    TwoBytes  tskTabIndex;  "
      "   //index to the type skeleton table              \n    TwoBytes  "
      "neededness;      //neededness (predicate constant)               \n    "
      "TwoBytes  univCount;                                                    "
      "   \n    int       precedence;                                          "
      "            \n    int       fixity;                                     "
      "                     \n} PERV_ConstData; \n\n");
  strcat(constH, "//pervasive const data table (array)                         "
                 "                 \nextern PERV_ConstData    "
                 "PERV_constDataTab[PERV_CONST_NUM]; \n\n");
  strcat(constH,
         "//pervasive const 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_copyConstDataTab(PERV_ConstData* dst); \n\n");
  strcat(constH, property);
  strcat(constH,
         "//functions used by the simulator for interpreted goals              "
         "         \nBoolean PERV_isLogicSymb(int index);                      "
         "                     \nBoolean PERV_isPredSymb(int index); \n\n");
  strcat(constH, "PERV_LogicSymbTypes PERV_logicSymb(int index); \n\n");
  strcat(constH, "int PERV_predBuiltin(int index); \n\n");
  return constH;
}


x86 assembly (clang, -O0):
<C_mkConstH>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xea5(%rip),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x70(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x70(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x68(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x68(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x60(%rbp)
lea    0xf56(%rip),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x60(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x58(%rbp)
lea    0x1270(%rip),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x58(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x50(%rbp)
lea    0x12e4(%rip),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x50(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x48(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
lea    0x13d6(%rip),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x40(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
lea    0x1482(%rip),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
lea    0x149a(%rip),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <UTIL_mallocStr@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xda3(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x28(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1060 <strcat@plt>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <strcat@plt>
mov    -0x28(%rbp),%rdi
lea    0xe68(%rip),%rsi
call   1060 <strcat@plt>
mov    -0x28(%rbp),%rdi
lea    0x118c(%rip),%rsi
call   1060 <strcat@plt>
mov    -0x28(%rbp),%rdi
lea    0x120a(%rip),%rsi
call   1060 <strcat@plt>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1060 <strcat@plt>
mov    -0x28(%rbp),%rdi
lea    0x1310(%rip),%rsi
call   1060 <strcat@plt>
mov    -0x28(%rbp),%rdi
lea    0x13c6(%rip),%rsi
call   1060 <strcat@plt>
mov    -0x28(%rbp),%rdi
lea    0x13e8(%rip),%rsi
call   1060 <strcat@plt>
mov    -0x28(%rbp),%rax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<C_mkConstH>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
call   1040 <strlen@plt>
mov    %rax,%r13
mov    %r15,%rdi
call   1040 <strlen@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1040 <strlen@plt>
add    %r13,%rbx
lea    (%rax,%rbx,1),%rdi
add    $0x6e9,%rdi
call   1050 <UTIL_mallocStr@plt>
mov    %rax,%rbx
lea    0xe76(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1060 <strcat@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <strcat@plt>
lea    0xf40(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcat@plt>
lea    0x1265(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcat@plt>
lea    0x12e4(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcat@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <strcat@plt>
lea    0x13ed(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcat@plt>
lea    0x14a4(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcat@plt>
lea    0x14c7(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcat@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [239 x i8] c"/***************************************************************************/ \0A/* PERVASIVE CONSTANTS */ \0A/***************************************************************************/\0A\0A\00"
@.str.1 = [820 x i8] c"//pervasive const data type \0Atypedef struct \0A{ \0A char *name; \0A TwoBytes typeEnvSize; \0A TwoBytes tskTabIndex; //index to the type skeleton table \0A TwoBytes neededness; //neededness (predicate constant) \0A TwoBytes univCount; \0A int precedence; \0A int fixity; \0A} PERV_ConstData; \0A\0A\00"
@.str.2 = [142 x i8] c"//pervasive const data table (array) \0Aextern PERV_ConstData PERV_constDataTab[PERV_CONST_NUM]; \0A\0A\00"
@.str.3 = [291 x i8] c"//pervasive const 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_copyConstDataTab(PERV_ConstData* dst); \0A\0A\00"
@.str.4 = [198 x i8] c"//functions used by the simulator for interpreted goals \0ABoolean PERV_isLogicSymb(int index); \0ABoolean PERV_isPredSymb(int index); \0A\0A\00"
@.str.5 = [50 x i8] c"PERV_LogicSymbTypes PERV_logicSymb(int index); \0A\0A\00"
@.str.6 = [36 x i8] c"int PERV_predBuiltin(int index); \0A\0A\00"
define i8* @C_mkConstH(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%9 = call i64 @strlen(i8* getelementptr inbounds ([239 x i8], [239 x i8]* @.str, i64 0, i64 0))
%10 = load i8*, i8** %4
%11 = call i64 @strlen(i8* %10)
%12 = add i64 %9, %11
%13 = load i8*, i8** %5
%14 = call i64 @strlen(i8* %13)
%15 = add i64 %12, %14
%16 = call i64 @strlen(i8* getelementptr inbounds ([820 x i8], [820 x i8]* @.str.1, i64 0, i64 0))
%17 = add i64 %15, %16
%18 = call i64 @strlen(i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str.2, i64 0, i64 0))
%19 = add i64 %17, %18
%20 = call i64 @strlen(i8* getelementptr inbounds ([291 x i8], [291 x i8]* @.str.3, i64 0, i64 0))
%21 = add i64 %19, %20
%22 = load i8*, i8** %6
%23 = call i64 @strlen(i8* %22)
%24 = add i64 %21, %23
%25 = call i64 @strlen(i8* getelementptr inbounds ([198 x i8], [198 x i8]* @.str.4, i64 0, i64 0))
%26 = add i64 %24, %25
%27 = call i64 @strlen(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.5, i64 0, i64 0))
%28 = add i64 %26, %27
%29 = call i64 @strlen(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0))
%30 = add i64 %28, %29
store i64 %30, i64* %7
%31 = load i64, i64* %7
%32 = call i8* @UTIL_mallocStr(i64 %31)
store i8* %32, i8** %8
%33 = load i8*, i8** %8
%34 = call i32 @strcpy(i8* %33, i8* getelementptr inbounds ([239 x i8], [239 x i8]* @.str, i64 0, i64 0))
%35 = load i8*, i8** %8
%36 = load i8*, i8** %4
%37 = call i32 @strcat(i8* %35, i8* %36)
%38 = load i8*, i8** %8
%39 = load i8*, i8** %5
%40 = call i32 @strcat(i8* %38, i8* %39)
%41 = load i8*, i8** %8
%42 = call i32 @strcat(i8* %41, i8* getelementptr inbounds ([820 x i8], [820 x i8]* @.str.1, i64 0, i64 0))
%43 = load i8*, i8** %8
%44 = call i32 @strcat(i8* %43, i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str.2, i64 0, i64 0))
%45 = load i8*, i8** %8
%46 = call i32 @strcat(i8* %45, i8* getelementptr inbounds ([291 x i8], [291 x i8]* @.str.3, i64 0, i64 0))
%47 = load i8*, i8** %8
%48 = load i8*, i8** %6
%49 = call i32 @strcat(i8* %47, i8* %48)
%50 = load i8*, i8** %8
%51 = call i32 @strcat(i8* %50, i8* getelementptr inbounds ([198 x i8], [198 x i8]* @.str.4, i64 0, i64 0))
%52 = load i8*, i8** %8
%53 = call i32 @strcat(i8* %52, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.5, i64 0, i64 0))
%54 = load i8*, i8** %8
%55 = call i32 @strcat(i8* %54, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0))
%56 = load i8*, i8** %8
ret i8* %56
}

LLVM IR (-O2):
@.str = [239 x i8] c"/***************************************************************************/ \0A/* PERVASIVE CONSTANTS */ \0A/***************************************************************************/\0A\0A\00"
@.str.1 = [820 x i8] c"//pervasive const data type \0Atypedef struct \0A{ \0A char *name; \0A TwoBytes typeEnvSize; \0A TwoBytes tskTabIndex; //index to the type skeleton table \0A TwoBytes neededness; //neededness (predicate constant) \0A TwoBytes univCount; \0A int precedence; \0A int fixity; \0A} PERV_ConstData; \0A\0A\00"
@.str.2 = [142 x i8] c"//pervasive const data table (array) \0Aextern PERV_ConstData PERV_constDataTab[PERV_CONST_NUM]; \0A\0A\00"
@.str.3 = [291 x i8] c"//pervasive const 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_copyConstDataTab(PERV_ConstData* dst); \0A\0A\00"
@.str.4 = [198 x i8] c"//functions used by the simulator for interpreted goals \0ABoolean PERV_isLogicSymb(int index); \0ABoolean PERV_isPredSymb(int index); \0A\0A\00"
@.str.5 = [50 x i8] c"PERV_LogicSymbTypes PERV_logicSymb(int index); \0A\0A\00"
@.str.6 = [36 x i8] c"int PERV_predBuiltin(int index); \0A\0A\00"
define i8* @C_mkConstH(i8* %0, i8* %1, i8* %2) {
%4 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%5 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%6 = tail call i64 @strlen(i8* dereferenceable(1) %2)
%7 = add i64 %4, 1769
%8 = add i64 %7, %5
%9 = add i64 %8, %6
%10 = tail call i8* @UTIL_mallocStr(i64 %9)
%11 = tail call i32 @strcpy(i8* %10, i8* getelementptr inbounds ([239 x i8], [239 x i8]* @.str, i64 0, i64 0))
%12 = tail call i32 @strcat(i8* %10, i8* %0)
%13 = tail call i32 @strcat(i8* %10, i8* %1)
%14 = tail call i32 @strcat(i8* %10, i8* getelementptr inbounds ([820 x i8], [820 x i8]* @.str.1, i64 0, i64 0))
%15 = tail call i32 @strcat(i8* %10, i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str.2, i64 0, i64 0))
%16 = tail call i32 @strcat(i8* %10, i8* getelementptr inbounds ([291 x i8], [291 x i8]* @.str.3, i64 0, i64 0))
%17 = tail call i32 @strcat(i8* %10, i8* %2)
%18 = tail call i32 @strcat(i8* %10, i8* getelementptr inbounds ([198 x i8], [198 x i8]* @.str.4, i64 0, i64 0))
%19 = tail call i32 @strcat(i8* %10, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.5, i64 0, i64 0))
%20 = tail call i32 @strcat(i8* %10, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0))
ret i8* %10
}