#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() {
  int voto = 0;
  float cand1 = 0, cand2 = 0, percent1 = 0, percent2 = 0, cont = 0;
  char continuar;
  do {
    printf("Para votar no Candidato1, digite 1 ou para votar no Candidato2, "
           "digite 2:\n");
    scanf("%d", &voto);
    if (voto == 1) {
      cand1 = cand1 + 1;
    } else if (voto == 2) {
      cand2 = cand2 + 1;
    } else {
      while (voto > 2 || voto < 1) {
        printf("\nVc digitou um numero errado, favor repetir.\nPara votar no "
               "Candidato1, digite 1 ou para votar no Candidato2, digite 2:\n");
        scanf("%d", &voto);
        if (voto == 1) {
          cand1 = cand1 + 1;
        } else if (voto == 2) {
          cand2 = cand2 + 1;
        }
      }
    }
    cont = cont + 1;
    printf("\nDeseja continuar:(s/n)?\n");
    scanf(" %c", &continuar);
  } while (continuar == 's');
  percent1 = (100 * (cand1 / cont));
  percent2 = (100 * (cand2 / cont));
  printf("\nTotal de Votos do Candidato1 = %.0f, com %.0f%% dos Votos.\n",
         cand1, percent1);
  printf("\nTotal de Votos do Candidato2 = %.0f, com %.0f%% dos Votos.\n",
         cand2, percent2);
  printf("\nTotal de Votantes: %.0f.\n", cont);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe95(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x1,-0x8(%rbp)
jne    119f <main+0x7f>
movss  0xe70(%rip),%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    125f <main+0x13f>
cmpl   $0x2,-0x8(%rbp)
jne    11c0 <main+0xa0>
movss  0xe4f(%rip),%xmm0
addss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    125a <main+0x13a>
jmp    11c5 <main+0xa5>
mov    $0x1,%al
cmpl   $0x2,-0x8(%rbp)
mov    %al,-0x1e(%rbp)
jg     11de <main+0xbe>
cmpl   $0x1,-0x8(%rbp)
setl   %al
mov    %al,-0x1e(%rbp)
mov    -0x1e(%rbp),%al
test   $0x1,%al
jne    11ee <main+0xce>
jmp    1255 <main+0x135>
lea    0xe16(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe05(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x1,-0x8(%rbp)
jne    122f <main+0x10f>
movss  0xde0(%rip),%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1250 <main+0x130>
cmpl   $0x2,-0x8(%rbp)
jne    124b <main+0x12b>
movss  0xdbf(%rip),%xmm0
addss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    1250 <main+0x130>
jmp    11c5 <main+0xa5>
jmp    125a <main+0x13a>
jmp    125f <main+0x13f>
movss  0xd99(%rip),%xmm0
addss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
lea    0xe0b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe17(%rip),%rdi
lea    -0x1d(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movsbl -0x1d(%rbp),%eax
cmp    $0x73,%eax
je     115e <main+0x3e>
movss  -0xc(%rbp),%xmm1
divss  -0x1c(%rbp),%xmm1
movss  0xd54(%rip),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x10(%rbp),%xmm1
divss  -0x1c(%rbp),%xmm1
movss  0xd39(%rip),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x14(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xdb4(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x18(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xdd1(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdf7(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
movl   $0x0,0x14(%rsp)
xorps  %xmm0,%xmm0
movss  %xmm0,0x4(%rsp)
lea    0xeb2(%rip),%r15
lea    0x14(%rsp),%rbx
lea    0xf42(%rip),%r12
lea    0xea2(%rip),%r13
lea    0xf(%rsp),%rbp
lea    0xf48(%rip),%r14
xorps  %xmm0,%xmm0
movss  %xmm0,0x10(%rsp)
xorps  %xmm0,%xmm0
movss  %xmm0,0x8(%rsp)
jmp    11d4 <main+0xa4>
nopl   0x0(%rax)
movss  0x4(%rsp),%xmm0
movss  0xe62(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,0x4(%rsp)
movss  0x8(%rsp),%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,0x8(%rsp)
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmpb   $0x73,0xf(%rsp)
jne    1248 <main+0x118>
lea    0xf0f(%rip),%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x14(%rsp),%eax
cmp    $0x1,%eax
je     1190 <main+0x60>
cmp    $0x2,%eax
jne    1220 <main+0xf0>
movss  0x10(%rsp),%xmm0
movss  0xdf7(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,0x10(%rsp)
jmp    11a8 <main+0x78>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x14(%rsp),%eax
cmp    $0x2,%eax
je     11fb <main+0xcb>
cmp    $0x1,%eax
jne    1220 <main+0xf0>
jmp    1190 <main+0x60>
movss  0x4(%rsp),%xmm2
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
movss  0x8(%rsp),%xmm3
divss  %xmm3,%xmm2
movss  0xd9d(%rip),%xmm1
mulss  %xmm1,%xmm2
movss  0x10(%rsp),%xmm4
divss  %xmm3,%xmm4
mulss  %xmm1,%xmm4
movss  %xmm4,0x4(%rsp)
xorps  %xmm1,%xmm1
cvtss2sd %xmm2,%xmm1
lea    0xd82(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movss  0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x4(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xd9d(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdc2(%rip),%rdi
mov    $0x1,%al
call   1040 <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 = [75 x i8] c"Para votar no Candidato1, digite 1 ou para votar no Candidato2, digite 2:\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [120 x i8] c"\0AVc digitou um numero errado, favor repetir.\0APara votar no Candidato1, digite 1 ou para votar no Candidato2, digite 2:\0A\00"
@.str.3 = [26 x i8] c"\0ADeseja continuar:(s/n)?\0A\00"
@.str.4 = [4 x i8] c" %c\00"
@.str.5 = [61 x i8] c"\0ATotal de Votos do Candidato1 = %.0f, com %.0f%% dos Votos.\0A\00"
@.str.6 = [61 x i8] c"\0ATotal de Votos do Candidato2 = %.0f, com %.0f%% dos Votos.\0A\00"
@.str.7 = [27 x i8] c"\0ATotal de Votantes: %.0f.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca i8
store i32 0, i32* %1
store i32 0, i32* %2
store float 0.000000e+00, float* %3
store float 0.000000e+00, float* %4
store float 0.000000e+00, float* %5
store float 0.000000e+00, float* %6
store float 0.000000e+00, float* %7
br label %9
9: ; preds = %55, %0
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([75 x i8], [75 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), i32* %2)
%12 = load i32, i32* %2
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %17
14: ; preds = %9
%15 = load float, float* %3
%16 = fadd float %15, 1.000000e+00
store float %16, float* %3
br label %50
17: ; preds = %9
%18 = load i32, i32* %2
%19 = icmp eq i32 %18, 2
br i1 %19, label %20, label %23
20: ; preds = %17
%21 = load float, float* %4
%22 = fadd float %21, 1.000000e+00
store float %22, float* %4
br label %49
23: ; preds = %17
br label %24
24: ; preds = %47, %23
%25 = load i32, i32* %2
%26 = icmp sgt i32 %25, 2
br i1 %26, label %30, label %27
27: ; preds = %24
%28 = load i32, i32* %2
%29 = icmp slt i32 %28, 1
br label %30
30: ; preds = %27, %24
%31 = phi i1 [ true, %24 ], [ %29, %27 ]
br i1 %31, label %32, label %48
32: ; preds = %30
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([120 x i8], [120 x i8]* @.str.2, i64 0, i64 0))
%34 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%35 = load i32, i32* %2
%36 = icmp eq i32 %35, 1
br i1 %36, label %37, label %40
37: ; preds = %32
%38 = load float, float* %3
%39 = fadd float %38, 1.000000e+00
store float %39, float* %3
br label %47
40: ; preds = %32
%41 = load i32, i32* %2
%42 = icmp eq i32 %41, 2
br i1 %42, label %43, label %46
43: ; preds = %40
%44 = load float, float* %4
%45 = fadd float %44, 1.000000e+00
store float %45, float* %4
br label %46
46: ; preds = %43, %40
br label %47
47: ; preds = %46, %37
br label %24
48: ; preds = %30
br label %49
49: ; preds = %48, %20
br label %50
50: ; preds = %49, %14
%51 = load float, float* %7
%52 = fadd float %51, 1.000000e+00
store float %52, float* %7
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%54 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %8)
br label %55
55: ; preds = %50
%56 = load i8, i8* %8
%57 = sext i8 %56 to i32
%58 = icmp eq i32 %57, 115
br i1 %58, label %9, label %59
59: ; preds = %55
%60 = load float, float* %3
%61 = load float, float* %7
%62 = fdiv float %60, %61
%63 = fmul float 1.000000e+02, %62
store float %63, float* %5
%64 = load float, float* %4
%65 = load float, float* %7
%66 = fdiv float %64, %65
%67 = fmul float 1.000000e+02, %66
store float %67, float* %6
%68 = load float, float* %3
%69 = fpext float %68 to double
%70 = load float, float* %5
%71 = fpext float %70 to double
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.5, i64 0, i64 0), double %69, double %71)
%73 = load float, float* %4
%74 = fpext float %73 to double
%75 = load float, float* %6
%76 = fpext float %75 to double
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.6, i64 0, i64 0), double %74, double %76)
%78 = load float, float* %7
%79 = fpext float %78 to double
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), double %79)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.4 = [4 x i8] c" %c\00"
@.str.5 = [61 x i8] c"\0ATotal de Votos do Candidato1 = %.0f, com %.0f%% dos Votos.\0A\00"
@.str.6 = [61 x i8] c"\0ATotal de Votos do Candidato2 = %.0f, com %.0f%% dos Votos.\0A\00"
@.str.7 = [27 x i8] c"\0ATotal de Votantes: %.0f.\0A\00"
@str = [74 x i8] c"Para votar no Candidato1, digite 1 ou para votar no Candidato2, digite 2:\00"
@str.8 = [25 x i8] c"\0ADeseja continuar:(s/n)?\00"
@str.9 = [119 x i8] c"\0AVc digitou um numero errado, favor repetir.\0APara votar no Candidato1, digite 1 ou para votar no Candidato2, digite 2:\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = bitcast i32* %1 to i8*
store i32 0, i32* %1
br label %4
4: ; preds = %23, %0
%5 = phi float [ 0.000000e+00, %0 ], [ %24, %23 ]
%6 = phi float [ 0.000000e+00, %0 ], [ %25, %23 ]
%7 = phi float [ 0.000000e+00, %0 ], [ %26, %23 ]
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([74 x i8], [74 x i8]* @str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%10 = load i32, i32* %1
switch i32 %10, label %15 [
i32 1, label %11
i32 2, label %13
]
11: ; preds = %4
%12 = fadd float %5, 1.000000e+00
br label %23
13: ; preds = %4
%14 = fadd float %6, 1.000000e+00
br label %23
15: ; preds = %4, %15
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([119 x i8], [119 x i8]* @str.9, i64 0, i64 0))
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%18 = load i32, i32* %1
switch i32 %18, label %15 [
i32 1, label %19
i32 2, label %21
]
19: ; preds = %15
%20 = fadd float %5, 1.000000e+00
br label %23
21: ; preds = %15
%22 = fadd float %6, 1.000000e+00
br label %23
23: ; preds = %19, %21, %13, %11
%24 = phi float [ %12, %11 ], [ %5, %13 ], [ %5, %21 ], [ %20, %19 ]
%25 = phi float [ %6, %11 ], [ %14, %13 ], [ %22, %21 ], [ %6, %19 ]
%26 = fadd float %7, 1.000000e+00
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.8, i64 0, i64 0))
%28 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %2)
%29 = load i8, i8* %2
%30 = icmp eq i8 %29, 115
br i1 %30, label %4, label %31
31: ; preds = %23
%32 = fdiv float %24, %26
%33 = fmul float %32, 1.000000e+02
%34 = fdiv float %25, %26
%35 = fmul float %34, 1.000000e+02
%36 = fpext float %24 to double
%37 = fpext float %33 to double
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str.5, i64 0, i64 0), double %36, double %37)
%39 = fpext float %25 to double
%40 = fpext float %35 to double
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str.6, i64 0, i64 0), double %39, double %40)
%42 = fpext float %26 to double
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), double %42)
ret i32 0
}