; LLVM IR from tangjz/acm-icpc :: leetcode/extra (DD_2019010-破译密码)

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

@_ZZ4mainE2sz = external hidden global [101 x i32], align 16
@_ZZ4mainE3val = external hidden global [101 x [201 x i32]], align 16
@_ZZ4mainE3buf = external hidden global [101 x [201 x i8]], align 16
@_ZZ4mainE3vis = external hidden global [100001 x i8], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@_ZZ4mainE3out = external hidden global [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
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %12

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

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

17:                                               ; preds = %12
  %18 = load i32, ptr %3, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [101 x [201 x i8]], ptr @_ZZ4mainE3buf, i64 0, i64 %19
  %21 = getelementptr inbounds [201 x i8], ptr %20, i64 0, i64 0
  %22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %21)
  %23 = load i32, ptr %3, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [101 x [201 x i8]], ptr @_ZZ4mainE3buf, i64 0, i64 %24
  %26 = getelementptr inbounds [201 x i8], ptr %25, i64 0, i64 0
  %27 = call i64 @strlen(ptr noundef %26) #6
  %28 = trunc i64 %27 to i32
  %29 = load i32, ptr %3, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [101 x i32], ptr @_ZZ4mainE2sz, i64 0, i64 %30
  store i32 %28, ptr %31, align 4, !tbaa !5
  %32 = load i32, ptr %3, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [101 x [201 x i32]], ptr @_ZZ4mainE3val, i64 0, i64 %33
  %35 = getelementptr inbounds [201 x i32], ptr %34, i64 0, i64 0
  %36 = load i32, ptr %3, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [101 x i32], ptr @_ZZ4mainE2sz, i64 0, i64 %37
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = mul i64 %40, 4
  call void @llvm.memset.p0.i64(ptr align 4 %35, i8 0, i64 %41, i1 false)
  br label %42

42:                                               ; preds = %17
  %43 = load i32, ptr %3, align 4, !tbaa !5
  %44 = add nsw i32 %43, 1
  store i32 %44, ptr %3, align 4, !tbaa !5
  br label %12, !llvm.loop !9

45:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 1, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 10, ptr %5, align 4, !tbaa !5
  br label %46

