#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(int *grid) {
  int i;
  for (i = 0; i < 9 * 9; i++) {
    printf("%d", grid[i]);
    if (i != 0 && (i + 1) % 9 == 0) {
      printf("\n");
      if (i == (9 * 3 - 1) || i == (9 * 6 - 1))
        printf("---|---|---\n");
    } else if ((i + 1) % 3 == 0)
      printf("|");
  }
}


x86 assembly (clang, -O0):
<print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x51,-0xc(%rbp)
jge    11d9 <print+0xc9>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0xc(%rbp)
je     119c <print+0x8c>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    $0x9,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    119c <print+0x8c>
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x1a,-0xc(%rbp)
je     1189 <print+0x79>
cmpl   $0x35,-0xc(%rbp)
jne    1197 <print+0x87>
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c6 <print+0xb6>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11c1 <print+0xb1>
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c6 <print+0xb6>
jmp    11cb <print+0xbb>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <print+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r12
mov    (%rdi),%esi
lea    0xeb9(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%ebx
mov    $0xfe,%bpl
mov    $0x2,%r13b
jmp    117e <print+0x4e>
nopl   0x0(%rax,%rax,1)
lea    0xe9c(%rip),%rdi
call   1040 <puts@plt>
add    $0x1,%rbx
add    $0xff,%bpl
add    $0x1,%r13b
cmp    $0x51,%rbx
je     11ea <print+0xba>
movzbl %r13b,%r15d
imul   $0x39,%r15d,%eax
shr    $0x9,%eax
lea    (%rax,%rax,8),%r14d
mov    (%r12,%rbx,4),%esi
lea    0xe68(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    %bpl,%r14b
je     11d0 <print+0xa0>
imul   $0xab,%r15d,%eax
shr    $0x9,%eax
lea    (%rax,%rax,2),%eax
add    %bpl,%al
jne    116c <print+0x3c>
mov    $0x7c,%edi
call   1030 <putchar@plt>
jmp    116c <print+0x3c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
cmp    $0x35,%ebx
je     1160 <print+0x30>
cmp    $0x1a,%ebx
je     1160 <print+0x30>
jmp    116c <print+0x3c>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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