#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*/ puts(char *);
int /*<<< orphan*/ scanf(char *, int *);
void getDimension(int *prow, int *pcol) {
  for (;;) {
    printf("Give the number of rows for the matrix, (n <= %d) :  \n", 3);
    printf(">> ");
    scanf(" %d", prow);
    printf("Give the number of columns for the matrix, (n <= %d) :  \n", 3);
    printf(">> ");
    scanf(" %d", pcol);
    if ((*prow <= 3 && *prow > 0) && (*pcol <= 3 && *pcol > 0))
      break;
    else
      puts("Invalid Input! Please try again...\n");
  }
}


x86 assembly (clang, -O0):
<getDimension>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb9(%rip),%rdi
mov    $0x3,%esi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xecf(%rip),%rdi
call   1050 <scanf@plt>
lea    0xec7(%rip),%rdi
mov    $0x3,%esi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe9e(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%rax
cmpl   $0x3,(%rax)
jg     11db <getDimension+0xab>
mov    -0x8(%rbp),%rax
cmpl   $0x0,(%rax)
jle    11db <getDimension+0xab>
mov    -0x10(%rbp),%rax
cmpl   $0x3,(%rax)
jg     11db <getDimension+0xab>
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
jle    11db <getDimension+0xab>
jmp    11ec <getDimension+0xbc>
lea    0xe97(%rip),%rdi
call   1030 <puts@plt>
jmp    1140 <getDimension+0x10>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getDimension>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xeef(%rip),%r12
lea    0xeec(%rip),%r13
lea    0xee9(%rip),%rbp
lea    0xf1c(%rip),%r15
jmp    1168 <getDimension+0x38>
nop
mov    %r15,%rdi
call   1030 <puts@plt>
lea    0xe91(%rip),%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    %rbp,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
mov    (%rbx),%eax
add    $0xffffffff,%eax
cmp    $0x2,%eax
ja     1160 <getDimension+0x30>
mov    (%r14),%eax
add    $0xffffffff,%eax
cmp    $0x3,%eax
jae    1160 <getDimension+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [55 x i8] c"Give the number of rows for the matrix, (n <= %d) : \0A\00"
@.str.1 = [4 x i8] c">> \00"
@.str.2 = [4 x i8] c" %d\00"
@.str.3 = [58 x i8] c"Give the number of columns for the matrix, (n <= %d) : \0A\00"
@.str.4 = [36 x i8] c"Invalid Input! Please try again...\0A\00"
define void @getDimension(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
br label %5
5: ; preds = %32, %2
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0), i32 3)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%8 = load i32*, i32** %3
%9 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32* %8)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.3, i64 0, i64 0), i32 3)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%12 = load i32*, i32** %4
%13 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32* %12)
%14 = load i32*, i32** %3
%15 = load i32, i32* %14
%16 = icmp sle i32 %15, 3
br i1 %16, label %17, label %30
17: ; preds = %5
%18 = load i32*, i32** %3
%19 = load i32, i32* %18
%20 = icmp sgt i32 %19, 0
br i1 %20, label %21, label %30
21: ; preds = %17
%22 = load i32*, i32** %4
%23 = load i32, i32* %22
%24 = icmp sle i32 %23, 3
br i1 %24, label %25, label %30
25: ; preds = %21
%26 = load i32*, i32** %4
%27 = load i32, i32* %26
%28 = icmp sgt i32 %27, 0
br i1 %28, label %29, label %30
29: ; preds = %25
br label %33
30: ; preds = %25, %21, %17, %5
%31 = call i32 @puts(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
br label %32
32: ; preds = %30
br label %5
33: ; preds = %29
ret void
}

LLVM IR (-O2):
@.str = [55 x i8] c"Give the number of rows for the matrix, (n <= %d) : \0A\00"
@.str.1 = [4 x i8] c">> \00"
@.str.2 = [4 x i8] c" %d\00"
@.str.3 = [58 x i8] c"Give the number of columns for the matrix, (n <= %d) : \0A\00"
@.str.4 = [36 x i8] c"Invalid Input! Please try again...\0A\00"
define void @getDimension(i32* %0, i32* %1) {
br label %3
3: ; preds = %17, %2
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0), i32 3)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32* %0)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str.3, i64 0, i64 0), i32 3)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%9 = tail call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%10 = load i32, i32* %0
%11 = add i32 %10, -1
%12 = icmp ult i32 %11, 3
br i1 %12, label %13, label %17
13: ; preds = %3
%14 = load i32, i32* %1
%15 = add i32 %14, -1
%16 = icmp ult i32 %15, 3
br i1 %16, label %19, label %17
17: ; preds = %13, %3
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
br label %3
19: ; preds = %13
ret void
}