#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 */
typedef int /*<<< orphan*/ s;

/* Variables and functions */
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ stdin;
int strlen(char *);
int main() {
  char s[32] = "";
  int a = 0;
  int i = 0;
  int j = 0;
  fgets(s, sizeof(s), stdin);
  scanf("%d", &a);
  for (i = 0; i < strlen(s);) {
    putchar(s[i]);
    j = 0;
    while (j < a) {
      j++;
      i++;
    }
    i++;
  }
  puts("");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1060 <memset@plt>
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
lea    -0x30(%rbp),%rdi
mov    0x2e49(%rip),%rax
mov    (%rax),%edx
mov    $0x20,%esi
call   1070 <fgets@plt>
lea    0xe4e(%rip),%rdi
lea    -0x34(%rbp),%rsi
call   1080 <scanf@plt>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
mov    %eax,-0x40(%rbp)
lea    -0x30(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x40(%rbp),%eax
cmp    %ecx,%eax
jge    1224 <main+0xc4>
movslq -0x38(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%edi
call   1030 <putchar@plt>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    1216 <main+0xb6>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11f3 <main+0x93>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11c2 <main+0x62>
lea    0xdd7(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x30,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
mov    0x2e84(%rip),%rax
mov    (%rax),%edx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x20,%esi
call   1050 <fgets@plt>
lea    0xe81(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    11c8 <main+0x88>
xor    %r14d,%r14d
lea    0x10(%rsp),%rbx
xor    %ebp,%ebp
nop
movslq %ebp,%rbp
movsbl 0x10(%rsp,%rbp,1),%edi
call   1030 <putchar@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
cmovs  %r14d,%eax
add    %eax,%ebp
add    $0x1,%ebp
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    %eax,%ebp
jl     11a0 <main+0x60>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [3 x i8] c"%d\00"
@.str.1 = [1 x i8] zeroinitializer
define i32 @main() {
%1 = alloca i32
%2 = alloca [32 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [32 x i8]* %2 to i8*
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
%7 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%8 = load i32, i32* @stdin
%9 = call i32 @fgets(i8* %7, i32 32, i32 %8)
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
store i32 0, i32* %4
br label %11
11: ; preds = %31, %0
%12 = load i32, i32* %4
%13 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%14 = call i32 @strlen(i8* %13)
%15 = icmp slt i32 %12, %14
br i1 %15, label %16, label %34
16: ; preds = %11
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 %18
%20 = load i8, i8* %19
%21 = call i32 @putchar(i8 signext %20)
store i32 0, i32* %5
br label %22
22: ; preds = %26, %16
%23 = load i32, i32* %5
%24 = load i32, i32* %3
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %31
26: ; preds = %22
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 1
store i32 %28, i32* %5
%29 = load i32, i32* %4
%30 = add nsw i32 %29, 1
store i32 %30, i32* %4
br label %22
31: ; preds = %22
%32 = load i32, i32* %4
%33 = add nsw i32 %32, 1
store i32 %33, i32* %4
br label %11
34: ; preds = %11
%35 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca [32 x i8]
%2 = alloca i32
%3 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 0
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = load i32, i32* @stdin
%6 = call i32 @fgets(i8* %3, i32 32, i32 %5)
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%8 = call i32 @strlen(i8* %3)
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %23
10: ; preds = %0, %10
%11 = phi i32 [ %20, %10 ], [ 0, %0 ]
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 %12
%14 = load i8, i8* %13
%15 = call i32 @putchar(i8 signext %14)
%16 = load i32, i32* %2
%17 = icmp sgt i32 %16, 0
%18 = select i1 %17, i32 %16, i32 0
%19 = add i32 %11, %18
%20 = add nsw i32 %19, 1
%21 = call i32 @strlen(i8* %3)
%22 = icmp slt i32 %20, %21
br i1 %22, label %10, label %23
23: ; preds = %10, %0
%24 = call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 10)
ret i32 0
}