int main() {
  char arr1[] = "gme2k";
  char *arr2[13] = {"gme2k"};
  char arr3[20] = "gme2k";
  int intArr[10];
  printf("Sizeof the three arr declarations are: %d  %d  %d\n", sizeof(arr1),
         sizeof(arr2), sizeof(arr3));
  printf("string length are separately: %d, %d\n", strlen(arr1), strlen(arr3));
  printf("strlen(arr2): %d\n", strlen(arr2));
  printf("sizeof intArr: %d\n", sizeof(intArr));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeb8(%rip),%eax
mov    %eax,-0xa(%rbp)
mov    0xeb2(%rip),%ax
mov    %ax,-0x6(%rbp)
lea    -0x80(%rbp),%rdi
xor    %esi,%esi
mov    $0x68,%edx
call   1050 <memset@plt>
lea    0xe93(%rip),%rax
mov    %rax,-0x80(%rbp)
mov    0xf18(%rip),%rax
mov    %rax,-0xa0(%rbp)
mov    0xf12(%rip),%rax
mov    %rax,-0x98(%rbp)
mov    0xf0d(%rip),%eax
mov    %eax,-0x90(%rbp)
lea    0xe66(%rip),%rdi
mov    $0x6,%esi
mov    $0x68,%edx
mov    $0x14,%ecx
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xa(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0xd8(%rbp)
lea    -0xa0(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0xd8(%rbp),%rsi
mov    %rax,%rdx
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x80(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rsi
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe66(%rip),%rdi
mov    $0x28,%esi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x68,%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)
movq   $0x0,0x60(%rsp)
lea    0xeac(%rip),%rax
mov    %rax,(%rsp)
lea    0xea7(%rip),%rdi
mov    $0x6,%esi
mov    $0x68,%edx
mov    $0x14,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xebd(%rip),%rdi
mov    $0x5,%esi
mov    $0x5,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%rdi
call   1030 <strlen@plt>
lea    0xec3(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec4(%rip),%rdi
mov    $0x28,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x68,%rsp
ret

LLVM IR (-O0):
@__const.main.arr1 = [6 x i8] c"gme2k\00"
@.str = [6 x i8] c"gme2k\00"
@__const.main.arr3 = [20 x i8] c"gme2k\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str.1 = [51 x i8] c"Sizeof the three arr declarations are: %d %d %d\0A\00"
@.str.2 = [38 x i8] c"string length are separately: %d, %d\0A\00"
@.str.3 = [18 x i8] c"strlen(arr2): %d\0A\00"
@.str.4 = [19 x i8] c"sizeof intArr: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [6 x i8]
%3 = alloca [13 x i8*]
%4 = alloca [20 x i8]
%5 = alloca [10 x i32]
store i32 0, i32* %1
%6 = bitcast [6 x i8]* %2 to i8*
%7 = bitcast [13 x i8*]* %3 to i8*
%8 = bitcast i8* %7 to <{ i8*, [12 x i8*] }>*
%9 = getelementptr inbounds <{ i8*, [12 x i8*] }>, <{ i8*, [12 x i8*] }>* %8, i32 0, i32 0
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i8** %9
%10 = bitcast [20 x i8]* %4 to i8*
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0), i64 6, i64 104, i64 20)
%12 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%13 = call i64 @strlen(i8* %12)
%14 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%15 = call i64 @strlen(i8* %14)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i64 %13, i64 %15)
%17 = getelementptr inbounds [13 x i8*], [13 x i8*]* %3, i64 0, i64 0
%18 = bitcast i8** %17 to i8*
%19 = call i64 @strlen(i8* %18)
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i64 %19)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i64 40)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"gme2k\00"
@.str.1 = [51 x i8] c"Sizeof the three arr declarations are: %d %d %d\0A\00"
@.str.2 = [38 x i8] c"string length are separately: %d, %d\0A\00"
@.str.3 = [18 x i8] c"strlen(arr2): %d\0A\00"
@.str.4 = [19 x i8] c"sizeof intArr: %d\0A\00"
define i32 @main() {
%1 = alloca [13 x i8*]
%2 = bitcast [13 x i8*]* %1 to i8*
%3 = getelementptr inbounds [13 x i8*], [13 x i8*]* %1, i64 0, i64 0
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %3
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0), i64 6, i64 104, i64 20)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i64 5, i64 5)
%6 = call i64 @strlen(i8* %2)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i64 %6)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i64 40)
ret i32 0
}