#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 *C_mkIndexName(char *);
char *UTIL_mallocStr(size_t);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char *C_mkLSRange(char *start, char *end) {
  char *range;
  char *startInd = C_mkIndexName(start);
  char *endInd = C_mkIndexName(end);
  size_t length = strlen(startInd) + strlen("#define PERV_LSSTART     ") +
                  strlen("     //begin of interpretable symbols\n") +
                  strlen(endInd) + strlen("#define PERV_LSEND       ") +
                  strlen("     //end of interpretable symbols\n") + 5;
  range = UTIL_mallocStr(length);
  strcpy(range, "#define PERV_LSSTART     ");
  strcat(range, " ");
  strcat(range, startInd);
  free(startInd);
  strcat(range, "     //begin of interpretable symbols\n");
  strcat(range, "#define PERV_LSEND       ");
  strcat(range, " ");
  strcat(range, endInd);
  free(endInd);
  strcat(range, "     //end of interpretable symbols\n");
  strcat(range, "\n");
  return range;
}


x86 assembly (clang, -O0):
<C_mkLSRange>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <C_mkIndexName@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <C_mkIndexName@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x44(%rbp)
lea    0xe63(%rip),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x44(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x40(%rbp)
lea    0xe67(%rip),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x40(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x28(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x3c(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x38(%rbp)
lea    0xe65(%rip),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x38(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x34(%rbp)
lea    0xe69(%rip),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
add    %ecx,%eax
add    $0x5,%eax
cltq
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
call   1070 <UTIL_mallocStr@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xde1(%rip),%rsi
call   1040 <strcpy@plt>
mov    -0x18(%rbp),%rdi
lea    0xe2a(%rip),%rsi
call   1080 <strcat@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1080 <strcat@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
lea    0xdc5(%rip),%rsi
call   1080 <strcat@plt>
mov    -0x18(%rbp),%rdi
lea    0xddc(%rip),%rsi
call   1080 <strcat@plt>
mov    -0x18(%rbp),%rdi
lea    0xde4(%rip),%rsi
call   1080 <strcat@plt>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1080 <strcat@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
lea    0xdc0(%rip),%rsi
call   1080 <strcat@plt>
mov    -0x18(%rbp),%rdi
lea    0xdd3(%rip),%rsi
call   1080 <strcat@plt>
mov    -0x18(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<C_mkLSRange>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
call   1060 <C_mkIndexName@plt>
mov    %rax,%r13
mov    %rbx,%rdi
call   1060 <C_mkIndexName@plt>
mov    %rax,%rbp
mov    %rax,0x10(%rsp)
mov    %r13,%rdi
call   1050 <strlen@plt>
mov    %eax,0xc(%rsp)
lea    0xe64(%rip),%rdi
call   1050 <strlen@plt>
mov    %eax,%ebx
lea    0xe70(%rip),%rdi
call   1050 <strlen@plt>
mov    %eax,%r12d
mov    %rbp,%rdi
call   1050 <strlen@plt>
mov    %eax,%r15d
lea    0xe7d(%rip),%rdi
call   1050 <strlen@plt>
mov    %eax,%r14d
lea    0xe88(%rip),%rdi
call   1050 <strlen@plt>
add    0xc(%rsp),%ebx
add    %r12d,%ebx
add    %r15d,%ebx
add    %r14d,%ebx
add    %ebx,%eax
add    $0x5,%eax
movslq %eax,%rdi
call   1070 <UTIL_mallocStr@plt>
mov    %rax,%rbx
mov    %rax,%rdi
lea    0xe01(%rip),%rsi
call   1040 <strcpy@plt>
lea    0xe4e(%rip),%rbp
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1080 <strcat@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1080 <strcat@plt>
mov    %r13,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
lea    0xde7(%rip),%rsi
call   1080 <strcat@plt>
mov    %rbx,%rdi
lea    0xdff(%rip),%rsi
call   1080 <strcat@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1080 <strcat@plt>
mov    %rbx,%rdi
mov    0x10(%rsp),%rbp
mov    %rbp,%rsi
call   1080 <strcat@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
lea    0xde7(%rip),%rsi
call   1080 <strcat@plt>
lea    0xdfe(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcat@plt>
mov    %rbx,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [26 x i8] c"#define PERV_LSSTART \00"
@.str.1 = [39 x i8] c" //begin of interpretable symbols\0A\00"
@.str.2 = [26 x i8] c"#define PERV_LSEND \00"
@.str.3 = [37 x i8] c" //end of interpretable symbols\0A\00"
@.str.4 = [2 x i8] c" \00"
@.str.5 = [2 x i8] c"\0A\00"
define i8* @C_mkLSRange(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i64
store i8* %0, i8** %3
store i8* %1, i8** %4
%9 = load i8*, i8** %3
%10 = call i8* @C_mkIndexName(i8* %9)
store i8* %10, i8** %6
%11 = load i8*, i8** %4
%12 = call i8* @C_mkIndexName(i8* %11)
store i8* %12, i8** %7
%13 = load i8*, i8** %6
%14 = call i32 @strlen(i8* %13)
%15 = call i32 @strlen(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%16 = add nsw i32 %14, %15
%17 = call i32 @strlen(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0))
%18 = add nsw i32 %16, %17
%19 = load i8*, i8** %7
%20 = call i32 @strlen(i8* %19)
%21 = add nsw i32 %18, %20
%22 = call i32 @strlen(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%23 = add nsw i32 %21, %22
%24 = call i32 @strlen(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
%25 = add nsw i32 %23, %24
%26 = add nsw i32 %25, 5
%27 = sext i32 %26 to i64
store i64 %27, i64* %8
%28 = load i64, i64* %8
%29 = call i8* @UTIL_mallocStr(i64 %28)
store i8* %29, i8** %5
%30 = load i8*, i8** %5
%31 = call i32 @strcpy(i8* %30, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%32 = load i8*, i8** %5
%33 = call i32 @strcat(i8* %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%34 = load i8*, i8** %5
%35 = load i8*, i8** %6
%36 = call i32 @strcat(i8* %34, i8* %35)
%37 = load i8*, i8** %6
%38 = call i32 @free(i8* %37)
%39 = load i8*, i8** %5
%40 = call i32 @strcat(i8* %39, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0))
%41 = load i8*, i8** %5
%42 = call i32 @strcat(i8* %41, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%43 = load i8*, i8** %5
%44 = call i32 @strcat(i8* %43, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%45 = load i8*, i8** %5
%46 = load i8*, i8** %7
%47 = call i32 @strcat(i8* %45, i8* %46)
%48 = load i8*, i8** %7
%49 = call i32 @free(i8* %48)
%50 = load i8*, i8** %5
%51 = call i32 @strcat(i8* %50, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
%52 = load i8*, i8** %5
%53 = call i32 @strcat(i8* %52, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%54 = load i8*, i8** %5
ret i8* %54
}

LLVM IR (-O2):
@.str = [26 x i8] c"#define PERV_LSSTART \00"
@.str.1 = [39 x i8] c" //begin of interpretable symbols\0A\00"
@.str.2 = [26 x i8] c"#define PERV_LSEND \00"
@.str.3 = [37 x i8] c" //end of interpretable symbols\0A\00"
@.str.4 = [2 x i8] c" \00"
@.str.5 = [2 x i8] c"\0A\00"
define i8* @C_mkLSRange(i8* %0, i8* %1) {
%3 = tail call i8* @C_mkIndexName(i8* %0)
%4 = tail call i8* @C_mkIndexName(i8* %1)
%5 = tail call i32 @strlen(i8* %3)
%6 = tail call i32 @strlen(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @strlen(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 @strlen(i8* %4)
%9 = tail call i32 @strlen(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%10 = tail call i32 @strlen(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
%11 = add i32 %5, 5
%12 = add i32 %11, %6
%13 = add i32 %12, %7
%14 = add i32 %13, %8
%15 = add i32 %14, %9
%16 = add i32 %15, %10
%17 = sext i32 %16 to i64
%18 = tail call i8* @UTIL_mallocStr(i64 %17)
%19 = tail call i32 @strcpy(i8* %18, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%20 = tail call i32 @strcat(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%21 = tail call i32 @strcat(i8* %18, i8* %3)
%22 = tail call i32 @free(i8* %3)
%23 = tail call i32 @strcat(i8* %18, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0))
%24 = tail call i32 @strcat(i8* %18, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%25 = tail call i32 @strcat(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%26 = tail call i32 @strcat(i8* %18, i8* %4)
%27 = tail call i32 @free(i8* %4)
%28 = tail call i32 @strcat(i8* %18, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
%29 = tail call i32 @strcat(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
ret i8* %18
}