#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 A, B, sum_a = 0, sum_b = 0, N, i;
  scanf(" %d", &N);
  while (N != 0) {
    i = N;
    sum_a = 0;
    sum_b = 0;
    while (i > 0) {
      scanf(" %d %d", &A, &B);
      if (A > B)
        sum_a++;
      else if (B > A)
        sum_b++;
      i--;
    }
    printf("%d %d\n", sum_a, sum_b);
    scanf(" %d", &N);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xebf(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x0,-0x18(%rbp)
je     11f8 <main+0xd8>
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jle    11cf <main+0xaf>
lea    0xe82(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    11a7 <main+0x87>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11c1 <main+0xa1>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    11bc <main+0x9c>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11c1 <main+0xa1>
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
jmp    116d <main+0x4d>
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xe2b(%rip),%rdi
call   1030 <printf@plt>
lea    0xe1b(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
jmp    114f <main+0x2f>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xece(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0xc(%rsp),%ebp
test   %ebp,%ebp
je     11e8 <main+0xc8>
lea    0xeac(%rip),%r14
lea    0x14(%rsp),%r15
lea    0x10(%rsp),%rbx
jmp    118d <main+0x6d>
lea    0xea0(%rip),%rdi
mov    %r13d,%esi
mov    %r12d,%edx
call   1030 <printf@plt>
lea    0xe8a(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0xc(%rsp),%ebp
test   %ebp,%ebp
je     11e8 <main+0xc8>
mov    $0x0,%r13d
mov    $0x0,%r12d
test   %ebp,%ebp
jle    1160 <main+0x40>
add    $0x1,%ebp
xor    %r12d,%r12d
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x14(%rsp),%eax
mov    0x10(%rsp),%ecx
xor    %edx,%edx
xor    %esi,%esi
cmp    %ecx,%eax
setg   %dl
setl   %sil
add    %edx,%r13d
add    %esi,%r12d
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
ja     11b0 <main+0x90>
jmp    1160 <main+0x40>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c" %d\00"
@.str.1 = [7 x i8] c" %d %d\00"
@.str.2 = [7 x i8] c"%d %d\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
store i32 0, i32* %1
store i32 0, i32* %4
store i32 0, i32* %5
%8 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %6)
br label %9
9: ; preds = %36, %0
%10 = load i32, i32* %6
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %41
12: ; preds = %9
%13 = load i32, i32* %6
store i32 %13, i32* %7
store i32 0, i32* %4
store i32 0, i32* %5
br label %14
14: ; preds = %33, %12
%15 = load i32, i32* %7
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %36
17: ; preds = %14
%18 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%19 = load i32, i32* %2
%20 = load i32, i32* %3
%21 = icmp sgt i32 %19, %20
br i1 %21, label %22, label %25
22: ; preds = %17
%23 = load i32, i32* %4
%24 = add nsw i32 %23, 1
store i32 %24, i32* %4
br label %33
25: ; preds = %17
%26 = load i32, i32* %3
%27 = load i32, i32* %2
%28 = icmp sgt i32 %26, %27
br i1 %28, label %29, label %32
29: ; preds = %25
%30 = load i32, i32* %5
%31 = add nsw i32 %30, 1
store i32 %31, i32* %5
br label %32
32: ; preds = %29, %25
br label %33
33: ; preds = %32, %22
%34 = load i32, i32* %7
%35 = add nsw i32 %34, -1
store i32 %35, i32* %7
br label %14
36: ; preds = %14
%37 = load i32, i32* %4
%38 = load i32, i32* %5
%39 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %37, i32 %38)
%40 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %6)
br label %9
41: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c" %d\00"
@.str.1 = [7 x i8] c" %d %d\00"
@.str.2 = [7 x i8] c"%d %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %3)
%8 = load i32, i32* %3
%9 = icmp eq i32 %8, 0
br i1 %9, label %37, label %10
10: ; preds = %0, %30
%11 = phi i32 [ %35, %30 ], [ %8, %0 ]
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %30
13: ; preds = %10, %13
%14 = phi i32 [ %28, %13 ], [ %11, %10 ]
%15 = phi i32 [ %27, %13 ], [ 0, %10 ]
%16 = phi i32 [ %23, %13 ], [ 0, %10 ]
%17 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%18 = load i32, i32* %1
%19 = load i32, i32* %2
%20 = icmp sgt i32 %18, %19
%21 = icmp sgt i32 %19, %18
%22 = zext i1 %20 to i32
%23 = add nuw nsw i32 %16, %22
%24 = xor i1 %20, true
%25 = and i1 %21, %24
%26 = zext i1 %25 to i32
%27 = add nuw nsw i32 %15, %26
%28 = add nsw i32 %14, -1
%29 = icmp ugt i32 %14, 1
br i1 %29, label %13, label %30
30: ; preds = %13, %10
%31 = phi i32 [ 0, %10 ], [ %23, %13 ]
%32 = phi i32 [ 0, %10 ], [ %27, %13 ]
%33 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %31, i32 %32)
%34 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %3)
%35 = load i32, i32* %3
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %10
37: ; preds = %30, %0
ret i32 0
}