#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 admk = 0, dmk = 0, bjp = 0, ch = 0, n = 0, i;
  printf("1)ADMK 2)BJP 3)DMK Enter number of voters");
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    printf(" Enter your choice");
    scanf("%d", &ch);
    switch (ch) {
    case 1:
      admk++;
      break;
    case 2:
      bjp++;
      break;
    case 3:
      dmk++;
      break;
    default:
      printf("Wrong choice");
    }
  }
  if (admk > dmk && admk > bjp)
    printf("The winner is ADMK");
  else if (dmk > admk && dmk > bjp)
    printf("The winner is DMK");
  else
    printf("The winner is BJP");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
lea    0xec5(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    121c <main+0xfc>
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
lea    0xe96(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
sub    $0x1,%eax
je     11d3 <main+0xb3>
jmp    11b1 <main+0x91>
mov    -0x20(%rbp),%eax
sub    $0x2,%eax
je     11e1 <main+0xc1>
jmp    11c2 <main+0xa2>
mov    -0x20(%rbp),%eax
sub    $0x3,%eax
je     11ef <main+0xcf>
jmp    11fd <main+0xdd>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1209 <main+0xe9>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1209 <main+0xe9>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1209 <main+0xe9>
lea    0xe3c(%rip),%rdi
call   1030 <printf@plt>
jmp    120e <main+0xee>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1175 <main+0x55>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1245 <main+0x125>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    1245 <main+0x125>
lea    0xe12(%rip),%rdi
call   1030 <printf@plt>
jmp    127f <main+0x15f>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    126e <main+0x14e>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    126e <main+0x14e>
lea    0xdfc(%rip),%rdi
call   1030 <printf@plt>
jmp    127a <main+0x15a>
lea    0xdfd(%rip),%rdi
call   1030 <printf@plt>
jmp    127f <main+0x15f>
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
push   %rax
movl   $0x0,0x4(%rsp)
movl   $0x0,(%rsp)
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
lea    0xedd(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
cmpl   $0x0,(%rsp)
jle    1204 <main+0xe4>
xor    %r14d,%r14d
lea    0xec1(%rip),%r15
lea    0x4(%rsp),%rbx
xor    %r13d,%r13d
xor    %ebp,%ebp
xor    %r12d,%r12d
jmp    118e <main+0x6e>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r13d
add    $0x1,%r14d
cmp    (%rsp),%r14d
jge    11de <main+0xbe>
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x3,%eax
je     11c0 <main+0xa0>
cmp    $0x2,%eax
je     1180 <main+0x60>
cmp    $0x1,%eax
jne    11d0 <main+0xb0>
add    $0x1,%r12d
jmp    1184 <main+0x64>
xchg   %ax,%ax
add    $0x1,%ebp
jmp    1184 <main+0x64>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0xe69(%rip),%rdi
call   1030 <printf@plt>
jmp    1184 <main+0x64>
cmp    %ebp,%r12d
jle    11f1 <main+0xd1>
cmp    %r13d,%r12d
jle    11f1 <main+0xd1>
lea    0xe5e(%rip),%rdi
jmp    120b <main+0xeb>
cmp    %r12d,%ebp
jle    1204 <main+0xe4>
cmp    %r13d,%ebp
jle    1204 <main+0xe4>
lea    0xe5e(%rip),%rdi
jmp    120b <main+0xeb>
lea    0xe67(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [42 x i8] c"1)ADMK 2)BJP 3)DMK Enter number of voters\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [19 x i8] c" Enter your choice\00"
@.str.3 = [13 x i8] c"Wrong choice\00"
@.str.4 = [19 x i8] c"The winner is ADMK\00"
@.str.5 = [18 x i8] c"The winner is DMK\00"
@.str.6 = [18 x i8] c"The winner is BJP\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
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
%8 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
store i32 0, i32* %7
br label %10
10: ; preds = %30, %0
%11 = load i32, i32* %7
%12 = load i32, i32* %6
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %33
14: ; preds = %10
%15 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%17 = load i32, i32* %5
switch i32 %17, label %27 [
i32 1, label %18
i32 2, label %21
i32 3, label %24
]
18: ; preds = %14
%19 = load i32, i32* %2
%20 = add nsw i32 %19, 1
store i32 %20, i32* %2
br label %29
21: ; preds = %14
%22 = load i32, i32* %4
%23 = add nsw i32 %22, 1
store i32 %23, i32* %4
br label %29
24: ; preds = %14
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
store i32 %26, i32* %3
br label %29
27: ; preds = %14
%28 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
br label %29
29: ; preds = %27, %24, %21, %18
br label %30
30: ; preds = %29
%31 = load i32, i32* %7
%32 = add nsw i32 %31, 1
store i32 %32, i32* %7
br label %10
33: ; preds = %10
%34 = load i32, i32* %2
%35 = load i32, i32* %3
%36 = icmp sgt i32 %34, %35
br i1 %36, label %37, label %43
37: ; preds = %33
%38 = load i32, i32* %2
%39 = load i32, i32* %4
%40 = icmp sgt i32 %38, %39
br i1 %40, label %41, label %43
41: ; preds = %37
%42 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
br label %56
43: ; preds = %37, %33
%44 = load i32, i32* %3
%45 = load i32, i32* %2
%46 = icmp sgt i32 %44, %45
br i1 %46, label %47, label %53
47: ; preds = %43
%48 = load i32, i32* %3
%49 = load i32, i32* %4
%50 = icmp sgt i32 %48, %49
br i1 %50, label %51, label %53
51: ; preds = %47
%52 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
br label %55
53: ; preds = %47, %43
%54 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0))
br label %55
55: ; preds = %53, %51
br label %56
56: ; preds = %55, %41
ret i32 0
}

LLVM IR (-O2):
@.str = [42 x i8] c"1)ADMK 2)BJP 3)DMK Enter number of voters\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [19 x i8] c" Enter your choice\00"
@.str.3 = [13 x i8] c"Wrong choice\00"
@.str.4 = [19 x i8] c"The winner is ADMK\00"
@.str.5 = [18 x i8] c"The winner is DMK\00"
@.str.6 = [18 x i8] c"The winner is BJP\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %40
9: ; preds = %0, %25
%10 = phi i32 [ %29, %25 ], [ 0, %0 ]
%11 = phi i32 [ %28, %25 ], [ 0, %0 ]
%12 = phi i32 [ %27, %25 ], [ 0, %0 ]
%13 = phi i32 [ %26, %25 ], [ 0, %0 ]
%14 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%16 = load i32, i32* %1
switch i32 %16, label %23 [
i32 1, label %17
i32 2, label %19
i32 3, label %21
]
17: ; preds = %9
%18 = add nsw i32 %13, 1
br label %25
19: ; preds = %9
%20 = add nsw i32 %11, 1
br label %25
21: ; preds = %9
%22 = add nsw i32 %12, 1
br label %25
23: ; preds = %9
%24 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
br label %25
25: ; preds = %17, %19, %21, %23
%26 = phi i32 [ %13, %23 ], [ %13, %21 ], [ %13, %19 ], [ %18, %17 ]
%27 = phi i32 [ %12, %23 ], [ %22, %21 ], [ %12, %19 ], [ %12, %17 ]
%28 = phi i32 [ %11, %23 ], [ %11, %21 ], [ %20, %19 ], [ %11, %17 ]
%29 = add nuw nsw i32 %10, 1
%30 = load i32, i32* %2
%31 = icmp slt i32 %29, %30
br i1 %31, label %9, label %32
32: ; preds = %25
%33 = icmp sgt i32 %26, %27
%34 = icmp sgt i32 %26, %28
%35 = select i1 %33, i1 %34, i1 false
br i1 %35, label %41, label %36
36: ; preds = %32
%37 = icmp sgt i32 %27, %26
%38 = icmp sgt i32 %27, %28
%39 = select i1 %37, i1 %38, i1 false
br i1 %39, label %41, label %40
40: ; preds = %0, %36
br label %41
41: ; preds = %36, %32, %40
%42 = phi i8* [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), %40 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), %32 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), %36 ]
%43 = call i32 @printf(i8* dereferenceable(1) %42)
ret i32 0
}