#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 displaymap(int a[8][8]) {
  int i, j;
  char c[] = "X-0";
  for (j = 0; j < 8; j++) {
    for (i = 0; i < 8; i++) {
      printf(" %c", c[a[i][j] + 1]);
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<displaymap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    0xede(%rip),%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x8,-0x10(%rbp)
jge    119f <displaymap+0x8f>
movl   $0x0,-0xc(%rbp)
cmpl   $0x8,-0xc(%rbp)
jge    1183 <displaymap+0x73>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
shl    $0x5,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
add    $0x1,%eax
cltq
movsbl -0x14(%rbp,%rax,1),%esi
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113d <displaymap+0x2d>
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112c <displaymap+0x1c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<displaymap>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r15
mov    $0xfffffffffffffff8,%rbx
lea    0xec7(%rip),%r12
lea    0xec4(%rip),%r14
movslq 0x20(%r15,%rbx,4),%rax
movsbl 0x1(%rax,%r12,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movslq 0x40(%r15,%rbx,4),%rax
movsbl 0x1(%rax,%r12,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movslq 0x60(%r15,%rbx,4),%rax
movsbl 0x1(%rax,%r12,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movslq 0x80(%r15,%rbx,4),%rax
movsbl 0x1(%rax,%r12,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movslq 0xa0(%r15,%rbx,4),%rax
movsbl 0x1(%rax,%r12,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movslq 0xc0(%r15,%rbx,4),%rax
movsbl 0x1(%rax,%r12,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movslq 0xe0(%r15,%rbx,4),%rax
movsbl 0x1(%rax,%r12,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movslq 0x100(%r15,%rbx,4),%rax
movsbl 0x1(%rax,%r12,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
inc    %rbx
jne    1140 <displaymap+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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