PROGRAM c168b

IMPLICIT NONE
INTEGER :: i, K
CHARACTER(LEN=100) :: S

READ *, K
READ *, S

i = LEN_TRIM(S)

IF (i > K) THEN
 PRINT *, S(1:K), "..."
ELSE
 PRINT *, S
END IF

END PROGRAM c168b
; 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 [100 x i8] undef
@_QQcl.10c6ac11e14973494118921ad999e988 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_1362/source.f\00"
@_QQcl.2E2E2E = linkonce constant [3 x i8] c"..."
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

define void @_QQmain() local_unnamed_addr {
  %1 = alloca i32, align 4
  %2 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.10c6ac11e14973494118921ad999e988, i32 7)
  %3 = call i1 @_FortranAioInputInteger(ptr %2, ptr nonnull %1, i32 4)
  %4 = call i32 @_FortranAioEndIoStatement(ptr %2)
  %5 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.10c6ac11e14973494118921ad999e988, i32 8)
  %6 = call i1 @_FortranAioInputAscii(ptr %5, ptr nonnull @_QFEs, i64 100)
  %7 = call i32 @_FortranAioEndIoStatement(ptr %5)
  br label %8

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

16:                                               ; preds = %8
  %17 = trunc i64 %9 to i32
  %18 = add i32 %17, 1
  %19 = select i1 %12, i32 0, i32 %18
  %20 = load i32, ptr %1, align 4, !tbaa !3
  %21 = icmp sgt i32 %19, %20
  br i1 %21, label %22, label %29

22:                                               ; preds = %16
  %23 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.10c6ac11e14973494118921ad999e988, i32 13)
  %24 = load i32, ptr %1, align 4, !tbaa !3
  %25 = call i32 @llvm.smax.i32(i32 %24, i32 0)
  %26 = zext i32 %25 to i64
  %27 = call i1 @_FortranAioOutputAscii(ptr %23, ptr nonnull @_QFEs, i64 %26)
  %28 = call i1 @_FortranAioOutputAscii(ptr %23, ptr nonnull @_QQcl.2E2E2E, i64 3)
  br label %32

29:                                               ; preds = %16
  %30 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.10c6ac11e14973494118921ad999e988, i32 15)
  %31 = call i1 @_FortranAioOutputAscii(ptr %30, ptr nonnull @_QFEs, i64 100)
  br label %32

32:                                               ; preds = %22, %29
  %.sink = phi ptr [ %23, %22 ], [ %30, %29 ]
  %33 = call i32 @_FortranAioEndIoStatement(ptr %.sink)
  ret void
}

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

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

declare i32 @_FortranAioEndIoStatement(ptr) local_unnamed_addr

declare i1 @_FortranAioInputAscii(ptr, ptr, i64) 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 i32 @llvm.smax.i32(i32, i32) #0

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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"}
