; LLVM IR from Water-Melon/Melon :: src (mln_bignum)

; 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.mln_bignum_t = type { i32, i32, [257 x i64] }

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

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

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

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

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

; Function Attrs: nounwind uwtable
define dso_local ptr @mln_bignum_tostring(ptr noundef nonnull %0) #4 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i8, align 1
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca %struct.mln_bignum_t, align 8
  %11 = alloca %struct.mln_bignum_t, align 8
  %12 = alloca i32, align 4
  %13 = alloca %struct.mln_bignum_t, align 8
  %14 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #8
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.mln_bignum_t, ptr %15, i32 0, i32 1
  %17 = load i32, ptr %16, align 4, !tbaa !9
  %18 = shl i32 %17, 6
  store i32 %18, ptr %9, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 2064, ptr %10) #8
  call void @llvm.memset.p0.i64(ptr align 8 %10, i8 0, i64 2064, i1 false)
  call void @llvm.lifetime.start.p0(i64 2064, ptr %11) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.mln_bignum_t, ptr %19, i32 0, i32 0
  %21 = load i32, ptr %20, align 8, !tbaa !13
  %22 = icmp eq i32 %21, 1
  %23 = zext i1 %22 to i32
  store i32 %23, ptr %12, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 2064, ptr %13) #8
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %13, ptr align 8 %24, i64 2064, i1 false), !tbaa.struct !14
  %25 = load i32, ptr %9, align 4, !tbaa !12
  %26 = icmp ne i32 %25, 0
  br i1 %26, label %30, label %27

27:                                               ; preds = %1
  %28 = load i32, ptr %9, align 4, !tbaa !12
  %29 = add i32 %28, 1
  store i32 %29, ptr %9, align 4, !tbaa !12
  br label %30

30:                                               ; preds = %27, %1
  %31 = load i32, ptr %9, align 4, !tbaa !12
  %32 = add i32 %31, 1
  %33 = zext i32 %32 to i64
  %34 = call noalias ptr @malloc(i64 noundef %33) #9
  store ptr %34, ptr %5, align 8, !tbaa !5
  %35 = icmp eq ptr %34, null
  br i1 %35, label %36, label %37

36:                                               ; preds = %30
  store ptr null, ptr %2, align 8
  store i32 1, ptr %14, align 4
  br label %125

37:                                               ; preds = %30
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %38, ptr %6, align 8, !tbaa !5
  br label %39

39:                                               ; preds = %47, %37
  %40 = call i32 @mln_bignum_compare(ptr noundef %13, ptr noundef %10)
  %41 = icmp ne i32 %40, 0
  br i1 %41, label %42, label %57

42:                                               ; preds = %39
  %43 = call i32 @__mln_bignum_div_word(ptr noundef %13, i64 noundef 10, ptr noundef %11)
  %44 = icmp slt i32 %43, 0
  br i1 %44, label %45, label %47

45:                                               ; preds = %42
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  call void @free(ptr noundef %46) #8
  store ptr null, ptr %2, align 8
  store i32 1, ptr %14, align 4
  br label %125

47:                                               ; preds = %42
  %48 = getelementptr inbounds %struct.mln_bignum_t, ptr %13, i32 0, i32 2
  %49 = getelementptr inbounds [257 x i64], ptr %48, i64 0, i64 0
  %50 = load i64, ptr %49, align 8, !tbaa !16
  %51 = trunc i64 %50 to i8
  %52 = zext i8 %51 to i32
  %53 = add nsw i32 %52, 48
  %54 = trunc i32 %53 to i8
  %55 = load ptr, ptr %6, align 8, !tbaa !5
  %56 = getelementptr inbounds i8, ptr %55, i32 1
  store ptr %56, ptr %6, align 8, !tbaa !5
  store i8 %54, ptr %55, align 1, !tbaa !15
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %13, ptr align 8 %11, i64 2064, i1 false), !tbaa.struct !14
  br label %39, !llvm.loop !18

57:                                               ; preds = %39
  %58 = load i32, ptr %12, align 4, !tbaa !12
  %59 = icmp ne i32 %58, 0
  br i1 %59, label %60, label %63

60:                                               ; preds = %57
  %61 = load ptr, ptr %6, align 8, !tbaa !5
  %62 = getelementptr inbounds i8, ptr %61, i32 1
  store ptr %62, ptr %6, align 8, !tbaa !5
  store i8 45, ptr %61, align 1, !tbaa !15
  br label %63

63:                                               ; preds = %60, %57
  %64 = load ptr, ptr %6, align 8, !tbaa !5
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = ptrtoint ptr %64 to i64
  %67 = ptrtoint ptr %65 to i64
  %68 = sub i64 %66, %67
  %69 = trunc i64 %68 to i32
  store i32 %69, ptr %9, align 4, !tbaa !12
  store i32 0, ptr %8, align 4, !tbaa !12
  br label %70

