#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 *, int /*<<< orphan*/);
int /*<<< orphan*/ putchar(char);
void print_board(int *board) {
  for (int i = 0, *pGrid = board; i < 81; ++i) {
    if (i % 9 == 0) {
      putchar('\n');
    }
    printf("%i", *(pGrid++));
  }
}


x86 assembly (clang, -O0):
<print_board>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x51,-0xc(%rbp)
jge    118e <print_board+0x6e>
mov    -0xc(%rbp),%eax
mov    $0x9,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1163 <print_board+0x43>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x18(%rbp)
mov    (%rax),%esi
lea    0xe85(%rip),%rdi
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113b <print_board+0x1b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_board>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdi,%r15
xor    %r12d,%r12d
lea    0xeca(%rip),%r14
xor    %r13d,%r13d
xor    %ebx,%ebx
jmp    1160 <print_board+0x40>
nopl   (%rax)
mov    (%r15,%rbx,1),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
add    $0x4,%rbx
add    $0xff,%r13b
add    $0x1,%r12b
cmp    $0x144,%ebx
je     117e <print_board+0x5e>
movzbl %r12b,%eax
imul   $0x39,%eax,%eax
shr    $0x9,%eax
lea    (%rax,%rax,8),%eax
add    %r13b,%al
jne    1140 <print_board+0x20>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1140 <print_board+0x20>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%i\00"
define void @print_board(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32*
store i32* %0, i32** %2
store i32 0, i32* %3
%5 = load i32*, i32** %2
store i32* %5, i32** %4
br label %6
6: ; preds = %20, %1
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 81
br i1 %8, label %9, label %23
9: ; preds = %6
%10 = load i32, i32* %3
%11 = srem i32 %10, 9
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = call i32 @putchar(i8 signext 10)
br label %15
15: ; preds = %13, %9
%16 = load i32*, i32** %4
%17 = getelementptr inbounds i32, i32* %16, i32 1
store i32* %17, i32** %4
%18 = load i32, i32* %16
%19 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %18)
br label %20
20: ; preds = %15
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 1
store i32 %22, i32* %3
br label %6
23: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%i\00"
define void @print_board(i32* nocapture %0) {
br label %3
2: ; preds = %11
ret void
3: ; preds = %1, %11
%4 = phi i32* [ %0, %1 ], [ %12, %11 ]
%5 = phi i32 [ 0, %1 ], [ %15, %11 ]
%6 = trunc i32 %5 to i8
%7 = urem i8 %6, 9
%8 = icmp eq i8 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = tail call i32 @putchar(i8 signext 10)
br label %11
11: ; preds = %9, %3
%12 = getelementptr inbounds i32, i32* %4, i64 1
%13 = load i32, i32* %4
%14 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = add nuw nsw i32 %5, 1
%16 = icmp eq i32 %15, 81
br i1 %16, label %2, label %3
}