#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 *OC_mkDotStr(char *, char *);
char *OC_mkSymbol(char *);
char *OC_mkVarDef(char *, char *);
char *UTIL_mallocStr(size_t);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char *OC_mkTabEntry(char *name, char *varName) {
  char *entry;
  char *tableAdd = OC_mkDotStr("Table", "add");
  char *symbol = OC_mkSymbol(name);
  size_t length =
      strlen(tableAdd) + strlen(symbol) + strlen(varName) + strlen("t") + 15;
  char *def = UTIL_mallocStr(length + 1);
  strcpy(def, tableAdd);
  free(tableAdd);
  strcat(def, " ");
  strcat(def, symbol);
  free(symbol);
  strcat(def, " ");
  strcat(def, varName);
  strcat(def, " ");
  strcat(def, "t");
  strcat(def, " in\n  ");
  entry = OC_mkVarDef("t", def);
  free(def);
  return entry;
}


x86 assembly (clang, -O0):
<OC_mkTabEntry>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe69(%rip),%rdi
lea    0xe68(%rip),%rsi
call   10a0 <OC_mkDotStr@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1090 <OC_mkSymbol@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x44(%rbp)
mov    -0x28(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x44(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x40(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x40(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x3c(%rbp)
lea    0xe1d(%rip),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x3c(%rbp),%eax
add    %ecx,%eax
add    $0xf,%eax
cltq
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
add    $0x1,%rdi
call   1070 <UTIL_mallocStr@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rdi
lea    0xddd(%rip),%rsi
call   1080 <strcat@plt>
mov    -0x38(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1080 <strcat@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rdi
lea    0xdb7(%rip),%rsi
call   1080 <strcat@plt>
mov    -0x38(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1080 <strcat@plt>
mov    -0x38(%rbp),%rdi
lea    0xd9a(%rip),%rsi
call   1080 <strcat@plt>
mov    -0x38(%rbp),%rdi
lea    0xd83(%rip),%rsi
call   1080 <strcat@plt>
mov    -0x38(%rbp),%rdi
lea    0xd75(%rip),%rsi
call   1080 <strcat@plt>
mov    -0x38(%rbp),%rsi
lea    0xd63(%rip),%rdi
call   1060 <OC_mkVarDef@plt>
mov    %rax,-0x18(%rbp)
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<OC_mkTabEntry>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0xe68(%rip),%rdi
lea    0xe67(%rip),%rsi
call   10a0 <OC_mkDotStr@plt>
mov    %rax,%r13
mov    %rbx,%rdi
call   1090 <OC_mkSymbol@plt>
mov    %rax,%r12
mov    %r13,%rdi
call   1050 <strlen@plt>
mov    %eax,%ebx
mov    %r12,%rdi
call   1050 <strlen@plt>
mov    %eax,%ebp
add    %ebx,%ebp
mov    %r15,%rdi
call   1050 <strlen@plt>
mov    %eax,%ebx
add    %ebp,%ebx
lea    0xe2f(%rip),%r14
mov    %r14,%rdi
call   1050 <strlen@plt>
add    %ebx,%eax
movslq %eax,%rdi
add    $0x10,%rdi
call   1070 <UTIL_mallocStr@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r13,%rsi
call   1040 <strcpy@plt>
mov    %r13,%rdi
call   1030 <free@plt>
lea    0xe03(%rip),%rbp
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1080 <strcat@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1080 <strcat@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1080 <strcat@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1080 <strcat@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1080 <strcat@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1080 <strcat@plt>
lea    0xdad(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcat@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <OC_mkVarDef@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %rbp,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"Table\00"
@.str.1 = [4 x i8] c"add\00"
@.str.2 = [2 x i8] c"t\00"
@.str.3 = [2 x i8] c" \00"
@.str.4 = [7 x i8] c" in\0A \00"
define i8* @OC_mkTabEntry(i8* %0, i8* %1) {
%3 = tail call i8* @OC_mkDotStr(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i8* @OC_mkSymbol(i8* %0)
%5 = tail call i32 @strlen(i8* %3)
%6 = tail call i32 @strlen(i8* %4)
%7 = add nsw i32 %6, %5
%8 = tail call i32 @strlen(i8* %1)
%9 = add nsw i32 %7, %8
%10 = tail call i32 @strlen(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%11 = add nsw i32 %9, %10
%12 = sext i32 %11 to i64
%13 = add nsw i64 %12, 16
%14 = tail call i8* @UTIL_mallocStr(i64 %13)
%15 = tail call i32 @strcpy(i8* %14, i8* %3)
%16 = tail call i32 @free(i8* %3)
%17 = tail call i32 @strcat(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%18 = tail call i32 @strcat(i8* %14, i8* %4)
%19 = tail call i32 @free(i8* %4)
%20 = tail call i32 @strcat(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%21 = tail call i32 @strcat(i8* %14, i8* %1)
%22 = tail call i32 @strcat(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%23 = tail call i32 @strcat(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%24 = tail call i32 @strcat(i8* %14, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%25 = tail call i8* @OC_mkVarDef(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* %14)
%26 = tail call i32 @free(i8* %14)
ret i8* %25
}