; LLVM IR from seppo0010/rlite :: src (page_multi_string)

; 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.rl_data_type = type { ptr, ptr, ptr, ptr }
%struct.rl_list_type = type { ptr, ptr, i32, ptr }
%struct.rlite = type { i64, i64, i32, ptr, i64, i64, i64, ptr, i32, i32, i32, i32, ptr, i64, i64, ptr, i64, i64, ptr, ptr, ptr, ptr }
%struct.rl_list = type { i64, i64, ptr, i64, i64 }

@rl_data_type_list_long = external global %struct.rl_data_type, align 8
@rl_list_type_long = external global %struct.rl_list_type, align 8

; Function Attrs: nounwind uwtable
declare dso_local i32 @rl_normalize_string_range(i64 noundef, ptr noundef, ptr noundef) #0

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

declare i32 @rl_read(ptr noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef, i32 noundef) #2

declare i32 @rl_string_get(ptr noundef, ptr noundef, i64 noundef) #2

declare i32 @rl_list_node_destroy(ptr noundef, ptr noundef) #2

declare i32 @rl_list_destroy(ptr noundef, ptr noundef) #2

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

declare i32 @rl_list_get_element(ptr noundef, ptr noundef, ptr noundef, i64 noundef) #2

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

; 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) #4

; Function Attrs: nounwind uwtable
define dso_local i32 @rl_multi_string_getrange(ptr noundef %0, i64 noundef %1, ptr noundef %2, ptr noundef %3, i64 noundef %4, i64 noundef %5) #0 {
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca i32, align 4
  %20 = alloca ptr, align 8
  %21 = alloca i64, align 8
  %22 = alloca i64, align 8
  %23 = alloca i64, align 8
  %24 = alloca i64, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i64 %1, ptr %8, align 8, !tbaa !9
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store i64 %4, ptr %11, align 8, !tbaa !9
  store i64 %5, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  store ptr null, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  store ptr null, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  store ptr null, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  %26 = load i64, ptr %8, align 8, !tbaa !9
  %27 = call i32 @rl_read(ptr noundef %25, ptr noundef @rl_data_type_list_long, i64 noundef %26, ptr noundef @rl_list_type_long, ptr noundef %16, i32 noundef 0)
  store i32 %27, ptr %19, align 4, !tbaa !11
  %28 = load i32, ptr %19, align 4, !tbaa !11
  %29 = icmp ne i32 2, %28
  br i1 %29, label %30, label %31

30:                                               ; preds = %6
  br label %156

31:                                               ; preds = %6
  %32 = load ptr, ptr %16, align 8, !tbaa !5
  store ptr %32, ptr %14, align 8, !tbaa !5
  store i64 0, ptr %22, align 8, !tbaa !9
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  %34 = load ptr, ptr %14, align 8, !tbaa !5
  %35 = call i32 @rl_list_get_element(ptr noundef %33, ptr noundef %34, ptr noundef %17, i64 noundef 0)
  store i32 %35, ptr %19, align 4, !tbaa !11
  %36 = load i32, ptr %19, align 4, !tbaa !11
  %37 = icmp ne i32 2, %36
  br i1 %37, label %38, label %39

38:                                               ; preds = %31
  br label %156

39:                                               ; preds = %31
  %40 = load ptr, ptr %17, align 8, !tbaa !5
  %41 = load i64, ptr %40, align 8, !tbaa !9
  store i64 %41, ptr %13, align 8, !tbaa !9
  %42 = load i64, ptr %13, align 8, !tbaa !9
  %43 = icmp eq i64 %42, 0
  br i1 %43, label %44, label %51

44:                                               ; preds = %39
  %45 = load ptr, ptr %10, align 8, !tbaa !5
  store i64 0, ptr %45, align 8, !tbaa !9
  %46 = load ptr, ptr %9, align 8, !tbaa !5
  %47 = icmp ne ptr %46, null
  br i1 %47, label %48, label %50

48:                                               ; preds = %44
  %49 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr null, ptr %49, align 8, !tbaa !5
  br label %50

50:                                               ; preds = %48, %44
  store i32 0, ptr %19, align 4, !tbaa !11
  br label %156

