; LLVM IR from OpenDiS/OpenDiS :: core/pydis/c/util (Util_subset)

; 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._node = type { i32, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, %struct._tag, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, ptr, ptr, i32 }
%struct._tag = type { i32, i32 }

; 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 @ReallocNodeArms(ptr noundef %0, i32 noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  %7 = load ptr, ptr %3, align 8, !tbaa !5
  %8 = getelementptr inbounds %struct._node, ptr %7, i32 0, i32 20
  %9 = load i32, ptr %8, align 8, !tbaa !11
  store i32 %9, ptr %6, align 4, !tbaa !9
  %10 = load i32, ptr %4, align 4, !tbaa !9
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct._node, ptr %11, i32 0, i32 20
  store i32 %10, ptr %12, align 8, !tbaa !11
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct._node, ptr %13, i32 0, i32 21
  %15 = load ptr, ptr %14, align 8, !tbaa !15
  %16 = load i32, ptr %4, align 4, !tbaa !9
  %17 = sext i32 %16 to i64
  %18 = mul i64 8, %17
  %19 = call ptr @realloc(ptr noundef %15, i64 noundef %18) #4
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct._node, ptr %20, i32 0, i32 21
  store ptr %19, ptr %21, align 8, !tbaa !15
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct._node, ptr %22, i32 0, i32 25
  %24 = load ptr, ptr %23, align 8, !tbaa !16
  %25 = load i32, ptr %4, align 4, !tbaa !9
  %26 = sext i32 %25 to i64
  %27 = mul i64 8, %26
  %28 = call ptr @realloc(ptr noundef %24, i64 noundef %27) #4
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct._node, ptr %29, i32 0, i32 25
  store ptr %28, ptr %30, align 8, !tbaa !16
  %31 = load ptr, ptr %3, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct._node, ptr %31, i32 0, i32 26
  %33 = load ptr, ptr %32, align 8, !tbaa !17
  %34 = load i32, ptr %4, align 4, !tbaa !9
  %35 = sext i32 %34 to i64
  %36 = mul i64 8, %35
  %37 = call ptr @realloc(ptr noundef %33, i64 noundef %36) #4
  %38 = load ptr, ptr %3, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct._node, ptr %38, i32 0, i32 26
  store ptr %37, ptr %39, align 8, !tbaa !17
  %40 = load ptr, ptr %3, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct._node, ptr %40, i32 0, i32 27
  %42 = load ptr, ptr %41, align 8, !tbaa !18
  %43 = load i32, ptr %4, align 4, !tbaa !9
  %44 = sext i32 %43 to i64
  %45 = mul i64 8, %44
  %46 = call ptr @realloc(ptr noundef %42, i64 noundef %45) #4
  %47 = load ptr, ptr %3, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct._node, ptr %47, i32 0, i32 27
  store ptr %46, ptr %48, align 8, !tbaa !18
  %49 = load ptr, ptr %3, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct._node, ptr %49, i32 0, i32 22
  %51 = load ptr, ptr %50, align 8, !tbaa !19
  %52 = load i32, ptr %4, align 4, !tbaa !9
  %53 = sext i32 %52 to i64
  %54 = mul i64 8, %53
  %55 = call ptr @realloc(ptr noundef %51, i64 noundef %54) #4
  %56 = load ptr, ptr %3, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct._node, ptr %56, i32 0, i32 22
  store ptr %55, ptr %57, align 8, !tbaa !19
  %58 = load ptr, ptr %3, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct._node, ptr %58, i32 0, i32 23
  %60 = load ptr, ptr %59, align 8, !tbaa !20
  %61 = load i32, ptr %4, align 4, !tbaa !9
  %62 = sext i32 %61 to i64
  %63 = mul i64 8, %62
  %64 = call ptr @realloc(ptr noundef %60, i64 noundef %63) #4
  %65 = load ptr, ptr %3, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct._node, ptr %65, i32 0, i32 23
  store ptr %64, ptr %66, align 8, !tbaa !20
  %67 = load ptr, ptr %3, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct._node, ptr %67, i32 0, i32 24
  %69 = load ptr, ptr %68, align 8, !tbaa !21
  %70 = load i32, ptr %4, align 4, !tbaa !9
  %71 = sext i32 %70 to i64
  %72 = mul i64 8, %71
  %73 = call ptr @realloc(ptr noundef %69, i64 noundef %72) #4
  %74 = load ptr, ptr %3, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct._node, ptr %74, i32 0, i32 24
  store ptr %73, ptr %75, align 8, !tbaa !21
  %76 = load ptr, ptr %3, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct._node, ptr %76, i32 0, i32 28
  %78 = load ptr, ptr %77, align 8, !tbaa !22
  %79 = load i32, ptr %4, align 4, !tbaa !9
  %80 = sext i32 %79 to i64
  %81 = mul i64 8, %80
  %82 = call ptr @realloc(ptr noundef %78, i64 noundef %81) #4
  %83 = load ptr, ptr %3, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct._node, ptr %83, i32 0, i32 28
  store ptr %82, ptr %84, align 8, !tbaa !22
  %85 = load ptr, ptr %3, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct._node, ptr %85, i32 0, i32 29
  %87 = load ptr, ptr %86, align 8, !tbaa !23
  %88 = load i32, ptr %4, align 4, !tbaa !9
  %89 = sext i32 %88 to i64
  %90 = mul i64 8, %89
  %91 = call ptr @realloc(ptr noundef %87, i64 noundef %90) #4
  %92 = load ptr, ptr %3, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct._node, ptr %92, i32 0, i32 29
  store ptr %91, ptr %93, align 8, !tbaa !23
  %94 = load ptr, ptr %3, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct._node, ptr %94, i32 0, i32 30
  %96 = load ptr, ptr %95, align 8, !tbaa !24
  %97 = load i32, ptr %4, align 4, !tbaa !9
  %98 = sext i32 %97 to i64
  %99 = mul i64 8, %98
  %100 = call ptr @realloc(ptr noundef %96, i64 noundef %99) #4
  %101 = load ptr, ptr %3, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct._node, ptr %101, i32 0, i32 30
  store ptr %100, ptr %102, align 8, !tbaa !24
  %103 = load ptr, ptr %3, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct._node, ptr %103, i32 0, i32 31
  %105 = load ptr, ptr %104, align 8, !tbaa !25
  %106 = load i32, ptr %4, align 4, !tbaa !9
  %107 = mul nsw i32 %106, 3
  %108 = sext i32 %107 to i64
  %109 = mul i64 %108, 8
  %110 = call ptr @realloc(ptr noundef %105, i64 noundef %109) #4
  %111 = load ptr, ptr %3, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct._node, ptr %111, i32 0, i32 31
  store ptr %110, ptr %112, align 8, !tbaa !25
  %113 = load ptr, ptr %3, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct._node, ptr %113, i32 0, i32 32
  %115 = load ptr, ptr %114, align 8, !tbaa !26
  %116 = load i32, ptr %4, align 4, !tbaa !9
  %117 = mul nsw i32 %116, 3
  %118 = sext i32 %117 to i64
  %119 = mul i64 %118, 8
  %120 = call ptr @realloc(ptr noundef %115, i64 noundef %119) #4
  %121 = load ptr, ptr %3, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct._node, ptr %121, i32 0, i32 32
  store ptr %120, ptr %122, align 8, !tbaa !26
  %123 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %123, ptr %5, align 4, !tbaa !9
  br label %124

124:                                              ; preds = %133, %2
  %125 = load i32, ptr %5, align 4, !tbaa !9
  %126 = load ptr, ptr %3, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct._node, ptr %126, i32 0, i32 20
  %128 = load i32, ptr %127, align 8, !tbaa !11
  %129 = icmp slt i32 %125, %128
  br i1 %129, label %130, label %136

130:                                              ; preds = %124
  %131 = load ptr, ptr %3, align 8, !tbaa !5
  %132 = load i32, ptr %5, align 4, !tbaa !9
  call void @InitNodeArm(ptr noundef %131, i32 noundef %132)
  br label %133

133:                                              ; preds = %130
  %134 = load i32, ptr %5, align 4, !tbaa !9
  %135 = add nsw i32 %134, 1
  store i32 %135, ptr %5, align 4, !tbaa !9
  br label %124, !llvm.loop !27

136:                                              ; preds = %124
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  ret void
}

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

