#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 *, int *, int *);
int main(void) {
  int trab1, trab2, trab3, freq, nota, Nota;
  printf(
      "Insira suas notas, trabalho e frequência (aka número de faltas): \n ");
  scanf("%d %d %d %d", &trab1, &trab2, &trab3, &freq);
  nota = (trab1 * 3 + trab2 * 5 + trab3 * 2) / 10;
  if (freq > 15)
    printf("Vc foi reprovado \n");
  else if (nota < 6)
    printf("Vc terá que fazer prova final aka 'Recu' \n ");
  else if (nota > 6)
    printf("Yay, vc foi aprovado \n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xf04(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
call   1040 <scanf@plt>
imul   $0x3,-0x8(%rbp),%eax
imul   $0x5,-0xc(%rbp),%ecx
add    %ecx,%eax
mov    -0x10(%rbp),%ecx
shl    $0x1,%ecx
add    %ecx,%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
cmpl   $0xf,-0x14(%rbp)
jle    118f <main+0x6f>
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
jmp    11ca <main+0xaa>
cmpl   $0x6,-0x18(%rbp)
jge    11aa <main+0x8a>
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
jmp    11c5 <main+0xa5>
cmpl   $0x6,-0x18(%rbp)
jle    11c0 <main+0xa0>
lea    0xed7(%rip),%rdi
call   1030 <printf@plt>
jmp    11c5 <main+0xa5>
jmp    11ca <main+0xaa>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xec5(%rip),%rdi
call   1040 <printf@plt>
lea    0xeff(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0x8(%rsp),%r8
call   1050 <scanf@plt>
cmpl   $0x10,0x8(%rsp)
jl     1170 <main+0x40>
lea    0xf27(%rip),%rdi
jmp    11a6 <main+0x76>
mov    0x14(%rsp),%eax
lea    (%rax,%rax,2),%eax
mov    0x10(%rsp),%ecx
lea    (%rcx,%rcx,4),%ecx
add    %eax,%ecx
mov    0xc(%rsp),%eax
lea    (%rcx,%rax,2),%eax
cmp    $0x3b,%eax
jg     119a <main+0x6a>
lea    0xebf(%rip),%rdi
call   1040 <printf@plt>
jmp    11ab <main+0x7b>
cmp    $0x46,%eax
jb     11ab <main+0x7b>
lea    0xed9(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [70 x i8] c"Insira suas notas, trabalho e frequ\C3\AAncia (aka n\C3\BAmero de faltas): \0A \00"
@.str.1 = [12 x i8] c"%d %d %d %d\00"
@.str.2 = [19 x i8] c"Vc foi reprovado \0A\00"
@.str.3 = [45 x i8] c"Vc ter\C3\A1 que fazer prova final aka 'Recu' \0A \00"
@.str.4 = [23 x i8] c"Yay, vc foi aprovado \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
store i32 0, i32* %1
%8 = call i32 @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3, i32* %4, i32* %5)
%10 = load i32, i32* %2
%11 = mul nsw i32 %10, 3
%12 = load i32, i32* %3
%13 = mul nsw i32 %12, 5
%14 = add nsw i32 %11, %13
%15 = load i32, i32* %4
%16 = mul nsw i32 %15, 2
%17 = add nsw i32 %14, %16
%18 = sdiv i32 %17, 10
store i32 %18, i32* %6
%19 = load i32, i32* %5
%20 = icmp sgt i32 %19, 15
br i1 %20, label %21, label %23
21: ; preds = %0
%22 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
br label %35
23: ; preds = %0
%24 = load i32, i32* %6
%25 = icmp slt i32 %24, 6
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0))
br label %34
28: ; preds = %23
%29 = load i32, i32* %6
%30 = icmp sgt i32 %29, 6
br i1 %30, label %31, label %33
31: ; preds = %28
%32 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
br label %33
33: ; preds = %31, %28
br label %34
34: ; preds = %33, %26
br label %35
35: ; preds = %34, %21
ret i32 0
}

LLVM IR (-O2):
@.str = [70 x i8] c"Insira suas notas, trabalho e frequ\C3\AAncia (aka n\C3\BAmero de faltas): \0A \00"
@.str.1 = [12 x i8] c"%d %d %d %d\00"
@.str.3 = [45 x i8] c"Vc ter\C3\A1 que fazer prova final aka 'Recu' \0A \00"
@str = [22 x i8] c"Yay, vc foi aprovado \00"
@str.5 = [18 x i8] c"Vc foi reprovado \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2, i32* %3, i32* %4)
%11 = load i32, i32* %1
%12 = mul nsw i32 %11, 3
%13 = load i32, i32* %2
%14 = mul nsw i32 %13, 5
%15 = add nsw i32 %14, %12
%16 = load i32, i32* %3
%17 = shl nsw i32 %16, 1
%18 = add nsw i32 %15, %17
%19 = load i32, i32* %4
%20 = icmp sgt i32 %19, 15
br i1 %20, label %21, label %23
21: ; preds = %0
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.5, i64 0, i64 0))
br label %31
23: ; preds = %0
%24 = icmp slt i32 %18, 60
br i1 %24, label %25, label %27
25: ; preds = %23
%26 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0))
br label %31
27: ; preds = %23
%28 = icmp ugt i32 %18, 69
br i1 %28, label %29, label %31
29: ; preds = %27
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
br label %31
31: ; preds = %25, %29, %27, %21
ret i32 0
}