int main() {
  char *s1 = "hello";
  char s2[] = "hello";
  char *s3 = s2;
  char **s4 = &s3;
  char **s5 = &s1;
  char(*s6)[6] = &s2;
  printf("s1=[%s]\n", s1);
  printf("s2=[%s]\n", s2);
  printf("s3=[%s]\n", s3);
  printf("s4=[%s]\n", *s4);
  printf("s5=[%s]\n", *s5);
  printf("s6=[%s]\n", s6);
  printf("size of s1: %d \n", sizeof(s1));
  printf("size of s2: %d \n", sizeof(s2));
  printf("%c \t %20i \t %c \n", s3[0], s6[0], *(s6[0]));
  s2[0] = 'H';
  printf("%c \t %20i \t %c \n", s3[0], s6[0], (*s6)[0]);
  printf("%c \t %20i \t %c \n", s1[0], s5[0], *s5[0]);
  printf("%c \t %20c \t %c \n", s1[0], (*s5)[0], *(s5[0]));
  for (int i = 0; i < 6; i++) {
    printf("s1: [%s] \n", s1 + i);
    printf("s2: [%s] \n", s2 + i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xed0(%rip),%eax
mov    %eax,-0x16(%rbp)
mov    0xeca(%rip),%ax
mov    %ax,-0x12(%rbp)
lea    -0x16(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    -0x16(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x16(%rbp),%rsi
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rax
mov    (%rax),%rsi
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%rax
mov    (%rax),%rsi
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%rsi
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe65(%rip),%rdi
mov    $0x8,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe63(%rip),%rdi
mov    $0x6,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
movsbl (%rax),%esi
mov    -0x38(%rbp),%rdx
mov    -0x38(%rbp),%rax
movsbl (%rax),%ecx
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movb   $0x48,-0x16(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%esi
mov    -0x38(%rbp),%rdx
mov    -0x38(%rbp),%rax
movsbl (%rax),%ecx
lea    0xe2b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movsbl (%rax),%esi
mov    -0x30(%rbp),%rax
mov    (%rax),%rdx
mov    -0x30(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%ecx
lea    0xe05(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movsbl (%rax),%esi
mov    -0x30(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%edx
mov    -0x30(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%ecx
lea    0xded(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x3c(%rbp)
cmpl   $0x6,-0x3c(%rbp)
jge    12da <main+0x1ca>
mov    -0x10(%rbp),%rsi
movslq -0x3c(%rbp),%rax
add    %rax,%rsi
lea    0xdd4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x16(%rbp),%rsi
movslq -0x3c(%rbp),%rax
add    %rax,%rsi
lea    0xdc6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1290 <main+0x180>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
movw   $0x6f,0x4(%rsp)
movl   $0x6c6c6568,(%rsp)
lea    0x4(%rsp),%r14
lea    0xece(%rip),%r15
lea    0xecd(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec5(%rip),%rdi
mov    %rsp,%r12
mov    %r12,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeba(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeb2(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeaa(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xea2(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe9a(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe98(%rip),%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1030 <printf@plt>
movsbl (%rsp),%ecx
lea    0xe92(%rip),%rbx
mov    %rbx,%rdi
mov    %ecx,%esi
mov    %r12,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
movb   $0x48,(%rsp)
mov    %rbx,%rdi
mov    $0x48,%esi
mov    %r12,%rdx
mov    $0x48,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x68,%esi
mov    %r15,%rdx
mov    $0x68,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe5b(%rip),%rdi
mov    $0x68,%esi
mov    $0x68,%edx
mov    $0x68,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe4f(%rip),%rbx
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe46(%rip),%r15
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xda8(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x1(%rsp),%rsi
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xd89(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x2(%rsp),%rsi
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xd6a(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x3(%rsp),%rsi
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xd4b(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xd2e(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x5(%rsp),%rsi
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"hello\00"
@__const.main.s2 = [6 x i8] c"hello\00"
@.str.1 = [9 x i8] c"s1=[%s]\0A\00"
@.str.2 = [9 x i8] c"s2=[%s]\0A\00"
@.str.3 = [9 x i8] c"s3=[%s]\0A\00"
@.str.4 = [9 x i8] c"s4=[%s]\0A\00"
@.str.5 = [9 x i8] c"s5=[%s]\0A\00"
@.str.6 = [9 x i8] c"s6=[%s]\0A\00"
@.str.7 = [17 x i8] c"size of s1: %d \0A\00"
@.str.8 = [17 x i8] c"size of s2: %d \0A\00"
@.str.9 = [17 x i8] c"%c \09 %20i \09 %c \0A\00"
@.str.10 = [17 x i8] c"%c \09 %20c \09 %c \0A\00"
@.str.11 = [11 x i8] c"s1: [%s] \0A\00"
@.str.12 = [11 x i8] c"s2: [%s] \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca [6 x i8]
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i8**
%7 = alloca [6 x i8]*
%8 = alloca i32
store i32 0, i32* %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %2
%9 = bitcast [6 x i8]* %3 to i8*
%10 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
store i8* %10, i8** %4
store i8** %4, i8*** %5
store i8** %2, i8*** %6
store [6 x i8]* %3, [6 x i8]** %7
%11 = load i8*, i8** %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%13 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %13)
%15 = load i8*, i8** %4
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* %15)
%17 = load i8**, i8*** %5
%18 = load i8*, i8** %17
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* %18)
%20 = load i8**, i8*** %6
%21 = load i8*, i8** %20
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i8* %21)
%23 = load [6 x i8]*, [6 x i8]** %7
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), [6 x i8]* %23)
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i64 8)
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i64 6)
%27 = load i8*, i8** %4
%28 = getelementptr inbounds i8, i8* %27, i64 0
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = load [6 x i8]*, [6 x i8]** %7
%32 = getelementptr inbounds [6 x i8], [6 x i8]* %31, i64 0
%33 = getelementptr inbounds [6 x i8], [6 x i8]* %32, i64 0, i64 0
%34 = load [6 x i8]*, [6 x i8]** %7
%35 = getelementptr inbounds [6 x i8], [6 x i8]* %34, i64 0
%36 = getelementptr inbounds [6 x i8], [6 x i8]* %35, i64 0, i64 0
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i32 %30, i8* %33, i32 %38)
%40 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
store i8 72, i8* %40
%41 = load i8*, i8** %4
%42 = getelementptr inbounds i8, i8* %41, i64 0
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = load [6 x i8]*, [6 x i8]** %7
%46 = getelementptr inbounds [6 x i8], [6 x i8]* %45, i64 0
%47 = getelementptr inbounds [6 x i8], [6 x i8]* %46, i64 0, i64 0
%48 = load [6 x i8]*, [6 x i8]** %7
%49 = getelementptr inbounds [6 x i8], [6 x i8]* %48, i64 0, i64 0
%50 = load i8, i8* %49
%51 = sext i8 %50 to i32
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i32 %44, i8* %47, i32 %51)
%53 = load i8*, i8** %2
%54 = getelementptr inbounds i8, i8* %53, i64 0
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = load i8**, i8*** %6
%58 = getelementptr inbounds i8*, i8** %57, i64 0
%59 = load i8*, i8** %58
%60 = load i8**, i8*** %6
%61 = getelementptr inbounds i8*, i8** %60, i64 0
%62 = load i8*, i8** %61
%63 = load i8, i8* %62
%64 = sext i8 %63 to i32
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i32 %56, i8* %59, i32 %64)
%66 = load i8*, i8** %2
%67 = getelementptr inbounds i8, i8* %66, i64 0
%68 = load i8, i8* %67
%69 = sext i8 %68 to i32
%70 = load i8**, i8*** %6
%71 = load i8*, i8** %70
%72 = getelementptr inbounds i8, i8* %71, i64 0
%73 = load i8, i8* %72
%74 = sext i8 %73 to i32
%75 = load i8**, i8*** %6
%76 = getelementptr inbounds i8*, i8** %75, i64 0
%77 = load i8*, i8** %76
%78 = load i8, i8* %77
%79 = sext i8 %78 to i32
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0), i32 %69, i32 %74, i32 %79)
store i32 0, i32* %8
br label %81
81: ; preds = %95, %0
%82 = load i32, i32* %8
%83 = icmp slt i32 %82, 6
br i1 %83, label %84, label %98
84: ; preds = %81
%85 = load i8*, i8** %2
%86 = load i32, i32* %8
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds i8, i8* %85, i64 %87
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0), i8* %88)
%90 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
%91 = load i32, i32* %8
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds i8, i8* %90, i64 %92
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), i8* %93)
br label %95
95: ; preds = %84
%96 = load i32, i32* %8
%97 = add nsw i32 %96, 1
store i32 %97, i32* %8
br label %81
98: ; preds = %81
ret i32 0
}

LLVM IR (-O2):
@__const.main.s2 = [6 x i8] c"hello\00"
@.str.1 = [9 x i8] c"s1=[%s]\0A\00"
@.str.2 = [9 x i8] c"s2=[%s]\0A\00"
@.str.3 = [9 x i8] c"s3=[%s]\0A\00"
@.str.4 = [9 x i8] c"s4=[%s]\0A\00"
@.str.5 = [9 x i8] c"s5=[%s]\0A\00"
@.str.6 = [9 x i8] c"s6=[%s]\0A\00"
@.str.7 = [17 x i8] c"size of s1: %d \0A\00"
@.str.8 = [17 x i8] c"size of s2: %d \0A\00"
@.str.9 = [17 x i8] c"%c \09 %20i \09 %c \0A\00"
@.str.10 = [17 x i8] c"%c \09 %20c \09 %c \0A\00"
@.str.11 = [11 x i8] c"s1: [%s] \0A\00"
@.str.12 = [11 x i8] c"s2: [%s] \0A\00"
define i32 @main() {
%1 = alloca [6 x i8]
%2 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @__const.main.s2, i64 0, i64 0))
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* %2)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* %2)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @__const.main.s2, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), [6 x i8]* %1)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i64 8)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i64 6)
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i32 %12, i8* %2, i32 %12)
store i8 72, i8* %2
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i32 72, i8* %2, i32 72)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i32 104, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @__const.main.s2, i64 0, i64 0), i32 104)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0), i32 104, i32 104, i32 104)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @__const.main.s2, i64 0, i64 0))
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), i8* %2)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @__const.main.s2, i64 0, i64 1))
%20 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 1
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), i8* %20)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @__const.main.s2, i64 0, i64 2))
%23 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 2
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), i8* %23)
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @__const.main.s2, i64 0, i64 3))
%26 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 3
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), i8* %26)
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @__const.main.s2, i64 0, i64 4))
%29 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 4
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), i8* %29)
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @__const.main.s2, i64 0, i64 5))
%32 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 5
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), i8* %32)
ret i32 0
}