#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 */
scalar_t__ malloc(int);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char *ConcatStartSymbol(char *inputString) {
  int length;
  char *outputString;
  if (inputString == NULL) {
    outputString = (char *)malloc(2);
    strcpy(outputString, " ");
    outputString[0] = '?';
  } else {
    length = strlen(inputString) + 1;
    outputString = (char *)malloc(2 + length);
    strcpy(outputString, "  ");
    outputString[0] = '?';
    strcat(outputString, inputString);
  }
  return outputString;
}


x86 assembly (clang, -O0):
<ConcatStartSymbol>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1181 <ConcatStartSymbol+0x41>
mov    $0x2,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe91(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rax
movb   $0x3f,(%rax)
jmp    11c3 <ConcatStartSymbol+0x83>
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
add    $0x2,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe56(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rax
movb   $0x3f,(%rax)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1060 <strcat@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ConcatStartSymbol>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     117b <ConcatStartSymbol+0x3b>
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x3(%rax),%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
lea    0xe9d(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
movb   $0x3f,(%rbx)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <strcat@plt>
jmp    119a <ConcatStartSymbol+0x5a>
mov    $0x2,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
lea    0xe72(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
movb   $0x3f,(%rbx)
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
@.str.1 = [3 x i8] c" \00"
define i8* @ConcatStartSymbol(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %14
7: ; preds = %1
%8 = call i64 @malloc(i32 2)
%9 = inttoptr i64 %8 to i8*
store i8* %9, i8** %4
%10 = load i8*, i8** %4
%11 = call i32 @strcpy(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%12 = load i8*, i8** %4
%13 = getelementptr inbounds i8, i8* %12, i64 0
store i8 63, i8* %13
br label %29
14: ; preds = %1
%15 = load i8*, i8** %2
%16 = call i32 @strlen(i8* %15)
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
%18 = load i32, i32* %3
%19 = add nsw i32 2, %18
%20 = call i64 @malloc(i32 %19)
%21 = inttoptr i64 %20 to i8*
store i8* %21, i8** %4
%22 = load i8*, i8** %4
%23 = call i32 @strcpy(i8* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%24 = load i8*, i8** %4
%25 = getelementptr inbounds i8, i8* %24, i64 0
store i8 63, i8* %25
%26 = load i8*, i8** %4
%27 = load i8*, i8** %2
%28 = call i32 @strcat(i8* %26, i8* %27)
br label %29
29: ; preds = %14, %7
%30 = load i8*, i8** %4
ret i8* %30
}

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
@.str.1 = [3 x i8] c" \00"
define i8* @ConcatStartSymbol(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = tail call i64 @malloc(i32 2)
%5 = inttoptr i64 %4 to i8*
%6 = tail call i32 @strcpy(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8 63, i8* %5
br label %14
7: ; preds = %1
%8 = tail call i32 @strlen(i8* %0)
%9 = add nsw i32 %8, 3
%10 = tail call i64 @malloc(i32 %9)
%11 = inttoptr i64 %10 to i8*
%12 = tail call i32 @strcpy(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i8 63, i8* %11
%13 = tail call i32 @strcat(i8* %11, i8* %0)
br label %14
14: ; preds = %7, %3
%15 = phi i8* [ %5, %3 ], [ %11, %7 ]
ret i8* %15
}