; LLVM IR from Izaron/ACM-ICPC :: Timus Online Judge/Volume 3/1220. Stacks (main)

; 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.cooler = type { i32, i32, i32 }

@heapCnt = external dso_local global [12002 x i32], align 16
@cool = external dso_local global [1001 x %struct.cooler], align 16
@n = external dso_local global i32, align 4
@a = external dso_local global i32, align 4
@b = external dso_local global i32, align 4
@p = external dso_local global i32, align 4
@ch = external dso_local global [12 x i8], align 1
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 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
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %5

5:                                                ; preds = %13, %0
  %6 = load i32, ptr %2, align 4, !tbaa !5
  %7 = icmp slt i32 %6, 12002
  br i1 %7, label %9, label %8

8:                                                ; preds = %5
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %16

9:                                                ; preds = %5
  %10 = load i32, ptr %2, align 4, !tbaa !5
  %11 = sext i32 %10 to i64
  %12 = getelementptr inbounds [12002 x i32], ptr @heapCnt, i64 0, i64 %11
  store i32 -1, ptr %12, align 4, !tbaa !5
  br label %13

13:                                               ; preds = %9
  %14 = load i32, ptr %2, align 4, !tbaa !5
  %15 = add nsw i32 %14, 1
  store i32 %15, ptr %2, align 4, !tbaa !5
  br label %5, !llvm.loop !9

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

17:                                               ; preds = %27, %16
  %18 = load i32, ptr %3, align 4, !tbaa !5
  %19 = icmp slt i32 %18, 1001
  br i1 %19, label %21, label %20

20:                                               ; preds = %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %30

21:                                               ; preds = %17
  %22 = load i32, ptr %3, align 4, !tbaa !5
  %23 = load i32, ptr %3, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [1001 x %struct.cooler], ptr @cool, i64 0, i64 %24
  %26 = getelementptr inbounds %struct.cooler, ptr %25, i32 0, i32 1
  store i32 %22, ptr %26, align 4, !tbaa !11
  br label %27

27:                                               ; preds = %21
  %28 = load i32, ptr %3, align 4, !tbaa !5
  %29 = add nsw i32 %28, 1
  store i32 %29, ptr %3, align 4, !tbaa !5
  br label %17, !llvm.loop !13

30:                                               ; preds = %20
  %31 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %32

32:                                               ; preds = %151, %30
  %33 = load i32, ptr %4, align 4, !tbaa !5
  %34 = load i32, ptr @n, align 4, !tbaa !5
  %35 = icmp slt i32 %33, %34
  br i1 %35, label %37, label %36

36:                                               ; preds = %32
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %154

37:                                               ; preds = %32
  %38 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @ch)
  store i32 0, ptr @p, align 4, !tbaa !5
  store i32 0, ptr @a, align 4, !tbaa !5
  store i32 0, ptr @b, align 4, !tbaa !5
  %39 = load i8, ptr getelementptr inbounds ([12 x i8], ptr @ch, i64 0, i64 1), align 1, !tbaa !14
  %40 = sext i8 %39 to i32
  %41 = icmp eq i32 %40, 85
  br i1 %41, label %42, label %111

42:                                               ; preds = %37
  %43 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @ch)
  br label %44

44:                                               ; preds = %60, %42
  %45 = load i32, ptr @p, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [12 x i8], ptr @ch, i64 0, i64 %46
  %48 = load i8, ptr %47, align 1, !tbaa !14
  %49 = sext i8 %48 to i32
  %50 = icmp sge i32 %49, 48
  br i1 %50, label %51, label %58

51:                                               ; preds = %44
  %52 = load i32, ptr @p, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [12 x i8], ptr @ch, i64 0, i64 %53
  %55 = load i8, ptr %54, align 1, !tbaa !14
  %56 = sext i8 %55 to i32
  %57 = icmp sle i32 %56, 57
  br label %58

58:                                               ; preds = %51, %44
  %59 = phi i1 [ false, %44 ], [ %57, %51 ]
  br i1 %59, label %60, label %73

