#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 EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char **argv) {
  int i, num[5];
  int major, menor, suma;
  float mitjana;
  suma = 0;
  printf("Introdueix numeros: \n");
  for (i = 0; i < 5; i++) {
    scanf("%d", &num[i]);
    suma = suma + num[i];
    if (num[i] > major) {
      major = num[i];
    }
    if (num[i] < menor) {
      menor = num[i];
    }
  }
  mitjana = suma / i;
  printf("\nSuma: %d", suma);
  printf("\nMitjana: %2f", mitjana);
  printf("\nNº major: %d", major);
  printf("\nNº menor: %d", menor);
  printf("\n\n");
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x3c(%rbp)
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x5,-0x14(%rbp)
jge    11d0 <main+0xb0>
movslq -0x14(%rbp),%rax
lea    -0x30(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xeab(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x3c(%rbp),%eax
movslq -0x14(%rbp),%rcx
add    -0x30(%rbp,%rcx,4),%eax
mov    %eax,-0x3c(%rbp)
movslq -0x14(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
cmp    -0x34(%rbp),%eax
jle    11a1 <main+0x81>
movslq -0x14(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x34(%rbp)
movslq -0x14(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
cmp    -0x38(%rbp),%eax
jge    11bd <main+0x9d>
movslq -0x14(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x38(%rbp)
jmp    11c2 <main+0xa2>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1152 <main+0x32>
mov    -0x3c(%rbp),%eax
cltd
idivl  -0x14(%rbp)
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x40(%rbp)
mov    -0x3c(%rbp),%esi
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x40(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe1f(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%esi
lea    0xe1c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%esi
lea    0xe1a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2da1(%rip),%rax
mov    (%rax),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
lea    0xef9(%rip),%rdi
call   1030 <puts@plt>
lea    0xebe(%rip),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    (%rsp),%ebp
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
add    0x4(%rsp),%ebp
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
add    0x8(%rsp),%ebp
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
add    0xc(%rsp),%ebp
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
add    0x10(%rsp),%ebp
movslq %ebp,%rsi
imul   $0x66666667,%rsi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x21,%rax
add    %ecx,%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x14(%rsp)
lea    0xe3d(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movss  0x14(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe2f(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe2f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe30(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe46(%rip),%rdi
call   1030 <puts@plt>
mov    0x2dcf(%rip),%rax
mov    (%rax),%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Introdueix numeros: \0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [10 x i8] c"\0ASuma: %d\00"
@.str.3 = [14 x i8] c"\0AMitjana: %2f\00"
@.str.4 = [15 x i8] c"\0AN\C2\BA major: %d\00"
@.str.5 = [15 x i8] c"\0AN\C2\BA menor: %d\00"
@.str.6 = [3 x i8] c"\0A\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [5 x i32]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %10
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %6
br label %13
13: ; preds = %51, %2
%14 = load i32, i32* %6
%15 = icmp slt i32 %14, 5
br i1 %15, label %16, label %54
16: ; preds = %13
%17 = load i32, i32* %6
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [5 x i32], [5 x i32]* %7, i64 0, i64 %18
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %19)
%21 = load i32, i32* %10
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [5 x i32], [5 x i32]* %7, i64 0, i64 %23
%25 = load i32, i32* %24
%26 = add nsw i32 %21, %25
store i32 %26, i32* %10
%27 = load i32, i32* %6
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [5 x i32], [5 x i32]* %7, i64 0, i64 %28
%30 = load i32, i32* %29
%31 = load i32, i32* %8
%32 = icmp sgt i32 %30, %31
br i1 %32, label %33, label %38
33: ; preds = %16
%34 = load i32, i32* %6
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [5 x i32], [5 x i32]* %7, i64 0, i64 %35
%37 = load i32, i32* %36
store i32 %37, i32* %8
br label %38
38: ; preds = %33, %16
%39 = load i32, i32* %6
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [5 x i32], [5 x i32]* %7, i64 0, i64 %40
%42 = load i32, i32* %41
%43 = load i32, i32* %9
%44 = icmp slt i32 %42, %43
br i1 %44, label %45, label %50
45: ; preds = %38
%46 = load i32, i32* %6
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [5 x i32], [5 x i32]* %7, i64 0, i64 %47
%49 = load i32, i32* %48
store i32 %49, i32* %9
br label %50
50: ; preds = %45, %38
br label %51
51: ; preds = %50
%52 = load i32, i32* %6
%53 = add nsw i32 %52, 1
store i32 %53, i32* %6
br label %13
54: ; preds = %13
%55 = load i32, i32* %10
%56 = load i32, i32* %6
%57 = sdiv i32 %55, %56
%58 = sitofp i32 %57 to float
store float %58, float* %11
%59 = load i32, i32* %10
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %59)
%61 = load float, float* %11
%62 = fpext float %61 to double
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), double %62)
%64 = load i32, i32* %8
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 %64)
%66 = load i32, i32* %9
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i32 %66)
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%69 = load i32, i32* @EXIT_SUCCESS
ret i32 %69
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [10 x i8] c"\0ASuma: %d\00"
@.str.3 = [14 x i8] c"\0AMitjana: %2f\00"
@.str.4 = [15 x i8] c"\0AN\C2\BA major: %d\00"
@.str.5 = [15 x i8] c"\0AN\C2\BA menor: %d\00"
@EXIT_SUCCESS = global i32 0
@str = [21 x i8] c"Introdueix numeros: \00"
@str.7 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [5 x i32]
%4 = bitcast [5 x i32]* %3 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%6 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%8 = load i32, i32* %6
%9 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 1
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %9)
%11 = load i32, i32* %9
%12 = add nsw i32 %11, %8
%13 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 2
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %13)
%15 = load i32, i32* %13
%16 = add nsw i32 %15, %12
%17 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 3
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %17)
%19 = load i32, i32* %17
%20 = add nsw i32 %19, %16
%21 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 4
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %21)
%23 = load i32, i32* %21
%24 = add nsw i32 %23, %20
%25 = sdiv i32 %24, 5
%26 = sitofp i32 %25 to float
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %24)
%28 = fpext float %26 to double
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), double %28)
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 undef)
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i32 undef)
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.7, i64 0, i64 0))
%33 = load i32, i32* @EXIT_SUCCESS
ret i32 %33
}