#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 *malloc(int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
int main() {
  char *str = malloc(20 * 8);
  char *str2 = malloc(20 * 8);
  str = "iii ";
  str2 = "fff ";
  char concat[50] = "";
  strcat(concat, str);
  strcat(concat, str2);
  printf("%s\n", concat);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    $0xa0,%edi
call   1050 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    $0xa0,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
lea    0xe95(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xe8f(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x32,%edx
call   1040 <memset@plt>
lea    -0x50(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1060 <strcat@plt>
lea    -0x50(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <strcat@plt>
lea    -0x50(%rbp),%rsi
lea    0xe5b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movw   $0x0,0x30(%rsp)
lea    0xebc(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <strcat@plt>
lea    0xeaf(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcat@plt>
lea    0xea5(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"iii \00"
@.str.1 = [5 x i8] c"fff \00"
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca [50 x i8]
%4 = call i8* @malloc(i32 160)
store i8* %4, i8** %1
%5 = call i8* @malloc(i32 160)
store i8* %5, i8** %2
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %2
%6 = bitcast [50 x i8]* %3 to i8*
%7 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%8 = load i8*, i8** %1
%9 = call i32 @strcat(i8* %7, i8* %8)
%10 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%11 = load i8*, i8** %2
%12 = call i32 @strcat(i8* %10, i8* %11)
%13 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%14 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %13)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"iii \00"
@.str.1 = [5 x i8] c"fff \00"
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [50 x i8]
%2 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%3 = call i32 @strcat(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @strcat(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %2)
ret i32 0
}