60:                                               ; preds = %58
  %61 = load i32, ptr @a, align 4, !tbaa !5
  %62 = mul nsw i32 %61, 10
  store i32 %62, ptr @a, align 4, !tbaa !5
  %63 = load i32, ptr @p, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [12 x i8], ptr @ch, i64 0, i64 %64
  %66 = load i8, ptr %65, align 1, !tbaa !14
  %67 = sext i8 %66 to i32
  %68 = sub nsw i32 %67, 48
  %69 = load i32, ptr @a, align 4, !tbaa !5
  %70 = add nsw i32 %69, %68
  store i32 %70, ptr @a, align 4, !tbaa !5
  %71 = load i32, ptr @p, align 4, !tbaa !5
  %72 = add nsw i32 %71, 1
  store i32 %72, ptr @p, align 4, !tbaa !5
  br label %44, !llvm.loop !15

73:                                               ; preds = %58
  store i32 0, ptr @p, align 4, !tbaa !5
  %74 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @ch)
  br label %75

75:                                               ; preds = %91, %73
  %76 = load i32, ptr @p, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [12 x i8], ptr @ch, i64 0, i64 %77
  %79 = load i8, ptr %78, align 1, !tbaa !14
  %80 = sext i8 %79 to i32
  %81 = icmp sge i32 %80, 48
  br i1 %81, label %82, label %89

82:                                               ; preds = %75
  %83 = load i32, ptr @p, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [12 x i8], ptr @ch, i64 0, i64 %84
  %86 = load i8, ptr %85, align 1, !tbaa !14
  %87 = sext i8 %86 to i32
  %88 = icmp sle i32 %87, 57
  br label %89

89:                                               ; preds = %82, %75
  %90 = phi i1 [ false, %75 ], [ %88, %82 ]
  br i1 %90, label %91, label %104

91:                                               ; preds = %89
  %92 = load i32, ptr @b, align 4, !tbaa !5
  %93 = mul nsw i32 %92, 10
  store i32 %93, ptr @b, align 4, !tbaa !5
  %94 = load i32, ptr @p, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [12 x i8], ptr @ch, i64 0, i64 %95
  %97 = load i8, ptr %96, align 1, !tbaa !14
  %98 = sext i8 %97 to i32
  %99 = sub nsw i32 %98, 48
  %100 = load i32, ptr @b, align 4, !tbaa !5
  %101 = add nsw i32 %100, %99
  store i32 %101, ptr @b, align 4, !tbaa !5
  %102 = load i32, ptr @p, align 4, !tbaa !5
  %103 = add nsw i32 %102, 1
  store i32 %103, ptr @p, align 4, !tbaa !5
  br label %75, !llvm.loop !16

104:                                              ; preds = %89
  %105 = load i32, ptr @a, align 4, !tbaa !5
  %106 = add nsw i32 %105, -1
  store i32 %106, ptr @a, align 4, !tbaa !5
  %107 = load i32, ptr @a, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [1001 x %struct.cooler], ptr @cool, i64 0, i64 %108
  %110 = load i32, ptr @b, align 4, !tbaa !5
  call void @_ZN6cooler4pushEi(ptr noundef nonnull align 4 dereferenceable(12) %109, i32 noundef %110)
  br label %150

111:                                              ; preds = %37
  %112 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @ch)
  br label %113

113:                                              ; preds = %129, %111
  %114 = load i32, ptr @p, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [12 x i8], ptr @ch, i64 0, i64 %115
  %117 = load i8, ptr %116, align 1, !tbaa !14
  %118 = sext i8 %117 to i32
  %119 = icmp sge i32 %118, 48
  br i1 %119, label %120, label %127

120:                                              ; preds = %113
  %121 = load i32, ptr @p, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [12 x i8], ptr @ch, i64 0, i64 %122
  %124 = load i8, ptr %123, align 1, !tbaa !14
  %125 = sext i8 %124 to i32
  %126 = icmp sle i32 %125, 57
  br label %127

127:                                              ; preds = %120, %113
  %128 = phi i1 [ false, %113 ], [ %126, %120 ]
  br i1 %128, label %129, label %142

