#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() {
  int golI, golG, sn = 1, tot = 0, vI = 0, vG = 0, e = 0;
  while (sn == 1) {
    scanf("%d %d", &golI, &golG);
    printf("Novo grenal (1-sim 2-nao)\n");
    scanf("%d", &sn);
    tot++;
    if (golI > golG)
      vI++;
    else if (golI < golG)
      vG++;
    else
      e++;
  }
  printf("%d grenais\n", tot);
  printf("Inter:%d\n", vI);
  printf("Gremio:%d\n", vG);
  printf("Empates:%d\n", e);
  if (vI > vG)
    printf("Inter venceu mais\n");
  else if (vI < vG)
    printf("Gremio venceu mais\n");
  else
    printf("Nao houve vencedor\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
cmpl   $0x1,-0x10(%rbp)
jne    11e2 <main+0xc2>
lea    0xe9d(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe7c(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    11b5 <main+0x95>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11dd <main+0xbd>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11cf <main+0xaf>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11d8 <main+0xb8>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11dd <main+0xbd>
jmp    1152 <main+0x32>
mov    -0x14(%rbp),%esi
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xe29(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%esi
lea    0xe23(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jle    1245 <main+0x125>
lea    0xe15(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1277 <main+0x157>
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1264 <main+0x144>
lea    0xe09(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1272 <main+0x152>
lea    0xe0a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1277 <main+0x157>
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
movl   $0x1,0xc(%rsp)
lea    0x10(%rsp),%rbx
lea    0xf19(%rip),%r15
lea    0xeaa(%rip),%r12
lea    0xc(%rsp),%r13
movl   $0x0,0x4(%rsp)
movl   $0x0,0x8(%rsp)
xor    %ebp,%ebp
xor    %r14d,%r14d
jmp    118e <main+0x5e>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%ebp
add    $0x1,%r14d
cmpl   $0x1,0xc(%rsp)
jne    11d7 <main+0xa7>
lea    0xe6b(%rip),%rdi
lea    0x14(%rsp),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x10(%rsp),%eax
cmp    %eax,0x14(%rsp)
jg     1180 <main+0x50>
jge    11d0 <main+0xa0>
addl   $0x1,0x8(%rsp)
jmp    1183 <main+0x53>
nopl   0x0(%rax)
addl   $0x1,0x4(%rsp)
jmp    1183 <main+0x53>
lea    0xe28(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe23(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe1d(%rip),%rdi
mov    0x8(%rsp),%ebx
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe14(%rip),%rdi
mov    0x4(%rsp),%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    %ebx,%ebp
lea    0xe1f(%rip),%rax
lea    0xe05(%rip),%rcx
cmovl  %rax,%rcx
lea    0xe20(%rip),%rdi
cmovle %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 = [6 x i8] c"%d %d\00"
@.str.1 = [27 x i8] c"Novo grenal (1-sim 2-nao)\0A\00"
@.str.2 = [3 x i8] c"%d\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 = [19 x i8] c"Inter venceu mais\0A\00"
@.str.8 = [20 x i8] c"Gremio venceu mais\0A\00"
@.str.9 = [20 x i8] c"Nao houve vencedor\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
store i32 0, i32* %1
store i32 1, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
br label %9
9: ; preds = %35, %0
%10 = load i32, i32* %4
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %36
12: ; preds = %9
%13 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%15 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%16 = load i32, i32* %5
%17 = add nsw i32 %16, 1
store i32 %17, i32* %5
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = icmp sgt i32 %18, %19
br i1 %20, label %21, label %24
21: ; preds = %12
%22 = load i32, i32* %6
%23 = add nsw i32 %22, 1
store i32 %23, i32* %6
br label %35
24: ; preds = %12
%25 = load i32, i32* %2
%26 = load i32, i32* %3
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %31
28: ; preds = %24
%29 = load i32, i32* %7
%30 = add nsw i32 %29, 1
store i32 %30, i32* %7
br label %34
31: ; preds = %24
%32 = load i32, i32* %8
%33 = add nsw i32 %32, 1
store i32 %33, i32* %8
br label %34
34: ; preds = %31, %28
br label %35
35: ; preds = %34, %21
br label %9
36: ; preds = %9
%37 = load i32, i32* %5
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %37)
%39 = load i32, i32* %6
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %39)
%41 = load i32, i32* %7
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32 %41)
%43 = load i32, i32* %8
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i32 %43)
%45 = load i32, i32* %6
%46 = load i32, i32* %7
%47 = icmp sgt i32 %45, %46
br i1 %47, label %48, label %50
48: ; preds = %36
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
br label %59
50: ; preds = %36
%51 = load i32, i32* %6
%52 = load i32, i32* %7
%53 = icmp slt i32 %51, %52
br i1 %53, label %54, label %56
54: ; preds = %50
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0))
br label %58
56: ; preds = %50
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0))
br label %58
58: ; preds = %56, %54
br label %59
59: ; preds = %58, %48
ret i32 0
}

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