#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 pow(int, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *, ...);
int main() {
  int testcases, pepermints = 0, wrappers = 0, i, uc = pow(10, 4), days;
  scanf("%d", &testcases);
  for (i = 0; i < testcases; i++) {
    scanf("%d %d", &pepermints, &wrappers);
    if (uc < pepermints || uc < wrappers) {
      return 1;
    }
    for (days = 0; days < pepermints; days++) {
      wrappers++;
      if (wrappers >= 7) {
        pepermints++;
        wrappers = 0;
      }
    }
    printf("Pepermints Will Last:%d\n", days);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    $0xa,%edi
mov    $0x4,%esi
call   1050 <pow@plt>
mov    %eax,-0x18(%rbp)
lea    0xe9d(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1224 <main+0xf4>
lea    0xe75(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     11b2 <main+0x82>
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11be <main+0x8e>
movl   $0x1,-0x4(%rbp)
jmp    1224 <main+0xf4>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1207 <main+0xd7>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x7,-0x10(%rbp)
jl     11f4 <main+0xc4>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
jmp    11f9 <main+0xc9>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11c5 <main+0x95>
mov    -0x1c(%rbp),%esi
lea    0xdf5(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1178 <main+0x48>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
movl   $0x0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
mov    $0xa,%edi
mov    $0x4,%esi
call   1050 <pow@plt>
mov    %eax,%ebx
lea    0xe9d(%rip),%rdi
xor    %ebp,%ebp
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,0x14(%rsp)
jle    120a <main+0xda>
lea    0xe7a(%rip),%r14
lea    0x10(%rsp),%r15
lea    0xc(%rsp),%r12
xor    %r13d,%r13d
jmp    11bb <main+0x8b>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ecx,0xc(%rsp)
lea    0xe5b(%rip),%rdi
call   1030 <printf@plt>
add    $0x1,%r13d
cmp    0x14(%rsp),%r13d
jge    120a <main+0xda>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x10(%rsp),%eax
mov    $0x1,%ebp
cmp    %eax,%ebx
jl     120a <main+0xda>
mov    0xc(%rsp),%ecx
cmp    %ecx,%ebx
jl     120a <main+0xda>
xor    %ebp,%ebp
mov    $0x0,%esi
test   %eax,%eax
jle    11a4 <main+0x74>
xor    %esi,%esi
jmp    1200 <main+0xd0>
nop
add    $0x1,%eax
mov    %eax,0x10(%rsp)
xor    %ecx,%ecx
add    $0x1,%esi
cmp    %eax,%esi
jge    11a0 <main+0x70>
cmp    $0x6,%ecx
jge    11f0 <main+0xc0>
add    $0x1,%ecx
jmp    11f9 <main+0xc9>
mov    %ebp,%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 = [6 x i8] c"%d %d\00"
@.str.2 = [25 x i8] c"Pepermints Will Last:%d\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
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %4
%8 = call i32 @pow(i32 10, i32 4)
store i32 %8, i32* %6
%9 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 0, i32* %5
br label %10
10: ; preds = %44, %0
%11 = load i32, i32* %5
%12 = load i32, i32* %2
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %47
14: ; preds = %10
%15 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32* %4)
%16 = load i32, i32* %6
%17 = load i32, i32* %3
%18 = icmp slt i32 %16, %17
br i1 %18, label %23, label %19
19: ; preds = %14
%20 = load i32, i32* %6
%21 = load i32, i32* %4
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %24
23: ; preds = %19, %14
store i32 1, i32* %1
br label %47
24: ; preds = %19
store i32 0, i32* %7
br label %25
25: ; preds = %38, %24
%26 = load i32, i32* %7
%27 = load i32, i32* %3
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %41
29: ; preds = %25
%30 = load i32, i32* %4
%31 = add nsw i32 %30, 1
store i32 %31, i32* %4
%32 = load i32, i32* %4
%33 = icmp sge i32 %32, 7
br i1 %33, label %34, label %37
34: ; preds = %29
%35 = load i32, i32* %3
%36 = add nsw i32 %35, 1
store i32 %36, i32* %3
store i32 0, i32* %4
br label %37
37: ; preds = %34, %29
br label %38
38: ; preds = %37
%39 = load i32, i32* %7
%40 = add nsw i32 %39, 1
store i32 %40, i32* %7
br label %25
41: ; preds = %25
%42 = load i32, i32* %7
%43 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %42)
br label %44
44: ; preds = %41
%45 = load i32, i32* %5
%46 = add nsw i32 %45, 1
store i32 %46, i32* %5
br label %10
47: ; preds = %23, %10
%48 = load i32, i32* %1
ret i32 %48
}

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