#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*/ scanf(char *, int *, ...);
int main(void) {
  int vitoriasDoInter = 0, vitoriasDoGremio = 0, empates = 0;
  int golsDoInter, golsDoGremio;
  int novoGrenal;
  do {
    scanf("%d %d\n", &golsDoInter, &golsDoGremio);
    if (golsDoInter == golsDoGremio) {
      empates++;
    } else if (golsDoInter > golsDoGremio) {
      vitoriasDoInter++;
    } else {
      vitoriasDoGremio++;
    }
    printf("Novo grenal (1-sim 2-nao)\n");
    scanf("%d\n", &novoGrenal);
  } while (novoGrenal == 1);
  printf("%d grenais\n", vitoriasDoInter + vitoriasDoGremio + empates);
  printf("Inter:%d\n", vitoriasDoInter);
  printf("Gremio:%d\n", vitoriasDoGremio);
  printf("Empates:%d\n", empates);
  if (vitoriasDoInter == vitoriasDoGremio) {
    printf("Nao houve vencedor\n");
  } else if (vitoriasDoInter > vitoriasDoGremio) {
    printf("Inter venceu mais\n");
  } else {
    printf("Gremio venceu mais\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xeb5(%rip),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jne    1174 <main+0x54>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    119c <main+0x7c>
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    118e <main+0x6e>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1197 <main+0x77>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    119c <main+0x7c>
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe52(%rip),%rdi
lea    -0x1c(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x1,-0x1c(%rbp)
je     1144 <main+0x24>
mov    -0x8(%rbp),%esi
add    -0xc(%rbp),%esi
add    -0x10(%rbp),%esi
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xe40(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    122f <main+0x10f>
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1261 <main+0x141>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    124e <main+0x12e>
lea    0xe21(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    125c <main+0x13c>
lea    0xe21(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1261 <main+0x141>
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    0xeef(%rip),%r13
lea    0xeb7(%rip),%r15
lea    0xc(%rsp),%r12
xor    %r14d,%r14d
xor    %ebx,%ebx
xor    %ebp,%ebp
jmp    117f <main+0x4f>
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebp
mov    %r13,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmpl   $0x1,0xc(%rsp)
jne    11b5 <main+0x85>
lea    0xe7a(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x10(%rsp),%eax
cmp    %eax,0x14(%rsp)
je     1160 <main+0x30>
jle    11b0 <main+0x80>
add    $0x1,%r14d
jmp    1163 <main+0x33>
nopl   0x0(%rax)
add    $0x1,%ebx
jmp    1163 <main+0x33>
lea    (%rbx,%r14,1),%esi
add    %ebp,%esi
lea    0xe45(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe43(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe3c(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe37(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    %ebx,%r14d
lea    0xe5d(%rip),%rax
lea    0xe43(%rip),%rcx
cmovg  %rax,%rcx
lea    0xe5d(%rip),%rdi
cmovne %rcx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%d %d\0A\00"
@.str.1 = [27 x i8] c"Novo grenal (1-sim 2-nao)\0A\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@.str.3 = [12 x i8] c"%d grenais\0A\00"
@.str.4 = [10 x i8] c"Inter:%d\0A\00"
@.str.5 = [11 x i8] c"Gremio:%d\0A\00"
@.str.6 = [12 x i8] c"Empates:%d\0A\00"
@.str.7 = [20 x i8] c"Nao houve vencedor\0A\00"
@.str.8 = [19 x i8] c"Inter venceu mais\0A\00"
@.str.9 = [20 x i8] c"Gremio venceu mais\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* %2
store i32 0, i32* %3
store i32 0, i32* %4
br label %8
8: ; preds = %30, %0
%9 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %5, i32* %6)
%10 = load i32, i32* %5
%11 = load i32, i32* %6
%12 = icmp eq i32 %10, %11
br i1 %12, label %13, label %16
13: ; preds = %8
%14 = load i32, i32* %4
%15 = add nsw i32 %14, 1
store i32 %15, i32* %4
br label %27
16: ; preds = %8
%17 = load i32, i32* %5
%18 = load i32, i32* %6
%19 = icmp sgt i32 %17, %18
br i1 %19, label %20, label %23
20: ; preds = %16
%21 = load i32, i32* %2
%22 = add nsw i32 %21, 1
store i32 %22, i32* %2
br label %26
23: ; preds = %16
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
store i32 %25, i32* %3
br label %26
26: ; preds = %23, %20
br label %27
27: ; preds = %26, %13
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%29 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32* %7)
br label %30
30: ; preds = %27
%31 = load i32, i32* %7
%32 = icmp eq i32 %31, 1
br i1 %32, label %8, label %33
33: ; preds = %30
%34 = load i32, i32* %2
%35 = load i32, i32* %3
%36 = add nsw i32 %34, %35
%37 = load i32, i32* %4
%38 = add nsw i32 %36, %37
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %38)
%40 = load i32, i32* %2
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %40)
%42 = load i32, i32* %3
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32 %42)
%44 = load i32, i32* %4
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i32 %44)
%46 = load i32, i32* %2
%47 = load i32, i32* %3
%48 = icmp eq i32 %46, %47
br i1 %48, label %49, label %51
49: ; preds = %33
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0))
br label %60
51: ; preds = %33
%52 = load i32, i32* %2
%53 = load i32, i32* %3
%54 = icmp sgt i32 %52, %53
br i1 %54, label %55, label %57
55: ; preds = %51
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0))
br label %59
57: ; preds = %51
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0))
br label %59
59: ; preds = %57, %55
br label %60
60: ; preds = %59, %49
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"%d %d\0A\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@.str.3 = [12 x i8] c"%d grenais\0A\00"
@.str.4 = [10 x i8] c"Inter:%d\0A\00"
@.str.5 = [11 x i8] c"Gremio:%d\0A\00"
@.str.6 = [12 x i8] c"Empates:%d\0A\00"
@str = [26 x i8] c"Novo grenal (1-sim 2-nao)\00"
@str.10 = [19 x i8] c"Gremio venceu mais\00"
@str.11 = [18 x i8] c"Inter venceu mais\00"
@str.12 = [19 x i8] c"Nao houve vencedor\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*
br label %7
7: ; preds = %23, %0
%8 = phi i32 [ 0, %0 ], [ %24, %23 ]
%9 = phi i32 [ 0, %0 ], [ %25, %23 ]
%10 = phi i32 [ 0, %0 ], [ %26, %23 ]
%11 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%12 = load i32, i32* %1
%13 = load i32, i32* %2
%14 = icmp eq i32 %12, %13
br i1 %14, label %15, label %17
15: ; preds = %7
%16 = add nsw i32 %10, 1
br label %23
17: ; preds = %7
%18 = icmp sgt i32 %12, %13
br i1 %18, label %19, label %21
19: ; preds = %17
%20 = add nsw i32 %8, 1
br label %23
21: ; preds = %17
%22 = add nsw i32 %9, 1
br label %23
23: ; preds = %19, %21, %15
%24 = phi i32 [ %8, %15 ], [ %20, %19 ], [ %8, %21 ]
%25 = phi i32 [ %9, %15 ], [ %9, %19 ], [ %22, %21 ]
%26 = phi i32 [ %16, %15 ], [ %10, %19 ], [ %10, %21 ]
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%28 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%29 = load i32, i32* %3
%30 = icmp eq i32 %29, 1
br i1 %30, label %7, label %31
31: ; preds = %23
%32 = add nsw i32 %25, %24
%33 = add nsw i32 %32, %26
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %33)
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %24)
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32 %25)
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i32 %26)
%38 = icmp eq i32 %24, %25
%39 = icmp sgt i32 %24, %25
%40 = select i1 %39, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @str.11, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @str.10, i64 0, i64 0)
%41 = select i1 %38, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @str.12, i64 0, i64 0), i8* %40
%42 = call i32 @puts(i8* dereferenceable(1) %41)
ret i32 0
}