129:                                              ; preds = %127
  %130 = load i32, ptr @a, align 4, !tbaa !5
  %131 = mul nsw i32 %130, 10
  store i32 %131, ptr @a, align 4, !tbaa !5
  %132 = load i32, ptr @p, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [12 x i8], ptr @ch, i64 0, i64 %133
  %135 = load i8, ptr %134, align 1, !tbaa !14
  %136 = sext i8 %135 to i32
  %137 = sub nsw i32 %136, 48
  %138 = load i32, ptr @a, align 4, !tbaa !5
  %139 = add nsw i32 %138, %137
  store i32 %139, ptr @a, align 4, !tbaa !5
  %140 = load i32, ptr @p, align 4, !tbaa !5
  %141 = add nsw i32 %140, 1
  store i32 %141, ptr @p, align 4, !tbaa !5
  br label %113, !llvm.loop !17

142:                                              ; preds = %127
  %143 = load i32, ptr @a, align 4, !tbaa !5
  %144 = add nsw i32 %143, -1
  store i32 %144, ptr @a, align 4, !tbaa !5
  %145 = load i32, ptr @a, align 4, !tbaa !5
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [1001 x %struct.cooler], ptr @cool, i64 0, i64 %146
  %148 = call noundef i32 @_ZN6cooler3popEv(ptr noundef nonnull align 4 dereferenceable(12) %147)
  %149 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %148)
  br label %150

150:                                              ; preds = %142, %104
  br label %151

151:                                              ; preds = %150
  %152 = load i32, ptr %4, align 4, !tbaa !5
  %153 = add nsw i32 %152, 1
  store i32 %153, ptr %4, align 4, !tbaa !5
  br label %32, !llvm.loop !18

154:                                              ; preds = %36
  %155 = load i32, ptr %1, align 4
  ret i32 %155
}

; 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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6cooler4pushEi(ptr noundef nonnull align 4 dereferenceable(12), i32 noundef) #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN6cooler3popEv(ptr noundef nonnull align 4 dereferenceable(12)) #4 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 = { "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 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 #4 = { 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 #5 = { 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !6, i64 4}
!12 = !{!"_ZTS6cooler", !6, i64 0, !6, i64 4, !6, i64 8}
!13 = distinct !{!13, !10}
!14 = !{!7, !7, i64 0}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}


; 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.cooler = type { i32, i32, i32 }

@heapCnt = external dso_local local_unnamed_addr global [12002 x i32], align 16
@cool = external dso_local global [1001 x %struct.cooler], align 16
@n = external dso_local global i32, align 4
@a = external dso_local local_unnamed_addr global i32, align 4
@b = external dso_local local_unnamed_addr global i32, align 4
@p = external dso_local local_unnamed_addr global i32, align 4
@ch = external dso_local global [12 x i8], align 1
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
.preheader.preheader:
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(48008) @heapCnt, i8 -1, i64 48008, i1 false), !tbaa !5
  br label %.preheader

0:                                                ; preds = %.preheader
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %2 = load i32, ptr @n, align 4, !tbaa !5
  %3 = icmp sgt i32 %2, 0
  br i1 %3, label %.lr.ph37, label %._crit_edge

.preheader:                                       ; preds = %.preheader.1, %.preheader.preheader
  %indvars.iv = phi i64 [ 0, %.preheader.preheader ], [ %indvars.iv.next.3, %.preheader.1 ]
  %4 = getelementptr inbounds [1001 x %struct.cooler], ptr @cool, i64 0, i64 %indvars.iv, i32 1
  %5 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %5, ptr %4, align 4, !tbaa !9
  %exitcond.not = icmp eq i64 %indvars.iv, 1000
  br i1 %exitcond.not, label %0, label %.preheader.1, !llvm.loop !11

.preheader.1:                                     ; preds = %.preheader
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %6 = getelementptr inbounds [1001 x %struct.cooler], ptr @cool, i64 0, i64 %indvars.iv.next, i32 1
  %7 = trunc nuw nsw i64 %indvars.iv.next to i32
  store i32 %7, ptr %6, align 16, !tbaa !9
  %indvars.iv.next.1 = or disjoint i64 %indvars.iv, 2
  %8 = getelementptr inbounds [1001 x %struct.cooler], ptr @cool, i64 0, i64 %indvars.iv.next.1, i32 1
  %9 = trunc nuw nsw i64 %indvars.iv.next.1 to i32
  store i32 %9, ptr %8, align 4, !tbaa !9
  %indvars.iv.next.2 = or disjoint i64 %indvars.iv, 3
  %10 = getelementptr inbounds [1001 x %struct.cooler], ptr @cool, i64 0, i64 %indvars.iv.next.2, i32 1
  %11 = trunc nuw nsw i64 %indvars.iv.next.2 to i32
  store i32 %11, ptr %10, align 8, !tbaa !9
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  br label %.preheader

