#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_itoa(int);
char *UTIL_mallocStr(scalar_t__);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
char *C_mkTySkelTabInit(char *body, int space) {
  char *spaceText = UTIL_itoa(space * 2);
  char *tabInit = UTIL_mallocStr(
      strlen(
          "//pervasive type skeletons and type skeleton table initialization   "
          "          \n//The type skeletons are created in the memory of the "
          "system through malloc,   \n//and addresses are entered into the "
          "pervasive type skeleton table.            \nvoid "
          "PERV_tySkelTabInit()                                                "
          "      \n{                                                           "
          "                   \n    int tySkelInd = 0; //ts tab index\n") +
      strlen("    MemPtr tySkelBase = (MemPtr)EM_malloc(WORD_SIZE * ") +
      strlen(spaceText) + strlen(" ); //ts area\n\n") + strlen(body) +
      strlen("}\n\n"));
  strcpy(tabInit,
         "//pervasive type skeletons and type skeleton table initialization    "
         "         \n//The type skeletons are created in the memory of the "
         "system through malloc,   \n//and addresses are entered into the "
         "pervasive type skeleton table.            \nvoid "
         "PERV_tySkelTabInit()                                                 "
         "     \n{                                                             "
         "                 \n    int tySkelInd = 0; //ts tab index\n");
  strcat(tabInit, "    MemPtr tySkelBase = (MemPtr)EM_malloc(WORD_SIZE * ");
  strcat(tabInit, spaceText);
  free(spaceText);
  strcat(tabInit, " ); //ts area\n\n");
  strcat(tabInit, body);
  strcat(tabInit, "}\n\n");
  return tabInit;
}


x86 assembly (clang, -O0):
<C_mkTySkelTabInit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
shl    $0x1,%edi
call   1030 <UTIL_itoa@plt>
mov    %rax,-0x18(%rbp)
lea    0xe7b(%rip),%rdi
call   1060 <strlen@plt>
mov    %rax,-0x48(%rbp)
lea    0x1021(%rip),%rdi
call   1060 <strlen@plt>
mov    %rax,%rcx
mov    -0x48(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <strlen@plt>
mov    %rax,%rcx
mov    -0x40(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
lea    0x1027(%rip),%rdi
call   1060 <strlen@plt>
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <strlen@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
lea    0x1006(%rip),%rdi
call   1060 <strlen@plt>
mov    -0x28(%rbp),%rdi
add    %rax,%rdi
call   1070 <UTIL_mallocStr@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xde9(%rip),%rsi
call   1050 <strcpy@plt>
mov    -0x20(%rbp),%rdi
lea    0xf8f(%rip),%rsi
call   1080 <strcat@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1080 <strcat@plt>
mov    -0x18(%rbp),%rdi
call   1040 <free@plt>
mov    -0x20(%rbp),%rdi
lea    0xfa0(%rip),%rsi
call   1080 <strcat@plt>
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1080 <strcat@plt>
mov    -0x20(%rbp),%rdi
lea    0xf93(%rip),%rsi
call   1080 <strcat@plt>
mov    -0x20(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<C_mkTySkelTabInit>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
lea    (%rsi,%rsi,1),%edi
call   1030 <UTIL_itoa@plt>
mov    %rax,%r15
mov    %rax,%rdi
call   1060 <strlen@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1060 <strlen@plt>
lea    (%rbx,%rax,1),%rdi
add    $0x1fd,%rdi
call   1070 <UTIL_mallocStr@plt>
mov    %rax,%rbx
lea    0xe60(%rip),%rsi
mov    %rax,%rdi
call   1050 <strcpy@plt>
lea    0x1007(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcat@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1080 <strcat@plt>
mov    %r15,%rdi
call   1040 <free@plt>
lea    0x101c(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcat@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1080 <strcat@plt>
lea    0x1012(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcat@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [438 x i8] c"//pervasive type skeletons and type skeleton table initialization \0A//The type skeletons are created in the memory of the system through malloc, \0A//and addresses are entered into the pervasive type skeleton table. \0Avoid PERV_tySkelTabInit() \0A{ \0A int tySkelInd = 0; //ts tab index\0A\00"
@.str.1 = [55 x i8] c" MemPtr tySkelBase = (MemPtr)EM_malloc(WORD_SIZE * \00"
@.str.2 = [16 x i8] c" ); //ts area\0A\0A\00"
@.str.3 = [4 x i8] c"}\0A\0A\00"
define i8* @C_mkTySkelTabInit(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = mul nsw i32 %7, 2
%9 = call i8* @UTIL_itoa(i32 %8)
store i8* %9, i8** %5
%10 = call i64 @strlen(i8* getelementptr inbounds ([438 x i8], [438 x i8]* @.str, i64 0, i64 0))
%11 = call i64 @strlen(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.1, i64 0, i64 0))
%12 = add nsw i64 %10, %11
%13 = load i8*, i8** %5
%14 = call i64 @strlen(i8* %13)
%15 = add nsw i64 %12, %14
%16 = call i64 @strlen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%17 = add nsw i64 %15, %16
%18 = load i8*, i8** %3
%19 = call i64 @strlen(i8* %18)
%20 = add nsw i64 %17, %19
%21 = call i64 @strlen(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%22 = add nsw i64 %20, %21
%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 ([438 x i8], [438 x i8]* @.str, i64 0, i64 0))
%26 = load i8*, i8** %6
%27 = call i32 @strcat(i8* %26, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.1, i64 0, i64 0))
%28 = load i8*, i8** %6
%29 = load i8*, i8** %5
%30 = call i32 @strcat(i8* %28, i8* %29)
%31 = load i8*, i8** %5
%32 = call i32 @free(i8* %31)
%33 = load i8*, i8** %6
%34 = call i32 @strcat(i8* %33, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%35 = load i8*, i8** %6
%36 = load i8*, i8** %3
%37 = call i32 @strcat(i8* %35, i8* %36)
%38 = load i8*, i8** %6
%39 = call i32 @strcat(i8* %38, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%40 = load i8*, i8** %6
ret i8* %40
}

LLVM IR (-O2):
@.str = [438 x i8] c"//pervasive type skeletons and type skeleton table initialization \0A//The type skeletons are created in the memory of the system through malloc, \0A//and addresses are entered into the pervasive type skeleton table. \0Avoid PERV_tySkelTabInit() \0A{ \0A int tySkelInd = 0; //ts tab index\0A\00"
@.str.1 = [55 x i8] c" MemPtr tySkelBase = (MemPtr)EM_malloc(WORD_SIZE * \00"
@.str.2 = [16 x i8] c" ); //ts area\0A\0A\00"
@.str.3 = [4 x i8] c"}\0A\0A\00"
define i8* @C_mkTySkelTabInit(i8* %0, i32 %1) {
%3 = shl nsw i32 %1, 1
%4 = tail call i8* @UTIL_itoa(i32 %3)
%5 = tail call i64 @strlen(i8* dereferenceable(1) %4)
%6 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%7 = add i64 %5, 509
%8 = add i64 %7, %6
%9 = tail call i8* @UTIL_mallocStr(i64 %8)
%10 = tail call i32 @strcpy(i8* %9, i8* getelementptr inbounds ([438 x i8], [438 x i8]* @.str, i64 0, i64 0))
%11 = tail call i32 @strcat(i8* %9, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.1, i64 0, i64 0))
%12 = tail call i32 @strcat(i8* %9, i8* %4)
%13 = tail call i32 @free(i8* %4)
%14 = tail call i32 @strcat(i8* %9, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%15 = tail call i32 @strcat(i8* %9, i8* %0)
%16 = tail call i32 @strcat(i8* %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
ret i8* %9
}