#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 */
char getchar();
int /*<<< orphan*/ printf(char *, ...);
int scanf(char *, int *);
int input(int row_number) {
  int number;
  printf("Row: %d Enter number: ", row_number);
  while (scanf("%d", &number) != 1 || (number < 1 || number >= 10)) {
    printf("Error the number cant be smaller than 1 or greater than 10\n");
    while ((getchar()) != '\n') {
      printf("\x1b[31m"
             "ONLY NUMBERS"
             "\x1b[0m\n");
    }
    printf("Row: %d Enter number: ", row_number);
  }
  return number;
}


x86 assembly (clang, -O0):
<input>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec4(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x1,%ecx
mov    %al,-0x9(%rbp)
jne    118b <input+0x5b>
mov    $0x1,%al
cmpl   $0x1,-0x8(%rbp)
mov    %al,-0xa(%rbp)
jl     1185 <input+0x55>
cmpl   $0xa,-0x8(%rbp)
setge  %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    119b <input+0x6b>
jmp    11e5 <input+0xb5>
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     11cf <input+0x9f>
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a9 <input+0x79>
mov    -0x4(%rbp),%esi
lea    0xe27(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    114c <input+0x1c>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<input>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edi,%ebx
lea    0xeac(%rip),%r14
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb0(%rip),%r15
lea    0x4(%rsp),%r12
lea    0xea7(%rip),%r13
lea    0xedb(%rip),%rbp
jmp    118c <input+0x4c>
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1060 <scanf@plt>
cmp    $0x1,%eax
jne    11a8 <input+0x68>
mov    0x4(%rsp),%eax
lea    -0xa(%rax),%ecx
cmp    $0xfffffff6,%ecx
ja     11c5 <input+0x85>
mov    %r13,%rdi
nopl   0x0(%rax,%rax,1)
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%al
je     1180 <input+0x40>
mov    %rbp,%rdi
jmp    11b0 <input+0x70>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Row: %d Enter number: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [60 x i8] c"Error the number cant be smaller than 1 or greater than 10\0A\00"
@.str.3 = [23 x i8] c"\1B[31mONLY NUMBERS\1B[0m\0A\00"
define i32 @input(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %4)
br label %6
6: ; preds = %27, %1
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%8 = icmp ne i32 %7, 1
br i1 %8, label %17, label %9
9: ; preds = %6
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 1
br i1 %11, label %15, label %12
12: ; preds = %9
%13 = load i32, i32* %3
%14 = icmp sge i32 %13, 10
br label %15
15: ; preds = %12, %9
%16 = phi i1 [ true, %9 ], [ %14, %12 ]
br label %17
17: ; preds = %15, %6
%18 = phi i1 [ true, %6 ], [ %16, %15 ]
br i1 %18, label %19, label %30
19: ; preds = %17
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.2, i64 0, i64 0))
br label %21
21: ; preds = %25, %19
%22 = call signext i8 (...) @getchar()
%23 = sext i8 %22 to i32
%24 = icmp ne i32 %23, 10
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
br label %21
27: ; preds = %21
%28 = load i32, i32* %2
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %28)
br label %6
30: ; preds = %17
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
@.str = [23 x i8] c"Row: %d Enter number: \00"
@.str.1 = [3 x i8] c"%d\00"
@str = [59 x i8] c"Error the number cant be smaller than 1 or greater than 10\00"
@str.4 = [22 x i8] c"\1B[31mONLY NUMBERS\1B[0m\00"
define i32 @input(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %5
5: ; preds = %20, %1
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %12
8: ; preds = %5
%9 = load i32, i32* %2
%10 = add i32 %9, -10
%11 = icmp ult i32 %10, -9
br i1 %11, label %12, label %22
12: ; preds = %5, %8
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str, i64 0, i64 0))
%14 = call signext i8 (...) @getchar()
%15 = icmp eq i8 %14, 10
br i1 %15, label %20, label %16
16: ; preds = %12, %16
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.4, i64 0, i64 0))
%18 = call signext i8 (...) @getchar()
%19 = icmp eq i8 %18, 10
br i1 %19, label %20, label %16
20: ; preds = %16, %12
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %5
22: ; preds = %8
ret i32 %9
}