#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 */
scalar_t__ EOF;
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ scanf(char *, ...);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main() {
  char current_name[21], failed_name[21];
  int current_score, failed_score;
  int n, i;
  int t = 0;
  while (scanf("%d", &n) != EOF) {
    scanf("%s %d", failed_name, &failed_score);
    for (i = 1; i < n; i++) {
      scanf("%s %d", current_name, &current_score);
      if (failed_score > current_score ||
          ((failed_score == current_score) &&
           (strcmp(failed_name, current_name) < 0))) {
        strcpy(failed_name, current_name);
        failed_score = current_score;
      }
    }
    printf("Instancia %d\n", ++t);
    printf("%s\n\n", failed_name);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x54(%rbp)
lea    0xea6(%rip),%rdi
lea    -0x4c(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    0x2e79(%rip),%rcx
cmp    (%rcx),%rax
je     123a <main+0xfa>
lea    -0x40(%rbp),%rsi
lea    0xe7d(%rip),%rdi
lea    -0x48(%rbp),%rdx
mov    $0x0,%al
call   1060 <scanf@plt>
movl   $0x1,-0x50(%rbp)
mov    -0x50(%rbp),%eax
cmp    -0x4c(%rbp),%eax
jge    120c <main+0xcc>
lea    -0x20(%rbp),%rsi
lea    0xe54(%rip),%rdi
lea    -0x44(%rbp),%rdx
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0x48(%rbp),%eax
cmp    -0x44(%rbp),%eax
jg     11e6 <main+0xa6>
mov    -0x48(%rbp),%eax
cmp    -0x44(%rbp),%eax
jne    11f9 <main+0xb9>
lea    -0x40(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jge    11f9 <main+0xb9>
lea    -0x40(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x44(%rbp),%eax
mov    %eax,-0x48(%rbp)
jmp    11fe <main+0xbe>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    1195 <main+0x55>
mov    -0x54(%rbp),%esi
add    $0x1,%esi
mov    %esi,-0x54(%rbp)
lea    0xdea(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x40(%rbp),%rsi
lea    0xde6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1156 <main+0x16>
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
lea    0xeae(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0x2e80(%rip),%rcx
cmp    (%rcx),%rax
jne    117e <main+0x3e>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe7b(%rip),%r12
lea    0x10(%rsp),%r14
lea    0x30(%rsp),%rbx
lea    0xc(%rsp),%r13
xor    %ebp,%ebp
jmp    11e3 <main+0xa3>
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
lea    0xe5c(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe5a(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe38(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0x2e0a(%rip),%rcx
cmp    (%rcx),%rax
je     116d <main+0x2d>
mov    %r12,%rdi
mov    %r14,%rsi
lea    0x8(%rsp),%rdx
xor    %eax,%eax
call   1060 <scanf@plt>
cmpl   $0x2,0x4(%rsp)
jl     11a0 <main+0x60>
mov    $0x1,%r15d
jmp    1232 <main+0xf2>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    0xc(%rsp),%eax
mov    %eax,0x8(%rsp)
add    $0x1,%r15d
cmp    0x4(%rsp),%r15d
jge    11a0 <main+0x60>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    %eax,0x8(%rsp)
jg     1210 <main+0xd0>
jne    1223 <main+0xe3>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
js     1210 <main+0xd0>
jmp    1223 <main+0xe3>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@EOF = global i64 0
@.str.1 = [6 x i8] c"%s %d\00"
@.str.2 = [14 x i8] c"Instancia %d\0A\00"
@.str.3 = [5 x i8] c"%s\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [21 x i8]
%3 = alloca [21 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %8
br label %9
9: ; preds = %44, %0
%10 = call i64 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%11 = load i64, i64* @EOF
%12 = icmp ne i64 %10, %11
br i1 %12, label %13, label %50
13: ; preds = %9
%14 = getelementptr inbounds [21 x i8], [21 x i8]* %3, i64 0, i64 0
%15 = call i64 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %14, i32* %5)
store i32 1, i32* %7
br label %16
16: ; preds = %41, %13
%17 = load i32, i32* %7
%18 = load i32, i32* %6
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %44
20: ; preds = %16
%21 = getelementptr inbounds [21 x i8], [21 x i8]* %2, i64 0, i64 0
%22 = call i64 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %21, i32* %4)
%23 = load i32, i32* %5
%24 = load i32, i32* %4
%25 = icmp sgt i32 %23, %24
br i1 %25, label %35, label %26
26: ; preds = %20
%27 = load i32, i32* %5
%28 = load i32, i32* %4
%29 = icmp eq i32 %27, %28
br i1 %29, label %30, label %40
30: ; preds = %26
%31 = getelementptr inbounds [21 x i8], [21 x i8]* %3, i64 0, i64 0
%32 = getelementptr inbounds [21 x i8], [21 x i8]* %2, i64 0, i64 0
%33 = call i64 @strcmp(i8* %31, i8* %32)
%34 = icmp slt i64 %33, 0
br i1 %34, label %35, label %40
35: ; preds = %30, %20
%36 = getelementptr inbounds [21 x i8], [21 x i8]* %3, i64 0, i64 0
%37 = getelementptr inbounds [21 x i8], [21 x i8]* %2, i64 0, i64 0
%38 = call i32 @strcpy(i8* %36, i8* %37)
%39 = load i32, i32* %4
store i32 %39, i32* %5
br label %40
40: ; preds = %35, %30, %26
br label %41
41: ; preds = %40
%42 = load i32, i32* %7
%43 = add nsw i32 %42, 1
store i32 %43, i32* %7
br label %16
44: ; preds = %16
%45 = load i32, i32* %8
%46 = add nsw i32 %45, 1
store i32 %46, i32* %8
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %46)
%48 = getelementptr inbounds [21 x i8], [21 x i8]* %3, i64 0, i64 0
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %48)
br label %9
50: ; preds = %9
%51 = load i32, i32* %1
ret i32 %51
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@EOF = global i64 0
@.str.1 = [6 x i8] c"%s %d\00"
@.str.2 = [14 x i8] c"Instancia %d\0A\00"
@.str.3 = [5 x i8] c"%s\0A\0A\00"
define i32 @main() {
%1 = alloca [21 x i8]
%2 = alloca [21 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = getelementptr inbounds [21 x i8], [21 x i8]* %1, i64 0, i64 0
%7 = getelementptr inbounds [21 x i8], [21 x i8]* %2, i64 0, i64 0
%8 = bitcast i32* %3 to i8*
%9 = bitcast i32* %4 to i8*
%10 = bitcast i32* %5 to i8*
%11 = call i64 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
%12 = load i64, i64* @EOF
%13 = icmp eq i64 %11, %12
br i1 %13, label %44, label %14
14: ; preds = %0, %37
%15 = phi i32 [ %38, %37 ], [ 0, %0 ]
%16 = call i64 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %7, i32* %4)
%17 = load i32, i32* %5
%18 = icmp sgt i32 %17, 1
br i1 %18, label %19, label %37
19: ; preds = %14, %33
%20 = phi i32 [ %34, %33 ], [ 1, %14 ]
%21 = call i64 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %6, i32* %3)
%22 = load i32, i32* %4
%23 = load i32, i32* %3
%24 = icmp sgt i32 %22, %23
br i1 %24, label %30, label %25
25: ; preds = %19
%26 = icmp eq i32 %22, %23
br i1 %26, label %27, label %33
27: ; preds = %25
%28 = call i64 @strcmp(i8* %7, i8* %6)
%29 = icmp slt i64 %28, 0
br i1 %29, label %30, label %33
30: ; preds = %27, %19
%31 = call i32 @strcpy(i8* %7, i8* %6)
%32 = load i32, i32* %3
store i32 %32, i32* %4
br label %33
33: ; preds = %25, %27, %30
%34 = add nuw nsw i32 %20, 1
%35 = load i32, i32* %5
%36 = icmp slt i32 %34, %35
br i1 %36, label %19, label %37
37: ; preds = %33, %14
%38 = add nuw nsw i32 %15, 1
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %38)
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %7)
%41 = call i64 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
%42 = load i64, i64* @EOF
%43 = icmp eq i64 %41, %42
br i1 %43, label %44, label %14
44: ; preds = %37, %0
ret i32 0
}