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

; 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.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_file_driver = type { ptr, ptr, i32 }
%struct.rl_page = type { i64, ptr, ptr }
%struct.rl_data_type = type { ptr, ptr, ptr, 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

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

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

; Function Attrs: nounwind allocsize(1)
declare ptr @realloc(ptr noundef, i64 noundef) #4

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

14:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.rlite, ptr %15, i32 0, i32 7
  %17 = load ptr, ptr %16, align 8, !tbaa !14
  store ptr %17, ptr %8, align 8, !tbaa !5
  %18 = load ptr, ptr %8, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.rl_file_driver, ptr %18, i32 0, i32 0
  %20 = load ptr, ptr %19, align 8, !tbaa !15
  %21 = icmp ne ptr %20, null
  br i1 %21, label %22, label %37

22:                                               ; preds = %14
  %23 = load ptr, ptr %8, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.rl_file_driver, ptr %23, i32 0, i32 0
  %25 = load ptr, ptr %24, align 8, !tbaa !15
  %26 = call i32 @rl_flock(ptr noundef %25, i32 noundef 3)
  store i32 %26, ptr %6, align 4, !tbaa !9
  %27 = load i32, ptr %6, align 4, !tbaa !9
  %28 = icmp ne i32 0, %27
  br i1 %28, label %29, label %30

29:                                               ; preds = %22
  store i32 2, ptr %9, align 4
  br label %38

30:                                               ; preds = %22
  %31 = load ptr, ptr %8, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.rl_file_driver, ptr %31, i32 0, i32 0
  %33 = load ptr, ptr %32, align 8, !tbaa !15
  %34 = call i32 @fclose(ptr noundef %33)
  %35 = load ptr, ptr %8, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.rl_file_driver, ptr %35, i32 0, i32 0
  store ptr null, ptr %36, align 8, !tbaa !15
  br label %37

37:                                               ; preds = %30, %14
  store i32 0, ptr %9, align 4
  br label %38

38:                                               ; preds = %37, %29
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  %39 = load i32, ptr %9, align 4
  switch i32 %39, label %240 [
    i32 0, label %40
    i32 2, label %238
  ]

40:                                               ; preds = %38
  br label %41

41:                                               ; preds = %40, %1
  store i64 0, ptr %4, align 8, !tbaa !17
  br label %42

42:                                               ; preds = %89, %41
  %43 = load i64, ptr %4, align 8, !tbaa !17
  %44 = load ptr, ptr %3, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.rlite, ptr %44, i32 0, i32 14
  %46 = load i64, ptr %45, align 8, !tbaa !18
  %47 = icmp slt i64 %43, %46
  br i1 %47, label %48, label %92

48:                                               ; preds = %42
  %49 = load ptr, ptr %3, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.rlite, ptr %49, i32 0, i32 15
  %51 = load ptr, ptr %50, align 8, !tbaa !19
  %52 = load i64, ptr %4, align 8, !tbaa !17
  %53 = getelementptr inbounds ptr, ptr %51, i64 %52
  %54 = load ptr, ptr %53, align 8, !tbaa !5
  store ptr %54, ptr %7, align 8, !tbaa !5
  %55 = load ptr, ptr %7, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.rl_page, ptr %55, i32 0, i32 1
  %57 = load ptr, ptr %56, align 8, !tbaa !20
  %58 = icmp eq ptr %57, null
  br i1 %58, label %59, label %63

59:                                               ; preds = %48
  %60 = load ptr, ptr %7, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.rl_page, ptr %60, i32 0, i32 2
  %62 = load ptr, ptr %61, align 8, !tbaa !22
  call void @free(ptr noundef %62) #7
  br label %87

63:                                               ; preds = %48
  %64 = load ptr, ptr %7, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.rl_page, ptr %64, i32 0, i32 1
  %66 = load ptr, ptr %65, align 8, !tbaa !20
  %67 = getelementptr inbounds %struct.rl_data_type, ptr %66, i32 0, i32 3
  %68 = load ptr, ptr %67, align 8, !tbaa !23
  %69 = icmp ne ptr %68, null
  br i1 %69, label %70, label %86

70:                                               ; preds = %63
  %71 = load ptr, ptr %7, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.rl_page, ptr %71, i32 0, i32 2
  %73 = load ptr, ptr %72, align 8, !tbaa !22
  %74 = icmp ne ptr %73, null
  br i1 %74, label %75, label %86

75:                                               ; preds = %70
  %76 = load ptr, ptr %7, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.rl_page, ptr %76, i32 0, i32 1
  %78 = load ptr, ptr %77, align 8, !tbaa !20
  %79 = getelementptr inbounds %struct.rl_data_type, ptr %78, i32 0, i32 3
  %80 = load ptr, ptr %79, align 8, !tbaa !23
  %81 = load ptr, ptr %3, align 8, !tbaa !5
  %82 = load ptr, ptr %7, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.rl_page, ptr %82, i32 0, i32 2
  %84 = load ptr, ptr %83, align 8, !tbaa !22
  %85 = call i32 %80(ptr noundef %81, ptr noundef %84)
  br label %86

86:                                               ; preds = %75, %70, %63
  br label %87

87:                                               ; preds = %86, %59
  %88 = load ptr, ptr %7, align 8, !tbaa !5
  call void @free(ptr noundef %88) #7
  br label %89

89:                                               ; preds = %87
  %90 = load i64, ptr %4, align 8, !tbaa !17
  %91 = add nsw i64 %90, 1
  store i64 %91, ptr %4, align 8, !tbaa !17
  br label %42, !llvm.loop !25

92:                                               ; preds = %42
  store i64 0, ptr %4, align 8, !tbaa !17
  br label %93

93:                                               ; preds = %135, %92
  %94 = load i64, ptr %4, align 8, !tbaa !17
  %95 = load ptr, ptr %3, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.rlite, ptr %95, i32 0, i32 17
  %97 = load i64, ptr %96, align 8, !tbaa !27
  %98 = icmp slt i64 %94, %97
  br i1 %98, label %99, label %138

99:                                               ; preds = %93
  %100 = load ptr, ptr %3, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.rlite, ptr %100, i32 0, i32 18
  %102 = load ptr, ptr %101, align 8, !tbaa !28
  %103 = load i64, ptr %4, align 8, !tbaa !17
  %104 = getelementptr inbounds ptr, ptr %102, i64 %103
  %105 = load ptr, ptr %104, align 8, !tbaa !5
  store ptr %105, ptr %7, align 8, !tbaa !5
  %106 = load ptr, ptr %7, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.rl_page, ptr %106, i32 0, i32 1
  %108 = load ptr, ptr %107, align 8, !tbaa !20
  %109 = icmp ne ptr %108, null
  br i1 %109, label %110, label %133

110:                                              ; preds = %99
  %111 = load ptr, ptr %7, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.rl_page, ptr %111, i32 0, i32 1
  %113 = load ptr, ptr %112, align 8, !tbaa !20
  %114 = getelementptr inbounds %struct.rl_data_type, ptr %113, i32 0, i32 3
  %115 = load ptr, ptr %114, align 8, !tbaa !23
  %116 = icmp ne ptr %115, null
  br i1 %116, label %117, label %133

117:                                              ; preds = %110
  %118 = load ptr, ptr %7, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.rl_page, ptr %118, i32 0, i32 2
  %120 = load ptr, ptr %119, align 8, !tbaa !22
  %121 = icmp ne ptr %120, null
  br i1 %121, label %122, label %133

122:                                              ; preds = %117
  %123 = load ptr, ptr %7, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.rl_page, ptr %123, i32 0, i32 1
  %125 = load ptr, ptr %124, align 8, !tbaa !20
  %126 = getelementptr inbounds %struct.rl_data_type, ptr %125, i32 0, i32 3
  %127 = load ptr, ptr %126, align 8, !tbaa !23
  %128 = load ptr, ptr %3, align 8, !tbaa !5
  %129 = load ptr, ptr %7, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.rl_page, ptr %129, i32 0, i32 2
  %131 = load ptr, ptr %130, align 8, !tbaa !22
  %132 = call i32 %127(ptr noundef %128, ptr noundef %131)
  br label %133

133:                                              ; preds = %122, %117, %110, %99
  %134 = load ptr, ptr %7, align 8, !tbaa !5
  call void @free(ptr noundef %134) #7
  br label %135

135:                                              ; preds = %133
  %136 = load i64, ptr %4, align 8, !tbaa !17
  %137 = add nsw i64 %136, 1
  store i64 %137, ptr %4, align 8, !tbaa !17
  br label %93, !llvm.loop !29

138:                                              ; preds = %93
  %139 = load ptr, ptr %3, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.rlite, ptr %139, i32 0, i32 14
  store i64 0, ptr %140, align 8, !tbaa !18
  %141 = load ptr, ptr %3, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.rlite, ptr %141, i32 0, i32 17
  store i64 0, ptr %142, align 8, !tbaa !27
  %143 = load ptr, ptr %3, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.rlite, ptr %143, i32 0, i32 0
  %145 = load i64, ptr %144, align 8, !tbaa !30
  %146 = load ptr, ptr %3, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.rlite, ptr %146, i32 0, i32 5
  store i64 %145, ptr %147, align 8, !tbaa !31
  %148 = load ptr, ptr %3, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct.rlite, ptr %148, i32 0, i32 1
  %150 = load i64, ptr %149, align 8, !tbaa !32
  %151 = load ptr, ptr %3, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.rlite, ptr %151, i32 0, i32 4
  store i64 %150, ptr %152, align 8, !tbaa !33
  %153 = load ptr, ptr %3, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.rlite, ptr %153, i32 0, i32 2
  %155 = load i32, ptr %154, align 8, !tbaa !34
  %156 = load ptr, ptr %3, align 8, !tbaa !5
  %157 = getelementptr inbounds %struct.rlite, ptr %156, i32 0, i32 11
  store i32 %155, ptr %157, align 4, !tbaa !35
  %158 = load ptr, ptr %3, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.rlite, ptr %158, i32 0, i32 12
  %160 = load ptr, ptr %159, align 8, !tbaa !36
  call void @free(ptr noundef %160) #7
  %161 = load ptr, ptr %3, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.rlite, ptr %161, i32 0, i32 11
  %163 = load i32, ptr %162, align 4, !tbaa !35
  %164 = add nsw i32 %163, 6
  %165 = sext i32 %164 to i64
  %166 = mul i64 8, %165
  %167 = call noalias ptr @malloc(i64 noundef %166) #8
  %168 = load ptr, ptr %3, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct.rlite, ptr %168, i32 0, i32 12
  store ptr %167, ptr %169, align 8, !tbaa !36
  %170 = load ptr, ptr %3, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.rlite, ptr %170, i32 0, i32 12
  %172 = load ptr, ptr %171, align 8, !tbaa !36
  %173 = icmp ne ptr %172, null
  br i1 %173, label %175, label %174

174:                                              ; preds = %138
  store i32 4, ptr %6, align 4, !tbaa !9
  br label %238

175:                                              ; preds = %138
  %176 = load ptr, ptr %3, align 8, !tbaa !5
  %177 = getelementptr inbounds %struct.rlite, ptr %176, i32 0, i32 3
  %178 = load ptr, ptr %177, align 8, !tbaa !37
  %179 = icmp ne ptr %178, null
  br i1 %179, label %180, label %193

180:                                              ; preds = %175
  %181 = load ptr, ptr %3, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.rlite, ptr %181, i32 0, i32 12
  %183 = load ptr, ptr %182, align 8, !tbaa !36
  %184 = load ptr, ptr %3, align 8, !tbaa !5
  %185 = getelementptr inbounds %struct.rlite, ptr %184, i32 0, i32 3
  %186 = load ptr, ptr %185, align 8, !tbaa !37
  %187 = load ptr, ptr %3, align 8, !tbaa !5
  %188 = getelementptr inbounds %struct.rlite, ptr %187, i32 0, i32 11
  %189 = load i32, ptr %188, align 4, !tbaa !35
  %190 = add nsw i32 %189, 6
  %191 = sext i32 %190 to i64
  %192 = mul i64 8, %191
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %183, ptr align 8 %186, i64 %192, i1 false)
  br label %193

