; LLVM IR from tangjz/acm-icpc :: usaco/Training/Chapter 1 Getting started (gift1)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@name = external dso_local global [10 x [15 x i8]], align 16
@NG = external dso_local global [15 x i8], align 1
@money = external dso_local global [10 x i32], align 16
@NP = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %7 = load ptr, ptr @stdin, align 8, !tbaa !5
  %8 = call ptr @freopen(ptr noundef @.str, ptr noundef @.str.1, ptr noundef %7)
  %9 = load ptr, ptr @stdout, align 8, !tbaa !5
  %10 = call ptr @freopen(ptr noundef @.str.2, ptr noundef @.str.3, ptr noundef %9)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.4, ptr noundef @NP)
  store i32 0, ptr %2, align 4, !tbaa !9
  br label %12

12:                                               ; preds = %22, %0
  %13 = load i32, ptr %2, align 4, !tbaa !9
  %14 = load i32, ptr @NP, align 4, !tbaa !9
  %15 = icmp slt i32 %13, %14
  br i1 %15, label %16, label %25

16:                                               ; preds = %12
  %17 = load i32, ptr %2, align 4, !tbaa !9
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [10 x [15 x i8]], ptr @name, i64 0, i64 %18
  %20 = getelementptr inbounds [15 x i8], ptr %19, i64 0, i64 0
  %21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.5, ptr noundef %20)
  br label %22

22:                                               ; preds = %16
  %23 = load i32, ptr %2, align 4, !tbaa !9
  %24 = add nsw i32 %23, 1
  store i32 %24, ptr %2, align 4, !tbaa !9
  br label %12, !llvm.loop !11

25:                                               ; preds = %12
  store i32 0, ptr %2, align 4, !tbaa !9
  br label %26

26:                                               ; preds = %97, %25
  %27 = load i32, ptr %2, align 4, !tbaa !9
  %28 = load i32, ptr @NP, align 4, !tbaa !9
  %29 = icmp slt i32 %27, %28
  br i1 %29, label %30, label %100

30:                                               ; preds = %26
  call void @llvm.memset.p0.i64(ptr align 1 @NG, i8 0, i64 15, i1 false)
  %31 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.6, ptr noundef @NG, ptr noundef %5, ptr noundef %6)
  %32 = load i32, ptr %6, align 4, !tbaa !9
  %33 = icmp ne i32 %32, 0
  br i1 %33, label %35, label %34

34:                                               ; preds = %30
  br label %97

35:                                               ; preds = %30
  store i32 0, ptr %4, align 4, !tbaa !9
  br label %36

36:                                               ; preds = %49, %35
  %37 = load i32, ptr %4, align 4, !tbaa !9
  %38 = load i32, ptr @NP, align 4, !tbaa !9
  %39 = icmp slt i32 %37, %38
  br i1 %39, label %40, label %52

40:                                               ; preds = %36
  %41 = load i32, ptr %4, align 4, !tbaa !9
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [10 x [15 x i8]], ptr @name, i64 0, i64 %42
  %44 = getelementptr inbounds [15 x i8], ptr %43, i64 0, i64 0
  %45 = call i32 @strcmp(ptr noundef @NG, ptr noundef %44) #6
  %46 = icmp ne i32 %45, 0
  br i1 %46, label %48, label %47

47:                                               ; preds = %40
  br label %52

48:                                               ; preds = %40
  br label %49

49:                                               ; preds = %48
  %50 = load i32, ptr %4, align 4, !tbaa !9
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %4, align 4, !tbaa !9
  br label %36, !llvm.loop !13

52:                                               ; preds = %47, %36
  %53 = load i32, ptr %6, align 4, !tbaa !9
  %54 = load i32, ptr %5, align 4, !tbaa !9
  %55 = sdiv i32 %54, %53
  store i32 %55, ptr %5, align 4, !tbaa !9
  %56 = load i32, ptr %5, align 4, !tbaa !9
  %57 = load i32, ptr %6, align 4, !tbaa !9
  %58 = mul nsw i32 %56, %57
  %59 = load i32, ptr %4, align 4, !tbaa !9
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [10 x i32], ptr @money, i64 0, i64 %60
  %62 = load i32, ptr %61, align 4, !tbaa !9
  %63 = sub nsw i32 %62, %58
  store i32 %63, ptr %61, align 4, !tbaa !9
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %64

