#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 i, n, maxPoeni, maxIndeks, f = 1;
  int pobedi, porazi, poeni, nivo;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d %d %d", &nivo, &pobedi, &porazi);
    if (nivo == 1)
      poeni = pobedi * 13 - porazi;
    if (nivo == 2)
      poeni = pobedi * 13 - porazi * 3;
    if (poeni > 0)
      printf("Dobar igrac\n");
    else
      printf("Los igrac\n");
    if (f) {
      f = 0;
      maxPoeni = poeni;
      maxIndeks = 0;
    } else if (poeni > maxPoeni) {
      maxPoeni = poeni;
      maxIndeks = i;
    }
  }
  printf("Najdobar igrac: br. %d, %d poeni\n", maxIndeks + 1, maxPoeni);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x18(%rbp)
lea    0xec9(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    121e <main+0xfe>
lea    0xe9e(%rip),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
lea    -0x20(%rbp),%rcx
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x1,-0x28(%rbp)
jne    1189 <main+0x69>
imul   $0xd,-0x1c(%rbp),%eax
sub    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x2,-0x28(%rbp)
jne    11a0 <main+0x80>
imul   $0xd,-0x1c(%rbp),%eax
imul   $0x3,-0x20(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jle    11bd <main+0x9d>
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11cb <main+0xab>
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x18(%rbp)
je     11ee <main+0xce>
movl   $0x0,-0x18(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
jmp    120b <main+0xeb>
mov    -0x24(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    1206 <main+0xe6>
mov    -0x24(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    120b <main+0xeb>
jmp    1210 <main+0xf0>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    114f <main+0x2f>
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
lea    0xdf3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%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    0xec1(%rip),%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xea8(%rip),%rdi
lea    0x8(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x10(%rsp),%eax
lea    (%rax,%rax,2),%ecx
lea    (%rax,%rcx,4),%r14d
mov    0xc(%rsp),%eax
cmpl   $0x2,0x8(%rsp)
lea    (%rax,%rax,2),%ecx
cmovne %eax,%ecx
sub    %ecx,%r14d
test   %r14d,%r14d
lea    0xea0(%rip),%rax
lea    0xe8f(%rip),%rdi
cmovg  %rax,%rdi
call   1030 <puts@plt>
mov    $0x1,%ebx
cmpl   $0x2,0x14(%rsp)
jl     1245 <main+0x115>
mov    $0x1,%r15d
lea    0x10(%rsp),%r12
lea    0xc(%rsp),%r13
xor    %ebx,%ebx
mov    %r14d,%ebp
jmp    11eb <main+0xbb>
nopl   0x0(%rax)
call   1030 <puts@plt>
cmp    %ebp,%r14d
cmovg  %r14d,%ebp
cmovg  %r15d,%ebx
add    $0x1,%r15d
cmp    0x14(%rsp),%r15d
jge    124a <main+0x11a>
lea    0xe0e(%rip),%rdi
lea    0x8(%rsp),%rsi
mov    %r12,%rdx
mov    %r13,%rcx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x8(%rsp),%eax
mov    0x10(%rsp),%ecx
lea    (%rcx,%rcx,2),%edx
lea    (%rcx,%rdx,4),%ecx
mov    0xc(%rsp),%edx
mov    %ecx,%esi
sub    %edx,%esi
cmp    $0x1,%eax
cmovne %r14d,%esi
lea    (%rdx,%rdx,2),%edx
sub    %edx,%ecx
cmp    $0x2,%eax
mov    %ecx,%r14d
cmovne %esi,%r14d
lea    0xdfe(%rip),%rdi
test   %r14d,%r14d
jg     11d0 <main+0xa0>
lea    0xde8(%rip),%rdi
jmp    11d0 <main+0xa0>
mov    %r14d,%ebp
jmp    124d <main+0x11d>
add    $0x1,%ebx
lea    0xdb5(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%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 = [9 x i8] c"%d %d %d\00"
@.str.2 = [13 x i8] c"Dobar igrac\0A\00"
@.str.3 = [11 x i8] c"Los igrac\0A\00"
@.str.4 = [34 x i8] c"Najdobar igrac: br. %d, %d poeni\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
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %6
%11 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
store i32 0, i32* %2
br label %12
12: ; preds = %55, %0
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %58
16: ; preds = %12
%17 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %10, i32* %7, i32* %8)
%18 = load i32, i32* %10
%19 = icmp eq i32 %18, 1
br i1 %19, label %20, label %25
20: ; preds = %16
%21 = load i32, i32* %7
%22 = mul nsw i32 %21, 13
%23 = load i32, i32* %8
%24 = sub nsw i32 %22, %23
store i32 %24, i32* %9
br label %25
25: ; preds = %20, %16
%26 = load i32, i32* %10
%27 = icmp eq i32 %26, 2
br i1 %27, label %28, label %34
28: ; preds = %25
%29 = load i32, i32* %7
%30 = mul nsw i32 %29, 13
%31 = load i32, i32* %8
%32 = mul nsw i32 %31, 3
%33 = sub nsw i32 %30, %32
store i32 %33, i32* %9
br label %34
34: ; preds = %28, %25
%35 = load i32, i32* %9
%36 = icmp sgt i32 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %34
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
br label %41
39: ; preds = %34
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
br label %41
41: ; preds = %39, %37
%42 = load i32, i32* %6
%43 = icmp ne i32 %42, 0
br i1 %43, label %44, label %46
44: ; preds = %41
store i32 0, i32* %6
%45 = load i32, i32* %9
store i32 %45, i32* %4
store i32 0, i32* %5
br label %54
46: ; preds = %41
%47 = load i32, i32* %9
%48 = load i32, i32* %4
%49 = icmp sgt i32 %47, %48
br i1 %49, label %50, label %53
50: ; preds = %46
%51 = load i32, i32* %9
store i32 %51, i32* %4
%52 = load i32, i32* %2
store i32 %52, i32* %5
br label %53
53: ; preds = %50, %46
br label %54
54: ; preds = %53, %44
br label %55
55: ; preds = %54
%56 = load i32, i32* %2
%57 = add nsw i32 %56, 1
store i32 %57, i32* %2
br label %12
58: ; preds = %12
%59 = load i32, i32* %5
%60 = add nsw i32 %59, 1
%61 = load i32, i32* %4
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i32 %60, i32 %61)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [9 x i8] c"%d %d %d\00"
@.str.4 = [34 x i8] c"Najdobar igrac: br. %d, %d poeni\0A\00"
@str = [10 x i8] c"Los igrac\00"
@str.5 = [12 x i8] c"Dobar igrac\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 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%10 = load i32, i32* %1
%11 = icmp sgt i32 %10, 0
%12 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %4, i32* %2, i32* %3)
%13 = load i32, i32* %4
%14 = icmp eq i32 %13, 1
%15 = load i32, i32* %2
%16 = mul nsw i32 %15, 13
%17 = load i32, i32* %3
%18 = sub nsw i32 %16, %17
%19 = select i1 %14, i32 %18, i32 undef
%20 = icmp eq i32 %13, 2
%21 = mul i32 %17, -3
%22 = add i32 %21, %16
%23 = select i1 %20, i32 %22, i32 %19
%24 = icmp sgt i32 %23, 0
%25 = select i1 %24, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @str.5, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0)
%26 = call i32 @puts(i8* dereferenceable(1) %25)
%27 = load i32, i32* %1
%28 = icmp sgt i32 %27, 1
br i1 %28, label %29, label %57
29: ; preds = %0, %29
%30 = phi i32 [ %45, %29 ], [ %23, %0 ]
%31 = phi i32 [ %51, %29 ], [ 0, %0 ]
%32 = phi i32 [ %50, %29 ], [ %23, %0 ]
%33 = phi i32 [ %52, %29 ], [ 1, %0 ]
%34 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %4, i32* %2, i32* %3)
%35 = load i32, i32* %4
%36 = icmp eq i32 %35, 1
%37 = load i32, i32* %2
%38 = mul nsw i32 %37, 13
%39 = load i32, i32* %3
%40 = sub nsw i32 %38, %39
%41 = select i1 %36, i32 %40, i32 %30
%42 = icmp eq i32 %35, 2
%43 = mul i32 %39, -3
%44 = add i32 %43, %38
%45 = select i1 %42, i32 %44, i32 %41
%46 = icmp sgt i32 %45, 0
%47 = select i1 %46, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @str.5, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0)
%48 = call i32 @puts(i8* dereferenceable(1) %47)
%49 = icmp sgt i32 %45, %32
%50 = select i1 %49, i32 %45, i32 %32
%51 = select i1 %49, i32 %33, i32 %31
%52 = add nuw nsw i32 %33, 1
%53 = load i32, i32* %1
%54 = icmp slt i32 %52, %53
br i1 %54, label %29, label %55
55: ; preds = %29
%56 = add i32 %51, 1
br label %57
57: ; preds = %55, %0
%58 = phi i32 [ %23, %0 ], [ %50, %55 ]
%59 = phi i32 [ 1, %0 ], [ %56, %55 ]
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i32 %59, i32 %58)
ret i32 0
}