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

@.str.3 = external hidden unnamed_addr constant [36 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
declare dso_local void @Fatal(ptr noundef, ...) #1

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

12:                                               ; preds = %2
  %13 = getelementptr inbounds %struct._tag, ptr %4, i32 0, i32 1
  %14 = load i32, ptr %13, align 4, !tbaa !12
  %15 = icmp slt i32 %14, 0
  br i1 %15, label %16, label %21

16:                                               ; preds = %12, %2
  %17 = getelementptr inbounds %struct._tag, ptr %4, i32 0, i32 0
  %18 = load i32, ptr %17, align 4, !tbaa !9
  %19 = getelementptr inbounds %struct._tag, ptr %4, i32 0, i32 1
  %20 = load i32, ptr %19, align 4, !tbaa !12
  call void (ptr, ...) @Fatal(ptr noundef @.str.3, i32 noundef %18, i32 noundef %20)
  br label %21

21:                                               ; preds = %16, %12
  %22 = getelementptr inbounds %struct._tag, ptr %4, i32 0, i32 0
  %23 = load i32, ptr %22, align 4, !tbaa !9
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct._home, ptr %24, i32 0, i32 0
  %26 = load i32, ptr %25, align 8, !tbaa !13
  %27 = icmp eq i32 %23, %26
  br i1 %27, label %28, label %49

28:                                               ; preds = %21
  %29 = getelementptr inbounds %struct._tag, ptr %4, i32 0, i32 1
  %30 = load i32, ptr %29, align 4, !tbaa !12
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct._home, ptr %31, i32 0, i32 14
  %33 = load i32, ptr %32, align 8, !tbaa !19
  %34 = icmp sge i32 %30, %33
  br i1 %34, label %35, label %36

35:                                               ; preds = %28
  store ptr null, ptr %3, align 8
  store i32 1, ptr %8, align 4
  br label %79

36:                                               ; preds = %28
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct._home, ptr %37, i32 0, i32 13
  %39 = load ptr, ptr %38, align 8, !tbaa !20
  %40 = getelementptr inbounds %struct._tag, ptr %4, i32 0, i32 1
  %41 = load i32, ptr %40, align 4, !tbaa !12
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds ptr, ptr %39, i64 %42
  %44 = load ptr, ptr %43, align 8, !tbaa !5
  store ptr %44, ptr %6, align 8, !tbaa !5
  %45 = icmp eq ptr %44, null
  br i1 %45, label %46, label %47

46:                                               ; preds = %36
  store ptr null, ptr %3, align 8
  store i32 1, ptr %8, align 4
  br label %79

47:                                               ; preds = %36
  %48 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %48, ptr %3, align 8
  store i32 1, ptr %8, align 4
  br label %79

49:                                               ; preds = %21
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct._home, ptr %50, i32 0, i32 27
  %52 = load ptr, ptr %51, align 8, !tbaa !21
  %53 = getelementptr inbounds %struct._tag, ptr %4, i32 0, i32 0
  %54 = load i32, ptr %53, align 4, !tbaa !9
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds ptr, ptr %52, i64 %55
  %57 = load ptr, ptr %56, align 8, !tbaa !5
  store ptr %57, ptr %7, align 8, !tbaa !5
  %58 = load ptr, ptr %7, align 8, !tbaa !5
  %59 = icmp eq ptr %58, null
  br i1 %59, label %60, label %61

60:                                               ; preds = %49
  store ptr null, ptr %3, align 8
  store i32 1, ptr %8, align 4
  br label %79

61:                                               ; preds = %49
  %62 = getelementptr inbounds %struct._tag, ptr %4, i32 0, i32 1
  %63 = load i32, ptr %62, align 4, !tbaa !12
  %64 = load ptr, ptr %7, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct._remotedomain, ptr %64, i32 0, i32 3
  %66 = load i32, ptr %65, align 8, !tbaa !22
  %67 = icmp sge i32 %63, %66
  br i1 %67, label %68, label %69

68:                                               ; preds = %61
  store ptr null, ptr %3, align 8
  store i32 1, ptr %8, align 4
  br label %79

69:                                               ; preds = %61
  %70 = load ptr, ptr %7, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct._remotedomain, ptr %70, i32 0, i32 4
  %72 = load ptr, ptr %71, align 8, !tbaa !24
  %73 = getelementptr inbounds %struct._tag, ptr %4, i32 0, i32 1
  %74 = load i32, ptr %73, align 4, !tbaa !12
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds ptr, ptr %72, i64 %75
  %77 = load ptr, ptr %76, align 8, !tbaa !5
  store ptr %77, ptr %6, align 8, !tbaa !5
  %78 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %78, ptr %3, align 8
  store i32 1, ptr %8, align 4
  br label %79

79:                                               ; preds = %69, %68, %60, %47, %46, %35
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #2
  %80 = load ptr, ptr %3, align 8
  ret ptr %80
}

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, !11, i64 0}
!10 = !{!"_tag", !11, i64 0, !11, i64 4}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 4}
!13 = !{!14, !11, i64 0}
!14 = !{!"_home", !11, i64 0, !11, i64 4, !11, i64 8, !11, 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, !11, i64 96, !11, i64 100, !6, i64 104, !11, i64 112, !11, i64 116, !6, i64 120, !11, i64 128, !11, i64 132, !11, i64 136, !6, i64 144, !11, i64 152, !11, 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, !11, i64 232, !11, i64 236, !11, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !11, i64 272, !6, i64 280, !11, i64 288, !6, i64 296, !6, i64 304, !6, i64 312, !11, i64 320, !11, i64 324, !6, i64 328, !11, i64 336, !6, i64 344, !6, i64 352, !6, i64 360, !11, i64 368, !11, i64 372, !11, i64 376, !6, i64 384, !6, i64 392, !11, i64 400, !11, i64 404, !6, i64 408, !6, i64 416, !6, i64 424, !11, i64 432, !11, i64 436, !11, i64 440, !7, i64 448, !7, i64 520, !16, i64 592, !11, i64 632, !11, i64 636, !11, i64 640, !11, i64 644, !11, i64 648, !11, i64 652, !11, i64 656, !17, i64 664}
!15 = !{!"double", !7, i64 0}
!16 = !{!"", !11, i64 0, !11, 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}
!19 = !{!14, !11, i64 96}
!20 = !{!14, !6, i64 88}
!21 = !{!14, !6, i64 168}
!22 = !{!23, !11, i64 16}
!23 = !{!"_remotedomain", !11, i64 0, !11, i64 4, !6, i64 8, !11, i64 16, !6, i64 24, !11, i64 32, !6, i64 40, !11, i64 48, !6, i64 56}
!24 = !{!23, !6, i64 24}


