#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ stdin;
int main() {
  struct pessoas {
    int codTC;
    int num;
    float kwh;
  };
  struct pessoas consumidor[16];
  float total, totalT, consumo1, consumo2;
  int i = 0;
  printf("\nExercício desenvolvido considerando a tarifa do CIP - Contribuição "
         "Municipal\n");
  do {
    printf("\nTipo de consumidor, digite:\n1 - Residencial\n2 - Comercial\n3 - "
           "Industrial: ");
    scanf("%i", &consumidor[i].codTC);
    fflush(stdin);
    if (consumidor[i].codTC == 1) {
      printf("\nResidencial");
      printf("\n\nDigite o numero do consumidor: ");
      scanf("%i", &consumidor[i].num);
      printf("\nDigite a quantidade de kWh consumidos durante o mes: ");
      scanf("%f", &consumidor[i].kwh);
      total = consumidor[i].kwh * 0.3;
      totalT = total + 5.17;
      consumo1 = consumidor[i].kwh;
    } else if (consumidor[i].codTC == 2) {
      printf("\nComercial");
      printf("\n\nDigite o numero do consumidor: ");
      scanf("%i", &consumidor[i].num);
      printf("\nDigite a quantidade de kWh consumidos durante o mes: ");
      scanf("%f", &consumidor[i].kwh);
      total = consumidor[i].kwh * 0.5;
      totalT = total + 5.17;
      consumo2 = consumidor[i].kwh;
    } else if (consumidor[i].codTC == 3) {
      printf("\nIndustrial");
      printf("\n\nDigite o numero do consumidor: ");
      scanf("%i", &consumidor[i].num);
      printf("\nDigite a quantidade de kWh consumidos durante o mes: ");
      scanf("%f", &consumidor[i].kwh);
      total = consumidor[i].kwh * 0.7;
      totalT = total + 5.17;
    }
    float media = consumo1 + consumo2 / 2;
    printf("\nO total de consumo e %.2f\n", total);
    printf("\nO custo total e %.2f\n", totalT);
    printf("\nA media de consumo dos consumidores 1 e 2 e %.2f\n", media);
    i++;
  } while (consumidor[i - 1].num != 0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xe4(%rbp)
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf15(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0xe4(%rbp),%rax
lea    -0xd0(%rbp),%rsi
imul   $0xc,%rax,%rax
add    %rax,%rsi
lea    0xf3e(%rip),%rdi
call   1050 <scanf@plt>
mov    0x2e58(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
movslq -0xe4(%rbp),%rcx
lea    -0xd0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
cmpl   $0x1,(%rax)
jne    12aa <main+0x17a>
lea    0xf09(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf08(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0xe4(%rbp),%rax
lea    -0xd0(%rbp),%rsi
imul   $0xc,%rax,%rax
add    %rax,%rsi
add    $0x4,%rsi
lea    0xed1(%rip),%rdi
call   1050 <scanf@plt>
lea    0xef7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0xe4(%rbp),%rax
lea    -0xd0(%rbp),%rsi
imul   $0xc,%rax,%rax
add    %rax,%rsi
add    $0x8,%rsi
lea    0xf07(%rip),%rdi
call   1050 <scanf@plt>
movslq -0xe4(%rbp),%rcx
lea    -0xd0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movss  0x8(%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdc9(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xd4(%rbp)
ff
movss  -0xd4(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movsd  0xd8d(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xd8(%rbp)
ff
movslq -0xe4(%rbp),%rcx
lea    -0xd0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movss  0x8(%rax),%xmm0
movss  %xmm0,-0xdc(%rbp)
ff
jmp    14b3 <main+0x383>
movslq -0xe4(%rbp),%rcx
lea    -0xd0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
cmpl   $0x2,(%rax)
jne    13bd <main+0x28d>
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdf5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0xe4(%rbp),%rax
lea    -0xd0(%rbp),%rsi
imul   $0xc,%rax,%rax
add    %rax,%rsi
add    $0x4,%rsi
lea    0xdbe(%rip),%rdi
call   1050 <scanf@plt>
lea    0xde4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0xe4(%rbp),%rax
lea    -0xd0(%rbp),%rsi
imul   $0xc,%rax,%rax
add    %rax,%rsi
add    $0x8,%rsi
lea    0xdf4(%rip),%rdi
call   1050 <scanf@plt>
movslq -0xe4(%rbp),%rcx
lea    -0xd0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movss  0x8(%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xcae(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xd4(%rbp)
ff
movss  -0xd4(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movsd  0xc7a(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xd8(%rbp)
ff
movslq -0xe4(%rbp),%rcx
lea    -0xd0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movss  0x8(%rax),%xmm0
movss  %xmm0,-0xe0(%rbp)
ff
jmp    14ae <main+0x37e>
movslq -0xe4(%rbp),%rcx
lea    -0xd0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
cmpl   $0x3,(%rax)
jne    14a9 <main+0x379>
lea    0xd57(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xce2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0xe4(%rbp),%rax
lea    -0xd0(%rbp),%rsi
imul   $0xc,%rax,%rax
add    %rax,%rsi
add    $0x4,%rsi
lea    0xcab(%rip),%rdi
call   1050 <scanf@plt>
lea    0xcd1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0xe4(%rbp),%rax
lea    -0xd0(%rbp),%rsi
imul   $0xc,%rax,%rax
add    %rax,%rsi
add    $0x8,%rsi
lea    0xce1(%rip),%rdi
call   1050 <scanf@plt>
movslq -0xe4(%rbp),%rcx
lea    -0xd0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movss  0x8(%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xb93(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xd4(%rbp)
ff
movss  -0xd4(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movsd  0xb67(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xd8(%rbp)
ff
jmp    14ae <main+0x37e>
jmp    14b3 <main+0x383>
movss  -0xdc(%rbp),%xmm0
ff
movss  -0xe0(%rbp),%xmm1
ff
movss  0xb55(%rip),%xmm2
divss  %xmm2,%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0xe8(%rbp)
ff
movss  -0xd4(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
lea    0xc57(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0xd8(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
lea    0xc59(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0xe8(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
lea    0xc56(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0xe4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe4(%rbp)
mov    -0xe4(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rcx
lea    -0xd0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
cmpl   $0x0,0x4(%rax)
jne    115a <main+0x2a>
mov    -0x4(%rbp),%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xe8,%rsp
lea    0xff9(%rip),%rdi
call   1030 <puts@plt>
lea    0x28(%rsp),%rbx
lea    0xeff(%rip),%r15
mov    0x2e78(%rip),%r14
lea    0xf74(%rip),%r13
lea    0xf89(%rip),%rbp
lea    0xf99(%rip),%r12
jmp    1262 <main+0x122>
nopw   0x0(%rax,%rax,1)
lea    0xf48(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    -0x4(%rbx),%rsi
mov    %r15,%rdi
call   1060 <scanf@plt>
lea    0xedb(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf04(%rip),%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
movss  (%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xe1b(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0xc(%rsp)
cvtss2sd %xmm0,%xmm0
movaps %xmm0,%xmm1
addsd  0xe0a(%rip),%xmm1
cvtsd2ss %xmm1,%xmm1
movss  %xmm1,0x10(%rsp)
movss  0x18(%rsp),%xmm1
mulss  0xe02(%rip),%xmm1
addss  0x14(%rsp),%xmm1
movss  %xmm1,0x1c(%rsp)
mov    %r13,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbp,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x1c(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
cmpl   $0x0,-0x4(%rbx)
lea    0xc(%rbx),%rbx
je     1370 <main+0x230>
lea    0xdb3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    -0x8(%rbx),%rsi
mov    %r15,%rdi
call   1060 <scanf@plt>
mov    (%r14),%edi
call   1050 <fflush@plt>
mov    -0x8(%rbx),%eax
cmp    $0x1,%eax
je     1310 <main+0x1d0>
cmp    $0x2,%eax
je     12b0 <main+0x170>
cmp    $0x3,%eax
je     1190 <main+0x50>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
jmp    1208 <main+0xc8>
nopl   (%rax)
lea    0xe1d(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdb3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    -0x4(%rbx),%rsi
mov    %r15,%rdi
call   1060 <scanf@plt>
lea    0xdbb(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xde4(%rip),%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
movss  (%rbx),%xmm0
movss  %xmm0,0x18(%rsp)
mulss  0xd11(%rip),%xmm0
jmp    11e9 <main+0xa9>
nopl   0x0(%rax)
lea    0xd54(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xd53(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    -0x4(%rbx),%rsi
mov    %r15,%rdi
call   1060 <scanf@plt>
lea    0xd5b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xd84(%rip),%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
movss  (%rbx),%xmm0
movss  %xmm0,0x14(%rsp)
cvtss2sd %xmm0,%xmm0
mulsd  0xca5(%rip),%xmm0
jmp    11e5 <main+0xa5>
xor    %eax,%eax
add    $0xe8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.pessoas = type { i32, i32, float }
@.str = [82 x i8] c"\0AExerc\C3\ADcio desenvolvido considerando a tarifa do CIP - Contribui\C3\A7\C3\A3o Municipal\0A\00"
@.str.1 = [76 x i8] c"\0ATipo de consumidor, digite:\0A1 - Residencial\0A2 - Comercial\0A3 - Industrial: \00"
@.str.2 = [3 x i8] c"%i\00"
@stdin = global i32 0
@.str.3 = [13 x i8] c"\0AResidencial\00"
@.str.4 = [34 x i8] c"\0A\0ADigite o numero do consumidor: \00"
@.str.5 = [55 x i8] c"\0ADigite a quantidade de kWh consumidos durante o mes: \00"
@.str.6 = [3 x i8] c"%f\00"
@.str.7 = [11 x i8] c"\0AComercial\00"
@.str.8 = [12 x i8] c"\0AIndustrial\00"
@.str.9 = [28 x i8] c"\0AO total de consumo e %.2f\0A\00"
@.str.10 = [23 x i8] c"\0AO custo total e %.2f\0A\00"
@.str.11 = [51 x i8] c"\0AA media de consumo dos consumidores 1 e 2 e %.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [16 x %struct.pessoas]
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca i32
%8 = alloca float
store i32 0, i32* %1
store i32 0, i32* %7
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %148, %0
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.1, i64 0, i64 0))
%12 = load i32, i32* %7
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [16 x %struct.pessoas], [16 x %struct.pessoas]* %2, i64 0, i64 %13
%15 = getelementptr inbounds %struct.pessoas, %struct.pessoas* %14, i32 0, i32 0
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %15)
%17 = load i32, i32* @stdin
%18 = call i32 @fflush(i32 %17)
%19 = load i32, i32* %7
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [16 x %struct.pessoas], [16 x %struct.pessoas]* %2, i64 0, i64 %20
%22 = getelementptr inbounds %struct.pessoas, %struct.pessoas* %21, i32 0, i32 0
%23 = load i32, i32* %22
%24 = icmp eq i32 %23, 1
br i1 %24, label %25, label %57
25: ; preds = %10
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0))
%28 = load i32, i32* %7
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [16 x %struct.pessoas], [16 x %struct.pessoas]* %2, i64 0, i64 %29
%31 = getelementptr inbounds %struct.pessoas, %struct.pessoas* %30, i32 0, i32 1
%32 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %31)
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.5, i64 0, i64 0))
%34 = load i32, i32* %7
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [16 x %struct.pessoas], [16 x %struct.pessoas]* %2, i64 0, i64 %35
%37 = getelementptr inbounds %struct.pessoas, %struct.pessoas* %36, i32 0, i32 2
%38 = bitcast float* %37 to i32*
%39 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %38)
%40 = load i32, i32* %7
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [16 x %struct.pessoas], [16 x %struct.pessoas]* %2, i64 0, i64 %41
%43 = getelementptr inbounds %struct.pessoas, %struct.pessoas* %42, i32 0, i32 2
%44 = load float, float* %43
%45 = fpext float %44 to double
%46 = fmul double %45, 3.000000e-01
%47 = fptrunc double %46 to float
store float %47, float* %3
%48 = load float, float* %3
%49 = fpext float %48 to double
%50 = fadd double %49, 5.170000e+00
%51 = fptrunc double %50 to float
store float %51, float* %4
%52 = load i32, i32* %7
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [16 x %struct.pessoas], [16 x %struct.pessoas]* %2, i64 0, i64 %53
%55 = getelementptr inbounds %struct.pessoas, %struct.pessoas* %54, i32 0, i32 2
%56 = load float, float* %55
store float %56, float* %5
br label %132
57: ; preds = %10
%58 = load i32, i32* %7
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [16 x %struct.pessoas], [16 x %struct.pessoas]* %2, i64 0, i64 %59
%61 = getelementptr inbounds %struct.pessoas, %struct.pessoas* %60, i32 0, i32 0
%62 = load i32, i32* %61
%63 = icmp eq i32 %62, 2
br i1 %63, label %64, label %96
64: ; preds = %57
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0))
%67 = load i32, i32* %7
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [16 x %struct.pessoas], [16 x %struct.pessoas]* %2, i64 0, i64 %68
%70 = getelementptr inbounds %struct.pessoas, %struct.pessoas* %69, i32 0, i32 1
%71 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %70)
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.5, i64 0, i64 0))
%73 = load i32, i32* %7
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds [16 x %struct.pessoas], [16 x %struct.pessoas]* %2, i64 0, i64 %74
%76 = getelementptr inbounds %struct.pessoas, %struct.pessoas* %75, i32 0, i32 2
%77 = bitcast float* %76 to i32*
%78 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %77)
%79 = load i32, i32* %7
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds [16 x %struct.pessoas], [16 x %struct.pessoas]* %2, i64 0, i64 %80
%82 = getelementptr inbounds %struct.pessoas, %struct.pessoas* %81, i32 0, i32 2
%83 = load float, float* %82
%84 = fpext float %83 to double
%85 = fmul double %84, 5.000000e-01
%86 = fptrunc double %85 to float
store float %86, float* %3
%87 = load float, float* %3
%88 = fpext float %87 to double
%89 = fadd double %88, 5.170000e+00
%90 = fptrunc double %89 to float
store float %90, float* %4
%91 = load i32, i32* %7
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds [16 x %struct.pessoas], [16 x %struct.pessoas]* %2, i64 0, i64 %92
%94 = getelementptr inbounds %struct.pessoas, %struct.pessoas* %93, i32 0, i32 2
%95 = load float, float* %94
store float %95, float* %6
br label %131
96: ; preds = %57
%97 = load i32, i32* %7
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds [16 x %struct.pessoas], [16 x %struct.pessoas]* %2, i64 0, i64 %98
%100 = getelementptr inbounds %struct.pessoas, %struct.pessoas* %99, i32 0, i32 0
%101 = load i32, i32* %100
%102 = icmp eq i32 %101, 3
br i1 %102, label %103, label %130
103: ; preds = %96
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0))
%105 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0))
%106 = load i32, i32* %7
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds [16 x %struct.pessoas], [16 x %struct.pessoas]* %2, i64 0, i64 %107
%109 = getelementptr inbounds %struct.pessoas, %struct.pessoas* %108, i32 0, i32 1
%110 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %109)
%111 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.5, i64 0, i64 0))
%112 = load i32, i32* %7
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds [16 x %struct.pessoas], [16 x %struct.pessoas]* %2, i64 0, i64 %113
%115 = getelementptr inbounds %struct.pessoas, %struct.pessoas* %114, i32 0, i32 2
%116 = bitcast float* %115 to i32*
%117 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %116)
%118 = load i32, i32* %7
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds [16 x %struct.pessoas], [16 x %struct.pessoas]* %2, i64 0, i64 %119
%121 = getelementptr inbounds %struct.pessoas, %struct.pessoas* %120, i32 0, i32 2
%122 = load float, float* %121
%123 = fpext float %122 to double
%124 = fmul double %123, 0x3FE6666666666666
%125 = fptrunc double %124 to float
store float %125, float* %3
%126 = load float, float* %3
%127 = fpext float %126 to double
%128 = fadd double %127, 5.170000e+00
%129 = fptrunc double %128 to float
store float %129, float* %4
br label %130
130: ; preds = %103, %96
br label %131
131: ; preds = %130, %64
br label %132
132: ; preds = %131, %25
%133 = load float, float* %5
%134 = load float, float* %6
%135 = fdiv float %134, 2.000000e+00
%136 = fadd float %133, %135
store float %136, float* %8
%137 = load float, float* %3
%138 = fpext float %137 to double
%139 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0), double %138)
%140 = load float, float* %4
%141 = fpext float %140 to double
%142 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.10, i64 0, i64 0), double %141)
%143 = load float, float* %8
%144 = fpext float %143 to double
%145 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.11, i64 0, i64 0), double %144)
%146 = load i32, i32* %7
%147 = add nsw i32 %146, 1
store i32 %147, i32* %7
br label %148
148: ; preds = %132
%149 = load i32, i32* %7
%150 = sub nsw i32 %149, 1
%151 = sext i32 %150 to i64
%152 = getelementptr inbounds [16 x %struct.pessoas], [16 x %struct.pessoas]* %2, i64 0, i64 %151
%153 = getelementptr inbounds %struct.pessoas, %struct.pessoas* %152, i32 0, i32 1
%154 = load i32, i32* %153
%155 = icmp ne i32 %154, 0
br i1 %155, label %10, label %156
156: ; preds = %148
%157 = load i32, i32* %1
ret i32 %157
}

LLVM IR (-O2):
%struct.pessoas = type { i32, i32, float }
@.str.1 = [76 x i8] c"\0ATipo de consumidor, digite:\0A1 - Residencial\0A2 - Comercial\0A3 - Industrial: \00"
@.str.2 = [3 x i8] c"%i\00"
@stdin = global i32 0
@.str.3 = [13 x i8] c"\0AResidencial\00"
@.str.4 = [34 x i8] c"\0A\0ADigite o numero do consumidor: \00"
@.str.5 = [55 x i8] c"\0ADigite a quantidade de kWh consumidos durante o mes: \00"
@.str.6 = [3 x i8] c"%f\00"
@.str.7 = [11 x i8] c"\0AComercial\00"
@.str.8 = [12 x i8] c"\0AIndustrial\00"
@.str.9 = [28 x i8] c"\0AO total de consumo e %.2f\0A\00"
@.str.10 = [23 x i8] c"\0AO custo total e %.2f\0A\00"
@.str.11 = [51 x i8] c"\0AA media de consumo dos consumidores 1 e 2 e %.2f\0A\00"
@str = [81 x i8] c"\0AExerc\C3\ADcio desenvolvido considerando a tarifa do CIP - Contribui\C3\A7\C3\A3o Municipal\00"
define i32 @main() {
%1 = alloca [16 x %struct.pessoas]
%2 = bitcast [16 x %struct.pessoas]* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([81 x i8], [81 x i8]* @str, i64 0, i64 0))
br label %4
4: ; preds = %64, %0
%5 = phi i64 [ %77, %64 ], [ 0, %0 ]
%6 = phi float [ %66, %64 ], [ undef, %0 ]
%7 = phi float [ %67, %64 ], [ undef, %0 ]
%8 = phi float [ %68, %64 ], [ undef, %0 ]
%9 = phi float [ %69, %64 ], [ undef, %0 ]
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([76 x i8], [76 x i8]* @.str.1, i64 0, i64 0))
%11 = getelementptr inbounds [16 x %struct.pessoas], [16 x %struct.pessoas]* %1, i64 0, i64 %5, i32 0
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %11)
%13 = load i32, i32* @stdin
%14 = call i32 @fflush(i32 %13)
%15 = load i32, i32* %11
switch i32 %15, label %16 [
i32 1, label %18
i32 2, label %34
i32 3, label %48
]
16: ; preds = %4
%17 = fpext float %9 to double
br label %64
18: ; preds = %4
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0))
%21 = getelementptr inbounds [16 x %struct.pessoas], [16 x %struct.pessoas]* %1, i64 0, i64 %5, i32 1
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %21)
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.5, i64 0, i64 0))
%24 = getelementptr inbounds [16 x %struct.pessoas], [16 x %struct.pessoas]* %1, i64 0, i64 %5, i32 2
%25 = bitcast float* %24 to i32*
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %25)
%27 = load float, float* %24
%28 = fpext float %27 to double
%29 = fmul double %28, 3.000000e-01
%30 = fptrunc double %29 to float
%31 = fpext float %30 to double
%32 = fadd double %31, 5.170000e+00
%33 = fptrunc double %32 to float
br label %64
34: ; preds = %4
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0))
%37 = getelementptr inbounds [16 x %struct.pessoas], [16 x %struct.pessoas]* %1, i64 0, i64 %5, i32 1
%38 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %37)
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.5, i64 0, i64 0))
%40 = getelementptr inbounds [16 x %struct.pessoas], [16 x %struct.pessoas]* %1, i64 0, i64 %5, i32 2
%41 = bitcast float* %40 to i32*
%42 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %41)
%43 = load float, float* %40
%44 = fmul float %43, 5.000000e-01
%45 = fpext float %44 to double
%46 = fadd double %45, 5.170000e+00
%47 = fptrunc double %46 to float
br label %64
48: ; preds = %4
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0))
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0))
%51 = getelementptr inbounds [16 x %struct.pessoas], [16 x %struct.pessoas]* %1, i64 0, i64 %5, i32 1
%52 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %51)
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.5, i64 0, i64 0))
%54 = getelementptr inbounds [16 x %struct.pessoas], [16 x %struct.pessoas]* %1, i64 0, i64 %5, i32 2
%55 = bitcast float* %54 to i32*
%56 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %55)
%57 = load float, float* %54
%58 = fpext float %57 to double
%59 = fmul double %58, 0x3FE6666666666666
%60 = fptrunc double %59 to float
%61 = fpext float %60 to double
%62 = fadd double %61, 5.170000e+00
%63 = fptrunc double %62 to float
br label %64
64: ; preds = %16, %34, %48, %18
%65 = phi double [ %17, %16 ], [ %45, %34 ], [ %61, %48 ], [ %31, %18 ]
%66 = phi float [ %6, %16 ], [ %47, %34 ], [ %63, %48 ], [ %33, %18 ]
%67 = phi float [ %7, %16 ], [ %7, %34 ], [ %7, %48 ], [ %27, %18 ]
%68 = phi float [ %8, %16 ], [ %43, %34 ], [ %8, %48 ], [ %8, %18 ]
%69 = phi float [ %9, %16 ], [ %44, %34 ], [ %60, %48 ], [ %30, %18 ]
%70 = fmul float %68, 5.000000e-01
%71 = fadd float %67, %70
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0), double %65)
%73 = fpext float %66 to double
%74 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.10, i64 0, i64 0), double %73)
%75 = fpext float %71 to double
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.11, i64 0, i64 0), double %75)
%77 = add nuw i64 %5, 1
%78 = getelementptr inbounds [16 x %struct.pessoas], [16 x %struct.pessoas]* %1, i64 0, i64 %5, i32 1
%79 = load i32, i32* %78
%80 = icmp eq i32 %79, 0
br i1 %80, label %81, label %4
81: ; preds = %64
ret i32 0
}