; LLVM IR from tangjz/acm-icpc :: lydsy (3034)

; 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"

%struct.Big_int = type { i32, [3127 x i32] }

@num = external dso_local global [5852 x %struct.Big_int], align 16
@tmp = external dso_local global %struct.Big_int, align 4
@tot = external dso_local global i32, align 4
@prime = external dso_local global [57774 x i32], align 16
@vis = external dso_local global [57774 x i8], align 16
@.str = external hidden unnamed_addr constant [3 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
  %7 = alloca i32, align 4
  %8 = alloca %struct.Big_int, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 2, ptr %3, align 4, !tbaa !5
  br label %12

12:                                               ; preds = %70, %0
  %13 = load i32, ptr %3, align 4, !tbaa !5
  %14 = icmp slt i32 %13, 57774
  br i1 %14, label %16, label %15

15:                                               ; preds = %12
  store i32 2, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %73

16:                                               ; preds = %12
  %17 = load i32, ptr %3, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [57774 x i8], ptr @vis, i64 0, i64 %18
  %20 = load i8, ptr %19, align 1, !tbaa !9, !range !11, !noundef !12
  %21 = trunc i8 %20 to i1
  br i1 %21, label %31, label %22

22:                                               ; preds = %16
  %23 = load i32, ptr %3, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [57774 x i8], ptr @vis, i64 0, i64 %24
  store i8 1, ptr %25, align 1, !tbaa !9
  %26 = load i32, ptr %3, align 4, !tbaa !5
  %27 = load i32, ptr @tot, align 4, !tbaa !5
  %28 = add nsw i32 %27, 1
  store i32 %28, ptr @tot, align 4, !tbaa !5
  %29 = sext i32 %27 to i64
  %30 = getelementptr inbounds [57774 x i32], ptr @prime, i64 0, i64 %29
  store i32 %26, ptr %30, align 4, !tbaa !5
  br label %31

31:                                               ; preds = %22, %16
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %32

32:                                               ; preds = %65, %31
  %33 = load i32, ptr %5, align 4, !tbaa !5
  %34 = load i32, ptr @tot, align 4, !tbaa !5
  %35 = icmp slt i32 %33, %34
  br i1 %35, label %36, label %44

36:                                               ; preds = %32
  %37 = load i32, ptr %3, align 4, !tbaa !5
  %38 = load i32, ptr %5, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [57774 x i32], ptr @prime, i64 0, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = mul nsw i32 %37, %41
  %43 = icmp slt i32 %42, 57774
  br label %44

44:                                               ; preds = %36, %32
  %45 = phi i1 [ false, %32 ], [ %43, %36 ]
  br i1 %45, label %47, label %46

46:                                               ; preds = %44
  store i32 5, ptr %4, align 4
  br label %68

47:                                               ; preds = %44
  %48 = load i32, ptr %3, align 4, !tbaa !5
  %49 = load i32, ptr %5, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [57774 x i32], ptr @prime, i64 0, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = mul nsw i32 %48, %52
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [57774 x i8], ptr @vis, i64 0, i64 %54
  store i8 1, ptr %55, align 1, !tbaa !9
  %56 = load i32, ptr %3, align 4, !tbaa !5
  %57 = load i32, ptr %5, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [57774 x i32], ptr @prime, i64 0, i64 %58
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %61 = srem i32 %56, %60
  %62 = icmp eq i32 %61, 0
  br i1 %62, label %63, label %64

63:                                               ; preds = %47
  store i32 5, ptr %4, align 4
  br label %68

64:                                               ; preds = %47
  br label %65

65:                                               ; preds = %64
  %66 = load i32, ptr %5, align 4, !tbaa !5
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr %5, align 4, !tbaa !5
  br label %32, !llvm.loop !13

68:                                               ; preds = %63, %46
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  br label %69

69:                                               ; preds = %68
  br label %70

70:                                               ; preds = %69
  %71 = load i32, ptr %3, align 4, !tbaa !5
  %72 = add nsw i32 %71, 1
  store i32 %72, ptr %3, align 4, !tbaa !5
  br label %12, !llvm.loop !15

73:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 2, ptr %6, align 4, !tbaa !5
  call void @_ZN7Big_int6getintERKi(ptr noundef nonnull align 4 dereferenceable(12512) @num, ptr noundef nonnull align 4 dereferenceable(4) %6)
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %74

74:                                               ; preds = %91, %73
  %75 = load i32, ptr %7, align 4, !tbaa !5
  %76 = load i32, ptr @tot, align 4, !tbaa !5
  %77 = icmp slt i32 %75, %76
  br i1 %77, label %79, label %78

78:                                               ; preds = %74
  store i32 8, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %94

79:                                               ; preds = %74
  call void @llvm.lifetime.start.p0(i64 12512, ptr %8) #6
  %80 = load i32, ptr %7, align 4, !tbaa !5
  %81 = sub nsw i32 %80, 1
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [5852 x %struct.Big_int], ptr @num, i64 0, i64 %82
  %84 = load i32, ptr %7, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [57774 x i32], ptr @prime, i64 0, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !5
  call void @_ZNK7Big_intmlEi(ptr dead_on_unwind writable sret(%struct.Big_int) align 4 %8, ptr noundef nonnull align 4 dereferenceable(12512) %83, i32 noundef %87)
  %88 = load i32, ptr %7, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [5852 x %struct.Big_int], ptr @num, i64 0, i64 %89
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %90, ptr align 4 %8, i64 12512, i1 false), !tbaa.struct !16
  call void @llvm.lifetime.end.p0(i64 12512, ptr %8) #6
  br label %91

