void main() {
  int i = 0;
  char names[5][20] = {
      "apple", "orange", "banana", "mango", "grapes",
  };
  for (i = 0; i < 5; i++) {
    printf("%s\n", names[i]);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
lea    0xec6(%rip),%rsi
mov    $0x64,%edx
call   1040 <memcpy@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x5,-0x4(%rbp)
jge    1180 <main+0x60>
movslq -0x4(%rbp),%rax
lea    -0x70(%rbp),%rsi
imul   $0x14,%rax,%rax
add    %rax,%rsi
lea    0xef9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    114b <main+0x2b>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
mov    0xf45(%rip),%eax
mov    %eax,0x60(%rsp)
movaps 0xf2a(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xf0e(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xef2(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xed6(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xeba(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe9e(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x50(%rsp),%rbx
mov    %rsp,%rdi
call   1030 <puts@plt>
lea    0x14(%rsp),%rdi
call   1030 <puts@plt>
lea    0x28(%rsp),%rdi
call   1030 <puts@plt>
lea    0x3c(%rsp),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.names = [5 x [20 x i8]] [[20 x i8] c"apple\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [20 x i8] c"orange\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [20 x i8] c"banana\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [20 x i8] c"mango\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [20 x i8] c"grapes\00\00\00\00\00\00\00\00\00\00\00\00\00\00"]
@.str = [4 x i8] c"%s\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca [5 x [20 x i8]]
store i32 0, i32* %1
%3 = bitcast [5 x [20 x i8]]* %2 to i8*
store i32 0, i32* %1
br label %4
4: ; preds = %13, %0
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 5
br i1 %6, label %7, label %16
7: ; preds = %4
%8 = load i32, i32* %1
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [5 x [20 x i8]], [5 x [20 x i8]]* %2, i64 0, i64 %9
%11 = getelementptr inbounds [20 x i8], [20 x i8]* %10, i64 0, i64 0
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %11)
br label %13
13: ; preds = %7
%14 = load i32, i32* %1
%15 = add nsw i32 %14, 1
store i32 %15, i32* %1
br label %4
16: ; preds = %4
ret void
}

LLVM IR (-O2):
@__const.main.names = [5 x [20 x i8]] [[20 x i8] c"apple\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [20 x i8] c"orange\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [20 x i8] c"banana\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [20 x i8] c"mango\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [20 x i8] c"grapes\00\00\00\00\00\00\00\00\00\00\00\00\00\00"]
define void @main() {
%1 = alloca [5 x [20 x i8]]
%2 = getelementptr inbounds [5 x [20 x i8]], [5 x [20 x i8]]* %1, i64 0, i64 0, i64 0
%3 = call i32 @puts(i8* %2)
%4 = getelementptr inbounds [5 x [20 x i8]], [5 x [20 x i8]]* %1, i64 0, i64 1, i64 0
%5 = call i32 @puts(i8* %4)
%6 = getelementptr inbounds [5 x [20 x i8]], [5 x [20 x i8]]* %1, i64 0, i64 2, i64 0
%7 = call i32 @puts(i8* %6)
%8 = getelementptr inbounds [5 x [20 x i8]], [5 x [20 x i8]]* %1, i64 0, i64 3, i64 0
%9 = call i32 @puts(i8* %8)
%10 = getelementptr inbounds [5 x [20 x i8]], [5 x [20 x i8]]* %1, i64 0, i64 4, i64 0
%11 = call i32 @puts(i8* %10)
ret void
}