; LLVM IR from hanzohasashi33/Competetive_programming :: CodeChef/beginner (Buggy_Calculator)

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

@.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 [2 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %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
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  %13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2)
  br label %14

14:                                               ; preds = %178, %0
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %16 = icmp sgt i32 %15, 0
  br i1 %16, label %17, label %182

17:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  %18 = call noalias ptr @malloc(i64 noundef 1000000000) #6
  store ptr %18, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  %19 = call noalias ptr @malloc(i64 noundef 1000000000) #6
  store ptr %19, ptr %4, align 8, !tbaa !9
  %20 = load ptr, ptr %3, align 8, !tbaa !9
  %21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %20)
  %22 = load ptr, ptr %4, align 8, !tbaa !9
  %23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %22)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %40, %17
  %25 = load i32, ptr %5, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = load ptr, ptr %3, align 8, !tbaa !9
  %28 = call i64 @strlen(ptr noundef %27) #7
  %29 = icmp ult i64 %26, %28
  br i1 %29, label %31, label %30

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

31:                                               ; preds = %24
  %32 = load ptr, ptr %3, align 8, !tbaa !9
  %33 = load i32, ptr %5, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds i8, ptr %32, i64 %34
  %36 = load i8, ptr %35, align 1, !tbaa !11
  %37 = sext i8 %36 to i32
  %38 = sub nsw i32 %37, 48
  %39 = trunc i32 %38 to i8
  store i8 %39, ptr %35, align 1, !tbaa !11
  br label %40

40:                                               ; preds = %31
  %41 = load i32, ptr %5, align 4, !tbaa !5
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %5, align 4, !tbaa !5
  br label %24, !llvm.loop !12

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

44:                                               ; preds = %60, %43
  %45 = load i32, ptr %6, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = load ptr, ptr %4, align 8, !tbaa !9
  %48 = call i64 @strlen(ptr noundef %47) #7
  %49 = icmp ult i64 %46, %48
  br i1 %49, label %51, label %50

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

51:                                               ; preds = %44
  %52 = load ptr, ptr %4, align 8, !tbaa !9
  %53 = load i32, ptr %6, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds i8, ptr %52, i64 %54
  %56 = load i8, ptr %55, align 1, !tbaa !11
  %57 = sext i8 %56 to i32
  %58 = sub nsw i32 %57, 48
  %59 = trunc i32 %58 to i8
  store i8 %59, ptr %55, align 1, !tbaa !11
  br label %60

60:                                               ; preds = %51
  %61 = load i32, ptr %6, align 4, !tbaa !5
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr %6, align 4, !tbaa !5
  br label %44, !llvm.loop !14

63:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %64 = load ptr, ptr %3, align 8, !tbaa !9
  %65 = call i64 @strlen(ptr noundef %64) #7
  %66 = trunc i64 %65 to i32
  store i32 %66, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %67 = load ptr, ptr %4, align 8, !tbaa !9
  %68 = call i64 @strlen(ptr noundef %67) #7
  %69 = trunc i64 %68 to i32
  store i32 %69, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %70 = load i32, ptr %7, align 4, !tbaa !5
  %71 = sub nsw i32 %70, 1
  store i32 %71, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %72 = load i32, ptr %8, align 4, !tbaa !5
  %73 = sub nsw i32 %72, 1
  store i32 %73, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %74 = call noalias ptr @malloc(i64 noundef 1000000000) #6
  store ptr %74, ptr %12, align 8, !tbaa !9
  br label %75

75:                                               ; preds = %103, %63
  %76 = load i32, ptr %10, align 4, !tbaa !5
  %77 = icmp sge i32 %76, 0
  br i1 %77, label %78, label %81

78:                                               ; preds = %75
  %79 = load i32, ptr %11, align 4, !tbaa !5
  %80 = icmp sge i32 %79, 0
  br label %81

81:                                               ; preds = %78, %75
  %82 = phi i1 [ false, %75 ], [ %80, %78 ]
  br i1 %82, label %83, label %110