46:                                               ; preds = %162, %45
  %47 = load i32, ptr %5, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = mul i64 %48, 1
  call void @llvm.memset.p0.i64(ptr align 16 @_ZZ4mainE3vis, i8 0, i64 %49, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %50

50:                                               ; preds = %107, %46
  %51 = load i32, ptr %6, align 4, !tbaa !5
  %52 = load i32, ptr %2, align 4, !tbaa !5
  %53 = icmp slt i32 %51, %52
  br i1 %53, label %55, label %54

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

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

56:                                               ; preds = %103, %55
  %57 = load i32, ptr %8, align 4, !tbaa !5
  %58 = load i32, ptr %6, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [101 x i32], ptr @_ZZ4mainE2sz, i64 0, i64 %59
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = load i32, ptr %4, align 4, !tbaa !5
  %63 = sub nsw i32 %61, %62
  %64 = icmp sle i32 %57, %63
  br i1 %64, label %66, label %65

65:                                               ; preds = %56
  store i32 11, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %106

66:                                               ; preds = %56
  %67 = load i32, ptr %6, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [101 x [201 x i32]], ptr @_ZZ4mainE3val, i64 0, i64 %68
  %70 = load i32, ptr %8, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [201 x i32], ptr %69, i64 0, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %74 = mul nsw i32 %73, 10
  %75 = load i32, ptr %6, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [101 x [201 x i8]], ptr @_ZZ4mainE3buf, i64 0, i64 %76
  %78 = load i32, ptr %8, align 4, !tbaa !5
  %79 = load i32, ptr %4, align 4, !tbaa !5
  %80 = add nsw i32 %78, %79
  %81 = sub nsw i32 %80, 1
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [201 x i8], ptr %77, i64 0, i64 %82
  %84 = load i8, ptr %83, align 1, !tbaa !11
  %85 = sext i8 %84 to i32
  %86 = sub nsw i32 %85, 48
  %87 = add nsw i32 %74, %86
  %88 = load i32, ptr %6, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [101 x [201 x i32]], ptr @_ZZ4mainE3val, i64 0, i64 %89
  %91 = load i32, ptr %8, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [201 x i32], ptr %90, i64 0, i64 %92
  store i32 %87, ptr %93, align 4, !tbaa !5
  %94 = load i32, ptr %6, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [101 x [201 x i32]], ptr @_ZZ4mainE3val, i64 0, i64 %95
  %97 = load i32, ptr %8, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [201 x i32], ptr %96, i64 0, i64 %98
  %100 = load i32, ptr %99, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [100001 x i8], ptr @_ZZ4mainE3vis, i64 0, i64 %101
  store i8 1, ptr %102, align 1, !tbaa !12
  br label %103

103:                                              ; preds = %66
  %104 = load i32, ptr %8, align 4, !tbaa !5
  %105 = add nsw i32 %104, 1
  store i32 %105, ptr %8, align 4, !tbaa !5
  br label %56, !llvm.loop !14

106:                                              ; preds = %65
  br label %107

107:                                              ; preds = %106
  %108 = load i32, ptr %6, align 4, !tbaa !5
  %109 = add nsw i32 %108, 1
  store i32 %109, ptr %6, align 4, !tbaa !5
  br label %50, !llvm.loop !15

110:                                              ; preds = %54
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %111

111:                                              ; preds = %124, %110
  %112 = load i32, ptr %9, align 4, !tbaa !5
  %113 = load i32, ptr %5, align 4, !tbaa !5
  %114 = icmp slt i32 %112, %113
  br i1 %114, label %115, label %121

115:                                              ; preds = %111
  %116 = load i32, ptr %9, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [100001 x i8], ptr @_ZZ4mainE3vis, i64 0, i64 %117
  %119 = load i8, ptr %118, align 1, !tbaa !12, !range !16, !noundef !17
  %120 = trunc i8 %119 to i1
  br label %121

121:                                              ; preds = %115, %111
  %122 = phi i1 [ false, %111 ], [ %120, %115 ]
  br i1 %122, label %123, label %127

123:                                              ; preds = %121
  br label %124

124:                                              ; preds = %123
  %125 = load i32, ptr %9, align 4, !tbaa !5
  %126 = add nsw i32 %125, 1
  store i32 %126, ptr %9, align 4, !tbaa !5
  br label %111, !llvm.loop !18

127:                                              ; preds = %121
  %128 = load i32, ptr %9, align 4, !tbaa !5
  %129 = load i32, ptr %5, align 4, !tbaa !5
  %130 = icmp slt i32 %128, %129
  br i1 %130, label %131, label %158

131:                                              ; preds = %127
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %132

132:                                              ; preds = %148, %131
  %133 = load i32, ptr %10, align 4, !tbaa !5
  %134 = load i32, ptr %4, align 4, !tbaa !5
  %135 = icmp slt i32 %133, %134
  br i1 %135, label %137, label %136

136:                                              ; preds = %132
  store i32 17, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %153

137:                                              ; preds = %132
  %138 = load i32, ptr %9, align 4, !tbaa !5
  %139 = srem i32 %138, 10
  %140 = add nsw i32 48, %139
  %141 = trunc i32 %140 to i8
  %142 = load i32, ptr %4, align 4, !tbaa !5
  %143 = sub nsw i32 %142, 1
  %144 = load i32, ptr %10, align 4, !tbaa !5
  %145 = sub nsw i32 %143, %144
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [7 x i8], ptr @_ZZ4mainE3out, i64 0, i64 %146
  store i8 %141, ptr %147, align 1, !tbaa !11
  br label %148

148:                                              ; preds = %137
  %149 = load i32, ptr %10, align 4, !tbaa !5
  %150 = add nsw i32 %149, 1
  store i32 %150, ptr %10, align 4, !tbaa !5
  %151 = load i32, ptr %9, align 4, !tbaa !5
  %152 = sdiv i32 %151, 10
  store i32 %152, ptr %9, align 4, !tbaa !5
  br label %132, !llvm.loop !19

153:                                              ; preds = %136
  %154 = load i32, ptr %4, align 4, !tbaa !5
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds [7 x i8], ptr @_ZZ4mainE3out, i64 0, i64 %155
  store i8 0, ptr %156, align 1, !tbaa !11
  %157 = call i32 @puts(ptr noundef @_ZZ4mainE3out)
  store i32 5, ptr %7, align 4
  br label %159

158:                                              ; preds = %127
  store i32 0, ptr %7, align 4
  br label %159

159:                                              ; preds = %158, %153
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  %160 = load i32, ptr %7, align 4
  switch i32 %160, label %167 [
    i32 0, label %161
  ]

161:                                              ; preds = %159
  br label %162

162:                                              ; preds = %161
  %163 = load i32, ptr %4, align 4, !tbaa !5
  %164 = add nsw i32 %163, 1
  store i32 %164, ptr %4, align 4, !tbaa !5
  %165 = load i32, ptr %5, align 4, !tbaa !5
  %166 = mul nsw i32 %165, 10
  store i32 %166, ptr %5, align 4, !tbaa !5
  br label %46, !llvm.loop !20

167:                                              ; preds = %159
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %168

168:                                              ; preds = %167
  store i32 0, ptr %1, align 4
  store i32 1, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  %169 = load i32, ptr %1, align 4
  ret i32 %169
}

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

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

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #3

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

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

declare i32 @puts(ptr noundef) #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 = { 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"bool", !7, i64 0}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !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"

@_ZZ4mainE2sz = external hidden local_unnamed_addr global [101 x i32], align 16
@_ZZ4mainE3val = external hidden local_unnamed_addr global [101 x [201 x i32]], align 16
@_ZZ4mainE3buf = external hidden global [101 x [201 x i8]], align 16
@_ZZ4mainE3vis = external hidden local_unnamed_addr global [100001 x i8], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@_ZZ4mainE3out = external hidden global [7 x i8], align 1

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

.preheader52:                                     ; preds = %.lr.ph
  %5 = icmp sgt i32 %35, 0
  br i1 %5, label %.preheader.lr.ph.us.preheader, label %.preheader51.preheader

.preheader51.preheader:                           ; preds = %0, %.preheader52
  br label %.preheader51

.preheader.lr.ph.us.preheader:                    ; preds = %.preheader52
  %wide.trip.count80 = zext nneg i32 %35 to i64
  br label %.preheader.lr.ph.us

.preheader.lr.ph.us:                              ; preds = %.preheader.lr.ph.us.preheader, %.critedge50.us
  %indvars.iv88 = phi i64 [ 1, %.preheader.lr.ph.us.preheader ], [ %indvars.iv.next89, %.critedge50.us ]
  %indvars.iv73 = phi i32 [ 0, %.preheader.lr.ph.us.preheader ], [ %indvars.iv.next74, %.critedge50.us ]
  %.045.us = phi i32 [ 10, %.preheader.lr.ph.us.preheader ], [ %8, %.critedge50.us ]
  %indvars90 = trunc i64 %indvars.iv88 to i32
  %6 = zext nneg i32 %.045.us to i64
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) @_ZZ4mainE3vis, i8 0, i64 %6, i1 false)
  %7 = add nuw i64 %indvars.iv88, 4294967295
  br label %.preheader.us

.critedge50.us:                                   ; preds = %12
  %indvars.iv.next89 = add nuw nsw i64 %indvars.iv88, 1
  %8 = mul nuw nsw i32 %.045.us, 10
  %indvars.iv.next74 = add nsw i32 %indvars.iv73, -1
  br label %.preheader.lr.ph.us, !llvm.loop !9

..preheader51_crit_edge.us:                       ; preds = %..preheader51_crit_edge.us.preheader, %12
  %indvars.iv82 = phi i64 [ 0, %..preheader51_crit_edge.us.preheader ], [ %indvars.iv.next83, %12 ]
  %9 = getelementptr inbounds [100001 x i8], ptr @_ZZ4mainE3vis, i64 0, i64 %indvars.iv82
  %10 = load i8, ptr %9, align 1, !tbaa !11, !range !13, !noundef !14
  %11 = trunc nuw i8 %10 to i1
  br i1 %11, label %12, label %.critedge.preheader