._crit_edge:                                      ; preds = %71, %0
  ret i32 0

.lr.ph37:                                         ; preds = %0, %71
  %.036 = phi i32 [ %72, %71 ], [ 0, %0 ]
  %12 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @ch)
  store i32 0, ptr @p, align 4, !tbaa !5
  store i32 0, ptr @a, align 4, !tbaa !5
  store i32 0, ptr @b, align 4, !tbaa !5
  %13 = load i8, ptr getelementptr inbounds (i8, ptr @ch, i64 1), align 1, !tbaa !13
  %14 = icmp eq i8 %13, 85
  %15 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @ch)
  %p.promoted25 = load i32, ptr @p, align 4, !tbaa !5
  br i1 %14, label %16, label %50

16:                                               ; preds = %.lr.ph37
  %17 = sext i32 %p.promoted25 to i64
  %18 = getelementptr inbounds [12 x i8], ptr @ch, i64 0, i64 %17
  %19 = load i8, ptr %18, align 1, !tbaa !13
  %20 = add i8 %19, -48
  %or.cond27 = icmp ult i8 %20, 10
  br i1 %or.cond27, label %.lr.ph28.preheader, label %.critedge

.lr.ph28.preheader:                               ; preds = %16
  %a.promoted26 = load i32, ptr @a, align 4, !tbaa !5
  br label %.lr.ph28

.lr.ph28:                                         ; preds = %.lr.ph28.preheader, %.lr.ph28
  %indvars.iv47 = phi i64 [ %17, %.lr.ph28.preheader ], [ %indvars.iv.next48, %.lr.ph28 ]
  %21 = phi i8 [ %19, %.lr.ph28.preheader ], [ %28, %.lr.ph28 ]
  %22 = phi i32 [ %a.promoted26, %.lr.ph28.preheader ], [ %26, %.lr.ph28 ]
  %23 = mul nsw i32 %22, 10
  %24 = zext nneg i8 %21 to i32
  %25 = add nsw i32 %24, -48
  %26 = add nsw i32 %25, %23
  %indvars.iv.next48 = add nsw i64 %indvars.iv47, 1
  %27 = getelementptr inbounds [12 x i8], ptr @ch, i64 0, i64 %indvars.iv.next48
  %28 = load i8, ptr %27, align 1, !tbaa !13
  %29 = add i8 %28, -48
  %or.cond = icmp ult i8 %29, 10
  br i1 %or.cond, label %.lr.ph28, label %..critedge_crit_edge, !llvm.loop !14

..critedge_crit_edge:                             ; preds = %.lr.ph28
  store i32 %26, ptr @a, align 4, !tbaa !5
  br label %.critedge

.critedge:                                        ; preds = %..critedge_crit_edge, %16
  store i32 0, ptr @p, align 4, !tbaa !5
  %30 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @ch)
  %p.promoted31 = load i32, ptr @p, align 4, !tbaa !5
  %b.promoted = load i32, ptr @b, align 4, !tbaa !5
  %31 = sext i32 %p.promoted31 to i64
  %32 = getelementptr inbounds [12 x i8], ptr @ch, i64 0, i64 %31
  %33 = load i8, ptr %32, align 1, !tbaa !13
  %34 = add i8 %33, -48
  %or.cond1932 = icmp ult i8 %34, 10
  br i1 %or.cond1932, label %.lr.ph33, label %.critedge2

.lr.ph33:                                         ; preds = %.critedge, %.lr.ph33
  %indvars.iv49 = phi i64 [ %indvars.iv.next50, %.lr.ph33 ], [ %31, %.critedge ]
  %35 = phi i8 [ %42, %.lr.ph33 ], [ %33, %.critedge ]
  %36 = phi i32 [ %40, %.lr.ph33 ], [ %b.promoted, %.critedge ]
  %37 = mul nsw i32 %36, 10
  %38 = zext nneg i8 %35 to i32
  %39 = add nsw i32 %38, -48
  %40 = add nsw i32 %39, %37
  %indvars.iv.next50 = add nsw i64 %indvars.iv49, 1
  %41 = getelementptr inbounds [12 x i8], ptr @ch, i64 0, i64 %indvars.iv.next50
  %42 = load i8, ptr %41, align 1, !tbaa !13
  %43 = add i8 %42, -48
  %or.cond19 = icmp ult i8 %43, 10
  br i1 %or.cond19, label %.lr.ph33, label %..critedge2_crit_edge, !llvm.loop !15