193:                                              ; preds = %180, %175
  %194 = load ptr, ptr %3, align 8, !tbaa !5
  %195 = getelementptr inbounds %struct.rlite, ptr %194, i32 0, i32 13
  %196 = load i64, ptr %195, align 8, !tbaa !38
  %197 = icmp ne i64 %196, 16
  br i1 %197, label %198, label %212

198:                                              ; preds = %193
  %199 = load ptr, ptr %3, align 8, !tbaa !5
  %200 = getelementptr inbounds %struct.rlite, ptr %199, i32 0, i32 15
  %201 = load ptr, ptr %200, align 8, !tbaa !19
  %202 = call ptr @realloc(ptr noundef %201, i64 noundef 128) #9
  store ptr %202, ptr %5, align 8, !tbaa !5
  %203 = load ptr, ptr %5, align 8, !tbaa !5
  %204 = icmp ne ptr %203, null
  br i1 %204, label %206, label %205

205:                                              ; preds = %198
  store i32 4, ptr %6, align 4, !tbaa !9
  br label %238

206:                                              ; preds = %198
  %207 = load ptr, ptr %5, align 8, !tbaa !5
  %208 = load ptr, ptr %3, align 8, !tbaa !5
  %209 = getelementptr inbounds %struct.rlite, ptr %208, i32 0, i32 15
  store ptr %207, ptr %209, align 8, !tbaa !19
  %210 = load ptr, ptr %3, align 8, !tbaa !5
  %211 = getelementptr inbounds %struct.rlite, ptr %210, i32 0, i32 13
  store i64 16, ptr %211, align 8, !tbaa !38
  br label %212

