#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 vot, vota = 0, votb = 0, votnul = 0;
  char canda[20], candb[20];
  printf("Sistema electoral.\n");
  printf("\nIntroduzca el nombre del primer candidato: ");
  scanf("%s", &canda);
  printf("\nIntroduzca el nombre del segundo candidato: ");
  scanf("%s", &candb);
  printf("\n¿Por quién desea votar?\n");
  printf("\nIntroduzca:");
  printf("\n\t0 si no desea votar.");
  printf("\n\t1 si desea votar por %s.", canda);
  printf("\n\t2 si desea votar por %s.\n", candb);
  while (vot != 0) {
    printf("Voto: ");
    scanf("%d", &vot);
    if (vot > 2) {
      votnul++;
    } else {
      switch (vot) {
      case 1:
        vota++;
        break;
      case 2:
        votb++;
        break;
      }
    }
  }
  if (vota > votb) {
    printf("\nEl ganador de la elección es %s con %d votos.", canda, vota);
  }
  if (vota < votb) {
    printf("\nEl ganador de la elección es %s con %d votos.", candb, votb);
  }
  if (vota == votb) {
    printf(
        "\nHubo un empate entre el candidato %s y el candidado %s de %d votos.",
        canda, candb, vota);
  }
  printf("\nLa cantidad de votos fueron: %d", vota + votb + votnul);
  printf("\nLa cantidad de votos nulos fueron: %d", votnul);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeda(%rip),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeba(%rip),%rdi
