#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);
scalar_t__ scanf(char *, int *);
int main() {
  int i, x, sum = 0, f = 0;
  while (scanf("%d", &x)) {
    if (x == 0) {
      break;
    }
    while (1) {
      if (x % 2 == 0) {
        f = f + 1;
        sum = sum + x;
      }
      x = x + 1;
      if (f == 5) {
        break;
      }
    }
    printf("%d\n", sum);
    sum = 0;
    f = 0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xebc(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
cmp    $0x0,%rax
je     11d0 <main+0xb0>
cmpl   $0x0,-0xc(%rbp)
jne    1166 <main+0x46>
jmp    11d0 <main+0xb0>
jmp    116b <main+0x4b>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1191 <main+0x71>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x5,-0x14(%rbp)
jne    11a9 <main+0x89>
jmp    11ae <main+0x8e>
jmp    116b <main+0x4b>
mov    -0x10(%rbp),%esi
lea    0xe4b(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
jmp    113d <main+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xed0(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
test   %rax,%rax
je     11aa <main+0x8a>
mov    0xc(%rsp),%eax
test   %eax,%eax
je     11aa <main+0x8a>
xor    %esi,%esi
lea    0xeb3(%rip),%r14
lea    0xea9(%rip),%r15
lea    0xc(%rsp),%rbx
xor    %ecx,%ecx
xchg   %ax,%ax
mov    %eax,%edx
and    $0x1,%edx
mov    $0x0,%edi
cmove  %eax,%edi
add    %edi,%esi
xor    $0x1,%edx
add    %edx,%ecx
add    $0x1,%eax
cmp    $0x5,%ecx
jne    1160 <main+0x40>
mov    %eax,0xc(%rsp)
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
test   %rax,%rax
je     11aa <main+0x8a>
mov    0xc(%rsp),%eax
mov    $0x0,%esi
mov    $0x0,%ecx
test   %eax,%eax
jne    1160 <main+0x40>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %31, %0
%7 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %34
9: ; preds = %6
%10 = load i32, i32* %3
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %9
br label %34
13: ; preds = %9
br label %14
14: ; preds = %13, %30
%15 = load i32, i32* %3
%16 = srem i32 %15, 2
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %24
18: ; preds = %14
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
store i32 %20, i32* %5
%21 = load i32, i32* %4
%22 = load i32, i32* %3
%23 = add nsw i32 %21, %22
store i32 %23, i32* %4
br label %24
24: ; preds = %18, %14
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
store i32 %26, i32* %3
%27 = load i32, i32* %5
%28 = icmp eq i32 %27, 5
br i1 %28, label %29, label %30
29: ; preds = %24
br label %31
30: ; preds = %24
br label %14
31: ; preds = %29
%32 = load i32, i32* %4
%33 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %32)
store i32 0, i32* %4
store i32 0, i32* %5
br label %6
34: ; preds = %12, %6
ret i32 0
}

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