#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 *UTIL_mallocStr(size_t);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char *OC_mkSymbolAlias(char *name, char *printName) {
  char *symbolCtr = OC_mkDotStr("Symbol", "symbolAlias");
  size_t length = strlen(symbolCtr) + strlen(name) + strlen(printName) + 10;
  char *rtptr = UTIL_mallocStr(length + 1);
  strcpy(rtptr, "(");
  strcat(rtptr, symbolCtr);
  free(symbolCtr);
  strcat(rtptr, " \"");
  strcat(rtptr, name);
  strcat(rtptr, "\" \"");
  strcat(rtptr, printName);
  strcat(rtptr, "\")");
  return rtptr;
}


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

x86 assembly (clang, -O2):
<OC_mkSymbolAlias>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
lea    0xe8b(%rip),%rdi
lea    0xe8b(%rip),%rsi
call   1080 <OC_mkDotStr@plt>
mov    %rax,%r12
mov    %rax,%rdi
call   1050 <strlen@plt>
mov    %eax,%ebx
mov    %r15,%rdi
call   1050 <strlen@plt>
mov    %eax,%ebp
add    %ebx,%ebp
mov    %r14,%rdi
call   1050 <strlen@plt>
add    %ebp,%eax
movslq %eax,%rdi
add    $0xb,%rdi
call   1060 <UTIL_mallocStr@plt>
mov    %rax,%rbx
lea    0xe59(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1070 <strcat@plt>
mov    %r12,%rdi
call   1030 <free@plt>
lea    0xe3a(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcat@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1070 <strcat@plt>
lea    0xe1f(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcat@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <strcat@plt>
lea    0xe09(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcat@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"Symbol\00"
@.str.1 = [12 x i8] c"symbolAlias\00"
@.str.2 = [2 x i8] c"(\00"
@.str.3 = [3 x i8] c" \22\00"
@.str.4 = [4 x i8] c"\22 \22\00"
@.str.5 = [3 x i8] c"\22)\00"
define i8* @OC_mkSymbolAlias(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 = call i8* @OC_mkDotStr(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = call i32 @strlen(i8* %9)
%11 = load i8*, i8** %3
%12 = call i32 @strlen(i8* %11)
%13 = add nsw i32 %10, %12
%14 = load i8*, i8** %4
%15 = call i32 @strlen(i8* %14)
%16 = add nsw i32 %13, %15
%17 = add nsw i32 %16, 10
%18 = sext i32 %17 to i64
store i64 %18, i64* %6
%19 = load i64, i64* %6
%20 = add i64 %19, 1
%21 = call i8* @UTIL_mallocStr(i64 %20)
store i8* %21, i8** %7
%22 = load i8*, i8** %7
%23 = call i32 @strcpy(i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%24 = load i8*, i8** %7
%25 = load i8*, i8** %5
%26 = call i32 @strcat(i8* %24, i8* %25)
%27 = load i8*, i8** %5
%28 = call i32 @free(i8* %27)
%29 = load i8*, i8** %7
%30 = call i32 @strcat(i8* %29, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%31 = load i8*, i8** %7
%32 = load i8*, i8** %3
%33 = call i32 @strcat(i8* %31, i8* %32)
%34 = load i8*, i8** %7
%35 = call i32 @strcat(i8* %34, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%36 = load i8*, i8** %7
%37 = load i8*, i8** %4
%38 = call i32 @strcat(i8* %36, i8* %37)
%39 = load i8*, i8** %7
%40 = call i32 @strcat(i8* %39, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%41 = load i8*, i8** %7
ret i8* %41
}

LLVM IR (-O2):
@.str = [7 x i8] c"Symbol\00"
@.str.1 = [12 x i8] c"symbolAlias\00"
@.str.2 = [2 x i8] c"(\00"
@.str.3 = [3 x i8] c" \22\00"
@.str.4 = [4 x i8] c"\22 \22\00"
@.str.5 = [3 x i8] c"\22)\00"
define i8* @OC_mkSymbolAlias(i8* %0, i8* %1) {
%3 = tail call i8* @OC_mkDotStr(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @strlen(i8* %3)
%5 = tail call i32 @strlen(i8* %0)
%6 = add nsw i32 %5, %4
%7 = tail call i32 @strlen(i8* %1)
%8 = add nsw i32 %6, %7
%9 = sext i32 %8 to i64
%10 = add nsw i64 %9, 11
%11 = tail call i8* @UTIL_mallocStr(i64 %10)
%12 = tail call i32 @strcpy(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%13 = tail call i32 @strcat(i8* %11, i8* %3)
%14 = tail call i32 @free(i8* %3)
%15 = tail call i32 @strcat(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%16 = tail call i32 @strcat(i8* %11, i8* %0)
%17 = tail call i32 @strcat(i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%18 = tail call i32 @strcat(i8* %11, i8* %1)
%19 = tail call i32 @strcat(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
ret i8* %11
}