#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 main(int argc, char *argv[]) {
  int i, j, n = 0, m = 0;
  for (i = 0; i < 12; ++i) {
    scanf("%i", &j);
    n += 300 - j;
    if (n < 0) {
      printf("-%i", ++i);
      return 0;
    }
    m += n / 100;
    n %= 100;
  }
  printf("%i", m * 120 + n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0xc,-0x14(%rbp)
jge    11cb <main+0xab>
lea    0xea5(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
mov    $0x12c,%eax
sub    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    119e <main+0x7e>
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    %esi,-0x14(%rbp)
lea    0xe73(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11e5 <main+0xc5>
mov    -0x1c(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
add    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114b <main+0x2b>
imul   $0x78,-0x20(%rbp),%esi
add    -0x1c(%rbp),%esi
lea    0xe28(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
xor    %r12d,%r12d
mov    $0x1,%ebx
lea    0xec6(%rip),%r14
lea    0xc(%rsp),%r15
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
sub    0xc(%rsp),%ebp
add    $0x12c,%ebp
js     1193 <main+0x73>
mov    %ebp,%eax
imul   $0x51eb851f,%rax,%rax
shr    $0x25,%rax
add    %eax,%r12d
imul   $0x64,%eax,%eax
sub    %eax,%ebp
add    $0x1,%ebx
cmp    $0xd,%ebx
jne    1150 <main+0x30>
imul   $0x78,%r12d,%esi
add    %ebp,%esi
lea    0xe70(%rip),%rdi
jmp    119c <main+0x7c>
lea    0xe66(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%i\00"
@.str.1 = [4 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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %6
br label %10
10: ; preds = %32, %2
%11 = load i32, i32* %6
%12 = icmp slt i32 %11, 12
br i1 %12, label %13, label %35
13: ; preds = %10
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %7)
%15 = load i32, i32* %7
%16 = sub nsw i32 300, %15
%17 = load i32, i32* %8
%18 = add nsw i32 %17, %16
store i32 %18, i32* %8
%19 = load i32, i32* %8
%20 = icmp slt i32 %19, 0
br i1 %20, label %21, label %25
21: ; preds = %13
%22 = load i32, i32* %6
%23 = add nsw i32 %22, 1
store i32 %23, i32* %6
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %23)
store i32 0, i32* %3
br label %41
25: ; preds = %13
%26 = load i32, i32* %8
%27 = sdiv i32 %26, 100
%28 = load i32, i32* %9
%29 = add nsw i32 %28, %27
store i32 %29, i32* %9
%30 = load i32, i32* %8
%31 = srem i32 %30, 100
store i32 %31, i32* %8
br label %32
32: ; preds = %25
%33 = load i32, i32* %6
%34 = add nsw i32 %33, 1
store i32 %34, i32* %6
br label %10
35: ; preds = %10
%36 = load i32, i32* %9
%37 = mul nsw i32 %36, 120
%38 = load i32, i32* %8
%39 = add nsw i32 %37, %38
%40 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %39)
store i32 0, i32* %3
br label %41
41: ; preds = %35, %21
%42 = load i32, i32* %3
ret i32 %42
}

LLVM IR (-O2):
@.str = [3 x i8] c"%i\00"
@.str.1 = [4 x i8] c"-%i\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
br label %5
5: ; preds = %2, %17
%6 = phi i32 [ 0, %2 ], [ %19, %17 ]
%7 = phi i32 [ 0, %2 ], [ %20, %17 ]
%8 = phi i32 [ 0, %2 ], [ %21, %17 ]
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%10 = load i32, i32* %3
%11 = sub nsw i32 300, %10
%12 = add nsw i32 %11, %7
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %5
%15 = add nuw nsw i32 %8, 1
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %15)
br label %27
17: ; preds = %5
%18 = udiv i32 %12, 100
%19 = add nuw nsw i32 %18, %6
%20 = urem i32 %12, 100
%21 = add nuw nsw i32 %8, 1
%22 = icmp eq i32 %21, 12
br i1 %22, label %23, label %5
23: ; preds = %17
%24 = mul nsw i32 %19, 120
%25 = add nuw nsw i32 %24, %20
%26 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %25)
br label %27
27: ; preds = %23, %14
ret i32 0
}