212:                                              ; preds = %206, %193
  %213 = load ptr, ptr %3, align 8, !tbaa !5
  %214 = getelementptr inbounds %struct.rlite, ptr %213, i32 0, i32 16
  %215 = load i64, ptr %214, align 8, !tbaa !39
  %216 = icmp sgt i64 %215, 0
  br i1 %216, label %217, label %237

217:                                              ; preds = %212
  %218 = load ptr, ptr %3, align 8, !tbaa !5
  %219 = getelementptr inbounds %struct.rlite, ptr %218, i32 0, i32 16
  %220 = load i64, ptr %219, align 8, !tbaa !39
  %221 = icmp ne i64 %220, 8
  br i1 %221, label %222, label %236

222:                                              ; preds = %217
  %223 = load ptr, ptr %3, align 8, !tbaa !5
  %224 = getelementptr inbounds %struct.rlite, ptr %223, i32 0, i32 16
  store i64 8, ptr %224, align 8, !tbaa !39
  %225 = load ptr, ptr %3, align 8, !tbaa !5
  %226 = getelementptr inbounds %struct.rlite, ptr %225, i32 0, i32 18
  %227 = load ptr, ptr %226, align 8, !tbaa !28
  %228 = call ptr @realloc(ptr noundef %227, i64 noundef 64) #9
  store ptr %228, ptr %5, align 8, !tbaa !5
  %229 = load ptr, ptr %5, align 8, !tbaa !5
  %230 = icmp ne ptr %229, null
  br i1 %230, label %232, label %231

