; LLVM IR from theck01/offbrand_lib :: src/classes (obdeque)

; 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.obdeque_struct = type { ptr, ptr, ptr, i64 }
%struct.obdeque_node_struct = 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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind uwtable
define dso_local void @obdeque_recursive_sort(ptr dead_on_unwind noalias writable sret(%struct.obdeque_struct) align 8 %0, ptr noundef byval(%struct.obdeque_struct) align 8 %1, i8 noundef signext %2, ptr noundef %3) #1 {
  %5 = alloca i8, align 1
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca %struct.obdeque_struct, align 8
  %10 = alloca %struct.obdeque_struct, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca %struct.obdeque_struct, align 8
  %14 = alloca %struct.obdeque_struct, align 8
  store i8 %2, ptr %5, align 1, !tbaa !5
  store ptr %3, ptr %6, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 32, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 32, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %15 = getelementptr inbounds %struct.obdeque_struct, ptr %1, i32 0, i32 3
  %16 = load i64, ptr %15, align 8, !tbaa !10
  %17 = icmp ult i64 %16, 2
  br i1 %17, label %18, label %19

18:                                               ; preds = %4
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %0, ptr align 8 %1, i64 32, i1 false), !tbaa.struct !13
  store i32 1, ptr %12, align 4
  br label %207

19:                                               ; preds = %4
  %20 = getelementptr inbounds %struct.obdeque_struct, ptr %1, i32 0, i32 3
  %21 = load i64, ptr %20, align 8, !tbaa !10
  %22 = udiv i64 %21, 2
  store i64 %22, ptr %8, align 8, !tbaa !14
  %23 = getelementptr inbounds %struct.obdeque_struct, ptr %1, i32 0, i32 1
  %24 = load ptr, ptr %23, align 8, !tbaa !15
  %25 = getelementptr inbounds %struct.obdeque_struct, ptr %9, i32 0, i32 1
  store ptr %24, ptr %25, align 8, !tbaa !15
  %26 = getelementptr inbounds %struct.obdeque_struct, ptr %1, i32 0, i32 1
  %27 = load ptr, ptr %26, align 8, !tbaa !15
  %28 = getelementptr inbounds %struct.obdeque_struct, ptr %9, i32 0, i32 2
  store ptr %27, ptr %28, align 8, !tbaa !16
  store i64 1, ptr %7, align 8, !tbaa !14
  br label %29

29:                                               ; preds = %39, %19
  %30 = load i64, ptr %7, align 8, !tbaa !14
  %31 = load i64, ptr %8, align 8, !tbaa !14
  %32 = icmp ult i64 %30, %31
  br i1 %32, label %33, label %42

33:                                               ; preds = %29
  %34 = getelementptr inbounds %struct.obdeque_struct, ptr %9, i32 0, i32 2
  %35 = load ptr, ptr %34, align 8, !tbaa !16
  %36 = getelementptr inbounds %struct.obdeque_node_struct, ptr %35, i32 0, i32 2
  %37 = load ptr, ptr %36, align 8, !tbaa !17
  %38 = getelementptr inbounds %struct.obdeque_struct, ptr %9, i32 0, i32 2
  store ptr %37, ptr %38, align 8, !tbaa !16
  br label %39

39:                                               ; preds = %33
  %40 = load i64, ptr %7, align 8, !tbaa !14
  %41 = add i64 %40, 1
  store i64 %41, ptr %7, align 8, !tbaa !14
  br label %29, !llvm.loop !19

42:                                               ; preds = %29
  %43 = getelementptr inbounds %struct.obdeque_struct, ptr %9, i32 0, i32 2
  %44 = load ptr, ptr %43, align 8, !tbaa !16
  %45 = getelementptr inbounds %struct.obdeque_node_struct, ptr %44, i32 0, i32 2
  %46 = load ptr, ptr %45, align 8, !tbaa !17
  %47 = getelementptr inbounds %struct.obdeque_struct, ptr %10, i32 0, i32 1
  store ptr %46, ptr %47, align 8, !tbaa !15
  %48 = getelementptr inbounds %struct.obdeque_struct, ptr %1, i32 0, i32 2
  %49 = load ptr, ptr %48, align 8, !tbaa !16
  %50 = getelementptr inbounds %struct.obdeque_struct, ptr %10, i32 0, i32 2
  store ptr %49, ptr %50, align 8, !tbaa !16
  %51 = getelementptr inbounds %struct.obdeque_struct, ptr %10, i32 0, i32 1
  %52 = load ptr, ptr %51, align 8, !tbaa !15
  %53 = getelementptr inbounds %struct.obdeque_node_struct, ptr %52, i32 0, i32 3
  store ptr null, ptr %53, align 8, !tbaa !21
  %54 = getelementptr inbounds %struct.obdeque_struct, ptr %9, i32 0, i32 2
  %55 = load ptr, ptr %54, align 8, !tbaa !16
  %56 = getelementptr inbounds %struct.obdeque_node_struct, ptr %55, i32 0, i32 2
  store ptr null, ptr %56, align 8, !tbaa !17
  %57 = load i64, ptr %8, align 8, !tbaa !14
  %58 = getelementptr inbounds %struct.obdeque_struct, ptr %9, i32 0, i32 3
  store i64 %57, ptr %58, align 8, !tbaa !10
  %59 = getelementptr inbounds %struct.obdeque_struct, ptr %1, i32 0, i32 3
  %60 = load i64, ptr %59, align 8, !tbaa !10
  %61 = load i64, ptr %8, align 8, !tbaa !14
  %62 = sub i64 %60, %61
  %63 = getelementptr inbounds %struct.obdeque_struct, ptr %10, i32 0, i32 3
  store i64 %62, ptr %63, align 8, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 32, ptr %13) #3
  %64 = load i8, ptr %5, align 1, !tbaa !5
  %65 = load ptr, ptr %6, align 8, !tbaa !8
  call void @obdeque_recursive_sort(ptr dead_on_unwind writable sret(%struct.obdeque_struct) align 8 %13, ptr noundef byval(%struct.obdeque_struct) align 8 %10, i8 noundef signext %64, ptr noundef %65)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %10, ptr align 8 %13, i64 32, i1 false), !tbaa.struct !13
  call void @llvm.lifetime.end.p0(i64 32, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 32, ptr %14) #3
  %66 = load i8, ptr %5, align 1, !tbaa !5
  %67 = load ptr, ptr %6, align 8, !tbaa !8
  call void @obdeque_recursive_sort(ptr dead_on_unwind writable sret(%struct.obdeque_struct) align 8 %14, ptr noundef byval(%struct.obdeque_struct) align 8 %9, i8 noundef signext %66, ptr noundef %67)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %9, ptr align 8 %14, i64 32, i1 false), !tbaa.struct !13
  call void @llvm.lifetime.end.p0(i64 32, ptr %14) #3
  %68 = load ptr, ptr %6, align 8, !tbaa !8
  %69 = getelementptr inbounds %struct.obdeque_struct, ptr %10, i32 0, i32 1
  %70 = load ptr, ptr %69, align 8, !tbaa !15
  %71 = getelementptr inbounds %struct.obdeque_node_struct, ptr %70, i32 0, i32 1
  %72 = load ptr, ptr %71, align 8, !tbaa !22
  %73 = getelementptr inbounds %struct.obdeque_struct, ptr %9, i32 0, i32 1
  %74 = load ptr, ptr %73, align 8, !tbaa !15
  %75 = getelementptr inbounds %struct.obdeque_node_struct, ptr %74, i32 0, i32 1
  %76 = load ptr, ptr %75, align 8, !tbaa !22
  %77 = call signext i8 %68(ptr noundef %72, ptr noundef %76)
  %78 = sext i8 %77 to i32
  %79 = load i8, ptr %5, align 1, !tbaa !5
  %80 = sext i8 %79 to i32
  %81 = icmp eq i32 %78, %80
  br i1 %81, label %82, label %91

82:                                               ; preds = %42
  %83 = getelementptr inbounds %struct.obdeque_struct, ptr %10, i32 0, i32 1
  %84 = load ptr, ptr %83, align 8, !tbaa !15
  %85 = getelementptr inbounds %struct.obdeque_struct, ptr %1, i32 0, i32 1
  store ptr %84, ptr %85, align 8, !tbaa !15
  %86 = getelementptr inbounds %struct.obdeque_struct, ptr %10, i32 0, i32 1
  %87 = load ptr, ptr %86, align 8, !tbaa !15
  %88 = getelementptr inbounds %struct.obdeque_node_struct, ptr %87, i32 0, i32 2
  %89 = load ptr, ptr %88, align 8, !tbaa !17
  %90 = getelementptr inbounds %struct.obdeque_struct, ptr %10, i32 0, i32 1
  store ptr %89, ptr %90, align 8, !tbaa !15
  br label %100

91:                                               ; preds = %42
  %92 = getelementptr inbounds %struct.obdeque_struct, ptr %9, i32 0, i32 1
  %93 = load ptr, ptr %92, align 8, !tbaa !15
  %94 = getelementptr inbounds %struct.obdeque_struct, ptr %1, i32 0, i32 1
  store ptr %93, ptr %94, align 8, !tbaa !15
  %95 = getelementptr inbounds %struct.obdeque_struct, ptr %9, i32 0, i32 1
  %96 = load ptr, ptr %95, align 8, !tbaa !15
  %97 = getelementptr inbounds %struct.obdeque_node_struct, ptr %96, i32 0, i32 2
  %98 = load ptr, ptr %97, align 8, !tbaa !17
  %99 = getelementptr inbounds %struct.obdeque_struct, ptr %9, i32 0, i32 1
  store ptr %98, ptr %99, align 8, !tbaa !15
  br label %100

100:                                              ; preds = %91, %82
  %101 = getelementptr inbounds %struct.obdeque_struct, ptr %1, i32 0, i32 1
  %102 = load ptr, ptr %101, align 8, !tbaa !15
  store ptr %102, ptr %11, align 8, !tbaa !8
  br label %103

103:                                              ; preds = %156, %100
  %104 = getelementptr inbounds %struct.obdeque_struct, ptr %10, i32 0, i32 1
  %105 = load ptr, ptr %104, align 8, !tbaa !15
  %106 = icmp ne ptr %105, null
  br i1 %106, label %107, label %111

107:                                              ; preds = %103
  %108 = getelementptr inbounds %struct.obdeque_struct, ptr %9, i32 0, i32 1
  %109 = load ptr, ptr %108, align 8, !tbaa !15
  %110 = icmp ne ptr %109, null
  br label %111

111:                                              ; preds = %107, %103
  %112 = phi i1 [ false, %103 ], [ %110, %107 ]
  br i1 %112, label %113, label %160

113:                                              ; preds = %111
  %114 = load ptr, ptr %6, align 8, !tbaa !8
  %115 = getelementptr inbounds %struct.obdeque_struct, ptr %10, i32 0, i32 1
  %116 = load ptr, ptr %115, align 8, !tbaa !15
  %117 = getelementptr inbounds %struct.obdeque_node_struct, ptr %116, i32 0, i32 1
  %118 = load ptr, ptr %117, align 8, !tbaa !22
  %119 = getelementptr inbounds %struct.obdeque_struct, ptr %9, i32 0, i32 1
  %120 = load ptr, ptr %119, align 8, !tbaa !15
  %121 = getelementptr inbounds %struct.obdeque_node_struct, ptr %120, i32 0, i32 1
  %122 = load ptr, ptr %121, align 8, !tbaa !22
  %123 = call signext i8 %114(ptr noundef %118, ptr noundef %122)
  %124 = sext i8 %123 to i32
  %125 = load i8, ptr %5, align 1, !tbaa !5
  %126 = sext i8 %125 to i32
  %127 = icmp eq i32 %124, %126
  br i1 %127, label %128, label %142

128:                                              ; preds = %113
  %129 = getelementptr inbounds %struct.obdeque_struct, ptr %10, i32 0, i32 1
  %130 = load ptr, ptr %129, align 8, !tbaa !15
  %131 = load ptr, ptr %11, align 8, !tbaa !8
  %132 = getelementptr inbounds %struct.obdeque_node_struct, ptr %131, i32 0, i32 2
  store ptr %130, ptr %132, align 8, !tbaa !17
  %133 = load ptr, ptr %11, align 8, !tbaa !8
  %134 = getelementptr inbounds %struct.obdeque_struct, ptr %10, i32 0, i32 1
  %135 = load ptr, ptr %134, align 8, !tbaa !15
  %136 = getelementptr inbounds %struct.obdeque_node_struct, ptr %135, i32 0, i32 3
  store ptr %133, ptr %136, align 8, !tbaa !21
  %137 = getelementptr inbounds %struct.obdeque_struct, ptr %10, i32 0, i32 1
  %138 = load ptr, ptr %137, align 8, !tbaa !15
  %139 = getelementptr inbounds %struct.obdeque_node_struct, ptr %138, i32 0, i32 2
  %140 = load ptr, ptr %139, align 8, !tbaa !17
  %141 = getelementptr inbounds %struct.obdeque_struct, ptr %10, i32 0, i32 1
  store ptr %140, ptr %141, align 8, !tbaa !15
  br label %156

142:                                              ; preds = %113
  %143 = getelementptr inbounds %struct.obdeque_struct, ptr %9, i32 0, i32 1
  %144 = load ptr, ptr %143, align 8, !tbaa !15
  %145 = load ptr, ptr %11, align 8, !tbaa !8
  %146 = getelementptr inbounds %struct.obdeque_node_struct, ptr %145, i32 0, i32 2
  store ptr %144, ptr %146, align 8, !tbaa !17
  %147 = load ptr, ptr %11, align 8, !tbaa !8
  %148 = getelementptr inbounds %struct.obdeque_struct, ptr %9, i32 0, i32 1
  %149 = load ptr, ptr %148, align 8, !tbaa !15
  %150 = getelementptr inbounds %struct.obdeque_node_struct, ptr %149, i32 0, i32 3
  store ptr %147, ptr %150, align 8, !tbaa !21
  %151 = getelementptr inbounds %struct.obdeque_struct, ptr %9, i32 0, i32 1
  %152 = load ptr, ptr %151, align 8, !tbaa !15
  %153 = getelementptr inbounds %struct.obdeque_node_struct, ptr %152, i32 0, i32 2
  %154 = load ptr, ptr %153, align 8, !tbaa !17
  %155 = getelementptr inbounds %struct.obdeque_struct, ptr %9, i32 0, i32 1
  store ptr %154, ptr %155, align 8, !tbaa !15
  br label %156

156:                                              ; preds = %142, %128
  %157 = load ptr, ptr %11, align 8, !tbaa !8
  %158 = getelementptr inbounds %struct.obdeque_node_struct, ptr %157, i32 0, i32 2
  %159 = load ptr, ptr %158, align 8, !tbaa !17
  store ptr %159, ptr %11, align 8, !tbaa !8
  br label %103, !llvm.loop !23

160:                                              ; preds = %111
  br label %161

161:                                              ; preds = %165, %160
  %162 = getelementptr inbounds %struct.obdeque_struct, ptr %10, i32 0, i32 1
  %163 = load ptr, ptr %162, align 8, !tbaa !15
  %164 = icmp ne ptr %163, null
  br i1 %164, label %165, label %182

165:                                              ; preds = %161
  %166 = getelementptr inbounds %struct.obdeque_struct, ptr %10, i32 0, i32 1
  %167 = load ptr, ptr %166, align 8, !tbaa !15
  %168 = load ptr, ptr %11, align 8, !tbaa !8
  %169 = getelementptr inbounds %struct.obdeque_node_struct, ptr %168, i32 0, i32 2
  store ptr %167, ptr %169, align 8, !tbaa !17
  %170 = load ptr, ptr %11, align 8, !tbaa !8
  %171 = getelementptr inbounds %struct.obdeque_struct, ptr %10, i32 0, i32 1
  %172 = load ptr, ptr %171, align 8, !tbaa !15
  %173 = getelementptr inbounds %struct.obdeque_node_struct, ptr %172, i32 0, i32 3
  store ptr %170, ptr %173, align 8, !tbaa !21
  %174 = getelementptr inbounds %struct.obdeque_struct, ptr %10, i32 0, i32 1
  %175 = load ptr, ptr %174, align 8, !tbaa !15
  %176 = getelementptr inbounds %struct.obdeque_node_struct, ptr %175, i32 0, i32 2
  %177 = load ptr, ptr %176, align 8, !tbaa !17
  %178 = getelementptr inbounds %struct.obdeque_struct, ptr %10, i32 0, i32 1
  store ptr %177, ptr %178, align 8, !tbaa !15
  %179 = load ptr, ptr %11, align 8, !tbaa !8
  %180 = getelementptr inbounds %struct.obdeque_node_struct, ptr %179, i32 0, i32 2
  %181 = load ptr, ptr %180, align 8, !tbaa !17
  store ptr %181, ptr %11, align 8, !tbaa !8
  br label %161, !llvm.loop !24

182:                                              ; preds = %161
  br label %183

183:                                              ; preds = %187, %182
  %184 = getelementptr inbounds %struct.obdeque_struct, ptr %9, i32 0, i32 1
  %185 = load ptr, ptr %184, align 8, !tbaa !15
  %186 = icmp ne ptr %185, null
  br i1 %186, label %187, label %204

187:                                              ; preds = %183
  %188 = getelementptr inbounds %struct.obdeque_struct, ptr %9, i32 0, i32 1
  %189 = load ptr, ptr %188, align 8, !tbaa !15
  %190 = load ptr, ptr %11, align 8, !tbaa !8
  %191 = getelementptr inbounds %struct.obdeque_node_struct, ptr %190, i32 0, i32 2
  store ptr %189, ptr %191, align 8, !tbaa !17
  %192 = load ptr, ptr %11, align 8, !tbaa !8
  %193 = getelementptr inbounds %struct.obdeque_struct, ptr %9, i32 0, i32 1
  %194 = load ptr, ptr %193, align 8, !tbaa !15
  %195 = getelementptr inbounds %struct.obdeque_node_struct, ptr %194, i32 0, i32 3
  store ptr %192, ptr %195, align 8, !tbaa !21
  %196 = getelementptr inbounds %struct.obdeque_struct, ptr %9, i32 0, i32 1
  %197 = load ptr, ptr %196, align 8, !tbaa !15
  %198 = getelementptr inbounds %struct.obdeque_node_struct, ptr %197, i32 0, i32 2
  %199 = load ptr, ptr %198, align 8, !tbaa !17
  %200 = getelementptr inbounds %struct.obdeque_struct, ptr %9, i32 0, i32 1
  store ptr %199, ptr %200, align 8, !tbaa !15
  %201 = load ptr, ptr %11, align 8, !tbaa !8
  %202 = getelementptr inbounds %struct.obdeque_node_struct, ptr %201, i32 0, i32 2
  %203 = load ptr, ptr %202, align 8, !tbaa !17
  store ptr %203, ptr %11, align 8, !tbaa !8
  br label %183, !llvm.loop !25

204:                                              ; preds = %183
  %205 = load ptr, ptr %11, align 8, !tbaa !8
  %206 = getelementptr inbounds %struct.obdeque_struct, ptr %1, i32 0, i32 2
  store ptr %205, ptr %206, align 8, !tbaa !16
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %0, ptr align 8 %1, i64 32, i1 false), !tbaa.struct !13
  store i32 1, ptr %12, align 4
  br label %207

207:                                              ; preds = %204, %18
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  ret void
}

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !6, i64 0}
!10 = !{!11, !12, i64 24}
!11 = !{!"obdeque_struct", !9, i64 0, !9, i64 8, !9, i64 16, !12, i64 24}
!12 = !{!"long", !6, i64 0}
!13 = !{i64 0, i64 8, !8, i64 8, i64 8, !8, i64 16, i64 8, !8, i64 24, i64 8, !14}
!14 = !{!12, !12, i64 0}
!15 = !{!11, !9, i64 8}
!16 = !{!11, !9, i64 16}
!17 = !{!18, !9, i64 16}
!18 = !{!"obdeque_node_struct", !9, i64 0, !9, i64 8, !9, i64 16, !9, i64 24}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!18, !9, i64 24}
!22 = !{!18, !9, i64 8}
!23 = distinct !{!23, !20}
!24 = distinct !{!24, !20}
!25 = distinct !{!25, !20}


; 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.obdeque_struct = type { ptr, ptr, ptr, i64 }

; 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: nounwind uwtable
define dso_local void @obdeque_recursive_sort(ptr dead_on_unwind noalias nocapture writable writeonly sret(%struct.obdeque_struct) align 8 %0, ptr nocapture noundef byval(%struct.obdeque_struct) align 8 %1, i8 noundef signext %2, ptr noundef %3) local_unnamed_addr #1 {
  %5 = alloca %struct.obdeque_struct, align 8
  %6 = alloca %struct.obdeque_struct, align 8
  %7 = alloca %struct.obdeque_struct, align 8
  %8 = alloca %struct.obdeque_struct, align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #3
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %6) #3
  %9 = getelementptr inbounds i8, ptr %1, i64 24
  %10 = load i64, ptr %9, align 8, !tbaa !5
  %11 = icmp ult i64 %10, 2
  br i1 %11, label %104, label %12

12:                                               ; preds = %4
  %13 = lshr i64 %10, 1
  %14 = getelementptr inbounds i8, ptr %1, i64 8
  %15 = load ptr, ptr %14, align 8, !tbaa !11
  %16 = getelementptr inbounds i8, ptr %5, i64 8
  store ptr %15, ptr %16, align 8, !tbaa !11
  %17 = getelementptr inbounds i8, ptr %5, i64 16
  %18 = icmp ugt i64 %10, 3
  br i1 %18, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %12
  %19 = add nsw i64 %13, -1
  %20 = add nsw i64 %13, -2
  %xtraiter = and i64 %19, 7
  %21 = icmp ult i64 %20, 7
  br i1 %21, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.preheader.new

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %unroll_iter = and i64 %19, -8
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader.new
  %22 = phi ptr [ %15, %.lr.ph.preheader.new ], [ %38, %.lr.ph ]
  %niter = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter.next.7, %.lr.ph ]
  %23 = getelementptr inbounds i8, ptr %22, i64 16
  %24 = load ptr, ptr %23, align 8, !tbaa !12
  %25 = getelementptr inbounds i8, ptr %24, i64 16
  %26 = load ptr, ptr %25, align 8, !tbaa !12
  %27 = getelementptr inbounds i8, ptr %26, i64 16
  %28 = load ptr, ptr %27, align 8, !tbaa !12
  %29 = getelementptr inbounds i8, ptr %28, i64 16
  %30 = load ptr, ptr %29, align 8, !tbaa !12
  %31 = getelementptr inbounds i8, ptr %30, i64 16
  %32 = load ptr, ptr %31, align 8, !tbaa !12
  %33 = getelementptr inbounds i8, ptr %32, i64 16
  %34 = load ptr, ptr %33, align 8, !tbaa !12
  %35 = getelementptr inbounds i8, ptr %34, i64 16
  %36 = load ptr, ptr %35, align 8, !tbaa !12
  %37 = getelementptr inbounds i8, ptr %36, i64 16
  %38 = load ptr, ptr %37, align 8, !tbaa !12
  %niter.next.7 = add i64 %niter, 8
  %niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
  br i1 %niter.ncmp.7, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph, !llvm.loop !14

._crit_edge.loopexit.unr-lcssa:                   ; preds = %.lr.ph, %.lr.ph.preheader
  %.lcssa84.ph = phi ptr [ poison, %.lr.ph.preheader ], [ %38, %.lr.ph ]
  %.unr = phi ptr [ %15, %.lr.ph.preheader ], [ %38, %.lr.ph ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph.epil
  %39 = phi ptr [ %41, %.lr.ph.epil ], [ %.unr, %._crit_edge.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph.epil ], [ 0, %._crit_edge.loopexit.unr-lcssa ]
  %40 = getelementptr inbounds i8, ptr %39, i64 16
  %41 = load ptr, ptr %40, align 8, !tbaa !12
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge, label %.lr.ph.epil, !llvm.loop !16

._crit_edge:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph.epil, %12
  %.lcssa32 = phi ptr [ %15, %12 ], [ %.lcssa84.ph, %._crit_edge.loopexit.unr-lcssa ], [ %41, %.lr.ph.epil ]
  store ptr %.lcssa32, ptr %17, align 8, !tbaa !18
  %42 = getelementptr inbounds i8, ptr %.lcssa32, i64 16
  %43 = load ptr, ptr %42, align 8, !tbaa !12
  %44 = getelementptr inbounds i8, ptr %6, i64 8
  store ptr %43, ptr %44, align 8, !tbaa !11
  %45 = getelementptr inbounds i8, ptr %1, i64 16
  %46 = load ptr, ptr %45, align 8, !tbaa !18
  %47 = getelementptr inbounds i8, ptr %6, i64 16
  store ptr %46, ptr %47, align 8, !tbaa !18
  %48 = getelementptr inbounds i8, ptr %43, i64 24
  store ptr null, ptr %48, align 8, !tbaa !19
  store ptr null, ptr %42, align 8, !tbaa !12
  %49 = getelementptr inbounds i8, ptr %5, i64 24
  store i64 %13, ptr %49, align 8, !tbaa !5
  %50 = sub i64 %10, %13
  %51 = getelementptr inbounds i8, ptr %6, i64 24
  store i64 %50, ptr %51, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %7) #3
  call void @obdeque_recursive_sort(ptr dead_on_unwind nonnull writable sret(%struct.obdeque_struct) align 8 %7, ptr noundef nonnull byval(%struct.obdeque_struct) align 8 %6, i8 noundef signext %2, ptr noundef %3)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(32) %6, ptr noundef nonnull align 8 dereferenceable(32) %7, i64 32, i1 false), !tbaa.struct !20
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #3
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %8) #3
  call void @obdeque_recursive_sort(ptr dead_on_unwind nonnull writable sret(%struct.obdeque_struct) align 8 %8, ptr noundef nonnull byval(%struct.obdeque_struct) align 8 %5, i8 noundef signext %2, ptr noundef %3)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(32) %5, ptr noundef nonnull align 8 dereferenceable(32) %8, i64 32, i1 false), !tbaa.struct !20
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #3
  %52 = load ptr, ptr %44, align 8, !tbaa !11
  %53 = getelementptr inbounds i8, ptr %52, i64 8
  %54 = load ptr, ptr %53, align 8, !tbaa !23
  %55 = load ptr, ptr %16, align 8
  %56 = getelementptr inbounds i8, ptr %55, i64 8
  %57 = load ptr, ptr %56, align 8, !tbaa !23
  %58 = tail call signext i8 %3(ptr noundef %54, ptr noundef %57) #3
  %59 = icmp eq i8 %58, %2
  br i1 %59, label %60, label %63

60:                                               ; preds = %._crit_edge
  %61 = getelementptr inbounds i8, ptr %52, i64 16
  %62 = load ptr, ptr %61, align 8, !tbaa !12
  br label %66

63:                                               ; preds = %._crit_edge
  %64 = getelementptr inbounds i8, ptr %55, i64 16
  %65 = load ptr, ptr %64, align 8, !tbaa !12
  br label %66

66:                                               ; preds = %63, %60
  %.promoted36 = phi ptr [ %55, %60 ], [ %65, %63 ]
  %.promoted34 = phi ptr [ %62, %60 ], [ %52, %63 ]
  %.sink = phi ptr [ %52, %60 ], [ %55, %63 ]
  store ptr %.sink, ptr %14, align 8
  %67 = icmp ne ptr %.promoted34, null
  %68 = icmp ne ptr %.promoted36, null
  %69 = select i1 %67, i1 %68, i1 false
  br i1 %69, label %.lr.ph41, label %.preheader

.preheader:                                       ; preds = %87, %66
  %.pr = phi ptr [ %.promoted36, %66 ], [ %88, %87 ]
  %.lcssa35 = phi ptr [ %.promoted34, %66 ], [ %89, %87 ]
  %.0.lcssa = phi ptr [ %.sink, %66 ], [ %.0, %87 ]
  %.not48 = icmp eq ptr %.lcssa35, null
  br i1 %.not48, label %thread-pre-split, label %.lr.ph50

.lr.ph41:                                         ; preds = %66, %87
  %.039 = phi ptr [ %.0, %87 ], [ %.sink, %66 ]
  %70 = phi ptr [ %89, %87 ], [ %.promoted34, %66 ]
  %71 = phi ptr [ %88, %87 ], [ %.promoted36, %66 ]
  %72 = getelementptr inbounds i8, ptr %70, i64 8
  %73 = load ptr, ptr %72, align 8, !tbaa !23
  %74 = getelementptr inbounds i8, ptr %71, i64 8
  %75 = load ptr, ptr %74, align 8, !tbaa !23
  %76 = tail call signext i8 %3(ptr noundef %73, ptr noundef %75) #3
  %77 = icmp eq i8 %76, %2
  %78 = getelementptr inbounds i8, ptr %.039, i64 16
  br i1 %77, label %79, label %83

79:                                               ; preds = %.lr.ph41
  store ptr %70, ptr %78, align 8, !tbaa !12
  %80 = getelementptr inbounds i8, ptr %70, i64 24
  store ptr %.039, ptr %80, align 8, !tbaa !19
  %81 = getelementptr inbounds i8, ptr %70, i64 16
  %82 = load ptr, ptr %81, align 8, !tbaa !12
  br label %87

83:                                               ; preds = %.lr.ph41
  store ptr %71, ptr %78, align 8, !tbaa !12
  %84 = getelementptr inbounds i8, ptr %71, i64 24
  store ptr %.039, ptr %84, align 8, !tbaa !19
  %85 = getelementptr inbounds i8, ptr %71, i64 16
  %86 = load ptr, ptr %85, align 8, !tbaa !12
  br label %87

87:                                               ; preds = %83, %79
  %88 = phi ptr [ %86, %83 ], [ %71, %79 ]
  %89 = phi ptr [ %70, %83 ], [ %82, %79 ]
  %90 = getelementptr inbounds i8, ptr %.039, i64 16
  %.0 = load ptr, ptr %90, align 8, !tbaa !21
  %91 = icmp ne ptr %89, null
  %92 = icmp ne ptr %88, null
  %93 = select i1 %91, i1 %92, i1 false
  br i1 %93, label %.lr.ph41, label %.preheader, !llvm.loop !24

.lr.ph50:                                         ; preds = %.preheader, %.lr.ph50
  %.149 = phi ptr [ %94, %.lr.ph50 ], [ %.0.lcssa, %.preheader ]
  %94 = phi ptr [ %98, %.lr.ph50 ], [ %.lcssa35, %.preheader ]
  %95 = getelementptr inbounds i8, ptr %.149, i64 16
  store ptr %94, ptr %95, align 8, !tbaa !12
  %96 = getelementptr inbounds i8, ptr %94, i64 24
  store ptr %.149, ptr %96, align 8, !tbaa !19
  %97 = getelementptr inbounds i8, ptr %94, i64 16
  %98 = load ptr, ptr %97, align 8, !tbaa !12
  %.not = icmp eq ptr %98, null
  br i1 %.not, label %thread-pre-split, label %.lr.ph50, !llvm.loop !25

thread-pre-split:                                 ; preds = %.lr.ph50, %.preheader
  %.1.lcssa = phi ptr [ %.0.lcssa, %.preheader ], [ %94, %.lr.ph50 ]
  %.not3155 = icmp eq ptr %.pr, null
  br i1 %.not3155, label %._crit_edge58, label %.lr.ph57

.lr.ph57:                                         ; preds = %thread-pre-split, %.lr.ph57
  %.256 = phi ptr [ %99, %.lr.ph57 ], [ %.1.lcssa, %thread-pre-split ]
  %99 = phi ptr [ %103, %.lr.ph57 ], [ %.pr, %thread-pre-split ]
  %100 = getelementptr inbounds i8, ptr %.256, i64 16
  store ptr %99, ptr %100, align 8, !tbaa !12
  %101 = getelementptr inbounds i8, ptr %99, i64 24
  store ptr %.256, ptr %101, align 8, !tbaa !19
  %102 = getelementptr inbounds i8, ptr %99, i64 16
  %103 = load ptr, ptr %102, align 8, !tbaa !12
  %.not31 = icmp eq ptr %103, null
  br i1 %.not31, label %._crit_edge58, label %.lr.ph57, !llvm.loop !26

._crit_edge58:                                    ; preds = %.lr.ph57, %thread-pre-split
  %.2.lcssa = phi ptr [ %.1.lcssa, %thread-pre-split ], [ %99, %.lr.ph57 ]
  store ptr %.2.lcssa, ptr %45, align 8, !tbaa !18
  br label %104

104:                                              ; preds = %4, %._crit_edge58
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(32) %1, i64 32, i1 false)
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #3
  ret void
}

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

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


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