#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, int);
int /*<<< orphan*/ scanf(char *, int *, ...);
int main() {
  int pol_position, position, max_sum, sum, previous, next;
  scanf("%d%d", &previous, &next);
  pol_position = position = 2;
  max_sum = sum = previous + next;
  while (1) {
    if (previous < 0 && next < 0) {
      break;
    }
    sum = previous + next;
    if (sum > max_sum) {
      max_sum = sum;
      pol_position = position;
    }
    previous = next;
    scanf("%d", &next);
    position++;
  }
  if (position > 2)
    printf("Broevite se na pozicii %d i %d i nivnata suma e %d",
           pol_position - 1, pol_position, max_sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x2,-0xc(%rbp)
movl   $0x2,-0x8(%rbp)
mov    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1178 <main+0x58>
cmpl   $0x0,-0x1c(%rbp)
jge    1178 <main+0x58>
jmp    11bf <main+0x9f>
mov    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    1199 <main+0x79>
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
lea    0xe8f(%rip),%rdi
lea    -0x1c(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115f <main+0x3f>
cmpl   $0x2,-0xc(%rbp)
jle    11e1 <main+0xc1>
mov    -0x8(%rbp),%esi
sub    $0x1,%esi
mov    -0x8(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe29(%rip),%rdi
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   %r13
push   %r12
push   %rbx
push   %rax
lea    0xece(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
mov    (%rsp),%ecx
mov    %eax,%r13d
and    %ecx,%r13d
js     11bc <main+0x9c>
shr    $0x1f,%r13d
lea    (%rcx,%rax,1),%ebx
mov    $0x2,%ebp
lea    0xed2(%rip),%r15
mov    %rsp,%r12
mov    $0x2,%r14d
nopl   0x0(%rax)
mov    %ebx,%edx
add    %ecx,%eax
cmp    %ebx,%eax
cmovg  %ebp,%r14d
mov    %eax,%ebx
cmovle %edx,%ebx
mov    %ecx,0x4(%rsp)
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
add    $0x1,%ebp
mov    0x4(%rsp),%eax
mov    (%rsp),%ecx
test   %eax,%eax
jns    1170 <main+0x50>
test   %ecx,%ecx
jns    1170 <main+0x50>
test   %r13b,%r13b
jne    11bc <main+0x9c>
lea    -0x1(%r14),%esi
lea    0xe53(%rip),%rdi
mov    %r14d,%edx
mov    %ebx,%ecx
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 = [5 x i8] c"%d%d\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [51 x i8] c"Broevite se na pozicii %d i %d i nivnata suma e %d\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
store i32 0, i32* %1
%8 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %6, i32* %7)
store i32 2, i32* %3
store i32 2, i32* %2
%9 = load i32, i32* %6
%10 = load i32, i32* %7
%11 = add nsw i32 %9, %10
store i32 %11, i32* %5
store i32 %11, i32* %4
br label %12
12: ; preds = %0, %29
%13 = load i32, i32* %6
%14 = icmp slt i32 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = load i32, i32* %7
%17 = icmp slt i32 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %15
br label %34
19: ; preds = %15, %12
%20 = load i32, i32* %6
%21 = load i32, i32* %7
%22 = add nsw i32 %20, %21
store i32 %22, i32* %5
%23 = load i32, i32* %5
%24 = load i32, i32* %4
%25 = icmp sgt i32 %23, %24
br i1 %25, label %26, label %29
26: ; preds = %19
%27 = load i32, i32* %5
store i32 %27, i32* %4
%28 = load i32, i32* %3
store i32 %28, i32* %2
br label %29
29: ; preds = %26, %19
%30 = load i32, i32* %7
store i32 %30, i32* %6
%31 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%32 = load i32, i32* %3
%33 = add nsw i32 %32, 1
store i32 %33, i32* %3
br label %12
34: ; preds = %18
%35 = load i32, i32* %3
%36 = icmp sgt i32 %35, 2
br i1 %36, label %37, label %43
37: ; preds = %34
%38 = load i32, i32* %2
%39 = sub nsw i32 %38, 1
%40 = load i32, i32* %2
%41 = load i32, i32* %4
%42 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0), i32 %39, i32 %40, i32 %41)
br label %43
43: ; preds = %37, %34
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%d%d\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [51 x i8] c"Broevite se na pozicii %d i %d i nivnata suma e %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = load i32, i32* %2
%8 = icmp slt i32 %6, 0
%9 = icmp slt i32 %7, 0
%10 = select i1 %8, i1 %9, i1 false
br i1 %10, label %34, label %11
11: ; preds = %0
%12 = add nsw i32 %7, %6
br label %13
13: ; preds = %11, %13
%14 = phi i32 [ %27, %13 ], [ %7, %11 ]
%15 = phi i32 [ %25, %13 ], [ %6, %11 ]
%16 = phi i32 [ %22, %13 ], [ %12, %11 ]
%17 = phi i32 [ %24, %13 ], [ 2, %11 ]
%18 = phi i32 [ %21, %13 ], [ 2, %11 ]
%19 = add nsw i32 %14, %15
%20 = icmp sgt i32 %19, %16
%21 = select i1 %20, i32 %17, i32 %18
%22 = select i1 %20, i32 %19, i32 %16
store i32 %14, i32* %1
%23 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%24 = add nuw nsw i32 %17, 1
%25 = load i32, i32* %1
%26 = icmp slt i32 %25, 0
%27 = load i32, i32* %2
%28 = icmp slt i32 %27, 0
%29 = select i1 %26, i1 %28, i1 false
br i1 %29, label %30, label %13
30: ; preds = %13
br i1 %10, label %34, label %31
31: ; preds = %30
%32 = add nsw i32 %21, -1
%33 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0), i32 %32, i32 %21, i32 %22)
br label %34
34: ; preds = %0, %31, %30
ret i32 0
}