#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 printb(int (*M)[8]) {
  int i, j;
  for (j = 1; j <= 8; j++) {
    for (i = 0; i < 8; i++)
      printf("%3d", M[i][8 - j]);
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<printb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0x10(%rbp)
cmpl   $0x8,-0x10(%rbp)
jg     1193 <printb+0x83>
movl   $0x0,-0xc(%rbp)
cmpl   $0x8,-0xc(%rbp)
jge    1177 <printb+0x67>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
shl    $0x5,%rcx
add    %rcx,%rax
mov    $0x8,%ecx
sub    -0x10(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1134 <printb+0x24>
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1123 <printb+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printb>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
lea    0xed1(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x1c(%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x3c(%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x5c(%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x7c(%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x9c(%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xbc(%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xdc(%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xfc(%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0xffffffffffffffff,%rbx
cmp    $0xfffffffffffffff8,%rbx
jne    1140 <printb+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%3d\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @printb([8 x i32]* %0) {
%2 = alloca [8 x i32]*
%3 = alloca i32
%4 = alloca i32
store [8 x i32]* %0, [8 x i32]** %2
store i32 1, i32* %4
br label %5
5: ; preds = %28, %1
%6 = load i32, i32* %4
%7 = icmp sle i32 %6, 8
br i1 %7, label %8, label %31
8: ; preds = %5
store i32 0, i32* %3
br label %9
9: ; preds = %23, %8
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 8
br i1 %11, label %12, label %26
12: ; preds = %9
%13 = load [8 x i32]*, [8 x i32]** %2
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [8 x i32], [8 x i32]* %13, i64 %15
%17 = load i32, i32* %4
%18 = sub nsw i32 8, %17
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [8 x i32], [8 x i32]* %16, i64 0, i64 %19
%21 = load i32, i32* %20
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %21)
br label %23
23: ; preds = %12
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
store i32 %25, i32* %3
br label %9
26: ; preds = %9
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %28
28: ; preds = %26
%29 = load i32, i32* %4
%30 = add nsw i32 %29, 1
store i32 %30, i32* %4
br label %5
31: ; preds = %5
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%3d\00"
define void @printb([8 x i32]* nocapture %0) {
br label %2
2: ; preds = %1, %2
%3 = phi i64 [ 1, %1 ], [ %30, %2 ]
%4 = sub nuw nsw i64 8, %3
%5 = getelementptr inbounds [8 x i32], [8 x i32]* %0, i64 0, i64 %4
%6 = load i32, i32* %5
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = getelementptr inbounds [8 x i32], [8 x i32]* %0, i64 1, i64 %4
%9 = load i32, i32* %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = getelementptr inbounds [8 x i32], [8 x i32]* %0, i64 2, i64 %4
%12 = load i32, i32* %11
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = getelementptr inbounds [8 x i32], [8 x i32]* %0, i64 3, i64 %4
%15 = load i32, i32* %14
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = getelementptr inbounds [8 x i32], [8 x i32]* %0, i64 4, i64 %4
%18 = load i32, i32* %17
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = getelementptr inbounds [8 x i32], [8 x i32]* %0, i64 5, i64 %4
%21 = load i32, i32* %20
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %21)
%23 = getelementptr inbounds [8 x i32], [8 x i32]* %0, i64 6, i64 %4
%24 = load i32, i32* %23
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %24)
%26 = getelementptr inbounds [8 x i32], [8 x i32]* %0, i64 7, i64 %4
%27 = load i32, i32* %26
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %27)
%29 = tail call i32 @putchar(i32 10)
%30 = add nuw nsw i64 %3, 1
%31 = icmp eq i64 %30, 9
br i1 %31, label %32, label %2
32: ; preds = %2
ret void
}