#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 n;
  for (;;) {
    scanf("%d", &n);
    if (n == -1)
      return 0;
    else if (!(n % 3))
      printf("%d\n", n / 3);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0xffffffff,-0x8(%rbp)
jne    1151 <main+0x31>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret
mov    -0x8(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    117e <main+0x5e>
mov    -0x8(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
jmp    1183 <main+0x63>
jmp    112f <main+0xf>

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>
mov    0xc(%rsp),%eax
cmp    $0xffffffff,%eax
je     11a8 <main+0x88>
lea    0xeb9(%rip),%r14
lea    0xeaf(%rip),%r15
lea    0xc(%rsp),%rbx
jmp    1174 <main+0x54>
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0xffffffff,%eax
je     11a8 <main+0x88>
imul   $0xaaaaaaab,%eax,%ecx
add    $0x2aaaaaaa,%ecx
cmp    $0x55555554,%ecx
ja     1160 <main+0x40>
cltq
imul   $0x55555556,%rax,%rsi
mov    %rsi,%rax
shr    $0x3f,%rax
shr    $0x20,%rsi
add    %eax,%esi
mov    %r14,%rdi
call   1030 <printf@plt>
jmp    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
store i32 0, i32* %1
br label %3
3: ; preds = %17, %0
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %8
7: ; preds = %3
ret i32 0
8: ; preds = %3
%9 = load i32, i32* %2
%10 = srem i32 %9, 3
%11 = icmp ne i32 %10, 0
br i1 %11, label %16, label %12
12: ; preds = %8
%13 = load i32, i32* %2
%14 = sdiv i32 %13, 3
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %14)
br label %16
16: ; preds = %12, %8
br label %17
17: ; preds = %16
br label %3
}

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, -1
br i1 %5, label %6, label %7
6: ; preds = %14, %0
ret i32 0
7: ; preds = %0, %14
%8 = phi i32 [ %16, %14 ], [ %4, %0 ]
%9 = srem i32 %8, 3
%10 = sdiv i32 %8, 3
%11 = icmp eq i32 %9, 0
br i1 %11, label %12, label %14
12: ; preds = %7
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %10)
br label %14
14: ; preds = %7, %12
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%16 = load i32, i32* %1
%17 = icmp eq i32 %16, -1
br i1 %17, label %6, label %7
}