51:                                               ; preds = %39
  %52 = load i64, ptr %13, align 8, !tbaa !9
  %53 = call i32 @rl_normalize_string_range(i64 noundef %52, ptr noundef %11, ptr noundef %12)
  %54 = load i64, ptr %12, align 8, !tbaa !9
  %55 = load i64, ptr %11, align 8, !tbaa !9
  %56 = icmp slt i64 %54, %55
  br i1 %56, label %57, label %64

57:                                               ; preds = %51
  %58 = load ptr, ptr %10, align 8, !tbaa !5
  store i64 0, ptr %58, align 8, !tbaa !9
  %59 = load ptr, ptr %9, align 8, !tbaa !5
  %60 = icmp ne ptr %59, null
  br i1 %60, label %61, label %63

61:                                               ; preds = %57
  %62 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr null, ptr %62, align 8, !tbaa !5
  br label %63

63:                                               ; preds = %61, %57
  store i32 0, ptr %19, align 4, !tbaa !11
  br label %156

64:                                               ; preds = %51
  %65 = load i64, ptr %12, align 8, !tbaa !9
  %66 = load i64, ptr %11, align 8, !tbaa !9
  %67 = sub nsw i64 %65, %66
  %68 = add nsw i64 %67, 1
  %69 = load ptr, ptr %10, align 8, !tbaa !5
  store i64 %68, ptr %69, align 8, !tbaa !9
  %70 = load ptr, ptr %9, align 8, !tbaa !5
  %71 = icmp ne ptr %70, null
  br i1 %71, label %73, label %72

72:                                               ; preds = %64
  store i32 0, ptr %19, align 4, !tbaa !11
  br label %156

73:                                               ; preds = %64
  %74 = load ptr, ptr %10, align 8, !tbaa !5
  %75 = load i64, ptr %74, align 8, !tbaa !9
  %76 = add nsw i64 %75, 1
  %77 = mul i64 1, %76
  %78 = call noalias ptr @malloc(i64 noundef %77) #7
  store ptr %78, ptr %18, align 8, !tbaa !5
  %79 = load ptr, ptr %18, align 8, !tbaa !5
  %80 = icmp ne ptr %79, null
  br i1 %80, label %82, label %81

81:                                               ; preds = %73
  store i32 4, ptr %19, align 4, !tbaa !11
  br label %156

82:                                               ; preds = %73
  %83 = load i64, ptr %11, align 8, !tbaa !9
  %84 = load ptr, ptr %7, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.rlite, ptr %84, i32 0, i32 6
  %86 = load i64, ptr %85, align 8, !tbaa !13
  %87 = sdiv i64 %83, %86
  store i64 %87, ptr %21, align 8, !tbaa !9
  %88 = load i64, ptr %11, align 8, !tbaa !9
  %89 = load ptr, ptr %7, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.rlite, ptr %89, i32 0, i32 6
  %91 = load i64, ptr %90, align 8, !tbaa !13
  %92 = srem i64 %88, %91
  store i64 %92, ptr %24, align 8, !tbaa !9
  %93 = load i64, ptr %21, align 8, !tbaa !9
  %94 = add nsw i64 %93, 1
  store i64 %94, ptr %21, align 8, !tbaa !9
  br label %95

95:                                               ; preds = %146, %82
  %96 = load i64, ptr %21, align 8, !tbaa !9
  %97 = load ptr, ptr %14, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.rl_list, ptr %97, i32 0, i32 1
  %99 = load i64, ptr %98, align 8, !tbaa !15
  %100 = icmp slt i64 %96, %99
  br i1 %100, label %101, label %149

101:                                              ; preds = %95
  %102 = load ptr, ptr %7, align 8, !tbaa !5
  %103 = load ptr, ptr %14, align 8, !tbaa !5
  %104 = load i64, ptr %21, align 8, !tbaa !9
  %105 = call i32 @rl_list_get_element(ptr noundef %102, ptr noundef %103, ptr noundef %17, i64 noundef %104)
  store i32 %105, ptr %19, align 4, !tbaa !11
  %106 = load i32, ptr %19, align 4, !tbaa !11
  %107 = icmp ne i32 2, %106
  br i1 %107, label %108, label %109

108:                                              ; preds = %101
  br label %156

