#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*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, unsigned int *, unsigned int *, unsigned int *,
                         unsigned int *);
int /*<<< orphan*/ stderr;
bool InputRowCol(unsigned int *Row, unsigned int *Col, unsigned int *Y,
                 unsigned int *X) {
  while (1) {
    printf("\nPlease Enter the dimension of map\n"
           "(input format:[Row] [Col] [Y] [X]),\n"
           "(Range:Rol->(2:40], Col->[2:20], Y->[0,Row), X->[0.Col))\n"
           "(exit input: 0 0 0 0)\n"
           ": ");
    scanf("%u %u %u %u", Row, Col, Y, X);
    if (*Row == 0 && *Col == 0 && *Y == 0 && *X == 0) {
      printf("exit file\n");
      return false;
    } else if ((*Row <= 2 || *Row > 40) || (*Col < 2 || *Col > 20))
      fprintf(stderr, "Error Input, ([Row],[Col])=([2:40],[2:20])\n");
    else if ((*Y < 0 || *Y >= *Row) || (*X < 0 || *X >= *Col))
      fprintf(stderr, "X or Y out of the range of Rol or Col\n");
    else
      return true;
  }
}


x86 assembly (clang, -O0):
<InputRowCol>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
lea    0xf2e(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
jne    11bc <InputRowCol+0x8c>
mov    -0x18(%rbp),%rax
cmpl   $0x0,(%rax)
jne    11bc <InputRowCol+0x8c>
mov    -0x20(%rbp),%rax
cmpl   $0x0,(%rax)
jne    11bc <InputRowCol+0x8c>
mov    -0x28(%rbp),%rax
cmpl   $0x0,(%rax)
jne    11bc <InputRowCol+0x8c>
lea    0xefa(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    127d <InputRowCol+0x14d>
mov    -0x10(%rbp),%rax
cmpl   $0x2,(%rax)
jbe    11f0 <InputRowCol+0xc0>
mov    -0x10(%rbp),%rax
cmpl   $0x28,(%rax)
ja     11f0 <InputRowCol+0xc0>
mov    -0x18(%rbp),%rax
cmpl   $0x2,(%rax)
jb     11f0 <InputRowCol+0xc0>
mov    -0x18(%rbp),%rax
cmpl   $0x14,(%rax)
jbe    120a <InputRowCol+0xda>
mov    0x2de9(%rip),%rax
mov    (%rax),%edi
lea    0xeb0(%rip),%rsi
call   1040 <fprintf@plt>
jmp    1273 <InputRowCol+0x143>
mov    -0x20(%rbp),%rax
cmpl   $0x0,(%rax)
jb     1248 <InputRowCol+0x118>
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
jae    1248 <InputRowCol+0x118>
mov    -0x28(%rbp),%rax
cmpl   $0x0,(%rax)
jb     1248 <InputRowCol+0x118>
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jb     1262 <InputRowCol+0x132>
mov    0x2d91(%rip),%rax
mov    (%rax),%edi
lea    0xe84(%rip),%rsi
call   1040 <fprintf@plt>
jmp    126e <InputRowCol+0x13e>
movl   $0x1,-0x4(%rbp)
jmp    127d <InputRowCol+0x14d>
jmp    1273 <InputRowCol+0x143>
jmp    1278 <InputRowCol+0x148>
jmp    1148 <InputRowCol+0x18>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<InputRowCol>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbx
lea    0xf47(%rip),%r13
mov    0x2e7b(%rip),%rbp
jmp    1182 <InputRowCol+0x42>
nopw   0x0(%rax,%rax,1)
cmpl   $0x0,(%r12)
mov    %r13,%rsi
je     11e0 <InputRowCol+0xa0>
mov    0x0(%rbp),%edi
call   1050 <fprintf@plt>
lea    0xe77(%rip),%rdi
call   1040 <printf@plt>
lea    0xf04(%rip),%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %r15,%rcx
mov    %r14,%r8
call   1060 <scanf@plt>
mov    (%rbx),%eax
test   %eax,%eax
je     1170 <InputRowCol+0x30>
lea    -0x29(%rax),%ecx
mov    %r13,%rsi
cmp    $0xffffffda,%ecx
jb     117a <InputRowCol+0x3a>
mov    (%r12),%ecx
lea    -0x15(%rcx),%edx
mov    %r13,%rsi
cmp    $0xffffffed,%edx
jb     117a <InputRowCol+0x3a>
lea    0xf04(%rip),%rsi
cmp    %eax,(%r15)
jae    117a <InputRowCol+0x3a>
lea    0xef8(%rip),%rsi
cmp    %ecx,(%r14)
jae    117a <InputRowCol+0x3a>
jmp    1202 <InputRowCol+0xc2>
cmpl   $0x0,(%r15)
mov    %r13,%rsi
jne    117a <InputRowCol+0x3a>
cmpl   $0x0,(%r14)
mov    %r13,%rsi
jne    117a <InputRowCol+0x3a>
lea    0xeff(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
jmp    1207 <InputRowCol+0xc7>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [153 x i8] c"\0APlease Enter the dimension of map\0A(input format:[Row] [Col] [Y] [X]),\0A(Range:Rol->(2:40], Col->[2:20], Y->[0,Row), X->[0.Col))\0A(exit input: 0 0 0 0)\0A: \00"
@.str.1 = [12 x i8] c"%u %u %u %u\00"
@.str.2 = [11 x i8] c"exit file\0A\00"
@stderr = global i32 0
@.str.3 = [44 x i8] c"Error Input, ([Row],[Col])=([2:40],[2:20])\0A\00"
@.str.4 = [39 x i8] c"X or Y out of the range of Rol or Col\0A\00"
define i32 @InputRowCol(i32* %0, i32* %1, i32* %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
store i32* %0, i32** %6
store i32* %1, i32** %7
store i32* %2, i32** %8
store i32* %3, i32** %9
br label %10
10: ; preds = %4, %79
%11 = call i32 @printf(i8* getelementptr inbounds ([153 x i8], [153 x i8]* @.str, i64 0, i64 0))
%12 = load i32*, i32** %6
%13 = load i32*, i32** %7
%14 = load i32*, i32** %8
%15 = load i32*, i32** %9
%16 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32* %12, i32* %13, i32* %14, i32* %15)
%17 = load i32*, i32** %6
%18 = load i32, i32* %17
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %34
20: ; preds = %10
%21 = load i32*, i32** %7
%22 = load i32, i32* %21
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %34
24: ; preds = %20
%25 = load i32*, i32** %8
%26 = load i32, i32* %25
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %34
28: ; preds = %24
%29 = load i32*, i32** %9
%30 = load i32, i32* %29
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %28
%33 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %5
br label %80
34: ; preds = %28, %24, %20, %10
%35 = load i32*, i32** %6
%36 = load i32, i32* %35
%37 = icmp ule i32 %36, 2
br i1 %37, label %50, label %38
38: ; preds = %34
%39 = load i32*, i32** %6
%40 = load i32, i32* %39
%41 = icmp ugt i32 %40, 40
br i1 %41, label %50, label %42
42: ; preds = %38
%43 = load i32*, i32** %7
%44 = load i32, i32* %43
%45 = icmp ult i32 %44, 2
br i1 %45, label %50, label %46
46: ; preds = %42
%47 = load i32*, i32** %7
%48 = load i32, i32* %47
%49 = icmp ugt i32 %48, 20
br i1 %49, label %50, label %53
50: ; preds = %46, %42, %38, %34
%51 = load i32, i32* @stderr
%52 = call i32 @fprintf(i32 %51, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0))
br label %78
53: ; preds = %46
%54 = load i32*, i32** %8
%55 = load i32, i32* %54
%56 = icmp ult i32 %55, 0
br i1 %56, label %73, label %57
57: ; preds = %53
%58 = load i32*, i32** %8
%59 = load i32, i32* %58
%60 = load i32*, i32** %6
%61 = load i32, i32* %60
%62 = icmp uge i32 %59, %61
br i1 %62, label %73, label %63
63: ; preds = %57
%64 = load i32*, i32** %9
%65 = load i32, i32* %64
%66 = icmp ult i32 %65, 0
br i1 %66, label %73, label %67
67: ; preds = %63
%68 = load i32*, i32** %9
%69 = load i32, i32* %68
%70 = load i32*, i32** %7
%71 = load i32, i32* %70
%72 = icmp uge i32 %69, %71
br i1 %72, label %73, label %76
73: ; preds = %67, %63, %57, %53
%74 = load i32, i32* @stderr
%75 = call i32 @fprintf(i32 %74, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0))
br label %77
76: ; preds = %67
store i32 1, i32* %5
br label %80
77: ; preds = %73
br label %78
78: ; preds = %77, %50
br label %79
79: ; preds = %78
br label %10
80: ; preds = %76, %32
%81 = load i32, i32* %5
ret i32 %81
}

