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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x1,-0x20(%rbp)
lea    0xeae(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
cmp    $0x0,%rax
je     11d0 <main+0xb0>
cmpl   $0x1,-0x10(%rbp)
jne    117d <main+0x5d>
mov    -0x14(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    11cb <main+0xab>
cmpl   $0x2,-0x10(%rbp)
jne    1195 <main+0x75>
mov    -0x18(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    11c6 <main+0xa6>
cmpl   $0x3,-0x10(%rbp)
jne    11ad <main+0x8d>
mov    -0x1c(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    11c1 <main+0xa1>
cmpl   $0x4,-0x10(%rbp)
jne    11bc <main+0x9c>
jmp    11d0 <main+0xb0>
jmp    11c1 <main+0xa1>
jmp    11c6 <main+0xa6>
jmp    11cb <main+0xab>
jmp    114b <main+0x2b>
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xe2b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xe26(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xe23(%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
lea    0xece(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
test   %rax,%rax
je     11a6 <main+0x76>
xor    %r13d,%r13d
lea    0xeb5(%rip),%r12
lea    0x4(%rsp),%rbp
lea    0xe99(%rip),%rbx
xor    %r14d,%r14d
xor    %r15d,%r15d
jmp    1184 <main+0x54>
nop
add    $0x1,%r14d
mov    %r12,%rdi
mov    %rbp,%rsi
call   1050 <scanf@plt>
test   %rax,%rax
je     11af <main+0x7f>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x3,%eax
ja     1174 <main+0x44>
movslq (%rbx,%rax,4),%rax
add    %rbx,%rax
jmp    *%rax
add    $0x1,%r13d
jmp    1174 <main+0x44>
nop
add    $0x1,%r15d
jmp    1174 <main+0x44>
xor    %r15d,%r15d
xor    %r14d,%r14d
xor    %r13d,%r13d
lea    0xe83(%rip),%rdi
call   1030 <puts@plt>
lea    0xe51(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe4c(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe49(%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
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 1, i32* %8
br label %9
9: ; preds = %40, %0
%10 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %41
12: ; preds = %9
%13 = load i32, i32* %4
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = load i32, i32* %5
%17 = load i32, i32* %8
%18 = add nsw i32 %16, %17
store i32 %18, i32* %5
br label %40
19: ; preds = %12
%20 = load i32, i32* %4
%21 = icmp eq i32 %20, 2
br i1 %21, label %22, label %26
22: ; preds = %19
%23 = load i32, i32* %6
%24 = load i32, i32* %8
%25 = add nsw i32 %23, %24
store i32 %25, i32* %6
br label %39
26: ; preds = %19
%27 = load i32, i32* %4
%28 = icmp eq i32 %27, 3
br i1 %28, label %29, label %33
29: ; preds = %26
%30 = load i32, i32* %7
%31 = load i32, i32* %8
%32 = add nsw i32 %30, %31
store i32 %32, i32* %7
br label %38
33: ; preds = %26
%34 = load i32, i32* %4
%35 = icmp eq i32 %34, 4
br i1 %35, label %36, label %37
36: ; preds = %33
br label %41
37: ; preds = %33
br label %38
38: ; preds = %37, %29
br label %39
39: ; preds = %38, %22
br label %40
40: ; preds = %39, %15
br label %9
41: ; preds = %36, %9
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%43 = load i32, i32* %5
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %43)
%45 = load i32, i32* %6
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %45)
%47 = load i32, i32* %7
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %47)
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*
%3 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %22, label %5
5: ; preds = %0, %16
%6 = phi i32 [ %19, %16 ], [ 0, %0 ]
%7 = phi i32 [ %18, %16 ], [ 0, %0 ]
%8 = phi i32 [ %17, %16 ], [ 0, %0 ]
%9 = load i32, i32* %1
switch i32 %9, label %16 [
i32 1, label %10
i32 2, label %12
i32 3, label %14
i32 4, label %22
]
10: ; preds = %5
%11 = add nsw i32 %6, 1
br label %16
12: ; preds = %5
%13 = add nsw i32 %8, 1
br label %16
14: ; preds = %5
%15 = add nsw i32 %7, 1
br label %16
16: ; preds = %5, %12, %14, %10
%17 = phi i32 [ %8, %10 ], [ %13, %12 ], [ %8, %14 ], [ %8, %5 ]
%18 = phi i32 [ %7, %10 ], [ %7, %12 ], [ %15, %14 ], [ %7, %5 ]
%19 = phi i32 [ %11, %10 ], [ %6, %12 ], [ %6, %14 ], [ %6, %5 ]
%20 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %5
22: ; preds = %16, %5, %0
%23 = phi i32 [ 0, %0 ], [ %8, %5 ], [ %17, %16 ]
%24 = phi i32 [ 0, %0 ], [ %7, %5 ], [ %18, %16 ]
%25 = phi i32 [ 0, %0 ], [ %6, %5 ], [ %19, %16 ]
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %25)
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %23)
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %24)
ret i32 0
}