lea    -0x50(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rsi
lea    0xeeb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x50(%rbp),%rsi
lea    0xef4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x8(%rbp)
je     1268 <main+0x148>
lea    0xef8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xfab(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x2,-0x8(%rbp)
jle    1222 <main+0x102>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1263 <main+0x143>
mov    -0x8(%rbp),%eax
mov    %eax,-0x54(%rbp)
sub    $0x1,%eax
je     1247 <main+0x127>
jmp    1236 <main+0x116>
mov    -0x54(%rbp),%eax
sub    $0x2,%eax
je     1255 <main+0x135>
jmp    125e <main+0x13e>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    125e <main+0x13e>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1263 <main+0x143>
jmp    11e0 <main+0xc0>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    1289 <main+0x169>
lea    -0x30(%rbp),%rsi
mov    -0xc(%rbp),%edx
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    12aa <main+0x18a>
lea    -0x50(%rbp),%rsi
mov    -0x10(%rbp),%edx
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    12cf <main+0x1af>
lea    -0x30(%rbp),%rsi
lea    -0x50(%rbp),%rdx
mov    -0xc(%rbp),%ecx
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
add    -0x10(%rbp),%esi
add    -0x14(%rbp),%esi
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd14(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
lea    0x1028(%rip),%rdi
call   1040 <puts@plt>
lea    0xe9f(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xebe(%rip),%rbx
lea    0x30(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xea8(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x10(%rsp),%rbp
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xfe8(%rip),%rdi
call   1040 <puts@plt>
lea    0xeaa(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xea9(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeb2(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xebc(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xec7(%rip),%r12
lea    0xf81(%rip),%r13
lea    0xc(%rsp),%rbp
xor    %ebx,%ebx
xor    %r15d,%r15d
xor    %r14d,%r14d
jmp    1217 <main+0xd7>
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebx
test   %eax,%eax
je     124d <main+0x10d>
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r13,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0x3,%eax
jge    1210 <main+0xd0>
cmp    $0x2,%eax
je     1247 <main+0x107>
cmp    $0x1,%eax
jne    1213 <main+0xd3>
add    $0x1,%r14d
jmp    1213 <main+0xd3>
add    $0x1,%r15d
jmp    1213 <main+0xd3>
cmp    %r15d,%r14d
jg     12b9 <main+0x179>
cmp    %r15d,%r14d
jl     12d4 <main+0x194>
cmp    %r15d,%r14d
jne    1277 <main+0x137>
lea    0xe8d(%rip),%rdi
lea    0x30(%rsp),%rsi
lea    0x10(%rsp),%rdx
mov    %r14d,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
add    %r14d,%r15d
add    %ebx,%r15d
lea    0xeb1(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xec1(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe00(%rip),%rdi
lea    0x30(%rsp),%rsi
mov    %r14d,%edx
xor    %eax,%eax
call   1050 <printf@plt>
cmp    %r15d,%r14d
jge    1257 <main+0x117>
lea    0xde5(%rip),%rdi
lea    0x10(%rsp),%rsi
mov    %r15d,%edx
xor    %eax,%eax
call   1050 <printf@plt>
cmp    %r15d,%r14d
je     125c <main+0x11c>
jmp    1277 <main+0x137>

LLVM IR (-O0):
@.str = [20 x i8] c"Sistema electoral.\0A\00"
@.str.1 = [45 x i8] c"\0AIntroduzca el nombre del primer candidato: \00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [46 x i8] c"\0AIntroduzca el nombre del segundo candidato: \00"
@.str.4 = [28 x i8] c"\0A\C2\BFPor qui\C3\A9n desea votar?\0A\00"
@.str.5 = [13 x i8] c"\0AIntroduzca:\00"
@.str.6 = [23 x i8] c"\0A\090 si no desea votar.\00"
@.str.7 = [27 x i8] c"\0A\091 si desea votar por %s.\00"
@.str.8 = [28 x i8] c"\0A\092 si desea votar por %s.\0A\00"
@.str.9 = [7 x i8] c"Voto: \00"
@.str.10 = [3 x i8] c"%d\00"
@.str.11 = [48 x i8] c"\0AEl ganador de la elecci\C3\B3n es %s con %d votos.\00"
@.str.12 = [69 x i8] c"\0AHubo un empate entre el candidato %s y el candidado %s de %d votos.\00"
@.str.13 = [33 x i8] c"\0ALa cantidad de votos fueron: %d\00"
@.str.14 = [39 x i8] c"\0ALa cantidad de votos nulos fueron: %d\00"
@.str.15 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [20 x i8]
%7 = alloca [20 x i8]
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), [20 x i8]* %6)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), [20 x i8]* %7)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0))
%16 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), i8* %16)
%18 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), i8* %18)
br label %20
20: ; preds = %40, %0
%21 = load i32, i32* %2
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %41
23: ; preds = %20
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
%25 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32* %2)
%26 = load i32, i32* %2
%27 = icmp sgt i32 %26, 2
br i1 %27, label %28, label %31
28: ; preds = %23
%29 = load i32, i32* %5
%30 = add nsw i32 %29, 1
store i32 %30, i32* %5
br label %40
31: ; preds = %23
%32 = load i32, i32* %2
switch i32 %32, label %39 [
i32 1, label %33
i32 2, label %36
]
33: ; preds = %31
%34 = load i32, i32* %3
%35 = add nsw i32 %34, 1
store i32 %35, i32* %3
br label %39
36: ; preds = %31
%37 = load i32, i32* %4
%38 = add nsw i32 %37, 1
store i32 %38, i32* %4
br label %39
39: ; preds = %31, %36, %33
br label %40
40: ; preds = %39, %28
br label %20
41: ; preds = %20
%42 = load i32, i32* %3
%43 = load i32, i32* %4
%44 = icmp sgt i32 %42, %43
br i1 %44, label %45, label %49
45: ; preds = %41
%46 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%47 = load i32, i32* %3
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.11, i64 0, i64 0), i8* %46, i32 %47)
br label %49
49: ; preds = %45, %41
%50 = load i32, i32* %3
%51 = load i32, i32* %4
%52 = icmp slt i32 %50, %51
br i1 %52, label %53, label %57
53: ; preds = %49
%54 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%55 = load i32, i32* %4
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.11, i64 0, i64 0), i8* %54, i32 %55)
br label %57
57: ; preds = %53, %49
%58 = load i32, i32* %3
%59 = load i32, i32* %4
%60 = icmp eq i32 %58, %59
br i1 %60, label %61, label %66
61: ; preds = %57
%62 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%63 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%64 = load i32, i32* %3
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.12, i64 0, i64 0), i8* %62, i8* %63, i32 %64)
br label %66
66: ; preds = %61, %57
%67 = load i32, i32* %3
%68 = load i32, i32* %4
%69 = add nsw i32 %67, %68
%70 = load i32, i32* %5
%71 = add nsw i32 %69, %70
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.13, i64 0, i64 0), i32 %71)
%73 = load i32, i32* %5
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.14, i64 0, i64 0), i32 %73)
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [45 x i8] c"\0AIntroduzca el nombre del primer candidato: \00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [46 x i8] c"\0AIntroduzca el nombre del segundo candidato: \00"
@.str.5 = [13 x i8] c"\0AIntroduzca:\00"
@.str.6 = [23 x i8] c"\0A\090 si no desea votar.\00"
@.str.7 = [27 x i8] c"\0A\091 si desea votar por %s.\00"
@.str.8 = [28 x i8] c"\0A\092 si desea votar por %s.\0A\00"
@.str.9 = [7 x i8] c"Voto: \00"
@.str.10 = [3 x i8] c"%d\00"
@.str.11 = [48 x i8] c"\0AEl ganador de la elecci\C3\B3n es %s con %d votos.\00"
@.str.12 = [69 x i8] c"\0AHubo un empate entre el candidato %s y el candidado %s de %d votos.\00"
@.str.13 = [33 x i8] c"\0ALa cantidad de votos fueron: %d\00"
@.str.14 = [39 x i8] c"\0ALa cantidad de votos nulos fueron: %d\00"
@str = [19 x i8] c"Sistema electoral.\00"
@str.16 = [27 x i8] c"\0A\C2\BFPor qui\C3\A9n desea votar?\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i8]
%3 = alloca [20 x i8]
%4 = bitcast i32* %1 to i8*
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), [20 x i8]* %2)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), [20 x i8]* %3)
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.16, i64 0, i64 0))
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0))
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), i8* %5)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), i8* %6)
br label %17
17: ; preds = %0, %32
%18 = phi i32 [ %35, %32 ], [ 0, %0 ]
%19 = phi i32 [ %34, %32 ], [ 0, %0 ]
%20 = phi i32 [ %33, %32 ], [ 0, %0 ]
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
%22 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32* %1)
%23 = load i32, i32* %1
%24 = icmp sgt i32 %23, 2
br i1 %24, label %25, label %27
25: ; preds = %17
%26 = add nsw i32 %18, 1
br label %32
27: ; preds = %17
switch i32 %23, label %32 [
i32 1, label %28
i32 2, label %30
]
28: ; preds = %27
%29 = add nsw i32 %20, 1
br label %32
30: ; preds = %27
%31 = add nsw i32 %19, 1
br label %32
32: ; preds = %28, %30, %27, %25
%33 = phi i32 [ %20, %25 ], [ %20, %27 ], [ %20, %30 ], [ %29, %28 ]
%34 = phi i32 [ %19, %25 ], [ %19, %27 ], [ %31, %30 ], [ %19, %28 ]
%35 = phi i32 [ %26, %25 ], [ %18, %27 ], [ %18, %30 ], [ %18, %28 ]
%36 = icmp eq i32 %23, 0
br i1 %36, label %37, label %17
37: ; preds = %32
%38 = icmp sgt i32 %33, %34
br i1 %38, label %39, label %41
39: ; preds = %37
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.11, i64 0, i64 0), i8* %5, i32 %33)
br label %41
41: ; preds = %39, %37
%42 = icmp slt i32 %33, %34
br i1 %42, label %43, label %45
43: ; preds = %41
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.11, i64 0, i64 0), i8* %6, i32 %34)
br label %45
45: ; preds = %43, %41
%46 = icmp eq i32 %33, %34
br i1 %46, label %47, label %49
47: ; preds = %45
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([69 x i8], [69 x i8]* @.str.12, i64 0, i64 0), i8* %5, i8* %6, i32 %33)
br label %49
49: ; preds = %47, %45
%50 = add nsw i32 %34, %33
%51 = add nsw i32 %50, %35
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.13, i64 0, i64 0), i32 %51)
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.14, i64 0, i64 0), i32 %35)
%54 = call i32 @putchar(i32 10)
ret i32 0
}