#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 *);
void ex6() {
  int num, c1 = 0, c2 = 0, c3 = 0, c4 = 0, b = 0, n = 0;
  printf("Eleicao:\n");
  printf("\t0 para encerrar a votacao;\n");
  printf("\t1 para o candidato 1;\n");
  printf("\t2 para o candidato 2;\n");
  printf("\t3 para o candidato 3;\n");
  printf("\t4 para o candidato 4;\n");
  printf("\t99 para votar em branco;\n");
  printf("\tQualquer outro valor para votar nulo.\n");
  while (1) {
    printf("Informe o voto:\n");
    scanf("%d", &num);
    if (!num)
      break;
    if (num == 1)
      c1++;
    else if (num == 2)
      c2++;
    else if (num == 3)
      c3++;
    else if (num == 4)
      c4++;
    else if (num == 99)
      b++;
    else
      n++;
  }
  int validos = c1 + c2 + c3 + c4;
  float p1 = (float)c1 / validos * 100;
  float p2 = (float)c2 / validos * 100;
  float p3 = (float)c3 / validos * 100;
  float p4 = (float)c4 / validos * 100;
  printf("\nVotos validos: %d\n", validos);
  printf("Primeiro Candidato:\n\tVotos:%d\n\tPercentual:%.2f%%\n", c1, p1);
  printf("Segundo Candidato:\n\tVotos:%d\n\tPercentual:%.2f%%\n", c2, p2);
  printf("Terceiro Candidato:\n\tVotos:%d\n\tPercentual:%.2f%%\n", c3, p3);
  printf("Quarto Candidato:\n\tVotos:%d\n\tPercentual:%.2f%%\n", c4, p4);
  printf("Votos brancos: %d\n", b);
  printf("Votos nulos: %d\n", n);
  if (p1 > 50)
    printf("\nVencedor: Primeiro Candidato.\n");
  else if (p2 > 50)
    printf("\nVencedor: Segundo Candidato.\n");
  else if (p3 > 50)
    printf("\nVencedor: Terceiro Candidato.\n");
  else if (p4 > 50)
    printf("\nVencedor: Quarto Candidato.\n");
  else
    printf("\nHavera segundo turno.\n");
}


