#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 *, char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main(void) {
  char testbuff[128];
  char *test[] = {"", "1", "12", "123", "1234"};
  size_t numtests = sizeof test / sizeof test[0];
  size_t thistest;
  size_t inner;
  for (thistest = 0; thistest < numtests; thistest++) {
    for (inner = 0; inner < numtests; inner++) {
      strcpy(testbuff, test[thistest]);
      strcat(testbuff, test[inner]);
      printf("[%s] + [%s] = [%s]\n", test[thistest], test[inner], testbuff);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xc0(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1050 <memset@plt>
lea    0xeb5(%rip),%rax
mov    %rax,-0xc0(%rbp)
lea    0xe86(%rip),%rax
mov    %rax,-0xb8(%rbp)
lea    0xe7a(%rip),%rax
mov    %rax,-0xb0(%rbp)
lea    0xe6f(%rip),%rax
mov    %rax,-0xa8(%rbp)
lea    0xe65(%rip),%rax
mov    %rax,-0xa0(%rbp)
movq   $0x5,-0xc8(%rbp)
movq   $0x0,-0xd0(%rbp)
mov    -0xd0(%rbp),%rax
cmp    -0xc8(%rbp),%rax
jae    128e <main+0x14e>
movq   $0x0,-0xd8(%rbp)
mov    -0xd8(%rbp),%rax
cmp    -0xc8(%rbp),%rax
jae    1272 <main+0x132>
lea    -0x90(%rbp),%rdi
mov    -0xd0(%rbp),%rax
mov    -0xc0(%rbp,%rax,8),%rsi
ff
call   1030 <strcpy@plt>
lea    -0x90(%rbp),%rdi
mov    -0xd8(%rbp),%rax
mov    -0xc0(%rbp,%rax,8),%rsi
ff
call   1060 <strcat@plt>
mov    -0xd0(%rbp),%rax
mov    -0xc0(%rbp,%rax,8),%rsi
ff
mov    -0xd8(%rbp),%rax
mov    -0xc0(%rbp,%rax,8),%rdx
ff
lea    -0x90(%rbp),%rcx
lea    0xdb8(%rip),%rdi
call   1040 <printf@plt>
mov    -0xd8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xd8(%rbp)
jmp    11e0 <main+0xa0>
jmp    1277 <main+0x137>
mov    -0xd0(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xd0(%rbp)
jmp    11c1 <main+0x81>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb8,%rsp
lea    0xed9(%rip),%r15
mov    %r15,(%rsp)
lea    0xead(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0xea3(%rip),%rax
mov    %rax,0x10(%rsp)
lea    0xe9a(%rip),%rax
mov    %rax,0x18(%rsp)
lea    0xe92(%rip),%rax
mov    %rax,0x20(%rsp)
xor    %r12d,%r12d
lea    0x30(%rsp),%rbp
lea    0xe83(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    %rbp,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
mov    %rbp,%rdi
lea    0xe7c(%rip),%r13
mov    %r13,%rsi
call   1050 <strcat@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r13,%rdx
mov    %rbp,%rcx
call   1040 <printf@plt>
mov    %rbp,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
mov    %rbp,%rdi
lea    0xe2d(%rip),%rbx
mov    %rbx,%rsi
call   1050 <strcat@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
mov    %rbp,%rcx
call   1040 <printf@plt>
mov    %rbp,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
mov    %rbp,%rdi
lea    0xe01(%rip),%rbx
mov    %rbx,%rsi
call   1050 <strcat@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
mov    %rbp,%rcx
call   1040 <printf@plt>
mov    %rbp,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
mov    %rbp,%rdi
lea    0xdd6(%rip),%rbx
mov    %rbx,%rsi
call   1050 <strcat@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
mov    %rbp,%rcx
call   1040 <printf@plt>
mov    %rbp,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
mov    %rbp,%rdi
lea    0xdac(%rip),%rbx
mov    %rbx,%rsi
call   1050 <strcat@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
mov    %rbp,%rcx
call   1040 <printf@plt>
cmp    $0x4,%r12
je     128a <main+0x15a>
mov    0x8(%rsp,%r12,8),%r15
add    $0x1,%r12
jmp    1190 <main+0x60>
xor    %eax,%eax
add    $0xb8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [2 x i8] c"1\00"
@.str.2 = [3 x i8] c"12\00"
@.str.3 = [4 x i8] c"123\00"
@.str.4 = [5 x i8] c"1234\00"
@.str.5 = [20 x i8] c"[%s] + [%s] = [%s]\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [128 x i8]
%3 = alloca [5 x i8*]
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i32 0, i32* %1
%7 = bitcast [5 x i8*]* %3 to i8*
%8 = bitcast i8* %7 to [5 x i8*]*
%9 = getelementptr inbounds [5 x i8*], [5 x i8*]* %8, i32 0, i32 0
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i32 0, i32 0), i8** %9
%10 = getelementptr inbounds [5 x i8*], [5 x i8*]* %8, i32 0, i32 1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i32 0, i32 0), i8** %10
%11 = getelementptr inbounds [5 x i8*], [5 x i8*]* %8, i32 0, i32 2
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i32 0, i32 0), i8** %11
%12 = getelementptr inbounds [5 x i8*], [5 x i8*]* %8, i32 0, i32 3
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0), i8** %12
%13 = getelementptr inbounds [5 x i8*], [5 x i8*]* %8, i32 0, i32 4
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i32 0, i32 0), i8** %13
store i64 5, i64* %4
store i64 0, i64* %5
br label %14
14: ; preds = %46, %0
%15 = load i64, i64* %5
%16 = load i64, i64* %4
%17 = icmp ult i64 %15, %16
br i1 %17, label %18, label %49
18: ; preds = %14
store i64 0, i64* %6
br label %19
19: ; preds = %42, %18
%20 = load i64, i64* %6
%21 = load i64, i64* %4
%22 = icmp ult i64 %20, %21
br i1 %22, label %23, label %45
23: ; preds = %19
%24 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%25 = load i64, i64* %5
%26 = getelementptr inbounds [5 x i8*], [5 x i8*]* %3, i64 0, i64 %25
%27 = load i8*, i8** %26
%28 = call i32 @strcpy(i8* %24, i8* %27)
%29 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%30 = load i64, i64* %6
%31 = getelementptr inbounds [5 x i8*], [5 x i8*]* %3, i64 0, i64 %30
%32 = load i8*, i8** %31
%33 = call i32 @strcat(i8* %29, i8* %32)
%34 = load i64, i64* %5
%35 = getelementptr inbounds [5 x i8*], [5 x i8*]* %3, i64 0, i64 %34
%36 = load i8*, i8** %35
%37 = load i64, i64* %6
%38 = getelementptr inbounds [5 x i8*], [5 x i8*]* %3, i64 0, i64 %37
%39 = load i8*, i8** %38
%40 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%41 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i8* %36, i8* %39, i8* %40)
br label %42
42: ; preds = %23
%43 = load i64, i64* %6
%44 = add i64 %43, 1
store i64 %44, i64* %6
br label %19
45: ; preds = %19
br label %46
46: ; preds = %45
%47 = load i64, i64* %5
%48 = add i64 %47, 1
store i64 %48, i64* %5
br label %14
49: ; preds = %14
ret i32 0
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [2 x i8] c"1\00"
@.str.2 = [3 x i8] c"12\00"
@.str.3 = [4 x i8] c"123\00"
@.str.4 = [5 x i8] c"1234\00"
@.str.5 = [20 x i8] c"[%s] + [%s] = [%s]\0A\00"
define i32 @main() {
%1 = alloca [128 x i8]
%2 = alloca [5 x i8*]
%3 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%4 = bitcast [5 x i8*]* %2 to i8*
%5 = getelementptr inbounds [5 x i8*], [5 x i8*]* %2, i64 0, i64 0
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %5
%6 = getelementptr inbounds [5 x i8*], [5 x i8*]* %2, i64 0, i64 1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8** %6
%7 = getelementptr inbounds [5 x i8*], [5 x i8*]* %2, i64 0, i64 2
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8** %7
%8 = getelementptr inbounds [5 x i8*], [5 x i8*]* %2, i64 0, i64 3
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8** %8
%9 = getelementptr inbounds [5 x i8*], [5 x i8*]* %2, i64 0, i64 4
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8** %9
br label %10
10: ; preds = %30, %0
%11 = phi i8* [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %0 ], [ %32, %30 ]
%12 = phi i64 [ 0, %0 ], [ %28, %30 ]
%13 = call i32 @strcpy(i8* %3, i8* %11)
%14 = call i32 @strcat(i8* %3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i8* %11, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %3)
%16 = call i32 @strcpy(i8* %3, i8* %11)
%17 = call i32 @strcat(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%18 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%19 = call i32 @strcpy(i8* %3, i8* %11)
%20 = call i32 @strcat(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%21 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%22 = call i32 @strcpy(i8* %3, i8* %11)
%23 = call i32 @strcat(i8* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%24 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %3)
%25 = call i32 @strcpy(i8* %3, i8* %11)
%26 = call i32 @strcat(i8* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%27 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* %3)
%28 = add nuw nsw i64 %12, 1
%29 = icmp eq i64 %28, 5
br i1 %29, label %33, label %30
30: ; preds = %10
%31 = getelementptr inbounds [5 x i8*], [5 x i8*]* %2, i64 0, i64 %28
%32 = load i8*, i8** %31
br label %10
33: ; preds = %10
ret i32 0
}