64:                                               ; preds = %93, %52
  %65 = load i32, ptr %3, align 4, !tbaa !9
  %66 = load i32, ptr %6, align 4, !tbaa !9
  %67 = icmp slt i32 %65, %66
  br i1 %67, label %68, label %96

68:                                               ; preds = %64
  call void @llvm.memset.p0.i64(ptr align 1 @NG, i8 0, i64 15, i1 false)
  %69 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.5, ptr noundef @NG)
  store i32 0, ptr %4, align 4, !tbaa !9
  br label %70

70:                                               ; preds = %83, %68
  %71 = load i32, ptr %4, align 4, !tbaa !9
  %72 = load i32, ptr @NP, align 4, !tbaa !9
  %73 = icmp slt i32 %71, %72
  br i1 %73, label %74, label %86

74:                                               ; preds = %70
  %75 = load i32, ptr %4, align 4, !tbaa !9
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [10 x [15 x i8]], ptr @name, i64 0, i64 %76
  %78 = getelementptr inbounds [15 x i8], ptr %77, i64 0, i64 0
  %79 = call i32 @strcmp(ptr noundef @NG, ptr noundef %78) #6
  %80 = icmp ne i32 %79, 0
  br i1 %80, label %82, label %81

81:                                               ; preds = %74
  br label %86

82:                                               ; preds = %74
  br label %83

83:                                               ; preds = %82
  %84 = load i32, ptr %4, align 4, !tbaa !9
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr %4, align 4, !tbaa !9
  br label %70, !llvm.loop !14

86:                                               ; preds = %81, %70
  %87 = load i32, ptr %5, align 4, !tbaa !9
  %88 = load i32, ptr %4, align 4, !tbaa !9
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [10 x i32], ptr @money, i64 0, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !9
  %92 = add nsw i32 %91, %87
  store i32 %92, ptr %90, align 4, !tbaa !9
  br label %93

93:                                               ; preds = %86
  %94 = load i32, ptr %3, align 4, !tbaa !9
  %95 = add nsw i32 %94, 1
  store i32 %95, ptr %3, align 4, !tbaa !9
  br label %64, !llvm.loop !15

96:                                               ; preds = %64
  br label %97

97:                                               ; preds = %96, %34
  %98 = load i32, ptr %2, align 4, !tbaa !9
  %99 = add nsw i32 %98, 1
  store i32 %99, ptr %2, align 4, !tbaa !9
  br label %26, !llvm.loop !16

100:                                              ; preds = %26
  store i32 0, ptr %2, align 4, !tbaa !9
  br label %101

101:                                              ; preds = %115, %100
  %102 = load i32, ptr %2, align 4, !tbaa !9
  %103 = load i32, ptr @NP, align 4, !tbaa !9
  %104 = icmp slt i32 %102, %103
  br i1 %104, label %105, label %118

105:                                              ; preds = %101
  %106 = load i32, ptr %2, align 4, !tbaa !9
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [10 x [15 x i8]], ptr @name, i64 0, i64 %107
  %109 = getelementptr inbounds [15 x i8], ptr %108, i64 0, i64 0
  %110 = load i32, ptr %2, align 4, !tbaa !9
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [10 x i32], ptr @money, i64 0, i64 %111
  %113 = load i32, ptr %112, align 4, !tbaa !9
  %114 = call i32 (ptr, ...) @printf(ptr noundef @.str.7, ptr noundef %109, i32 noundef %113)
  br label %115

115:                                              ; preds = %105
  %116 = load i32, ptr %2, align 4, !tbaa !9
  %117 = add nsw i32 %116, 1
  store i32 %117, ptr %2, align 4, !tbaa !9
  br label %101, !llvm.loop !17

118:                                              ; preds = %101
  %119 = load ptr, ptr @stdin, align 8, !tbaa !5
  %120 = call i32 @fclose(ptr noundef %119)
  %121 = load ptr, ptr @stdout, align 8, !tbaa !5
  %122 = call i32 @fclose(ptr noundef %121)
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  ret i32 0
}

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2

declare i32 @__isoc99_scanf(ptr noundef, ...) #1

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

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #4

declare i32 @printf(ptr noundef, ...) #1

