#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 rand();
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int i = 0, num1, num2, resultado, resposta, acerto = 0;
  while (i <= 4) {
    num1 = rand() % 100;
    num2 = rand() % 100;
    resposta = 0;
    resultado = num1 + num2;
    printf("Qual eh resultado da soma de %d + %d = ", num1, num2);
    scanf("%d", &resposta);
    if (resultado == resposta) {
      acerto += 1;
    }
    i++;
  }
  printf("Total de acerto(s): %d", acerto);
  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,-0x1c(%rbp)
cmpl   $0x4,-0x8(%rbp)
jg     11d2 <main+0xa2>
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe96(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jne    11c4 <main+0x94>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    114d <main+0x1d>
mov    -0x1c(%rbp),%esi
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
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
push   %rax
xor    %eax,%eax
call   1050 <rand@plt>
movslq %eax,%rbx
imul   $0x51eb851f,%rbx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rax
add    %ecx,%eax
imul   $0x64,%eax,%eax
sub    %eax,%ebx
xor    %eax,%eax
call   1050 <rand@plt>
movslq %eax,%rdx
imul   $0x51eb851f,%rdx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rax
add    %ecx,%eax
imul   $0x64,%eax,%eax
sub    %eax,%edx
movl   $0x0,0x4(%rsp)
lea    (%rdx,%rbx,1),%ebp
lea    0xe6d(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe99(%rip),%r12
lea    0x4(%rsp),%r15
mov    %r12,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
xor    %r13d,%r13d
cmp    0x4(%rsp),%ebp
sete   %r13b
xor    %eax,%eax
call   1050 <rand@plt>
movslq %eax,%rbx
imul   $0x51eb851f,%rbx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rax
add    %ecx,%eax
imul   $0x64,%eax,%eax
sub    %eax,%ebx
xor    %eax,%eax
call   1050 <rand@plt>
movslq %eax,%rdx
imul   $0x51eb851f,%rdx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rax
add    %ecx,%eax
imul   $0x64,%eax,%eax
sub    %eax,%edx
movl   $0x0,0x4(%rsp)
lea    (%rdx,%rbx,1),%r14d
lea    0xde9(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r15,%r12
call   1040 <scanf@plt>
xor    %ebp,%ebp
cmp    0x4(%rsp),%r14d
sete   %bpl
add    %r13d,%ebp
xor    %eax,%eax
call   1050 <rand@plt>
movslq %eax,%rbx
imul   $0x51eb851f,%rbx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rax
add    %ecx,%eax
imul   $0x64,%eax,%eax
sub    %eax,%ebx
xor    %eax,%eax
call   1050 <rand@plt>
movslq %eax,%rdx
imul   $0x51eb851f,%rdx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rax
add    %ecx,%eax
imul   $0x64,%eax,%eax
sub    %eax,%edx
movl   $0x0,0x4(%rsp)
lea    (%rdx,%rbx,1),%r14d
lea    0xd6b(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xd97(%rip),%rdi
mov    %rdi,%r15
mov    %r12,%rsi
call   1040 <scanf@plt>
xor    %r13d,%r13d
cmp    0x4(%rsp),%r14d
sete   %r13b
add    %ebp,%r13d
xor    %eax,%eax
call   1050 <rand@plt>
movslq %eax,%rbx
imul   $0x51eb851f,%rbx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rax
add    %ecx,%eax
imul   $0x64,%eax,%eax
sub    %eax,%ebx
xor    %eax,%eax
call   1050 <rand@plt>
movslq %eax,%rdx
imul   $0x51eb851f,%rdx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rax
add    %ecx,%eax
imul   $0x64,%eax,%eax
sub    %eax,%edx
movl   $0x0,0x4(%rsp)
lea    (%rdx,%rbx,1),%r14d
lea    0xce8(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
xor    %ebp,%ebp
cmp    0x4(%rsp),%r14d
sete   %bpl
add    %r13d,%ebp
xor    %eax,%eax
call   1050 <rand@plt>
movslq %eax,%rbx
imul   $0x51eb851f,%rbx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rax
add    %ecx,%eax
imul   $0x64,%eax,%eax
sub    %eax,%ebx
xor    %eax,%eax
call   1050 <rand@plt>
movslq %eax,%rdx
imul   $0x51eb851f,%rdx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rax
add    %ecx,%eax
imul   $0x64,%eax,%eax
sub    %eax,%edx
movl   $0x0,0x4(%rsp)
lea    (%rdx,%rbx,1),%r14d
lea    0xc6d(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
xor    %esi,%esi
cmp    0x4(%rsp),%r14d
sete   %sil
add    %ebp,%esi
lea    0xc6d(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [40 x i8] c"Qual eh resultado da soma de %d + %d = \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [23 x i8] c"Total de acerto(s): %d\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* %7
br label %8
8: ; preds = %29, %0
%9 = load i32, i32* %2
%10 = icmp sle i32 %9, 4
br i1 %10, label %11, label %32
11: ; preds = %8
%12 = call i32 (...) @rand()
%13 = srem i32 %12, 100
store i32 %13, i32* %3
%14 = call i32 (...) @rand()
%15 = srem i32 %14, 100
store i32 %15, i32* %4
store i32 0, i32* %6
%16 = load i32, i32* %3
%17 = load i32, i32* %4
%18 = add nsw i32 %16, %17
store i32 %18, i32* %5
%19 = load i32, i32* %3
%20 = load i32, i32* %4
%21 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %19, i32 %20)
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%23 = load i32, i32* %5
%24 = load i32, i32* %6
%25 = icmp eq i32 %23, %24
br i1 %25, label %26, label %29
26: ; preds = %11
%27 = load i32, i32* %7
%28 = add nsw i32 %27, 1
store i32 %28, i32* %7
br label %29
29: ; preds = %26, %11
%30 = load i32, i32* %2
%31 = add nsw i32 %30, 1
store i32 %31, i32* %2
br label %8
32: ; preds = %8
%33 = load i32, i32* %7
%34 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %33)
ret i32 0
}

LLVM IR (-O2):
@.str = [40 x i8] c"Qual eh resultado da soma de %d + %d = \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [23 x i8] c"Total de acerto(s): %d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 (...) @rand()
%4 = srem i32 %3, 100
%5 = call i32 (...) @rand()
%6 = srem i32 %5, 100
store i32 0, i32* %1
%7 = add nsw i32 %6, %4
%8 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %6)
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%10 = load i32, i32* %1
%11 = icmp eq i32 %7, %10
%12 = zext i1 %11 to i32
%13 = call i32 (...) @rand()
%14 = srem i32 %13, 100
%15 = call i32 (...) @rand()
%16 = srem i32 %15, 100
store i32 0, i32* %1
%17 = add nsw i32 %16, %14
%18 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %16)
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%20 = load i32, i32* %1
%21 = icmp eq i32 %17, %20
%22 = zext i1 %21 to i32
%23 = add nuw nsw i32 %12, %22
%24 = call i32 (...) @rand()
%25 = srem i32 %24, 100
%26 = call i32 (...) @rand()
%27 = srem i32 %26, 100
store i32 0, i32* %1
%28 = add nsw i32 %27, %25
%29 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %25, i32 %27)
%30 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%31 = load i32, i32* %1
%32 = icmp eq i32 %28, %31
%33 = zext i1 %32 to i32
%34 = add nuw nsw i32 %23, %33
%35 = call i32 (...) @rand()
%36 = srem i32 %35, 100
%37 = call i32 (...) @rand()
%38 = srem i32 %37, 100
store i32 0, i32* %1
%39 = add nsw i32 %38, %36
%40 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %36, i32 %38)
%41 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%42 = load i32, i32* %1
%43 = icmp eq i32 %39, %42
%44 = zext i1 %43 to i32
%45 = add nuw nsw i32 %34, %44
%46 = call i32 (...) @rand()
%47 = srem i32 %46, 100
%48 = call i32 (...) @rand()
%49 = srem i32 %48, 100
store i32 0, i32* %1
%50 = add nsw i32 %49, %47
%51 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %47, i32 %49)
%52 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%53 = load i32, i32* %1
%54 = icmp eq i32 %50, %53
%55 = zext i1 %54 to i32
%56 = add nuw nsw i32 %45, %55
%57 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %56)
ret i32 0
}