#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);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ puts(char *);
void affichage(int grille[9][9]) {
  for (int i = 0; i < 9; i++) {
    for (int j = 0; j < 9; j++) {
      printf(((j + 1) % 3) ? "%d " : "%d|", grille[i][j]);
    }
    putchar('\n');
    if (!((i + 1) % 3))
      puts("------------------");
  }
  puts("\n\n");
}


x86 assembly (clang, -O0):
<affichage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x9,-0xc(%rbp)
jge    11ea <affichage+0xba>
movl   $0x0,-0x10(%rbp)
cmpl   $0x9,-0x10(%rbp)
jge    11aa <affichage+0x7a>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
lea    0xe91(%rip),%rdi
lea    0xe86(%rip),%rax
cmp    $0x0,%edx
cmovne %rax,%rdi
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
imul   $0x24,%rcx,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
call   1050 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1154 <affichage+0x24>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11d7 <affichage+0xa7>
lea    0xe36(%rip),%rdi
call   1040 <puts@plt>
jmp    11dc <affichage+0xac>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1143 <affichage+0x13>
lea    0xe2a(%rip),%rdi
call   1040 <puts@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<affichage>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r13
mov    $0x20,%ebx
mov    $0xffffffff,%ebp
mov    $0x1,%r12d
jmp    1168 <affichage+0x38>
add    $0x24,%rbx
add    $0xffffffff,%ebp
add    $0x1,%r12d
cmp    $0x164,%rbx
je     1227 <affichage+0xf7>
mov    %r12d,%eax
mov    $0xaaaaaaab,%ecx
imul   %rcx,%rax
shr    $0x21,%rax
lea    (%rax,%rax,2),%eax
mov    %eax,0x4(%rsp)
mov    -0x20(%r13,%rbx,1),%esi
lea    0xe75(%rip),%r15
mov    %r15,%rdi
call   1050 <printf@plt>
mov    -0x1c(%r13,%rbx,1),%esi
mov    %r15,%rdi
call   1050 <printf@plt>
mov    -0x18(%r13,%rbx,1),%esi
lea    0xe58(%rip),%r14
mov    %r14,%rdi
call   1050 <printf@plt>
mov    -0x14(%r13,%rbx,1),%esi
mov    %r15,%rdi
call   1050 <printf@plt>
mov    -0x10(%r13,%rbx,1),%esi
mov    %r15,%rdi
call   1050 <printf@plt>
mov    -0xc(%r13,%rbx,1),%esi
mov    %r14,%rdi
call   1050 <printf@plt>
mov    -0x8(%r13,%rbx,1),%esi
mov    %r15,%rdi
call   1050 <printf@plt>
mov    -0x4(%r13,%rbx,1),%esi
mov    %r15,%rdi
call   1050 <printf@plt>
mov    0x0(%r13,%rbx,1),%esi
mov    %r14,%rdi
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    %ebp,0x4(%rsp)
jne    1150 <affichage+0x20>
lea    0xdeb(%rip),%rdi
call   1040 <puts@plt>
jmp    1150 <affichage+0x20>
lea    0xded(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <puts@plt>

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

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