#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 argc, const char *argv[]) {
  int cand1, cand2, cand3, numele, i, nulo, arm;
  char ch;
  cand1 = 0;
  cand2 = 0;
  cand3 = 0;
  nulo = 0;
  printf("Digite o numero de eleitores. \n");
  scanf("%d", &numele);
  arm = numele;
  for (i = 0; i < arm; i++) {
    printf("1. Candidato 1 \n");
    printf("2. handidato 2 \n");
    printf("3. Candidato 3 \n");
    scanf("%s", &ch);
    switch (ch) {
    case '1':
      cand1++;
      break;
    case '2':
      cand2++;
      break;
    case '3':
      cand3++;
      break;
    default:
      printf("Voto nulo\n");
      nulo++;
    }
  }
  printf("Votos no Candidato 1: %d\n", cand1);
  printf("Votos no Candidato 2: %d\n", cand2);
  printf("Votos no Candidato 3: %d\n", cand3);
  printf("Votos nulos: %d\n", nulo);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x28(%rbp)
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb9(%rip),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x20(%rbp),%eax
mov    %eax,-0x2c(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    1258 <main+0x138>
lea    0xe91(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x35(%rbp)
call   1030 <printf@plt>
mov    -0x35(%rbp),%al
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x35(%rbp),%al
lea    0xe90(%rip),%rdi
call   1030 <printf@plt>
mov    -0x35(%rbp),%al
lea    0xe92(%rip),%rdi
lea    -0x2d(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x2d(%rbp),%eax
mov    %eax,-0x34(%rbp)
sub    $0x31,%eax
je     1204 <main+0xe4>
jmp    11e2 <main+0xc2>
mov    -0x34(%rbp),%eax
sub    $0x32,%eax
je     1212 <main+0xf2>
jmp    11f3 <main+0xd3>
mov    -0x34(%rbp),%eax
sub    $0x33,%eax
je     1220 <main+0x100>
jmp    122e <main+0x10e>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1245 <main+0x125>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1245 <main+0x125>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1245 <main+0x125>
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    124a <main+0x12a>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    117f <main+0x5f>
mov    -0x14(%rbp),%esi
lea    0xe02(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xe0b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xe14(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%esi
lea    0xe1d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xf20(%rip),%rdi
call   1030 <puts@plt>
lea    0xeaf(%rip),%rdi
xor    %r15d,%r15d
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x14(%rsp),%r14d
mov    $0x0,%ebx
movl   $0x0,0x10(%rsp)
mov    $0x0,%ebp
test   %r14d,%r14d
jle    1223 <main+0xf3>
lea    0xe7c(%rip),%r12
lea    0xf(%rsp),%r13
xor    %ebp,%ebp
movl   $0x0,0x10(%rsp)
xor    %ebx,%ebx
xor    %r15d,%r15d
jmp    11aa <main+0x7a>
nopl   (%rax)
add    $0x1,%r15d
add    $0xffffffff,%r14d
je     1223 <main+0xf3>
lea    0xed3(%rip),%rdi
call   1030 <puts@plt>
lea    0xed7(%rip),%rdi
call   1030 <puts@plt>
lea    0xedb(%rip),%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movsbl 0xf(%rsp),%eax
cmp    $0x33,%eax
je     1200 <main+0xd0>
cmp    $0x32,%eax
je     11a0 <main+0x70>
cmp    $0x31,%eax
jne    1210 <main+0xe0>
add    $0x1,%ebp
jmp    11a4 <main+0x74>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%ebx
jmp    11a4 <main+0x74>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0xe9d(%rip),%rdi
call   1030 <puts@plt>
addl   $0x1,0x10(%rsp)
jmp    11a4 <main+0x74>
lea    0xddc(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xde6(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdef(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdf9(%rip),%rdi
mov    0x10(%rsp),%esi
xor    %eax,%eax
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 = [32 x i8] c"Digite o numero de eleitores. \0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [17 x i8] c"1. Candidato 1 \0A\00"
@.str.3 = [17 x i8] c"2. handidato 2 \0A\00"
@.str.4 = [17 x i8] c"3. Candidato 3 \0A\00"
@.str.5 = [3 x i8] c"%s\00"
@.str.6 = [11 x i8] c"Voto nulo\0A\00"
@.str.7 = [26 x i8] c"Votos no Candidato 1: %d\0A\00"
@.str.8 = [26 x i8] c"Votos no Candidato 2: %d\0A\00"
@.str.9 = [26 x i8] c"Votos no Candidato 3: %d\0A\00"
@.str.10 = [17 x i8] c"Votos nulos: %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
store i32 0, i32* %11
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %9)
%16 = load i32, i32* %9
store i32 %16, i32* %12
store i32 0, i32* %10
br label %17
17: ; preds = %42, %2
%18 = load i32, i32* %10
%19 = load i32, i32* %12
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %45
21: ; preds = %17
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%25 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %13)
%26 = load i8, i8* %13
%27 = sext i8 %26 to i32
switch i32 %27, label %37 [
i32 49, label %28
i32 50, label %31
i32 51, label %34
]
28: ; preds = %21
%29 = load i32, i32* %6
%30 = add nsw i32 %29, 1
store i32 %30, i32* %6
br label %41
31: ; preds = %21
%32 = load i32, i32* %7
%33 = add nsw i32 %32, 1
store i32 %33, i32* %7
br label %41
34: ; preds = %21
%35 = load i32, i32* %8
%36 = add nsw i32 %35, 1
store i32 %36, i32* %8
br label %41
37: ; preds = %21
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%39 = load i32, i32* %11
%40 = add nsw i32 %39, 1
store i32 %40, i32* %11
br label %41
41: ; preds = %37, %34, %31, %28
br label %42
42: ; preds = %41
%43 = load i32, i32* %10
%44 = add nsw i32 %43, 1
store i32 %44, i32* %10
br label %17
45: ; preds = %17
%46 = load i32, i32* %6
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i32 %46)
%48 = load i32, i32* %7
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i32 %48)
%50 = load i32, i32* %8
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0), i32 %50)
%52 = load i32, i32* %11
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0), i32 %52)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.5 = [3 x i8] c"%s\00"
@.str.7 = [26 x i8] c"Votos no Candidato 1: %d\0A\00"
@.str.8 = [26 x i8] c"Votos no Candidato 2: %d\0A\00"
@.str.9 = [26 x i8] c"Votos no Candidato 3: %d\0A\00"
@.str.10 = [17 x i8] c"Votos nulos: %d\0A\00"
@str = [31 x i8] c"Digite o numero de eleitores. \00"
@str.11 = [16 x i8] c"1. Candidato 1 \00"
@str.12 = [16 x i8] c"2. handidato 2 \00"
@str.13 = [16 x i8] c"3. Candidato 3 \00"
@str.14 = [10 x i8] c"Voto nulo\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i8
%5 = bitcast i32* %3 to i8*
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%8 = load i32, i32* %3
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %38
10: ; preds = %2, %31
%11 = phi i32 [ %35, %31 ], [ 0, %2 ]
%12 = phi i32 [ %34, %31 ], [ 0, %2 ]
%13 = phi i32 [ %36, %31 ], [ 0, %2 ]
%14 = phi i32 [ %33, %31 ], [ 0, %2 ]
%15 = phi i32 [ %32, %31 ], [ 0, %2 ]
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.11, i64 0, i64 0))
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.12, i64 0, i64 0))
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.13, i64 0, i64 0))
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %4)
%20 = load i8, i8* %4
%21 = sext i8 %20 to i32
switch i32 %21, label %28 [
i32 49, label %22
i32 50, label %24
i32 51, label %26
]
22: ; preds = %10
%23 = add nsw i32 %11, 1
br label %31
24: ; preds = %10
%25 = add nsw i32 %15, 1
br label %31
26: ; preds = %10
%27 = add nsw i32 %14, 1
br label %31
28: ; preds = %10
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.14, i64 0, i64 0))
%30 = add nsw i32 %12, 1
br label %31
31: ; preds = %22, %24, %26, %28
%32 = phi i32 [ %15, %28 ], [ %15, %26 ], [ %25, %24 ], [ %15, %22 ]
%33 = phi i32 [ %14, %28 ], [ %27, %26 ], [ %14, %24 ], [ %14, %22 ]
%34 = phi i32 [ %30, %28 ], [ %12, %26 ], [ %12, %24 ], [ %12, %22 ]
%35 = phi i32 [ %11, %28 ], [ %11, %26 ], [ %11, %24 ], [ %23, %22 ]
%36 = add nuw nsw i32 %13, 1
%37 = icmp eq i32 %36, %8
br i1 %37, label %38, label %10
38: ; preds = %31, %2
%39 = phi i32 [ 0, %2 ], [ %32, %31 ]
%40 = phi i32 [ 0, %2 ], [ %33, %31 ]
%41 = phi i32 [ 0, %2 ], [ %34, %31 ]
%42 = phi i32 [ 0, %2 ], [ %35, %31 ]
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i32 %42)
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i32 %39)
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0), i32 %40)
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0), i32 %41)
ret i32 0
}