12:                                               ; preds = %..preheader51_crit_edge.us
  %indvars.iv.next83 = add nuw nsw i64 %indvars.iv82, 1
  %exitcond87.not = icmp eq i64 %indvars.iv.next83, %wide.trip.count86
  br i1 %exitcond87.not, label %.critedge50.us, label %..preheader51_crit_edge.us, !llvm.loop !15

.lr.ph57.us:                                      ; preds = %.lr.ph57.us.preheader, %.lr.ph57.us
  %indvars.iv70 = phi i64 [ 0, %.lr.ph57.us.preheader ], [ %indvars.iv.next71, %.lr.ph57.us ]
  %13 = getelementptr inbounds [101 x [201 x i32]], ptr @_ZZ4mainE3val, i64 0, i64 %indvars.iv77, i64 %indvars.iv70
  %14 = load i32, ptr %13, align 4, !tbaa !5
  %15 = mul nsw i32 %14, 10
  %16 = add i64 %7, %indvars.iv70
  %sext96 = shl i64 %16, 32
  %17 = ashr exact i64 %sext96, 32
  %18 = getelementptr inbounds [101 x [201 x i8]], ptr @_ZZ4mainE3buf, i64 0, i64 %indvars.iv77, i64 %17
  %19 = load i8, ptr %18, align 1, !tbaa !16
  %20 = sext i8 %19 to i32
  %21 = add i32 %15, -48
  %22 = add i32 %21, %20
  store i32 %22, ptr %13, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [100001 x i8], ptr @_ZZ4mainE3vis, i64 0, i64 %23
  store i8 1, ptr %24, align 1, !tbaa !11
  %indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, 1
  %exitcond76.not = icmp eq i64 %indvars.iv.next71, %wide.trip.count75
  br i1 %exitcond76.not, label %._crit_edge.us, label %.lr.ph57.us, !llvm.loop !17

._crit_edge.us:                                   ; preds = %.lr.ph57.us, %.preheader.us
  %indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
  %exitcond81.not = icmp eq i64 %indvars.iv.next78, %wide.trip.count80
  br i1 %exitcond81.not, label %..preheader51_crit_edge.us.preheader, label %.preheader.us, !llvm.loop !18

..preheader51_crit_edge.us.preheader:             ; preds = %._crit_edge.us
  %umax85 = call i32 @llvm.umax.i32(i32 %.045.us, i32 1)
  %wide.trip.count86 = zext nneg i32 %umax85 to i64
  br label %..preheader51_crit_edge.us

.preheader.us:                                    ; preds = %.preheader.lr.ph.us, %._crit_edge.us
  %indvars.iv77 = phi i64 [ 0, %.preheader.lr.ph.us ], [ %indvars.iv.next78, %._crit_edge.us ]
  %25 = getelementptr inbounds [101 x i32], ptr @_ZZ4mainE2sz, i64 0, i64 %indvars.iv77
  %26 = load i32, ptr %25, align 4, !tbaa !5
  %.not4855.us = icmp slt i32 %26, %indvars90
  br i1 %.not4855.us, label %._crit_edge.us, label %.lr.ph57.us.preheader

.lr.ph57.us.preheader:                            ; preds = %.preheader.us
  %27 = add i32 %indvars.iv73, %26
  %wide.trip.count75 = zext i32 %27 to i64
  br label %.lr.ph57.us

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %28 = getelementptr inbounds [101 x [201 x i8]], ptr @_ZZ4mainE3buf, i64 0, i64 %indvars.iv
  %29 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %28)
  %30 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %28) #7
  %31 = trunc i64 %30 to i32
  %32 = getelementptr inbounds [101 x i32], ptr @_ZZ4mainE2sz, i64 0, i64 %indvars.iv
  store i32 %31, ptr %32, align 4, !tbaa !5
  %33 = getelementptr inbounds [101 x [201 x i32]], ptr @_ZZ4mainE3val, i64 0, i64 %indvars.iv
  %sext = shl i64 %30, 32
  %34 = ashr exact i64 %sext, 30
  call void @llvm.memset.p0.i64(ptr nonnull align 4 %33, i8 0, i64 %34, i1 false)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %35 = load i32, ptr %1, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = icmp slt i64 %indvars.iv.next, %36
  br i1 %37, label %.lr.ph, label %.preheader52, !llvm.loop !19

