#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);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main(int argc, char *args[]) {
  int i, n = 0, m = 0, a, b;
  for (i = 0; i < 7; i++) {
    scanf("%i %i", &a, &b);
    if (a + b > (n > 8 ? n : 8)) {
      n = a + b, m = i;
    }
  }
  printf("%i", ++m);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x7,-0x14(%rbp)
jge    11c4 <main+0xa4>
lea    0xea4(%rip),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x24(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x20(%rbp),%eax
add    -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
cmpl   $0x8,-0x18(%rbp)
jle    1187 <main+0x67>
mov    -0x18(%rbp),%eax
mov    %eax,-0x2c(%rbp)
jmp    1194 <main+0x74>
mov    $0x8,%eax
mov    %eax,-0x2c(%rbp)
jmp    1194 <main+0x74>
mov    -0x28(%rbp),%eax
mov    -0x2c(%rbp),%ecx
cmp    %ecx,%eax
jle    11b1 <main+0x91>
mov    -0x20(%rbp),%eax
add    -0x24(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    11b6 <main+0x96>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114b <main+0x2b>
mov    -0x1c(%rbp),%esi
add    $0x1,%esi
mov    %esi,-0x1c(%rbp)
lea    0xe2f(%rip),%rdi
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
push   %rax
lea    0xece(%rip),%r15
lea    0x4(%rsp),%rbx
mov    %rsp,%r14
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1040 <scanf@plt>
mov    (%rsp),%ebp
add    0x4(%rsp),%ebp
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1040 <scanf@plt>
mov    (%rsp),%eax
add    0x4(%rsp),%eax
xor    %ebx,%ebx
cmp    $0x9,%ebp
cmovge %ebp,%ebx
mov    $0x8,%ecx
cmovl  %ecx,%ebp
xor    %r12d,%r12d
cmp    %ebp,%eax
setg   %r12b
cmovg  %eax,%ebx
mov    %r15,%rdi
lea    0x4(%rsp),%rsi
mov    %r14,%rdx
mov    %r14,%r13
call   1040 <scanf@plt>
mov    (%rsp),%ebp
add    0x4(%rsp),%ebp
cmp    $0x9,%ebx
mov    $0x8,%r14d
cmovge %ebx,%r14d
mov    %r15,%rdi
lea    0x4(%rsp),%rsi
mov    %r13,%rdx
call   1040 <scanf@plt>
mov    (%rsp),%r15d
add    0x4(%rsp),%r15d
add    $0x1,%r12d
cmp    %r14d,%ebp
cmovle %ebx,%ebp
mov    $0x3,%r14d
cmovle %r12d,%r14d
cmp    $0x9,%ebp
mov    $0x8,%ebx
cmovge %ebp,%ebx
lea    0xe1a(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsi,%r13
mov    %rsp,%rdx
call   1040 <scanf@plt>
mov    (%rsp),%r12d
add    0x4(%rsp),%r12d
cmp    %ebx,%r15d
cmovg  %r15d,%ebp
mov    $0x4,%r15d
cmovle %r14d,%r15d
cmp    $0x9,%ebp
mov    $0x8,%ebx
cmovge %ebp,%ebx
lea    0xdde(%rip),%rdi
mov    %r13,%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
mov    (%rsp),%r14d
add    0x4(%rsp),%r14d
cmp    %ebx,%r12d
cmovg  %r12d,%ebp
mov    $0x5,%r12d
cmovle %r15d,%r12d
cmp    $0x9,%ebp
mov    $0x8,%ebx
cmovge %ebp,%ebx
lea    0xda7(%rip),%rdi
mov    %r13,%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
mov    (%rsp),%eax
add    0x4(%rsp),%eax
cmp    %ebx,%r14d
cmovg  %r14d,%ebp
mov    $0x6,%ecx
cmovle %r12d,%ecx
cmp    $0x9,%ebp
mov    $0x8,%edx
cmovl  %edx,%ebp
cmp    %ebp,%eax
mov    $0x7,%esi
cmovle %ecx,%esi
lea    0xd6c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"%i %i\00"
@.str.1 = [3 x i8] c"%i\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %4)
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = add nsw i32 %9, %8
%11 = icmp sgt i32 %10, 8
%12 = select i1 %11, i32 %10, i32 0
%13 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %4)
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = add nsw i32 %15, %14
%17 = select i1 %11, i32 %10, i32 8
%18 = icmp sgt i32 %16, %17
%19 = select i1 %18, i32 %16, i32 %12
%20 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %4)
%21 = load i32, i32* %3
%22 = load i32, i32* %4
%23 = add nsw i32 %22, %21
%24 = icmp sgt i32 %19, 8
%25 = select i1 %24, i32 %19, i32 8
%26 = icmp sgt i32 %23, %25
%27 = select i1 %26, i32 %23, i32 %19
%28 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %4)
%29 = load i32, i32* %3
%30 = load i32, i32* %4
%31 = add nsw i32 %30, %29
%32 = icmp sgt i32 %27, 8
%33 = select i1 %32, i32 %27, i32 8
%34 = icmp sgt i32 %31, %33
%35 = select i1 %34, i32 %31, i32 %27
%36 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %4)
%37 = load i32, i32* %3
%38 = load i32, i32* %4
%39 = add nsw i32 %38, %37
%40 = icmp sgt i32 %35, 8
%41 = select i1 %40, i32 %35, i32 8
%42 = icmp sgt i32 %39, %41
%43 = select i1 %42, i32 %39, i32 %35
%44 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %4)
%45 = load i32, i32* %3
%46 = load i32, i32* %4
%47 = add nsw i32 %46, %45
%48 = icmp sgt i32 %43, 8
%49 = select i1 %48, i32 %43, i32 8
%50 = icmp sgt i32 %47, %49
%51 = select i1 %50, i32 %47, i32 %43
%52 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %4)
%53 = load i32, i32* %3
%54 = load i32, i32* %4
%55 = add nsw i32 %54, %53
%56 = icmp sgt i32 %51, 8
%57 = select i1 %56, i32 %51, i32 8
%58 = icmp sgt i32 %55, %57
%59 = select i1 %18, i32 2, i32 1
%60 = select i1 %26, i32 3, i32 %59
%61 = select i1 %34, i32 4, i32 %60
%62 = select i1 %42, i32 5, i32 %61
%63 = select i1 %50, i32 6, i32 %62
%64 = select i1 %58, i32 7, i32 %63
%65 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %64)
ret i32 0
}