int main(int argc, char *argv[]) {
  char joke[] = "The joke is :\n\n";
  char str[][40] = {"My dog hasn't got any nose.\n",
                    "How dose your dog smell then?\n",
                    "My dog smells horrible.\n"};
  int strCount = strCount = sizeof(str) / sizeof(str[0]);
  int length = 0;
  int i = 0;
  for (i = 0; i < strCount; ++i) {
    length += sizeof(str[i]);
  }
  char haha[length + sizeof(joke) + 1];
  if (!strcpy(haha, joke)) {
    printf("Error copying joke to haha.%s", haha);
    return 1;
  }
  for (i = 0; i < strCount; ++i) {
    if (!strcat(haha, str[i])) {
      printf("Error copying string \"%s\"", str[i]);
      return 2;
    }
  }
  printf("%s", haha);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xea0(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xe9d(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0xa0(%rbp),%rdi
lea    0xe93(%rip),%rsi
mov    $0x78,%edx
call   1050 <memcpy@plt>
movl   $0x3,-0xa4(%rbp)
movl   $0x3,-0xa4(%rbp)
movl   $0x0,-0xa8(%rbp)
movl   $0x0,-0xac(%rbp)
movl   $0x0,-0xac(%rbp)
mov    -0xac(%rbp),%eax
cmp    -0xa4(%rbp),%eax
jge    11f0 <main+0xb0>
movslq -0xa8(%rbp),%rax
add    $0x28,%rax
mov    %eax,-0xa8(%rbp)
mov    -0xac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xac(%rbp)
jmp    11b9 <main+0x79>
movslq -0xa8(%rbp),%rcx
mov    %rcx,%rax
add    $0x11,%rax
mov    %rsp,%rdx
mov    %rdx,-0xb8(%rbp)
add    $0x20,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0xd0(%rbp)
mov    %rdi,%rsp
mov    %rax,-0xc0(%rbp)
lea    -0x20(%rbp),%rsi
call   1030 <strcpy@plt>
cmp    $0x0,%rax
jne    1265 <main+0x125>
mov    -0xd0(%rbp),%rsi
lea    0xe40(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0xc4(%rbp)
jmp    1324 <main+0x1e4>
movl   $0x0,-0xac(%rbp)
mov    -0xac(%rbp),%eax
cmp    -0xa4(%rbp),%eax
jge    12fe <main+0x1be>
mov    -0xd0(%rbp),%rdi
movslq -0xac(%rbp),%rax
lea    -0xa0(%rbp),%rsi
imul   $0x28,%rax,%rax
add    %rax,%rsi
call   1060 <strcat@plt>
cmp    $0x0,%rax
jne    12e5 <main+0x1a5>
movslq -0xac(%rbp),%rax
lea    -0xa0(%rbp),%rsi
imul   $0x28,%rax,%rax
add    %rax,%rsi
lea    0xdde(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x2,-0x4(%rbp)
movl   $0x1,-0xc4(%rbp)
jmp    1324 <main+0x1e4>
jmp    12ea <main+0x1aa>
mov    -0xac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xac(%rbp)
jmp    126f <main+0x12f>
mov    -0xd0(%rbp),%rsi
lea    0xd97(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0xc4(%rbp)
mov    -0xb8(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x120,%rsp
mov    %rsp,%r15
movaps 0xeba(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    0xf2f(%rip),%rax
mov    %rax,0x80(%rsp)
movaps 0xf10(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xef4(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xed8(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xebc(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xea0(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xe84(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xe68(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0x60(%rsp),%r14
lea    0x90(%rsp),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <strcat@plt>
lea    0x38(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <strcat@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strcat@plt>
lea    0xe97(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rsp
xor    %eax,%eax
add    $0x120,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.joke = [16 x i8] c"The joke is :\0A\0A\00"
@__const.main.str = [3 x [40 x i8]] [[40 x i8] c"My dog hasn't got any nose.\0A\00\00\00\00\00\00\00\00\00\00\00\00", [40 x i8] c"How dose your dog smell then?\0A\00\00\00\00\00\00\00\00\00\00", [40 x i8] c"My dog smells horrible.\0A\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"]
@.str = [30 x i8] c"Error copying joke to haha.%s\00"
@.str.1 = [26 x i8] c"Error copying string \22%s\22\00"
@.str.2 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [16 x i8]
%7 = alloca [3 x [40 x i8]]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i64
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = bitcast [16 x i8]* %6 to i8*
%15 = bitcast [3 x [40 x i8]]* %7 to i8*
store i32 3, i32* %8
store i32 3, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
store i32 0, i32* %10
br label %16
16: ; preds = %25, %2
%17 = load i32, i32* %10
%18 = load i32, i32* %8
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %28
20: ; preds = %16
%21 = load i32, i32* %9
%22 = sext i32 %21 to i64
%23 = add i64 %22, 40
%24 = trunc i64 %23 to i32
store i32 %24, i32* %9
br label %25
25: ; preds = %20
%26 = load i32, i32* %10
%27 = add nsw i32 %26, 1
store i32 %27, i32* %10
br label %16
28: ; preds = %16
%29 = load i32, i32* %9
%30 = sext i32 %29 to i64
%31 = add i64 %30, 16
%32 = add i64 %31, 1
%33 = call i8* @llvm.stacksave()
store i8* %33, i8** %11
%34 = alloca i8, i64 %32
store i64 %32, i64* %12
%35 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%36 = call i8* @strcpy(i8* %34, i8* %35)
%37 = icmp ne i8* %36, null
br i1 %37, label %40, label %38
38: ; preds = %28
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %34)
store i32 1, i32* %3
store i32 1, i32* %13
br label %64
40: ; preds = %28
store i32 0, i32* %10
br label %41
41: ; preds = %59, %40
%42 = load i32, i32* %10
%43 = load i32, i32* %8
%44 = icmp slt i32 %42, %43
br i1 %44, label %45, label %62
45: ; preds = %41
%46 = load i32, i32* %10
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [3 x [40 x i8]], [3 x [40 x i8]]* %7, i64 0, i64 %47
%49 = getelementptr inbounds [40 x i8], [40 x i8]* %48, i64 0, i64 0
%50 = call i8* @strcat(i8* %34, i8* %49)
%51 = icmp ne i8* %50, null
br i1 %51, label %58, label %52
52: ; preds = %45
%53 = load i32, i32* %10
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [3 x [40 x i8]], [3 x [40 x i8]]* %7, i64 0, i64 %54
%56 = getelementptr inbounds [40 x i8], [40 x i8]* %55, i64 0, i64 0
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %56)
store i32 2, i32* %3
store i32 1, i32* %13
br label %64
58: ; preds = %45
br label %59
59: ; preds = %58
%60 = load i32, i32* %10
%61 = add nsw i32 %60, 1
store i32 %61, i32* %10
br label %41
62: ; preds = %41
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %34)
store i32 0, i32* %3
store i32 1, i32* %13
br label %64
64: ; preds = %62, %52, %38
%65 = load i8*, i8** %11
%66 = load i32, i32* %3
ret i32 %66
}

LLVM IR (-O2):
@__const.main.joke = [16 x i8] c"The joke is :\0A\0A\00"
@__const.main.str = [3 x [40 x i8]] [[40 x i8] c"My dog hasn't got any nose.\0A\00\00\00\00\00\00\00\00\00\00\00\00", [40 x i8] c"How dose your dog smell then?\0A\00\00\00\00\00\00\00\00\00\00", [40 x i8] c"My dog smells horrible.\0A\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"]
@.str.2 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [16 x i8]
%4 = alloca [3 x [40 x i8]]
%5 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [3 x [40 x i8]], [3 x [40 x i8]]* %4, i64 0, i64 0, i64 0
%7 = tail call i8* @llvm.stacksave()
%8 = alloca [137 x i8]
%9 = getelementptr inbounds [137 x i8], [137 x i8]* %8, i64 0, i64 0
%10 = call i8* @strcpy(i8* %9, i8* %5)
%11 = call i8* @strcat(i8* %9, i8* %6)
%12 = getelementptr inbounds [3 x [40 x i8]], [3 x [40 x i8]]* %4, i64 0, i64 1, i64 0
%13 = call i8* @strcat(i8* %9, i8* %12)
%14 = getelementptr inbounds [3 x [40 x i8]], [3 x [40 x i8]]* %4, i64 0, i64 2, i64 0
%15 = call i8* @strcat(i8* %9, i8* %14)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %9)
ret i32 0
}