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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @rl_list_iterator_next(ptr noundef %0, ptr noundef %1) #2 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %10 = load ptr, ptr %4, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.rl_list_iterator, ptr %10, i32 0, i32 2
  %12 = load ptr, ptr %11, align 8, !tbaa !9
  %13 = icmp eq ptr %12, null
  br i1 %13, label %14, label %15

14:                                               ; preds = %2
  store i32 9, ptr %6, align 4, !tbaa !13
  br label %169

15:                                               ; preds = %2
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = icmp ne ptr %16, null
  br i1 %17, label %18, label %54

18:                                               ; preds = %15
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.rl_list_iterator, ptr %19, i32 0, i32 1
  %21 = load ptr, ptr %20, align 8, !tbaa !14
  %22 = getelementptr inbounds %struct.rl_list, ptr %21, i32 0, i32 2
  %23 = load ptr, ptr %22, align 8, !tbaa !15
  %24 = getelementptr inbounds %struct.rl_list_type, ptr %23, i32 0, i32 2
  %25 = load i32, ptr %24, align 8, !tbaa !17
  %26 = sext i32 %25 to i64
  %27 = call noalias ptr @malloc(i64 noundef %26) #6
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %27, ptr %28, align 8, !tbaa !5
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = load ptr, ptr %29, align 8, !tbaa !5
  %31 = icmp ne ptr %30, null
  br i1 %31, label %33, label %32

32:                                               ; preds = %18
  store i32 4, ptr %6, align 4, !tbaa !13
  br label %169

33:                                               ; preds = %18
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  %35 = load ptr, ptr %34, align 8, !tbaa !5
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.rl_list_iterator, ptr %36, i32 0, i32 2
  %38 = load ptr, ptr %37, align 8, !tbaa !9
  %39 = getelementptr inbounds %struct.rl_list_node, ptr %38, i32 0, i32 3
  %40 = load ptr, ptr %39, align 8, !tbaa !19
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.rl_list_iterator, ptr %41, i32 0, i32 4
  %43 = load i64, ptr %42, align 8, !tbaa !21
  %44 = getelementptr inbounds ptr, ptr %40, i64 %43
  %45 = load ptr, ptr %44, align 8, !tbaa !5
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.rl_list_iterator, ptr %46, i32 0, i32 1
  %48 = load ptr, ptr %47, align 8, !tbaa !14
  %49 = getelementptr inbounds %struct.rl_list, ptr %48, i32 0, i32 2
  %50 = load ptr, ptr %49, align 8, !tbaa !15
  %51 = getelementptr inbounds %struct.rl_list_type, ptr %50, i32 0, i32 2
  %52 = load i32, ptr %51, align 8, !tbaa !17
  %53 = sext i32 %52 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %35, ptr align 1 %45, i64 %53, i1 false)
  br label %54

54:                                               ; preds = %33, %15
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.rl_list_iterator, ptr %55, i32 0, i32 3
  %57 = load i32, ptr %56, align 8, !tbaa !22
  %58 = sext i32 %57 to i64
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.rl_list_iterator, ptr %59, i32 0, i32 4
  %61 = load i64, ptr %60, align 8, !tbaa !21
  %62 = add nsw i64 %61, %58
  store i64 %62, ptr %60, align 8, !tbaa !21
  %63 = load ptr, ptr %4, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.rl_list_iterator, ptr %63, i32 0, i32 4
  %65 = load i64, ptr %64, align 8, !tbaa !21
  %66 = icmp slt i64 %65, 0
  br i1 %66, label %77, label %67

67:                                               ; preds = %54
  %68 = load ptr, ptr %4, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.rl_list_iterator, ptr %68, i32 0, i32 4
  %70 = load i64, ptr %69, align 8, !tbaa !21
  %71 = load ptr, ptr %4, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.rl_list_iterator, ptr %71, i32 0, i32 2
  %73 = load ptr, ptr %72, align 8, !tbaa !9
  %74 = getelementptr inbounds %struct.rl_list_node, ptr %73, i32 0, i32 0
  %75 = load i64, ptr %74, align 8, !tbaa !23
  %76 = icmp eq i64 %70, %75
  br i1 %76, label %77, label %157