.preheader51:                                     ; preds = %.preheader51.preheader, %.critedge50
  %.046 = phi i32 [ %52, %.critedge50 ], [ 1, %.preheader51.preheader ]
  %.045 = phi i32 [ %53, %.critedge50 ], [ 10, %.preheader51.preheader ]
  %38 = zext nneg i32 %.045 to i64
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) @_ZZ4mainE3vis, i8 0, i64 %38, i1 false)
  %umax = call i32 @llvm.umax.i32(i32 %.045, i32 1)
  %wide.trip.count = zext nneg i32 %umax to i64
  br label %39

39:                                               ; preds = %.preheader51, %44
  %indvars.iv67 = phi i64 [ 0, %.preheader51 ], [ %indvars.iv.next68, %44 ]
  %40 = getelementptr inbounds [100001 x i8], ptr @_ZZ4mainE3vis, i64 0, i64 %indvars.iv67
  %41 = load i8, ptr %40, align 1, !tbaa !11, !range !13, !noundef !14
  %42 = trunc nuw i8 %41 to i1
  br i1 %42, label %44, label %.critedge.preheader

.critedge.preheader:                              ; preds = %39, %..preheader51_crit_edge.us
  %.us-phi = phi i32 [ %indvars90, %..preheader51_crit_edge.us ], [ %.046, %39 ]
  %.us-phi60.in = phi i64 [ %indvars.iv82, %..preheader51_crit_edge.us ], [ %indvars.iv67, %39 ]
  %.us-phi60 = trunc i64 %.us-phi60.in to i32
  %43 = sext i32 %.us-phi to i64
  %wide.trip.count94 = zext i32 %.us-phi to i64
  br label %.critedge

44:                                               ; preds = %39
  %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next68, %wide.trip.count
  br i1 %exitcond.not, label %.critedge50, label %39, !llvm.loop !15

.critedge:                                        ; preds = %.critedge.preheader, %.critedge
  %indvars.iv91 = phi i64 [ 0, %.critedge.preheader ], [ %indvars.iv.next92, %.critedge ]
  %.161 = phi i32 [ %.us-phi60, %.critedge.preheader ], [ %51, %.critedge ]
  %45 = srem i32 %.161, 10
  %46 = trunc nsw i32 %45 to i8
  %47 = add nsw i8 %46, 48
  %48 = xor i64 %indvars.iv91, -1
  %49 = add nsw i64 %43, %48
  %50 = getelementptr inbounds [7 x i8], ptr @_ZZ4mainE3out, i64 0, i64 %49
  store i8 %47, ptr %50, align 1, !tbaa !16
  %indvars.iv.next92 = add nuw nsw i64 %indvars.iv91, 1
  %51 = sdiv i32 %.161, 10
  %exitcond95.not = icmp eq i64 %indvars.iv.next92, %wide.trip.count94
  br i1 %exitcond95.not, label %54, label %.critedge, !llvm.loop !20

.critedge50:                                      ; preds = %44
  %52 = add nuw nsw i32 %.046, 1
  %53 = mul nuw nsw i32 %.045, 10
  br label %.preheader51, !llvm.loop !9

54:                                               ; preds = %.critedge
  %55 = getelementptr inbounds [7 x i8], ptr @_ZZ4mainE3out, i64 0, i64 %wide.trip.count94
  store i8 0, ptr %55, align 1, !tbaa !16
  %56 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @_ZZ4mainE3out)
  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: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umax.i32(i32, i32) #5

attributes #0 = { mustprogress nofree norecurse 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = distinct !{!15, !10}
!16 = !{!7, !7, i64 0}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}


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