; 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.3 = external hidden unnamed_addr constant [36 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @Fatal(ptr noundef, ...) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local ptr @GetNodeFromTag(ptr nocapture noundef readonly %0, i64 %1) local_unnamed_addr #0 {
  %.sroa.0.0.extract.trunc = trunc i64 %1 to i32
  %.sroa.5.0.extract.shift = lshr i64 %1, 32
  %.sroa.5.0.extract.trunc = trunc nuw i64 %.sroa.5.0.extract.shift to i32
  %3 = and i64 %1, -9223372034707292160
  %or.cond.not = icmp eq i64 %3, 0
  br i1 %or.cond.not, label %5, label %4

4:                                                ; preds = %2
  tail call void (ptr, ...) @Fatal(ptr noundef nonnull @.str.3, i32 noundef %.sroa.0.0.extract.trunc, i32 noundef %.sroa.5.0.extract.trunc)
  br label %5

5:                                                ; preds = %2, %4
  %6 = load i32, ptr %0, align 8, !tbaa !5
  %7 = icmp eq i32 %6, %.sroa.0.0.extract.trunc
  br i1 %7, label %8, label %13

8:                                                ; preds = %5
  %9 = getelementptr inbounds i8, ptr %0, i64 96
  %10 = load i32, ptr %9, align 8, !tbaa !15
  %.not23 = icmp sgt i32 %10, %.sroa.5.0.extract.trunc
  br i1 %.not23, label %11, label %29

11:                                               ; preds = %8
  %12 = getelementptr inbounds i8, ptr %0, i64 88
  br label %.sink.split

13:                                               ; preds = %5
  %14 = getelementptr inbounds i8, ptr %0, i64 168
  %15 = load ptr, ptr %14, align 8, !tbaa !16
  %sext = shl i64 %1, 32
  %16 = ashr exact i64 %sext, 29
  %17 = getelementptr inbounds i8, ptr %15, i64 %16
  %18 = load ptr, ptr %17, align 8, !tbaa !17
  %19 = icmp eq ptr %18, null
  br i1 %19, label %29, label %20

20:                                               ; preds = %13
  %21 = getelementptr inbounds i8, ptr %18, i64 16
  %22 = load i32, ptr %21, align 8, !tbaa !18
  %.not = icmp sgt i32 %22, %.sroa.5.0.extract.trunc
  br i1 %.not, label %23, label %29

23:                                               ; preds = %20
  %24 = getelementptr inbounds i8, ptr %18, i64 24
  br label %.sink.split

.sink.split:                                      ; preds = %23, %11
  %.sink = phi ptr [ %12, %11 ], [ %24, %23 ]
  %25 = load ptr, ptr %.sink, align 8, !tbaa !17
  %26 = ashr i64 %1, 32
  %27 = getelementptr inbounds ptr, ptr %25, i64 %26
  %28 = load ptr, ptr %27, align 8, !tbaa !17
  br label %29

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


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