77:                                               ; preds = %67, %54
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %78 = load ptr, ptr %4, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.rl_list_iterator, ptr %78, i32 0, i32 3
  %80 = load i32, ptr %79, align 8, !tbaa !22
  %81 = icmp eq i32 %80, 1
  br i1 %81, label %82, label %88

82:                                               ; preds = %77
  %83 = load ptr, ptr %4, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.rl_list_iterator, ptr %83, i32 0, i32 2
  %85 = load ptr, ptr %84, align 8, !tbaa !9
  %86 = getelementptr inbounds %struct.rl_list_node, ptr %85, i32 0, i32 2
  %87 = load i64, ptr %86, align 8, !tbaa !24
  br label %94

88:                                               ; preds = %77
  %89 = load ptr, ptr %4, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.rl_list_iterator, ptr %89, i32 0, i32 2
  %91 = load ptr, ptr %90, align 8, !tbaa !9
  %92 = getelementptr inbounds %struct.rl_list_node, ptr %91, i32 0, i32 1
  %93 = load i64, ptr %92, align 8, !tbaa !25
  br label %94

94:                                               ; preds = %88, %82
  %95 = phi i64 [ %87, %82 ], [ %93, %88 ]
  store i64 %95, ptr %7, align 8, !tbaa !26
  %96 = load ptr, ptr %4, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.rl_list_iterator, ptr %96, i32 0, i32 0
  %98 = load ptr, ptr %97, align 8, !tbaa !27
  %99 = load ptr, ptr %4, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.rl_list_iterator, ptr %99, i32 0, i32 2
  %101 = load ptr, ptr %100, align 8, !tbaa !9
  %102 = call i32 @rl_list_node_destroy(ptr noundef %98, ptr noundef %101)
  store i32 %102, ptr %6, align 4, !tbaa !13
  %103 = load i32, ptr %6, align 4, !tbaa !13
  %104 = icmp ne i32 0, %103
  br i1 %104, label %105, label %106

105:                                              ; preds = %94
  store i32 2, ptr %9, align 4
  br label %154

106:                                              ; preds = %94
  %107 = load ptr, ptr %4, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.rl_list_iterator, ptr %107, i32 0, i32 2
  store ptr null, ptr %108, align 8, !tbaa !9
  %109 = load i64, ptr %7, align 8, !tbaa !26
  %110 = icmp ne i64 %109, 0
  br i1 %110, label %111, label %153

111:                                              ; preds = %106
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %112 = load ptr, ptr %4, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.rl_list_iterator, ptr %112, i32 0, i32 0
  %114 = load ptr, ptr %113, align 8, !tbaa !27
  %115 = load ptr, ptr %4, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.rl_list_iterator, ptr %115, i32 0, i32 1
  %117 = load ptr, ptr %116, align 8, !tbaa !14
  %118 = getelementptr inbounds %struct.rl_list, ptr %117, i32 0, i32 2
  %119 = load ptr, ptr %118, align 8, !tbaa !15
  %120 = getelementptr inbounds %struct.rl_list_type, ptr %119, i32 0, i32 1
  %121 = load ptr, ptr %120, align 8, !tbaa !28
  %122 = load i64, ptr %7, align 8, !tbaa !26
  %123 = load ptr, ptr %4, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.rl_list_iterator, ptr %123, i32 0, i32 1
  %125 = load ptr, ptr %124, align 8, !tbaa !14
  %126 = call i32 @rl_read(ptr noundef %114, ptr noundef %121, i64 noundef %122, ptr noundef %125, ptr noundef %8, i32 noundef 0)
  store i32 %126, ptr %6, align 4, !tbaa !13
  %127 = load i32, ptr %6, align 4, !tbaa !13
  %128 = icmp ne i32 2, %127
  br i1 %128, label %129, label %130

129:                                              ; preds = %111
  store i32 2, ptr %9, align 4
  br label %150

