#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*/ scanf(char *, int *);
void getSudoku(int grid[9][9]) {
  printf("Enter the sudoku (1 to 9). Enter 0 if you want to leave it "
         "unassigned\n\n");
  int i, j;
  for (i = 0; i < 9; ++i) {
    printf("Enter the row #%dof sudoku\n", i + 1);
    for (j = 0; j < 9; ++j)
      scanf("%d", &grid[i][j]);
  }
}


x86 assembly (clang, -O0):
<getSudoku>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x9,-0xc(%rbp)
jge    11b7 <getSudoku+0x97>
mov    -0xc(%rbp),%esi
add    $0x1,%esi
lea    0xef0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0x9,-0x10(%rbp)
jge    11a4 <getSudoku+0x84>
mov    -0x8(%rbp),%rsi
movslq -0xc(%rbp),%rax
imul   $0x24,%rax,%rax
add    %rax,%rsi
movslq -0x10(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xed3(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1166 <getSudoku+0x46>
jmp    11a9 <getSudoku+0x89>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1141 <getSudoku+0x21>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getSudoku>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdi,%rbx
lea    0xedd(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%r12d
lea    0xeac(%rip),%r14
lea    0xec1(%rip),%r15
xor    %ebp,%ebp
nopl   (%rax)
mov    %r14,%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    (%rbx,%rbp,1),%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
lea    (%rbx,%rbp,1),%rsi
add    $0x4,%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
lea    (%rbx,%rbp,1),%rsi
add    $0x8,%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
lea    (%rbx,%rbp,1),%rsi
add    $0xc,%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
lea    (%rbx,%rbp,1),%rsi
add    $0x10,%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
lea    (%rbx,%rbp,1),%rsi
add    $0x14,%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
lea    (%rbx,%rbp,1),%rsi
add    $0x18,%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
lea    (%rbx,%rbp,1),%rsi
add    $0x1c,%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
lea    (%rbx,%rbp,1),%rsi
add    $0x20,%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
add    $0x24,%rbp
add    $0x1,%r12d
cmp    $0x144,%rbp
jne    1160 <getSudoku+0x30>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str.1 = [28 x i8] c"Enter the row #%dof sudoku\0A\00"
@.str.2 = [3 x i8] c"%d\00"
@str = [71 x i8] c"Enter the sudoku (1 to 9). Enter 0 if you want to leave it unassigned\0A\00"
define void @getSudoku([9 x i32]* %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([71 x i8], [71 x i8]* @str, i64 0, i64 0))
br label %3
3: ; preds = %1, %3
%4 = phi i64 [ 0, %1 ], [ %5, %3 ]
%5 = add nuw nsw i64 %4, 1
%6 = trunc i64 %5 to i32
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = getelementptr inbounds [9 x i32], [9 x i32]* %0, i64 %4, i64 0
%9 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %8)
%10 = getelementptr inbounds [9 x i32], [9 x i32]* %0, i64 %4, i64 1
%11 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %10)
%12 = getelementptr inbounds [9 x i32], [9 x i32]* %0, i64 %4, i64 2
%13 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %12)
%14 = getelementptr inbounds [9 x i32], [9 x i32]* %0, i64 %4, i64 3
%15 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %14)
%16 = getelementptr inbounds [9 x i32], [9 x i32]* %0, i64 %4, i64 4
%17 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %16)
%18 = getelementptr inbounds [9 x i32], [9 x i32]* %0, i64 %4, i64 5
%19 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %18)
%20 = getelementptr inbounds [9 x i32], [9 x i32]* %0, i64 %4, i64 6
%21 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %20)
%22 = getelementptr inbounds [9 x i32], [9 x i32]* %0, i64 %4, i64 7
%23 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %22)
%24 = getelementptr inbounds [9 x i32], [9 x i32]* %0, i64 %4, i64 8
%25 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %24)
%26 = icmp eq i64 %5, 9
br i1 %26, label %27, label %3
27: ; preds = %3
ret void
}