#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 *, ...);
main(int argc, const char *argv[]) {
  int op, status, cont;
  float n_temp, acum, media, maior, menor;
  status = 1;
  cont = 1;
  printf("Informe uma temperatura: ");
  scanf("%f", &n_temp);
  maior = n_temp;
  menor = n_temp;
  acum = n_temp;
  while (status == 1) {
    printf("Outra temperatura? [1/0] ");
    scanf("%d", &op);
    switch (op) {
    case 1:
      printf("\nTemperatura: ");
      scanf("%f", &n_temp);
      acum += n_temp;
      cont++;
      if (n_temp > maior) {
        maior = n_temp;
      }
      if (n_temp < menor) {
        menor = n_temp;
      }
      break;
    case 0:
      status = 0;
      break;
    }
  }
  media = acum / cont;
  printf("\nMenor temperatura: %.2f\n", menor);
  printf("Maior temperatura: %.2f\n", maior);
  printf("\nMedia de temperatura eh: %.2f\n", media);
  return 0;
}


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   $0x1,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec1(%rip),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
cmpl   $0x1,-0x18(%rbp)
jne    1253 <main+0x133>
lea    0xe8a(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x35(%rbp)
call   1030 <printf@plt>
mov    -0x35(%rbp),%al
lea    0xe90(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x34(%rbp)
test   %eax,%eax
je     1247 <main+0x127>
jmp    11c3 <main+0xa3>
mov    -0x34(%rbp),%eax
sub    $0x1,%eax
jne    124e <main+0x12e>
jmp    11d4 <main+0xb4>
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe31(%rip),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0x20(%rbp),%xmm0
addss  -0x24(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
movss  -0x20(%rbp),%xmm0
ucomiss -0x2c(%rbp),%xmm0
jbe    1225 <main+0x105>
movss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x20(%rbp),%xmm1
movss  -0x30(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1242 <main+0x122>
movss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
jmp    124e <main+0x12e>
movl   $0x0,-0x18(%rbp)
jmp    1182 <main+0x62>
movss  -0x24(%rbp),%xmm0
cvtsi2ssl -0x1c(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x30(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdd3(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x2c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdd6(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdd8(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xecb(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed7(%rip),%r14
lea    0x10(%rsp),%r15
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    $0x1,%ebp
movss  0x10(%rsp),%xmm0
lea    0xeb6(%rip),%r12
lea    0xec9(%rip),%r13
lea    0x14(%rsp),%rbx
movaps %xmm0,%xmm1
movss  %xmm0,0x4(%rsp)
movss  %xmm0,0xc(%rsp)
movss  %xmm1,0x8(%rsp)
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x14(%rsp),%eax
test   %eax,%eax
je     1207 <main+0xe7>
cmp    $0x1,%eax
jne    1190 <main+0x70>
lea    0xe7f(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
movss  0x10(%rsp),%xmm0
movss  0x4(%rsp),%xmm1
addss  %xmm0,%xmm1
movss  %xmm1,0x4(%rsp)
add    $0x1,%ebp
movaps %xmm0,%xmm1
maxss  0x8(%rsp),%xmm1
movss  0xc(%rsp),%xmm2
ucomiss %xmm0,%xmm2
movss  %xmm1,0x8(%rsp)
jbe    1190 <main+0x70>
jmp    117c <main+0x5c>
xorps  %xmm0,%xmm0
cvtsi2ss %ebp,%xmm0
movss  0x4(%rsp),%xmm1
divss  %xmm0,%xmm1
movss  %xmm1,0x4(%rsp)
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe1a(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe1c(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe1d(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Informe uma temperatura: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [26 x i8] c"Outra temperatura? [1/0] \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [15 x i8] c"\0ATemperatura: \00"
@.str.5 = [26 x i8] c"\0AMenor temperatura: %.2f\0A\00"
@.str.6 = [25 x i8] c"Maior temperatura: %.2f\0A\00"
@.str.7 = [32 x i8] c"\0AMedia de temperatura eh: %.2f\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 float
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %7
store i32 1, i32* %8
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %9)
%16 = load float, float* %9
store float %16, float* %12
%17 = load float, float* %9
store float %17, float* %13
%18 = load float, float* %9
store float %18, float* %10
br label %19
19: ; preds = %47, %2
%20 = load i32, i32* %7
%21 = icmp eq i32 %20, 1
br i1 %21, label %22, label %48
22: ; preds = %19
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%24 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %6)
%25 = load i32, i32* %6
switch i32 %25, label %47 [
i32 1, label %26
i32 0, label %46
]
26: ; preds = %22
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
%28 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %9)
%29 = load float, float* %9
%30 = load float, float* %10
%31 = fadd float %30, %29
store float %31, float* %10
%32 = load i32, i32* %8
%33 = add nsw i32 %32, 1
store i32 %33, i32* %8
%34 = load float, float* %9
%35 = load float, float* %12
%36 = fcmp ogt float %34, %35
br i1 %36, label %37, label %39
37: ; preds = %26
%38 = load float, float* %9
store float %38, float* %12
br label %39
39: ; preds = %37, %26
%40 = load float, float* %9
%41 = load float, float* %13
%42 = fcmp olt float %40, %41
br i1 %42, label %43, label %45
43: ; preds = %39
%44 = load float, float* %9
store float %44, float* %13
br label %45
45: ; preds = %43, %39
br label %47
46: ; preds = %22
store i32 0, i32* %7
br label %47
47: ; preds = %22, %46, %45
br label %19
48: ; preds = %19
%49 = load float, float* %10
%50 = load i32, i32* %8
%51 = sitofp i32 %50 to float
%52 = fdiv float %49, %51
store float %52, float* %11
%53 = load float, float* %13
%54 = fpext float %53 to double
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), double %54)
%56 = load float, float* %12
%57 = fpext float %56 to double
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), double %57)
%59 = load float, float* %11
%60 = fpext float %59 to double
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0), double %60)
ret i32 0
}

LLVM IR (-O2):
@.str = [26 x i8] c"Informe uma temperatura: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [26 x i8] c"Outra temperatura? [1/0] \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [15 x i8] c"\0ATemperatura: \00"
@.str.5 = [26 x i8] c"\0AMenor temperatura: %.2f\0A\00"
@.str.6 = [25 x i8] c"Maior temperatura: %.2f\0A\00"
@.str.7 = [32 x i8] c"\0AMedia de temperatura eh: %.2f\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca float
%5 = bitcast i32* %3 to i8*
%6 = bitcast float* %4 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %4)
%9 = load float, float* %4
br label %10
10: ; preds = %23, %2
%11 = phi float [ %9, %2 ], [ %26, %23 ]
%12 = phi float [ %9, %2 ], [ %30, %23 ]
%13 = phi float [ %9, %2 ], [ %27, %23 ]
%14 = phi i32 [ 1, %2 ], [ %28, %23 ]
br label %15
15: ; preds = %10, %23
%16 = phi float [ %12, %10 ], [ %30, %23 ]
%17 = phi float [ %13, %10 ], [ %27, %23 ]
%18 = phi i32 [ %14, %10 ], [ %28, %23 ]
br label %19
19: ; preds = %15, %19
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %3)
%22 = load i32, i32* %3
switch i32 %22, label %19 [
i32 1, label %23
i32 0, label %32
]
23: ; preds = %19
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
%25 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %4)
%26 = load float, float* %4
%27 = fadd float %17, %26
%28 = add nsw i32 %18, 1
%29 = fcmp ogt float %26, %16
%30 = select i1 %29, float %26, float %16
%31 = fcmp olt float %26, %11
br i1 %31, label %10, label %15
32: ; preds = %19
%33 = sitofp i32 %18 to float
%34 = fdiv float %17, %33
%35 = fpext float %11 to double
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), double %35)
%37 = fpext float %16 to double
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), double %37)
%39 = fpext float %34 to double
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0), double %39)
ret i32 0
}