#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_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_mkTab(char *tabName, char *buildFuncName) {
  char *tab;
  size_t length = strlen(buildFuncName) + 10;
  char *def = UTIL_mallocStr(length + 1);
  strcpy(def, buildFuncName);
  strcat(def, " ()\n\n");
  tab = OC_mkVarDef(tabName, def);
  free(def);
  return tab;
}


x86 assembly (clang, -O0):
<OC_mkTab>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
add    $0xa,%eax
cltq
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
add    $0x1,%rdi
call   1070 <UTIL_mallocStr@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x28(%rbp),%rdi
lea    0xe55(%rip),%rsi
call   1080 <strcat@plt>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1060 <OC_mkVarDef@plt>
mov    %rax,-0x18(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<OC_mkTab>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
mov    %rsi,%rdi
call   1050 <strlen@plt>
movslq %eax,%rdi
add    $0xb,%rdi
call   1070 <UTIL_mallocStr@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r15,%rsi
call   1040 <strcpy@plt>
lea    0xe6c(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcat@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <OC_mkVarDef@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c" ()\0A\0A\00"
define i8* @OC_mkTab(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = sext i32 %3 to i64
%5 = add nsw i64 %4, 11
%6 = tail call i8* @UTIL_mallocStr(i64 %5)
%7 = tail call i32 @strcpy(i8* %6, i8* %1)
%8 = tail call i32 @strcat(i8* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%9 = tail call i8* @OC_mkVarDef(i8* %0, i8* %6)
%10 = tail call i32 @free(i8* %6)
ret i8* %9
}