#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 *);
int main(int argc, char **argv) {
  char source[] = "fresh2refresh";
  char target[] = "C tutorial";
  printf("Source string = %s", source);
  printf("Target string = %s", target);
  strcat(target, source);
  printf("Target string after strcat( ) = %s", target);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xec3(%rip),%rax
mov    %rax,-0x1e(%rbp)
mov    0xec1(%rip),%eax
mov    %eax,-0x16(%rbp)
mov    0xebb(%rip),%ax
mov    %ax,-0x12(%rbp)
mov    0xeb2(%rip),%rax
mov    %rax,-0x29(%rbp)
mov    0xeaf(%rip),%ax
mov    %ax,-0x21(%rbp)
mov    0xea7(%rip),%al
mov    %al,-0x1f(%rbp)
lea    -0x1e(%rbp),%rsi
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
lea    -0x29(%rbp),%rsi
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
lea    -0x29(%rbp),%rdi
lea    -0x1e(%rbp),%rsi
call   1040 <strcat@plt>
lea    -0x29(%rbp),%rsi
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
movabs $0x68736572666572,%rax
mov    %rax,0x1e(%rsp)
movabs $0x6572326873657266,%rax
32 72 65
mov    %rax,0x18(%rsp)
movabs $0x69726f7475742043,%rax
6f 72 69
mov    %rax,0x8(%rsp)
movl   $0x6c6169,0xf(%rsp)
lea    0xeb6(%rip),%rdi
lea    0x18(%rsp),%r14
mov    %r14,%rsi
call   1030 <printf@plt>
lea    0xeb5(%rip),%rdi
lea    0x8(%rsp),%rbx
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strcat@plt>
lea    0xea9(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.source = [14 x i8] c"fresh2refresh\00"
@__const.main.target = [11 x i8] c"C tutorial\00"
@.str = [19 x i8] c"Source string = %s\00"
@.str.1 = [19 x i8] c"Target string = %s\00"
@.str.2 = [35 x i8] c"Target string after strcat( ) = %s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [14 x i8]
%7 = alloca [11 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = bitcast [14 x i8]* %6 to i8*
%9 = bitcast [11 x i8]* %7 to i8*
%10 = getelementptr inbounds [14 x i8], [14 x i8]* %6, i64 0, i64 0
%11 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds [11 x i8], [11 x i8]* %7, i64 0, i64 0
%13 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = getelementptr inbounds [11 x i8], [11 x i8]* %7, i64 0, i64 0
%15 = getelementptr inbounds [14 x i8], [14 x i8]* %6, i64 0, i64 0
%16 = call i32 @strcat(i8* %14, i8* %15)
%17 = getelementptr inbounds [11 x i8], [11 x i8]* %7, i64 0, i64 0
%18 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i8* %17)
ret i32 0
}

LLVM IR (-O2):
@__const.main.source = [14 x i8] c"fresh2refresh\00"
@__const.main.target = [11 x i8] c"C tutorial\00"
@.str = [19 x i8] c"Source string = %s\00"
@.str.1 = [19 x i8] c"Target string = %s\00"
@.str.2 = [35 x i8] c"Target string after strcat( ) = %s\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [14 x i8]
%4 = alloca [11 x i8]
%5 = getelementptr inbounds [14 x i8], [14 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 0
%7 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %5)
%8 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%9 = call i32 @strcat(i8* %6, i8* %5)
%10 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i8* %6)
ret i32 0
}