#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 */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
char *getStringNoMalloc() {
  char string[100] = {};
  strcat(string, "bla");
  strcat(string, "/");
  strcat(string, "blub");
  printf("string : '%s'\n", string);
  return string;
}


x86 assembly (clang, -O0):
<getStringNoMalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1040 <memset@plt>
lea    -0x70(%rbp),%rdi
lea    0xead(%rip),%rsi
call   1050 <strcat@plt>
lea    -0x70(%rbp),%rdi
lea    0xea1(%rip),%rsi
call   1050 <strcat@plt>
lea    -0x70(%rbp),%rdi
lea    0xe93(%rip),%rsi
call   1050 <strcat@plt>
lea    -0x70(%rbp),%rsi
lea    0xe88(%rip),%rdi
call   1030 <printf@plt>
lea    -0x70(%rbp),%rax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getStringNoMalloc>:
push   %rbx
sub    $0x70,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movl   $0x0,0x60(%rsp)
lea    0xeac(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <strcat@plt>
lea    0xe9e(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcat@plt>
lea    0xe91(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcat@plt>
lea    0xe87(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %rbx,%rax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"bla\00"
@.str.1 = [2 x i8] c"/\00"
@.str.2 = [5 x i8] c"blub\00"
@.str.3 = [15 x i8] c"string : '%s'\0A\00"
define i8* @getStringNoMalloc() {
%1 = alloca [100 x i8]
%2 = bitcast [100 x i8]* %1 to i8*
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%4 = call i32 @strcat(i8* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%6 = call i32 @strcat(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%8 = call i32 @strcat(i8* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%10 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %9)
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
ret i8* %11
}

LLVM IR (-O2):
@.str = [4 x i8] c"bla\00"
@.str.1 = [2 x i8] c"/\00"
@.str.2 = [5 x i8] c"blub\00"
@.str.3 = [15 x i8] c"string : '%s'\0A\00"
define i8* @getStringNoMalloc() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call i32 @strcat(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @strcat(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @strcat(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %2)
ret i8* %2
}