#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, int, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int tipo[4] = {0, 0, 0, 0}, N;
  scanf(" %d", &N);
  while (N != 4) {
    switch (N) {
    case 1:
      tipo[0]++;
      break;
    case 2:
      tipo[1]++;
      break;
    case 3:
      tipo[2]++;
      break;
    }
    scanf(" %d", &N);
  }
  printf("MUITO OBRIGADO\nAlcool: %d\nGasolina: %d\nDiesel: %d\n", tipo[0],
         tipo[1], tipo[2]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <memset@plt>
lea    0xeaa(%rip),%rdi
lea    -0x24(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x4,-0x24(%rbp)
je     11d9 <main+0xa9>
mov    -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
sub    $0x1,%eax
je     119f <main+0x6f>
jmp    117d <main+0x4d>
mov    -0x28(%rbp),%eax
sub    $0x2,%eax
je     11ad <main+0x7d>
jmp    118e <main+0x5e>
mov    -0x28(%rbp),%eax
sub    $0x3,%eax
je     11bb <main+0x8b>
jmp    11c4 <main+0x94>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11c4 <main+0x94>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11c4 <main+0x94>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
lea    0xe35(%rip),%rdi
lea    -0x24(%rbp),%rsi
call   1050 <scanf@plt>
jmp    115f <main+0x2f>
mov    -0x20(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x18(%rbp),%ecx
lea    0xe1b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %r14d,%r14d
lea    0xedb(%rip),%rbx
lea    0x4(%rsp),%rbp
lea    0xebf(%rip),%r13
xor    %r15d,%r15d
xor    %r12d,%r12d
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x3,%eax
ja     1150 <main+0x30>
movslq 0x0(%r13,%rax,4),%rax
add    %r13,%rax
jmp    *%rax
add    $0x1,%r12d
jmp    1150 <main+0x30>
add    $0x1,%r14d
jmp    1150 <main+0x30>
add    $0x1,%r15d
jmp    1150 <main+0x30>
lea    0xe8a(%rip),%rdi
mov    %r12d,%esi
mov    %r14d,%edx
mov    %r15d,%ecx
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 = [4 x i8] c" %d\00"
@.str.1 = [51 x i8] c"MUITO OBRIGADO\0AAlcool: %d\0AGasolina: %d\0ADiesel: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [4 x i32]* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %3)
br label %6
6: ; preds = %23, %0
%7 = load i32, i32* %3
%8 = icmp ne i32 %7, 4
br i1 %8, label %9, label %25
9: ; preds = %6
%10 = load i32, i32* %3
switch i32 %10, label %23 [
i32 1, label %11
i32 2, label %15
i32 3, label %19
]
11: ; preds = %9
%12 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
%13 = load i32, i32* %12
%14 = add nsw i32 %13, 1
store i32 %14, i32* %12
br label %23
15: ; preds = %9
%16 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 1
%17 = load i32, i32* %16
%18 = add nsw i32 %17, 1
store i32 %18, i32* %16
br label %23
19: ; preds = %9
%20 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 2
%21 = load i32, i32* %20
%22 = add nsw i32 %21, 1
store i32 %22, i32* %20
br label %23
23: ; preds = %9, %19, %15, %11
%24 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %3)
br label %6
25: ; preds = %6
%26 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
%27 = load i32, i32* %26
%28 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 1
%29 = load i32, i32* %28
%30 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 2
%31 = load i32, i32* %30
%32 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0), i32 %27, i32 %29, i32 %31)
ret i32 0
}

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