91:                                               ; preds = %79
  %92 = load i32, ptr %7, align 4, !tbaa !5
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %7, align 4, !tbaa !5
  br label %74, !llvm.loop !18

94:                                               ; preds = %78
  %95 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2)
  br label %96

96:                                               ; preds = %123, %94
  %97 = load i32, ptr %2, align 4, !tbaa !5
  %98 = add nsw i32 %97, -1
  store i32 %98, ptr %2, align 4, !tbaa !5
  %99 = icmp ne i32 %97, 0
  br i1 %99, label %100, label %127

100:                                              ; preds = %96
  call void @_ZN7Big_int9getstringEv(ptr noundef nonnull align 4 dereferenceable(12512) @tmp)
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %101 = load i32, ptr @tot, align 4, !tbaa !5
  %102 = sub nsw i32 %101, 1
  store i32 %102, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  br label %103

103:                                              ; preds = %122, %100
  %104 = load i32, ptr %9, align 4, !tbaa !5
  %105 = load i32, ptr %10, align 4, !tbaa !5
  %106 = icmp slt i32 %104, %105
  br i1 %106, label %107, label %123

107:                                              ; preds = %103
  %108 = load i32, ptr %9, align 4, !tbaa !5
  %109 = load i32, ptr %10, align 4, !tbaa !5
  %110 = add nsw i32 %108, %109
  %111 = add nsw i32 %110, 1
  %112 = ashr i32 %111, 1
  store i32 %112, ptr %11, align 4, !tbaa !5
  %113 = load i32, ptr %11, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [5852 x %struct.Big_int], ptr @num, i64 0, i64 %114
  %116 = call noundef zeroext i1 @_ZNK7Big_intleERKS_(ptr noundef nonnull align 4 dereferenceable(12512) %115, ptr noundef nonnull align 4 dereferenceable(12512) @tmp)
  br i1 %116, label %117, label %119

117:                                              ; preds = %107
  %118 = load i32, ptr %11, align 4, !tbaa !5
  store i32 %118, ptr %9, align 4, !tbaa !5
  br label %122

119:                                              ; preds = %107
  %120 = load i32, ptr %11, align 4, !tbaa !5
  %121 = sub nsw i32 %120, 1
  store i32 %121, ptr %10, align 4, !tbaa !5
  br label %122

122:                                              ; preds = %119, %117
  br label %103, !llvm.loop !19

123:                                              ; preds = %103
  %124 = load i32, ptr %9, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [5852 x %struct.Big_int], ptr @num, i64 0, i64 %125
  call void @_ZNK7Big_int3putEv(ptr noundef nonnull align 4 dereferenceable(12512) %126)
  call void @_ZN7Big_int5clearEv(ptr noundef nonnull align 4 dereferenceable(12512) @tmp)
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %96, !llvm.loop !20

127:                                              ; preds = %96
  store i32 0, ptr %1, align 4
  store i32 1, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  %128 = load i32, ptr %1, align 4
  ret i32 %128
}

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7Big_int6getintERKi(ptr noundef nonnull align 4 dereferenceable(12512), ptr noundef nonnull align 4 dereferenceable(4)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNK7Big_intmlEi(ptr dead_on_unwind noalias writable sret(%struct.Big_int) align 4, ptr noundef nonnull align 4 dereferenceable(12512), i32 noundef) #2 align 2

; 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) #3

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Big_int9getstringEv(ptr noundef nonnull align 4 dereferenceable(12512)) #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK7Big_intleERKS_(ptr noundef nonnull align 4 dereferenceable(12512), ptr noundef nonnull align 4 dereferenceable(12512)) #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK7Big_int3putEv(ptr noundef nonnull align 4 dereferenceable(12512)) #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7Big_int5clearEv(ptr noundef nonnull align 4 dereferenceable(12512)) #2 align 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nounwind 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { "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 = { mustprogress 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 #6 = { nounwind }

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = !{i64 0, i64 4, !5, i64 4, i64 12508, !17}
!17 = !{!7, !7, i64 0}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !14}


; 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"

%struct.Big_int = type { i32, [3127 x i32] }

@num = external dso_local global [5852 x %struct.Big_int], align 16
@tmp = external dso_local global %struct.Big_int, align 4
@tot = external dso_local local_unnamed_addr global i32, align 4
@prime = external dso_local local_unnamed_addr global [57774 x i32], align 16
@vis = external dso_local local_unnamed_addr global [57774 x i8], align 16
@.str = external hidden unnamed_addr constant [3 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 = alloca %struct.Big_int, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %tot.promoted = load i32, ptr @tot, align 4, !tbaa !5
  br label %7

4:                                                ; preds = %.critedge
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  store i32 2, ptr %2, align 4, !tbaa !5
  call void @_ZN7Big_int6getintERKi(ptr noundef nonnull align 4 dereferenceable(12512) @num, ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  %5 = load i32, ptr @tot, align 4, !tbaa !5
  %6 = icmp sgt i32 %5, 1
  br i1 %6, label %.lr.ph38, label %._crit_edge

7:                                                ; preds = %0, %.critedge
  %indvars.iv49 = phi i64 [ 2, %0 ], [ %indvars.iv.next50, %.critedge ]
  %8 = phi i32 [ %tot.promoted, %0 ], [ %18, %.critedge ]
  %9 = getelementptr inbounds [57774 x i8], ptr @vis, i64 0, i64 %indvars.iv49
  %10 = load i8, ptr %9, align 1, !tbaa !9, !range !11, !noundef !12
  %11 = trunc nuw i8 %10 to i1
  br i1 %11, label %17, label %12

12:                                               ; preds = %7
  store i8 1, ptr %9, align 1, !tbaa !9
  %13 = add nsw i32 %8, 1
  store i32 %13, ptr @tot, align 4, !tbaa !5
  %14 = sext i32 %8 to i64
  %15 = getelementptr inbounds [57774 x i32], ptr @prime, i64 0, i64 %14
  %16 = trunc nuw nsw i64 %indvars.iv49 to i32
  store i32 %16, ptr %15, align 4, !tbaa !5
  br label %17

17:                                               ; preds = %12, %7
  %18 = phi i32 [ %13, %12 ], [ %8, %7 ]
  %19 = icmp sgt i32 %18, 0
  br i1 %19, label %.lr.ph.preheader, label %.critedge

.lr.ph.preheader:                                 ; preds = %17
  %20 = zext nneg i32 %18 to i64
  %21 = trunc nuw nsw i64 %indvars.iv49 to i32
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %26
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %26 ]
  %22 = getelementptr inbounds [57774 x i32], ptr @prime, i64 0, i64 %indvars.iv
  %23 = load i32, ptr %22, align 4, !tbaa !5
  %24 = mul nsw i32 %23, %21
  %25 = icmp slt i32 %24, 57774
  br i1 %25, label %26, label %.critedge

26:                                               ; preds = %.lr.ph
  %27 = sext i32 %24 to i64
  %28 = getelementptr inbounds [57774 x i8], ptr @vis, i64 0, i64 %27
  store i8 1, ptr %28, align 1, !tbaa !9
  %29 = srem i32 %21, %23
  %30 = icmp ne i32 %29, 0
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %31 = icmp ult i64 %indvars.iv.next, %20
  %or.cond = select i1 %30, i1 %31, i1 false
  br i1 %or.cond, label %.lr.ph, label %.critedge, !llvm.loop !13

.critedge:                                        ; preds = %.lr.ph, %26, %17
  %indvars.iv.next50 = add nuw nsw i64 %indvars.iv49, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next50, 57774
  br i1 %exitcond.not, label %4, label %7, !llvm.loop !15

._crit_edge:                                      ; preds = %.lr.ph38, %4
  %32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %33 = load i32, ptr %1, align 4, !tbaa !5
  %34 = add nsw i32 %33, -1
  store i32 %34, ptr %1, align 4, !tbaa !5
  %.not44 = icmp eq i32 %33, 0
  br i1 %.not44, label %._crit_edge47, label %.lr.ph46

.lr.ph38:                                         ; preds = %4, %.lr.ph38
  %indvars.iv52 = phi i64 [ %indvars.iv.next53, %.lr.ph38 ], [ 1, %4 ]
  call void @llvm.lifetime.start.p0(i64 12512, ptr nonnull %3) #6
  %35 = add nsw i64 %indvars.iv52, -1
  %36 = getelementptr inbounds [5852 x %struct.Big_int], ptr @num, i64 0, i64 %35
  %37 = getelementptr inbounds [57774 x i32], ptr @prime, i64 0, i64 %indvars.iv52
  %38 = load i32, ptr %37, align 4, !tbaa !5
  call void @_ZNK7Big_intmlEi(ptr dead_on_unwind nonnull writable sret(%struct.Big_int) align 4 %3, ptr noundef nonnull align 4 dereferenceable(12512) %36, i32 noundef %38)
  %39 = getelementptr inbounds [5852 x %struct.Big_int], ptr @num, i64 0, i64 %indvars.iv52
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(12512) %39, ptr noundef nonnull align 4 dereferenceable(12512) %3, i64 12512, i1 false), !tbaa.struct !16
  call void @llvm.lifetime.end.p0(i64 12512, ptr nonnull %3) #6
  %indvars.iv.next53 = add nuw nsw i64 %indvars.iv52, 1
  %40 = load i32, ptr @tot, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = icmp slt i64 %indvars.iv.next53, %41
  br i1 %42, label %.lr.ph38, label %._crit_edge, !llvm.loop !18

.lr.ph46:                                         ; preds = %._crit_edge, %._crit_edge43
  call void @_ZN7Big_int9getstringEv(ptr noundef nonnull align 4 dereferenceable(12512) @tmp)
  %43 = load i32, ptr @tot, align 4, !tbaa !5
  %44 = icmp sgt i32 %43, 1
  br i1 %44, label %.lr.ph42.preheader, label %._crit_edge43

.lr.ph42.preheader:                               ; preds = %.lr.ph46
  %45 = add nsw i32 %43, -1
  br label %.lr.ph42

.lr.ph42:                                         ; preds = %.lr.ph42.preheader, %.lr.ph42
  %.040 = phi i32 [ %.1, %.lr.ph42 ], [ %45, %.lr.ph42.preheader ]
  %.02739 = phi i32 [ %.128, %.lr.ph42 ], [ 0, %.lr.ph42.preheader ]
  %46 = add nuw nsw i32 %.02739, 1
  %47 = add nuw nsw i32 %46, %.040
  %48 = lshr i32 %47, 1
  %49 = zext nneg i32 %48 to i64
  %50 = getelementptr inbounds [5852 x %struct.Big_int], ptr @num, i64 0, i64 %49
  %51 = call noundef zeroext i1 @_ZNK7Big_intleERKS_(ptr noundef nonnull align 4 dereferenceable(12512) %50, ptr noundef nonnull align 4 dereferenceable(12512) @tmp)
  %52 = add nsw i32 %48, -1
  %.128 = select i1 %51, i32 %48, i32 %.02739
  %.1 = select i1 %51, i32 %.040, i32 %52
  %53 = icmp slt i32 %.128, %.1
  br i1 %53, label %.lr.ph42, label %._crit_edge43, !llvm.loop !19

._crit_edge43:                                    ; preds = %.lr.ph42, %.lr.ph46
  %.027.lcssa = phi i32 [ 0, %.lr.ph46 ], [ %.128, %.lr.ph42 ]
  %54 = zext nneg i32 %.027.lcssa to i64
  %55 = getelementptr inbounds [5852 x %struct.Big_int], ptr @num, i64 0, i64 %54
  call void @_ZNK7Big_int3putEv(ptr noundef nonnull align 4 dereferenceable(12512) %55)
  call void @_ZN7Big_int5clearEv(ptr noundef nonnull align 4 dereferenceable(12512) @tmp)
  %56 = load i32, ptr %1, align 4, !tbaa !5
  %57 = add nsw i32 %56, -1
  store i32 %57, ptr %1, align 4, !tbaa !5
  %.not = icmp eq i32 %56, 0
  br i1 %.not, label %._crit_edge47, label %.lr.ph46, !llvm.loop !20

._crit_edge47:                                    ; preds = %._crit_edge43, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  ret i32 0
}

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7Big_int6getintERKi(ptr noundef nonnull align 4 dereferenceable(12512), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNK7Big_intmlEi(ptr dead_on_unwind noalias writable sret(%struct.Big_int) align 4, ptr noundef nonnull align 4 dereferenceable(12512), i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress 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) #3

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Big_int9getstringEv(ptr noundef nonnull align 4 dereferenceable(12512)) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK7Big_intleERKS_(ptr noundef nonnull align 4 dereferenceable(12512), ptr noundef nonnull align 4 dereferenceable(12512)) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK7Big_int3putEv(ptr noundef nonnull align 4 dereferenceable(12512)) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7Big_int5clearEv(ptr noundef nonnull align 4 dereferenceable(12512)) local_unnamed_addr #2 align 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nounwind 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 #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { mustprogress 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 #6 = { nounwind }

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = !{i64 0, i64 4, !5, i64 4, i64 12508, !17}
!17 = !{!7, !7, i64 0}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !14}


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