; LLVM IR from LeoVen/C-Macro-Collections :: tests (types)

; 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.treemap0 = type { ptr, i64, i32, ptr, ptr, ptr }
%struct.treemap0_node = type { ptr, ptr, i8, ptr, ptr, ptr }
%struct.treemap0_fval = type { ptr, ptr, 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
declare hidden ptr @tm0_impl_get_node(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @tm0_equals(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i8, align 1
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %10 = load ptr, ptr %4, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.treemap0, ptr %10, i32 0, i32 2
  store i32 0, ptr %11, align 8, !tbaa !9
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.treemap0, ptr %12, i32 0, i32 2
  store i32 0, ptr %13, align 8, !tbaa !9
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.treemap0, ptr %14, i32 0, i32 1
  %16 = load i64, ptr %15, align 8, !tbaa !13
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.treemap0, ptr %17, i32 0, i32 1
  %19 = load i64, ptr %18, align 8, !tbaa !13
  %20 = icmp ne i64 %16, %19
  br i1 %20, label %21, label %22

21:                                               ; preds = %2
  store i1 false, ptr %3, align 1
  br label %119

22:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #2
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.treemap0, ptr %23, i32 0, i32 0
  %25 = load ptr, ptr %24, align 8, !tbaa !14
  store ptr %25, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #2
  store i8 0, ptr %7, align 1, !tbaa !15
  br label %26

26:                                               ; preds = %116, %22
  %27 = load ptr, ptr %6, align 8, !tbaa !5
  %28 = icmp ne ptr %27, null
  br i1 %28, label %29, label %117

29:                                               ; preds = %26
  %30 = load i8, ptr %7, align 1, !tbaa !15, !range !17, !noundef !18
  %31 = trunc i8 %30 to i1
  br i1 %31, label %43, label %32

32:                                               ; preds = %29
  br label %33

33:                                               ; preds = %38, %32
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.treemap0_node, ptr %34, i32 0, i32 4
  %36 = load ptr, ptr %35, align 8, !tbaa !19
  %37 = icmp ne ptr %36, null
  br i1 %37, label %38, label %42

38:                                               ; preds = %33
  %39 = load ptr, ptr %6, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.treemap0_node, ptr %39, i32 0, i32 4
  %41 = load ptr, ptr %40, align 8, !tbaa !19
  store ptr %41, ptr %6, align 8, !tbaa !5
  br label %33, !llvm.loop !21

42:                                               ; preds = %33
  br label %43

43:                                               ; preds = %42, %29
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #2
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = load ptr, ptr %6, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.treemap0_node, ptr %45, i32 0, i32 0
  %47 = load ptr, ptr %46, align 8, !tbaa !23
  %48 = call ptr @tm0_impl_get_node(ptr noundef %44, ptr noundef %47)
  store ptr %48, ptr %8, align 8, !tbaa !5
  %49 = load ptr, ptr %8, align 8, !tbaa !5
  %50 = icmp eq ptr %49, null
  br i1 %50, label %51, label %52

51:                                               ; preds = %43
  store i1 false, ptr %3, align 1
  store i32 1, ptr %9, align 4
  br label %114

52:                                               ; preds = %43
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.treemap0, ptr %53, i32 0, i32 4
  %55 = load ptr, ptr %54, align 8, !tbaa !24
  %56 = getelementptr inbounds %struct.treemap0_fval, ptr %55, i32 0, i32 0
  %57 = load ptr, ptr %56, align 8, !tbaa !25
  %58 = load ptr, ptr %8, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.treemap0_node, ptr %58, i32 0, i32 1
  %60 = load ptr, ptr %59, align 8, !tbaa !27
  %61 = load ptr, ptr %6, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.treemap0_node, ptr %61, i32 0, i32 1
  %63 = load ptr, ptr %62, align 8, !tbaa !27
  %64 = call i32 %57(ptr noundef %60, ptr noundef %63)
  %65 = icmp ne i32 %64, 0
  br i1 %65, label %66, label %67

66:                                               ; preds = %52
  store i1 false, ptr %3, align 1
  store i32 1, ptr %9, align 4
  br label %114

67:                                               ; preds = %52
  store i8 1, ptr %7, align 1, !tbaa !15
  %68 = load ptr, ptr %6, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.treemap0_node, ptr %68, i32 0, i32 3
  %70 = load ptr, ptr %69, align 8, !tbaa !28
  %71 = icmp ne ptr %70, null
  br i1 %71, label %72, label %76

72:                                               ; preds = %67
  store i8 0, ptr %7, align 1, !tbaa !15
  %73 = load ptr, ptr %6, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.treemap0_node, ptr %73, i32 0, i32 3
  %75 = load ptr, ptr %74, align 8, !tbaa !28
  store ptr %75, ptr %6, align 8, !tbaa !5
  br label %113

76:                                               ; preds = %67
  %77 = load ptr, ptr %6, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.treemap0_node, ptr %77, i32 0, i32 5
  %79 = load ptr, ptr %78, align 8, !tbaa !29
  %80 = icmp ne ptr %79, null
  br i1 %80, label %81, label %111

81:                                               ; preds = %76
  br label %82

82:                                               ; preds = %97, %81
  %83 = load ptr, ptr %6, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.treemap0_node, ptr %83, i32 0, i32 5
  %85 = load ptr, ptr %84, align 8, !tbaa !29
  %86 = icmp ne ptr %85, null
  br i1 %86, label %87, label %95

87:                                               ; preds = %82
  %88 = load ptr, ptr %6, align 8, !tbaa !5
  %89 = load ptr, ptr %6, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.treemap0_node, ptr %89, i32 0, i32 5
  %91 = load ptr, ptr %90, align 8, !tbaa !29
  %92 = getelementptr inbounds %struct.treemap0_node, ptr %91, i32 0, i32 3
  %93 = load ptr, ptr %92, align 8, !tbaa !28
  %94 = icmp eq ptr %88, %93
  br label %95

95:                                               ; preds = %87, %82
  %96 = phi i1 [ false, %82 ], [ %94, %87 ]
  br i1 %96, label %97, label %101

97:                                               ; preds = %95
  %98 = load ptr, ptr %6, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.treemap0_node, ptr %98, i32 0, i32 5
  %100 = load ptr, ptr %99, align 8, !tbaa !29
  store ptr %100, ptr %6, align 8, !tbaa !5
  br label %82, !llvm.loop !30

101:                                              ; preds = %95
  %102 = load ptr, ptr %6, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.treemap0_node, ptr %102, i32 0, i32 5
  %104 = load ptr, ptr %103, align 8, !tbaa !29
  %105 = icmp ne ptr %104, null
  br i1 %105, label %107, label %106

106:                                              ; preds = %101
  store i32 3, ptr %9, align 4
  br label %114

107:                                              ; preds = %101
  %108 = load ptr, ptr %6, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.treemap0_node, ptr %108, i32 0, i32 5
  %110 = load ptr, ptr %109, align 8, !tbaa !29
  store ptr %110, ptr %6, align 8, !tbaa !5
  br label %112

111:                                              ; preds = %76
  store i32 3, ptr %9, align 4
  br label %114

112:                                              ; preds = %107
  br label %113

113:                                              ; preds = %112, %72
  store i32 0, ptr %9, align 4
  br label %114

114:                                              ; preds = %113, %111, %106, %66, %51
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #2
  %115 = load i32, ptr %9, align 4
  switch i32 %115, label %118 [
    i32 0, label %116
    i32 3, label %117
  ]

116:                                              ; preds = %114
  br label %26, !llvm.loop !31

117:                                              ; preds = %114, %26
  store i1 true, ptr %3, align 1
  store i32 1, ptr %9, align 4
  br label %118

118:                                              ; preds = %117, %114
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #2
  br label %119

119:                                              ; preds = %118, %21
  %120 = load i1, ptr %3, align 1
  ret i1 %120
}

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, !12, i64 16}
!10 = !{!"treemap0", !6, i64 0, !11, i64 8, !12, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!11 = !{!"long", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!10, !11, i64 8}
!14 = !{!10, !6, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"_Bool", !7, i64 0}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = !{!20, !6, i64 32}
!20 = !{!"treemap0_node", !6, i64 0, !6, i64 8, !7, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{!20, !6, i64 0}
!24 = !{!10, !6, i64 32}
!25 = !{!26, !6, i64 0}
!26 = !{!"treemap0_fval", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!27 = !{!20, !6, i64 8}
!28 = !{!20, !6, i64 24}
!29 = !{!20, !6, i64 40}
!30 = distinct !{!30, !22}
!31 = distinct !{!31, !22}


; 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
declare hidden ptr @tm0_impl_get_node(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local noundef zeroext i1 @tm0_equals(ptr nocapture noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 16
  store i32 0, ptr %3, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %1, i64 16
  store i32 0, ptr %4, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  %6 = load i64, ptr %5, align 8, !tbaa !12
  %7 = getelementptr inbounds i8, ptr %1, i64 8
  %8 = load i64, ptr %7, align 8, !tbaa !12
  %.not = icmp eq i64 %6, %8
  br i1 %.not, label %9, label %.thread

9:                                                ; preds = %2
  %10 = load ptr, ptr %0, align 8, !tbaa !13
  %.not3858 = icmp eq ptr %10, null
  br i1 %.not3858, label %.thread, label %.lr.ph

.lr.ph:                                           ; preds = %9
  %11 = getelementptr inbounds i8, ptr %0, i64 32
  br label %.critedge

.critedge:                                        ; preds = %.critedge.backedge, %.lr.ph
  %.02660 = phi i1 [ false, %.lr.ph ], [ %.not41, %.critedge.backedge ]
  %.02959 = phi ptr [ %10, %.lr.ph ], [ %.02959.be, %.critedge.backedge ]
  br i1 %.02660, label %.loopexit, label %.preheader55

.preheader55:                                     ; preds = %.critedge, %.preheader55
  %.130 = phi ptr [ %13, %.preheader55 ], [ %.02959, %.critedge ]
  %12 = getelementptr inbounds i8, ptr %.130, i64 32
  %13 = load ptr, ptr %12, align 8, !tbaa !14
  %.not39 = icmp eq ptr %13, null
  br i1 %.not39, label %.loopexit, label %.preheader55, !llvm.loop !16

.loopexit:                                        ; preds = %.preheader55, %.critedge
  %.231 = phi ptr [ %.02959, %.critedge ], [ %.130, %.preheader55 ]
  %14 = load ptr, ptr %.231, align 8, !tbaa !18
  %15 = tail call ptr @tm0_impl_get_node(ptr noundef %1, ptr noundef %14)
  %16 = icmp eq ptr %15, null
  br i1 %16, label %.thread, label %17

17:                                               ; preds = %.loopexit
  %18 = load ptr, ptr %11, align 8, !tbaa !19
  %19 = load ptr, ptr %18, align 8, !tbaa !20
  %20 = getelementptr inbounds i8, ptr %15, i64 8
  %21 = load ptr, ptr %20, align 8, !tbaa !22
  %22 = getelementptr inbounds i8, ptr %.231, i64 8
  %23 = load ptr, ptr %22, align 8, !tbaa !22
  %24 = tail call i32 %19(ptr noundef %21, ptr noundef %23) #1
  %.not40 = icmp eq i32 %24, 0
  br i1 %.not40, label %25, label %.thread

25:                                               ; preds = %17
  %26 = getelementptr inbounds i8, ptr %.231, i64 24
  %27 = load ptr, ptr %26, align 8, !tbaa !23
  %.not41 = icmp eq ptr %27, null
  br i1 %.not41, label %28, label %.critedge.backedge

.critedge.backedge:                               ; preds = %33, %25
  %.02959.be = phi ptr [ %27, %25 ], [ %32, %33 ]
  br label %.critedge

28:                                               ; preds = %25
  %29 = getelementptr inbounds i8, ptr %.231, i64 40
  %30 = load ptr, ptr %29, align 8, !tbaa !24
  %.not42 = icmp eq ptr %30, null
  br i1 %.not42, label %.thread, label %.preheader

.preheader:                                       ; preds = %28, %33
  %.332 = phi ptr [ %32, %33 ], [ %.231, %28 ]
  %31 = getelementptr inbounds i8, ptr %.332, i64 40
  %32 = load ptr, ptr %31, align 8, !tbaa !24
  %.not43 = icmp eq ptr %32, null
  br i1 %.not43, label %.thread, label %33

33:                                               ; preds = %.preheader
  %34 = getelementptr inbounds i8, ptr %32, i64 24
  %35 = load ptr, ptr %34, align 8, !tbaa !23
  %36 = icmp eq ptr %.332, %35
  br i1 %36, label %.preheader, label %.critedge.backedge, !llvm.loop !25

.thread:                                          ; preds = %.loopexit, %17, %28, %.preheader, %9, %2
  %.3 = phi i1 [ false, %2 ], [ true, %9 ], [ true, %.preheader ], [ true, %28 ], [ false, %17 ], [ false, %.loopexit ]
  ret i1 %.3
}

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 = { 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, !11, i64 16}
!6 = !{!"treemap0", !7, i64 0, !10, i64 8, !11, i64 16, !7, i64 24, !7, i64 32, !7, i64 40}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!6, !10, i64 8}
!13 = !{!6, !7, i64 0}
!14 = !{!15, !7, i64 32}
!15 = !{!"treemap0_node", !7, i64 0, !7, i64 8, !8, i64 16, !7, i64 24, !7, i64 32, !7, i64 40}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!15, !7, i64 0}
!19 = !{!6, !7, i64 32}
!20 = !{!21, !7, i64 0}
!21 = !{!"treemap0_fval", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40}
!22 = !{!15, !7, i64 8}
!23 = !{!15, !7, i64 24}
!24 = !{!15, !7, i64 40}
!25 = distinct !{!25, !17}


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