130:                                              ; preds = %111
  %131 = load ptr, ptr %8, align 8, !tbaa !5
  %132 = load ptr, ptr %4, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.rl_list_iterator, ptr %132, i32 0, i32 2
  store ptr %131, ptr %133, align 8, !tbaa !9
  %134 = load ptr, ptr %4, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.rl_list_iterator, ptr %134, i32 0, i32 3
  %136 = load i32, ptr %135, align 8, !tbaa !22
  %137 = icmp eq i32 %136, 1
  br i1 %137, label %138, label %139

138:                                              ; preds = %130
  br label %146

139:                                              ; preds = %130
  %140 = load ptr, ptr %4, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.rl_list_iterator, ptr %140, i32 0, i32 2
  %142 = load ptr, ptr %141, align 8, !tbaa !9
  %143 = getelementptr inbounds %struct.rl_list_node, ptr %142, i32 0, i32 0
  %144 = load i64, ptr %143, align 8, !tbaa !23
  %145 = sub nsw i64 %144, 1
  br label %146

146:                                              ; preds = %139, %138
  %147 = phi i64 [ 0, %138 ], [ %145, %139 ]
  %148 = load ptr, ptr %4, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct.rl_list_iterator, ptr %148, i32 0, i32 4
  store i64 %147, ptr %149, align 8, !tbaa !21
  store i32 0, ptr %9, align 4
  br label %150

150:                                              ; preds = %146, %129
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  %151 = load i32, ptr %9, align 4
  switch i32 %151, label %154 [
    i32 0, label %152
  ]

152:                                              ; preds = %150
  br label %153

153:                                              ; preds = %152, %106
  store i32 0, ptr %9, align 4
  br label %154

154:                                              ; preds = %153, %150, %105
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  %155 = load i32, ptr %9, align 4
  switch i32 %155, label %180 [
    i32 0, label %156
    i32 2, label %169
  ]

156:                                              ; preds = %154
  br label %157

157:                                              ; preds = %156, %67
  %158 = load ptr, ptr %4, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.rl_list_iterator, ptr %158, i32 0, i32 2
  %160 = load ptr, ptr %159, align 8, !tbaa !9
  %161 = icmp ne ptr %160, null
  br i1 %161, label %162, label %168

162:                                              ; preds = %157
  %163 = load ptr, ptr %4, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct.rl_list_iterator, ptr %163, i32 0, i32 4
  %165 = load i64, ptr %164, align 8, !tbaa !21
  %166 = icmp slt i64 %165, -1
  br i1 %166, label %167, label %168

167:                                              ; preds = %162
  store i32 6, ptr %6, align 4, !tbaa !13
  br label %169

168:                                              ; preds = %162, %157
  store i32 0, ptr %6, align 4, !tbaa !13
  br label %169

169:                                              ; preds = %168, %167, %154, %32, %14
  %170 = load i32, ptr %6, align 4, !tbaa !13
  %171 = icmp ne i32 %170, 0
  br i1 %171, label %172, label %178

172:                                              ; preds = %169
  %173 = load ptr, ptr %4, align 8, !tbaa !5
  %174 = getelementptr inbounds %struct.rl_list_iterator, ptr %173, i32 0, i32 0
  %175 = load ptr, ptr %174, align 8, !tbaa !27
  %176 = load ptr, ptr %4, align 8, !tbaa !5
  %177 = call i32 @rl_list_iterator_destroy(ptr noundef %175, ptr noundef %176)
  br label %178

178:                                              ; preds = %172, %169
  %179 = load i32, ptr %6, align 4, !tbaa !13
  store i32 %179, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %180

180:                                              ; preds = %178, %154
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  %181 = load i32, ptr %3, align 4
  ret i32 %181
}

