; 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.struct_s = type { i32, i32, ptr, ptr, [10 x double] }
%struct.treemap1 = type { ptr, i64, i32, ptr, ptr, ptr }
%struct.treemap1_node = type { %struct.struct_s, %struct.struct_s, i8, ptr, ptr, ptr }
%struct.treemap1_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 @tm1_impl_get_node(ptr noundef, ptr noundef byval(%struct.struct_s) align 8) #1

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @tm1_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.treemap1, 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.treemap1, 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.treemap1, 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.treemap1, 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 %116

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.treemap1, 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 = %113, %22
  %27 = load ptr, ptr %6, align 8, !tbaa !5
  %28 = icmp ne ptr %27, null
  br i1 %28, label %29, label %114

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.treemap1_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.treemap1_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 !22

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.treemap1_node, ptr %45, i32 0, i32 0
  %47 = call ptr @tm1_impl_get_node(ptr noundef %44, ptr noundef byval(%struct.struct_s) align 8 %46)
  store ptr %47, ptr %8, align 8, !tbaa !5
  %48 = load ptr, ptr %8, align 8, !tbaa !5
  %49 = icmp eq ptr %48, null
  br i1 %49, label %50, label %51

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

51:                                               ; preds = %43
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.treemap1, ptr %52, i32 0, i32 4
  %54 = load ptr, ptr %53, align 8, !tbaa !24
  %55 = getelementptr inbounds %struct.treemap1_fval, ptr %54, i32 0, i32 0
  %56 = load ptr, ptr %55, align 8, !tbaa !25
  %57 = load ptr, ptr %8, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.treemap1_node, ptr %57, i32 0, i32 1
  %59 = load ptr, ptr %6, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.treemap1_node, ptr %59, i32 0, i32 1
  %61 = call i32 %56(ptr noundef byval(%struct.struct_s) align 8 %58, ptr noundef byval(%struct.struct_s) align 8 %60)
  %62 = icmp ne i32 %61, 0
  br i1 %62, label %63, label %64

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

64:                                               ; preds = %51
  store i8 1, ptr %7, align 1, !tbaa !15
  %65 = load ptr, ptr %6, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.treemap1_node, ptr %65, i32 0, i32 3
  %67 = load ptr, ptr %66, align 8, !tbaa !27
  %68 = icmp ne ptr %67, null
  br i1 %68, label %69, label %73

69:                                               ; preds = %64
  store i8 0, ptr %7, align 1, !tbaa !15
  %70 = load ptr, ptr %6, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.treemap1_node, ptr %70, i32 0, i32 3
  %72 = load ptr, ptr %71, align 8, !tbaa !27
  store ptr %72, ptr %6, align 8, !tbaa !5
  br label %110

73:                                               ; preds = %64
  %74 = load ptr, ptr %6, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.treemap1_node, ptr %74, i32 0, i32 5
  %76 = load ptr, ptr %75, align 8, !tbaa !28
  %77 = icmp ne ptr %76, null
  br i1 %77, label %78, label %108

78:                                               ; preds = %73
  br label %79

79:                                               ; preds = %94, %78
  %80 = load ptr, ptr %6, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.treemap1_node, ptr %80, i32 0, i32 5
  %82 = load ptr, ptr %81, align 8, !tbaa !28
  %83 = icmp ne ptr %82, null
  br i1 %83, label %84, label %92

84:                                               ; preds = %79
  %85 = load ptr, ptr %6, align 8, !tbaa !5
  %86 = load ptr, ptr %6, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.treemap1_node, ptr %86, i32 0, i32 5
  %88 = load ptr, ptr %87, align 8, !tbaa !28
  %89 = getelementptr inbounds %struct.treemap1_node, ptr %88, i32 0, i32 3
  %90 = load ptr, ptr %89, align 8, !tbaa !27
  %91 = icmp eq ptr %85, %90
  br label %92

92:                                               ; preds = %84, %79
  %93 = phi i1 [ false, %79 ], [ %91, %84 ]
  br i1 %93, label %94, label %98

94:                                               ; preds = %92
  %95 = load ptr, ptr %6, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.treemap1_node, ptr %95, i32 0, i32 5
  %97 = load ptr, ptr %96, align 8, !tbaa !28
  store ptr %97, ptr %6, align 8, !tbaa !5
  br label %79, !llvm.loop !29

98:                                               ; preds = %92
  %99 = load ptr, ptr %6, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.treemap1_node, ptr %99, i32 0, i32 5
  %101 = load ptr, ptr %100, align 8, !tbaa !28
  %102 = icmp ne ptr %101, null
  br i1 %102, label %104, label %103

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

104:                                              ; preds = %98
  %105 = load ptr, ptr %6, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.treemap1_node, ptr %105, i32 0, i32 5
  %107 = load ptr, ptr %106, align 8, !tbaa !28
  store ptr %107, ptr %6, align 8, !tbaa !5
  br label %109

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

109:                                              ; preds = %104
  br label %110

110:                                              ; preds = %109, %69
  store i32 0, ptr %9, align 4
  br label %111

111:                                              ; preds = %110, %108, %103, %63, %50
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #2
  %112 = load i32, ptr %9, align 4
  switch i32 %112, label %115 [
    i32 0, label %113
    i32 3, label %114
  ]

113:                                              ; preds = %111
  br label %26, !llvm.loop !30

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

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

116:                                              ; preds = %115, %21
  %117 = load i1, ptr %3, align 1
  ret i1 %117
}

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 = !{!"treemap1", !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 224}
!20 = !{!"treemap1_node", !21, i64 0, !21, i64 104, !7, i64 208, !6, i64 216, !6, i64 224, !6, i64 232}
!21 = !{!"struct_s", !12, i64 0, !12, i64 4, !6, i64 8, !6, i64 16, !7, i64 24}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = !{!10, !6, i64 32}
!25 = !{!26, !6, i64 0}
!26 = !{!"treemap1_fval", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!27 = !{!20, !6, i64 216}
!28 = !{!20, !6, i64 232}
!29 = distinct !{!29, !23}
!30 = distinct !{!30, !23}


; 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.struct_s = type { i32, i32, ptr, ptr, [10 x double] }

; Function Attrs: nounwind uwtable
declare hidden ptr @tm1_impl_get_node(ptr noundef, ptr noundef byval(%struct.struct_s) align 8) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local noundef zeroext i1 @tm1_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 224
  %13 = load ptr, ptr %12, align 8, !tbaa !14
  %.not39 = icmp eq ptr %13, null
  br i1 %.not39, label %.loopexit, label %.preheader55, !llvm.loop !17

.loopexit:                                        ; preds = %.preheader55, %.critedge
  %.231 = phi ptr [ %.02959, %.critedge ], [ %.130, %.preheader55 ]
  %14 = tail call ptr @tm1_impl_get_node(ptr noundef %1, ptr noundef nonnull byval(%struct.struct_s) align 8 %.231)
  %15 = icmp eq ptr %14, null
  br i1 %15, label %.thread, label %16

16:                                               ; preds = %.loopexit
  %17 = load ptr, ptr %11, align 8, !tbaa !19
  %18 = load ptr, ptr %17, align 8, !tbaa !20
  %19 = getelementptr inbounds i8, ptr %14, i64 104
  %20 = getelementptr inbounds i8, ptr %.231, i64 104
  %21 = tail call i32 %18(ptr noundef nonnull byval(%struct.struct_s) align 8 %19, ptr noundef nonnull byval(%struct.struct_s) align 8 %20) #1
  %.not40 = icmp eq i32 %21, 0
  br i1 %.not40, label %22, label %.thread

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

.critedge.backedge:                               ; preds = %30, %22
  %.02959.be = phi ptr [ %24, %22 ], [ %29, %30 ]
  br label %.critedge

25:                                               ; preds = %22
  %26 = getelementptr inbounds i8, ptr %.231, i64 232
  %27 = load ptr, ptr %26, align 8, !tbaa !23
  %.not42 = icmp eq ptr %27, null
  br i1 %.not42, label %.thread, label %.preheader

.preheader:                                       ; preds = %25, %30
  %.332 = phi ptr [ %29, %30 ], [ %.231, %25 ]
  %28 = getelementptr inbounds i8, ptr %.332, i64 232
  %29 = load ptr, ptr %28, align 8, !tbaa !23
  %.not43 = icmp eq ptr %29, null
  br i1 %.not43, label %.thread, label %30

30:                                               ; preds = %.preheader
  %31 = getelementptr inbounds i8, ptr %29, i64 216
  %32 = load ptr, ptr %31, align 8, !tbaa !22
  %33 = icmp eq ptr %.332, %32
  br i1 %33, label %.preheader, label %.critedge.backedge, !llvm.loop !24

.thread:                                          ; preds = %.loopexit, %16, %25, %.preheader, %9, %2
  %.3 = phi i1 [ false, %2 ], [ true, %9 ], [ true, %.preheader ], [ true, %25 ], [ false, %16 ], [ 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 = !{!"treemap1", !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 224}
!15 = !{!"treemap1_node", !16, i64 0, !16, i64 104, !8, i64 208, !7, i64 216, !7, i64 224, !7, i64 232}
!16 = !{!"struct_s", !11, i64 0, !11, i64 4, !7, i64 8, !7, i64 16, !8, i64 24}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!6, !7, i64 32}
!20 = !{!21, !7, i64 0}
!21 = !{!"treemap1_fval", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40}
!22 = !{!15, !7, i64 216}
!23 = !{!15, !7, i64 232}
!24 = distinct !{!24, !18}


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