void shiftRight(char grid[21][21]) {
  int buffer[21];
  int x, y;
  for (y = 0; y < 21; y++)
    buffer[y] = grid[21 - 1][y];
  for (y = 0; y < 21; y++)
    for (x = 21; x > 0; x--)
      grid[x][y] = grid[x - 1][y];
  for (y = 0; y < 21; y++)
    grid[0][y] = buffer[y];
  return;
}


x86 assembly (clang, -O0):
<shiftRight>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x68(%rbp)
cmpl   $0x15,-0x68(%rbp)
jge    113f <shiftRight+0x3f>
mov    -0x8(%rbp),%rax
movslq -0x68(%rbp),%rcx
movsbl 0x1a4(%rax,%rcx,1),%ecx
movslq -0x68(%rbp),%rax
mov    %ecx,-0x60(%rbp,%rax,4)
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    110f <shiftRight+0xf>
movl   $0x0,-0x68(%rbp)
cmpl   $0x15,-0x68(%rbp)
jge    11b3 <shiftRight+0xb3>
movl   $0x15,-0x64(%rbp)
cmpl   $0x0,-0x64(%rbp)
jle    11a0 <shiftRight+0xa0>
mov    -0x8(%rbp),%rax
mov    -0x64(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
imul   $0x15,%rcx,%rcx
add    %rcx,%rax
movslq -0x68(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
movslq -0x64(%rbp),%rcx
imul   $0x15,%rcx,%rcx
add    %rcx,%rax
movslq -0x68(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x64(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x64(%rbp)
jmp    1157 <shiftRight+0x57>
jmp    11a5 <shiftRight+0xa5>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    1146 <shiftRight+0x46>
movl   $0x0,-0x68(%rbp)
cmpl   $0x15,-0x68(%rbp)
jge    11e7 <shiftRight+0xe7>
movslq -0x68(%rbp),%rax
mov    -0x60(%rbp,%rax,4),%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0x68(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    11ba <shiftRight+0xba>
pop    %rbp
ret

x86 assembly (clang, -O2):
<shiftRight>:
push   %rbx
movups 0x1a4(%rdi),%xmm0
mov    0x1b4(%rdi),%r9b
mov    0x1b5(%rdi),%r10b
mov    0x1b6(%rdi),%r11b
mov    0x1b7(%rdi),%sil
mov    0x1b8(%rdi),%r8b
movaps %xmm0,-0x10(%rsp)
mov    -0x10(%rsp),%dl
lea    0x1b9(%rdi),%rax
mov    $0xffffffffffffffec,%rcx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %dl,0x14(%rax,%rcx,1)
movzbl -0x16(%rax,%rcx,1),%edx
mov    %dl,-0x1(%rax,%rcx,1)
movzbl -0x2b(%rax,%rcx,1),%edx
mov    %dl,-0x16(%rax,%rcx,1)
movzbl -0x40(%rax,%rcx,1),%edx
mov    %dl,-0x2b(%rax,%rcx,1)
movzbl -0x55(%rax,%rcx,1),%edx
mov    %dl,-0x40(%rax,%rcx,1)
movzbl -0x6a(%rax,%rcx,1),%edx
mov    %dl,-0x55(%rax,%rcx,1)
movzbl -0x7f(%rax,%rcx,1),%edx
mov    %dl,-0x6a(%rax,%rcx,1)
movzbl -0x94(%rax,%rcx,1),%edx
ff
mov    %dl,-0x7f(%rax,%rcx,1)
movzbl -0xbe(%rax,%rcx,1),%edx
ff
movzbl -0xa9(%rax,%rcx,1),%ebx
ff
mov    %bl,-0x94(%rax,%rcx,1)
mov    %dl,-0xa9(%rax,%rcx,1)
movzbl -0xd3(%rax,%rcx,1),%edx
ff
mov    %dl,-0xbe(%rax,%rcx,1)
movzbl -0xe8(%rax,%rcx,1),%edx
ff
mov    %dl,-0xd3(%rax,%rcx,1)
movzbl -0xfd(%rax,%rcx,1),%edx
ff
mov    %dl,-0xe8(%rax,%rcx,1)
movzbl -0x112(%rax,%rcx,1),%edx
ff
mov    %dl,-0xfd(%rax,%rcx,1)
movzbl -0x127(%rax,%rcx,1),%edx
ff
mov    %dl,-0x112(%rax,%rcx,1)
movzbl -0x13c(%rax,%rcx,1),%edx
ff
mov    %dl,-0x127(%rax,%rcx,1)
movzbl -0x151(%rax,%rcx,1),%edx
ff
mov    %dl,-0x13c(%rax,%rcx,1)
movzbl -0x166(%rax,%rcx,1),%edx
ff
mov    %dl,-0x151(%rax,%rcx,1)
movzbl -0x17b(%rax,%rcx,1),%edx
ff
mov    %dl,-0x166(%rax,%rcx,1)
movzbl -0x190(%rax,%rcx,1),%edx
ff
mov    %dl,-0x17b(%rax,%rcx,1)
movzbl -0x1a5(%rax,%rcx,1),%edx
ff
mov    %dl,-0x190(%rax,%rcx,1)
test   %rcx,%rcx
je     126b <shiftRight+0x16b>
movzbl (%rax,%rcx,1),%edx
add    $0x1,%rcx
jmp    1150 <shiftRight+0x50>
movups %xmm0,(%rdi)
mov    %r9b,0x10(%rdi)
mov    %r10b,0x11(%rdi)
mov    %r11b,0x12(%rdi)
mov    %sil,0x13(%rdi)
mov    %r8b,0x14(%rdi)
pop    %rbx
ret

LLVM IR (-O0):
define void @shiftRight([21 x i8]* %0) {
%2 = alloca [21 x i8]*
%3 = alloca [21 x i32]
%4 = alloca i32
%5 = alloca i32
store [21 x i8]* %0, [21 x i8]** %2
store i32 0, i32* %5
br label %6
6: ; preds = %20, %1
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 21
br i1 %8, label %9, label %23
9: ; preds = %6
%10 = load [21 x i8]*, [21 x i8]** %2
%11 = getelementptr inbounds [21 x i8], [21 x i8]* %10, i64 20
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [21 x i8], [21 x i8]* %11, i64 0, i64 %13
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = load i32, i32* %5
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [21 x i32], [21 x i32]* %3, i64 0, i64 %18
store i32 %16, i32* %19
br label %20
20: ; preds = %9
%21 = load i32, i32* %5
%22 = add nsw i32 %21, 1
store i32 %22, i32* %5
br label %6
23: ; preds = %6
store i32 0, i32* %5
br label %24
24: ; preds = %52, %23
%25 = load i32, i32* %5
%26 = icmp slt i32 %25, 21
br i1 %26, label %27, label %55
27: ; preds = %24
store i32 21, i32* %4
br label %28
28: ; preds = %48, %27
%29 = load i32, i32* %4
%30 = icmp sgt i32 %29, 0
br i1 %30, label %31, label %51
31: ; preds = %28
%32 = load [21 x i8]*, [21 x i8]** %2
%33 = load i32, i32* %4
%34 = sub nsw i32 %33, 1
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [21 x i8], [21 x i8]* %32, i64 %35
%37 = load i32, i32* %5
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [21 x i8], [21 x i8]* %36, i64 0, i64 %38
%40 = load i8, i8* %39
%41 = load [21 x i8]*, [21 x i8]** %2
%42 = load i32, i32* %4
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [21 x i8], [21 x i8]* %41, i64 %43
%45 = load i32, i32* %5
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [21 x i8], [21 x i8]* %44, i64 0, i64 %46
store i8 %40, i8* %47
br label %48
48: ; preds = %31
%49 = load i32, i32* %4
%50 = add nsw i32 %49, -1
store i32 %50, i32* %4
br label %28
51: ; preds = %28
br label %52
52: ; preds = %51
%53 = load i32, i32* %5
%54 = add nsw i32 %53, 1
store i32 %54, i32* %5
br label %24
55: ; preds = %24
store i32 0, i32* %5
br label %56
56: ; preds = %70, %55
%57 = load i32, i32* %5
%58 = icmp slt i32 %57, 21
br i1 %58, label %59, label %73
59: ; preds = %56
%60 = load i32, i32* %5
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [21 x i32], [21 x i32]* %3, i64 0, i64 %61
%63 = load i32, i32* %62
%64 = trunc i32 %63 to i8
%65 = load [21 x i8]*, [21 x i8]** %2
%66 = getelementptr inbounds [21 x i8], [21 x i8]* %65, i64 0
%67 = load i32, i32* %5
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [21 x i8], [21 x i8]* %66, i64 0, i64 %68
store i8 %64, i8* %69
br label %70
70: ; preds = %59
%71 = load i32, i32* %5
%72 = add nsw i32 %71, 1
store i32 %72, i32* %5
br label %56
73: ; preds = %56
ret void
}

LLVM IR (-O2):
define void @shiftRight([21 x i8]* nocapture %0) {
%2 = getelementptr inbounds [21 x i8], [21 x i8]* %0, i64 20, i64 0
%3 = bitcast i8* %2 to <16 x i8>*
%4 = load <16 x i8>, <16 x i8>* %3
%5 = getelementptr inbounds [21 x i8], [21 x i8]* %0, i64 20, i64 16
%6 = load i8, i8* %5
%7 = getelementptr inbounds [21 x i8], [21 x i8]* %0, i64 20, i64 17
%8 = load i8, i8* %7
%9 = getelementptr inbounds [21 x i8], [21 x i8]* %0, i64 20, i64 18
%10 = load i8, i8* %9
%11 = getelementptr inbounds [21 x i8], [21 x i8]* %0, i64 20, i64 19
%12 = load i8, i8* %11
%13 = getelementptr inbounds [21 x i8], [21 x i8]* %0, i64 20, i64 20
%14 = load i8, i8* %13
%15 = extractelement <16 x i8> %4, i64 0
br label %16
16: ; preds = %63, %1
%17 = phi i8 [ %15, %1 ], [ %65, %63 ]
%18 = phi i64 [ 0, %1 ], [ %61, %63 ]
%19 = getelementptr inbounds [21 x i8], [21 x i8]* %0, i64 20, i64 %18
%20 = getelementptr inbounds [21 x i8], [21 x i8]* %0, i64 21, i64 %18
store i8 %17, i8* %20
%21 = getelementptr inbounds [21 x i8], [21 x i8]* %0, i64 19, i64 %18
%22 = load i8, i8* %21
store i8 %22, i8* %19
%23 = getelementptr inbounds [21 x i8], [21 x i8]* %0, i64 18, i64 %18
%24 = load i8, i8* %23
store i8 %24, i8* %21
%25 = getelementptr inbounds [21 x i8], [21 x i8]* %0, i64 17, i64 %18
%26 = load i8, i8* %25
store i8 %26, i8* %23
%27 = getelementptr inbounds [21 x i8], [21 x i8]* %0, i64 16, i64 %18
%28 = load i8, i8* %27
store i8 %28, i8* %25
%29 = getelementptr inbounds [21 x i8], [21 x i8]* %0, i64 15, i64 %18
%30 = load i8, i8* %29
store i8 %30, i8* %27
%31 = getelementptr inbounds [21 x i8], [21 x i8]* %0, i64 14, i64 %18
%32 = load i8, i8* %31
store i8 %32, i8* %29
%33 = getelementptr inbounds [21 x i8], [21 x i8]* %0, i64 13, i64 %18
%34 = load i8, i8* %33
store i8 %34, i8* %31
%35 = getelementptr inbounds [21 x i8], [21 x i8]* %0, i64 12, i64 %18
%36 = load i8, i8* %35
store i8 %36, i8* %33
%37 = getelementptr inbounds [21 x i8], [21 x i8]* %0, i64 11, i64 %18
%38 = load i8, i8* %37
store i8 %38, i8* %35
%39 = getelementptr inbounds [21 x i8], [21 x i8]* %0, i64 10, i64 %18
%40 = load i8, i8* %39
store i8 %40, i8* %37
%41 = getelementptr inbounds [21 x i8], [21 x i8]* %0, i64 9, i64 %18
%42 = load i8, i8* %41
store i8 %42, i8* %39
%43 = getelementptr inbounds [21 x i8], [21 x i8]* %0, i64 8, i64 %18
%44 = load i8, i8* %43
store i8 %44, i8* %41
%45 = getelementptr inbounds [21 x i8], [21 x i8]* %0, i64 7, i64 %18
%46 = load i8, i8* %45
store i8 %46, i8* %43
%47 = getelementptr inbounds [21 x i8], [21 x i8]* %0, i64 6, i64 %18
%48 = load i8, i8* %47
store i8 %48, i8* %45
%49 = getelementptr inbounds [21 x i8], [21 x i8]* %0, i64 5, i64 %18
%50 = load i8, i8* %49
store i8 %50, i8* %47
%51 = getelementptr inbounds [21 x i8], [21 x i8]* %0, i64 4, i64 %18
%52 = load i8, i8* %51
store i8 %52, i8* %49
%53 = getelementptr inbounds [21 x i8], [21 x i8]* %0, i64 3, i64 %18
%54 = load i8, i8* %53
store i8 %54, i8* %51
%55 = getelementptr inbounds [21 x i8], [21 x i8]* %0, i64 2, i64 %18
%56 = load i8, i8* %55
store i8 %56, i8* %53
%57 = getelementptr inbounds [21 x i8], [21 x i8]* %0, i64 1, i64 %18
%58 = load i8, i8* %57
store i8 %58, i8* %55
%59 = getelementptr inbounds [21 x i8], [21 x i8]* %0, i64 0, i64 %18
%60 = load i8, i8* %59
store i8 %60, i8* %57
%61 = add nuw nsw i64 %18, 1
%62 = icmp eq i64 %61, 21
br i1 %62, label %66, label %63
63: ; preds = %16
%64 = getelementptr inbounds [21 x i8], [21 x i8]* %0, i64 20, i64 %61
%65 = load i8, i8* %64
br label %16
66: ; preds = %16
%67 = bitcast [21 x i8]* %0 to <16 x i8>*
store <16 x i8> %4, <16 x i8>* %67
%68 = getelementptr inbounds [21 x i8], [21 x i8]* %0, i64 0, i64 16
store i8 %6, i8* %68
%69 = getelementptr inbounds [21 x i8], [21 x i8]* %0, i64 0, i64 17
store i8 %8, i8* %69
%70 = getelementptr inbounds [21 x i8], [21 x i8]* %0, i64 0, i64 18
store i8 %10, i8* %70
%71 = getelementptr inbounds [21 x i8], [21 x i8]* %0, i64 0, i64 19
store i8 %12, i8* %71
%72 = getelementptr inbounds [21 x i8], [21 x i8]* %0, i64 0, i64 20
store i8 %14, i8* %72
ret void
}