#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 main(void) {
  int m, f, r, score;
  while (1) {
    scanf("%d %d %d", &m, &f, &r);
    score = m + f;
    if (m == -1 && f == -1 && r == -1)
      break;
    if (m == -1 || f == -1) {
      printf("F\n");
    } else if (score >= 80) {
      printf("A\n");
    } else if (score >= 65) {
      printf("B\n");
    } else if (score >= 50 || (score >= 30 && r >= 50)) {
      printf("C\n");
    } else if (score >= 30) {
      printf("D\n");
    } else {
      printf("F\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jne    1173 <main+0x53>
cmpl   $0xffffffff,-0xc(%rbp)
jne    1173 <main+0x53>
cmpl   $0xffffffff,-0x10(%rbp)
jne    1173 <main+0x53>
jmp    123d <main+0x11d>
cmpl   $0xffffffff,-0x8(%rbp)
je     1187 <main+0x67>
cmpl   $0xffffffff,-0xc(%rbp)
jne    1198 <main+0x78>
lea    0xe7b(%rip),%rdi
call   1030 <printf@plt>
jmp    1238 <main+0x118>
cmpl   $0x50,-0x14(%rbp)
jl     11b3 <main+0x93>
lea    0xe63(%rip),%rdi
call   1030 <printf@plt>
jmp    1233 <main+0x113>
cmpl   $0x41,-0x14(%rbp)
jl     11ce <main+0xae>
lea    0xe4b(%rip),%rdi
call   1030 <printf@plt>
jmp    122e <main+0x10e>
cmpl   $0x32,-0x14(%rbp)
jge    11ec <main+0xcc>
cmpl   $0x1e,-0x14(%rbp)
jl     11fd <main+0xdd>
cmpl   $0x32,-0x10(%rbp)
jl     11fd <main+0xdd>
lea    0xe1f(%rip),%rdi
call   1030 <printf@plt>
jmp    1229 <main+0x109>
cmpl   $0x1e,-0x14(%rbp)
jl     1218 <main+0xf8>
lea    0xe07(%rip),%rdi
call   1030 <printf@plt>
jmp    1224 <main+0x104>
lea    0xdea(%rip),%rdi
call   1030 <printf@plt>
jmp    1229 <main+0x109>
jmp    122e <main+0x10e>
jmp    1233 <main+0x113>
jmp    1238 <main+0x118>
jmp    112f <main+0xf>
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
sub    $0x18,%rsp
lea    0xecb(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
call   1040 <scanf@plt>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%eax
cmp    $0xffffffff,%eax
sete   %dl
mov    0xc(%rsp),%ecx
cmp    $0xffffffff,%esi
sete   %bl
jne    1171 <main+0x51>
cmp    $0xffffffff,%eax
jne    1171 <main+0x51>
cmp    $0xffffffff,%ecx
je     1239 <main+0x119>
add    %esi,%eax
lea    0xe97(%rip),%rbp
lea    0xe7f(%rip),%r14
lea    0x14(%rsp),%r15
lea    0x10(%rsp),%r12
lea    0xc(%rsp),%r13
mov    %rbp,%rdi
test   $0x1,%bl
jne    11f0 <main+0xd0>
mov    %rbp,%rdi
test   $0x1,%dl
jne    11f0 <main+0xd0>
lea    0xe68(%rip),%rdi
cmp    $0x4f,%eax
jg     11f0 <main+0xd0>
lea    0xe5a(%rip),%rdi
cmp    $0x40,%eax
jg     11f0 <main+0xd0>
lea    0xe4c(%rip),%rdi
cmp    $0x31,%eax
jg     11f0 <main+0xd0>
cmp    $0x1e,%eax
jl     11d5 <main+0xb5>
lea    0xe3b(%rip),%rdi
cmp    $0x31,%ecx
jg     11f0 <main+0xd0>
lea    0xe2d(%rip),%rdi
cmp    $0x1e,%eax
jge    11f0 <main+0xd0>
mov    %rbp,%rdi
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
call   1030 <puts@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
call   1040 <scanf@plt>
mov    0x14(%rsp),%edi
mov    0x10(%rsp),%esi
lea    (%rsi,%rdi,1),%eax
cmp    $0xffffffff,%esi
sete   %dl
mov    0xc(%rsp),%ecx
cmp    $0xffffffff,%edi
sete   %bl
jne    1190 <main+0x70>
cmp    $0xffffffff,%esi
jne    1190 <main+0x70>
cmp    $0xffffffff,%ecx
jne    1190 <main+0x70>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%d %d %d\00"
@.str.1 = [3 x i8] c"F\0A\00"
@.str.2 = [3 x i8] c"A\0A\00"
@.str.3 = [3 x i8] c"B\0A\00"
@.str.4 = [3 x i8] c"C\0A\00"
@.str.5 = [3 x i8] c"D\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
br label %6
6: ; preds = %0, %60
%7 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3, i32* %4)
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = add nsw i32 %8, %9
store i32 %10, i32* %5
%11 = load i32, i32* %2
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %20
13: ; preds = %6
%14 = load i32, i32* %3
%15 = icmp eq i32 %14, -1
br i1 %15, label %16, label %20
16: ; preds = %13
%17 = load i32, i32* %4
%18 = icmp eq i32 %17, -1
br i1 %18, label %19, label %20
19: ; preds = %16
br label %61
20: ; preds = %16, %13, %6
%21 = load i32, i32* %2
%22 = icmp eq i32 %21, -1
br i1 %22, label %26, label %23
23: ; preds = %20
%24 = load i32, i32* %3
%25 = icmp eq i32 %24, -1
br i1 %25, label %26, label %28
26: ; preds = %23, %20
%27 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %60
28: ; preds = %23
%29 = load i32, i32* %5
%30 = icmp sge i32 %29, 80
br i1 %30, label %31, label %33
31: ; preds = %28
%32 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %59
33: ; preds = %28
%34 = load i32, i32* %5
%35 = icmp sge i32 %34, 65
br i1 %35, label %36, label %38
36: ; preds = %33
%37 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %58
38: ; preds = %33
%39 = load i32, i32* %5
%40 = icmp sge i32 %39, 50
br i1 %40, label %47, label %41
41: ; preds = %38
%42 = load i32, i32* %5
%43 = icmp sge i32 %42, 30
br i1 %43, label %44, label %49
44: ; preds = %41
%45 = load i32, i32* %4
%46 = icmp sge i32 %45, 50
br i1 %46, label %47, label %49
47: ; preds = %44, %38
%48 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %57
49: ; preds = %44, %41
%50 = load i32, i32* %5
%51 = icmp sge i32 %50, 30
br i1 %51, label %52, label %54
52: ; preds = %49
%53 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %56
54: ; preds = %49
%55 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %56
56: ; preds = %54, %52
br label %57
57: ; preds = %56, %47
br label %58
58: ; preds = %57, %36
br label %59
59: ; preds = %58, %31
br label %60
60: ; preds = %59, %26
br label %6
61: ; preds = %19
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"%d %d %d\00"
@str.6 = [2 x i8] c"D\00"
@str.7 = [2 x i8] c"C\00"
@str.8 = [2 x i8] c"B\00"
@str.9 = [2 x i8] c"A\00"
@str.10 = [2 x i8] c"F\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%8 = load i32, i32* %1
%9 = load i32, i32* %2
%10 = icmp eq i32 %8, -1
%11 = icmp eq i32 %9, -1
%12 = select i1 %10, i1 %11, i1 false
%13 = load i32, i32* %3
%14 = icmp eq i32 %13, -1
%15 = select i1 %12, i1 %14, i1 false
br i1 %15, label %49, label %16
16: ; preds = %0
%17 = add nsw i32 %9, %8
br label %18
18: ; preds = %16, %36
%19 = phi i32 [ %46, %36 ], [ %13, %16 ]
%20 = phi i1 [ %44, %36 ], [ %11, %16 ]
%21 = phi i1 [ %43, %36 ], [ %10, %16 ]
%22 = phi i32 [ %42, %36 ], [ %17, %16 ]
%23 = select i1 %21, i1 true, i1 %20
br i1 %23, label %36, label %24
24: ; preds = %18
%25 = icmp sgt i32 %22, 79
br i1 %25, label %36, label %26
26: ; preds = %24
%27 = icmp sgt i32 %22, 64
br i1 %27, label %36, label %28
28: ; preds = %26
%29 = icmp sgt i32 %22, 49
br i1 %29, label %36, label %30
30: ; preds = %28
%31 = icmp sgt i32 %22, 29
%32 = icmp sgt i32 %19, 49
%33 = select i1 %31, i1 %32, i1 false
br i1 %33, label %36, label %34
34: ; preds = %30
%35 = select i1 %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @str.6, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @str.10, i64 0, i64 0)
br label %36
36: ; preds = %34, %28, %30, %26, %24, %18
%37 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.10, i64 0, i64 0), %18 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.9, i64 0, i64 0), %24 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.8, i64 0, i64 0), %26 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.7, i64 0, i64 0), %30 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.7, i64 0, i64 0), %28 ], [ %35, %34 ]
%38 = call i32 @puts(i8* dereferenceable(1) %37)
%39 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%40 = load i32, i32* %1
%41 = load i32, i32* %2
%42 = add nsw i32 %41, %40
%43 = icmp eq i32 %40, -1
%44 = icmp eq i32 %41, -1
%45 = select i1 %43, i1 %44, i1 false
%46 = load i32, i32* %3
%47 = icmp eq i32 %46, -1
%48 = select i1 %45, i1 %47, i1 false
br i1 %48, label %49, label %18
49: ; preds = %36, %0
ret i32 0
}