#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, int);
int /*<<< orphan*/ scanf(char *, int *, ...);
int main() {
  int teste = 0, x1 = 0, y1 = 0, x2 = 0, y2 = 0, i = 0, n = 0, x = 0, y = 0,
      certos = 0;
  while (1) {
    teste++;
    x1 = 0;
    y1 = 0;
    x2 = 0;
    y2 = 0;
    i = 0;
    n = 0;
    x = 0;
    y = 0;
    certos = 0;
    scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
    if (x1 == 0 && y2 == 0 && y1 == 0 && x2 == 0)
      break;
    scanf("%d", &n);
    for (i; i < n; i++) {
      scanf("%d %d", &x, &y);
      if (x >= x1 && x <= x2 && y >= y2 && y <= y1)
        certos++;
    }
    printf("Teste %d\n%d\n\n", teste, certos);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
lea    0xe3c(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    -0x14(%rbp),%rcx
lea    -0x18(%rbp),%r8
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x0,-0xc(%rbp)
jne    1208 <main+0xe8>
cmpl   $0x0,-0x18(%rbp)
jne    1208 <main+0xe8>
cmpl   $0x0,-0x10(%rbp)
jne    1208 <main+0xe8>
cmpl   $0x0,-0x14(%rbp)
jne    1208 <main+0xe8>
jmp    129f <main+0x17f>
lea    0xdfa(%rip),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1288 <main+0x168>
lea    0xdd9(%rip),%rdi
lea    -0x24(%rbp),%rsi
lea    -0x28(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     1275 <main+0x155>
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     1275 <main+0x155>
mov    -0x28(%rbp),%eax
cmp    -0x18(%rbp),%eax
jl     1275 <main+0x155>
mov    -0x28(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     1275 <main+0x155>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    127a <main+0x15a>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    121a <main+0xfa>
mov    -0x8(%rbp),%esi
mov    -0x2c(%rbp),%edx
lea    0xd77(%rip),%rdi
call   1030 <printf@plt>
jmp    1175 <main+0x55>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xed1(%rip),%rbp
lea    0x24(%rsp),%r15
lea    0x20(%rsp),%r14
xor    %r13d,%r13d
jmp    1161 <main+0x41>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0xeb5(%rip),%rdi
mov    %r13d,%esi
mov    %ebx,%edx
call   1030 <printf@plt>
movl   $0x0,0x1c(%rsp)
movl   $0x0,0x18(%rsp)
movl   $0x0,0x14(%rsp)
movl   $0x0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
movl   $0x0,0x24(%rsp)
movl   $0x0,0x20(%rsp)
lea    0xe60(%rip),%rdi
lea    0x1c(%rsp),%rsi
lea    0x18(%rsp),%rdx
lea    0x14(%rsp),%rcx
lea    0x10(%rsp),%r8
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,0x1c(%rsp)
jne    11db <main+0xbb>
cmpl   $0x0,0x10(%rsp)
jne    11db <main+0xbb>
cmpl   $0x0,0x18(%rsp)
jne    11db <main+0xbb>
cmpl   $0x0,0x14(%rsp)
je     125a <main+0x13a>
add    $0x1,%r13d
xor    %ebx,%ebx
lea    0xe21(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    1150 <main+0x30>
xor    %ebx,%ebx
xor    %r12d,%r12d
jmp    121f <main+0xff>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%r12d
cmp    0xc(%rsp),%r12d
jge    1150 <main+0x30>
mov    %rbp,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x24(%rsp),%eax
cmp    0x1c(%rsp),%eax
jl     1210 <main+0xf0>
cmp    0x14(%rsp),%eax
jg     1210 <main+0xf0>
mov    0x20(%rsp),%eax
cmp    0x10(%rsp),%eax
setge  %cl
cmp    0x18(%rsp),%eax
setle  %al
and    %cl,%al
movzbl %al,%eax
add    %eax,%ebx
jmp    1210 <main+0xf0>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"%d %d %d %d\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [6 x i8] c"%d %d\00"
@.str.3 = [14 x i8] c"Teste %d\0A%d\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
store i32 0, i32* %11
br label %12
12: ; preds = %0, %59
%13 = load i32, i32* %2
%14 = add nsw i32 %13, 1
store i32 %14, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
store i32 0, i32* %11
%15 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %4, i32* %5, i32* %6)
%16 = load i32, i32* %3
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %28
18: ; preds = %12
%19 = load i32, i32* %6
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %28
21: ; preds = %18
%22 = load i32, i32* %4
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %28
24: ; preds = %21
%25 = load i32, i32* %5
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %24
br label %63
28: ; preds = %24, %21, %18, %12
%29 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %8)
%30 = load i32, i32* %7
br label %31
31: ; preds = %56, %28
%32 = load i32, i32* %7
%33 = load i32, i32* %8
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %59
35: ; preds = %31
%36 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %9, i32* %10)
%37 = load i32, i32* %9
%38 = load i32, i32* %3
%39 = icmp sge i32 %37, %38
br i1 %39, label %40, label %55
40: ; preds = %35
%41 = load i32, i32* %9
%42 = load i32, i32* %5
%43 = icmp sle i32 %41, %42
br i1 %43, label %44, label %55
44: ; preds = %40
%45 = load i32, i32* %10
%46 = load i32, i32* %6
%47 = icmp sge i32 %45, %46
br i1 %47, label %48, label %55
48: ; preds = %44
%49 = load i32, i32* %10
%50 = load i32, i32* %4
%51 = icmp sle i32 %49, %50
br i1 %51, label %52, label %55
52: ; preds = %48
%53 = load i32, i32* %11
%54 = add nsw i32 %53, 1
store i32 %54, i32* %11
br label %55
55: ; preds = %52, %48, %44, %40, %35
br label %56
56: ; preds = %55
%57 = load i32, i32* %7
%58 = add nsw i32 %57, 1
store i32 %58, i32* %7
br label %31
59: ; preds = %31
%60 = load i32, i32* %2
%61 = load i32, i32* %11
%62 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %60, i32 %61)
br label %12
63: ; preds = %27
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"%d %d %d %d\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [6 x i8] c"%d %d\00"
@.str.3 = [14 x i8] c"Teste %d\0A%d\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = bitcast i32* %1 to i8*
%9 = bitcast i32* %2 to i8*
%10 = bitcast i32* %3 to i8*
%11 = bitcast i32* %4 to i8*
%12 = bitcast i32* %5 to i8*
%13 = bitcast i32* %6 to i8*
%14 = bitcast i32* %7 to i8*
br label %15
15: ; preds = %58, %0
%16 = phi i32 [ 0, %0 ], [ %17, %58 ]
%17 = add nuw nsw i32 %16, 1
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
%18 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i32* %3, i32* %4)
%19 = load i32, i32* %1
%20 = icmp eq i32 %19, 0
%21 = load i32, i32* %4
%22 = icmp eq i32 %21, 0
%23 = select i1 %20, i1 %22, i1 false
%24 = load i32, i32* %2
%25 = icmp eq i32 %24, 0
%26 = select i1 %23, i1 %25, i1 false
%27 = load i32, i32* %3
%28 = icmp eq i32 %27, 0
%29 = select i1 %26, i1 %28, i1 false
br i1 %29, label %61, label %30
30: ; preds = %15
%31 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%32 = load i32, i32* %5
%33 = icmp sgt i32 %32, 0
br i1 %33, label %34, label %58
34: ; preds = %30, %53
%35 = phi i32 [ %54, %53 ], [ 0, %30 ]
%36 = phi i32 [ %55, %53 ], [ 0, %30 ]
%37 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %6, i32* %7)
%38 = load i32, i32* %6
%39 = load i32, i32* %1
%40 = icmp slt i32 %38, %39
%41 = load i32, i32* %3
%42 = icmp sgt i32 %38, %41
%43 = select i1 %40, i1 true, i1 %42
br i1 %43, label %53, label %44
44: ; preds = %34
%45 = load i32, i32* %7
%46 = load i32, i32* %4
%47 = icmp sge i32 %45, %46
%48 = load i32, i32* %2
%49 = icmp sle i32 %45, %48
%50 = select i1 %47, i1 %49, i1 false
%51 = zext i1 %50 to i32
%52 = add nsw i32 %35, %51
br label %53
53: ; preds = %44, %34
%54 = phi i32 [ %35, %34 ], [ %52, %44 ]
%55 = add nuw nsw i32 %36, 1
%56 = load i32, i32* %5
%57 = icmp slt i32 %55, %56
br i1 %57, label %34, label %58
58: ; preds = %53, %30
%59 = phi i32 [ 0, %30 ], [ %54, %53 ]
%60 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %17, i32 %59)
br label %15
61: ; preds = %15
ret i32 0
}