83:                                               ; preds = %81
  %84 = load ptr, ptr %3, align 8, !tbaa !9
  %85 = load i32, ptr %10, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds i8, ptr %84, i64 %86
  %88 = load i8, ptr %87, align 1, !tbaa !11
  %89 = sext i8 %88 to i32
  %90 = load ptr, ptr %4, align 8, !tbaa !9
  %91 = load i32, ptr %11, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds i8, ptr %90, i64 %92
  %94 = load i8, ptr %93, align 1, !tbaa !11
  %95 = sext i8 %94 to i32
  %96 = add nsw i32 %89, %95
  %97 = srem i32 %96, 10
  %98 = trunc i32 %97 to i8
  %99 = load ptr, ptr %12, align 8, !tbaa !9
  %100 = load i32, ptr %9, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds i8, ptr %99, i64 %101
  store i8 %98, ptr %102, align 1, !tbaa !11
  br label %103

103:                                              ; preds = %83
  %104 = load i32, ptr %10, align 4, !tbaa !5
  %105 = add nsw i32 %104, -1
  store i32 %105, ptr %10, align 4, !tbaa !5
  %106 = load i32, ptr %11, align 4, !tbaa !5
  %107 = add nsw i32 %106, -1
  store i32 %107, ptr %11, align 4, !tbaa !5
  %108 = load i32, ptr %9, align 4, !tbaa !5
  %109 = add nsw i32 %108, 1
  store i32 %109, ptr %9, align 4, !tbaa !5
  br label %75, !llvm.loop !15

110:                                              ; preds = %81
  %111 = load i32, ptr %7, align 4, !tbaa !5
  %112 = load i32, ptr %8, align 4, !tbaa !5
  %113 = icmp sgt i32 %111, %112
  br i1 %113, label %114, label %135

114:                                              ; preds = %110
  br label %115

115:                                              ; preds = %118, %114
  %116 = load i32, ptr %10, align 4, !tbaa !5
  %117 = icmp sge i32 %116, 0
  br i1 %117, label %118, label %134

118:                                              ; preds = %115
  %119 = load ptr, ptr %3, align 8, !tbaa !9
  %120 = load i32, ptr %10, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds i8, ptr %119, i64 %121
  %123 = load i8, ptr %122, align 1, !tbaa !11
  %124 = sext i8 %123 to i32
  %125 = srem i32 %124, 10
  %126 = trunc i32 %125 to i8
  %127 = load ptr, ptr %12, align 8, !tbaa !9
  %128 = load i32, ptr %9, align 4, !tbaa !5
  %129 = add nsw i32 %128, 1
  store i32 %129, ptr %9, align 4, !tbaa !5
  %130 = sext i32 %128 to i64
  %131 = getelementptr inbounds i8, ptr %127, i64 %130
  store i8 %126, ptr %131, align 1, !tbaa !11
  %132 = load i32, ptr %10, align 4, !tbaa !5
  %133 = add nsw i32 %132, -1
  store i32 %133, ptr %10, align 4, !tbaa !5
  br label %115, !llvm.loop !16

134:                                              ; preds = %115
  br label %161

135:                                              ; preds = %110
  %136 = load i32, ptr %8, align 4, !tbaa !5
  %137 = load i32, ptr %7, align 4, !tbaa !5
  %138 = icmp sgt i32 %136, %137
  br i1 %138, label %139, label %160

139:                                              ; preds = %135
  br label %140

140:                                              ; preds = %143, %139
  %141 = load i32, ptr %11, align 4, !tbaa !5
  %142 = icmp sge i32 %141, 0
  br i1 %142, label %143, label %159

143:                                              ; preds = %140
  %144 = load ptr, ptr %4, align 8, !tbaa !9
  %145 = load i32, ptr %11, align 4, !tbaa !5
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds i8, ptr %144, i64 %146
  %148 = load i8, ptr %147, align 1, !tbaa !11
  %149 = sext i8 %148 to i32
  %150 = srem i32 %149, 10
  %151 = trunc i32 %150 to i8
  %152 = load ptr, ptr %12, align 8, !tbaa !9
  %153 = load i32, ptr %9, align 4, !tbaa !5
  %154 = add nsw i32 %153, 1
  store i32 %154, ptr %9, align 4, !tbaa !5
  %155 = sext i32 %153 to i64
  %156 = getelementptr inbounds i8, ptr %152, i64 %155
  store i8 %151, ptr %156, align 1, !tbaa !11
  %157 = load i32, ptr %11, align 4, !tbaa !5
  %158 = add nsw i32 %157, -1
  store i32 %158, ptr %11, align 4, !tbaa !5
  br label %140, !llvm.loop !17

159:                                              ; preds = %140
  br label %160

160:                                              ; preds = %159, %135
  br label %161

161:                                              ; preds = %160, %134
  %162 = load i32, ptr %9, align 4, !tbaa !5
  %163 = add nsw i32 %162, -1
  store i32 %163, ptr %9, align 4, !tbaa !5
  br label %164

164:                                              ; preds = %175, %161
  %165 = load i32, ptr %9, align 4, !tbaa !5
  %166 = icmp sge i32 %165, 0
  br i1 %166, label %167, label %178

167:                                              ; preds = %164
  %168 = load ptr, ptr %12, align 8, !tbaa !9
  %169 = load i32, ptr %9, align 4, !tbaa !5
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds i8, ptr %168, i64 %170
  %172 = load i8, ptr %171, align 1, !tbaa !11
  %173 = sext i8 %172 to i32
  %174 = call i32 (ptr, ...) @printf(ptr noundef @.str, i32 noundef %173)
  br label %175

175:                                              ; preds = %167
  %176 = load i32, ptr %9, align 4, !tbaa !5
  %177 = add nsw i32 %176, -1
  store i32 %177, ptr %9, align 4, !tbaa !5
  br label %164, !llvm.loop !18

178:                                              ; preds = %164
  %179 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  %180 = load i32, ptr %2, align 4, !tbaa !5
  %181 = add nsw i32 %180, -1
  store i32 %181, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  br label %14, !llvm.loop !19

182:                                              ; preds = %14
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  ret i32 0
}

; 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 allocsize(0)
declare noalias ptr @malloc(i64 noundef) #3

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

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

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

attributes #0 = { 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 = { 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 allocsize(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 = { 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 allocsize(0) }
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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !13}
!17 = distinct !{!17, !13}
!18 = distinct !{!18, !13}
!19 = distinct !{!19, !13}


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

@.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 [2 x i8], align 1

; Function Attrs: nofree 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)
  %.pr = load i32, ptr %1, align 4, !tbaa !5
  %3 = icmp sgt i32 %.pr, 0
  br i1 %3, label %.lr.ph95, label %._crit_edge96

.lr.ph95:                                         ; preds = %0, %._crit_edge93
  %4 = call noalias dereferenceable_or_null(1000000000) ptr @malloc(i64 noundef 1000000000) #7
  %5 = call noalias dereferenceable_or_null(1000000000) ptr @malloc(i64 noundef 1000000000) #7
  %6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef %4)
  %7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef %5)
  %char0 = load i8, ptr %4, align 1
  %.not = icmp eq i8 %char0, 0
  br i1 %.not, label %.preheader66, label %.lr.ph

.preheader66:                                     ; preds = %.lr.ph, %.lr.ph95
  %.lcssa = phi i64 [ 0, %.lr.ph95 ], [ %11, %.lr.ph ]
  %char0139 = load i8, ptr %5, align 1
  %.not97 = icmp eq i8 %char0139, 0
  br i1 %.not97, label %._crit_edge, label %.lr.ph72

.lr.ph:                                           ; preds = %.lr.ph95, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.lr.ph95 ]
  %8 = getelementptr inbounds i8, ptr %4, i64 %indvars.iv
  %9 = load i8, ptr %8, align 1, !tbaa !9
  %10 = add i8 %9, -48
  store i8 %10, ptr %8, align 1, !tbaa !9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %11 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %4) #8
  %12 = icmp ugt i64 %11, %indvars.iv.next
  br i1 %12, label %.lr.ph, label %.preheader66, !llvm.loop !10

._crit_edge:                                      ; preds = %.lr.ph72, %.preheader66
  %.lcssa67 = phi i64 [ 0, %.preheader66 ], [ %32, %.lr.ph72 ]
  %13 = trunc i64 %.lcssa to i32
  %14 = trunc i64 %.lcssa67 to i32
  %15 = call noalias dereferenceable_or_null(1000000000) ptr @malloc(i64 noundef 1000000000) #7
  %.04974 = add i32 %14, -1
  %.05075 = add i32 %13, -1
  %16 = icmp sgt i32 %13, 0
  %17 = icmp sgt i32 %14, 0
  %18 = and i1 %16, %17
  br i1 %18, label %.lr.ph80.preheader, label %._crit_edge81

.lr.ph80.preheader:                               ; preds = %._crit_edge
  %19 = zext nneg i32 %.05075 to i64
  %20 = zext nneg i32 %.04974 to i64
  %umin = call i32 @llvm.umin.i32(i32 %.04974, i32 %.05075)
  %21 = add nuw nsw i32 %umin, 1
  %wide.trip.count = zext nneg i32 %21 to i64
  %min.iters.check168 = icmp ult i32 %umin, 15
  br i1 %min.iters.check168, label %.lr.ph80.preheader189, label %vector.ph169

.lr.ph80.preheader189:                            ; preds = %middle.block166, %.lr.ph80.preheader
  %indvars.iv115.ph = phi i64 [ 0, %.lr.ph80.preheader ], [ %n.vec171, %middle.block166 ]
  %indvars.iv113.ph = phi i64 [ %20, %.lr.ph80.preheader ], [ %ind.end173, %middle.block166 ]
  %indvars.iv111.ph = phi i64 [ %19, %.lr.ph80.preheader ], [ %ind.end175, %middle.block166 ]
  br label %.lr.ph80

vector.ph169:                                     ; preds = %.lr.ph80.preheader
  %n.vec171 = and i64 %wide.trip.count, 2147483632
  %ind.end173 = sub nsw i64 %20, %n.vec171
  %ind.end175 = sub nsw i64 %19, %n.vec171
  %invariant.gep = getelementptr i8, ptr %4, i64 -15
  %invariant.gep204 = getelementptr i8, ptr %5, i64 -15
  br label %vector.body177

vector.body177:                                   ; preds = %vector.body177, %vector.ph169
  %index178 = phi i64 [ 0, %vector.ph169 ], [ %index.next185, %vector.body177 ]
  %offset.idx179 = sub i64 %20, %index178
  %offset.idx180 = sub i64 %19, %index178
  %gep = getelementptr i8, ptr %invariant.gep, i64 %offset.idx180
  %wide.load181 = load <16 x i8>, ptr %gep, align 1, !tbaa !9
  %reverse182 = shufflevector <16 x i8> %wide.load181, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
  %22 = sext <16 x i8> %reverse182 to <16 x i16>
  %gep205 = getelementptr i8, ptr %invariant.gep204, i64 %offset.idx179
  %wide.load183 = load <16 x i8>, ptr %gep205, align 1, !tbaa !9
  %reverse184 = shufflevector <16 x i8> %wide.load183, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
  %23 = sext <16 x i8> %reverse184 to <16 x i16>
  %24 = add nsw <16 x i16> %23, %22
  %25 = srem <16 x i16> %24, <i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10>
  %26 = trunc nsw <16 x i16> %25 to <16 x i8>
  %27 = getelementptr inbounds i8, ptr %15, i64 %index178
  store <16 x i8> %26, ptr %27, align 1, !tbaa !9
  %index.next185 = add nuw i64 %index178, 16
  %28 = icmp eq i64 %index.next185, %n.vec171
  br i1 %28, label %middle.block166, label %vector.body177, !llvm.loop !12

middle.block166:                                  ; preds = %vector.body177
  %cmp.n186 = icmp eq i64 %n.vec171, %wide.trip.count
  %cmo = add nsw i64 %n.vec171, -1
  %ind.escape = sub nsw i64 %20, %cmo
  br i1 %cmp.n186, label %._crit_edge81.loopexit, label %.lr.ph80.preheader189

.lr.ph72:                                         ; preds = %.preheader66, %.lr.ph72
  %indvars.iv108 = phi i64 [ %indvars.iv.next109, %.lr.ph72 ], [ 0, %.preheader66 ]
  %29 = getelementptr inbounds i8, ptr %5, i64 %indvars.iv108
  %30 = load i8, ptr %29, align 1, !tbaa !9
  %31 = add i8 %30, -48
  store i8 %31, ptr %29, align 1, !tbaa !9
  %indvars.iv.next109 = add nuw nsw i64 %indvars.iv108, 1
  %32 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %5) #8
  %33 = icmp ugt i64 %32, %indvars.iv.next109
  br i1 %33, label %.lr.ph72, label %._crit_edge, !llvm.loop !15

.lr.ph80:                                         ; preds = %.lr.ph80.preheader189, %.lr.ph80
  %indvars.iv115 = phi i64 [ %indvars.iv.next116, %.lr.ph80 ], [ %indvars.iv115.ph, %.lr.ph80.preheader189 ]
  %indvars.iv113 = phi i64 [ %indvars.iv.next114, %.lr.ph80 ], [ %indvars.iv113.ph, %.lr.ph80.preheader189 ]
  %indvars.iv111 = phi i64 [ %indvars.iv.next112, %.lr.ph80 ], [ %indvars.iv111.ph, %.lr.ph80.preheader189 ]
  %34 = getelementptr inbounds i8, ptr %4, i64 %indvars.iv111
  %35 = load i8, ptr %34, align 1, !tbaa !9
  %36 = sext i8 %35 to i16
  %37 = getelementptr inbounds i8, ptr %5, i64 %indvars.iv113
  %38 = load i8, ptr %37, align 1, !tbaa !9
  %39 = sext i8 %38 to i16
  %.lhs.trunc = add nsw i16 %39, %36
  %40 = srem i16 %.lhs.trunc, 10
  %41 = trunc nsw i16 %40 to i8
  %42 = getelementptr inbounds i8, ptr %15, i64 %indvars.iv115
  store i8 %41, ptr %42, align 1, !tbaa !9
  %indvars.iv.next116 = add nuw nsw i64 %indvars.iv115, 1
  %indvars.iv.next114 = add nsw i64 %indvars.iv113, -1
  %indvars.iv.next112 = add nsw i64 %indvars.iv111, -1
  %exitcond.not = icmp eq i64 %indvars.iv.next116, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge81.loopexit, label %.lr.ph80, !llvm.loop !16

._crit_edge81.loopexit:                           ; preds = %.lr.ph80, %middle.block166
  %indvars.iv113.lcssa = phi i64 [ %ind.escape, %middle.block166 ], [ %indvars.iv113, %.lr.ph80 ]
  %indvars.iv.next114.lcssa = phi i64 [ %ind.end173, %middle.block166 ], [ %indvars.iv.next114, %.lr.ph80 ]
  %indvars.iv.next112.lcssa = phi i64 [ %ind.end175, %middle.block166 ], [ %indvars.iv.next112, %.lr.ph80 ]
  %43 = icmp sgt i64 %indvars.iv113.lcssa, 0
  %44 = trunc nsw i64 %indvars.iv.next114.lcssa to i32
  %45 = trunc nsw i64 %indvars.iv.next112.lcssa to i32
  br label %._crit_edge81

._crit_edge81:                                    ; preds = %._crit_edge81.loopexit, %._crit_edge
  %.052.lcssa = phi i32 [ 0, %._crit_edge ], [ %21, %._crit_edge81.loopexit ]
  %.049.lcssa = phi i32 [ %.04974, %._crit_edge ], [ %44, %._crit_edge81.loopexit ]
  %.050.lcssa = phi i32 [ %.05075, %._crit_edge ], [ %45, %._crit_edge81.loopexit ]
  %.lcssa68 = phi i1 [ %17, %._crit_edge ], [ %43, %._crit_edge81.loopexit ]
  %46 = icmp sgt i32 %13, %14
  br i1 %46, label %.preheader, label %58

.preheader:                                       ; preds = %._crit_edge81
  %47 = icmp sgt i32 %.050.lcssa, -1
  br i1 %47, label %.lr.ph88.preheader, label %.loopexit

.lr.ph88.preheader:                               ; preds = %.preheader
  %48 = zext nneg i32 %.050.lcssa to i64
  %49 = zext i32 %.052.lcssa to i64
  %50 = add nuw nsw i64 %48, 1
  %min.iters.check = icmp ult i32 %.050.lcssa, 15
  br i1 %min.iters.check, label %.lr.ph88.preheader187, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph88.preheader
  %n.vec = and i64 %50, 4294967280
  %ind.end = add nuw nsw i64 %n.vec, %49
  %ind.end145 = sub nsw i64 %48, %n.vec
  %invariant.gep210 = getelementptr i8, ptr %4, i64 -15
  %invariant.gep212 = getelementptr i8, ptr %15, i64 %49
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %offset.idx147 = sub i64 %48, %index
  %gep211 = getelementptr i8, ptr %invariant.gep210, i64 %offset.idx147
  %wide.load = load <16 x i8>, ptr %gep211, align 1, !tbaa !9
  %51 = srem <16 x i8> %wide.load, <i8 10, i8 10, i8 10, i8 10, i8 10, i8 10, i8 10, i8 10, i8 10, i8 10, i8 10, i8 10, i8 10, i8 10, i8 10, i8 10>
  %52 = shufflevector <16 x i8> %51, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
  %gep213 = getelementptr i8, ptr %invariant.gep212, i64 %index
  store <16 x i8> %52, ptr %gep213, align 1, !tbaa !9
  %index.next = add nuw i64 %index, 16
  %53 = icmp eq i64 %index.next, %n.vec
  br i1 %53, label %middle.block, label %vector.body, !llvm.loop !17

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %50, %n.vec
  br i1 %cmp.n, label %.loopexit.loopexit, label %.lr.ph88.preheader187

.lr.ph88.preheader187:                            ; preds = %middle.block, %.lr.ph88.preheader
  %indvars.iv131.ph = phi i64 [ %49, %.lr.ph88.preheader ], [ %ind.end, %middle.block ]
  %indvars.iv129.ph = phi i64 [ %48, %.lr.ph88.preheader ], [ %ind.end145, %middle.block ]
  br label %.lr.ph88

.lr.ph88:                                         ; preds = %.lr.ph88.preheader187, %.lr.ph88
  %indvars.iv131 = phi i64 [ %indvars.iv.next132, %.lr.ph88 ], [ %indvars.iv131.ph, %.lr.ph88.preheader187 ]
  %indvars.iv129 = phi i64 [ %indvars.iv.next130, %.lr.ph88 ], [ %indvars.iv129.ph, %.lr.ph88.preheader187 ]
  %54 = getelementptr inbounds i8, ptr %4, i64 %indvars.iv129
  %55 = load i8, ptr %54, align 1, !tbaa !9
  %56 = srem i8 %55, 10
  %indvars.iv.next132 = add nuw nsw i64 %indvars.iv131, 1
  %57 = getelementptr inbounds i8, ptr %15, i64 %indvars.iv131
  store i8 %56, ptr %57, align 1, !tbaa !9
  %indvars.iv.next130 = add nsw i64 %indvars.iv129, -1
  %.not142 = icmp eq i64 %indvars.iv129, 0
  br i1 %.not142, label %.loopexit.loopexit, label %.lr.ph88, !llvm.loop !18

58:                                               ; preds = %._crit_edge81
  %59 = icmp sgt i32 %14, %13
  %or.cond = and i1 %59, %.lcssa68
  br i1 %or.cond, label %.preheader64.preheader, label %.loopexit

.preheader64.preheader:                           ; preds = %58
  %60 = zext i32 %.052.lcssa to i64
  %61 = zext i32 %.049.lcssa to i64
  %62 = add nuw nsw i64 %61, 1
  %min.iters.check150 = icmp ult i32 %.049.lcssa, 15
  br i1 %min.iters.check150, label %.preheader64.preheader188, label %vector.ph151

vector.ph151:                                     ; preds = %.preheader64.preheader
  %n.vec153 = and i64 %62, 8589934576
  %ind.end154 = sub nsw i64 %61, %n.vec153
  %ind.end156 = add nuw nsw i64 %n.vec153, %60
  %invariant.gep206 = getelementptr i8, ptr %5, i64 -15
  %invariant.gep208 = getelementptr i8, ptr %15, i64 %60
  br label %vector.body158

vector.body158:                                   ; preds = %vector.body158, %vector.ph151
  %index159 = phi i64 [ 0, %vector.ph151 ], [ %index.next164, %vector.body158 ]
  %offset.idx160 = sub i64 %61, %index159
  %gep207 = getelementptr i8, ptr %invariant.gep206, i64 %offset.idx160
  %wide.load162 = load <16 x i8>, ptr %gep207, align 1, !tbaa !9
  %63 = srem <16 x i8> %wide.load162, <i8 10, i8 10, i8 10, i8 10, i8 10, i8 10, i8 10, i8 10, i8 10, i8 10, i8 10, i8 10, i8 10, i8 10, i8 10, i8 10>
  %64 = shufflevector <16 x i8> %63, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
  %gep209 = getelementptr i8, ptr %invariant.gep208, i64 %index159
  store <16 x i8> %64, ptr %gep209, align 1, !tbaa !9
  %index.next164 = add nuw i64 %index159, 16
  %65 = icmp eq i64 %index.next164, %n.vec153
  br i1 %65, label %middle.block148, label %vector.body158, !llvm.loop !19

middle.block148:                                  ; preds = %vector.body158
  %cmp.n165 = icmp eq i64 %62, %n.vec153
  br i1 %cmp.n165, label %.loopexit.loopexit98, label %.preheader64.preheader188

.preheader64.preheader188:                        ; preds = %middle.block148, %.preheader64.preheader
  %indvars.iv124.ph = phi i64 [ %61, %.preheader64.preheader ], [ %ind.end154, %middle.block148 ]
  %indvars.iv122.ph = phi i64 [ %60, %.preheader64.preheader ], [ %ind.end156, %middle.block148 ]
  br label %.preheader64

.preheader64:                                     ; preds = %.preheader64.preheader188, %.preheader64
  %indvars.iv124 = phi i64 [ %indvars.iv.next125, %.preheader64 ], [ %indvars.iv124.ph, %.preheader64.preheader188 ]
  %indvars.iv122 = phi i64 [ %indvars.iv.next123, %.preheader64 ], [ %indvars.iv122.ph, %.preheader64.preheader188 ]
  %66 = getelementptr inbounds i8, ptr %5, i64 %indvars.iv124
  %67 = load i8, ptr %66, align 1, !tbaa !9
  %68 = srem i8 %67, 10
  %indvars.iv.next123 = add nuw nsw i64 %indvars.iv122, 1
  %69 = getelementptr inbounds i8, ptr %15, i64 %indvars.iv122
  store i8 %68, ptr %69, align 1, !tbaa !9
  %indvars.iv.next125 = add nsw i64 %indvars.iv124, -1
  %.old1.not = icmp eq i64 %indvars.iv124, 0
  br i1 %.old1.not, label %.loopexit.loopexit98, label %.preheader64, !llvm.loop !20

.loopexit.loopexit:                               ; preds = %.lr.ph88, %middle.block
  %indvars.iv.next132.lcssa = phi i64 [ %ind.end, %middle.block ], [ %indvars.iv.next132, %.lr.ph88 ]
  %70 = trunc nuw i64 %indvars.iv.next132.lcssa to i32
  br label %.loopexit

.loopexit.loopexit98:                             ; preds = %.preheader64, %middle.block148
  %indvars.iv.next123.lcssa = phi i64 [ %ind.end156, %middle.block148 ], [ %indvars.iv.next123, %.preheader64 ]
  %71 = trunc nuw i64 %indvars.iv.next123.lcssa to i32
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.loopexit98, %.loopexit.loopexit, %.preheader, %58
  %.3 = phi i32 [ %.052.lcssa, %58 ], [ %.052.lcssa, %.preheader ], [ %70, %.loopexit.loopexit ], [ %71, %.loopexit.loopexit98 ]
  %72 = icmp sgt i32 %.3, 0
  br i1 %72, label %.lr.ph92.preheader, label %._crit_edge93

.lr.ph92.preheader:                               ; preds = %.loopexit
  %73 = zext nneg i32 %.3 to i64
  br label %.lr.ph92

.lr.ph92:                                         ; preds = %.lr.ph92.preheader, %.lr.ph92
  %indvars.iv136 = phi i64 [ %73, %.lr.ph92.preheader ], [ %indvars.iv.next137, %.lr.ph92 ]
  %indvars.iv.next137 = add nsw i64 %indvars.iv136, -1
  %74 = getelementptr inbounds i8, ptr %15, i64 %indvars.iv.next137
  %75 = load i8, ptr %74, align 1, !tbaa !9
  %76 = sext i8 %75 to i32
  %77 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %76)
  %78 = icmp ugt i64 %indvars.iv136, 1
  br i1 %78, label %.lr.ph92, label %._crit_edge93, !llvm.loop !21

._crit_edge93:                                    ; preds = %.lr.ph92, %.loopexit
  %79 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  %80 = load i32, ptr %1, align 4, !tbaa !5
  %81 = add nsw i32 %80, -1
  store i32 %81, ptr %1, align 4, !tbaa !5
  %82 = icmp sgt i32 %80, 1
  br i1 %82, label %.lr.ph95, label %._crit_edge96, !llvm.loop !22

._crit_edge96:                                    ; preds = %._crit_edge93, %0
  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 allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #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 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

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

attributes #0 = { nofree 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 allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }
attributes #8 = { 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/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !11}
!16 = distinct !{!16, !11, !14, !13}
!17 = distinct !{!17, !11, !13, !14}
!18 = distinct !{!18, !11, !14, !13}
!19 = distinct !{!19, !13, !14}
!20 = distinct !{!20, !14, !13}
!21 = distinct !{!21, !11}
!22 = distinct !{!22, !11}


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