#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*/ printf(char *, ...);
void test2D() {
  char c[10][20];
  int x;
  int y;
  printf("test2D:\n");
  for (y = 0; y < 10; y++) {
    for (x = 0; x < 20; x++) {
      c[y][x] = 'a' + (15 & (y * 19 + x));
    }
  }
  for (y = 0; y < 10; y++) {
    for (x = 0; x < 20; x++) {
      printf("%c", c[y][x]);
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<test2D>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
lea    0xede(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xd8(%rbp)
cmpl   $0xa,-0xd8(%rbp)
jge    11b8 <test2D+0xa8>
movl   $0x0,-0xd4(%rbp)
cmpl   $0x14,-0xd4(%rbp)
jge    119f <test2D+0x8f>
imul   $0x13,-0xd8(%rbp),%eax
add    -0xd4(%rbp),%eax
and    $0xf,%eax
add    $0x61,%eax
mov    %al,%dl
movslq -0xd8(%rbp),%rcx
lea    -0xd0(%rbp),%rax
imul   $0x14,%rcx,%rcx
add    %rcx,%rax
movslq -0xd4(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd4(%rbp)
jmp    114a <test2D+0x3a>
jmp    11a4 <test2D+0x94>
mov    -0xd8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd8(%rbp)
jmp    1133 <test2D+0x23>
movl   $0x0,-0xd8(%rbp)
cmpl   $0xa,-0xd8(%rbp)
jge    124a <test2D+0x13a>
movl   $0x0,-0xd4(%rbp)
cmpl   $0x14,-0xd4(%rbp)
jge    1228 <test2D+0x118>
movslq -0xd8(%rbp),%rcx
lea    -0xd0(%rbp),%rax
imul   $0x14,%rcx,%rcx
add    %rcx,%rax
movslq -0xd4(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xdfc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd4(%rbp)
jmp    11d9 <test2D+0xc9>
lea    0xdd8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xd8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd8(%rbp)
jmp    11c2 <test2D+0xb2>
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test2D>:
push   %rbx
sub    $0xd0,%rsp
lea    0xf21(%rip),%rdi
call   1040 <puts@plt>
lea    0x13(%rsp),%rax
xor    %ecx,%ecx
movdqa 0xebc(%rip),%xmm8
movdqa 0xec4(%rip),%xmm1
movdqa 0xecc(%rip),%xmm2
movdqa 0xed4(%rip),%xmm3
movdqa 0xedc(%rip),%xmm4
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movd   %ecx,%xmm5
punpcklbw %xmm5,%xmm5
pshuflw $0x0,%xmm5,%xmm6
paddb  %xmm8,%xmm5
movdqa %xmm6,%xmm7
paddb  %xmm1,%xmm7
paddb  %xmm2,%xmm6
lea    0x1(%rcx),%edx
movzbl %cl,%esi
movzbl %dl,%edx
mov    %edx,%edi
shl    $0x8,%edi
or     %esi,%edi
movd   %edi,%xmm0
punpcklwd %xmm5,%xmm0
punpckldq %xmm7,%xmm0
punpcklqdq %xmm6,%xmm0
pand   %xmm3,%xmm0
paddb  %xmm4,%xmm0
movdqu %xmm0,-0x13(%rax)
mov    %ecx,%ebx
and    $0xf,%bl
add    $0x61,%bl
mov    %bl,-0x3(%rax)
and    $0xf,%dl
add    $0x61,%dl
mov    %dl,-0x2(%rax)
lea    0x2(%rcx),%edx
and    $0xf,%dl
add    $0x61,%dl
mov    %dl,-0x1(%rax)
lea    0x3(%rcx),%edx
and    $0xf,%dl
add    $0x61,%dl
mov    %dl,(%rax)
add    $0x13,%rcx
add    $0x14,%rax
cmp    $0xbe,%rcx
jne    1170 <test2D+0x50>
mov    $0x13,%ebx
movsbl -0x13(%rsp,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl -0x12(%rsp,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl -0x11(%rsp,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl -0x10(%rsp,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl -0xf(%rsp,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl -0xe(%rsp,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl -0xd(%rsp,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl -0xc(%rsp,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl -0xb(%rsp,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl -0xa(%rsp,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl -0x9(%rsp,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl -0x8(%rsp,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl -0x7(%rsp,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl -0x6(%rsp,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl -0x5(%rsp,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl -0x4(%rsp,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl -0x3(%rsp,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl -0x2(%rsp,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl -0x1(%rsp,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl (%rsp,%rbx,1),%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x14,%rbx
cmp    $0xdb,%rbx
jne    1200 <test2D+0xe0>
add    $0xd0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"test2D:\0A\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @test2D() {
%1 = alloca [10 x [20 x i8]]
%2 = alloca i32
%3 = alloca i32
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %5
5: ; preds = %30, %0
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 10
br i1 %7, label %8, label %33
8: ; preds = %5
store i32 0, i32* %2
br label %9
9: ; preds = %26, %8
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 20
br i1 %11, label %12, label %29
12: ; preds = %9
%13 = load i32, i32* %3
%14 = mul nsw i32 %13, 19
%15 = load i32, i32* %2
%16 = add nsw i32 %14, %15
%17 = and i32 15, %16
%18 = add nsw i32 97, %17
%19 = trunc i32 %18 to i8
%20 = load i32, i32* %3
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [10 x [20 x i8]], [10 x [20 x i8]]* %1, i64 0, i64 %21
%23 = load i32, i32* %2
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [20 x i8], [20 x i8]* %22, i64 0, i64 %24
store i8 %19, i8* %25
br label %26
26: ; preds = %12
%27 = load i32, i32* %2
%28 = add nsw i32 %27, 1
store i32 %28, i32* %2
br label %9
29: ; preds = %9
br label %30
30: ; preds = %29
%31 = load i32, i32* %3
%32 = add nsw i32 %31, 1
store i32 %32, i32* %3
br label %5
33: ; preds = %5
store i32 0, i32* %3
br label %34
34: ; preds = %56, %33
%35 = load i32, i32* %3
%36 = icmp slt i32 %35, 10
br i1 %36, label %37, label %59
37: ; preds = %34
store i32 0, i32* %2
br label %38
38: ; preds = %51, %37
%39 = load i32, i32* %2
%40 = icmp slt i32 %39, 20
br i1 %40, label %41, label %54
41: ; preds = %38
%42 = load i32, i32* %3
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [10 x [20 x i8]], [10 x [20 x i8]]* %1, i64 0, i64 %43
%45 = load i32, i32* %2
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [20 x i8], [20 x i8]* %44, i64 0, i64 %46
%48 = load i8, i8* %47
%49 = sext i8 %48 to i32
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %49)
br label %51
51: ; preds = %41
%52 = load i32, i32* %2
%53 = add nsw i32 %52, 1
store i32 %53, i32* %2
br label %38
54: ; preds = %38
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %56
56: ; preds = %54
%57 = load i32, i32* %3
%58 = add nsw i32 %57, 1
store i32 %58, i32* %3
br label %34
59: ; preds = %34
ret void
}

LLVM IR (-O2):
@str = [8 x i8] c"test2D:\00"
define void @test2D() {
%1 = alloca [10 x [20 x i8]]
%2 = getelementptr inbounds [10 x [20 x i8]], [10 x [20 x i8]]* %1, i64 0, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
br label %4
4: ; preds = %0, %4
%5 = phi i64 [ 0, %0 ], [ %54, %4 ]
%6 = trunc i64 %5 to i32
%7 = mul nuw nsw i32 %6, 19
%8 = trunc i32 %7 to i8
%9 = getelementptr inbounds [10 x [20 x i8]], [10 x [20 x i8]]* %1, i64 0, i64 %5, i64 0
%10 = trunc i32 %7 to i8
%11 = add i8 %10, 1
%12 = trunc i32 %7 to i8
%13 = insertelement <2 x i8> undef, i8 %12, i64 0
%14 = shufflevector <2 x i8> %13, <2 x i8> poison, <2 x i32> zeroinitializer
%15 = add <2 x i8> %14, <i8 2, i8 3>
%16 = trunc i32 %7 to i8
%17 = insertelement <4 x i8> undef, i8 %16, i64 0
%18 = shufflevector <4 x i8> %17, <4 x i8> poison, <4 x i32> zeroinitializer
%19 = add <4 x i8> %18, <i8 4, i8 5, i8 6, i8 7>
%20 = trunc i32 %7 to i8
%21 = insertelement <8 x i8> undef, i8 %20, i64 0
%22 = shufflevector <8 x i8> %21, <8 x i8> poison, <8 x i32> zeroinitializer
%23 = add <8 x i8> %22, <i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15>
%24 = insertelement <16 x i8> poison, i8 %8, i64 0
%25 = insertelement <16 x i8> %24, i8 %11, i64 1
%26 = shufflevector <2 x i8> %15, <2 x i8> poison, <16 x i32> <i32 0, i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
%27 = shufflevector <16 x i8> %25, <16 x i8> %26, <16 x i32> <i32 0, i32 1, i32 16, i32 17, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
%28 = shufflevector <4 x i8> %19, <4 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
%29 = shufflevector <16 x i8> %27, <16 x i8> %28, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 16, i32 17, i32 18, i32 19, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
%30 = shufflevector <8 x i8> %23, <8 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
%31 = shufflevector <16 x i8> %29, <16 x i8> %30, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23>
%32 = and <16 x i8> %31, <i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15>
%33 = add nuw nsw <16 x i8> %32, <i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97>
%34 = bitcast i8* %9 to <16 x i8>*
store <16 x i8> %33, <16 x i8>* %34
%35 = trunc i32 %7 to i8
%36 = and i8 %35, 15
%37 = add nuw nsw i8 %36, 97
%38 = getelementptr inbounds [10 x [20 x i8]], [10 x [20 x i8]]* %1, i64 0, i64 %5, i64 16
store i8 %37, i8* %38
%39 = trunc i32 %7 to i8
%40 = add i8 %39, 1
%41 = and i8 %40, 15
%42 = add nuw nsw i8 %41, 97
%43 = getelementptr inbounds [10 x [20 x i8]], [10 x [20 x i8]]* %1, i64 0, i64 %5, i64 17
store i8 %42, i8* %43
%44 = trunc i32 %7 to i8
%45 = add i8 %44, 2
%46 = and i8 %45, 15
%47 = add nuw nsw i8 %46, 97
%48 = getelementptr inbounds [10 x [20 x i8]], [10 x [20 x i8]]* %1, i64 0, i64 %5, i64 18
store i8 %47, i8* %48
%49 = trunc i32 %7 to i8
%50 = add i8 %49, 3
%51 = and i8 %50, 15
%52 = add nuw nsw i8 %51, 97
%53 = getelementptr inbounds [10 x [20 x i8]], [10 x [20 x i8]]* %1, i64 0, i64 %5, i64 19
store i8 %52, i8* %53
%54 = add nuw nsw i64 %5, 1
%55 = icmp eq i64 %54, 10
br i1 %55, label %56, label %4
56: ; preds = %4, %56
%57 = phi i64 [ %139, %56 ], [ 0, %4 ]
%58 = getelementptr inbounds [10 x [20 x i8]], [10 x [20 x i8]]* %1, i64 0, i64 %57, i64 0
%59 = load i8, i8* %58
%60 = sext i8 %59 to i32
%61 = tail call i32 @putchar(i32 %60)
%62 = getelementptr inbounds [10 x [20 x i8]], [10 x [20 x i8]]* %1, i64 0, i64 %57, i64 1
%63 = load i8, i8* %62
%64 = sext i8 %63 to i32
%65 = tail call i32 @putchar(i32 %64)
%66 = getelementptr inbounds [10 x [20 x i8]], [10 x [20 x i8]]* %1, i64 0, i64 %57, i64 2
%67 = load i8, i8* %66
%68 = sext i8 %67 to i32
%69 = tail call i32 @putchar(i32 %68)
%70 = getelementptr inbounds [10 x [20 x i8]], [10 x [20 x i8]]* %1, i64 0, i64 %57, i64 3
%71 = load i8, i8* %70
%72 = sext i8 %71 to i32
%73 = tail call i32 @putchar(i32 %72)
%74 = getelementptr inbounds [10 x [20 x i8]], [10 x [20 x i8]]* %1, i64 0, i64 %57, i64 4
%75 = load i8, i8* %74
%76 = sext i8 %75 to i32
%77 = tail call i32 @putchar(i32 %76)
%78 = getelementptr inbounds [10 x [20 x i8]], [10 x [20 x i8]]* %1, i64 0, i64 %57, i64 5
%79 = load i8, i8* %78
%80 = sext i8 %79 to i32
%81 = tail call i32 @putchar(i32 %80)
%82 = getelementptr inbounds [10 x [20 x i8]], [10 x [20 x i8]]* %1, i64 0, i64 %57, i64 6
%83 = load i8, i8* %82
%84 = sext i8 %83 to i32
%85 = tail call i32 @putchar(i32 %84)
%86 = getelementptr inbounds [10 x [20 x i8]], [10 x [20 x i8]]* %1, i64 0, i64 %57, i64 7
%87 = load i8, i8* %86
%88 = sext i8 %87 to i32
%89 = tail call i32 @putchar(i32 %88)
%90 = getelementptr inbounds [10 x [20 x i8]], [10 x [20 x i8]]* %1, i64 0, i64 %57, i64 8
%91 = load i8, i8* %90
%92 = sext i8 %91 to i32
%93 = tail call i32 @putchar(i32 %92)
%94 = getelementptr inbounds [10 x [20 x i8]], [10 x [20 x i8]]* %1, i64 0, i64 %57, i64 9
%95 = load i8, i8* %94
%96 = sext i8 %95 to i32
%97 = tail call i32 @putchar(i32 %96)
%98 = getelementptr inbounds [10 x [20 x i8]], [10 x [20 x i8]]* %1, i64 0, i64 %57, i64 10
%99 = load i8, i8* %98
%100 = sext i8 %99 to i32
%101 = tail call i32 @putchar(i32 %100)
%102 = getelementptr inbounds [10 x [20 x i8]], [10 x [20 x i8]]* %1, i64 0, i64 %57, i64 11
%103 = load i8, i8* %102
%104 = sext i8 %103 to i32
%105 = tail call i32 @putchar(i32 %104)
%106 = getelementptr inbounds [10 x [20 x i8]], [10 x [20 x i8]]* %1, i64 0, i64 %57, i64 12
%107 = load i8, i8* %106
%108 = sext i8 %107 to i32
%109 = tail call i32 @putchar(i32 %108)
%110 = getelementptr inbounds [10 x [20 x i8]], [10 x [20 x i8]]* %1, i64 0, i64 %57, i64 13
%111 = load i8, i8* %110
%112 = sext i8 %111 to i32
%113 = tail call i32 @putchar(i32 %112)
%114 = getelementptr inbounds [10 x [20 x i8]], [10 x [20 x i8]]* %1, i64 0, i64 %57, i64 14
%115 = load i8, i8* %114
%116 = sext i8 %115 to i32
%117 = tail call i32 @putchar(i32 %116)
%118 = getelementptr inbounds [10 x [20 x i8]], [10 x [20 x i8]]* %1, i64 0, i64 %57, i64 15
%119 = load i8, i8* %118
%120 = sext i8 %119 to i32
%121 = tail call i32 @putchar(i32 %120)
%122 = getelementptr inbounds [10 x [20 x i8]], [10 x [20 x i8]]* %1, i64 0, i64 %57, i64 16
%123 = load i8, i8* %122
%124 = sext i8 %123 to i32
%125 = tail call i32 @putchar(i32 %124)
%126 = getelementptr inbounds [10 x [20 x i8]], [10 x [20 x i8]]* %1, i64 0, i64 %57, i64 17
%127 = load i8, i8* %126
%128 = sext i8 %127 to i32
%129 = tail call i32 @putchar(i32 %128)
%130 = getelementptr inbounds [10 x [20 x i8]], [10 x [20 x i8]]* %1, i64 0, i64 %57, i64 18
%131 = load i8, i8* %130
%132 = sext i8 %131 to i32
%133 = tail call i32 @putchar(i32 %132)
%134 = getelementptr inbounds [10 x [20 x i8]], [10 x [20 x i8]]* %1, i64 0, i64 %57, i64 19
%135 = load i8, i8* %134
%136 = sext i8 %135 to i32
%137 = tail call i32 @putchar(i32 %136)
%138 = tail call i32 @putchar(i32 10)
%139 = add nuw nsw i64 %57, 1
%140 = icmp eq i64 %139, 10
br i1 %140, label %141, label %56
141: ; preds = %56
ret void
}