#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 print_sudoku(const int sudoku[9][9]) {
  int i, j, c;
  printf("+-------+-------+-------+");
  for (i = 0; i < 9; ++i) {
    printf("\n|");
    for (j = 0; j < 9; ++j) {
      c = (sudoku[i][j] == 0) ? ' ' : '0' + sudoku[i][j];
      printf(" %c", c);
      if ((j + 1) % 3 == 0) {
        printf(" |");
      }
    }
    if ((i + 1) % 3 == 0) {
      printf("\n+-------+-------+-------+");
    }
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<print_sudoku>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xee8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x9,-0xc(%rbp)
jge    1227 <print_sudoku+0x117>
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0x9,-0x10(%rbp)
jge    11ef <print_sudoku+0xdf>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
imul   $0x24,%rcx,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    1184 <print_sudoku+0x74>
mov    $0x20,%eax
mov    %eax,-0x18(%rbp)
jmp    11a0 <print_sudoku+0x90>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
imul   $0x24,%rcx,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
add    $0x30,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11dc <print_sudoku+0xcc>
lea    0xe32(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e1 <print_sudoku+0xd1>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1150 <print_sudoku+0x40>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1214 <print_sudoku+0x104>
lea    0xdfd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1219 <print_sudoku+0x109>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1131 <print_sudoku+0x21>
lea    0xdf7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_sudoku>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xed6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec0(%rip),%r15
xor    %ebp,%ebp
jmp    1177 <print_sudoku+0x57>
nopw   0x0(%rax,%rax,1)
mov    (%rsp),%rbp
add    $0x1,%rbp
imul   $0xaaaaaaab,%ebp,%eax
cmp    $0x55555555,%eax
jbe    1200 <print_sudoku+0xe0>
add    $0x24,%rbx
cmp    $0x9,%rbp
je     1213 <print_sudoku+0xf3>
mov    %rbp,(%rsp)
lea    0xe7e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%r14b
xor    %r12d,%r12d
jmp    11aa <print_sudoku+0x8a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%r14b
cmp    $0x9,%r12
je     1150 <print_sudoku+0x30>
mov    %r12,%r13
movzbl %r14b,%eax
imul   $0xab,%eax,%eax
shr    $0x9,%eax
lea    (%rax,%rax,2),%ebp
add    $0xff,%bpl
mov    (%rbx,%r12,4),%eax
lea    0x30(%rax),%esi
test   %eax,%eax
mov    $0x20,%eax
cmove  %eax,%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r12
cmp    %r13b,%bpl
jne    11a0 <print_sudoku+0x80>
lea    0xe1b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11a0 <print_sudoku+0x80>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0xe03(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1169 <print_sudoku+0x49>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [26 x i8] c"+-------+-------+-------+\00"
@.str.1 = [3 x i8] c"\0A|\00"
@.str.2 = [4 x i8] c" %c\00"
@.str.3 = [3 x i8] c" |\00"
@.str.4 = [27 x i8] c"\0A+-------+-------+-------+\00"
@.str.5 = [2 x i8] c"\0A\00"
define i32 @print_sudoku([9 x i32]* %0) {
%2 = alloca [9 x i32]*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store [9 x i32]* %0, [9 x i32]** %2
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %7
7: ; preds = %58, %1
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 9
br i1 %9, label %10, label %61
10: ; preds = %7
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %4
br label %12
12: ; preds = %47, %10
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 9
br i1 %14, label %15, label %50
15: ; preds = %12
%16 = load [9 x i32]*, [9 x i32]** %2
%17 = load i32, i32* %3
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [9 x i32], [9 x i32]* %16, i64 %18
%20 = load i32, i32* %4
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [9 x i32], [9 x i32]* %19, i64 0, i64 %21
%23 = load i32, i32* %22
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %15
br label %36
26: ; preds = %15
%27 = load [9 x i32]*, [9 x i32]** %2
%28 = load i32, i32* %3
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [9 x i32], [9 x i32]* %27, i64 %29
%31 = load i32, i32* %4
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [9 x i32], [9 x i32]* %30, i64 0, i64 %32
%34 = load i32, i32* %33
%35 = add nsw i32 48, %34
br label %36
36: ; preds = %26, %25
%37 = phi i32 [ 32, %25 ], [ %35, %26 ]
store i32 %37, i32* %5
%38 = load i32, i32* %5
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %38)
%40 = load i32, i32* %4
%41 = add nsw i32 %40, 1
%42 = srem i32 %41, 3
%43 = icmp eq i32 %42, 0
br i1 %43, label %44, label %46
44: ; preds = %36
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %46
46: ; preds = %44, %36
br label %47
47: ; preds = %46
%48 = load i32, i32* %4
%49 = add nsw i32 %48, 1
store i32 %49, i32* %4
br label %12
50: ; preds = %12
%51 = load i32, i32* %3
%52 = add nsw i32 %51, 1
%53 = srem i32 %52, 3
%54 = icmp eq i32 %53, 0
br i1 %54, label %55, label %57
55: ; preds = %50
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
br label %57
57: ; preds = %55, %50
br label %58
58: ; preds = %57
%59 = load i32, i32* %3
%60 = add nsw i32 %59, 1
store i32 %60, i32* %3
br label %7
61: ; preds = %7
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}

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