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


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

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

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

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