; Function Attrs: nounwind uwtable
declare dso_local i32 @rl_list_iterator_destroy(ptr noundef, ptr 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) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { "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 }
attributes #6 = { 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, !6, i64 16}
!10 = !{!"rl_list_iterator", !6, i64 0, !6, i64 8, !6, i64 16, !11, i64 24, !12, i64 32}
!11 = !{!"int", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!11, !11, i64 0}
!14 = !{!10, !6, i64 8}
!15 = !{!16, !6, i64 16}
!16 = !{!"rl_list", !12, i64 0, !12, i64 8, !6, i64 16, !12, i64 24, !12, i64 32}
!17 = !{!18, !11, i64 16}
!18 = !{!"", !6, i64 0, !6, i64 8, !11, i64 16, !6, i64 24}
!19 = !{!20, !6, i64 24}
!20 = !{!"rl_list_node", !12, i64 0, !12, i64 8, !12, i64 16, !6, i64 24}
!21 = !{!10, !12, i64 32}
!22 = !{!10, !11, i64 24}
!23 = !{!20, !12, i64 0}
!24 = !{!20, !12, i64 16}
!25 = !{!20, !12, i64 8}
!26 = !{!12, !12, i64 0}
!27 = !{!10, !6, i64 0}
!28 = !{!18, !6, i64 8}


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

; 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 nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #1

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @rl_list_iterator_next(ptr noundef %0, ptr noundef writeonly %1) local_unnamed_addr #2 {
  %3 = alloca ptr, align 8
  %4 = getelementptr inbounds i8, ptr %0, i64 16
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  %6 = icmp eq ptr %5, null
  br i1 %6, label %.thread62, label %7

7:                                                ; preds = %2
  %.not = icmp eq ptr %1, null
  br i1 %.not, label %._crit_edge, label %8

._crit_edge:                                      ; preds = %7
  %.phi.trans.insert = getelementptr inbounds i8, ptr %0, i64 32
  %.pre = load i64, ptr %.phi.trans.insert, align 8, !tbaa !12
  br label %31

8:                                                ; preds = %7
  %9 = getelementptr inbounds i8, ptr %0, i64 8
  %10 = load ptr, ptr %9, align 8, !tbaa !13
  %11 = getelementptr inbounds i8, ptr %10, i64 16
  %12 = load ptr, ptr %11, align 8, !tbaa !14
  %13 = getelementptr inbounds i8, ptr %12, i64 16
  %14 = load i32, ptr %13, align 8, !tbaa !16
  %15 = sext i32 %14 to i64
  %16 = tail call noalias ptr @malloc(i64 noundef %15) #5
  store ptr %16, ptr %1, align 8, !tbaa !18
  %.not48 = icmp eq ptr %16, null
  br i1 %.not48, label %.thread62, label %17

17:                                               ; preds = %8
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds i8, ptr %18, i64 24
  %20 = load ptr, ptr %19, align 8, !tbaa !19
  %21 = getelementptr inbounds i8, ptr %0, i64 32
  %22 = load i64, ptr %21, align 8, !tbaa !12
  %23 = getelementptr inbounds ptr, ptr %20, i64 %22
  %24 = load ptr, ptr %23, align 8, !tbaa !18
  %25 = load ptr, ptr %9, align 8, !tbaa !13
  %26 = getelementptr inbounds i8, ptr %25, i64 16
  %27 = load ptr, ptr %26, align 8, !tbaa !14
  %28 = getelementptr inbounds i8, ptr %27, i64 16
  %29 = load i32, ptr %28, align 8, !tbaa !16
  %30 = sext i32 %29 to i64
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %16, ptr align 1 %24, i64 %30, i1 false)
  br label %31

31:                                               ; preds = %._crit_edge, %17
  %32 = phi ptr [ %5, %._crit_edge ], [ %18, %17 ]
  %33 = phi i64 [ %.pre, %._crit_edge ], [ %22, %17 ]
  %34 = getelementptr inbounds i8, ptr %0, i64 24
  %35 = load i32, ptr %34, align 8, !tbaa !21
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds i8, ptr %0, i64 32
  %38 = add nsw i64 %33, %36
  store i64 %38, ptr %37, align 8, !tbaa !12
  %39 = icmp slt i64 %38, 0
  br i1 %39, label %43, label %40

40:                                               ; preds = %31
  %41 = load i64, ptr %32, align 8, !tbaa !22
  %42 = icmp eq i64 %38, %41
  br i1 %42, label %43, label %.thread66

43:                                               ; preds = %40, %31
  %44 = icmp eq i32 %35, 1
  %. = select i1 %44, i64 16, i64 8
  %45 = getelementptr inbounds i8, ptr %32, i64 %.
  %46 = load i64, ptr %45, align 8, !tbaa !23
  %47 = load ptr, ptr %0, align 8, !tbaa !24
  %48 = tail call i32 @rl_list_node_destroy(ptr noundef %47, ptr noundef nonnull %32)
  %.not49 = icmp eq i32 %48, 0
  br i1 %.not49, label %49, label %.thread62