; Function Attrs: nounwind uwtable
declare hidden void @InitNodeArm(ptr noundef, i32 noundef) #1

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 = { 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 #3 = { nounwind }
attributes #4 = { 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 160}
!12 = !{!"_node", !10, i64 0, !13, i64 8, !13, i64 16, !13, i64 24, !13, i64 32, !13, i64 40, !13, i64 48, !13, i64 56, !13, i64 64, !13, i64 72, !13, i64 80, !13, i64 88, !13, i64 96, !13, i64 104, !13, i64 112, !13, i64 120, !13, i64 128, !13, i64 136, !13, i64 144, !14, i64 152, !10, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !10, i64 272, !10, i64 276, !10, i64 280, !10, i64 284, !10, i64 288, !6, i64 296, !6, i64 304, !10, i64 312}
!13 = !{!"double", !7, i64 0}
!14 = !{!"_tag", !10, i64 0, !10, i64 4}
!15 = !{!12, !6, i64 168}
!16 = !{!12, !6, i64 200}
!17 = !{!12, !6, i64 208}
!18 = !{!12, !6, i64 216}
!19 = !{!12, !6, i64 176}
!20 = !{!12, !6, i64 184}
!21 = !{!12, !6, i64 192}
!22 = !{!12, !6, i64 224}
!23 = !{!12, !6, i64 232}
!24 = !{!12, !6, i64 240}
!25 = !{!12, !6, i64 248}
!26 = !{!12, !6, i64 256}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}


; 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: nounwind uwtable
define dso_local void @ReallocNodeArms(ptr noundef %0, i32 noundef %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 160
  %4 = load i32, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 168
  %6 = load ptr, ptr %5, align 8, !tbaa !13
  %7 = sext i32 %1 to i64
  %8 = shl nsw i64 %7, 3
  %9 = tail call ptr @realloc(ptr noundef %6, i64 noundef %8) #2
  store ptr %9, ptr %5, align 8, !tbaa !13
  %10 = getelementptr inbounds i8, ptr %0, i64 200
  %11 = load ptr, ptr %10, align 8, !tbaa !14
  %12 = tail call ptr @realloc(ptr noundef %11, i64 noundef %8) #2
  store ptr %12, ptr %10, align 8, !tbaa !14
  %13 = getelementptr inbounds i8, ptr %0, i64 208
  %14 = load ptr, ptr %13, align 8, !tbaa !15
  %15 = tail call ptr @realloc(ptr noundef %14, i64 noundef %8) #2
  store ptr %15, ptr %13, align 8, !tbaa !15
  %16 = getelementptr inbounds i8, ptr %0, i64 216
  %17 = load ptr, ptr %16, align 8, !tbaa !16
  %18 = tail call ptr @realloc(ptr noundef %17, i64 noundef %8) #2
  store ptr %18, ptr %16, align 8, !tbaa !16
  %19 = getelementptr inbounds i8, ptr %0, i64 176
  %20 = load ptr, ptr %19, align 8, !tbaa !17
  %21 = tail call ptr @realloc(ptr noundef %20, i64 noundef %8) #2
  store ptr %21, ptr %19, align 8, !tbaa !17
  %22 = getelementptr inbounds i8, ptr %0, i64 184
  %23 = load ptr, ptr %22, align 8, !tbaa !18
  %24 = tail call ptr @realloc(ptr noundef %23, i64 noundef %8) #2
  store ptr %24, ptr %22, align 8, !tbaa !18
  %25 = getelementptr inbounds i8, ptr %0, i64 192
  %26 = load ptr, ptr %25, align 8, !tbaa !19
  %27 = tail call ptr @realloc(ptr noundef %26, i64 noundef %8) #2
  store ptr %27, ptr %25, align 8, !tbaa !19
  %28 = getelementptr inbounds i8, ptr %0, i64 224
  %29 = load ptr, ptr %28, align 8, !tbaa !20
  %30 = tail call ptr @realloc(ptr noundef %29, i64 noundef %8) #2
  store ptr %30, ptr %28, align 8, !tbaa !20
  %31 = getelementptr inbounds i8, ptr %0, i64 232
  %32 = load ptr, ptr %31, align 8, !tbaa !21
  %33 = tail call ptr @realloc(ptr noundef %32, i64 noundef %8) #2
  store ptr %33, ptr %31, align 8, !tbaa !21
  %34 = getelementptr inbounds i8, ptr %0, i64 240
  %35 = load ptr, ptr %34, align 8, !tbaa !22
  %36 = tail call ptr @realloc(ptr noundef %35, i64 noundef %8) #2
  store ptr %36, ptr %34, align 8, !tbaa !22
  %37 = getelementptr inbounds i8, ptr %0, i64 248
  %38 = load ptr, ptr %37, align 8, !tbaa !23
  %39 = mul nsw i32 %1, 3
  %40 = sext i32 %39 to i64
  %41 = shl nsw i64 %40, 3
  %42 = tail call ptr @realloc(ptr noundef %38, i64 noundef %41) #2
  store ptr %42, ptr %37, align 8, !tbaa !23
  %43 = getelementptr inbounds i8, ptr %0, i64 256
  %44 = load ptr, ptr %43, align 8, !tbaa !24
  %45 = tail call ptr @realloc(ptr noundef %44, i64 noundef %41) #2
  store ptr %45, ptr %43, align 8, !tbaa !24
  %46 = load i32, ptr %3, align 8, !tbaa !5
  %47 = icmp slt i32 %4, %46
  br i1 %47, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %2, %.lr.ph
  %.044 = phi i32 [ %48, %.lr.ph ], [ %4, %2 ]
  tail call void @InitNodeArm(ptr noundef nonnull %0, i32 noundef %.044)
  %48 = add nsw i32 %.044, 1
  %49 = load i32, ptr %3, align 8, !tbaa !5
  %50 = icmp slt i32 %48, %49
  br i1 %50, label %.lr.ph, label %._crit_edge, !llvm.loop !25

._crit_edge:                                      ; preds = %.lr.ph, %2
  ret void
}

; 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 #1

; Function Attrs: nounwind uwtable
declare hidden void @InitNodeArm(ptr noundef, i32 noundef) local_unnamed_addr #0

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 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 #2 = { 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, !7, i64 160}
!6 = !{!"_node", !7, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !10, i64 120, !10, i64 128, !10, i64 136, !10, i64 144, !11, i64 152, !7, i64 160, !12, i64 168, !12, i64 176, !12, i64 184, !12, i64 192, !12, i64 200, !12, i64 208, !12, i64 216, !12, i64 224, !12, i64 232, !12, i64 240, !12, i64 248, !12, i64 256, !12, i64 264, !7, i64 272, !7, i64 276, !7, i64 280, !7, i64 284, !7, i64 288, !12, i64 296, !12, i64 304, !7, i64 312}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"double", !8, i64 0}
!11 = !{!"_tag", !7, i64 0, !7, i64 4}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!6, !12, i64 168}
!14 = !{!6, !12, i64 200}
!15 = !{!6, !12, i64 208}
!16 = !{!6, !12, i64 216}
!17 = !{!6, !12, i64 176}
!18 = !{!6, !12, i64 184}
!19 = !{!6, !12, i64 192}
!20 = !{!6, !12, i64 224}
!21 = !{!6, !12, i64 232}
!22 = !{!6, !12, i64 240}
!23 = !{!6, !12, i64 248}
!24 = !{!6, !12, i64 256}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}


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