declare i32 @fclose(ptr noundef) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind willreturn memory(read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@name = external dso_local global [10 x [15 x i8]], align 16
@NG = external dso_local global [15 x i8], align 1
@money = external dso_local local_unnamed_addr global [10 x i32], align 16
@NP = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = load ptr, ptr @stdin, align 8, !tbaa !5
  %4 = tail call ptr @freopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef %3)
  %5 = load ptr, ptr @stdout, align 8, !tbaa !5
  %6 = tail call ptr @freopen(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, ptr noundef %5)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %7 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull @NP)
  %8 = load i32, ptr @NP, align 4, !tbaa !9
  %9 = icmp sgt i32 %8, 0
  br i1 %9, label %.lr.ph, label %._crit_edge45

.preheader25:                                     ; preds = %.lr.ph
  %10 = icmp sgt i32 %13, 0
  br i1 %10, label %.lr.ph42, label %._crit_edge45

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %11 = getelementptr inbounds [10 x [15 x i8]], ptr @name, i64 0, i64 %indvars.iv
  %12 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.5, ptr noundef nonnull %11)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %13 = load i32, ptr @NP, align 4, !tbaa !9
  %14 = sext i32 %13 to i64
  %15 = icmp slt i64 %indvars.iv.next, %14
  br i1 %15, label %.lr.ph, label %.preheader25, !llvm.loop !11

.preheader:                                       ; preds = %.loopexit
  %16 = icmp sgt i32 %47, 0
  br i1 %16, label %.lr.ph44, label %._crit_edge45

.lr.ph42:                                         ; preds = %.preheader25, %.loopexit
  %.12141 = phi i32 [ %48, %.loopexit ], [ 0, %.preheader25 ]
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(15) @NG, i8 0, i64 15, i1 false)
  %17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.6, ptr noundef nonnull @NG, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %18 = load i32, ptr %2, align 4, !tbaa !9
  %.not = icmp eq i32 %18, 0
  %.pre = load i32, ptr @NP, align 4, !tbaa !9
  br i1 %.not, label %.loopexit, label %.preheader24

.preheader24:                                     ; preds = %.lr.ph42
  %19 = icmp sgt i32 %.pre, 0
  br i1 %19, label %.lr.ph28.preheader, label %._crit_edge

.lr.ph28.preheader:                               ; preds = %.preheader24
  %wide.trip.count = zext nneg i32 %.pre to i64
  br label %.lr.ph28

.lr.ph28:                                         ; preds = %.lr.ph28.preheader, %22
  %indvars.iv47 = phi i64 [ 0, %.lr.ph28.preheader ], [ %indvars.iv.next48, %22 ]
  %20 = getelementptr inbounds [10 x [15 x i8]], ptr @name, i64 0, i64 %indvars.iv47
  %21 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) @NG, ptr noundef nonnull dereferenceable(1) %20) #7
  %.not22 = icmp eq i32 %21, 0
  br i1 %.not22, label %._crit_edge.loopexit.split.loop.exit, label %22

22:                                               ; preds = %.lr.ph28
  %indvars.iv.next48 = add nuw nsw i64 %indvars.iv47, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next48, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph28, !llvm.loop !13

._crit_edge.loopexit.split.loop.exit:             ; preds = %.lr.ph28
  %23 = trunc nuw nsw i64 %indvars.iv47 to i32
  br label %._crit_edge

._crit_edge:                                      ; preds = %22, %._crit_edge.loopexit.split.loop.exit, %.preheader24
  %.0.lcssa = phi i32 [ 0, %.preheader24 ], [ %23, %._crit_edge.loopexit.split.loop.exit ], [ %.pre, %22 ]
  %24 = load i32, ptr %1, align 4, !tbaa !9
  %25 = sdiv i32 %24, %18
  store i32 %25, ptr %1, align 4, !tbaa !9
  %26 = mul nsw i32 %25, %18
  %27 = zext nneg i32 %.0.lcssa to i64
  %28 = getelementptr inbounds [10 x i32], ptr @money, i64 0, i64 %27
  %29 = load i32, ptr %28, align 4, !tbaa !9
  %30 = sub nsw i32 %29, %26
  store i32 %30, ptr %28, align 4, !tbaa !9
  %31 = icmp sgt i32 %18, 0
  br i1 %31, label %.lr.ph40, label %.loopexit

