#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 v[3] = {0, 0, 0}, n;
  while (1) {
    scanf("%d", &n);
    if (n > 0 && n < 5) {
      if (n == 4)
        break;
      v[n - 1]++;
    }
  }
  printf("MUITO OBRIGADO\nAlcool: %d\nGasolina: %d\nDiesel: %d\n", v[0], v[1],
         v[2]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1040 <memset@plt>
lea    0xeaa(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,-0x14(%rbp)
jle    1195 <main+0x65>
cmpl   $0x5,-0x14(%rbp)
jge    1195 <main+0x65>
cmpl   $0x4,-0x14(%rbp)
jne    1182 <main+0x52>
jmp    119a <main+0x6a>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x10(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x10(%rbp,%rax,4)
jmp    114f <main+0x1f>
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%ecx
lea    0xe59(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movl   $0x0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
lea    0xec1(%rip),%r14
lea    0x14(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0x14(%rsp),%ecx
lea    -0x1(%rcx),%eax
cmp    $0x3,%eax
ja     1150 <main+0x30>
cmp    $0x4,%ecx
je     1175 <main+0x55>
mov    %eax,%eax
addl   $0x1,0x8(%rsp,%rax,4)
jmp    1150 <main+0x30>
mov    0x8(%rsp),%esi
mov    0xc(%rsp),%edx
mov    0x10(%rsp),%ecx
lea    0xe7b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 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 [3 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [3 x i32]* %2 to i8*
br label %5
5: ; preds = %0, %23
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%7 = load i32, i32* %3
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %23
9: ; preds = %5
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 5
br i1 %11, label %12, label %23
12: ; preds = %9
%13 = load i32, i32* %3
%14 = icmp eq i32 %13, 4
br i1 %14, label %15, label %16
15: ; preds = %12
br label %24
16: ; preds = %12
%17 = load i32, i32* %3
%18 = sub nsw i32 %17, 1
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 %19
%21 = load i32, i32* %20
%22 = add nsw i32 %21, 1
store i32 %22, i32* %20
br label %23
23: ; preds = %16, %9, %5
br label %5
24: ; preds = %15
%25 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%26 = load i32, i32* %25
%27 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 1
%28 = load i32, i32* %27
%29 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 2
%30 = load i32, i32* %29
%31 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0), i32 %26, i32 %28, i32 %30)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 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 [3 x i32]
%2 = alloca i32
%3 = bitcast [3 x i32]* %1 to i8*
%4 = bitcast i32* %2 to i8*
br label %5
5: ; preds = %17, %0
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
%8 = add i32 %7, -1
%9 = icmp ult i32 %8, 4
br i1 %9, label %10, label %17
10: ; preds = %5
%11 = icmp eq i32 %7, 4
br i1 %11, label %18, label %12
12: ; preds = %10
%13 = zext i32 %8 to i64
%14 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 %13
%15 = load i32, i32* %14
%16 = add nsw i32 %15, 1
store i32 %16, i32* %14
br label %17
17: ; preds = %12, %5
br label %5
18: ; preds = %10
%19 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%20 = load i32, i32* %19
%21 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 1
%22 = load i32, i32* %21
%23 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 2
%24 = load i32, i32* %23
%25 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0), i32 %20, i32 %22, i32 %24)
ret i32 0
}