LLVM IR (-O2):
@.str = [153 x i8] c"\0APlease Enter the dimension of map\0A(input format:[Row] [Col] [Y] [X]),\0A(Range:Rol->(2:40], Col->[2:20], Y->[0,Row), X->[0.Col))\0A(exit input: 0 0 0 0)\0A: \00"
@.str.1 = [12 x i8] c"%u %u %u %u\00"
@stderr = global i32 0
@.str.3 = [44 x i8] c"Error Input, ([Row],[Col])=([2:40],[2:20])\0A\00"
@.str.4 = [39 x i8] c"X or Y out of the range of Rol or Col\0A\00"
@str = [10 x i8] c"exit file\00"
define i32 @InputRowCol(i32* %0, i32* %1, i32* %2, i32* %3) {
br label %5
5: ; preds = %4, %34
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([153 x i8], [153 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32* %0, i32* %1, i32* %2, i32* %3)
%8 = load i32, i32* %0
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %21
10: ; preds = %5
%11 = load i32, i32* %1
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %34
13: ; preds = %10
%14 = load i32, i32* %2
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %34
16: ; preds = %13
%17 = load i32, i32* %3
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %34
19: ; preds = %16
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
br label %38
21: ; preds = %5
%22 = add i32 %8, -41
%23 = icmp ult i32 %22, -38
br i1 %23, label %34, label %24
24: ; preds = %21
%25 = load i32, i32* %1
%26 = add i32 %25, -21
%27 = icmp ult i32 %26, -19
br i1 %27, label %34, label %28
28: ; preds = %24
%29 = load i32, i32* %2
%30 = icmp ult i32 %29, %8
br i1 %30, label %31, label %34
31: ; preds = %28
%32 = load i32, i32* %3
%33 = icmp ult i32 %32, %25
br i1 %33, label %38, label %34
34: ; preds = %28, %31, %21, %24, %16, %13, %10
%35 = phi i8* [ getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0), %10 ], [ getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0), %13 ], [ getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0), %16 ], [ getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0), %24 ], [ getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0), %21 ], [ getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), %31 ], [ getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), %28 ]
%36 = load i32, i32* @stderr
%37 = tail call i32 @fprintf(i32 %36, i8* %35)
br label %5
38: ; preds = %31, %19
%39 = phi i32 [ 0, %19 ], [ 1, %31 ]
ret i32 %39
}