#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 main() {
  float preco, quant_mes, pagar, maior = -99999999, menor = 99999999, media = 0;
  int numero, cont = 0;
  printf("Entre com o preço do kWh: ");
  scanf("%f", &preco);
  do {
    printf("entre com o Número do consumidor (0 para sair): ");
    scanf("%d", &numero);
    if (numero != 0) {
      printf("entre com a quantidade de kWh consumidos durante o mês: ");
      scanf("%f", &quant_mes);
      pagar = preco * quant_mes;
      media = media + quant_mes;
      cont++;
      printf("o consumidor %d tem que pagar %.2f R$\n", numero, pagar);
      if (quant_mes < menor)
        menor = quant_mes;
      if (quant_mes > maior)
        maior = quant_mes;
    }
  } while (numero != 0);
  media = media / cont;
  if (menor != 99999999 || maior != -99999999) {
    printf("\no maior consumo verificado: %.2f kWh\n ", maior);
    printf("o menor consumo verificado: %.2f kWh\n ", menor);
    printf("média geral de consumo: %.2f kWh\n ", media);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xecd(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xebc(%rip),%xmm0
movss  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
movl   $0x0,-0x24(%rbp)
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb7(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x0,-0x20(%rbp)
je     123e <main+0x11e>
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe6d(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x1c(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%esi
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe9a(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0xc(%rbp),%xmm1
movss  -0x18(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1220 <main+0x100>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0xc(%rbp),%xmm0
ucomiss -0x14(%rbp),%xmm0
jbe    1239 <main+0x119>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
jmp    123e <main+0x11e>
jmp    1243 <main+0x123>
cmpl   $0x0,-0x20(%rbp)
jne    1178 <main+0x58>
movss  -0x1c(%rbp),%xmm0
cvtsi2ssl -0x24(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x18(%rbp),%xmm0
movss  0xd93(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    129d <main+0x17d>
jp     129d <main+0x17d>
movss  -0x14(%rbp),%xmm0
movss  0xd7b(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    129d <main+0x17d>
jp     129d <main+0x17d>
jmp    12e2 <main+0x1c2>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe10(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe21(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe31(%rip),%rdi
mov    $0x1,%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
sub    $0x18,%rsp
lea    0xed3(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee1(%rip),%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,(%rsp)
movss  0xea1(%rip),%xmm2
movss  0xe9d(%rip),%xmm1
lea    0xeb9(%rip),%r15
lea    0xee4(%rip),%r12
lea    0x8(%rsp),%rbx
lea    0x10(%rsp),%rbp
lea    0xf10(%rip),%r14
xor    %r13d,%r13d
nopl   0x0(%rax)
movss  %xmm2,0xc(%rsp)
movss  %xmm1,0x4(%rsp)
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,0x8(%rsp)
je     1238 <main+0x118>
lea    0xe9b(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe55(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
movss  0x10(%rsp),%xmm0
movss  0x14(%rsp),%xmm1
mulss  %xmm0,%xmm1
movss  (%rsp),%xmm2
addss  %xmm0,%xmm2
movss  %xmm2,(%rsp)
add    $0x1,%r13d
mov    0x8(%rsp),%esi
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  0x10(%rsp),%xmm0
movaps %xmm0,%xmm3
minss  0xc(%rsp),%xmm3
maxss  0x4(%rsp),%xmm0
cmpl   $0x0,0x8(%rsp)
movaps %xmm0,%xmm1
movaps %xmm3,%xmm2
jne    1190 <main+0x70>
jmp    1244 <main+0x124>
movss  0xc(%rsp),%xmm3
movss  0x4(%rsp),%xmm0
ucomiss 0xdb5(%rip),%xmm3
jne    125a <main+0x13a>
jp     125a <main+0x13a>
ucomiss 0xdae(%rip),%xmm0
jne    125a <main+0x13a>
jnp    12b7 <main+0x197>
xorps  %xmm1,%xmm1
cvtsi2ss %r13d,%xmm1
movss  (%rsp),%xmm2
divss  %xmm1,%xmm2
movss  %xmm2,(%rsp)
cvtss2sd %xmm0,%xmm0
lea    0xe42(%rip),%rdi
mov    $0x1,%al
movss  %xmm3,0x4(%rsp)
call   1030 <printf@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe4c(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  (%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe5c(%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 = [28 x i8] c"Entre com o pre\C3\A7o do kWh: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [50 x i8] c"entre com o N\C3\BAmero do consumidor (0 para sair): \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [58 x i8] c"entre com a quantidade de kWh consumidos durante o m\C3\AAs: \00"
@.str.5 = [39 x i8] c"o consumidor %d tem que pagar %.2f R$\0A\00"
@.str.6 = [40 x i8] c"\0Ao maior consumo verificado: %.2f kWh\0A \00"
@.str.7 = [39 x i8] c"o menor consumo verificado: %.2f kWh\0A \00"
@.str.8 = [36 x i8] c"m\C3\A9dia geral de consumo: %.2f kWh\0A \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
store float -1.000000e+08, float* %5
store float 1.000000e+08, float* %6
store float 0.000000e+00, float* %7
store i32 0, i32* %9
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
br label %12
12: ; preds = %45, %0
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %8)
%15 = load i32, i32* %8
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %44
17: ; preds = %12
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.4, i64 0, i64 0))
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%20 = load float, float* %2
%21 = load float, float* %3
%22 = fmul float %20, %21
store float %22, float* %4
%23 = load float, float* %7
%24 = load float, float* %3
%25 = fadd float %23, %24
store float %25, float* %7
%26 = load i32, i32* %9
%27 = add nsw i32 %26, 1
store i32 %27, i32* %9
%28 = load i32, i32* %8
%29 = load float, float* %4
%30 = fpext float %29 to double
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0), i32 %28, double %30)
%32 = load float, float* %3
%33 = load float, float* %6
%34 = fcmp olt float %32, %33
br i1 %34, label %35, label %37
35: ; preds = %17
%36 = load float, float* %3
store float %36, float* %6
br label %37
37: ; preds = %35, %17
%38 = load float, float* %3
%39 = load float, float* %5
%40 = fcmp ogt float %38, %39
br i1 %40, label %41, label %43
41: ; preds = %37
%42 = load float, float* %3
store float %42, float* %5
br label %43
43: ; preds = %41, %37
br label %44
44: ; preds = %43, %12
br label %45
45: ; preds = %44
%46 = load i32, i32* %8
%47 = icmp ne i32 %46, 0
br i1 %47, label %12, label %48
48: ; preds = %45
%49 = load float, float* %7
%50 = load i32, i32* %9
%51 = sitofp i32 %50 to float
%52 = fdiv float %49, %51
store float %52, float* %7
%53 = load float, float* %6
%54 = fcmp une float %53, 1.000000e+08
br i1 %54, label %58, label %55
55: ; preds = %48
%56 = load float, float* %5
%57 = fcmp une float %56, -1.000000e+08
br i1 %57, label %58, label %68
58: ; preds = %55, %48
%59 = load float, float* %5
%60 = fpext float %59 to double
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.6, i64 0, i64 0), double %60)
%62 = load float, float* %6
%63 = fpext float %62 to double
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.7, i64 0, i64 0), double %63)
%65 = load float, float* %7
%66 = fpext float %65 to double
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.8, i64 0, i64 0), double %66)
br label %68
68: ; preds = %58, %55
ret i32 0
}

LLVM IR (-O2):
@.str = [28 x i8] c"Entre com o pre\C3\A7o do kWh: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [50 x i8] c"entre com o N\C3\BAmero do consumidor (0 para sair): \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [58 x i8] c"entre com a quantidade de kWh consumidos durante o m\C3\AAs: \00"
@.str.5 = [39 x i8] c"o consumidor %d tem que pagar %.2f R$\0A\00"
@.str.6 = [40 x i8] c"\0Ao maior consumo verificado: %.2f kWh\0A \00"
@.str.7 = [39 x i8] c"o menor consumo verificado: %.2f kWh\0A \00"
@.str.8 = [36 x i8] c"m\C3\A9dia geral de consumo: %.2f kWh\0A \00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca i32
%4 = bitcast float* %1 to i8*
%5 = bitcast float* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 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* %1)
br label %9
9: ; preds = %18, %0
%10 = phi float [ -1.000000e+08, %0 ], [ %33, %18 ]
%11 = phi float [ 1.000000e+08, %0 ], [ %31, %18 ]
%12 = phi float [ 0.000000e+00, %0 ], [ %24, %18 ]
%13 = phi i32 [ 0, %0 ], [ %25, %18 ]
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %3)
%16 = load i32, i32* %3
%17 = icmp eq i32 %16, 0
br i1 %17, label %36, label %18
18: ; preds = %9
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str.4, i64 0, i64 0))
%20 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%21 = load float, float* %1
%22 = load float, float* %2
%23 = fmul float %21, %22
%24 = fadd float %12, %22
%25 = add nuw nsw i32 %13, 1
%26 = load i32, i32* %3
%27 = fpext float %23 to double
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0), i32 %26, double %27)
%29 = load float, float* %2
%30 = fcmp olt float %29, %11
%31 = select i1 %30, float %29, float %11
%32 = fcmp ogt float %29, %10
%33 = select i1 %32, float %29, float %10
%34 = load i32, i32* %3
%35 = icmp eq i32 %34, 0
br i1 %35, label %36, label %9
36: ; preds = %9, %18
%37 = phi i32 [ %25, %18 ], [ %13, %9 ]
%38 = phi float [ %24, %18 ], [ %12, %9 ]
%39 = phi float [ %31, %18 ], [ %11, %9 ]
%40 = phi float [ %33, %18 ], [ %10, %9 ]
%41 = fcmp une float %39, 1.000000e+08
%42 = fcmp une float %40, -1.000000e+08
%43 = select i1 %41, i1 true, i1 %42
br i1 %43, label %44, label %53
44: ; preds = %36
%45 = sitofp i32 %37 to float
%46 = fdiv float %38, %45
%47 = fpext float %40 to double
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.6, i64 0, i64 0), double %47)
%49 = fpext float %39 to double
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.7, i64 0, i64 0), double %49)
%51 = fpext float %46 to double
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.8, i64 0, i64 0), double %51)
br label %53
53: ; preds = %36, %44
ret i32 0
}