109:                                              ; preds = %101
  %110 = load ptr, ptr %7, align 8, !tbaa !5
  %111 = load ptr, ptr %17, align 8, !tbaa !5
  %112 = load i64, ptr %111, align 8, !tbaa !9
  %113 = call i32 @rl_string_get(ptr noundef %110, ptr noundef %20, i64 noundef %112)
  store i32 %113, ptr %19, align 4, !tbaa !11
  %114 = load i32, ptr %19, align 4, !tbaa !11
  %115 = icmp ne i32 0, %114
  br i1 %115, label %116, label %117

116:                                              ; preds = %109
  br label %156

117:                                              ; preds = %109
  %118 = load ptr, ptr %7, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.rlite, ptr %118, i32 0, i32 6
  %120 = load i64, ptr %119, align 8, !tbaa !13
  %121 = load i64, ptr %24, align 8, !tbaa !9
  %122 = sub nsw i64 %120, %121
  store i64 %122, ptr %23, align 8, !tbaa !9
  %123 = load i64, ptr %22, align 8, !tbaa !9
  %124 = load i64, ptr %23, align 8, !tbaa !9
  %125 = add nsw i64 %123, %124
  %126 = load ptr, ptr %10, align 8, !tbaa !5
  %127 = load i64, ptr %126, align 8, !tbaa !9
  %128 = icmp sgt i64 %125, %127
  br i1 %128, label %129, label %134

129:                                              ; preds = %117
  %130 = load ptr, ptr %10, align 8, !tbaa !5
  %131 = load i64, ptr %130, align 8, !tbaa !9
  %132 = load i64, ptr %22, align 8, !tbaa !9
  %133 = sub nsw i64 %131, %132
  store i64 %133, ptr %23, align 8, !tbaa !9
  br label %134

134:                                              ; preds = %129, %117
  %135 = load ptr, ptr %18, align 8, !tbaa !5
  %136 = load i64, ptr %22, align 8, !tbaa !9
  %137 = getelementptr inbounds i8, ptr %135, i64 %136
  %138 = load ptr, ptr %20, align 8, !tbaa !5
  %139 = load i64, ptr %24, align 8, !tbaa !9
  %140 = getelementptr inbounds i8, ptr %138, i64 %139
  %141 = load i64, ptr %23, align 8, !tbaa !9
  %142 = mul i64 1, %141
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %137, ptr align 1 %140, i64 %142, i1 false)
  %143 = load i64, ptr %23, align 8, !tbaa !9
  %144 = load i64, ptr %22, align 8, !tbaa !9
  %145 = add nsw i64 %144, %143
  store i64 %145, ptr %22, align 8, !tbaa !9
  store i64 0, ptr %24, align 8, !tbaa !9
  br label %146

146:                                              ; preds = %134
  %147 = load i64, ptr %21, align 8, !tbaa !9
  %148 = add nsw i64 %147, 1
  store i64 %148, ptr %21, align 8, !tbaa !9
  br label %95, !llvm.loop !17

149:                                              ; preds = %95
  %150 = load ptr, ptr %18, align 8, !tbaa !5
  %151 = load ptr, ptr %10, align 8, !tbaa !5
  %152 = load i64, ptr %151, align 8, !tbaa !9
  %153 = getelementptr inbounds i8, ptr %150, i64 %152
  store i8 0, ptr %153, align 1, !tbaa !19
  %154 = load ptr, ptr %18, align 8, !tbaa !5
  %155 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %154, ptr %155, align 8, !tbaa !5
  store i32 0, ptr %19, align 4, !tbaa !11
  br label %156

156:                                              ; preds = %149, %116, %108, %81, %72, %63, %50, %38, %30
  %157 = load i32, ptr %19, align 4, !tbaa !11
  %158 = icmp ne i32 %157, 0
  br i1 %158, label %159, label %161

159:                                              ; preds = %156
  %160 = load ptr, ptr %18, align 8, !tbaa !5
  call void @free(ptr noundef %160) #6
  br label %161

161:                                              ; preds = %159, %156
  %162 = load ptr, ptr %14, align 8, !tbaa !5
  %163 = icmp ne ptr %162, null
  br i1 %163, label %164, label %168

164:                                              ; preds = %161
  %165 = load ptr, ptr %7, align 8, !tbaa !5
  %166 = load ptr, ptr %14, align 8, !tbaa !5
  %167 = call i32 @rl_list_destroy(ptr noundef %165, ptr noundef %166)
  br label %168

168:                                              ; preds = %164, %161
  %169 = load ptr, ptr %15, align 8, !tbaa !5
  %170 = icmp ne ptr %169, null
  br i1 %170, label %171, label %175

171:                                              ; preds = %168
  %172 = load ptr, ptr %7, align 8, !tbaa !5
  %173 = load ptr, ptr %15, align 8, !tbaa !5
  %174 = call i32 @rl_list_node_destroy(ptr noundef %172, ptr noundef %173)
  br label %175

175:                                              ; preds = %171, %168
  %176 = load i32, ptr %19, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  ret i32 %176
}

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

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #6 = { nounwind }
attributes #7 = { 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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !10, i64 48}
!14 = !{!"rlite", !10, i64 0, !10, i64 8, !12, i64 16, !6, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !6, i64 56, !12, i64 64, !12, i64 68, !12, i64 72, !12, i64 76, !6, i64 80, !10, i64 88, !10, i64 96, !6, i64 104, !10, i64 112, !10, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152}
!15 = !{!16, !10, i64 8}
!16 = !{!"rl_list", !10, i64 0, !10, i64 8, !6, i64 16, !10, i64 24, !10, i64 32}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!7, !7, i64 0}


; 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.rl_data_type = type { ptr, ptr, ptr, ptr }
%struct.rl_list_type = type { ptr, ptr, i32, ptr }

@rl_data_type_list_long = external global %struct.rl_data_type, align 8
@rl_list_type_long = external global %struct.rl_list_type, align 8

; Function Attrs: nounwind uwtable
declare dso_local i32 @rl_normalize_string_range(i64 noundef, ptr noundef, ptr 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

declare i32 @rl_read(ptr noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

declare i32 @rl_string_get(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

declare i32 @rl_list_destroy(ptr noundef, ptr noundef) local_unnamed_addr #2

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

declare i32 @rl_list_get_element(ptr noundef, ptr noundef, ptr noundef, i64 noundef) 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 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) #4

; Function Attrs: nounwind uwtable
define dso_local i32 @rl_multi_string_getrange(ptr noundef %0, i64 noundef %1, ptr noundef writeonly %2, ptr nocapture noundef %3, i64 noundef %4, i64 noundef %5) local_unnamed_addr #0 {
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  store i64 %4, ptr %7, align 8, !tbaa !5
  store i64 %5, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #7
  %12 = call i32 @rl_read(ptr noundef %0, ptr noundef nonnull @rl_data_type_list_long, i64 noundef %1, ptr noundef nonnull @rl_list_type_long, ptr noundef nonnull %9, i32 noundef 0) #7
  %.not = icmp eq i32 %12, 2
  br i1 %.not, label %13, label %.loopexit

13:                                               ; preds = %6
  %14 = load ptr, ptr %9, align 8, !tbaa !9
  %15 = call i32 @rl_list_get_element(ptr noundef %0, ptr noundef %14, ptr noundef nonnull %10, i64 noundef 0) #7
  %.not72 = icmp eq i32 %15, 2
  br i1 %.not72, label %16, label %.loopexit

16:                                               ; preds = %13
  %17 = load ptr, ptr %10, align 8, !tbaa !9
  %18 = load i64, ptr %17, align 8, !tbaa !5
  %19 = icmp eq i64 %18, 0
  br i1 %19, label %20, label %22

20:                                               ; preds = %16
  store i64 0, ptr %3, align 8, !tbaa !5
  %.not78 = icmp eq ptr %2, null
  br i1 %.not78, label %.thread, label %21

21:                                               ; preds = %20
  store ptr null, ptr %2, align 8, !tbaa !9
  br label %.thread

22:                                               ; preds = %16
  %23 = call i32 @rl_normalize_string_range(i64 noundef %18, ptr noundef nonnull %7, ptr noundef nonnull %8)
  %24 = load i64, ptr %8, align 8, !tbaa !5
  %25 = load i64, ptr %7, align 8, !tbaa !5
  %26 = icmp slt i64 %24, %25
  br i1 %26, label %27, label %29

27:                                               ; preds = %22
  store i64 0, ptr %3, align 8, !tbaa !5
  %.not77 = icmp eq ptr %2, null
  br i1 %.not77, label %.thread, label %28

28:                                               ; preds = %27
  store ptr null, ptr %2, align 8, !tbaa !9
  br label %.thread

29:                                               ; preds = %22
  %30 = sub nsw i64 %24, %25
  %31 = add nsw i64 %30, 1
  store i64 %31, ptr %3, align 8, !tbaa !5
  %.not73 = icmp eq ptr %2, null
  br i1 %.not73, label %.thread, label %32

32:                                               ; preds = %29
  %33 = add nsw i64 %30, 2
  %34 = call noalias ptr @malloc(i64 noundef %33) #8
  %.not74 = icmp eq ptr %34, null
  br i1 %.not74, label %.thread88, label %35

35:                                               ; preds = %32
  %36 = getelementptr inbounds i8, ptr %0, i64 48
  %37 = load i64, ptr %36, align 8, !tbaa !11
  %38 = sdiv i64 %25, %37
  %39 = srem i64 %25, %37
  %40 = getelementptr inbounds i8, ptr %14, i64 8
  %.057104 = add nsw i64 %38, 1
  %41 = load i64, ptr %40, align 8, !tbaa !14
  %42 = icmp slt i64 %.057104, %41
  br i1 %42, label %.lr.ph.preheader, label %.thread.thread

.lr.ph.preheader:                                 ; preds = %35
  %43 = call i32 @rl_list_get_element(ptr noundef nonnull %0, ptr noundef nonnull %14, ptr noundef nonnull %10, i64 noundef %.057104) #7
  %.not75.peel = icmp eq i32 %43, 2
  br i1 %.not75.peel, label %44, label %.loopexit

44:                                               ; preds = %.lr.ph.preheader
  %45 = load ptr, ptr %10, align 8, !tbaa !9
  %46 = load i64, ptr %45, align 8, !tbaa !5
  %47 = call i32 @rl_string_get(ptr noundef nonnull %0, ptr noundef nonnull %11, i64 noundef %46) #7
  %.not76.peel = icmp eq i32 %47, 0
  br i1 %.not76.peel, label %48, label %.thread88

48:                                               ; preds = %44
  %49 = load i64, ptr %36, align 8, !tbaa !11
  %50 = sub nsw i64 %49, %39
  %51 = load i64, ptr %3, align 8, !tbaa !5
  %spec.select.peel = call i64 @llvm.smin.i64(i64 %50, i64 %51)
  %52 = load ptr, ptr %11, align 8, !tbaa !9
  %53 = getelementptr inbounds i8, ptr %52, i64 %39
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %34, ptr align 1 %53, i64 %spec.select.peel, i1 false)
  %.057.peel = add nsw i64 %38, 2
  %54 = load i64, ptr %40, align 8, !tbaa !14
  %55 = icmp slt i64 %.057.peel, %54
  br i1 %55, label %.lr.ph, label %.thread.thread

.lr.ph:                                           ; preds = %48, %61
  %.057107 = phi i64 [ %.057, %61 ], [ %.057.peel, %48 ]
  %.056105 = phi i64 [ %69, %61 ], [ %spec.select.peel, %48 ]
  %56 = call i32 @rl_list_get_element(ptr noundef nonnull %0, ptr noundef nonnull %14, ptr noundef nonnull %10, i64 noundef %.057107) #7
  %.not75 = icmp eq i32 %56, 2
  br i1 %.not75, label %57, label %.loopexit

57:                                               ; preds = %.lr.ph
  %58 = load ptr, ptr %10, align 8, !tbaa !9
  %59 = load i64, ptr %58, align 8, !tbaa !5
  %60 = call i32 @rl_string_get(ptr noundef %0, ptr noundef nonnull %11, i64 noundef %59) #7
  %.not76 = icmp eq i32 %60, 0
  br i1 %.not76, label %61, label %.thread88

61:                                               ; preds = %57
  %62 = load i64, ptr %36, align 8, !tbaa !11
  %63 = add nsw i64 %62, %.056105
  %64 = load i64, ptr %3, align 8, !tbaa !5
  %65 = icmp sgt i64 %63, %64
  %66 = sub nsw i64 %64, %.056105
  %spec.select = select i1 %65, i64 %66, i64 %62
  %67 = getelementptr inbounds i8, ptr %34, i64 %.056105
  %68 = load ptr, ptr %11, align 8, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %67, ptr align 1 %68, i64 %spec.select, i1 false)
  %69 = add nsw i64 %spec.select, %.056105
  %.057 = add nsw i64 %.057107, 1
  %70 = load i64, ptr %40, align 8, !tbaa !14
  %71 = icmp slt i64 %.057, %70
  br i1 %71, label %.lr.ph, label %.thread.thread, !llvm.loop !16

.thread.thread:                                   ; preds = %61, %48, %35
  %72 = phi i64 [ %31, %35 ], [ %51, %48 ], [ %64, %61 ]
  %73 = getelementptr inbounds i8, ptr %34, i64 %72
  store i8 0, ptr %73, align 1, !tbaa !19
  store ptr %34, ptr %2, align 8, !tbaa !9
  br label %74

.loopexit:                                        ; preds = %.lr.ph, %.lr.ph.preheader, %13, %6
  %.060 = phi ptr [ null, %6 ], [ %14, %13 ], [ %14, %.lr.ph.preheader ], [ %14, %.lr.ph ]
  %.059 = phi ptr [ null, %6 ], [ null, %13 ], [ %34, %.lr.ph.preheader ], [ %34, %.lr.ph ]
  %.058 = phi i32 [ %12, %6 ], [ %15, %13 ], [ %43, %.lr.ph.preheader ], [ %56, %.lr.ph ]
  %.not79 = icmp eq i32 %.058, 0
  br i1 %.not79, label %.thread, label %.thread88

.thread88:                                        ; preds = %57, %44, %32, %.loopexit
  %.05895 = phi i32 [ %.058, %.loopexit ], [ 4, %32 ], [ %47, %44 ], [ %60, %57 ]
  %.05994 = phi ptr [ %.059, %.loopexit ], [ null, %32 ], [ %34, %44 ], [ %34, %57 ]
  %.06093 = phi ptr [ %.060, %.loopexit ], [ %14, %32 ], [ %14, %44 ], [ %14, %57 ]
  call void @free(ptr noundef %.05994) #7
  br label %.thread

.thread:                                          ; preds = %29, %27, %28, %20, %21, %.thread88, %.loopexit
  %.05886 = phi i32 [ %.05895, %.thread88 ], [ 0, %.loopexit ], [ 0, %21 ], [ 0, %20 ], [ 0, %28 ], [ 0, %27 ], [ 0, %29 ]
  %.06085 = phi ptr [ %.06093, %.thread88 ], [ %.060, %.loopexit ], [ %14, %21 ], [ %14, %20 ], [ %14, %28 ], [ %14, %27 ], [ %14, %29 ]
  %.not80 = icmp eq ptr %.06085, null
  br i1 %.not80, label %76, label %74

74:                                               ; preds = %.thread.thread, %.thread
  %.06085101 = phi ptr [ %14, %.thread.thread ], [ %.06085, %.thread ]
  %.0588699 = phi i32 [ 0, %.thread.thread ], [ %.05886, %.thread ]
  %75 = call i32 @rl_list_destroy(ptr noundef %0, ptr noundef nonnull %.06085101) #7
  br label %76

76:                                               ; preds = %.thread, %74
  %.05886100 = phi i32 [ %.05886, %.thread ], [ %.0588699, %74 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #7
  ret i32 %.05886100
}

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #6

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress 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 nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
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 = !{!"long", !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 = !{!12, !6, i64 48}
!12 = !{!"rlite", !6, i64 0, !6, i64 8, !13, i64 16, !10, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !10, i64 56, !13, i64 64, !13, i64 68, !13, i64 72, !13, i64 76, !10, i64 80, !6, i64 88, !6, i64 96, !10, i64 104, !6, i64 112, !6, i64 120, !10, i64 128, !10, i64 136, !10, i64 144, !10, i64 152}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !6, i64 8}
!15 = !{!"rl_list", !6, i64 0, !6, i64 8, !10, i64 16, !6, i64 24, !6, i64 32}
!16 = distinct !{!16, !17, !18}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!"llvm.loop.peeled.count", i32 1}
!19 = !{!7, !7, i64 0}


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