#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*/ strcats(char *, char *);
main() {
  char s[1000] = "hello ";
  char *t = "world!";
  strcats(s, t);
  printf("%s\n", s);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
lea    -0x3f0(%rbp),%rdi
xor    %esi,%esi
mov    $0x3e8,%edx
call   1040 <memset@plt>
movb   $0x68,-0x3f0(%rbp)
movb   $0x65,-0x3ef(%rbp)
movb   $0x6c,-0x3ee(%rbp)
movb   $0x6c,-0x3ed(%rbp)
movb   $0x6f,-0x3ec(%rbp)
movb   $0x20,-0x3eb(%rbp)
lea    0xe81(%rip),%rax
mov    %rax,-0x3f8(%rbp)
lea    -0x3f0(%rbp),%rdi
mov    -0x3f8(%rbp),%rsi
call   1050 <strcats@plt>
lea    -0x3f0(%rbp),%rsi
lea    0xe60(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x3f0,%rsp
mov    %rsp,%rbx
mov    $0x3e8,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
movl   $0x6c6c6568,(%rsp)
movw   $0x206f,0x4(%rsp)
lea    0xea1(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcats@plt>
lea    0xe99(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x3f0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"world!\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [1000 x i8]
%2 = alloca i8*
%3 = bitcast [1000 x i8]* %1 to i8*
%4 = bitcast i8* %3 to [1000 x i8]*
%5 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i32 0, i32 0
store i8 104, i8* %5
%6 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i32 0, i32 1
store i8 101, i8* %6
%7 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i32 0, i32 2
store i8 108, i8* %7
%8 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i32 0, i32 3
store i8 108, i8* %8
%9 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i32 0, i32 4
store i8 111, i8* %9
%10 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i32 0, i32 5
store i8 32, i8* %10
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %2
%11 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%12 = load i8*, i8** %2
%13 = call i32 @strcats(i8* %11, i8* %12)
%14 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %14)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"world!\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [1000 x i8]
%2 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
store i8 104, i8* %2
%3 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 1
store i8 101, i8* %3
%4 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 2
store i8 108, i8* %4
%5 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 3
store i8 108, i8* %5
%6 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 4
store i8 111, i8* %6
%7 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 5
store i8 32, i8* %7
%8 = call i32 @strcats(i8* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %2)
ret i32 0
}