..critedge2_crit_edge:                            ; preds = %.lr.ph33
  %44 = trunc nsw i64 %indvars.iv.next50 to i32
  store i32 %40, ptr @b, align 4, !tbaa !5
  store i32 %44, ptr @p, align 4, !tbaa !5
  br label %.critedge2

.critedge2:                                       ; preds = %..critedge2_crit_edge, %.critedge
  %45 = phi i32 [ %40, %..critedge2_crit_edge ], [ %b.promoted, %.critedge ]
  %46 = load i32, ptr @a, align 4, !tbaa !5
  %47 = add nsw i32 %46, -1
  store i32 %47, ptr @a, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [1001 x %struct.cooler], ptr @cool, i64 0, i64 %48
  tail call void @_ZN6cooler4pushEi(ptr noundef nonnull align 4 dereferenceable(12) %49, i32 noundef %45)
  br label %71

50:                                               ; preds = %.lr.ph37
  %a.promoted = load i32, ptr @a, align 4, !tbaa !5
  %51 = sext i32 %p.promoted25 to i64
  %52 = getelementptr inbounds [12 x i8], ptr @ch, i64 0, i64 %51
  %53 = load i8, ptr %52, align 1, !tbaa !13
  %54 = add i8 %53, -48
  %or.cond2023 = icmp ult i8 %54, 10
  br i1 %or.cond2023, label %.lr.ph, label %.critedge4

.lr.ph:                                           ; preds = %50, %.lr.ph
  %indvars.iv45 = phi i64 [ %indvars.iv.next46, %.lr.ph ], [ %51, %50 ]
  %55 = phi i8 [ %62, %.lr.ph ], [ %53, %50 ]
  %56 = phi i32 [ %60, %.lr.ph ], [ %a.promoted, %50 ]
  %57 = mul nsw i32 %56, 10
  %58 = zext nneg i8 %55 to i32
  %59 = add nsw i32 %58, -48
  %60 = add nsw i32 %59, %57
  %indvars.iv.next46 = add nsw i64 %indvars.iv45, 1
  %61 = getelementptr inbounds [12 x i8], ptr @ch, i64 0, i64 %indvars.iv.next46
  %62 = load i8, ptr %61, align 1, !tbaa !13
  %63 = add i8 %62, -48
  %or.cond20 = icmp ult i8 %63, 10
  br i1 %or.cond20, label %.lr.ph, label %..critedge4_crit_edge, !llvm.loop !16

..critedge4_crit_edge:                            ; preds = %.lr.ph
  %64 = trunc nsw i64 %indvars.iv.next46 to i32
  store i32 %64, ptr @p, align 4, !tbaa !5
  br label %.critedge4

.critedge4:                                       ; preds = %..critedge4_crit_edge, %50
  %65 = phi i32 [ %60, %..critedge4_crit_edge ], [ %a.promoted, %50 ]
  %66 = add nsw i32 %65, -1
  store i32 %66, ptr @a, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [1001 x %struct.cooler], ptr @cool, i64 0, i64 %67
  %69 = tail call noundef i32 @_ZN6cooler3popEv(ptr noundef nonnull align 4 dereferenceable(12) %68)
  %70 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %69)
  br label %71

71:                                               ; preds = %.critedge2, %.critedge4
  %72 = add nuw nsw i32 %.036, 1
  %73 = load i32, ptr @n, align 4, !tbaa !5
  %74 = icmp slt i32 %72, %73
  br i1 %74, label %.lr.ph37, label %._crit_edge, !llvm.loop !17
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6cooler4pushEi(ptr noundef nonnull align 4 dereferenceable(12), i32 noundef) local_unnamed_addr #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN6cooler3popEv(ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #3 align 2

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

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 = { 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 #2 = { 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 #3 = { 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }

!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, !6, i64 4}
!10 = !{!"_ZTS6cooler", !6, i64 0, !6, i64 4, !6, i64 8}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}


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