49:                                               ; preds = %43
  store ptr null, ptr %4, align 8, !tbaa !5
  %.not50 = icmp eq i64 %46, 0
  br i1 %.not50, label %.thread66, label %50

50:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  %51 = load ptr, ptr %0, align 8, !tbaa !24
  %52 = getelementptr inbounds i8, ptr %0, i64 8
  %53 = load ptr, ptr %52, align 8, !tbaa !13
  %54 = getelementptr inbounds i8, ptr %53, i64 16
  %55 = load ptr, ptr %54, align 8, !tbaa !14
  %56 = getelementptr inbounds i8, ptr %55, i64 8
  %57 = load ptr, ptr %56, align 8, !tbaa !25
  %58 = call i32 @rl_read(ptr noundef %51, ptr noundef %57, i64 noundef %46, ptr noundef %53, ptr noundef nonnull %3, i32 noundef 0) #6
  %.not51 = icmp eq i32 %58, 2
  br i1 %.not51, label %59, label %66

59:                                               ; preds = %50
  %60 = load ptr, ptr %3, align 8, !tbaa !18
  store ptr %60, ptr %4, align 8, !tbaa !5
  %61 = load i32, ptr %34, align 8, !tbaa !21
  %62 = icmp eq i32 %61, 1
  br i1 %62, label %.thread, label %.thread59

.thread:                                          ; preds = %59
  store i64 0, ptr %37, align 8, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  br label %.thread66

.thread59:                                        ; preds = %59
  %63 = load i64, ptr %60, align 8, !tbaa !22
  %64 = add nsw i64 %63, -1
  store i64 %64, ptr %37, align 8, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  %65 = icmp slt i64 %63, 0
  br i1 %65, label %.thread62, label %.thread66

66:                                               ; preds = %50
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  %.not53 = icmp eq i32 %58, 0
  br i1 %.not53, label %.thread66, label %.thread62

.thread62:                                        ; preds = %43, %.thread59, %8, %2, %66
  %.265 = phi i32 [ %58, %66 ], [ 6, %.thread59 ], [ 4, %8 ], [ 9, %2 ], [ %48, %43 ]
  %67 = load ptr, ptr %0, align 8, !tbaa !24
  %68 = call i32 @rl_list_iterator_destroy(ptr noundef %67, ptr noundef nonnull %0)
  br label %.thread66

.thread66:                                        ; preds = %.thread, %40, %49, %.thread59, %66, %.thread62
  %.039 = phi i32 [ %.265, %.thread62 ], [ 0, %66 ], [ 0, %.thread59 ], [ 0, %49 ], [ 0, %.thread ], [ 0, %40 ]
  ret i32 %.039
}

; Function Attrs: nounwind uwtable
declare dso_local i32 @rl_list_iterator_destroy(ptr noundef, ptr 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) #4

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { "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 = { nounwind allocsize(0) }
attributes #6 = { 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, !7, i64 16}
!6 = !{!"rl_list_iterator", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24, !11, i64 32}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"long", !8, i64 0}
!12 = !{!6, !11, i64 32}
!13 = !{!6, !7, i64 8}
!14 = !{!15, !7, i64 16}
!15 = !{!"rl_list", !11, i64 0, !11, i64 8, !7, i64 16, !11, i64 24, !11, i64 32}
!16 = !{!17, !10, i64 16}
!17 = !{!"", !7, i64 0, !7, i64 8, !10, i64 16, !7, i64 24}
!18 = !{!7, !7, i64 0}
!19 = !{!20, !7, i64 24}
!20 = !{!"rl_list_node", !11, i64 0, !11, i64 8, !11, i64 16, !7, i64 24}
!21 = !{!6, !10, i64 24}
!22 = !{!20, !11, i64 0}
!23 = !{!11, !11, i64 0}
!24 = !{!6, !7, i64 0}
!25 = !{!17, !7, i64 8}


; Effective O3 passes: ADCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass