#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 /*<<< orphan*/ scanf(char *, int *);
int main() {
  int i, n;
  while (1) {
    scanf("%d", &n);
    if (n <= 0) {
      break;
    }
    for (i = 1; i <= n; i++) {
      if (i == n) {
        printf("%d", n % 10);
      } else if (i % 5 == 0) {
        printf("X");
      } else {
        printf("*");
      }
    }
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0xc(%rbp)
jg     114e <main+0x2e>
jmp    11ed <main+0xcd>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11da <main+0xba>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    118d <main+0x6d>
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c7 <main+0xa7>
mov    -0x8(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11b4 <main+0x94>
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c2 <main+0xa2>
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c7 <main+0xa7>
jmp    11cc <main+0xac>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1155 <main+0x35>
lea    0xe26(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xec0(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%esi
test   %esi,%esi
jle    11ed <main+0xbd>
mov    $0x1,%ebx
lea    0xe9e(%rip),%r15
lea    0xc(%rsp),%r14
nopw   0x0(%rax,%rax,1)
cmp    %esi,%ebx
jne    11a0 <main+0x70>
movslq %esi,%rax
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11be <main+0x8e>
xchg   %ax,%ax
imul   $0xcccccccd,%ebx,%eax
cmp    $0x33333333,%eax
jbe    11b4 <main+0x84>
mov    $0x2a,%edi
jmp    11b9 <main+0x89>
mov    $0x58,%edi
call   1030 <putchar@plt>
lea    0x1(%rbx),%eax
mov    0xc(%rsp),%esi
cmp    %esi,%ebx
mov    %eax,%ebx
jl     1170 <main+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%esi
mov    $0x1,%ebx
test   %esi,%esi
jg     1170 <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 = [2 x i8] c"X\00"
@.str.2 = [2 x i8] c"*\00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
br label %4
4: ; preds = %0, %35
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%6 = load i32, i32* %3
%7 = icmp sle i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %4
br label %37
9: ; preds = %4
store i32 1, i32* %2
br label %10
10: ; preds = %32, %9
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = icmp sle i32 %11, %12
br i1 %13, label %14, label %35
14: ; preds = %10
%15 = load i32, i32* %2
%16 = load i32, i32* %3
%17 = icmp eq i32 %15, %16
br i1 %17, label %18, label %22
18: ; preds = %14
%19 = load i32, i32* %3
%20 = srem i32 %19, 10
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %20)
br label %31
22: ; preds = %14
%23 = load i32, i32* %2
%24 = srem i32 %23, 5
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %22
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %30
28: ; preds = %22
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %30
30: ; preds = %28, %26
br label %31
31: ; preds = %30, %18
br label %32
32: ; preds = %31
%33 = load i32, i32* %2
%34 = add nsw i32 %33, 1
store i32 %34, i32* %2
br label %10
35: ; preds = %10
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %4
37: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [3 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 slt i32 %4, 1
br i1 %5, label %32, label %6
6: ; preds = %0, %24
%7 = phi i32 [ %25, %24 ], [ %4, %0 ]
%8 = phi i32 [ %26, %24 ], [ 1, %0 ]
%9 = icmp eq i32 %8, %7
br i1 %9, label %10, label %13
10: ; preds = %6
%11 = srem i32 %7, 10
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %11)
br label %20
13: ; preds = %6
%14 = urem i32 %8, 5
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = call i32 @putchar(i32 88)
br label %20
18: ; preds = %13
%19 = call i32 @putchar(i32 42)
br label %20
20: ; preds = %10, %18, %16
%21 = add nuw nsw i32 %8, 1
%22 = load i32, i32* %1
%23 = icmp slt i32 %8, %22
br i1 %23, label %24, label %27
24: ; preds = %20, %27
%25 = phi i32 [ %22, %20 ], [ %30, %27 ]
%26 = phi i32 [ %21, %20 ], [ 1, %27 ]
br label %6
27: ; preds = %20
%28 = call i32 @putchar(i32 10)
%29 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%30 = load i32, i32* %1
%31 = icmp slt i32 %30, 1
br i1 %31, label %32, label %24
32: ; preds = %27, %0
ret i32 0
}