#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 argc, const char *argv[]) {
  int i, soma = 0, v, num, maior, menor;
  printf("digite a quantidade de valores:");
  scanf("%d", &v);
  for (i = 1; i <= v; i++) {
    printf("digite um numero: ");
    scanf("%d", &num);
    if (i == 1) {
      maior = num;
      menor = num;
    }
    if (num >= maior) {
      maior = num;
    } else if (num < menor) {
      menor = num;
    }
    soma = soma + num;
  }
  printf("a soma dos valores: %d \no maior numero: %d \n e o menor numero %d\n",
         soma, maior, menor);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xece(%rip),%rdi
lea    -0x1c(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jg     11e7 <main+0xc7>
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9d(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x1,-0x14(%rbp)
jne    11a2 <main+0x82>
mov    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x24(%rbp),%eax
jl     11b9 <main+0x99>
mov    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
jmp    11d0 <main+0xb0>
mov    -0x20(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    11cb <main+0xab>
mov    -0x20(%rbp),%eax
mov    %eax,-0x28(%rbp)
jmp    11d0 <main+0xb0>
mov    -0x18(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1162 <main+0x42>
mov    -0x18(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x28(%rbp),%ecx
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xece(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee0(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
lea    0xed2(%rip),%r12
mov    %rsp,%r13
xor    %r14d,%r14d
xor    %r15d,%r15d
nopw   0x0(%rax,%rax,1)
mov    %r12,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeaf(%rip),%rdi
mov    %r13,%rsi
call   1040 <scanf@plt>
test   %r14d,%r14d
mov    (%rsp),%eax
cmove  %eax,%ebp
mov    %ebx,%ecx
cmove  %eax,%ecx
cmp    %ecx,%eax
mov    %ecx,%ebx
cmovl  %eax,%ebx
cmp    %ebp,%eax
cmovge %eax,%ebp
cmovge %ecx,%ebx
add    %eax,%r15d
add    $0x1,%r14d
cmp    0x4(%rsp),%r14d
jl     1160 <main+0x40>
lea    0xe8b(%rip),%rdi
mov    %r15d,%esi
mov    %ebp,%edx
mov    %ebx,%ecx
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 = [32 x i8] c"digite a quantidade de valores:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [19 x i8] c"digite um numero: \00"
@.str.3 = [66 x i8] c"a soma dos valores: %d \0Ao maior numero: %d \0A e o menor numero %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %8)
store i32 1, i32* %6
br label %14
14: ; preds = %43, %2
%15 = load i32, i32* %6
%16 = load i32, i32* %8
%17 = icmp sle i32 %15, %16
br i1 %17, label %18, label %46
18: ; preds = %14
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %9)
%21 = load i32, i32* %6
%22 = icmp eq i32 %21, 1
br i1 %22, label %23, label %26
23: ; preds = %18
%24 = load i32, i32* %9
store i32 %24, i32* %10
%25 = load i32, i32* %9
store i32 %25, i32* %11
br label %26
26: ; preds = %23, %18
%27 = load i32, i32* %9
%28 = load i32, i32* %10
%29 = icmp sge i32 %27, %28
br i1 %29, label %30, label %32
30: ; preds = %26
%31 = load i32, i32* %9
store i32 %31, i32* %10
br label %39
32: ; preds = %26
%33 = load i32, i32* %9
%34 = load i32, i32* %11
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %38
36: ; preds = %32
%37 = load i32, i32* %9
store i32 %37, i32* %11
br label %38
38: ; preds = %36, %32
br label %39
39: ; preds = %38, %30
%40 = load i32, i32* %7
%41 = load i32, i32* %9
%42 = add nsw i32 %40, %41
store i32 %42, i32* %7
br label %43
43: ; preds = %39
%44 = load i32, i32* %6
%45 = add nsw i32 %44, 1
store i32 %45, i32* %6
br label %14
46: ; preds = %14
%47 = load i32, i32* %7
%48 = load i32, i32* %10
%49 = load i32, i32* %11
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.3, i64 0, i64 0), i32 %47, i32 %48, i32 %49)
ret i32 0
}

LLVM IR (-O2):
@.str = [32 x i8] c"digite a quantidade de valores:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [19 x i8] c"digite um numero: \00"
@.str.3 = [66 x i8] c"a soma dos valores: %d \0Ao maior numero: %d \0A e o menor numero %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%9 = load i32, i32* %3
%10 = icmp sgt i32 %9, 0
br label %11
11: ; preds = %2, %11
%12 = phi i32 [ %26, %11 ], [ undef, %2 ]
%13 = phi i32 [ %24, %11 ], [ undef, %2 ]
%14 = phi i32 [ %27, %11 ], [ 0, %2 ]
%15 = phi i32 [ %28, %11 ], [ 1, %2 ]
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%18 = icmp eq i32 %15, 1
%19 = load i32, i32* %4
%20 = select i1 %18, i32 %19, i32 %13
%21 = select i1 %18, i32 %19, i32 %12
%22 = icmp slt i32 %19, %20
%23 = icmp slt i32 %19, %21
%24 = select i1 %22, i32 %20, i32 %19
%25 = select i1 %22, i1 %23, i1 false
%26 = select i1 %25, i32 %19, i32 %21
%27 = add nsw i32 %19, %14
%28 = add nuw nsw i32 %15, 1
%29 = load i32, i32* %3
%30 = icmp slt i32 %15, %29
br i1 %30, label %11, label %31
31: ; preds = %11
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @.str.3, i64 0, i64 0), i32 %27, i32 %24, i32 %26)
ret i32 0
}