#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 digitConverter(int /*<<< orphan*/);
int /*<<< orphan*/ getch();
int /*<<< orphan*/ initialize(int **);
int /*<<< orphan*/ printGrid(int **);
int /*<<< orphan*/ printf(char *, int);
scalar_t__ validity(int **);
void userInput(int grid[9][9]) {
  int x, y, data;
  for (y = 0; y < 9; ++y)
    for (x = 0; x < 9; ++x) {
      grid[x][y] = data = 10;
      printGrid(grid);
      while (!((data >= 0) && (data <= 9))) {
        data = digitConverter(getch());
      }
      grid[x][y] = data;
    }
  if (validity(grid) == 0) {
    printf("Try again!%c\n", 0x7);
    initialize(grid);
    userInput(grid);
  }
  return;
}


x86 assembly (clang, -O0):
<userInput>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x9,-0x10(%rbp)
jge    1243 <userInput+0xd3>
movl   $0x0,-0xc(%rbp)
cmpl   $0x9,-0xc(%rbp)
jge    1230 <userInput+0xc0>
movl   $0xa,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
imul   $0x24,%rcx,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
movl   $0xa,(%rax,%rcx,4)
mov    -0x8(%rbp),%rdi
call   1080 <printGrid@plt>
xor    %eax,%eax
cmpl   $0x0,-0x14(%rbp)
mov    %al,-0x15(%rbp)
jl     11e1 <userInput+0x71>
cmpl   $0x9,-0x14(%rbp)
setle  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
xor    $0xff,%al
test   $0x1,%al
jne    11f3 <userInput+0x83>
jmp    1209 <userInput+0x99>
mov    $0x0,%al
call   1070 <getch@plt>
mov    %eax,%edi
call   1090 <digitConverter@plt>
mov    %eax,-0x14(%rbp)
jmp    11c8 <userInput+0x58>
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
imul   $0x24,%rcx,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1194 <userInput+0x24>
jmp    1235 <userInput+0xc5>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1183 <userInput+0x13>
mov    -0x8(%rbp),%rdi
call   1030 <validity@plt>
cmp    $0x0,%rax
jne    1279 <userInput+0x109>
lea    0xda3(%rip),%rdi
mov    $0x7,%esi
call   1050 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1060 <initialize@plt>
mov    -0x8(%rbp),%rdi
call   1040 <userInput@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<userInput>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
lea    0xe91(%rip),%r14
nop
xor    %r15d,%r15d
movl   $0xa,(%rbx,%r15,4)
mov    %rbx,%rdi
call   1070 <printGrid@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1060 <getch@plt>
mov    %eax,%edi
call   1080 <digitConverter@plt>
cmp    $0x9,%eax
ja     1190 <userInput+0x30>
mov    %eax,(%rbx,%r15,4)
movl   $0xa,0x24(%rbx,%r15,4)
mov    %rbx,%rdi
call   1070 <printGrid@plt>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <getch@plt>
mov    %eax,%edi
call   1080 <digitConverter@plt>
cmp    $0x9,%eax
ja     11c0 <userInput+0x60>
mov    %eax,0x24(%rbx,%r15,4)
movl   $0xa,0x48(%rbx,%r15,4)
mov    %rbx,%rdi
call   1070 <printGrid@plt>
nopl   0x0(%rax)
xor    %eax,%eax
call   1060 <getch@plt>
mov    %eax,%edi
call   1080 <digitConverter@plt>
cmp    $0x9,%eax
ja     11f0 <userInput+0x90>
mov    %eax,0x48(%rbx,%r15,4)
movl   $0xa,0x6c(%rbx,%r15,4)
mov    %rbx,%rdi
call   1070 <printGrid@plt>
nopl   0x0(%rax)
xor    %eax,%eax
call   1060 <getch@plt>
mov    %eax,%edi
call   1080 <digitConverter@plt>
cmp    $0x9,%eax
ja     1220 <userInput+0xc0>
mov    %eax,0x6c(%rbx,%r15,4)
movl   $0xa,0x90(%rbx,%r15,4)
mov    %rbx,%rdi
call   1070 <printGrid@plt>
nopl   0x0(%rax)
xor    %eax,%eax
call   1060 <getch@plt>
mov    %eax,%edi
call   1080 <digitConverter@plt>
cmp    $0x9,%eax
ja     1250 <userInput+0xf0>
mov    %eax,0x90(%rbx,%r15,4)
movl   $0xa,0xb4(%rbx,%r15,4)
mov    %rbx,%rdi
call   1070 <printGrid@plt>
nop
xor    %eax,%eax
call   1060 <getch@plt>
mov    %eax,%edi
call   1080 <digitConverter@plt>
cmp    $0x9,%eax
ja     1280 <userInput+0x120>
mov    %eax,0xb4(%rbx,%r15,4)
movl   $0xa,0xd8(%rbx,%r15,4)
mov    %rbx,%rdi
call   1070 <printGrid@plt>
nop
xor    %eax,%eax
call   1060 <getch@plt>
mov    %eax,%edi
call   1080 <digitConverter@plt>
cmp    $0x9,%eax
ja     12b0 <userInput+0x150>
mov    %eax,0xd8(%rbx,%r15,4)
movl   $0xa,0xfc(%rbx,%r15,4)
mov    %rbx,%rdi
call   1070 <printGrid@plt>
nop
xor    %eax,%eax
call   1060 <getch@plt>
mov    %eax,%edi
call   1080 <digitConverter@plt>
cmp    $0x9,%eax
ja     12e0 <userInput+0x180>
mov    %eax,0xfc(%rbx,%r15,4)
movl   $0xa,0x120(%rbx,%r15,4)
mov    %rbx,%rdi
call   1070 <printGrid@plt>
nop
xor    %eax,%eax
call   1060 <getch@plt>
mov    %eax,%edi
call   1080 <digitConverter@plt>
cmp    $0x9,%eax
ja     1310 <userInput+0x1b0>
mov    %eax,0x120(%rbx,%r15,4)
add    $0x1,%r15
cmp    $0x9,%r15
jne    1173 <userInput+0x13>
mov    %rbx,%rdi
call   1030 <validity@plt>
test   %rax,%rax
jne    1360 <userInput+0x200>
mov    %r14,%rdi
mov    $0x7,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <initialize@plt>
jmp    1170 <userInput+0x10>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [14 x i8] c"Try again!%c\0A\00"
define void @userInput([9 x i32]* %0) {
%2 = bitcast [9 x i32]* %0 to i32**
br label %3
3: ; preds = %70, %1
%4 = phi i64 [ 0, %1 ], [ %71, %70 ]
%5 = getelementptr inbounds [9 x i32], [9 x i32]* %0, i64 0, i64 %4
store i32 10, i32* %5
%6 = tail call i32 @printGrid(i32** %2)
br label %7
7: ; preds = %3, %7
%8 = tail call i32 (...) @getch()
%9 = tail call i32 @digitConverter(i32 %8)
%10 = icmp ugt i32 %9, 9
br i1 %10, label %7, label %11
11: ; preds = %7
store i32 %9, i32* %5
%12 = getelementptr inbounds [9 x i32], [9 x i32]* %0, i64 1, i64 %4
store i32 10, i32* %12
%13 = tail call i32 @printGrid(i32** %2)
br label %14
14: ; preds = %14, %11
%15 = tail call i32 (...) @getch()
%16 = tail call i32 @digitConverter(i32 %15)
%17 = icmp ugt i32 %16, 9
br i1 %17, label %14, label %18
18: ; preds = %14
store i32 %16, i32* %12
%19 = getelementptr inbounds [9 x i32], [9 x i32]* %0, i64 2, i64 %4
store i32 10, i32* %19
%20 = tail call i32 @printGrid(i32** %2)
br label %21
21: ; preds = %21, %18
%22 = tail call i32 (...) @getch()
%23 = tail call i32 @digitConverter(i32 %22)
%24 = icmp ugt i32 %23, 9
br i1 %24, label %21, label %25
25: ; preds = %21
store i32 %23, i32* %19
%26 = getelementptr inbounds [9 x i32], [9 x i32]* %0, i64 3, i64 %4
store i32 10, i32* %26
%27 = tail call i32 @printGrid(i32** %2)
br label %28
28: ; preds = %28, %25
%29 = tail call i32 (...) @getch()
%30 = tail call i32 @digitConverter(i32 %29)
%31 = icmp ugt i32 %30, 9
br i1 %31, label %28, label %32
32: ; preds = %28
store i32 %30, i32* %26
%33 = getelementptr inbounds [9 x i32], [9 x i32]* %0, i64 4, i64 %4
store i32 10, i32* %33
%34 = tail call i32 @printGrid(i32** %2)
br label %35
35: ; preds = %35, %32
%36 = tail call i32 (...) @getch()
%37 = tail call i32 @digitConverter(i32 %36)
%38 = icmp ugt i32 %37, 9
br i1 %38, label %35, label %39
39: ; preds = %35
store i32 %37, i32* %33
%40 = getelementptr inbounds [9 x i32], [9 x i32]* %0, i64 5, i64 %4
store i32 10, i32* %40
%41 = tail call i32 @printGrid(i32** %2)
br label %42
42: ; preds = %42, %39
%43 = tail call i32 (...) @getch()
%44 = tail call i32 @digitConverter(i32 %43)
%45 = icmp ugt i32 %44, 9
br i1 %45, label %42, label %46
46: ; preds = %42
store i32 %44, i32* %40
%47 = getelementptr inbounds [9 x i32], [9 x i32]* %0, i64 6, i64 %4
store i32 10, i32* %47
%48 = tail call i32 @printGrid(i32** %2)
br label %49
49: ; preds = %49, %46
%50 = tail call i32 (...) @getch()
%51 = tail call i32 @digitConverter(i32 %50)
%52 = icmp ugt i32 %51, 9
br i1 %52, label %49, label %53
53: ; preds = %49
store i32 %51, i32* %47
%54 = getelementptr inbounds [9 x i32], [9 x i32]* %0, i64 7, i64 %4
store i32 10, i32* %54
%55 = tail call i32 @printGrid(i32** %2)
br label %56
56: ; preds = %56, %53
%57 = tail call i32 (...) @getch()
%58 = tail call i32 @digitConverter(i32 %57)
%59 = icmp ugt i32 %58, 9
br i1 %59, label %56, label %60
60: ; preds = %56
store i32 %58, i32* %54
%61 = getelementptr inbounds [9 x i32], [9 x i32]* %0, i64 8, i64 %4
store i32 10, i32* %61
%62 = tail call i32 @printGrid(i32** %2)
br label %63
63: ; preds = %63, %60
%64 = tail call i32 (...) @getch()
%65 = tail call i32 @digitConverter(i32 %64)
%66 = icmp ugt i32 %65, 9
br i1 %66, label %63, label %67
67: ; preds = %63
store i32 %65, i32* %61
%68 = add nuw nsw i64 %4, 1
%69 = icmp eq i64 %68, 9
br i1 %69, label %72, label %70
70: ; preds = %67, %75
%71 = phi i64 [ %68, %67 ], [ 0, %75 ]
br label %3
72: ; preds = %67
%73 = tail call i64 @validity(i32** %2)
%74 = icmp eq i64 %73, 0
br i1 %74, label %75, label %78
75: ; preds = %72
%76 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 7)
%77 = tail call i32 @initialize(i32** %2)
br label %70
78: ; preds = %72
ret void
}