#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*/ assert(int);
char *concatStrs(char *, char *, int);
int /*<<< orphan*/ printf(char *);
void concatStrsTestA() {
  char *result = concatStrs("test", "string", 10);
  assert(result && result[0] == 't' && result[1] == 'e' && result[2] == 's' &&
         result[3] == 't' && result[4] == 's' && result[5] == 't' &&
         result[6] == 'r' && result[7] == 'i' && result[8] == 'n' &&
         result[9] == 'g' && result[10] == '\0');
  printf("Test successful.");
}


x86 assembly (clang, -O0):
<concatStrsTestA>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    0xebf(%rip),%rsi
mov    $0xa,%edx
call   1050 <concatStrs@plt>
mov    %rax,-0x8(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x9(%rbp)
je     1250 <concatStrsTestA+0x120>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x74,%ecx
mov    %al,-0x9(%rbp)
jne    1250 <concatStrsTestA+0x120>
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%ecx
xor    %eax,%eax
cmp    $0x65,%ecx
mov    %al,-0x9(%rbp)
jne    1250 <concatStrsTestA+0x120>
mov    -0x8(%rbp),%rax
movsbl 0x2(%rax),%ecx
xor    %eax,%eax
cmp    $0x73,%ecx
mov    %al,-0x9(%rbp)
jne    1250 <concatStrsTestA+0x120>
mov    -0x8(%rbp),%rax
movsbl 0x3(%rax),%ecx
xor    %eax,%eax
cmp    $0x74,%ecx
mov    %al,-0x9(%rbp)
jne    1250 <concatStrsTestA+0x120>
mov    -0x8(%rbp),%rax
movsbl 0x4(%rax),%ecx
xor    %eax,%eax
cmp    $0x73,%ecx
mov    %al,-0x9(%rbp)
jne    1250 <concatStrsTestA+0x120>
mov    -0x8(%rbp),%rax
movsbl 0x5(%rax),%ecx
xor    %eax,%eax
cmp    $0x74,%ecx
mov    %al,-0x9(%rbp)
jne    1250 <concatStrsTestA+0x120>
mov    -0x8(%rbp),%rax
movsbl 0x6(%rax),%ecx
xor    %eax,%eax
cmp    $0x72,%ecx
mov    %al,-0x9(%rbp)
jne    1250 <concatStrsTestA+0x120>
mov    -0x8(%rbp),%rax
movsbl 0x7(%rax),%ecx
xor    %eax,%eax
cmp    $0x69,%ecx
mov    %al,-0x9(%rbp)
jne    1250 <concatStrsTestA+0x120>
mov    -0x8(%rbp),%rax
movsbl 0x8(%rax),%ecx
xor    %eax,%eax
cmp    $0x6e,%ecx
mov    %al,-0x9(%rbp)
jne    1250 <concatStrsTestA+0x120>
mov    -0x8(%rbp),%rax
movsbl 0x9(%rax),%ecx
xor    %eax,%eax
cmp    $0x67,%ecx
mov    %al,-0x9(%rbp)
jne    1250 <concatStrsTestA+0x120>
mov    -0x8(%rbp),%rax
movsbl 0xa(%rax),%eax
cmp    $0x0,%eax
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xda8(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<concatStrsTestA>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0xec6(%rip),%rsi
mov    $0xa,%edx
call   1050 <concatStrs@plt>
xor    %edi,%edi
test   %rax,%rax
je     1195 <concatStrsTestA+0x65>
cmpb   $0x74,(%rax)
jne    1195 <concatStrsTestA+0x65>
cmpb   $0x65,0x1(%rax)
jne    1195 <concatStrsTestA+0x65>
cmpb   $0x73,0x2(%rax)
jne    1195 <concatStrsTestA+0x65>
cmpb   $0x74,0x3(%rax)
jne    1195 <concatStrsTestA+0x65>
cmpb   $0x73,0x4(%rax)
jne    1195 <concatStrsTestA+0x65>
cmpb   $0x74,0x5(%rax)
jne    1195 <concatStrsTestA+0x65>
cmpb   $0x72,0x6(%rax)
jne    1195 <concatStrsTestA+0x65>
cmpb   $0x69,0x7(%rax)
jne    1195 <concatStrsTestA+0x65>
cmpb   $0x6e,0x8(%rax)
jne    1195 <concatStrsTestA+0x65>
cmpb   $0x67,0x9(%rax)
jne    1195 <concatStrsTestA+0x65>
xor    %edi,%edi
cmpb   $0x0,0xa(%rax)
sete   %dil
call   1040 <assert@plt>
lea    0xe6b(%rip),%rdi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"test\00"
@.str.1 = [7 x i8] c"string\00"
@.str.2 = [17 x i8] c"Test successful.\00"
define void @concatStrsTestA() {
%1 = alloca i8*
%2 = call i8* @concatStrs(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 10)
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %71
5: ; preds = %0
%6 = load i8*, i8** %1
%7 = getelementptr inbounds i8, i8* %6, i64 0
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 116
br i1 %10, label %11, label %71
11: ; preds = %5
%12 = load i8*, i8** %1
%13 = getelementptr inbounds i8, i8* %12, i64 1
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 101
br i1 %16, label %17, label %71
17: ; preds = %11
%18 = load i8*, i8** %1
%19 = getelementptr inbounds i8, i8* %18, i64 2
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 115
br i1 %22, label %23, label %71
23: ; preds = %17
%24 = load i8*, i8** %1
%25 = getelementptr inbounds i8, i8* %24, i64 3
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 116
br i1 %28, label %29, label %71
29: ; preds = %23
%30 = load i8*, i8** %1
%31 = getelementptr inbounds i8, i8* %30, i64 4
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 115
br i1 %34, label %35, label %71
35: ; preds = %29
%36 = load i8*, i8** %1
%37 = getelementptr inbounds i8, i8* %36, i64 5
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = icmp eq i32 %39, 116
br i1 %40, label %41, label %71
41: ; preds = %35
%42 = load i8*, i8** %1
%43 = getelementptr inbounds i8, i8* %42, i64 6
%44 = load i8, i8* %43
%45 = sext i8 %44 to i32
%46 = icmp eq i32 %45, 114
br i1 %46, label %47, label %71
47: ; preds = %41
%48 = load i8*, i8** %1
%49 = getelementptr inbounds i8, i8* %48, i64 7
%50 = load i8, i8* %49
%51 = sext i8 %50 to i32
%52 = icmp eq i32 %51, 105
br i1 %52, label %53, label %71
53: ; preds = %47
%54 = load i8*, i8** %1
%55 = getelementptr inbounds i8, i8* %54, i64 8
%56 = load i8, i8* %55
%57 = sext i8 %56 to i32
%58 = icmp eq i32 %57, 110
br i1 %58, label %59, label %71
59: ; preds = %53
%60 = load i8*, i8** %1
%61 = getelementptr inbounds i8, i8* %60, i64 9
%62 = load i8, i8* %61
%63 = sext i8 %62 to i32
%64 = icmp eq i32 %63, 103
br i1 %64, label %65, label %71
65: ; preds = %59
%66 = load i8*, i8** %1
%67 = getelementptr inbounds i8, i8* %66, i64 10
%68 = load i8, i8* %67
%69 = sext i8 %68 to i32
%70 = icmp eq i32 %69, 0
br label %71
71: ; preds = %65, %59, %53, %47, %41, %35, %29, %23, %17, %11, %5, %0
%72 = phi i1 [ false, %59 ], [ false, %53 ], [ false, %47 ], [ false, %41 ], [ false, %35 ], [ false, %29 ], [ false, %23 ], [ false, %17 ], [ false, %11 ], [ false, %5 ], [ false, %0 ], [ %70, %65 ]
%73 = zext i1 %72 to i32
%74 = call i32 @assert(i32 %73)
%75 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"test\00"
@.str.1 = [7 x i8] c"string\00"
@.str.2 = [17 x i8] c"Test successful.\00"
define void @concatStrsTestA() {
%1 = tail call i8* @concatStrs(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 10)
%2 = icmp eq i8* %1, null
br i1 %2, label %47, label %3
3: ; preds = %0
%4 = load i8, i8* %1
%5 = icmp eq i8 %4, 116
br i1 %5, label %6, label %47
6: ; preds = %3
%7 = getelementptr inbounds i8, i8* %1, i64 1
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 101
br i1 %9, label %10, label %47
10: ; preds = %6
%11 = getelementptr inbounds i8, i8* %1, i64 2
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 115
br i1 %13, label %14, label %47
14: ; preds = %10
%15 = getelementptr inbounds i8, i8* %1, i64 3
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 116
br i1 %17, label %18, label %47
18: ; preds = %14
%19 = getelementptr inbounds i8, i8* %1, i64 4
%20 = load i8, i8* %19
%21 = icmp eq i8 %20, 115
br i1 %21, label %22, label %47
22: ; preds = %18
%23 = getelementptr inbounds i8, i8* %1, i64 5
%24 = load i8, i8* %23
%25 = icmp eq i8 %24, 116
br i1 %25, label %26, label %47
26: ; preds = %22
%27 = getelementptr inbounds i8, i8* %1, i64 6
%28 = load i8, i8* %27
%29 = icmp eq i8 %28, 114
br i1 %29, label %30, label %47
30: ; preds = %26
%31 = getelementptr inbounds i8, i8* %1, i64 7
%32 = load i8, i8* %31
%33 = icmp eq i8 %32, 105
br i1 %33, label %34, label %47
34: ; preds = %30
%35 = getelementptr inbounds i8, i8* %1, i64 8
%36 = load i8, i8* %35
%37 = icmp eq i8 %36, 110
br i1 %37, label %38, label %47
38: ; preds = %34
%39 = getelementptr inbounds i8, i8* %1, i64 9
%40 = load i8, i8* %39
%41 = icmp eq i8 %40, 103
br i1 %41, label %42, label %47
42: ; preds = %38
%43 = getelementptr inbounds i8, i8* %1, i64 10
%44 = load i8, i8* %43
%45 = icmp eq i8 %44, 0
%46 = zext i1 %45 to i32
br label %47
47: ; preds = %42, %38, %34, %30, %26, %22, %18, %14, %10, %6, %3, %0
%48 = phi i32 [ 0, %38 ], [ 0, %34 ], [ 0, %30 ], [ 0, %26 ], [ 0, %22 ], [ 0, %18 ], [ 0, %14 ], [ 0, %10 ], [ 0, %6 ], [ 0, %3 ], [ 0, %0 ], [ %46, %42 ]
%49 = tail call i32 @assert(i32 %48)
%50 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
ret void
}