70:                                               ; preds = %101, %63
  %71 = load i32, ptr %8, align 4, !tbaa !12
  %72 = load i32, ptr %9, align 4, !tbaa !12
  %73 = lshr i32 %72, 1
  %74 = icmp ult i32 %71, %73
  br i1 %74, label %75, label %104

75:                                               ; preds = %70
  %76 = load ptr, ptr %5, align 8, !tbaa !5
  %77 = load i32, ptr %8, align 4, !tbaa !12
  %78 = zext i32 %77 to i64
  %79 = getelementptr inbounds i8, ptr %76, i64 %78
  %80 = load i8, ptr %79, align 1, !tbaa !15
  store i8 %80, ptr %7, align 1, !tbaa !15
  %81 = load ptr, ptr %5, align 8, !tbaa !5
  %82 = load i32, ptr %9, align 4, !tbaa !12
  %83 = load i32, ptr %8, align 4, !tbaa !12
  %84 = sub i32 %82, %83
  %85 = sub i32 %84, 1
  %86 = zext i32 %85 to i64
  %87 = getelementptr inbounds i8, ptr %81, i64 %86
  %88 = load i8, ptr %87, align 1, !tbaa !15
  %89 = load ptr, ptr %5, align 8, !tbaa !5
  %90 = load i32, ptr %8, align 4, !tbaa !12
  %91 = zext i32 %90 to i64
  %92 = getelementptr inbounds i8, ptr %89, i64 %91
  store i8 %88, ptr %92, align 1, !tbaa !15
  %93 = load i8, ptr %7, align 1, !tbaa !15
  %94 = load ptr, ptr %5, align 8, !tbaa !5
  %95 = load i32, ptr %9, align 4, !tbaa !12
  %96 = load i32, ptr %8, align 4, !tbaa !12
  %97 = sub i32 %95, %96
  %98 = sub i32 %97, 1
  %99 = zext i32 %98 to i64
  %100 = getelementptr inbounds i8, ptr %94, i64 %99
  store i8 %93, ptr %100, align 1, !tbaa !15
  br label %101

101:                                              ; preds = %75
  %102 = load i32, ptr %8, align 4, !tbaa !12
  %103 = add i32 %102, 1
  store i32 %103, ptr %8, align 4, !tbaa !12
  br label %70, !llvm.loop !20

104:                                              ; preds = %70
  %105 = load ptr, ptr %6, align 8, !tbaa !5
  %106 = load ptr, ptr %5, align 8, !tbaa !5
  %107 = icmp eq ptr %105, %106
  br i1 %107, label %108, label %111

108:                                              ; preds = %104
  %109 = load ptr, ptr %6, align 8, !tbaa !5
  %110 = getelementptr inbounds i8, ptr %109, i32 1
  store ptr %110, ptr %6, align 8, !tbaa !5
  store i8 48, ptr %109, align 1, !tbaa !15
  br label %111

111:                                              ; preds = %108, %104
  %112 = load ptr, ptr %6, align 8, !tbaa !5
  store i8 0, ptr %112, align 1, !tbaa !15
  %113 = load ptr, ptr %5, align 8, !tbaa !5
  %114 = load ptr, ptr %6, align 8, !tbaa !5
  %115 = load ptr, ptr %5, align 8, !tbaa !5
  %116 = ptrtoint ptr %114 to i64
  %117 = ptrtoint ptr %115 to i64
  %118 = sub i64 %116, %117
  %119 = call ptr @mln_string_buf_new(ptr noundef %113, i64 noundef %118)
  store ptr %119, ptr %4, align 8, !tbaa !5
  %120 = icmp eq ptr %119, null
  br i1 %120, label %121, label %123

121:                                              ; preds = %111
  %122 = load ptr, ptr %5, align 8, !tbaa !5
  call void @free(ptr noundef %122) #8
  store ptr null, ptr %2, align 8
  store i32 1, ptr %14, align 4
  br label %125

123:                                              ; preds = %111
  %124 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %124, ptr %2, align 8
  store i32 1, ptr %14, align 4
  br label %125

125:                                              ; preds = %123, %121, %45, %36
  call void @llvm.lifetime.end.p0(i64 2064, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 2064, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 2064, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #8
  %126 = load ptr, ptr %2, align 8
  ret ptr %126
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @__mln_bignum_div_word(ptr noundef, i64 noundef, ptr noundef) #6

declare ptr @mln_string_buf_new(ptr noundef, i64 noundef) #7

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 nounwind willreturn memory(argmem: write) }
attributes #6 = { inlinehint 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 #7 = { "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 = { nounwind }
attributes #9 = { 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, !11, i64 4}
!10 = !{!"", !11, i64 0, !11, i64 4, !7, i64 8}
!11 = !{!"int", !7, i64 0}
!12 = !{!11, !11, i64 0}
!13 = !{!10, !11, i64 0}
!14 = !{i64 0, i64 4, !12, i64 4, i64 4, !12, i64 8, i64 2056, !15}
!15 = !{!7, !7, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"long", !7, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = distinct !{!20, !19}


; 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.mln_bignum_t = type { i32, i32, [257 x i64] }

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

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

; Function Attrs: mustprogress 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 nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

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

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

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

; Function Attrs: nounwind uwtable
define dso_local ptr @mln_bignum_tostring(ptr nocapture noundef nonnull readonly %0) local_unnamed_addr #4 {
  %2 = alloca %struct.mln_bignum_t, align 8
  %3 = alloca %struct.mln_bignum_t, align 8
  %4 = alloca %struct.mln_bignum_t, align 8
  %5 = getelementptr inbounds i8, ptr %0, i64 4
  %6 = load i32, ptr %5, align 4, !tbaa !5
  %7 = shl i32 %6, 6
  call void @llvm.lifetime.start.p0(i64 2064, ptr nonnull %2) #9
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(2064) %2, i8 0, i64 2064, i1 false)
  call void @llvm.lifetime.start.p0(i64 2064, ptr nonnull %3) #9
  %8 = load i32, ptr %0, align 8, !tbaa !10
  %9 = icmp eq i32 %8, 1
  call void @llvm.lifetime.start.p0(i64 2064, ptr nonnull %4) #9
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(2064) %4, ptr noundef nonnull align 8 dereferenceable(2064) %0, i64 2064, i1 false), !tbaa.struct !11
  %spec.select = tail call i32 @llvm.umax.i32(i32 %7, i32 1)
  %10 = add nuw nsw i32 %spec.select, 1
  %11 = zext i32 %10 to i64
  %12 = tail call noalias ptr @malloc(i64 noundef %11) #10
  %13 = icmp eq ptr %12, null
  br i1 %13, label %61, label %.preheader

.preheader:                                       ; preds = %1
  %14 = call i32 @mln_bignum_compare(ptr noundef %4, ptr noundef %2)
  %.not4345 = icmp eq i32 %14, 0
  br i1 %.not4345, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader
  %15 = getelementptr inbounds i8, ptr %4, i64 8
  br label %16

16:                                               ; preds = %.lr.ph, %19
  %.03846 = phi ptr [ %12, %.lr.ph ], [ %23, %19 ]
  %17 = call i32 @__mln_bignum_div_word(ptr noundef nonnull %4, i64 noundef 10, ptr noundef nonnull %3)
  %18 = icmp slt i32 %17, 0
  br i1 %18, label %.sink.split, label %19

19:                                               ; preds = %16
  %20 = load i64, ptr %15, align 8, !tbaa !14
  %21 = trunc i64 %20 to i8
  %22 = add i8 %21, 48
  %23 = getelementptr inbounds i8, ptr %.03846, i64 1
  store i8 %22, ptr %.03846, align 1, !tbaa !13
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(2064) %4, ptr noundef nonnull align 8 dereferenceable(2064) %3, i64 2064, i1 false), !tbaa.struct !11
  %24 = call i32 @mln_bignum_compare(ptr noundef %4, ptr noundef %2)
  %.not43 = icmp eq i32 %24, 0
  br i1 %.not43, label %._crit_edge, label %16, !llvm.loop !16

._crit_edge:                                      ; preds = %19, %.preheader
  %.038.lcssa = phi ptr [ %12, %.preheader ], [ %23, %19 ]
  br i1 %9, label %25, label %27

25:                                               ; preds = %._crit_edge
  %26 = getelementptr inbounds i8, ptr %.038.lcssa, i64 1
  store i8 45, ptr %.038.lcssa, align 1, !tbaa !13
  br label %27

27:                                               ; preds = %25, %._crit_edge
  %.1 = phi ptr [ %26, %25 ], [ %.038.lcssa, %._crit_edge ]
  %28 = ptrtoint ptr %.1 to i64
  %29 = ptrtoint ptr %12 to i64
  %30 = sub i64 %28, %29
  %31 = and i64 %30, 4294967294
  %.not = icmp eq i64 %31, 0
  br i1 %.not, label %._crit_edge50, label %.lr.ph49.preheader

.lr.ph49.preheader:                               ; preds = %27
  %32 = lshr i64 %30, 1
  %wide.trip.count = and i64 %32, 2147483647
  %xtraiter = and i64 %32, 1
  %33 = icmp eq i64 %wide.trip.count, 1
  br i1 %33, label %._crit_edge50.loopexit.unr-lcssa, label %.lr.ph49.preheader.new

.lr.ph49.preheader.new:                           ; preds = %.lr.ph49.preheader
  %unroll_iter = sub nsw i64 %wide.trip.count, %xtraiter
  br label %.lr.ph49

.lr.ph49:                                         ; preds = %.lr.ph49, %.lr.ph49.preheader.new
  %indvars.iv = phi i64 [ 0, %.lr.ph49.preheader.new ], [ %indvars.iv.next.1, %.lr.ph49 ]
  %niter = phi i64 [ 0, %.lr.ph49.preheader.new ], [ %niter.next.1, %.lr.ph49 ]
  %34 = getelementptr inbounds i8, ptr %12, i64 %indvars.iv
  %35 = load i8, ptr %34, align 1, !tbaa !13
  %36 = xor i64 %indvars.iv, -1
  %37 = add i64 %30, %36
  %38 = and i64 %37, 4294967295
  %39 = getelementptr inbounds i8, ptr %12, i64 %38
  %40 = load i8, ptr %39, align 1, !tbaa !13
  store i8 %40, ptr %34, align 1, !tbaa !13
  store i8 %35, ptr %39, align 1, !tbaa !13
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %41 = getelementptr inbounds i8, ptr %12, i64 %indvars.iv.next
  %42 = load i8, ptr %41, align 1, !tbaa !13
  %43 = xor i64 %indvars.iv, 4294967294
  %44 = add i64 %30, %43
  %45 = and i64 %44, 4294967295
  %46 = getelementptr inbounds i8, ptr %12, i64 %45
  %47 = load i8, ptr %46, align 1, !tbaa !13
  store i8 %47, ptr %41, align 1, !tbaa !13
  store i8 %42, ptr %46, align 1, !tbaa !13
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge50.loopexit.unr-lcssa, label %.lr.ph49, !llvm.loop !18

._crit_edge50.loopexit.unr-lcssa:                 ; preds = %.lr.ph49, %.lr.ph49.preheader
  %indvars.iv.unr = phi i64 [ 0, %.lr.ph49.preheader ], [ %indvars.iv.next.1, %.lr.ph49 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge50, label %.lr.ph49.epil

.lr.ph49.epil:                                    ; preds = %._crit_edge50.loopexit.unr-lcssa
  %48 = getelementptr inbounds i8, ptr %12, i64 %indvars.iv.unr
  %49 = load i8, ptr %48, align 1, !tbaa !13
  %50 = xor i64 %indvars.iv.unr, -1
  %51 = add i64 %30, %50
  %52 = and i64 %51, 4294967295
  %53 = getelementptr inbounds i8, ptr %12, i64 %52
  %54 = load i8, ptr %53, align 1, !tbaa !13
  store i8 %54, ptr %48, align 1, !tbaa !13
  store i8 %49, ptr %53, align 1, !tbaa !13
  br label %._crit_edge50

._crit_edge50:                                    ; preds = %.lr.ph49.epil, %._crit_edge50.loopexit.unr-lcssa, %27
  %55 = icmp eq ptr %.1, %12
  br i1 %55, label %56, label %58

56:                                               ; preds = %._crit_edge50
  %57 = getelementptr inbounds i8, ptr %12, i64 1
  store i8 48, ptr %12, align 1, !tbaa !13
  br label %58

58:                                               ; preds = %56, %._crit_edge50
  %.pre-phi53 = phi i64 [ 1, %56 ], [ %30, %._crit_edge50 ]
  %.2 = phi ptr [ %57, %56 ], [ %.1, %._crit_edge50 ]
  store i8 0, ptr %.2, align 1, !tbaa !13
  %59 = call ptr @mln_string_buf_new(ptr noundef nonnull %12, i64 noundef %.pre-phi53) #9
  %60 = icmp eq ptr %59, null
  br i1 %60, label %.sink.split, label %61

.sink.split:                                      ; preds = %16, %58
  call void @free(ptr noundef %12) #9
  br label %61

61:                                               ; preds = %.sink.split, %58, %1
  %.0 = phi ptr [ null, %1 ], [ %59, %58 ], [ null, %.sink.split ]
  call void @llvm.lifetime.end.p0(i64 2064, ptr nonnull %4) #9
  call void @llvm.lifetime.end.p0(i64 2064, ptr nonnull %3) #9
  call void @llvm.lifetime.end.p0(i64 2064, ptr nonnull %2) #9
  ret ptr %.0
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @__mln_bignum_div_word(ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #6

declare ptr @mln_string_buf_new(ptr noundef, i64 noundef) local_unnamed_addr #7

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

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


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