x86 assembly (clang, -O0):
<ex6>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeef(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf09(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf0c(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x4(%rbp)
jne    11ef <ex6+0xcf>
jmp    1289 <ex6+0x169>
cmpl   $0x1,-0x4(%rbp)
jne    1207 <ex6+0xe7>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1284 <ex6+0x164>
cmpl   $0x2,-0x4(%rbp)
jne    121f <ex6+0xff>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    127f <ex6+0x15f>
cmpl   $0x3,-0x4(%rbp)
jne    1237 <ex6+0x117>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    127a <ex6+0x15a>
cmpl   $0x4,-0x4(%rbp)
jne    124f <ex6+0x12f>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1275 <ex6+0x155>
cmpl   $0x63,-0x4(%rbp)
jne    1267 <ex6+0x147>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1270 <ex6+0x150>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1275 <ex6+0x155>
jmp    127a <ex6+0x15a>
jmp    127f <ex6+0x15f>
jmp    1284 <ex6+0x164>
jmp    11c2 <ex6+0xa2>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
cvtsi2ssl -0x8(%rbp),%xmm0
cvtsi2ssl -0x20(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  0xd56(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x24(%rbp)
cvtsi2ssl -0xc(%rbp),%xmm0
cvtsi2ssl -0x20(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  0xd37(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x28(%rbp)
cvtsi2ssl -0x10(%rbp),%xmm0
cvtsi2ssl -0x20(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  0xd18(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x2c(%rbp)
cvtsi2ssl -0x14(%rbp),%xmm0
cvtsi2ssl -0x20(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  0xcf9(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x30(%rbp)
mov    -0x20(%rbp),%esi
lea    0xdc8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdc2(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdda(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
movss  -0x2c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdf1(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
movss  -0x30(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe09(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xe28(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x24(%rbp),%xmm0
movss  0xc44(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    13d8 <ex6+0x2b8>
lea    0xe17(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1470 <ex6+0x350>
movss  -0x28(%rbp),%xmm0
movss  0xc1b(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    1401 <ex6+0x2e1>
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    146b <ex6+0x34b>
movss  -0x2c(%rbp),%xmm0
movss  0xbf2(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    142a <ex6+0x30a>
lea    0xe04(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1466 <ex6+0x346>
movss  -0x30(%rbp),%xmm0
movss  0xbc9(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    1453 <ex6+0x333>
lea    0xdfb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1461 <ex6+0x341>
lea    0xe06(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1466 <ex6+0x346>
jmp    146b <ex6+0x34b>
jmp    1470 <ex6+0x350>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ex6>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
lea    0xfd7(%rip),%rdi
call   1030 <puts@plt>
lea    0xfd4(%rip),%rdi
call   1030 <puts@plt>
lea    0xfe4(%rip),%rdi
call   1030 <puts@plt>
lea    0xfef(%rip),%rdi
call   1030 <puts@plt>
lea    0xffa(%rip),%rdi
call   1030 <puts@plt>
lea    0x1005(%rip),%rdi
call   1030 <puts@plt>
lea    0x1010(%rip),%rdi
call   1030 <puts@plt>
lea    0x101e(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,0x14(%rsp)
lea    0x1031(%rip),%r14
lea    0xe68(%rip),%r15
lea    0x34(%rsp),%r12
movl   $0x0,0xc(%rsp)
xor    %eax,%eax
xor    %ecx,%ecx
mov    %rcx,0x20(%rsp)
xor    %ecx,%ecx
mov    %rcx,0x28(%rsp)
xor    %ebx,%ebx
jmp    11ea <ex6+0xba>
cs nopw 0x0(%rax,%rax,1)
nop
addl   $0x1,0x14(%rsp)
mov    0x18(%rsp),%rax
mov    %rax,0x18(%rsp)
mov    0x20(%rsp),%rcx
lea    (%rcx,%rax,1),%ebp
mov    0x28(%rsp),%rax
lea    (%rax,%rbp,1),%r13d
jmp    1213 <ex6+0xe3>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%ebx
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
mov    0x34(%rsp),%eax
cmp    $0x1,%eax
je     1210 <ex6+0xe0>
cmp    $0x4,%eax
ja     1280 <ex6+0x150>
mov    %eax,%eax
lea    0xdcb(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x28(%rsp),%rax
add    $0x1,%eax
mov    %rax,0x28(%rsp)
add    $0x1,%r13d
jmp    1213 <ex6+0xe3>
nopl   0x0(%rax)
mov    0x20(%rsp),%rax
add    $0x1,%eax
mov    %rax,0x20(%rsp)
add    $0x1,%ebp
jmp    11f7 <ex6+0xc7>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmp    $0x63,%eax
jne    11e0 <ex6+0xb0>
addl   $0x1,0xc(%rsp)
mov    0x18(%rsp),%rax
jmp    11ea <ex6+0xba>
nopl   0x0(%rax,%rax,1)
mov    0x18(%rsp),%rax
add    $0x1,%eax
jmp    11ea <ex6+0xba>
cvtsi2ss %ebx,%xmm2
add    %ebx,%r13d
cvtsi2ss %r13d,%xmm0
divss  %xmm0,%xmm2
movss  0xd3b(%rip),%xmm1
mulss  %xmm1,%xmm2
movss  %xmm2,0x10(%rsp)
mov    0x28(%rsp),%rbp
xorps  %xmm2,%xmm2
cvtsi2ss %ebp,%xmm2
divss  %xmm0,%xmm2
mov    0x20(%rsp),%r15
cvtsi2ss %r15d,%xmm3
mulss  %xmm1,%xmm2
movss  %xmm2,0x8(%rsp)
mov    0x18(%rsp),%r14
xorps  %xmm2,%xmm2
cvtsi2ss %r14d,%xmm2
divss  %xmm0,%xmm3
mulss  %xmm1,%xmm3
movss  %xmm3,0x4(%rsp)
divss  %xmm0,%xmm2
mulss  %xmm1,%xmm2
movss  %xmm2,(%rsp)
lea    0xcfd(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movss  0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xcf6(%rip),%rdi
mov    %ebx,%esi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd0e(%rip),%rdi
mov    %ebp,%esi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd25(%rip),%rdi
mov    %r15d,%esi
mov    $0x1,%al
call   1040 <printf@plt>
movss  (%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd3d(%rip),%rdi
mov    %r14d,%esi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xd5c(%rip),%rdi
mov    0xc(%rsp),%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xd5d(%rip),%rdi
mov    0x14(%rsp),%esi
xor    %eax,%eax
call   1040 <printf@plt>
movss  0x10(%rsp),%xmm0
ucomiss 0xc3e(%rip),%xmm0
jbe    13d1 <ex6+0x2a1>
lea    0xe90(%rip),%rdi
jmp    141f <ex6+0x2ef>
movss  0x8(%rsp),%xmm0
ucomiss 0xc26(%rip),%xmm0
jbe    13e9 <ex6+0x2b9>
lea    0xe5a(%rip),%rdi
jmp    141f <ex6+0x2ef>
movss  0x4(%rsp),%xmm0
ucomiss 0xc0e(%rip),%xmm0
jbe    1401 <ex6+0x2d1>
lea    0xe23(%rip),%rdi
jmp    141f <ex6+0x2ef>
movss  (%rsp),%xmm0
ucomiss 0xbf7(%rip),%xmm0
lea    0xdf1(%rip),%rax
lea    0xdd3(%rip),%rdi
cmova  %rax,%rdi
call   1030 <puts@plt>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"Eleicao:\0A\00"
@.str.1 = [29 x i8] c"\090 para encerrar a votacao;\0A\00"
@.str.2 = [24 x i8] c"\091 para o candidato 1;\0A\00"
@.str.3 = [24 x i8] c"\092 para o candidato 2;\0A\00"
@.str.4 = [24 x i8] c"\093 para o candidato 3;\0A\00"
@.str.5 = [24 x i8] c"\094 para o candidato 4;\0A\00"
@.str.6 = [27 x i8] c"\0999 para votar em branco;\0A\00"
@.str.7 = [40 x i8] c"\09Qualquer outro valor para votar nulo.\0A\00"
@.str.8 = [17 x i8] c"Informe o voto:\0A\00"
@.str.9 = [3 x i8] c"%d\00"
@.str.10 = [20 x i8] c"\0AVotos validos: %d\0A\00"
@.str.11 = [50 x i8] c"Primeiro Candidato:\0A\09Votos:%d\0A\09Percentual:%.2f%%\0A\00"
@.str.12 = [49 x i8] c"Segundo Candidato:\0A\09Votos:%d\0A\09Percentual:%.2f%%\0A\00"
@.str.13 = [50 x i8] c"Terceiro Candidato:\0A\09Votos:%d\0A\09Percentual:%.2f%%\0A\00"
@.str.14 = [48 x i8] c"Quarto Candidato:\0A\09Votos:%d\0A\09Percentual:%.2f%%\0A\00"
@.str.15 = [19 x i8] c"Votos brancos: %d\0A\00"
@.str.16 = [17 x i8] c"Votos nulos: %d\0A\00"
@.str.17 = [32 x i8] c"\0AVencedor: Primeiro Candidato.\0A\00"
@.str.18 = [31 x i8] c"\0AVencedor: Segundo Candidato.\0A\00"
@.str.19 = [32 x i8] c"\0AVencedor: Terceiro Candidato.\0A\00"
@.str.20 = [30 x i8] c"\0AVencedor: Quarto Candidato.\0A\00"
@.str.21 = [24 x i8] c"\0AHavera segundo turno.\0A\00"
define void @ex6() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0))
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.7, i64 0, i64 0))
br label %21
21: ; preds = %0, %64
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0))
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32* %1)
%24 = load i32, i32* %1
%25 = icmp ne i32 %24, 0
br i1 %25, label %27, label %26
26: ; preds = %21
br label %65
27: ; preds = %21
%28 = load i32, i32* %1
%29 = icmp eq i32 %28, 1
br i1 %29, label %30, label %33
30: ; preds = %27
%31 = load i32, i32* %2
%32 = add nsw i32 %31, 1
store i32 %32, i32* %2
br label %64
33: ; preds = %27
%34 = load i32, i32* %1
%35 = icmp eq i32 %34, 2
br i1 %35, label %36, label %39
36: ; preds = %33
%37 = load i32, i32* %3
%38 = add nsw i32 %37, 1
store i32 %38, i32* %3
br label %63
39: ; preds = %33
%40 = load i32, i32* %1
%41 = icmp eq i32 %40, 3
br i1 %41, label %42, label %45
42: ; preds = %39
%43 = load i32, i32* %4
%44 = add nsw i32 %43, 1
store i32 %44, i32* %4
br label %62
45: ; preds = %39
%46 = load i32, i32* %1
%47 = icmp eq i32 %46, 4
br i1 %47, label %48, label %51
48: ; preds = %45
%49 = load i32, i32* %5
%50 = add nsw i32 %49, 1
store i32 %50, i32* %5
br label %61
51: ; preds = %45
%52 = load i32, i32* %1
%53 = icmp eq i32 %52, 99
br i1 %53, label %54, label %57
54: ; preds = %51
%55 = load i32, i32* %6
%56 = add nsw i32 %55, 1
store i32 %56, i32* %6
br label %60
57: ; preds = %51
%58 = load i32, i32* %7
%59 = add nsw i32 %58, 1
store i32 %59, i32* %7
br label %60
60: ; preds = %57, %54
br label %61
61: ; preds = %60, %48
br label %62
62: ; preds = %61, %42
br label %63
63: ; preds = %62, %36
br label %64
64: ; preds = %63, %30
br label %21
65: ; preds = %26
%66 = load i32, i32* %2
%67 = load i32, i32* %3
%68 = add nsw i32 %66, %67
%69 = load i32, i32* %4
%70 = add nsw i32 %68, %69
%71 = load i32, i32* %5
%72 = add nsw i32 %70, %71
store i32 %72, i32* %8
%73 = load i32, i32* %2
%74 = sitofp i32 %73 to float
%75 = load i32, i32* %8
%76 = sitofp i32 %75 to float
%77 = fdiv float %74, %76
%78 = fmul float %77, 1.000000e+02
store float %78, float* %9
%79 = load i32, i32* %3
%80 = sitofp i32 %79 to float
%81 = load i32, i32* %8
%82 = sitofp i32 %81 to float
%83 = fdiv float %80, %82
%84 = fmul float %83, 1.000000e+02
store float %84, float* %10
%85 = load i32, i32* %4
%86 = sitofp i32 %85 to float
%87 = load i32, i32* %8
%88 = sitofp i32 %87 to float
%89 = fdiv float %86, %88
%90 = fmul float %89, 1.000000e+02
store float %90, float* %11
%91 = load i32, i32* %5
%92 = sitofp i32 %91 to float
%93 = load i32, i32* %8
%94 = sitofp i32 %93 to float
%95 = fdiv float %92, %94
%96 = fmul float %95, 1.000000e+02
store float %96, float* %12
%97 = load i32, i32* %8
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0), i32 %97)
%99 = load i32, i32* %2
%100 = load float, float* %9
%101 = fpext float %100 to double
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.11, i64 0, i64 0), i32 %99, double %101)
%103 = load i32, i32* %3
%104 = load float, float* %10
%105 = fpext float %104 to double
%106 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.12, i64 0, i64 0), i32 %103, double %105)
%107 = load i32, i32* %4
%108 = load float, float* %11
%109 = fpext float %108 to double
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.13, i64 0, i64 0), i32 %107, double %109)
%111 = load i32, i32* %5
%112 = load float, float* %12
%113 = fpext float %112 to double
%114 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.14, i64 0, i64 0), i32 %111, double %113)
%115 = load i32, i32* %6
%116 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.15, i64 0, i64 0), i32 %115)
%117 = load i32, i32* %7
%118 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.16, i64 0, i64 0), i32 %117)
%119 = load float, float* %9
%120 = fcmp ogt float %119, 5.000000e+01
br i1 %120, label %121, label %123
121: ; preds = %65
%122 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.17, i64 0, i64 0))
br label %143
123: ; preds = %65
%124 = load float, float* %10
%125 = fcmp ogt float %124, 5.000000e+01
br i1 %125, label %126, label %128
126: ; preds = %123
%127 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.18, i64 0, i64 0))
br label %142
128: ; preds = %123
%129 = load float, float* %11
%130 = fcmp ogt float %129, 5.000000e+01
br i1 %130, label %131, label %133
131: ; preds = %128
%132 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.19, i64 0, i64 0))
br label %141
133: ; preds = %128
%134 = load float, float* %12
%135 = fcmp ogt float %134, 5.000000e+01
br i1 %135, label %136, label %138
136: ; preds = %133
%137 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.20, i64 0, i64 0))
br label %140
138: ; preds = %133
%139 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.21, i64 0, i64 0))
br label %140
140: ; preds = %138, %136
br label %141
141: ; preds = %140, %131
br label %142
142: ; preds = %141, %126
br label %143
143: ; preds = %142, %121
ret void
}

