#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 /*<<< orphan*/ system(char *);
int main() {
  int acumulador = 0, num, contador = 1;
  printf("\n\tDigite 10 números inteiros e positivos!\n\n");
  do {
    printf("Qual o valor do %dº número: ", contador);
    scanf("%d", &num);
    acumulador = acumulador + num;
    contador++;
  } while (contador <= 10);
  printf("\nA média desses números é: %d.\n\n", (acumulador / 10));
  system("pause");
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0x10(%rbp)
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xed9(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0xa,-0x10(%rbp)
jle    115b <main+0x2b>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeb9(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xefe(%rip),%rdi
call   1030 <puts@plt>
lea    0xea6(%rip),%r14
mov    %r14,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeaf(%rip),%rbx
lea    0x4(%rsp),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%ebp
mov    %r14,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
add    0x4(%rsp),%ebp
mov    %r14,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
add    0x4(%rsp),%ebp
mov    %r14,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
add    0x4(%rsp),%ebp
mov    %r14,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
add    0x4(%rsp),%ebp
mov    %r14,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
add    0x4(%rsp),%ebp
mov    %r14,%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
add    0x4(%rsp),%ebp
mov    %r14,%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
add    0x4(%rsp),%ebp
mov    %r14,%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
add    0x4(%rsp),%ebp
mov    %r14,%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
add    0x4(%rsp),%ebp
movslq %ebp,%rax
imul   $0x66666667,%rax,%rsi
mov    %rsi,%rax
shr    $0x3f,%rax
sar    $0x22,%rsi
add    %eax,%esi
lea    0xd72(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd88(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [45 x i8] c"\0A\09Digite 10 n\C3\BAmeros inteiros e positivos!\0A\0A\00"
@.str.1 = [31 x i8] c"Qual o valor do %d\C2\BA n\C3\BAmero: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [36 x i8] c"\0AA m\C3\A9dia desses n\C3\BAmeros \C3\A9: %d.\0A\0A\00"
@.str.4 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 1, i32* %4
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %15, %0
%7 = load i32, i32* %4
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = add nsw i32 %10, %11
store i32 %12, i32* %2
%13 = load i32, i32* %4
%14 = add nsw i32 %13, 1
store i32 %14, i32* %4
br label %15
15: ; preds = %6
%16 = load i32, i32* %4
%17 = icmp sle i32 %16, 10
br i1 %17, label %6, label %18
18: ; preds = %15
%19 = load i32, i32* %2
%20 = sdiv i32 %19, 10
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 %20)
%22 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [31 x i8] c"Qual o valor do %d\C2\BA n\C3\BAmero: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [36 x i8] c"\0AA m\C3\A9dia desses n\C3\BAmeros \C3\A9: %d.\0A\0A\00"
@.str.4 = [6 x i8] c"pause\00"
@str = [44 x i8] c"\0A\09Digite 10 n\C3\BAmeros inteiros e positivos!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 1)
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 2)
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%9 = load i32, i32* %1
%10 = add nsw i32 %9, %6
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 3)
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%13 = load i32, i32* %1
%14 = add nsw i32 %13, %10
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 4)
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%17 = load i32, i32* %1
%18 = add nsw i32 %17, %14
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 5)
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%21 = load i32, i32* %1
%22 = add nsw i32 %21, %18
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 6)
%24 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%25 = load i32, i32* %1
%26 = add nsw i32 %25, %22
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 7)
%28 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%29 = load i32, i32* %1
%30 = add nsw i32 %29, %26
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 8)
%32 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%33 = load i32, i32* %1
%34 = add nsw i32 %33, %30
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 9)
%36 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%37 = load i32, i32* %1
%38 = add nsw i32 %37, %34
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 10)
%40 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%41 = load i32, i32* %1
%42 = add nsw i32 %41, %38
%43 = sdiv i32 %42, 10
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 %43)
%45 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}