#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 force3(int, int, int, int);
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ scanf(char *, int *, int *, int *, int *);
int main(void) {
  int p, e, i, d;
  int next;
  int count = 0;
  while (1) {
    scanf("%d %d %d %d", &p, &e, &i, &d);
    if (p == -1 && e == -1 && i == -1 && d == -1)
      break;
    next = force3(p, e, i, d);
    printf("Case %d: the next triple peak occurs in %d days.\n", ++count, next);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xeb3(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
call   1040 <scanf@plt>
cmpl   $0xffffffff,-0x8(%rbp)
jne    118f <main+0x5f>
cmpl   $0xffffffff,-0xc(%rbp)
jne    118f <main+0x5f>
cmpl   $0xffffffff,-0x10(%rbp)
jne    118f <main+0x5f>
cmpl   $0xffffffff,-0x14(%rbp)
jne    118f <main+0x5f>
jmp    11c0 <main+0x90>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1050 <force3@plt>
mov    %eax,-0x18(%rbp)
mov    -0x1c(%rbp),%esi
add    $0x1,%esi
mov    %esi,-0x1c(%rbp)
mov    -0x18(%rbp),%edx
lea    0xe56(%rip),%rdi
call   1030 <printf@plt>
jmp    1146 <main+0x16>
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
mov    $0x1,%ebx
lea    0x14(%rsp),%r15
lea    0x10(%rsp),%r12
lea    0xc(%rsp),%r13
lea    0x8(%rsp),%rbp
lea    0xeae(%rip),%r14
jmp    1174 <main+0x44>
call   1050 <force3@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1030 <printf@plt>
add    $0x1,%ebx
lea    0xe85(%rip),%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
mov    %rbp,%r8
call   1040 <scanf@plt>
mov    0x14(%rsp),%edi
mov    0x10(%rsp),%esi
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%ecx
cmp    $0xffffffff,%edi
jne    1160 <main+0x30>
cmp    $0xffffffff,%esi
jne    1160 <main+0x30>
cmp    $0xffffffff,%edx
jne    1160 <main+0x30>
cmp    $0xffffffff,%ecx
jne    1160 <main+0x30>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"%d %d %d %d\00"
@.str.1 = [50 x i8] c"Case %d: the next triple peak occurs in %d days.\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* %7
br label %8
8: ; preds = %0, %22
%9 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3, i32* %4, i32* %5)
%10 = load i32, i32* %2
%11 = icmp eq i32 %10, -1
br i1 %11, label %12, label %22
12: ; preds = %8
%13 = load i32, i32* %3
%14 = icmp eq i32 %13, -1
br i1 %14, label %15, label %22
15: ; preds = %12
%16 = load i32, i32* %4
%17 = icmp eq i32 %16, -1
br i1 %17, label %18, label %22
18: ; preds = %15
%19 = load i32, i32* %5
%20 = icmp eq i32 %19, -1
br i1 %20, label %21, label %22
21: ; preds = %18
br label %32
22: ; preds = %18, %15, %12, %8
%23 = load i32, i32* %2
%24 = load i32, i32* %3
%25 = load i32, i32* %4
%26 = load i32, i32* %5
%27 = call i32 @force3(i32 %23, i32 %24, i32 %25, i32 %26)
store i32 %27, i32* %6
%28 = load i32, i32* %7
%29 = add nsw i32 %28, 1
store i32 %29, i32* %7
%30 = load i32, i32* %6
%31 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0), i32 %29, i32 %30)
br label %8
32: ; preds = %21
%33 = load i32, i32* %1
ret i32 %33
}

LLVM IR (-O2):
@.str = [12 x i8] c"%d %d %d %d\00"
@.str.1 = [50 x i8] c"Case %d: the next triple peak occurs in %d days.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
br label %9
9: ; preds = %23, %0
%10 = phi i32 [ 0, %0 ], [ %25, %23 ]
%11 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i32* %3, i32* %4)
%12 = load i32, i32* %1
%13 = icmp eq i32 %12, -1
%14 = load i32, i32* %2
%15 = icmp eq i32 %14, -1
%16 = select i1 %13, i1 %15, i1 false
%17 = load i32, i32* %3
%18 = icmp eq i32 %17, -1
%19 = select i1 %16, i1 %18, i1 false
%20 = load i32, i32* %4
%21 = icmp eq i32 %20, -1
%22 = select i1 %19, i1 %21, i1 false
br i1 %22, label %27, label %23
23: ; preds = %9
%24 = call i32 @force3(i32 %12, i32 %14, i32 %17, i32 %20)
%25 = add nuw nsw i32 %10, 1
%26 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0), i32 %25, i32 %24)
br label %9
27: ; preds = %9
ret i32 0
}