program aaa
implicit none
integer :: i,j,k,n,a,b,len,w

character(len=1000) :: s
character(len=1000) :: s2

read(*,*) s
read(*,*) w

s2=""
a=1

do while(a <= len_trim(s))
s2 = s2(1:len_trim(s2))//s(a:a)

a = a + w
enddo

write(*,*) s2(1:len_trim(s2))

end program
; ModuleID = 'FIRModule'
source_filename = "FIRModule"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"

@_QFEs = internal global [1000 x i8] undef
@_QFEs2 = internal global [1000 x i8] undef
@_QQcl.7abaafbdbc437e49f91083934cc4243b = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_5763/source.f\00"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

define void @_QQmain() local_unnamed_addr {
.preheader10:
  %0 = alloca i32, align 4
  %1 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.7abaafbdbc437e49f91083934cc4243b, i32 8)
  %2 = tail call i1 @_FortranAioInputAscii(ptr %1, ptr nonnull @_QFEs, i64 1000)
  %3 = tail call i32 @_FortranAioEndIoStatement(ptr %1)
  %4 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.7abaafbdbc437e49f91083934cc4243b, i32 9)
  %5 = call i1 @_FortranAioInputInteger(ptr %4, ptr nonnull %0, i32 4)
  %6 = call i32 @_FortranAioEndIoStatement(ptr %4)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1000) @_QFEs2, i8 32, i64 1000, i1 false), !tbaa !3
  %7 = load i32, ptr %0, align 4
  br label %8

8:                                                ; preds = %.preheader10, %._crit_edge
  %.0 = phi i32 [ %44, %._crit_edge ], [ 1, %.preheader10 ]
  br label %9

9:                                                ; preds = %8, %9
  %10 = phi i64 [ 999, %8 ], [ %14, %9 ]
  %11 = getelementptr [1000 x [1 x i8]], ptr @_QFEs, i64 0, i64 %10
  %12 = load i8, ptr %11, align 1, !tbaa !3
  %13 = icmp eq i8 %12, 32
  %14 = add nsw i64 %10, -1
  %15 = icmp ne i64 %10, 0
  %16 = and i1 %13, %15
  br i1 %16, label %9, label %17

17:                                               ; preds = %9
  %18 = trunc i64 %10 to i32
  %19 = add i32 %18, 1
  %20 = select i1 %13, i32 0, i32 %19
  %.not = icmp sgt i32 %.0, %20
  br i1 %.not, label %45, label %.preheader

.preheader:                                       ; preds = %17, %.preheader
  %21 = phi i64 [ %25, %.preheader ], [ 999, %17 ]
  %22 = getelementptr [1000 x [1 x i8]], ptr @_QFEs2, i64 0, i64 %21
  %23 = load i8, ptr %22, align 1, !tbaa !3
  %24 = icmp eq i8 %23, 32
  %25 = add nsw i64 %21, -1
  %26 = icmp ne i64 %21, 0
  %27 = and i1 %24, %26
  br i1 %27, label %.preheader, label %28

28:                                               ; preds = %.preheader
  %29 = shl i64 %21, 32
  %sext9 = add i64 %29, 4294967296
  %30 = ashr exact i64 %sext9, 32
  %31 = call i64 @llvm.smax.i64(i64 %30, i64 0)
  %32 = select i1 %24, i64 0, i64 %31
  %33 = sext i32 %.0 to i64
  %34 = add nsw i64 %33, -1
  %35 = getelementptr [1000 x [1 x i8]], ptr @_QFEs, i64 0, i64 %34
  %36 = add nuw nsw i64 %32, 1
  %37 = alloca i8, i64 %36, align 1
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %37, ptr nonnull align 16 @_QFEs2, i64 %32, i1 false)
  %.unpack = load i8, ptr %35, align 1, !tbaa !3
  %38 = getelementptr [1 x i8], ptr %37, i64 %32
  store i8 %.unpack, ptr %38, align 1, !tbaa !3
  %39 = call i64 @llvm.smin.i64(i64 %36, i64 1000)
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 @_QFEs2, ptr nonnull align 1 %37, i64 %39, i1 false)
  %40 = icmp ult i64 %39, 1000
  br i1 %40, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %28
  %41 = sub nuw nsw i64 1000, %39
  %uglygep = getelementptr i8, ptr @_QFEs2, i64 %39
  %smin = call i64 @llvm.smin.i64(i64 %41, i64 1)
  %42 = add nuw nsw i64 %39, %smin
  %43 = sub nuw nsw i64 1001, %42
  call void @llvm.memset.p0.i64(ptr align 1 %uglygep, i8 32, i64 %43, i1 false), !tbaa !3
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph.preheader, %28
  %44 = add i32 %7, %.0
  br label %8

45:                                               ; preds = %17
  %46 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.7abaafbdbc437e49f91083934cc4243b, i32 20)
  br label %47

47:                                               ; preds = %45, %47
  %48 = phi i64 [ 999, %45 ], [ %52, %47 ]
  %49 = getelementptr [1000 x [1 x i8]], ptr @_QFEs2, i64 0, i64 %48
  %50 = load i8, ptr %49, align 1, !tbaa !3
  %51 = icmp eq i8 %50, 32
  %52 = add nsw i64 %48, -1
  %53 = icmp ne i64 %48, 0
  %54 = and i1 %51, %53
  br i1 %54, label %47, label %55

55:                                               ; preds = %47
  %56 = shl i64 %48, 32
  %sext = add i64 %56, 4294967296
  %57 = ashr exact i64 %sext, 32
  %58 = call i64 @llvm.smax.i64(i64 %57, i64 0)
  %59 = select i1 %51, i64 0, i64 %58
  %60 = call i1 @_FortranAioOutputAscii(ptr %46, ptr nonnull @_QFEs2, i64 %59)
  %61 = call i32 @_FortranAioEndIoStatement(ptr %46)
  ret void
}

declare ptr @_FortranAioBeginExternalListInput(i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioInputAscii(ptr, ptr, i64) local_unnamed_addr

declare i32 @_FortranAioEndIoStatement(ptr) local_unnamed_addr

declare i1 @_FortranAioInputInteger(ptr, ptr, i32) local_unnamed_addr

declare ptr @_FortranAioBeginExternalListOutput(i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputAscii(ptr, ptr, i64) local_unnamed_addr

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #0

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #0

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }

!llvm.module.flags = !{!0, !1, !2}

!0 = !{i32 2, !"Debug Info Version", i32 3}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{!4, !4, i64 0}
!4 = !{!"any data access", !5, i64 0}
!5 = !{!"any access", !6, i64 0}
!6 = !{!"Flang Type TBAA Root"}
