#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 main() {
  int n, id, best = -1;
  float grade, bestGrade = 0.0;
  scanf("%d", &n);
  while (n--) {
    scanf("%d%f", &id, &grade);
    if (grade >= 8 && grade > bestGrade) {
      bestGrade = grade;
      best = id;
    }
  }
  if (best != -1) {
    printf("%d\n", best);
  } else {
    printf("Minimum note not reached\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffffffff,-0x10(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
lea    0xebf(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     11b4 <main+0x94>
lea    0xe9c(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x14(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0x14(%rbp),%xmm0
movss  0xe79(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     11af <main+0x8f>
movss  -0x14(%rbp),%xmm0
ucomiss -0x18(%rbp),%xmm0
jbe    11af <main+0x8f>
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1150 <main+0x30>
cmpl   $0xffffffff,-0x10(%rbp)
je     11d4 <main+0xb4>
mov    -0x10(%rbp),%esi
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e2 <main+0xc2>
lea    0xe35(%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   %rbx
sub    $0x18,%rsp
lea    0xec3(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
subl   $0x1,0x8(%rsp)
jb     11f5 <main+0xc5>
mov    $0xffffffff,%r14d
xorps  %xmm0,%xmm0
lea    0xe9f(%rip),%r15
lea    0x14(%rsp),%rbp
lea    0x10(%rsp),%rbx
jmp    1187 <main+0x57>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
subl   $0x1,0x8(%rsp)
jb     11dc <main+0xac>
movss  %xmm0,0xc(%rsp)
mov    %r15,%rdi
mov    %rbp,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
movss  0xc(%rsp),%xmm1
movss  0x10(%rsp),%xmm0
ucomiss 0xe50(%rip),%xmm0
setae  %al
ucomiss %xmm1,%xmm0
seta   %cl
test   %cl,%al
jne    11d0 <main+0xa0>
jne    1180 <main+0x50>
jmp    11d7 <main+0xa7>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x14(%rsp),%r14d
jne    1180 <main+0x50>
movaps %xmm1,%xmm0
jmp    1180 <main+0x50>
cmp    $0xffffffff,%r14d
je     11f5 <main+0xc5>
lea    0xe23(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1201 <main+0xd1>
lea    0xe14(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%d%f\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@.str.3 = [26 x i8] c"Minimum note not reached\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca float
%6 = alloca float
store i32 0, i32* %1
store i32 -1, i32* %4
store float 0.000000e+00, float* %6
%7 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %8
8: ; preds = %23, %0
%9 = load i32, i32* %2
%10 = add nsw i32 %9, -1
store i32 %10, i32* %2
%11 = icmp ne i32 %9, 0
br i1 %11, label %12, label %24
12: ; preds = %8
%13 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %3, float* %5)
%14 = load float, float* %5
%15 = fcmp oge float %14, 8.000000e+00
br i1 %15, label %16, label %23
16: ; preds = %12
%17 = load float, float* %5
%18 = load float, float* %6
%19 = fcmp ogt float %17, %18
br i1 %19, label %20, label %23
20: ; preds = %16
%21 = load float, float* %5
store float %21, float* %6
%22 = load i32, i32* %3
store i32 %22, i32* %4
br label %23
23: ; preds = %20, %16, %12
br label %8
24: ; preds = %8
%25 = load i32, i32* %4
%26 = icmp ne i32 %25, -1
br i1 %26, label %27, label %30
27: ; preds = %24
%28 = load i32, i32* %4
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %28)
br label %32
30: ; preds = %24
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
br label %32
32: ; preds = %30, %27
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%d%f\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@str = [25 x i8] c"Minimum note not reached\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast float* %3 to i8*
%7 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
%9 = add nsw i32 %8, -1
store i32 %9, i32* %1
%10 = icmp eq i32 %8, 0
br i1 %10, label %29, label %11
11: ; preds = %0, %11
%12 = phi float [ %21, %11 ], [ 0.000000e+00, %0 ]
%13 = phi i32 [ %20, %11 ], [ -1, %0 ]
%14 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %2, float* %3)
%15 = load float, float* %3
%16 = fcmp oge float %15, 8.000000e+00
%17 = fcmp ogt float %15, %12
%18 = select i1 %16, i1 %17, i1 false
%19 = load i32, i32* %2
%20 = select i1 %18, i32 %19, i32 %13
%21 = select i1 %18, float %15, float %12
%22 = load i32, i32* %1
%23 = add nsw i32 %22, -1
store i32 %23, i32* %1
%24 = icmp eq i32 %22, 0
br i1 %24, label %25, label %11
25: ; preds = %11
%26 = icmp eq i32 %20, -1
br i1 %26, label %29, label %27
27: ; preds = %25
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %20)
br label %31
29: ; preds = %0, %25
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
br label %31
31: ; preds = %29, %27
ret i32 0
}