#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 scanf(char *, int *);
int main() {
  int n, i, a1[14], a2[14], j, k = 1, sum;
  while (scanf("%d", &n) == 1) {
    if (n < 0)
      break;
    sum = n;
    for (j = 0; j < 12; j++)
      scanf("%d", &a1[j]);
    for (j = 0; j < 12; j++)
      scanf("%d", &a2[j]);
    printf("Case %d:\n", k);
    for (j = 0; j < 12; j++) {
      if (sum >= a2[j]) {
        printf("No problem! :D\n");
        sum -= a2[j];
      } else
        printf("No problem. :(\n");
      sum += a1[j];
    }
    k++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x98(%rbp)
lea    0xebd(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    12c3 <main+0x1a3>
cmpl   $0x0,-0x8(%rbp)
jge    1164 <main+0x44>
jmp    12c3 <main+0x1a3>
mov    -0x8(%rbp),%eax
mov    %eax,-0x9c(%rbp)
movl   $0x0,-0x94(%rbp)
cmpl   $0xc,-0x94(%rbp)
jge    11b6 <main+0x96>
movslq -0x94(%rbp),%rax
lea    -0x50(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe63(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    1177 <main+0x57>
movl   $0x0,-0x94(%rbp)
cmpl   $0xc,-0x94(%rbp)
jge    1202 <main+0xe2>
movslq -0x94(%rbp),%rax
lea    -0x90(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe17(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    11c0 <main+0xa0>
mov    -0x98(%rbp),%esi
lea    0xdf4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x94(%rbp)
cmpl   $0xc,-0x94(%rbp)
jge    12af <main+0x18f>
mov    -0x9c(%rbp),%eax
movslq -0x94(%rbp),%rcx
cmp    -0x90(%rbp,%rcx,4),%eax
jl     1276 <main+0x156>
lea    0xdbf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x94(%rbp),%rax
mov    -0x90(%rbp,%rax,4),%ecx
mov    -0x9c(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x9c(%rbp)
jmp    1284 <main+0x164>
lea    0xda0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x94(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%eax
add    -0x9c(%rbp),%eax
mov    %eax,-0x9c(%rbp)
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    1220 <main+0x100>
mov    -0x98(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x98(%rbp)
jmp    113c <main+0x1c>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
lea    0xeb8(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    1334 <main+0x204>
mov    0xc(%rsp),%r12d
test   %r12d,%r12d
js     1334 <main+0x204>
mov    $0x1,%r13d
lea    0xe8a(%rip),%rbp
lea    0xe90(%rip),%rbx
lea    0xe98(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbp,%rdi
lea    0x50(%rsp),%rsi
call   1050 <scanf@plt>
mov    %rbp,%rdi
lea    0x54(%rsp),%rsi
call   1050 <scanf@plt>
mov    %rbp,%rdi
lea    0x58(%rsp),%rsi
call   1050 <scanf@plt>
mov    %rbp,%rdi
lea    0x5c(%rsp),%rsi
call   1050 <scanf@plt>
mov    %rbp,%rdi
lea    0x60(%rsp),%rsi
call   1050 <scanf@plt>
mov    %rbp,%rdi
lea    0x64(%rsp),%rsi
call   1050 <scanf@plt>
mov    %rbp,%rdi
lea    0x68(%rsp),%rsi
call   1050 <scanf@plt>
mov    %rbp,%rdi
lea    0x6c(%rsp),%rsi
call   1050 <scanf@plt>
mov    %rbp,%rdi
lea    0x70(%rsp),%rsi
call   1050 <scanf@plt>
mov    %rbp,%rdi
lea    0x74(%rsp),%rsi
call   1050 <scanf@plt>
mov    %rbp,%rdi
lea    0x78(%rsp),%rsi
call   1050 <scanf@plt>
mov    %rbp,%rdi
lea    0x7c(%rsp),%rsi
call   1050 <scanf@plt>
mov    %rbp,%rdi
lea    0x10(%rsp),%rsi
call   1050 <scanf@plt>
mov    %rbp,%rdi
lea    0x14(%rsp),%rsi
call   1050 <scanf@plt>
mov    %rbp,%rdi
lea    0x18(%rsp),%rsi
call   1050 <scanf@plt>
mov    %rbp,%rdi
lea    0x1c(%rsp),%rsi
call   1050 <scanf@plt>
mov    %rbp,%rdi
lea    0x20(%rsp),%rsi
call   1050 <scanf@plt>
mov    %rbp,%rdi
lea    0x24(%rsp),%rsi
call   1050 <scanf@plt>
mov    %rbp,%rdi
lea    0x28(%rsp),%rsi
call   1050 <scanf@plt>
mov    %rbp,%rdi
lea    0x2c(%rsp),%rsi
call   1050 <scanf@plt>
mov    %rbp,%rdi
lea    0x30(%rsp),%rsi
call   1050 <scanf@plt>
mov    %rbp,%rdi
lea    0x34(%rsp),%rsi
call   1050 <scanf@plt>
mov    %rbp,%rdi
lea    0x38(%rsp),%rsi
call   1050 <scanf@plt>
mov    %rbp,%rdi
lea    0x3c(%rsp),%rsi
call   1050 <scanf@plt>
lea    0xd34(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %r14d,%r14d
jmp    12f7 <main+0x1c7>
xchg   %ax,%ax
mov    %rbx,%rdi
call   1030 <puts@plt>
add    0x50(%rsp,%r14,4),%r12d
add    $0x1,%r14
cmp    $0xc,%r14
je     1310 <main+0x1e0>
cmp    0x10(%rsp,%r14,4),%r12d
jl     12e0 <main+0x1b0>
mov    %r15,%rdi
call   1030 <puts@plt>
sub    0x10(%rsp,%r14,4),%r12d
jmp    12e8 <main+0x1b8>
nopl   (%rax)
mov    %rbp,%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    1334 <main+0x204>
add    $0x1,%r13d
mov    0xc(%rsp),%r12d
test   %r12d,%r12d
jns    1190 <main+0x60>
xor    %eax,%eax
add    $0x88,%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 = [10 x i8] c"Case %d:\0A\00"
@.str.2 = [16 x i8] c"No problem! :D\0A\00"
@.str.3 = [16 x i8] c"No problem. :(\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [14 x i32]
%5 = alloca [14 x i32]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %7
br label %9
9: ; preds = %74, %0
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %77
12: ; preds = %9
%13 = load i32, i32* %2
%14 = icmp slt i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %12
br label %77
16: ; preds = %12
%17 = load i32, i32* %2
store i32 %17, i32* %8
store i32 0, i32* %6
br label %18
18: ; preds = %26, %16
%19 = load i32, i32* %6
%20 = icmp slt i32 %19, 12
br i1 %20, label %21, label %29
21: ; preds = %18
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [14 x i32], [14 x i32]* %4, i64 0, i64 %23
%25 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %24)
br label %26
26: ; preds = %21
%27 = load i32, i32* %6
%28 = add nsw i32 %27, 1
store i32 %28, i32* %6
br label %18
29: ; preds = %18
store i32 0, i32* %6
br label %30
30: ; preds = %38, %29
%31 = load i32, i32* %6
%32 = icmp slt i32 %31, 12
br i1 %32, label %33, label %41
33: ; preds = %30
%34 = load i32, i32* %6
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [14 x i32], [14 x i32]* %5, i64 0, i64 %35
%37 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %36)
br label %38
38: ; preds = %33
%39 = load i32, i32* %6
%40 = add nsw i32 %39, 1
store i32 %40, i32* %6
br label %30
41: ; preds = %30
%42 = load i32, i32* %7
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %42)
store i32 0, i32* %6
br label %44
44: ; preds = %71, %41
%45 = load i32, i32* %6
%46 = icmp slt i32 %45, 12
br i1 %46, label %47, label %74
47: ; preds = %44
%48 = load i32, i32* %8
%49 = load i32, i32* %6
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [14 x i32], [14 x i32]* %5, i64 0, i64 %50
%52 = load i32, i32* %51
%53 = icmp sge i32 %48, %52
br i1 %53, label %54, label %62
54: ; preds = %47
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%56 = load i32, i32* %6
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [14 x i32], [14 x i32]* %5, i64 0, i64 %57
%59 = load i32, i32* %58
%60 = load i32, i32* %8
%61 = sub nsw i32 %60, %59
store i32 %61, i32* %8
br label %64
62: ; preds = %47
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %64
64: ; preds = %62, %54
%65 = load i32, i32* %6
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [14 x i32], [14 x i32]* %4, i64 0, i64 %66
%68 = load i32, i32* %67
%69 = load i32, i32* %8
%70 = add nsw i32 %69, %68
store i32 %70, i32* %8
br label %71
71: ; preds = %64
%72 = load i32, i32* %6
%73 = add nsw i32 %72, 1
store i32 %73, i32* %6
br label %44
74: ; preds = %44
%75 = load i32, i32* %7
%76 = add nsw i32 %75, 1
store i32 %76, i32* %7
br label %9
77: ; preds = %15, %9
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [10 x i8] c"Case %d:\0A\00"
@str = [15 x i8] c"No problem. :(\00"
@str.4 = [15 x i8] c"No problem! :D\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [14 x i32]
%3 = alloca [14 x i32]
%4 = bitcast i32* %1 to i8*
%5 = bitcast [14 x i32]* %2 to i8*
%6 = bitcast [14 x i32]* %3 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = icmp ne i32 %7, 1
%9 = load i32, i32* %1
%10 = icmp slt i32 %9, 0
%11 = select i1 %8, i1 true, i1 %10
br i1 %11, label %91, label %12
12: ; preds = %0
%13 = getelementptr inbounds [14 x i32], [14 x i32]* %2, i64 0, i64 0
%14 = getelementptr inbounds [14 x i32], [14 x i32]* %2, i64 0, i64 1
%15 = getelementptr inbounds [14 x i32], [14 x i32]* %2, i64 0, i64 2
%16 = getelementptr inbounds [14 x i32], [14 x i32]* %2, i64 0, i64 3
%17 = getelementptr inbounds [14 x i32], [14 x i32]* %2, i64 0, i64 4
%18 = getelementptr inbounds [14 x i32], [14 x i32]* %2, i64 0, i64 5
%19 = getelementptr inbounds [14 x i32], [14 x i32]* %2, i64 0, i64 6
%20 = getelementptr inbounds [14 x i32], [14 x i32]* %2, i64 0, i64 7
%21 = getelementptr inbounds [14 x i32], [14 x i32]* %2, i64 0, i64 8
%22 = getelementptr inbounds [14 x i32], [14 x i32]* %2, i64 0, i64 9
%23 = getelementptr inbounds [14 x i32], [14 x i32]* %2, i64 0, i64 10
%24 = getelementptr inbounds [14 x i32], [14 x i32]* %2, i64 0, i64 11
%25 = getelementptr inbounds [14 x i32], [14 x i32]* %3, i64 0, i64 0
%26 = getelementptr inbounds [14 x i32], [14 x i32]* %3, i64 0, i64 1
%27 = getelementptr inbounds [14 x i32], [14 x i32]* %3, i64 0, i64 2
%28 = getelementptr inbounds [14 x i32], [14 x i32]* %3, i64 0, i64 3
%29 = getelementptr inbounds [14 x i32], [14 x i32]* %3, i64 0, i64 4
%30 = getelementptr inbounds [14 x i32], [14 x i32]* %3, i64 0, i64 5
%31 = getelementptr inbounds [14 x i32], [14 x i32]* %3, i64 0, i64 6
%32 = getelementptr inbounds [14 x i32], [14 x i32]* %3, i64 0, i64 7
%33 = getelementptr inbounds [14 x i32], [14 x i32]* %3, i64 0, i64 8
%34 = getelementptr inbounds [14 x i32], [14 x i32]* %3, i64 0, i64 9
%35 = getelementptr inbounds [14 x i32], [14 x i32]* %3, i64 0, i64 10
%36 = getelementptr inbounds [14 x i32], [14 x i32]* %3, i64 0, i64 11
br label %37
37: ; preds = %12, %84
%38 = phi i32 [ %88, %84 ], [ %9, %12 ]
%39 = phi i32 [ %85, %84 ], [ 1, %12 ]
%40 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %13)
%41 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %14)
%42 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %15)
%43 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %16)
%44 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %17)
%45 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %18)
%46 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %19)
%47 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %20)
%48 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %21)
%49 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %22)
%50 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %23)
%51 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %24)
%52 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %25)
%53 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %26)
%54 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %27)
%55 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %28)
%56 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %29)
%57 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %30)
%58 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %31)
%59 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %32)
%60 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %33)
%61 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %34)
%62 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %35)
%63 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %36)
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %39)
br label %65
65: ; preds = %37, %77
%66 = phi i64 [ 0, %37 ], [ %82, %77 ]
%67 = phi i32 [ %38, %37 ], [ %81, %77 ]
%68 = getelementptr inbounds [14 x i32], [14 x i32]* %3, i64 0, i64 %66
%69 = load i32, i32* %68
%70 = icmp slt i32 %67, %69
br i1 %70, label %75, label %71
71: ; preds = %65
%72 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.4, i64 0, i64 0))
%73 = load i32, i32* %68
%74 = sub nsw i32 %67, %73
br label %77
75: ; preds = %65
%76 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
br label %77
77: ; preds = %75, %71
%78 = phi i32 [ %74, %71 ], [ %67, %75 ]
%79 = getelementptr inbounds [14 x i32], [14 x i32]* %2, i64 0, i64 %66
%80 = load i32, i32* %79
%81 = add nsw i32 %80, %78
%82 = add nuw nsw i64 %66, 1
%83 = icmp eq i64 %82, 12
br i1 %83, label %84, label %65
84: ; preds = %77
%85 = add nuw nsw i32 %39, 1
%86 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%87 = icmp ne i32 %86, 1
%88 = load i32, i32* %1
%89 = icmp slt i32 %88, 0
%90 = select i1 %87, i1 true, i1 %89
br i1 %90, label %91, label %37
91: ; preds = %84, %0
ret i32 0
}