#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 printf(char *, ...);
int scanf(char *, int *);
int main() {
  int n, s = 0;
  while (scanf("%d", &n), n || 0 * printf("%s%d개\n", s ? "\n" : "", s))
    if (!(n % 5 || n % 3))
      s++, printf("%d ", n);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xec3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    $0x1,%al
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0xd(%rbp)
jne    118a <main+0x6a>
mov    -0xc(%rbp),%ecx
lea    0xeac(%rip),%rsi
lea    0xea4(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
mov    -0xc(%rbp),%edx
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
imul   $0x0,%eax,%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    119a <main+0x7a>
jmp    11e1 <main+0xc1>
mov    -0x8(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11dc <main+0xbc>
mov    -0x8(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11dc <main+0xbc>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe37(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1136 <main+0x16>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xed1(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
test   %esi,%esi
je     11cc <main+0xac>
lea    0xec0(%rip),%r14
lea    0xead(%rip),%r15
lea    0x4(%rsp),%r12
xor    %ebx,%ebx
jmp    1173 <main+0x53>
nopl   0x0(%rax)
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
test   %esi,%esi
je     11bf <main+0x9f>
movslq %esi,%rax
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    %ecx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%ecx
mov    %eax,%edx
sub    %ecx,%edx
imul   $0x55555556,%rax,%rcx
mov    %rcx,%rdi
shr    $0x3f,%rdi
shr    $0x20,%rcx
add    %edi,%ecx
lea    (%rcx,%rcx,2),%ecx
sub    %ecx,%eax
or     %edx,%eax
jne    1160 <main+0x40>
add    $0x1,%ebx
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1160 <main+0x40>
test   %ebx,%ebx
je     11cc <main+0xac>
lea    0xe40(%rip),%rsi
jmp    11d5 <main+0xb5>
lea    0xe38(%rip),%rsi
xor    %ebx,%ebx
lea    0xe27(%rip),%rdi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [9 x i8] c"%s%d\EA\B0\9C\0A\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [4 x i8] c"%d \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 %8, label %13
6: ; preds = %23
%7 = icmp eq i32 %24, 0
br i1 %7, label %8, label %9
8: ; preds = %0, %6
br label %9
9: ; preds = %6, %8
%10 = phi i32 [ 0, %8 ], [ %24, %6 ]
%11 = phi i8* [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), %8 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), %6 ]
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %11, i32 %10)
ret i32 0
13: ; preds = %0, %23
%14 = phi i32 [ %26, %23 ], [ %4, %0 ]
%15 = phi i32 [ %24, %23 ], [ 0, %0 ]
%16 = srem i32 %14, 5
%17 = srem i32 %14, 3
%18 = or i32 %16, %17
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %13
%21 = add nsw i32 %15, 1
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %14)
br label %23
23: ; preds = %20, %13
%24 = phi i32 [ %15, %13 ], [ %21, %20 ]
%25 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%26 = load i32, i32* %1
%27 = icmp eq i32 %26, 0
br i1 %27, label %6, label %13
}