#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 *, char);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ strcat(char *, char *);
scalar_t__ strcmp(char *, char *);
int strlen(char *);
int main() {
  while (1) {
    char az[200];
    char af[300] = {};
    int num, count, countf, countl;
    scanf("%s", az);
    if (strcmp(az, ".") == 0)
      break;
    scanf("%d", &num);
    for (count = 0; count < num; count++)
      strcat(af, az);
    count = strlen(az);
    for (num = 0; num < count; num++) {
      for (countf = num; af[countf] != '\0'; countf++)
        printf("%c", af[countf]);
      for (countl = 0; countl < num; countl++)
        printf("%c", af[countl]);
      puts("");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x200(%rbp),%rdi
xor    %esi,%esi
mov    $0x12c,%edx
call   1060 <memset@plt>
lea    -0xd0(%rbp),%rsi
lea    0xe5d(%rip),%rdi
mov    $0x0,%al
call   1080 <scanf@plt>
lea    -0xd0(%rbp),%rdi
lea    0xe4b(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    11cc <main+0x5c>
jmp    1315 <main+0x1a5>
lea    0xe32(%rip),%rdi
lea    -0x204(%rbp),%rsi
mov    $0x0,%al
call   1080 <scanf@plt>
movl   $0x0,-0x208(%rbp)
mov    -0x208(%rbp),%eax
cmp    -0x204(%rbp),%eax
jge    1224 <main+0xb4>
lea    -0x200(%rbp),%rdi
lea    -0xd0(%rbp),%rsi
call   1090 <strcat@plt>
mov    -0x208(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x208(%rbp)
jmp    11eb <main+0x7b>
lea    -0xd0(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x208(%rbp)
movl   $0x0,-0x204(%rbp)
mov    -0x204(%rbp),%eax
cmp    -0x208(%rbp),%eax
jge    1310 <main+0x1a0>
mov    -0x204(%rbp),%eax
mov    %eax,-0x20c(%rbp)
movslq -0x20c(%rbp),%rax
movsbl -0x200(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
je     12a5 <main+0x135>
movslq -0x20c(%rbp),%rax
lea    0xd84(%rip),%rdi
movsbl -0x200(%rbp,%rax,1),%esi
ff
call   1050 <printf@plt>
mov    -0x20c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20c(%rbp)
jmp    125e <main+0xee>
movl   $0x0,-0x210(%rbp)
mov    -0x210(%rbp),%eax
cmp    -0x204(%rbp),%eax
jge    12f0 <main+0x180>
movslq -0x210(%rbp),%rax
lea    0xd39(%rip),%rdi
movsbl -0x200(%rbp,%rax,1),%esi
ff
call   1050 <printf@plt>
mov    -0x210(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x210(%rbp)
jmp    12af <main+0x13f>
lea    0xd0d(%rip),%rdi
call   1030 <puts@plt>
mov    -0x204(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x204(%rbp)
jmp    1240 <main+0xd0>
jmp    1182 <main+0x12>
xor    %eax,%eax
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x208,%rsp
lea    0x10(%rsp),%rdi
mov    $0x12c,%edx
xor    %esi,%esi
call   1060 <memset@plt>
lea    0xe67(%rip),%rdi
lea    0x140(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
lea    0xe51(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1310 <main+0x1a0>
lea    0x10(%rsp),%r12
lea    0x140(%rsp),%r13
lea    0xe31(%rip),%rbx
jmp    1218 <main+0xa8>
nopl   0x0(%rax)
mov    $0x12c,%edx
mov    %r12,%rdi
xor    %esi,%esi
call   1060 <memset@plt>
lea    0xe0a(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
mov    %r13,%rdi
lea    0xdf9(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1310 <main+0x1a0>
lea    0xde6(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    1254 <main+0xe4>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r12,%rdi
mov    %r13,%rsi
call   1090 <strcat@plt>
add    $0x1,%ebp
cmp    0xc(%rsp),%ebp
jl     1240 <main+0xd0>
mov    %r13,%rdi
call   1040 <strlen@plt>
movl   $0x0,0xc(%rsp)
test   %eax,%eax
jle    11e0 <main+0x70>
mov    %eax,%r15d
xor    %ecx,%ecx
jmp    129e <main+0x12e>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0xc(%rsp),%ecx
add    $0x1,%ecx
mov    %ecx,0xc(%rsp)
cmp    %r15d,%ecx
jge    11e0 <main+0x70>
movslq %ecx,%r14
mov    0x10(%rsp,%r14,1),%al
test   %al,%al
je     12db <main+0x16b>
lea    0x11(%rsp),%rcx
add    %rcx,%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl %al,%esi
mov    %rbx,%rdi
call   1050 <printf@plt>
movzbl (%r14),%eax
add    $0x1,%r14
test   %al,%al
jne    12c0 <main+0x150>
mov    0xc(%rsp),%ecx
test   %ecx,%ecx
jle    1280 <main+0x110>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl 0x10(%rsp,%rbp,1),%esi
mov    %rbx,%rdi
call   1050 <printf@plt>
add    $0x1,%rbp
movslq 0xc(%rsp),%rax
cmp    %rax,%rbp
jl     12f0 <main+0x180>
jmp    1280 <main+0x110>
xor    %eax,%eax
add    $0x208,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [2 x i8] c".\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [3 x i8] c"%c\00"
@.str.4 = [1 x i8] zeroinitializer
define i32 @main() {
%1 = alloca i32
%2 = alloca [200 x i8]
%3 = alloca [300 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
br label %8
8: ; preds = %0, %73
%9 = bitcast [300 x i8]* %3 to i8*
%10 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%13 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %8
br label %74
16: ; preds = %8
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
store i32 0, i32* %5
br label %18
18: ; preds = %26, %16
%19 = load i32, i32* %5
%20 = load i32, i32* %4
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %29
22: ; preds = %18
%23 = getelementptr inbounds [300 x i8], [300 x i8]* %3, i64 0, i64 0
%24 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%25 = call i32 @strcat(i8* %23, i8* %24)
br label %26
26: ; preds = %22
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 1
store i32 %28, i32* %5
br label %18
29: ; preds = %18
%30 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%31 = call i32 @strlen(i8* %30)
store i32 %31, i32* %5
store i32 0, i32* %4
br label %32
32: ; preds = %70, %29
%33 = load i32, i32* %4
%34 = load i32, i32* %5
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %73
36: ; preds = %32
%37 = load i32, i32* %4
store i32 %37, i32* %6
br label %38
38: ; preds = %51, %36
%39 = load i32, i32* %6
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [300 x i8], [300 x i8]* %3, i64 0, i64 %40
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = icmp ne i32 %43, 0
br i1 %44, label %45, label %54
45: ; preds = %38
%46 = load i32, i32* %6
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [300 x i8], [300 x i8]* %3, i64 0, i64 %47
%49 = load i8, i8* %48
%50 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8 signext %49)
br label %51
51: ; preds = %45
%52 = load i32, i32* %6
%53 = add nsw i32 %52, 1
store i32 %53, i32* %6
br label %38
54: ; preds = %38
store i32 0, i32* %7
br label %55
55: ; preds = %65, %54
%56 = load i32, i32* %7
%57 = load i32, i32* %4
%58 = icmp slt i32 %56, %57
br i1 %58, label %59, label %68
59: ; preds = %55
%60 = load i32, i32* %7
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [300 x i8], [300 x i8]* %3, i64 0, i64 %61
%63 = load i8, i8* %62
%64 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8 signext %63)
br label %65
65: ; preds = %59
%66 = load i32, i32* %7
%67 = add nsw i32 %66, 1
store i32 %67, i32* %7
br label %55
68: ; preds = %55
%69 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
br label %70
70: ; preds = %68
%71 = load i32, i32* %4
%72 = add nsw i32 %71, 1
store i32 %72, i32* %4
br label %32
73: ; preds = %32
br label %8
74: ; preds = %15
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [2 x i8] c".\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca [200 x i8]
%2 = alloca [300 x i8]
%3 = alloca i32
%4 = getelementptr inbounds [200 x i8], [200 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [300 x i8], [300 x i8]* %2, i64 0, i64 0
%6 = bitcast i32* %3 to i8*
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%8 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %60, label %10
10: ; preds = %0, %56
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%12 = load i32, i32* %3
%13 = icmp sgt i32 %12, 0
br i1 %13, label %14, label %20
14: ; preds = %10, %14
%15 = phi i32 [ %17, %14 ], [ 0, %10 ]
%16 = call i32 @strcat(i8* %5, i8* %4)
%17 = add nuw nsw i32 %15, 1
%18 = load i32, i32* %3
%19 = icmp slt i32 %17, %18
br i1 %19, label %14, label %20
20: ; preds = %14, %10
%21 = call i32 @strlen(i8* %4)
store i32 0, i32* %3
%22 = icmp sgt i32 %21, 0
br i1 %22, label %23, label %56
23: ; preds = %20, %51
%24 = phi i32 [ %54, %51 ], [ 0, %20 ]
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [300 x i8], [300 x i8]* %2, i64 0, i64 %25
%27 = load i8, i8* %26
%28 = icmp eq i8 %27, 0
br i1 %28, label %31, label %34
29: ; preds = %34
%30 = load i32, i32* %3
br label %31
31: ; preds = %29, %23
%32 = phi i32 [ %30, %29 ], [ %24, %23 ]
%33 = icmp sgt i32 %32, 0
br i1 %33, label %42, label %51
34: ; preds = %23, %34
%35 = phi i64 [ %38, %34 ], [ %25, %23 ]
%36 = phi i8 [ %40, %34 ], [ %27, %23 ]
%37 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8 signext %36)
%38 = add i64 %35, 1
%39 = getelementptr inbounds [300 x i8], [300 x i8]* %2, i64 0, i64 %38
%40 = load i8, i8* %39
%41 = icmp eq i8 %40, 0
br i1 %41, label %29, label %34
42: ; preds = %31, %42
%43 = phi i64 [ %47, %42 ], [ 0, %31 ]
%44 = getelementptr inbounds [300 x i8], [300 x i8]* %2, i64 0, i64 %43
%45 = load i8, i8* %44
%46 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8 signext %45)
%47 = add nuw nsw i64 %43, 1
%48 = load i32, i32* %3
%49 = sext i32 %48 to i64
%50 = icmp slt i64 %47, %49
br i1 %50, label %42, label %51
51: ; preds = %42, %31
%52 = call i32 @putchar(i32 10)
%53 = load i32, i32* %3
%54 = add nsw i32 %53, 1
store i32 %54, i32* %3
%55 = icmp slt i32 %54, %21
br i1 %55, label %23, label %56
56: ; preds = %51, %20
%57 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%58 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%59 = icmp eq i64 %58, 0
br i1 %59, label %60, label %10
60: ; preds = %56, %0
ret i32 0
}