; 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._tag = type { i32, i32 }
%struct._home = type { i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, ptr, i32, i32, ptr, i32, i32, i32, ptr, i32, i32, ptr, ptr, ptr, double, double, double, double, double, double, i32, i32, i32, ptr, ptr, ptr, i32, ptr, i32, ptr, ptr, ptr, i32, i32, ptr, i32, ptr, ptr, ptr, i32, i32, i32, ptr, ptr, i32, i32, ptr, ptr, ptr, i32, i32, i32, [3 x [3 x double]], [3 x [3 x double]], %struct.BurgInfo_t, i32, i32, i32, i32, i32, i32, i32, %struct.timeval }
%struct.BurgInfo_t = type { i32, i32, ptr, ptr, ptr, ptr }
%struct.timeval = type { i64, i64 }

@.str = external hidden unnamed_addr constant [38 x i8], align 1

; 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 i32 @DomainOwnsSeg(ptr noundef %0, i32 noundef %1, i32 noundef %2, ptr noundef %3) #1 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !9
  store i32 %2, ptr %8, align 4, !tbaa !9
  store ptr %3, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #2
  store i32 1, ptr %10, align 4, !tbaa !9
  %12 = load i32, ptr %8, align 4, !tbaa !9
  %13 = load ptr, ptr %9, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct._tag, ptr %13, i32 0, i32 0
  %15 = load i32, ptr %14, align 4, !tbaa !11
  %16 = icmp eq i32 %12, %15
  br i1 %16, label %17, label %18

17:                                               ; preds = %4
  store i32 1, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %66

18:                                               ; preds = %4
  %19 = load i32, ptr %7, align 4, !tbaa !9
  switch i32 %19, label %62 [
    i32 1, label %20
    i32 2, label %20
    i32 3, label %41
  ]

20:                                               ; preds = %18, %18
  %21 = load ptr, ptr %6, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct._home, ptr %21, i32 0, i32 2
  %23 = load i32, ptr %22, align 8, !tbaa !13
  %24 = and i32 %23, 1
  %25 = icmp ne i32 %24, 0
  br i1 %25, label %26, label %33

26:                                               ; preds = %20
  %27 = load i32, ptr %8, align 4, !tbaa !9
  %28 = load ptr, ptr %9, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct._tag, ptr %28, i32 0, i32 0
  %30 = load i32, ptr %29, align 4, !tbaa !11
  %31 = icmp sgt i32 %27, %30
  %32 = zext i1 %31 to i32
  store i32 %32, ptr %10, align 4, !tbaa !9
  br label %40

33:                                               ; preds = %20
  %34 = load i32, ptr %8, align 4, !tbaa !9
  %35 = load ptr, ptr %9, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct._tag, ptr %35, i32 0, i32 0
  %37 = load i32, ptr %36, align 4, !tbaa !11
  %38 = icmp slt i32 %34, %37
  %39 = zext i1 %38 to i32
  store i32 %39, ptr %10, align 4, !tbaa !9
  br label %40

40:                                               ; preds = %33, %26
  br label %64

41:                                               ; preds = %18
  %42 = load ptr, ptr %6, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct._home, ptr %42, i32 0, i32 2
  %44 = load i32, ptr %43, align 8, !tbaa !13
  %45 = and i32 %44, 1
  %46 = icmp ne i32 %45, 0
  br i1 %46, label %47, label %54

47:                                               ; preds = %41
  %48 = load i32, ptr %8, align 4, !tbaa !9
  %49 = load ptr, ptr %9, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct._tag, ptr %49, i32 0, i32 0
  %51 = load i32, ptr %50, align 4, !tbaa !11
  %52 = icmp slt i32 %48, %51
  %53 = zext i1 %52 to i32
  store i32 %53, ptr %10, align 4, !tbaa !9
  br label %61

54:                                               ; preds = %41
  %55 = load i32, ptr %8, align 4, !tbaa !9
  %56 = load ptr, ptr %9, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct._tag, ptr %56, i32 0, i32 0
  %58 = load i32, ptr %57, align 4, !tbaa !11
  %59 = icmp sgt i32 %55, %58
  %60 = zext i1 %59 to i32
  store i32 %60, ptr %10, align 4, !tbaa !9
  br label %61

61:                                               ; preds = %54, %47
  br label %64

62:                                               ; preds = %18
  %63 = load i32, ptr %7, align 4, !tbaa !9
  call void (ptr, ...) @Fatal(ptr noundef @.str, i32 noundef %63)
  br label %64

64:                                               ; preds = %62, %61, %40
  %65 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %65, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %66

66:                                               ; preds = %64, %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #2
  %67 = load i32, ptr %5, align 4
  ret i32 %67
}

; Function Attrs: nounwind uwtable
declare dso_local void @Fatal(ptr 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 }

!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 0}
!12 = !{!"_tag", !10, i64 0, !10, i64 4}
!13 = !{!14, !10, i64 8}
!14 = !{!"_home", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !10, i64 96, !10, i64 100, !6, i64 104, !10, i64 112, !10, i64 116, !6, i64 120, !10, i64 128, !10, i64 132, !10, i64 136, !6, i64 144, !10, i64 152, !10, i64 156, !6, i64 160, !6, i64 168, !6, i64 176, !15, i64 184, !15, i64 192, !15, i64 200, !15, i64 208, !15, i64 216, !15, i64 224, !10, i64 232, !10, i64 236, !10, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !10, i64 272, !6, i64 280, !10, i64 288, !6, i64 296, !6, i64 304, !6, i64 312, !10, i64 320, !10, i64 324, !6, i64 328, !10, i64 336, !6, i64 344, !6, i64 352, !6, i64 360, !10, i64 368, !10, i64 372, !10, i64 376, !6, i64 384, !6, i64 392, !10, i64 400, !10, i64 404, !6, i64 408, !6, i64 416, !6, i64 424, !10, i64 432, !10, i64 436, !10, i64 440, !7, i64 448, !7, i64 520, !16, i64 592, !10, i64 632, !10, i64 636, !10, i64 640, !10, i64 644, !10, i64 648, !10, i64 652, !10, i64 656, !17, i64 664}
!15 = !{!"double", !7, i64 0}
!16 = !{!"", !10, i64 0, !10, i64 4, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!17 = !{!"timeval", !18, i64 0, !18, i64 8}
!18 = !{!"long", !7, i64 0}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@.str = external hidden unnamed_addr constant [38 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @DomainOwnsSeg(ptr nocapture noundef readonly %0, i32 noundef %1, i32 noundef %2, ptr nocapture noundef readonly %3) local_unnamed_addr #0 {
  %5 = load i32, ptr %3, align 4, !tbaa !5
  %6 = icmp eq i32 %5, %2
  br i1 %6, label %26, label %7

7:                                                ; preds = %4
  switch i32 %1, label %24 [
    i32 1, label %8
    i32 2, label %8
    i32 3, label %16
  ]

8:                                                ; preds = %7, %7
  %9 = getelementptr inbounds i8, ptr %0, i64 8
  %10 = load i32, ptr %9, align 8, !tbaa !10
  %11 = and i32 %10, 1
  %.not18 = icmp eq i32 %11, 0
  br i1 %.not18, label %14, label %12

12:                                               ; preds = %8
  %13 = icmp slt i32 %5, %2
  br label %25

14:                                               ; preds = %8
  %15 = icmp sgt i32 %5, %2
  br label %25

16:                                               ; preds = %7
  %17 = getelementptr inbounds i8, ptr %0, i64 8
  %18 = load i32, ptr %17, align 8, !tbaa !10
  %19 = and i32 %18, 1
  %.not = icmp eq i32 %19, 0
  br i1 %.not, label %22, label %20

20:                                               ; preds = %16
  %21 = icmp sgt i32 %5, %2
  br label %25

22:                                               ; preds = %16
  %23 = icmp slt i32 %5, %2
  br label %25

24:                                               ; preds = %7
  tail call void (ptr, ...) @Fatal(ptr noundef nonnull @.str, i32 noundef %1)
  br label %25

25:                                               ; preds = %20, %22, %12, %14, %24
  %.0.shrunk = phi i1 [ true, %24 ], [ %21, %20 ], [ %23, %22 ], [ %13, %12 ], [ %15, %14 ]
  %.0 = zext i1 %.0.shrunk to i32
  br label %26

26:                                               ; preds = %4, %25
  %.015 = phi i32 [ %.0, %25 ], [ 1, %4 ]
  ret i32 %.015
}

; Function Attrs: nounwind uwtable
declare dso_local void @Fatal(ptr 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" }

!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 0}
!6 = !{!"_tag", !7, i64 0, !7, i64 4}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!11, !7, i64 8}
!11 = !{!"_home", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !12, i64 48, !12, i64 56, !12, i64 64, !12, i64 72, !12, i64 80, !12, i64 88, !7, i64 96, !7, i64 100, !12, i64 104, !7, i64 112, !7, i64 116, !12, i64 120, !7, i64 128, !7, i64 132, !7, i64 136, !12, i64 144, !7, i64 152, !7, i64 156, !12, i64 160, !12, i64 168, !12, i64 176, !13, i64 184, !13, i64 192, !13, i64 200, !13, i64 208, !13, i64 216, !13, i64 224, !7, i64 232, !7, i64 236, !7, i64 240, !12, i64 248, !12, i64 256, !12, i64 264, !7, i64 272, !12, i64 280, !7, i64 288, !12, i64 296, !12, i64 304, !12, i64 312, !7, i64 320, !7, i64 324, !12, i64 328, !7, i64 336, !12, i64 344, !12, i64 352, !12, i64 360, !7, i64 368, !7, i64 372, !7, i64 376, !12, i64 384, !12, i64 392, !7, i64 400, !7, i64 404, !12, i64 408, !12, i64 416, !12, i64 424, !7, i64 432, !7, i64 436, !7, i64 440, !8, i64 448, !8, i64 520, !14, i64 592, !7, i64 632, !7, i64 636, !7, i64 640, !7, i64 644, !7, i64 648, !7, i64 652, !7, i64 656, !15, i64 664}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!"double", !8, i64 0}
!14 = !{!"", !7, i64 0, !7, i64 4, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32}
!15 = !{!"timeval", !16, i64 0, !16, i64 8}
!16 = !{!"long", !8, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass