#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 *);
int main() {
  int a, i, cou1 = 0, cou2 = 0, cou3 = 0;
  while (1) {
    scanf("%d", &a);
    if (a == 1) {
      cou1++;
    } else if (a == 2) {
      cou2++;
    } else if (a == 3) {
      cou3++;
    } else if (a == 4) {
      break;
    }
  }
  printf("MUITO OBRIGADO\n");
  printf("Alcool: %d\n", cou1);
  printf("Gasolina: %d\n", cou2);
  printf("Diesel: %d\n", cou3);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xeb5(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x1,-0x8(%rbp)
jne    116c <main+0x4c>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11ba <main+0x9a>
cmpl   $0x2,-0x8(%rbp)
jne    1184 <main+0x64>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11b5 <main+0x95>
cmpl   $0x3,-0x8(%rbp)
jne    119c <main+0x7c>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11b0 <main+0x90>
cmpl   $0x4,-0x8(%rbp)
jne    11ab <main+0x8b>
jmp    11bf <main+0x9f>
jmp    11b0 <main+0x90>
jmp    11b5 <main+0x95>
jmp    11ba <main+0x9a>
jmp    1144 <main+0x24>
lea    0xe3d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xe37(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xe34(%rip),%rdi
mov    $0x0,%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
push   %rax
xor    %r12d,%r12d
lea    0xecb(%rip),%rbp
lea    0x4(%rsp),%rbx
lea    0xeaf(%rip),%r13
xor    %r15d,%r15d
xor    %r14d,%r14d
nopw   0x0(%rax,%rax,1)
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x3,%eax
ja     1160 <main+0x30>
movslq 0x0(%r13,%rax,4),%rax
add    %r13,%rax
jmp    *%rax
add    $0x1,%r12d
jmp    1160 <main+0x30>
add    $0x1,%r15d
jmp    1160 <main+0x30>
add    $0x1,%r14d
jmp    1160 <main+0x30>
lea    0xe9f(%rip),%rdi
call   1030 <puts@plt>
lea    0xe6d(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe68(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe65(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <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 = [3 x i8] c"%d\00"
@.str.1 = [16 x i8] c"MUITO OBRIGADO\0A\00"
@.str.2 = [12 x i8] c"Alcool: %d\0A\00"
@.str.3 = [14 x i8] c"Gasolina: %d\0A\00"
@.str.4 = [12 x i8] c"Diesel: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
br label %7
7: ; preds = %0, %33
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = load i32, i32* %4
%13 = add nsw i32 %12, 1
store i32 %13, i32* %4
br label %33
14: ; preds = %7
%15 = load i32, i32* %2
%16 = icmp eq i32 %15, 2
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
br label %32
20: ; preds = %14
%21 = load i32, i32* %2
%22 = icmp eq i32 %21, 3
br i1 %22, label %23, label %26
23: ; preds = %20
%24 = load i32, i32* %6
%25 = add nsw i32 %24, 1
store i32 %25, i32* %6
br label %31
26: ; preds = %20
%27 = load i32, i32* %2
%28 = icmp eq i32 %27, 4
br i1 %28, label %29, label %30
29: ; preds = %26
br label %34
30: ; preds = %26
br label %31
31: ; preds = %30, %23
br label %32
32: ; preds = %31, %17
br label %33
33: ; preds = %32, %11
br label %7
34: ; preds = %29
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%36 = load i32, i32* %4
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %36)
%38 = load i32, i32* %5
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %38)
%40 = load i32, i32* %6
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %40)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.2 = [12 x i8] c"Alcool: %d\0A\00"
@.str.3 = [14 x i8] c"Gasolina: %d\0A\00"
@.str.4 = [12 x i8] c"Diesel: %d\0A\00"
@str = [15 x i8] c"MUITO OBRIGADO\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %15, %0
%4 = phi i32 [ %16, %15 ], [ 0, %0 ]
%5 = phi i32 [ %8, %15 ], [ 0, %0 ]
%6 = phi i32 [ %11, %15 ], [ 0, %0 ]
br label %7
7: ; preds = %3, %17
%8 = phi i32 [ %5, %3 ], [ %18, %17 ]
%9 = phi i32 [ %6, %3 ], [ %11, %17 ]
br label %10
10: ; preds = %7, %19
%11 = phi i32 [ %9, %7 ], [ %20, %19 ]
br label %12
12: ; preds = %10, %12
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%14 = load i32, i32* %1
switch i32 %14, label %12 [
i32 1, label %15
i32 2, label %17
i32 3, label %19
i32 4, label %21
]
15: ; preds = %12
%16 = add nuw nsw i32 %4, 1
br label %3
17: ; preds = %12
%18 = add nsw i32 %8, 1
br label %7
19: ; preds = %12
%20 = add nsw i32 %11, 1
br label %10
21: ; preds = %12
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %4)
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %8)
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %11)
ret i32 0
}