LLVM IR (-O2):
@.str.9 = [3 x i8] c"%d\00"
@.str.10 = [20 x i8] c"\0AVotos validos: %d\0A\00"
@.str.11 = [50 x i8] c"Primeiro Candidato:\0A\09Votos:%d\0A\09Percentual:%.2f%%\0A\00"
@.str.12 = [49 x i8] c"Segundo Candidato:\0A\09Votos:%d\0A\09Percentual:%.2f%%\0A\00"
@.str.13 = [50 x i8] c"Terceiro Candidato:\0A\09Votos:%d\0A\09Percentual:%.2f%%\0A\00"
@.str.14 = [48 x i8] c"Quarto Candidato:\0A\09Votos:%d\0A\09Percentual:%.2f%%\0A\00"
@.str.15 = [19 x i8] c"Votos brancos: %d\0A\00"
@.str.16 = [17 x i8] c"Votos nulos: %d\0A\00"
@str = [9 x i8] c"Eleicao:\00"
@str.22 = [28 x i8] c"\090 para encerrar a votacao;\00"
@str.23 = [23 x i8] c"\091 para o candidato 1;\00"
@str.24 = [23 x i8] c"\092 para o candidato 2;\00"
@str.25 = [23 x i8] c"\093 para o candidato 3;\00"
@str.26 = [23 x i8] c"\094 para o candidato 4;\00"
@str.27 = [26 x i8] c"\0999 para votar em branco;\00"
@str.28 = [39 x i8] c"\09Qualquer outro valor para votar nulo.\00"
@str.29 = [16 x i8] c"Informe o voto:\00"
@str.30 = [23 x i8] c"\0AHavera segundo turno.\00"
@str.31 = [29 x i8] c"\0AVencedor: Quarto Candidato.\00"
@str.32 = [31 x i8] c"\0AVencedor: Terceiro Candidato.\00"
@str.33 = [30 x i8] c"\0AVencedor: Segundo Candidato.\00"
@str.34 = [31 x i8] c"\0AVencedor: Primeiro Candidato.\00"
define void @ex6() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.22, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.23, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.24, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.25, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.26, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.27, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.28, i64 0, i64 0))
br label %11
11: ; preds = %51, %0
%12 = phi i32 [ %52, %51 ], [ 0, %0 ]
%13 = phi i32 [ %19, %51 ], [ 0, %0 ]
%14 = phi i32 [ %25, %51 ], [ 0, %0 ]
%15 = phi i32 [ %30, %51 ], [ 0, %0 ]
%16 = phi i32 [ %34, %51 ], [ 0, %0 ]
%17 = phi i32 [ %37, %51 ], [ 0, %0 ]
br label %18
18: ; preds = %11, %49
%19 = phi i32 [ %13, %11 ], [ %50, %49 ]
%20 = phi i32 [ %14, %11 ], [ %25, %49 ]
%21 = phi i32 [ %15, %11 ], [ %30, %49 ]
%22 = phi i32 [ %16, %11 ], [ %34, %49 ]
%23 = phi i32 [ %17, %11 ], [ %37, %49 ]
br label %24
24: ; preds = %18, %47
%25 = phi i32 [ %20, %18 ], [ %48, %47 ]
%26 = phi i32 [ %21, %18 ], [ %30, %47 ]
%27 = phi i32 [ %22, %18 ], [ %34, %47 ]
%28 = phi i32 [ %23, %18 ], [ %37, %47 ]
br label %29
29: ; preds = %24, %45
%30 = phi i32 [ %26, %24 ], [ %46, %45 ]
%31 = phi i32 [ %27, %24 ], [ %34, %45 ]
%32 = phi i32 [ %28, %24 ], [ %37, %45 ]
br label %33
33: ; preds = %29, %43
%34 = phi i32 [ %31, %29 ], [ %44, %43 ]
%35 = phi i32 [ %32, %29 ], [ %37, %43 ]
br label %36
36: ; preds = %33, %41
%37 = phi i32 [ %42, %41 ], [ %35, %33 ]
%38 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.29, i64 0, i64 0))
%39 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32* %1)
%40 = load i32, i32* %1
switch i32 %40, label %51 [
i32 0, label %53
i32 1, label %41
i32 2, label %43
i32 3, label %45
i32 4, label %47
i32 99, label %49
]
41: ; preds = %36
%42 = add nsw i32 %37, 1
br label %36
43: ; preds = %36
%44 = add nsw i32 %34, 1
br label %33
45: ; preds = %36
%46 = add nsw i32 %30, 1
br label %29
47: ; preds = %36
%48 = add nsw i32 %25, 1
br label %24
49: ; preds = %36
%50 = add nsw i32 %19, 1
br label %18
51: ; preds = %36
%52 = add nuw nsw i32 %12, 1
br label %11
53: ; preds = %36
%54 = add i32 %30, %25
%55 = add i32 %54, %34
%56 = add i32 %55, %37
%57 = sitofp i32 %37 to float
%58 = sitofp i32 %56 to float
%59 = fdiv float %57, %58
%60 = fmul float %59, 1.000000e+02
%61 = sitofp i32 %34 to float
%62 = fdiv float %61, %58
%63 = fmul float %62, 1.000000e+02
%64 = sitofp i32 %30 to float
%65 = fdiv float %64, %58
%66 = fmul float %65, 1.000000e+02
%67 = sitofp i32 %25 to float
%68 = fdiv float %67, %58
%69 = fmul float %68, 1.000000e+02
%70 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0), i32 %56)
%71 = fpext float %60 to double
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.11, i64 0, i64 0), i32 %37, double %71)
%73 = fpext float %63 to double
%74 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.12, i64 0, i64 0), i32 %34, double %73)
%75 = fpext float %66 to double
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.13, i64 0, i64 0), i32 %30, double %75)
%77 = fpext float %69 to double
%78 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.14, i64 0, i64 0), i32 %25, double %77)
%79 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.15, i64 0, i64 0), i32 %19)
%80 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.16, i64 0, i64 0), i32 %12)
%81 = fcmp ogt float %60, 5.000000e+01
br i1 %81, label %89, label %82
82: ; preds = %53
%83 = fcmp ogt float %63, 5.000000e+01
br i1 %83, label %89, label %84
84: ; preds = %82
%85 = fcmp ogt float %66, 5.000000e+01
br i1 %85, label %89, label %86
86: ; preds = %84
%87 = fcmp ogt float %69, 5.000000e+01
%88 = select i1 %87, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @str.31, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @str.30, i64 0, i64 0)
br label %89
89: ; preds = %86, %84, %82, %53
%90 = phi i8* [ getelementptr inbounds ([31 x i8], [31 x i8]* @str.34, i64 0, i64 0), %53 ], [ getelementptr inbounds ([30 x i8], [30 x i8]* @str.33, i64 0, i64 0), %82 ], [ getelementptr inbounds ([31 x i8], [31 x i8]* @str.32, i64 0, i64 0), %84 ], [ %88, %86 ]
%91 = call i32 @puts(i8* dereferenceable(1) %90)
ret void
}