231:                                              ; preds = %222
  store i32 4, ptr %6, align 4, !tbaa !9
  br label %238

232:                                              ; preds = %222
  %233 = load ptr, ptr %5, align 8, !tbaa !5
  %234 = load ptr, ptr %3, align 8, !tbaa !5
  %235 = getelementptr inbounds %struct.rlite, ptr %234, i32 0, i32 18
  store ptr %233, ptr %235, align 8, !tbaa !28
  br label %236

236:                                              ; preds = %232, %217
  br label %237

237:                                              ; preds = %236, %212
  br label %238

238:                                              ; preds = %237, %231, %205, %174, %38
  %239 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %239, ptr %2, align 4
  store i32 1, ptr %9, align 4
  br label %240

240:                                              ; preds = %238, %38
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  %241 = load i32, ptr %2, align 4
  ret i32 %241
}

declare i32 @rl_flock(ptr noundef, i32 noundef) #6

declare i32 @fclose(ptr noundef) #6

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind allocsize(0) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind allocsize(1) "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 = { "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 = { nounwind }
attributes #8 = { nounwind allocsize(0) }
attributes #9 = { nounwind allocsize(1) }

!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 = !{!12, !10, i64 64}
!12 = !{!"rlite", !13, i64 0, !13, i64 8, !10, i64 16, !6, i64 24, !13, i64 32, !13, i64 40, !13, i64 48, !6, i64 56, !10, i64 64, !10, i64 68, !10, i64 72, !10, i64 76, !6, i64 80, !13, i64 88, !13, i64 96, !6, i64 104, !13, i64 112, !13, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152}
!13 = !{!"long", !7, i64 0}
!14 = !{!12, !6, i64 56}
!15 = !{!16, !6, i64 0}
!16 = !{!"", !6, i64 0, !6, i64 8, !10, i64 16}
!17 = !{!13, !13, i64 0}
!18 = !{!12, !13, i64 96}
!19 = !{!12, !6, i64 104}
!20 = !{!21, !6, i64 8}
!21 = !{!"", !13, i64 0, !6, i64 8, !6, i64 16}
!22 = !{!21, !6, i64 16}
!23 = !{!24, !6, i64 24}
!24 = !{!"rl_data_type", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}
!27 = !{!12, !13, i64 120}
!28 = !{!12, !6, i64 128}
!29 = distinct !{!29, !26}
!30 = !{!12, !13, i64 0}
!31 = !{!12, !13, i64 40}
!32 = !{!12, !13, i64 8}
!33 = !{!12, !13, i64 32}
!34 = !{!12, !10, i64 16}
!35 = !{!12, !10, i64 76}
!36 = !{!12, !6, i64 80}
!37 = !{!12, !6, i64 24}
!38 = !{!12, !13, i64 88}
!39 = !{!12, !13, i64 112}


; 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #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 nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias noundef ptr @realloc(ptr allocptr nocapture noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local i32 @rl_discard(ptr noundef %0) local_unnamed_addr #4 {
  %2 = getelementptr inbounds i8, ptr %0, i64 64
  %3 = load i32, ptr %2, align 8, !tbaa !5
  %4 = icmp eq i32 %3, 1
  br i1 %4, label %5, label %.thread

5:                                                ; preds = %1
  %6 = getelementptr inbounds i8, ptr %0, i64 56
  %7 = load ptr, ptr %6, align 8, !tbaa !12
  %8 = load ptr, ptr %7, align 8, !tbaa !13
  %.not = icmp eq ptr %8, null
  br i1 %.not, label %.thread, label %9

9:                                                ; preds = %5
  %10 = tail call i32 @rl_flock(ptr noundef nonnull %8, i32 noundef 3) #7
  %.not81 = icmp eq i32 %10, 0
  br i1 %.not81, label %11, label %96

11:                                               ; preds = %9
  %12 = load ptr, ptr %7, align 8, !tbaa !13
  %13 = tail call i32 @fclose(ptr noundef %12)
  store ptr null, ptr %7, align 8, !tbaa !13
  br label %.thread

.thread:                                          ; preds = %5, %11, %1
  %14 = getelementptr inbounds i8, ptr %0, i64 96
  %15 = load i64, ptr %14, align 8, !tbaa !15
  %16 = icmp sgt i64 %15, 0
  br i1 %16, label %.lr.ph, label %.preheader

.lr.ph:                                           ; preds = %.thread
  %17 = getelementptr inbounds i8, ptr %0, i64 104
  br label %22

.preheader:                                       ; preds = %40, %.thread
  %18 = getelementptr inbounds i8, ptr %0, i64 120
  %19 = load i64, ptr %18, align 8, !tbaa !16
  %20 = icmp sgt i64 %19, 0
  br i1 %20, label %.lr.ph100, label %._crit_edge

.lr.ph100:                                        ; preds = %.preheader
  %21 = getelementptr inbounds i8, ptr %0, i64 128
  br label %44

22:                                               ; preds = %.lr.ph, %40
  %.06598 = phi i64 [ 0, %.lr.ph ], [ %41, %40 ]
  %23 = load ptr, ptr %17, align 8, !tbaa !17
  %24 = getelementptr inbounds ptr, ptr %23, i64 %.06598
  %25 = load ptr, ptr %24, align 8, !tbaa !18
  %26 = getelementptr inbounds i8, ptr %25, i64 8
  %27 = load ptr, ptr %26, align 8, !tbaa !19
  %28 = icmp eq ptr %27, null
  br i1 %28, label %29, label %32

29:                                               ; preds = %22
  %30 = getelementptr inbounds i8, ptr %25, i64 16
  %31 = load ptr, ptr %30, align 8, !tbaa !21
  tail call void @free(ptr noundef %31) #7
  br label %40

32:                                               ; preds = %22
  %33 = getelementptr inbounds i8, ptr %27, i64 24
  %34 = load ptr, ptr %33, align 8, !tbaa !22
  %.not91 = icmp eq ptr %34, null
  br i1 %.not91, label %40, label %35

35:                                               ; preds = %32
  %36 = getelementptr inbounds i8, ptr %25, i64 16
  %37 = load ptr, ptr %36, align 8, !tbaa !21
  %.not92 = icmp eq ptr %37, null
  br i1 %.not92, label %40, label %38

38:                                               ; preds = %35
  %39 = tail call i32 %34(ptr noundef nonnull %0, ptr noundef nonnull %37) #7
  br label %40

40:                                               ; preds = %32, %35, %38, %29
  tail call void @free(ptr noundef nonnull %25) #7
  %41 = add nuw nsw i64 %.06598, 1
  %42 = load i64, ptr %14, align 8, !tbaa !15
  %43 = icmp slt i64 %41, %42
  br i1 %43, label %22, label %.preheader, !llvm.loop !24

44:                                               ; preds = %.lr.ph100, %58
  %.16699 = phi i64 [ 0, %.lr.ph100 ], [ %59, %58 ]
  %45 = load ptr, ptr %21, align 8, !tbaa !26
  %46 = getelementptr inbounds ptr, ptr %45, i64 %.16699
  %47 = load ptr, ptr %46, align 8, !tbaa !18
  %48 = getelementptr inbounds i8, ptr %47, i64 8
  %49 = load ptr, ptr %48, align 8, !tbaa !19
  %.not88 = icmp eq ptr %49, null
  br i1 %.not88, label %58, label %50

50:                                               ; preds = %44
  %51 = getelementptr inbounds i8, ptr %49, i64 24
  %52 = load ptr, ptr %51, align 8, !tbaa !22
  %.not89 = icmp eq ptr %52, null
  br i1 %.not89, label %58, label %53

53:                                               ; preds = %50
  %54 = getelementptr inbounds i8, ptr %47, i64 16
  %55 = load ptr, ptr %54, align 8, !tbaa !21
  %.not90 = icmp eq ptr %55, null
  br i1 %.not90, label %58, label %56

56:                                               ; preds = %53
  %57 = tail call i32 %52(ptr noundef nonnull %0, ptr noundef nonnull %55) #7
  br label %58

58:                                               ; preds = %56, %53, %50, %44
  tail call void @free(ptr noundef nonnull %47) #7
  %59 = add nuw nsw i64 %.16699, 1
  %60 = load i64, ptr %18, align 8, !tbaa !16
  %61 = icmp slt i64 %59, %60
  br i1 %61, label %44, label %._crit_edge, !llvm.loop !27

._crit_edge:                                      ; preds = %58, %.preheader
  store i64 0, ptr %14, align 8, !tbaa !15
  store i64 0, ptr %18, align 8, !tbaa !16
  %62 = getelementptr inbounds i8, ptr %0, i64 32
  %63 = load <2 x i64>, ptr %0, align 8, !tbaa !28
  %64 = shufflevector <2 x i64> %63, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
  store <2 x i64> %64, ptr %62, align 8, !tbaa !28
  %65 = getelementptr inbounds i8, ptr %0, i64 16
  %66 = load i32, ptr %65, align 8, !tbaa !29
  %67 = getelementptr inbounds i8, ptr %0, i64 76
  store i32 %66, ptr %67, align 4, !tbaa !30
  %68 = getelementptr inbounds i8, ptr %0, i64 80
  %69 = load ptr, ptr %68, align 8, !tbaa !31
  tail call void @free(ptr noundef %69) #7
  %70 = load i32, ptr %67, align 4, !tbaa !30
  %71 = add nsw i32 %70, 6
  %72 = sext i32 %71 to i64
  %73 = shl nsw i64 %72, 3
  %74 = tail call noalias ptr @malloc(i64 noundef %73) #8
  store ptr %74, ptr %68, align 8, !tbaa !31
  %.not82 = icmp eq ptr %74, null
  br i1 %.not82, label %96, label %75

75:                                               ; preds = %._crit_edge
  %76 = getelementptr inbounds i8, ptr %0, i64 24
  %77 = load ptr, ptr %76, align 8, !tbaa !32
  %.not83 = icmp eq ptr %77, null
  br i1 %.not83, label %79, label %78

78:                                               ; preds = %75
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 8 %74, ptr nonnull align 8 %77, i64 %73, i1 false)
  br label %79

79:                                               ; preds = %78, %75
  %80 = getelementptr inbounds i8, ptr %0, i64 88
  %81 = load i64, ptr %80, align 8, !tbaa !33
  %.not84 = icmp eq i64 %81, 16
  br i1 %.not84, label %87, label %82

82:                                               ; preds = %79
  %83 = getelementptr inbounds i8, ptr %0, i64 104
  %84 = load ptr, ptr %83, align 8, !tbaa !17
  %85 = tail call dereferenceable_or_null(128) ptr @realloc(ptr noundef %84, i64 noundef 128) #9
  %.not85 = icmp eq ptr %85, null
  br i1 %.not85, label %96, label %86

86:                                               ; preds = %82
  store ptr %85, ptr %83, align 8, !tbaa !17
  store i64 16, ptr %80, align 8, !tbaa !33
  br label %87

87:                                               ; preds = %86, %79
  %88 = getelementptr inbounds i8, ptr %0, i64 112
  %89 = load i64, ptr %88, align 8, !tbaa !34
  %90 = icmp slt i64 %89, 1
  %.not86 = icmp eq i64 %89, 8
  %or.cond = or i1 %90, %.not86
  br i1 %or.cond, label %96, label %91

91:                                               ; preds = %87
  store i64 8, ptr %88, align 8, !tbaa !34
  %92 = getelementptr inbounds i8, ptr %0, i64 128
  %93 = load ptr, ptr %92, align 8, !tbaa !26
  %94 = tail call dereferenceable_or_null(64) ptr @realloc(ptr noundef %93, i64 noundef 64) #9
  %.not87 = icmp eq ptr %94, null
  br i1 %.not87, label %96, label %95

95:                                               ; preds = %91
  store ptr %94, ptr %92, align 8, !tbaa !26
  br label %96

96:                                               ; preds = %9, %95, %87, %._crit_edge, %82, %91
  %.3 = phi i32 [ 0, %95 ], [ 0, %87 ], [ 4, %._crit_edge ], [ 4, %82 ], [ 4, %91 ], [ %10, %9 ]
  ret i32 %.3
}

declare i32 @rl_flock(ptr noundef, i32 noundef) local_unnamed_addr #5

; Function Attrs: nofree nounwind
declare noundef i32 @fclose(ptr nocapture noundef) local_unnamed_addr #6

attributes #0 = { mustprogress nocallback nofree 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 nounwind willreturn allockind("realloc") allocsize(1) 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 #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 = { "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 = { 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 #7 = { nounwind }
attributes #8 = { nounwind allocsize(0) }
attributes #9 = { nounwind allocsize(1) }

!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, !10, i64 64}
!6 = !{!"rlite", !7, i64 0, !7, i64 8, !10, i64 16, !11, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !11, i64 56, !10, i64 64, !10, i64 68, !10, i64 72, !10, i64 76, !11, i64 80, !7, i64 88, !7, i64 96, !11, i64 104, !7, i64 112, !7, i64 120, !11, i64 128, !11, i64 136, !11, i64 144, !11, i64 152}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!6, !11, i64 56}
!13 = !{!14, !11, i64 0}
!14 = !{!"", !11, i64 0, !11, i64 8, !10, i64 16}
!15 = !{!6, !7, i64 96}
!16 = !{!6, !7, i64 120}
!17 = !{!6, !11, i64 104}
!18 = !{!11, !11, i64 0}
!19 = !{!20, !11, i64 8}
!20 = !{!"", !7, i64 0, !11, i64 8, !11, i64 16}
!21 = !{!20, !11, i64 16}
!22 = !{!23, !11, i64 24}
!23 = !{!"rl_data_type", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = !{!6, !11, i64 128}
!27 = distinct !{!27, !25}
!28 = !{!7, !7, i64 0}
!29 = !{!6, !10, i64 16}
!30 = !{!6, !10, i64 76}
!31 = !{!6, !11, i64 80}
!32 = !{!6, !11, i64 24}
!33 = !{!6, !7, i64 88}
!34 = !{!6, !7, i64 112}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass