#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 x, i = 0, tot = 0;
  scanf("%d", &x);
  while (x != 0) {
    while (i < 5) {
      if (x % 2 == 0) {
        tot = tot + x;
        i++;
      }
      x++;
    }
    printf("%d\n", tot);
    tot = 0;
    i = 0;
    scanf("%d", &x);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xebc(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
je     11cc <main+0xac>
jmp    115c <main+0x3c>
cmpl   $0x5,-0xc(%rbp)
jge    119a <main+0x7a>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    118c <main+0x6c>
mov    -0x10(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    115c <main+0x3c>
mov    -0x10(%rbp),%esi
lea    0xe5f(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xe42(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
jmp    114d <main+0x2d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xecd(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
je     11a6 <main+0x86>
xor    %ebp,%ebp
lea    0xeb5(%rip),%r14
lea    0xeab(%rip),%r15
lea    0xc(%rsp),%r12
xor    %esi,%esi
xor    %ecx,%ecx
xchg   %ax,%ax
mov    %eax,%edx
mov    %eax,%ebx
and    $0x1,%ebx
lea    0x1(%rdx),%eax
mov    %ebx,%edi
xor    $0x1,%edi
add    %edi,%ecx
test   %ebx,%ebx
cmovne %ebp,%edx
add    %edx,%esi
cmp    $0x5,%ecx
jb     1160 <main+0x40>
mov    %eax,0xc(%rsp)
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
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    %r12
pop    %r14
pop    %r15
pop    %rbp
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
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %4
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %6
6: ; preds = %26, %0
%7 = load i32, i32* %2
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %30
9: ; preds = %6
br label %10
10: ; preds = %23, %9
%11 = load i32, i32* %3
%12 = icmp slt i32 %11, 5
br i1 %12, label %13, label %26
13: ; preds = %10
%14 = load i32, i32* %2
%15 = srem i32 %14, 2
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %23
17: ; preds = %13
%18 = load i32, i32* %4
%19 = load i32, i32* %2
%20 = add nsw i32 %18, %19
store i32 %20, i32* %4
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 1
store i32 %22, i32* %3
br label %23
23: ; preds = %17, %13
%24 = load i32, i32* %2
%25 = add nsw i32 %24, 1
store i32 %25, i32* %2
br label %10
26: ; preds = %10
%27 = load i32, i32* %4
%28 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %27)
store i32 0, i32* %4
store i32 0, i32* %3
%29 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %6
30: ; preds = %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 i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = icmp eq i32 %4, 0
br i1 %5, label %27, label %6
6: ; preds = %0, %18
%7 = phi i32 [ %19, %18 ], [ 0, %0 ]
%8 = phi i32 [ %20, %18 ], [ 0, %0 ]
%9 = phi i32 [ %21, %18 ], [ %4, %0 ]
%10 = and i32 %9, 1
%11 = icmp eq i32 %10, 0
%12 = add nsw i32 %9, 1
%13 = xor i32 %10, 1
%14 = add nuw nsw i32 %13, %8
%15 = select i1 %11, i32 %9, i32 0
%16 = add nsw i32 %15, %7
%17 = icmp ult i32 %14, 5
br i1 %17, label %18, label %22
18: ; preds = %6, %22
%19 = phi i32 [ %16, %6 ], [ 0, %22 ]
%20 = phi i32 [ %14, %6 ], [ 0, %22 ]
%21 = phi i32 [ %12, %6 ], [ %25, %22 ]
br label %6
22: ; preds = %6
store i32 %12, i32* %1
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%24 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%25 = load i32, i32* %1
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %18
27: ; preds = %22, %0
ret i32 0
}