#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*/ my_strcat(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strcat_ptr(char *, char *);
int main() {
  char test_string1[100] = "bacon";
  char test_string2[100] = " and eggs";
  printf("\n%s", test_string1);
  printf("\n%s", test_string2);
  my_strcat(test_string1, test_string2);
  printf("\n%s", test_string1);
  char test_string3[100] = "peanut butter";
  char test_string4[100] = " and jelly";
  printf("\n%s", test_string3);
  printf("\n%s", test_string4);
  strcat_ptr(test_string3, test_string4);
  printf("\n%s", test_string3);
  printf("\n\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c0,%rsp
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1050 <memset@plt>
movb   $0x62,-0x70(%rbp)
movb   $0x61,-0x6f(%rbp)
movb   $0x63,-0x6e(%rbp)
movb   $0x6f,-0x6d(%rbp)
movb   $0x6e,-0x6c(%rbp)
lea    -0xe0(%rbp),%rdi
lea    0xe73(%rip),%rsi
mov    $0x64,%edx
call   1070 <memcpy@plt>
lea    -0x70(%rbp),%rsi
lea    0xfa2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xe0(%rbp),%rsi
lea    0xf8d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x70(%rbp),%rdi
lea    -0xe0(%rbp),%rsi
call   1060 <my_strcat@plt>
lea    -0x70(%rbp),%rsi
lea    0xf6b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x150(%rbp),%rdi
lea    0xe82(%rip),%rsi
mov    $0x64,%edx
call   1070 <memcpy@plt>
lea    -0x1c0(%rbp),%rdi
lea    0xeda(%rip),%rsi
mov    $0x64,%edx
call   1070 <memcpy@plt>
lea    -0x150(%rbp),%rsi
lea    0xf26(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x1c0(%rbp),%rsi
lea    0xf11(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x150(%rbp),%rdi
lea    -0x1c0(%rbp),%rsi
call   1030 <strcat_ptr@plt>
lea    -0x150(%rbp),%rsi
lea    0xee9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xedf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x1c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x1c0,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movl   $0x0,0x60(%rsp)
movl   $0x6f636162,(%rsp)
movb   $0x6e,0x4(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,0x1a0(%rsp)
movaps 0xeaa(%rip),%xmm0
movaps %xmm0,0x190(%rsp)
movaps 0xe8b(%rip),%xmm0
movaps %xmm0,0x180(%rsp)
movaps 0xe6c(%rip),%xmm0
movaps %xmm0,0x170(%rsp)
movaps 0xe4d(%rip),%xmm0
movaps %xmm0,0x160(%rsp)
movaps 0xe2e(%rip),%xmm0
movaps %xmm0,0x150(%rsp)
movl   $0x0,0x1b0(%rsp)
lea    0xf58(%rip),%r14
mov    %rsp,%r15
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x150(%rsp),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <my_strcat@plt>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
movaps 0xe90(%rip),%xmm0
movaps %xmm0,0x130(%rsp)
movaps 0xe71(%rip),%xmm0
movaps %xmm0,0x120(%rsp)
movaps 0xe52(%rip),%xmm0
movaps %xmm0,0x110(%rsp)
movaps 0xe33(%rip),%xmm0
movaps %xmm0,0x100(%rsp)
movaps 0xe14(%rip),%xmm0
movaps %xmm0,0xf0(%rsp)
movaps 0xdf5(%rip),%xmm0
movaps %xmm0,0xe0(%rsp)
movl   $0x0,0x140(%rsp)
movaps 0xe9b(%rip),%xmm0
movaps %xmm0,0xc0(%rsp)
movaps 0xe7c(%rip),%xmm0
movaps %xmm0,0xb0(%rsp)
movaps 0xe5d(%rip),%xmm0
movaps %xmm0,0xa0(%rsp)
movaps 0xe3e(%rip),%xmm0
movaps %xmm0,0x90(%rsp)
movaps 0xe1f(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movaps 0xe00(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movl   $0x0,0xd0(%rsp)
lea    0xe0(%rsp),%r15
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x70(%rsp),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <strcat_ptr@plt>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe12(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x1c0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.test_string2 = [100 x i8] c" and eggs\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [4 x i8] c"\0A%s\00"
@__const.main.test_string3 = [100 x i8] c"peanut butter\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@__const.main.test_string4 = [100 x i8] c" and jelly\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str.1 = [3 x i8] c"\0A\0A\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca [100 x i8]
%3 = alloca [100 x i8]
%4 = alloca [100 x i8]
%5 = bitcast [100 x i8]* %1 to i8*
%6 = bitcast i8* %5 to [100 x i8]*
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i32 0, i32 0
store i8 98, i8* %7
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i32 0, i32 1
store i8 97, i8* %8
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i32 0, i32 2
store i8 99, i8* %9
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i32 0, i32 3
store i8 111, i8* %10
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i32 0, i32 4
store i8 110, i8* %11
%12 = bitcast [100 x i8]* %2 to i8*
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%19 = call i32 @my_strcat(i8* %17, i8* %18)
%20 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %20)
%22 = bitcast [100 x i8]* %3 to i8*
%23 = bitcast [100 x i8]* %4 to i8*
%24 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %24)
%26 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %26)
%28 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%29 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%30 = call i32 @strcat_ptr(i8* %28, i8* %29)
%31 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %31)
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@__const.main.test_string2 = [100 x i8] c" and eggs\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [4 x i8] c"\0A%s\00"
@__const.main.test_string3 = [100 x i8] c"peanut butter\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@__const.main.test_string4 = [100 x i8] c" and jelly\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@str = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca [100 x i8]
%3 = alloca [100 x i8]
%4 = alloca [100 x i8]
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
store i8 98, i8* %5
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 1
store i8 97, i8* %6
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 2
store i8 99, i8* %7
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 3
store i8 111, i8* %8
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 4
store i8 110, i8* %9
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %5)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %10)
%13 = call i32 @my_strcat(i8* %5, i8* %10)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %5)
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %15)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %16)
%19 = call i32 @strcat_ptr(i8* %15, i8* %16)
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %15)
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
ret i32 0
}