#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 */
typedef int /*<<< orphan*/ y;
typedef int /*<<< orphan*/ x;

/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, char *, char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
main() {
  char *x = "this is a ";
  char y[] = "sitter";
  char *z;
  z = (char *)malloc(sizeof(x) + sizeof(y));
  strcpy(z, y);
  strcat(z, y);
  printf("%s+%s=%s", y, x, z);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xeb1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    0xeb2(%rip),%eax
mov    %eax,-0xf(%rbp)
mov    0xeac(%rip),%ax
mov    %ax,-0xb(%rbp)
mov    0xea4(%rip),%al
mov    %al,-0x9(%rbp)
mov    $0xf,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0xf(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rdi
lea    -0xf(%rbp),%rsi
call   1060 <strcat@plt>
lea    -0xf(%rbp),%rsi
mov    -0x8(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xe67(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
movl   $0x726574,0x3(%rsp)
movl   $0x74746973,(%rsp)
mov    $0xf,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rsp,%r14
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <strcat@plt>
lea    0xe92(%rip),%rdi
lea    0xe79(%rip),%rdx
mov    %r14,%rsi
mov    %rbx,%rcx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [11 x i8] c"this is a \00"
@__const.main.y = [7 x i8] c"sitter\00"
@.str.1 = [9 x i8] c"%s+%s=%s\00"
define i32 @main() {
%1 = alloca i8*
%2 = alloca [7 x i8]
%3 = alloca i8*
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8** %1
%4 = bitcast [7 x i8]* %2 to i8*
%5 = call i64 @malloc(i32 15)
%6 = inttoptr i64 %5 to i8*
store i8* %6, i8** %3
%7 = load i8*, i8** %3
%8 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%9 = call i32 @strcpy(i8* %7, i8* %8)
%10 = load i8*, i8** %3
%11 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%12 = call i32 @strcat(i8* %10, i8* %11)
%13 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%14 = load i8*, i8** %1
%15 = load i8*, i8** %3
%16 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %13, i8* %14, i8* %15)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"this is a \00"
@__const.main.y = [7 x i8] c"sitter\00"
@.str.1 = [9 x i8] c"%s+%s=%s\00"
define i32 @main() {
%1 = alloca [7 x i8]
%2 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%3 = tail call i64 @malloc(i32 15)
%4 = inttoptr i64 %3 to i8*
%5 = call i32 @strcpy(i8* %4, i8* %2)
%6 = call i32 @strcat(i8* %4, i8* %2)
%7 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %4)
ret i32 0
}