#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 votoCand1 = 0, votoCand2 = 0;
  int voto;
  char continuar;
  do {
    printf("\nEntre com voto");
    printf("\n1 - Dilma");
    printf("\n2 - Aecio");
    printf("\nOpção: ");
    scanf("%d", &voto);
    if (voto == 1)
      votoCand1++;
    else if (voto == 2)
      votoCand2++;
    printf("\nDeseja continuar(s/n)? ");
    scanf(" %c", &continuar);
  } while (continuar == 's' || continuar == 'S');
  printf("\nPercentagem de votos do candidato 1 = %.2f%%",
         (votoCand1 / (votoCand1 + votoCand2)) * 100);
  printf("\nPercentagem de votos do candidato 2 = %.2f%%",
         (votoCand2 / (votoCand1 + votoCand2)) * 100);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebb(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x1,-0x10(%rbp)
jne    11aa <main+0x8a>
movss  0xe65(%rip),%xmm0
addss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    11cb <main+0xab>
cmpl   $0x2,-0x10(%rbp)
jne    11c6 <main+0xa6>
movss  0xe44(%rip),%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    11cb <main+0xab>
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe75(%rip),%rdi
lea    -0x11(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movsbl -0x11(%rbp),%ecx
mov    $0x1,%al
cmp    $0x73,%ecx
mov    %al,-0x12(%rbp)
je     120a <main+0xea>
movsbl -0x11(%rbp),%eax
cmp    $0x53,%eax
sete   %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
test   $0x1,%al
jne    113f <main+0x1f>
movss  -0x8(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
addss  -0xc(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  0xdd4(%rip),%xmm1
mulss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe1a(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0xc(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
addss  -0xc(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  0xda3(%rip),%xmm1
mulss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe17(%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
xorps  %xmm0,%xmm0
movss  %xmm0,0xc(%rsp)
lea    0xef0(%rip),%r13
lea    0xef4(%rip),%rbx
lea    0x14(%rsp),%rbp
lea    0xeeb(%rip),%r14
lea    0xefd(%rip),%r15
lea    0x7(%rsp),%r12
xorps  %xmm0,%xmm0
movss  %xmm0,0x8(%rsp)
jmp    11a6 <main+0x86>
nopl   0x0(%rax,%rax,1)
movss  0x8(%rsp),%xmm0
addss  0xe82(%rip),%xmm0
movss  %xmm0,0x8(%rsp)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
movzbl 0x7(%rsp),%eax
and    $0xdf,%al
cmp    $0x53,%al
jne    120e <main+0xee>
lea    0xe5b(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe5d(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe5a(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r13,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x14(%rsp),%eax
cmp    $0x2,%eax
je     1170 <main+0x50>
cmp    $0x1,%eax
jne    1184 <main+0x64>
movss  0xc(%rsp),%xmm0
addss  0xdfd(%rip),%xmm0
movss  %xmm0,0xc(%rsp)
jmp    1184 <main+0x64>
movss  0xc(%rsp),%xmm0
movaps %xmm0,%xmm1
addss  0x8(%rsp),%xmm1
movss  %xmm1,0x10(%rsp)
divss  %xmm1,%xmm0
mulss  0xdd5(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe1f(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  0x8(%rsp),%xmm0
divss  0x10(%rsp),%xmm0
mulss  0xdaf(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe27(%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 = [16 x i8] c"\0AEntre com voto\00"
@.str.1 = [11 x i8] c"\0A1 - Dilma\00"
@.str.2 = [11 x i8] c"\0A2 - Aecio\00"
@.str.3 = [11 x i8] c"\0AOp\C3\A7\C3\A3o: \00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [25 x i8] c"\0ADeseja continuar(s/n)? \00"
@.str.6 = [4 x i8] c" %c\00"
@.str.7 = [46 x i8] c"\0APercentagem de votos do candidato 1 = %.2f%%\00"
@.str.8 = [46 x i8] c"\0APercentagem de votos do candidato 2 = %.2f%%\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca i32
%5 = alloca i8
store i32 0, i32* %1
store float 0.000000e+00, float* %2
store float 0.000000e+00, float* %3
br label %6
6: ; preds = %35, %0
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %4)
%12 = load i32, i32* %4
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %17
14: ; preds = %6
%15 = load float, float* %2
%16 = fadd float %15, 1.000000e+00
store float %16, float* %2
br label %24
17: ; preds = %6
%18 = load i32, i32* %4
%19 = icmp eq i32 %18, 2
br i1 %19, label %20, label %23
20: ; preds = %17
%21 = load float, float* %3
%22 = fadd float %21, 1.000000e+00
store float %22, float* %3
br label %23
23: ; preds = %20, %17
br label %24
24: ; preds = %23, %14
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
%26 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* %5)
br label %27
27: ; preds = %24
%28 = load i8, i8* %5
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 115
br i1 %30, label %35, label %31
31: ; preds = %27
%32 = load i8, i8* %5
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 83
br label %35
35: ; preds = %31, %27
%36 = phi i1 [ true, %27 ], [ %34, %31 ]
br i1 %36, label %6, label %37
37: ; preds = %35
%38 = load float, float* %2
%39 = load float, float* %2
%40 = load float, float* %3
%41 = fadd float %39, %40
%42 = fdiv float %38, %41
%43 = fmul float %42, 1.000000e+02
%44 = fpext float %43 to double
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.7, i64 0, i64 0), double %44)
%46 = load float, float* %3
%47 = load float, float* %2
%48 = load float, float* %3
%49 = fadd float %47, %48
%50 = fdiv float %46, %49
%51 = fmul float %50, 1.000000e+02
%52 = fpext float %51 to double
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.8, i64 0, i64 0), double %52)
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"\0AEntre com voto\00"
@.str.1 = [11 x i8] c"\0A1 - Dilma\00"
@.str.2 = [11 x i8] c"\0A2 - Aecio\00"
@.str.3 = [11 x i8] c"\0AOp\C3\A7\C3\A3o: \00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [25 x i8] c"\0ADeseja continuar(s/n)? \00"
@.str.6 = [4 x i8] c" %c\00"
@.str.7 = [46 x i8] c"\0APercentagem de votos do candidato 1 = %.2f%%\00"
@.str.8 = [46 x i8] c"\0APercentagem de votos do candidato 2 = %.2f%%\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = bitcast i32* %1 to i8*
br label %4
4: ; preds = %17, %0
%5 = phi float [ 0.000000e+00, %0 ], [ %18, %17 ]
%6 = phi float [ 0.000000e+00, %0 ], [ %19, %17 ]
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %1)
%12 = load i32, i32* %1
switch i32 %12, label %17 [
i32 1, label %13
i32 2, label %15
]
13: ; preds = %4
%14 = fadd float %5, 1.000000e+00
br label %17
15: ; preds = %4
%16 = fadd float %6, 1.000000e+00
br label %17
17: ; preds = %4, %15, %13
%18 = phi float [ %14, %13 ], [ %5, %15 ], [ %5, %4 ]
%19 = phi float [ %6, %13 ], [ %16, %15 ], [ %6, %4 ]
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* %2)
%22 = load i8, i8* %2
%23 = and i8 %22, -33
%24 = icmp eq i8 %23, 83
br i1 %24, label %4, label %25
25: ; preds = %17
%26 = fadd float %18, %19
%27 = fdiv float %18, %26
%28 = fmul float %27, 1.000000e+02
%29 = fpext float %28 to double
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.7, i64 0, i64 0), double %29)
%31 = fdiv float %19, %26
%32 = fmul float %31, 1.000000e+02
%33 = fpext float %32 to double
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.8, i64 0, i64 0), double %33)
ret i32 0
}