#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 print_board(char *board) {
  int i, j;
  printf("\n");
  for (i = 10 - 1; i >= 0; --i) {
    for (j = 0; j < 9; ++j) {
      printf("%c", board[i * 9 + j]);
    }
    printf("\n");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print_board>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x9,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     1196 <print_board+0x86>
movl   $0x0,-0x10(%rbp)
cmpl   $0x9,-0x10(%rbp)
jge    117a <print_board+0x6a>
mov    -0x8(%rbp),%rax
imul   $0x9,-0xc(%rbp),%ecx
add    -0x10(%rbp),%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1142 <print_board+0x32>
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1131 <print_board+0x21>
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_board>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x5a,%ebx
cs nopw 0x0(%rax,%rax,1)
movsbl -0x9(%r14,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl -0x8(%r14,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl -0x7(%r14,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl -0x6(%r14,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl -0x5(%r14,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl -0x4(%r14,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl -0x3(%r14,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl -0x2(%r14,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl -0x1(%r14,%rbx,1),%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0xfffffffffffffff7,%rbx
jne    1130 <print_board+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define void @print_board(i8* nocapture %0) {
%2 = tail call i32 @putchar(i32 10)
br label %3
3: ; preds = %1, %3
%4 = phi i64 [ 9, %1 ], [ %51, %3 ]
%5 = mul nuw nsw i64 %4, 9
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = tail call i32 @putchar(i32 %8)
%10 = add nuw nsw i64 %5, 1
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = tail call i32 @putchar(i32 %13)
%15 = add nuw nsw i64 %5, 2
%16 = getelementptr inbounds i8, i8* %0, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = tail call i32 @putchar(i32 %18)
%20 = add nuw nsw i64 %5, 3
%21 = getelementptr inbounds i8, i8* %0, i64 %20
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = tail call i32 @putchar(i32 %23)
%25 = add nuw nsw i64 %5, 4
%26 = getelementptr inbounds i8, i8* %0, i64 %25
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = tail call i32 @putchar(i32 %28)
%30 = add nuw nsw i64 %5, 5
%31 = getelementptr inbounds i8, i8* %0, i64 %30
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = tail call i32 @putchar(i32 %33)
%35 = add nuw nsw i64 %5, 6
%36 = getelementptr inbounds i8, i8* %0, i64 %35
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = tail call i32 @putchar(i32 %38)
%40 = add nuw nsw i64 %5, 7
%41 = getelementptr inbounds i8, i8* %0, i64 %40
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = tail call i32 @putchar(i32 %43)
%45 = add nuw nsw i64 %5, 8
%46 = getelementptr inbounds i8, i8* %0, i64 %45
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = tail call i32 @putchar(i32 %48)
%50 = tail call i32 @putchar(i32 10)
%51 = add nsw i64 %4, -1
%52 = icmp eq i64 %4, 0
br i1 %52, label %53, label %3
53: ; preds = %3
%54 = tail call i32 @putchar(i32 10)
ret void
}