.lr.ph40:                                         ; preds = %._crit_edge, %._crit_edge34
  %.01938 = phi i32 [ %44, %._crit_edge34 ], [ 0, %._crit_edge ]
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(15) @NG, i8 0, i64 15, i1 false)
  %32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.5, ptr noundef nonnull @NG)
  %33 = load i32, ptr @NP, align 4, !tbaa !9
  %34 = icmp sgt i32 %33, 0
  br i1 %34, label %.lr.ph33.preheader, label %._crit_edge34

.lr.ph33.preheader:                               ; preds = %.lr.ph40
  %wide.trip.count53 = zext nneg i32 %33 to i64
  br label %.lr.ph33

.lr.ph33:                                         ; preds = %.lr.ph33.preheader, %37
  %indvars.iv50 = phi i64 [ 0, %.lr.ph33.preheader ], [ %indvars.iv.next51, %37 ]
  %35 = getelementptr inbounds [10 x [15 x i8]], ptr @name, i64 0, i64 %indvars.iv50
  %36 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) @NG, ptr noundef nonnull dereferenceable(1) %35) #7
  %.not23 = icmp eq i32 %36, 0
  br i1 %.not23, label %._crit_edge34.loopexit.split.loop.exit, label %37

37:                                               ; preds = %.lr.ph33
  %indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1
  %exitcond54.not = icmp eq i64 %indvars.iv.next51, %wide.trip.count53
  br i1 %exitcond54.not, label %._crit_edge34, label %.lr.ph33, !llvm.loop !14

._crit_edge34.loopexit.split.loop.exit:           ; preds = %.lr.ph33
  %38 = trunc nuw nsw i64 %indvars.iv50 to i32
  br label %._crit_edge34

._crit_edge34:                                    ; preds = %37, %._crit_edge34.loopexit.split.loop.exit, %.lr.ph40
  %.1.lcssa = phi i32 [ 0, %.lr.ph40 ], [ %38, %._crit_edge34.loopexit.split.loop.exit ], [ %33, %37 ]
  %39 = load i32, ptr %1, align 4, !tbaa !9
  %40 = zext nneg i32 %.1.lcssa to i64
  %41 = getelementptr inbounds [10 x i32], ptr @money, i64 0, i64 %40
  %42 = load i32, ptr %41, align 4, !tbaa !9
  %43 = add nsw i32 %42, %39
  store i32 %43, ptr %41, align 4, !tbaa !9
  %44 = add nuw nsw i32 %.01938, 1
  %45 = load i32, ptr %2, align 4, !tbaa !9
  %46 = icmp slt i32 %44, %45
  br i1 %46, label %.lr.ph40, label %.loopexit, !llvm.loop !15

.loopexit:                                        ; preds = %._crit_edge34, %._crit_edge, %.lr.ph42
  %47 = phi i32 [ %.pre, %._crit_edge ], [ %.pre, %.lr.ph42 ], [ %33, %._crit_edge34 ]
  %48 = add nuw nsw i32 %.12141, 1
  %49 = icmp slt i32 %48, %47
  br i1 %49, label %.lr.ph42, label %.preheader, !llvm.loop !16

.lr.ph44:                                         ; preds = %.preheader, %.lr.ph44
  %indvars.iv55 = phi i64 [ %indvars.iv.next56, %.lr.ph44 ], [ 0, %.preheader ]
  %50 = getelementptr inbounds [10 x [15 x i8]], ptr @name, i64 0, i64 %indvars.iv55
  %51 = getelementptr inbounds [10 x i32], ptr @money, i64 0, i64 %indvars.iv55
  %52 = load i32, ptr %51, align 4, !tbaa !9
  %53 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, ptr noundef nonnull %50, i32 noundef %52)
  %indvars.iv.next56 = add nuw nsw i64 %indvars.iv55, 1
  %54 = load i32, ptr @NP, align 4, !tbaa !9
  %55 = sext i32 %54 to i64
  %56 = icmp slt i64 %indvars.iv.next56, %55
  br i1 %56, label %.lr.ph44, label %._crit_edge45, !llvm.loop !17

._crit_edge45:                                    ; preds = %.lr.ph44, %0, %.preheader25, %.preheader
  %57 = load ptr, ptr @stdin, align 8, !tbaa !5
  %58 = call i32 @fclose(ptr noundef %57)
  %59 = load ptr, ptr @stdout, align 8, !tbaa !5
  %60 = call i32 @fclose(ptr noundef %59)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  ret i32 0
}

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #5

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3

; Function Attrs: nofree nounwind
declare noundef i32 @fclose(ptr nocapture noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass