; LLVM IR from ahampriyanshu/algo-ds-101 :: Algorithms/Cryptography/Shamir_Cipher (Shamir_Cipher)

; 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.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1

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

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

; Function Attrs: nounwind
declare void @free(ptr noundef) #1

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #2

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

; Function Attrs: nounwind
declare i32 @sprintf(ptr noundef, ptr noundef, ...) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @join_shares(ptr noundef, i32 noundef) #4

; Function Attrs: nounwind uwtable
define dso_local ptr @decode(ptr noundef %0, i32 noundef %1) #4 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca [3 x i8], align 1
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i8, align 1
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  %16 = load i32, ptr %5, align 4, !tbaa !9
  %17 = icmp eq i32 %16, 0
  br i1 %17, label %26, label %18

18:                                               ; preds = %2
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = icmp eq ptr %19, null
  br i1 %20, label %26, label %21

21:                                               ; preds = %18
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = getelementptr inbounds ptr, ptr %22, i64 0
  %24 = load ptr, ptr %23, align 8, !tbaa !5
  %25 = icmp eq ptr %24, null
  br i1 %25, label %26, label %27

26:                                               ; preds = %21, %18, %2
  store ptr null, ptr %3, align 8
  br label %177

27:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds ptr, ptr %28, i64 0
  %30 = load ptr, ptr %29, align 8, !tbaa !5
  %31 = call i64 @strlen(ptr noundef %30) #7
  %32 = sub i64 %31, 6
  %33 = udiv i64 %32, 2
  %34 = trunc i64 %33 to i32
  store i32 %34, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %35 = load i32, ptr %6, align 4, !tbaa !9
  %36 = add nsw i32 %35, 1
  %37 = sext i32 %36 to i64
  %38 = call noalias ptr @malloc(i64 noundef %37) #8
  store ptr %38, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 3, ptr %8) #6
  %39 = getelementptr inbounds [3 x i8], ptr %8, i64 0, i64 2
  store i8 0, ptr %39, align 1, !tbaa !11
  %40 = load i32, ptr %5, align 4, !tbaa !9
  %41 = zext i32 %40 to i64
  %42 = call ptr @llvm.stacksave.p0()
  store ptr %42, ptr %9, align 8
  %43 = alloca i32, i64 %41, align 16
  store i64 %41, ptr %10, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %44

44:                                               ; preds = %80, %27
  %45 = load i32, ptr %11, align 4, !tbaa !9
  %46 = load i32, ptr %5, align 4, !tbaa !9
  %47 = icmp slt i32 %45, %46
  br i1 %47, label %48, label %83

48:                                               ; preds = %44
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = load i32, ptr %11, align 4, !tbaa !9
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds ptr, ptr %49, i64 %51
  %53 = load ptr, ptr %52, align 8, !tbaa !5
  %54 = icmp eq ptr %53, null
  br i1 %54, label %55, label %57

55:                                               ; preds = %48
  %56 = load ptr, ptr %7, align 8, !tbaa !5
  call void @free(ptr noundef %56) #6
  store ptr null, ptr %3, align 8
  store i32 1, ptr %13, align 4
  br label %175

57:                                               ; preds = %48
  %58 = load ptr, ptr %4, align 8, !tbaa !5
  %59 = load i32, ptr %11, align 4, !tbaa !9
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds ptr, ptr %58, i64 %60
  %62 = load ptr, ptr %61, align 8, !tbaa !5
  %63 = getelementptr inbounds i8, ptr %62, i64 0
  %64 = load i8, ptr %63, align 1, !tbaa !11
  %65 = getelementptr inbounds [3 x i8], ptr %8, i64 0, i64 0
  store i8 %64, ptr %65, align 1, !tbaa !11
  %66 = load ptr, ptr %4, align 8, !tbaa !5
  %67 = load i32, ptr %11, align 4, !tbaa !9
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds ptr, ptr %66, i64 %68
  %70 = load ptr, ptr %69, align 8, !tbaa !5
  %71 = getelementptr inbounds i8, ptr %70, i64 1
  %72 = load i8, ptr %71, align 1, !tbaa !11
  %73 = getelementptr inbounds [3 x i8], ptr %8, i64 0, i64 1
  store i8 %72, ptr %73, align 1, !tbaa !11
  %74 = getelementptr inbounds [3 x i8], ptr %8, i64 0, i64 0
  %75 = call i64 @strtol(ptr noundef %74, ptr noundef null, i32 noundef 16) #6
  %76 = trunc i64 %75 to i32
  %77 = load i32, ptr %11, align 4, !tbaa !9
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds i32, ptr %43, i64 %78
  store i32 %76, ptr %79, align 4, !tbaa !9
  br label %80

80:                                               ; preds = %57
  %81 = load i32, ptr %11, align 4, !tbaa !9
  %82 = add nsw i32 %81, 1
  store i32 %82, ptr %11, align 4, !tbaa !9
  br label %44, !llvm.loop !12

83:                                               ; preds = %44
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %84

84:                                               ; preds = %170, %83
  %85 = load i32, ptr %11, align 4, !tbaa !9
  %86 = load i32, ptr %6, align 4, !tbaa !9
  %87 = icmp slt i32 %85, %86
  br i1 %87, label %88, label %173

88:                                               ; preds = %84
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %89 = load i32, ptr %5, align 4, !tbaa !9
  %90 = sext i32 %89 to i64
  %91 = mul i64 4, %90
  %92 = mul i64 %91, 2
  %93 = call noalias ptr @malloc(i64 noundef %92) #8
  store ptr %93, ptr %14, align 8, !tbaa !5
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %94

94:                                               ; preds = %154, %88
  %95 = load i32, ptr %12, align 4, !tbaa !9
  %96 = load i32, ptr %5, align 4, !tbaa !9
  %97 = icmp slt i32 %95, %96
  br i1 %97, label %98, label %157

98:                                               ; preds = %94
  %99 = load i32, ptr %12, align 4, !tbaa !9
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds i32, ptr %43, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !9
  %103 = load ptr, ptr %14, align 8, !tbaa !5
  %104 = load i32, ptr %12, align 4, !tbaa !9
  %105 = mul nsw i32 %104, 2
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds i32, ptr %103, i64 %106
  store i32 %102, ptr %107, align 4, !tbaa !9
  %108 = load ptr, ptr %4, align 8, !tbaa !5
  %109 = load i32, ptr %12, align 4, !tbaa !9
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds ptr, ptr %108, i64 %110
  %112 = load ptr, ptr %111, align 8, !tbaa !5
  %113 = load i32, ptr %11, align 4, !tbaa !9
  %114 = mul nsw i32 %113, 2
  %115 = add nsw i32 6, %114
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds i8, ptr %112, i64 %116
  %118 = load i8, ptr %117, align 1, !tbaa !11
  %119 = getelementptr inbounds [3 x i8], ptr %8, i64 0, i64 0
  store i8 %118, ptr %119, align 1, !tbaa !11
  %120 = load ptr, ptr %4, align 8, !tbaa !5
  %121 = load i32, ptr %12, align 4, !tbaa !9
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds ptr, ptr %120, i64 %122
  %124 = load ptr, ptr %123, align 8, !tbaa !5
  %125 = load i32, ptr %11, align 4, !tbaa !9
  %126 = mul nsw i32 %125, 2
  %127 = add nsw i32 6, %126
  %128 = add nsw i32 %127, 1
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds i8, ptr %124, i64 %129
  %131 = load i8, ptr %130, align 1, !tbaa !11
  %132 = getelementptr inbounds [3 x i8], ptr %8, i64 0, i64 1
  store i8 %131, ptr %132, align 1, !tbaa !11
  %133 = getelementptr inbounds [3 x i8], ptr %8, i64 0, i64 0
  %134 = call i32 @memcmp(ptr noundef %133, ptr noundef @.str.1, i64 noundef 2) #7
  %135 = icmp eq i32 %134, 0
  br i1 %135, label %136, label %143

136:                                              ; preds = %98
  %137 = load ptr, ptr %14, align 8, !tbaa !5
  %138 = load i32, ptr %12, align 4, !tbaa !9
  %139 = mul nsw i32 %138, 2
  %140 = add nsw i32 %139, 1
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds i32, ptr %137, i64 %141
  store i32 256, ptr %142, align 4, !tbaa !9
  br label %153

143:                                              ; preds = %98
  %144 = getelementptr inbounds [3 x i8], ptr %8, i64 0, i64 0
  %145 = call i64 @strtol(ptr noundef %144, ptr noundef null, i32 noundef 16) #6
  %146 = trunc i64 %145 to i32
  %147 = load ptr, ptr %14, align 8, !tbaa !5
  %148 = load i32, ptr %12, align 4, !tbaa !9
  %149 = mul nsw i32 %148, 2
  %150 = add nsw i32 %149, 1
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds i32, ptr %147, i64 %151
  store i32 %146, ptr %152, align 4, !tbaa !9
  br label %153

153:                                              ; preds = %143, %136
  br label %154

154:                                              ; preds = %153
  %155 = load i32, ptr %12, align 4, !tbaa !9
  %156 = add nsw i32 %155, 1
  store i32 %156, ptr %12, align 4, !tbaa !9
  br label %94, !llvm.loop !14

157:                                              ; preds = %94
  call void @llvm.lifetime.start.p0(i64 1, ptr %15) #6
  %158 = load ptr, ptr %14, align 8, !tbaa !5
  %159 = load i32, ptr %5, align 4, !tbaa !9
  %160 = call i32 @join_shares(ptr noundef %158, i32 noundef %159)
  %161 = trunc i32 %160 to i8
  store i8 %161, ptr %15, align 1, !tbaa !11
  %162 = load ptr, ptr %14, align 8, !tbaa !5
  call void @free(ptr noundef %162) #6
  %163 = load ptr, ptr %7, align 8, !tbaa !5
  %164 = load i32, ptr %11, align 4, !tbaa !9
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds i8, ptr %163, i64 %165
  %167 = load i8, ptr %15, align 1, !tbaa !11
  %168 = sext i8 %167 to i32
  %169 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %166, ptr noundef @.str.3, i32 noundef %168) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  br label %170

170:                                              ; preds = %157
  %171 = load i32, ptr %11, align 4, !tbaa !9
  %172 = add nsw i32 %171, 1
  store i32 %172, ptr %11, align 4, !tbaa !9
  br label %84, !llvm.loop !15

173:                                              ; preds = %84
  %174 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %174, ptr %3, align 8
  store i32 1, ptr %13, align 4
  br label %175

175:                                              ; preds = %173, %55
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  %176 = load ptr, ptr %9, align 8
  call void @llvm.stackrestore.p0(ptr %176)
  call void @llvm.lifetime.end.p0(i64 3, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %177

177:                                              ; preds = %175, %26
  %178 = load ptr, ptr %3, align 8
  ret ptr %178
}

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #5

; Function Attrs: nounwind
declare i64 @strtol(ptr noundef, ptr noundef, i32 noundef) #1

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #5

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { 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 #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 = { 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 = { nocallback nofree nosync nounwind willreturn }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
attributes #8 = { nounwind allocsize(0) }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !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.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1

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

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

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) 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: nofree nounwind
declare noundef i32 @sprintf(ptr noalias nocapture noundef writeonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
declare dso_local i32 @join_shares(ptr noundef, i32 noundef) local_unnamed_addr #5

; Function Attrs: nounwind uwtable
define dso_local noalias noundef ptr @decode(ptr noundef readonly %0, i32 noundef %1) local_unnamed_addr #5 {
  %3 = alloca [3 x i8], align 1
  %4 = icmp eq i32 %1, 0
  %5 = icmp eq ptr %0, null
  %or.cond = or i1 %5, %4
  br i1 %or.cond, label %73, label %6

6:                                                ; preds = %2
  %7 = load ptr, ptr %0, align 8, !tbaa !5
  %8 = icmp eq ptr %7, null
  br i1 %8, label %73, label %9

9:                                                ; preds = %6
  %10 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %7) #9
  %11 = add i64 %10, 8589934586
  %12 = lshr i64 %11, 1
  %13 = trunc i64 %12 to i32
  %14 = shl i64 %12, 32
  %sext = add i64 %14, 4294967296
  %15 = ashr exact i64 %sext, 32
  %16 = tail call noalias ptr @malloc(i64 noundef %15) #10
  call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %3) #11
  %17 = getelementptr inbounds i8, ptr %3, i64 2
  store i8 0, ptr %17, align 1, !tbaa !9
  %18 = zext i32 %1 to i64
  %19 = tail call ptr @llvm.stacksave.p0()
  %20 = alloca i32, i64 %18, align 16
  %21 = icmp sgt i32 %1, 0
  br i1 %21, label %.lr.ph, label %.preheader.thread

.lr.ph:                                           ; preds = %9
  %22 = getelementptr inbounds i8, ptr %3, i64 1
  br label %56

.preheader:                                       ; preds = %61
  %23 = icmp sgt i32 %13, 0
  br i1 %23, label %.lr.ph58, label %.loopexit

.preheader.thread:                                ; preds = %9
  %24 = icmp sgt i32 %13, 0
  br i1 %24, label %.lr.ph58.thread, label %.loopexit

.lr.ph58.thread:                                  ; preds = %.preheader.thread
  %25 = sext i32 %1 to i64
  %26 = shl nsw i64 %25, 3
  br label %.lr.ph58.split.preheader

.lr.ph58:                                         ; preds = %.preheader
  %27 = zext nneg i32 %1 to i64
  %28 = shl nuw nsw i64 %27, 3
  %29 = getelementptr inbounds i8, ptr %3, i64 1
  br i1 %21, label %.lr.ph56.us.preheader, label %.lr.ph58.split.preheader

.lr.ph58.split.preheader:                         ; preds = %.lr.ph58.thread, %.lr.ph58
  %30 = phi i64 [ %26, %.lr.ph58.thread ], [ %28, %.lr.ph58 ]
  %wide.trip.count64 = and i64 %12, 2147483647
  br label %.lr.ph58.split

.lr.ph56.us.preheader:                            ; preds = %.lr.ph58
  %wide.trip.count74 = and i64 %12, 2147483647
  br label %.lr.ph56.us

.lr.ph56.us:                                      ; preds = %.lr.ph56.us.preheader, %._crit_edge.us
  %indvars.iv71 = phi i64 [ 0, %.lr.ph56.us.preheader ], [ %indvars.iv.next72, %._crit_edge.us ]
  %31 = tail call noalias ptr @malloc(i64 noundef %28) #10
  %32 = shl nuw nsw i64 %indvars.iv71, 1
  br label %33

33:                                               ; preds = %.lr.ph56.us, %49
  %indvars.iv66 = phi i64 [ 0, %.lr.ph56.us ], [ %indvars.iv.next67, %49 ]
  %34 = getelementptr inbounds i32, ptr %20, i64 %indvars.iv66
  %35 = load i32, ptr %34, align 4, !tbaa !10
  %36 = shl nuw nsw i64 %indvars.iv66, 1
  %37 = getelementptr inbounds i32, ptr %31, i64 %36
  store i32 %35, ptr %37, align 4, !tbaa !10
  %38 = getelementptr inbounds ptr, ptr %0, i64 %indvars.iv66
  %39 = load ptr, ptr %38, align 8, !tbaa !5
  %40 = getelementptr inbounds i8, ptr %39, i64 %32
  %41 = getelementptr inbounds i8, ptr %40, i64 6
  %42 = load i8, ptr %41, align 1, !tbaa !9
  store i8 %42, ptr %3, align 1, !tbaa !9
  %43 = getelementptr inbounds i8, ptr %40, i64 7
  %44 = load i8, ptr %43, align 1, !tbaa !9
  store i8 %44, ptr %29, align 1, !tbaa !9
  %bcmp.us = call i32 @bcmp(ptr noundef nonnull dereferenceable(2) %3, ptr noundef nonnull dereferenceable(2) @.str.1, i64 2)
  %45 = icmp eq i32 %bcmp.us, 0
  br i1 %45, label %49, label %46

46:                                               ; preds = %33
  %47 = call i64 @strtol(ptr nocapture noundef nonnull %3, ptr noundef null, i32 noundef 16) #11
  %48 = trunc i64 %47 to i32
  br label %49

49:                                               ; preds = %33, %46
  %.sink = phi i32 [ %48, %46 ], [ 256, %33 ]
  %50 = or disjoint i64 %36, 1
  %51 = getelementptr inbounds i32, ptr %31, i64 %50
  store i32 %.sink, ptr %51, align 4, !tbaa !10
  %indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
  %exitcond70.not = icmp eq i64 %indvars.iv.next67, %18
  br i1 %exitcond70.not, label %._crit_edge.us, label %33, !llvm.loop !12

._crit_edge.us:                                   ; preds = %49
  %52 = tail call i32 @join_shares(ptr noundef nonnull %31, i32 noundef %1)
  tail call void @free(ptr noundef nonnull %31) #11
  %53 = getelementptr inbounds i8, ptr %16, i64 %indvars.iv71
  %sext53.us = shl i32 %52, 24
  %54 = ashr exact i32 %sext53.us, 24
  %55 = tail call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %53, ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %54) #11
  %indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1
  %exitcond75.not = icmp eq i64 %indvars.iv.next72, %wide.trip.count74
  br i1 %exitcond75.not, label %.loopexit, label %.lr.ph56.us, !llvm.loop !14

56:                                               ; preds = %.lr.ph, %61
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %61 ]
  %57 = getelementptr inbounds ptr, ptr %0, i64 %indvars.iv
  %58 = load ptr, ptr %57, align 8, !tbaa !5
  %59 = icmp eq ptr %58, null
  br i1 %59, label %60, label %61

60:                                               ; preds = %56
  tail call void @free(ptr noundef %16) #11
  br label %.loopexit

61:                                               ; preds = %56
  %62 = load i8, ptr %58, align 1, !tbaa !9
  store i8 %62, ptr %3, align 1, !tbaa !9
  %63 = getelementptr inbounds i8, ptr %58, i64 1
  %64 = load i8, ptr %63, align 1, !tbaa !9
  store i8 %64, ptr %22, align 1, !tbaa !9
  %65 = call i64 @strtol(ptr nocapture noundef nonnull %3, ptr noundef null, i32 noundef 16) #11
  %66 = trunc i64 %65 to i32
  %67 = getelementptr inbounds i32, ptr %20, i64 %indvars.iv
  store i32 %66, ptr %67, align 4, !tbaa !10
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %18
  br i1 %exitcond.not, label %.preheader, label %56, !llvm.loop !15

.lr.ph58.split:                                   ; preds = %.lr.ph58.split.preheader, %.lr.ph58.split
  %indvars.iv61 = phi i64 [ 0, %.lr.ph58.split.preheader ], [ %indvars.iv.next62, %.lr.ph58.split ]
  %68 = tail call noalias ptr @malloc(i64 noundef %30) #10
  %69 = tail call i32 @join_shares(ptr noundef %68, i32 noundef %1)
  tail call void @free(ptr noundef %68) #11
  %70 = getelementptr inbounds i8, ptr %16, i64 %indvars.iv61
  %sext53 = shl i32 %69, 24
  %71 = ashr exact i32 %sext53, 24
  %72 = tail call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %70, ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %71) #11
  %indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1
  %exitcond65.not = icmp eq i64 %indvars.iv.next62, %wide.trip.count64
  br i1 %exitcond65.not, label %.loopexit, label %.lr.ph58.split, !llvm.loop !14

.loopexit:                                        ; preds = %.lr.ph58.split, %._crit_edge.us, %.preheader.thread, %.preheader, %60
  %.0 = phi ptr [ null, %60 ], [ %16, %.preheader ], [ %16, %.preheader.thread ], [ %16, %._crit_edge.us ], [ %16, %.lr.ph58.split ]
  tail call void @llvm.stackrestore.p0(ptr %19)
  call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %3) #11
  br label %73

73:                                               ; preds = %2, %6, %.loopexit
  %.1 = phi ptr [ %.0, %.loopexit ], [ null, %6 ], [ null, %2 ]
  ret ptr %.1
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #6

; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #7

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #6

; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #8

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, 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 #2 = { 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 #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 = { 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 = { 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 #6 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #7 = { mustprogress nofree nounwind willreturn "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 #8 = { nofree nounwind willreturn memory(argmem: read) }
attributes #9 = { nounwind willreturn memory(read) }
attributes #10 = { nounwind allocsize(0) }
attributes #11 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}


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