#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_mkConstC(char *constTab) {
  size_t length =
      strlen("/****************************************************************"
             "***********/ \n/*   PERVASIVE CONSTANTS                          "
             "                         */  "
             "\n/"
             "*****************************************************************"
             "**********/\n\n") +
      strlen(constTab) +
      strlen("void PERV_copyConstDataTab(PERV_ConstData* 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_constDataTab,       "
             "                        \n           sizeof(PERV_ConstData) * "
             "PERV_CONST_NUM);                           \n}                   "
             "                                                       \n\n") +
      strlen(
          "Boolean PERV_isLogicSymb(int index)                                 "
          "          \n{                                                       "
          "                       \n    return ((index >= PERV_LSSTART) && "
          "(index <= PERV_LSEND));                  \n}\n\n") +
      strlen("Boolean PERV_isPredSymb(int index)                               "
             "             \n{                                                 "
             "                             \n    return ((index >= "
             "PERV_PREDSTART) && (index <= PERV_PREDEND));           \n}\n\n") +
      strlen(
          "PERV_LogicSymbTypes PERV_logicSymb(int index)                       "
          "          \n{                                                       "
          "                       \n    return ((PERV_LogicSymbTypes)(index - "
          "PERV_LSSTART));                      \n}\n\n") +
      strlen(
          "int PERV_predBuiltin(int index)                                     "
          "          \n{                                                       "
          "                       \n    return (index - PERV_PREDSTART);       "
          "                                    \n}\n\n");
  char *constC = UTIL_mallocStr(length);
  strcpy(constC, "/************************************************************"
                 "***************/ \n/*   PERVASIVE CONSTANTS                  "
                 "                                 */  "
                 "\n/"
                 "*************************************************************"
                 "**************/\n\n");
  strcat(constC, constTab);
  strcat(constC,
         "void PERV_copyConstDataTab(PERV_ConstData* 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_constDataTab,                         "
         "      \n           sizeof(PERV_ConstData) * PERV_CONST_NUM);         "
         "                  \n}                                                "
         "                          \n\n");
  strcat(constC,
         "Boolean PERV_isLogicSymb(int index)                                  "
         "         \n{                                                         "
         "                     \n    return ((index >= PERV_LSSTART) && (index "
         "<= PERV_LSEND));                  \n}\n\n");
  strcat(constC,
         "Boolean PERV_isPredSymb(int index)                                   "
         "         \n{                                                         "
         "                     \n    return ((index >= PERV_PREDSTART) && "
         "(index <= PERV_PREDEND));           \n}\n\n");
  strcat(constC,
         "PERV_LogicSymbTypes PERV_logicSymb(int index)                        "
         "         \n{                                                         "
         "                     \n    return ((PERV_LogicSymbTypes)(index - "
         "PERV_LSSTART));                      \n}\n\n");
  strcat(constC,
         "int PERV_predBuiltin(int index)                                      "
         "         \n{                                                         "
         "                     \n    return (index - PERV_PREDSTART);          "
         "                                 \n}\n\n");
  return constC;
}


x86 assembly (clang, -O0):
<C_mkConstC>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xead(%rip),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x48(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x48(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
lea    0xf75(%rip),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x40(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
lea    0x1188(%rip),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
lea    0x1262(%rip),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
lea    0x1339(%rip),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
lea    0x1412(%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    0xdf3(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1060 <strcat@plt>
mov    -0x18(%rbp),%rdi
lea    0xec5(%rip),%rsi
call   1060 <strcat@plt>
mov    -0x18(%rbp),%rdi
lea    0x10e2(%rip),%rsi
call   1060 <strcat@plt>
mov    -0x18(%rbp),%rdi
lea    0x11c6(%rip),%rsi
call   1060 <strcat@plt>
mov    -0x18(%rbp),%rdi
lea    0x12a7(%rip),%rsi
call   1060 <strcat@plt>
mov    -0x18(%rbp),%rdi
lea    0x138a(%rip),%rsi
call   1060 <strcat@plt>
mov    -0x18(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<C_mkConstC>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x6e1(%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    0xf73(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcat@plt>
lea    0x1191(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcat@plt>
lea    0x1276(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcat@plt>
lea    0x1358(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcat@plt>
lea    0x143c(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcat@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [239 x i8] c"/***************************************************************************/ \0A/* PERVASIVE CONSTANTS */ \0A/***************************************************************************/\0A\0A\00"
@.str.1 = [557 x i8] c"void PERV_copyConstDataTab(PERV_ConstData* 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_constDataTab, \0A sizeof(PERV_ConstData) * PERV_CONST_NUM); \0A} \0A\0A\00"
@.str.2 = [244 x i8] c"Boolean PERV_isLogicSymb(int index) \0A{ \0A return ((index >= PERV_LSSTART) && (index <= PERV_LSEND)); \0A}\0A\0A\00"
@.str.3 = [241 x i8] c"Boolean PERV_isPredSymb(int index) \0A{ \0A return ((index >= PERV_PREDSTART) && (index <= PERV_PREDEND)); \0A}\0A\0A\00"
@.str.4 = [243 x i8] c"PERV_LogicSymbTypes PERV_logicSymb(int index) \0A{ \0A return ((PERV_LogicSymbTypes)(index - PERV_LSSTART)); \0A}\0A\0A\00"
@.str.5 = [243 x i8] c"int PERV_predBuiltin(int index) \0A{ \0A return (index - PERV_PREDSTART); \0A}\0A\0A\00"
define i8* @C_mkConstC(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8*
store i8* %0, i8** %2
%5 = call i64 @strlen(i8* getelementptr inbounds ([239 x i8], [239 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 ([557 x i8], [557 x i8]* @.str.1, i64 0, i64 0))
%10 = add i64 %8, %9
%11 = call i64 @strlen(i8* getelementptr inbounds ([244 x i8], [244 x i8]* @.str.2, i64 0, i64 0))
%12 = add i64 %10, %11
%13 = call i64 @strlen(i8* getelementptr inbounds ([241 x i8], [241 x i8]* @.str.3, i64 0, i64 0))
%14 = add i64 %12, %13
%15 = call i64 @strlen(i8* getelementptr inbounds ([243 x i8], [243 x i8]* @.str.4, i64 0, i64 0))
%16 = add i64 %14, %15
%17 = call i64 @strlen(i8* getelementptr inbounds ([243 x i8], [243 x i8]* @.str.5, i64 0, i64 0))
%18 = add i64 %16, %17
store i64 %18, i64* %3
%19 = load i64, i64* %3
%20 = call i8* @UTIL_mallocStr(i64 %19)
store i8* %20, i8** %4
%21 = load i8*, i8** %4
%22 = call i32 @strcpy(i8* %21, i8* getelementptr inbounds ([239 x i8], [239 x i8]* @.str, i64 0, i64 0))
%23 = load i8*, i8** %4
%24 = load i8*, i8** %2
%25 = call i32 @strcat(i8* %23, i8* %24)
%26 = load i8*, i8** %4
%27 = call i32 @strcat(i8* %26, i8* getelementptr inbounds ([557 x i8], [557 x i8]* @.str.1, i64 0, i64 0))
%28 = load i8*, i8** %4
%29 = call i32 @strcat(i8* %28, i8* getelementptr inbounds ([244 x i8], [244 x i8]* @.str.2, i64 0, i64 0))
%30 = load i8*, i8** %4
%31 = call i32 @strcat(i8* %30, i8* getelementptr inbounds ([241 x i8], [241 x i8]* @.str.3, i64 0, i64 0))
%32 = load i8*, i8** %4
%33 = call i32 @strcat(i8* %32, i8* getelementptr inbounds ([243 x i8], [243 x i8]* @.str.4, i64 0, i64 0))
%34 = load i8*, i8** %4
%35 = call i32 @strcat(i8* %34, i8* getelementptr inbounds ([243 x i8], [243 x i8]* @.str.5, i64 0, i64 0))
%36 = load i8*, i8** %4
ret i8* %36
}

LLVM IR (-O2):
@.str = [239 x i8] c"/***************************************************************************/ \0A/* PERVASIVE CONSTANTS */ \0A/***************************************************************************/\0A\0A\00"
@.str.1 = [557 x i8] c"void PERV_copyConstDataTab(PERV_ConstData* 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_constDataTab, \0A sizeof(PERV_ConstData) * PERV_CONST_NUM); \0A} \0A\0A\00"
@.str.2 = [244 x i8] c"Boolean PERV_isLogicSymb(int index) \0A{ \0A return ((index >= PERV_LSSTART) && (index <= PERV_LSEND)); \0A}\0A\0A\00"
@.str.3 = [241 x i8] c"Boolean PERV_isPredSymb(int index) \0A{ \0A return ((index >= PERV_PREDSTART) && (index <= PERV_PREDEND)); \0A}\0A\0A\00"
@.str.4 = [243 x i8] c"PERV_LogicSymbTypes PERV_logicSymb(int index) \0A{ \0A return ((PERV_LogicSymbTypes)(index - PERV_LSSTART)); \0A}\0A\0A\00"
@.str.5 = [243 x i8] c"int PERV_predBuiltin(int index) \0A{ \0A return (index - PERV_PREDSTART); \0A}\0A\0A\00"
define i8* @C_mkConstC(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add i64 %2, 1761
%4 = tail call i8* @UTIL_mallocStr(i64 %3)
%5 = tail call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([239 x i8], [239 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 ([557 x i8], [557 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 @strcat(i8* %4, i8* getelementptr inbounds ([244 x i8], [244 x i8]* @.str.2, i64 0, i64 0))
%9 = tail call i32 @strcat(i8* %4, i8* getelementptr inbounds ([241 x i8], [241 x i8]* @.str.3, i64 0, i64 0))
%10 = tail call i32 @strcat(i8* %4, i8* getelementptr inbounds ([243 x i8], [243 x i8]* @.str.4, i64 0, i64 0))
%11 = tail call i32 @strcat(i8* %4, i8* getelementptr inbounds ([243 x i8], [243 x i8]* @.str.5, i64 0, i64 0))
ret i8* %4
}