; 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"

%union.union_u = type { %struct.struct_s }
%struct.struct_s = type { i32, i32, ptr, ptr, [10 x double] }
%struct.intervalheap6 = type { ptr, i64, i64, i64, i32, ptr, ptr }
%struct.intervalheap6_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: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @ih6_insert(ptr noundef %0, ptr noundef byval(%union.union_u) align 8 %1) #3 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca %union.union_u, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  %8 = load ptr, ptr %4, align 8, !tbaa !5
  %9 = call zeroext i1 @ih6_full(ptr noundef %8)
  br i1 %9, label %10, label %19

10:                                               ; preds = %2
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.intervalheap6, ptr %12, i32 0, i32 1
  %14 = load i64, ptr %13, align 8, !tbaa !9
  %15 = mul i64 %14, 4
  %16 = call zeroext i1 @ih6_resize(ptr noundef %11, i64 noundef %15)
  br i1 %16, label %18, label %17

17:                                               ; preds = %10
  store i1 false, ptr %3, align 1
  br label %122

18:                                               ; preds = %10
  br label %19

19:                                               ; preds = %18, %2
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.intervalheap6, ptr %20, i32 0, i32 3
  %22 = load i64, ptr %21, align 8, !tbaa !13
  %23 = urem i64 %22, 2
  %24 = icmp eq i64 %23, 0
  br i1 %24, label %25, label %46

25:                                               ; preds = %19
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.intervalheap6, ptr %26, i32 0, i32 0
  %28 = load ptr, ptr %27, align 8, !tbaa !14
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.intervalheap6, ptr %29, i32 0, i32 2
  %31 = load i64, ptr %30, align 8, !tbaa !15
  %32 = getelementptr inbounds [2 x %union.union_u], ptr %28, i64 %31
  %33 = getelementptr inbounds [2 x %union.union_u], ptr %32, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %33, ptr align 8 %1, i64 104, i1 false), !tbaa.struct !16
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.intervalheap6, ptr %34, i32 0, i32 0
  %36 = load ptr, ptr %35, align 8, !tbaa !14
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.intervalheap6, ptr %37, i32 0, i32 2
  %39 = load i64, ptr %38, align 8, !tbaa !15
  %40 = getelementptr inbounds [2 x %union.union_u], ptr %36, i64 %39
  %41 = getelementptr inbounds [2 x %union.union_u], ptr %40, i64 0, i64 1
  call void @llvm.memset.p0.i64(ptr align 8 %5, i8 0, i64 104, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %41, ptr align 8 %5, i64 104, i1 false), !tbaa.struct !16
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.intervalheap6, ptr %42, i32 0, i32 2
  %44 = load i64, ptr %43, align 8, !tbaa !15
  %45 = add i64 %44, 1
  store i64 %45, ptr %43, align 8, !tbaa !15
  br label %75

46:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.intervalheap6, ptr %47, i32 0, i32 0
  %49 = load ptr, ptr %48, align 8, !tbaa !14
  %50 = load ptr, ptr %4, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.intervalheap6, ptr %50, i32 0, i32 2
  %52 = load i64, ptr %51, align 8, !tbaa !15
  %53 = sub i64 %52, 1
  %54 = getelementptr inbounds [2 x %union.union_u], ptr %49, i64 %53
  store ptr %54, ptr %6, align 8, !tbaa !5
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.intervalheap6, ptr %55, i32 0, i32 5
  %57 = load ptr, ptr %56, align 8, !tbaa !18
  %58 = getelementptr inbounds %struct.intervalheap6_fval, ptr %57, i32 0, i32 0
  %59 = load ptr, ptr %58, align 8, !tbaa !19
  %60 = load ptr, ptr %6, align 8, !tbaa !5
  %61 = getelementptr inbounds [2 x %union.union_u], ptr %60, i64 0, i64 0
  %62 = call i32 %59(ptr noundef byval(%union.union_u) align 8 %61, ptr noundef byval(%union.union_u) align 8 %1)
  %63 = icmp sgt i32 %62, 0
  br i1 %63, label %64, label %71

64:                                               ; preds = %46
  %65 = load ptr, ptr %6, align 8, !tbaa !5
  %66 = getelementptr inbounds [2 x %union.union_u], ptr %65, i64 0, i64 1
  %67 = load ptr, ptr %6, align 8, !tbaa !5
  %68 = getelementptr inbounds [2 x %union.union_u], ptr %67, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %66, ptr align 8 %68, i64 104, i1 false), !tbaa.struct !16
  %69 = load ptr, ptr %6, align 8, !tbaa !5
  %70 = getelementptr inbounds [2 x %union.union_u], ptr %69, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %70, ptr align 8 %1, i64 104, i1 false), !tbaa.struct !16
  br label %74

71:                                               ; preds = %46
  %72 = load ptr, ptr %6, align 8, !tbaa !5
  %73 = getelementptr inbounds [2 x %union.union_u], ptr %72, i64 0, i64 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %73, ptr align 8 %1, i64 104, i1 false), !tbaa.struct !16
  br label %74

74:                                               ; preds = %71, %64
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  br label %75

75:                                               ; preds = %74, %25
  %76 = load ptr, ptr %4, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.intervalheap6, ptr %76, i32 0, i32 3
  %78 = load i64, ptr %77, align 8, !tbaa !13
  %79 = add i64 %78, 1
  store i64 %79, ptr %77, align 8, !tbaa !13
  %80 = load ptr, ptr %4, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.intervalheap6, ptr %80, i32 0, i32 4
  store i32 0, ptr %81, align 8, !tbaa !21
  %82 = load ptr, ptr %4, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.intervalheap6, ptr %82, i32 0, i32 3
  %84 = load i64, ptr %83, align 8, !tbaa !13
  %85 = icmp ugt i64 %84, 2
  br i1 %85, label %86, label %121

86:                                               ; preds = %75
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %87 = load ptr, ptr %4, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.intervalheap6, ptr %87, i32 0, i32 0
  %89 = load ptr, ptr %88, align 8, !tbaa !14
  %90 = load ptr, ptr %4, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.intervalheap6, ptr %90, i32 0, i32 2
  %92 = load i64, ptr %91, align 8, !tbaa !15
  %93 = sub i64 %92, 2
  %94 = udiv i64 %93, 2
  %95 = getelementptr inbounds [2 x %union.union_u], ptr %89, i64 %94
  store ptr %95, ptr %7, align 8, !tbaa !5
  %96 = load ptr, ptr %4, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.intervalheap6, ptr %96, i32 0, i32 5
  %98 = load ptr, ptr %97, align 8, !tbaa !18
  %99 = getelementptr inbounds %struct.intervalheap6_fval, ptr %98, i32 0, i32 0
  %100 = load ptr, ptr %99, align 8, !tbaa !19
  %101 = load ptr, ptr %7, align 8, !tbaa !5
  %102 = getelementptr inbounds [2 x %union.union_u], ptr %101, i64 0, i64 0
  %103 = call i32 %100(ptr noundef byval(%union.union_u) align 8 %102, ptr noundef byval(%union.union_u) align 8 %1)
  %104 = icmp sgt i32 %103, 0
  br i1 %104, label %105, label %107

105:                                              ; preds = %86
  %106 = load ptr, ptr %4, align 8, !tbaa !5
  call void @ih6_impl_float_up_min(ptr noundef %106)
  br label %120

107:                                              ; preds = %86
  %108 = load ptr, ptr %4, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.intervalheap6, ptr %108, i32 0, i32 5
  %110 = load ptr, ptr %109, align 8, !tbaa !18
  %111 = getelementptr inbounds %struct.intervalheap6_fval, ptr %110, i32 0, i32 0
  %112 = load ptr, ptr %111, align 8, !tbaa !19
  %113 = load ptr, ptr %7, align 8, !tbaa !5
  %114 = getelementptr inbounds [2 x %union.union_u], ptr %113, i64 0, i64 1
  %115 = call i32 %112(ptr noundef byval(%union.union_u) align 8 %114, ptr noundef byval(%union.union_u) align 8 %1)
  %116 = icmp slt i32 %115, 0
  br i1 %116, label %117, label %119

117:                                              ; preds = %107
  %118 = load ptr, ptr %4, align 8, !tbaa !5
  call void @ih6_impl_float_up_max(ptr noundef %118)
  br label %119

119:                                              ; preds = %117, %107
  br label %120

120:                                              ; preds = %119, %105
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  br label %121

121:                                              ; preds = %120, %75
  store i1 true, ptr %3, align 1
  br label %122

122:                                              ; preds = %121, %17
  %123 = load i1, ptr %3, align 1
  ret i1 %123
}

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @ih6_full(ptr noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @ih6_resize(ptr noundef, i64 noundef) #3

; Function Attrs: nounwind uwtable
declare hidden void @ih6_impl_float_up_min(ptr noundef) #3

; Function Attrs: nounwind uwtable
declare hidden void @ih6_impl_float_up_max(ptr noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 8}
!10 = !{!"intervalheap6", !6, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !12, i64 32, !6, i64 40, !6, i64 48}
!11 = !{!"long", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!10, !11, i64 24}
!14 = !{!10, !6, i64 0}
!15 = !{!10, !11, i64 16}
!16 = !{i64 0, i64 104, !17}
!17 = !{!7, !7, i64 0}
!18 = !{!10, !6, i64 40}
!19 = !{!20, !6, i64 0}
!20 = !{!"intervalheap6_fval", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!21 = !{!10, !12, i64 32}


; 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"

%union.union_u = type { %struct.struct_s }
%struct.struct_s = type { i32, i32, ptr, ptr, [10 x double] }

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #0

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; Function Attrs: nounwind uwtable
define dso_local noundef zeroext i1 @ih6_insert(ptr noundef %0, ptr noundef byval(%union.union_u) align 8 %1) local_unnamed_addr #2 {
  %3 = tail call zeroext i1 @ih6_full(ptr noundef %0)
  br i1 %3, label %4, label %9

4:                                                ; preds = %2
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  %6 = load i64, ptr %5, align 8, !tbaa !5
  %7 = shl i64 %6, 2
  %8 = tail call zeroext i1 @ih6_resize(ptr noundef %0, i64 noundef %7)
  br i1 %8, label %9, label %59

9:                                                ; preds = %4, %2
  %10 = getelementptr inbounds i8, ptr %0, i64 24
  %11 = load i64, ptr %10, align 8, !tbaa !12
  %12 = and i64 %11, 1
  %13 = icmp eq i64 %12, 0
  %14 = load ptr, ptr %0, align 8, !tbaa !13
  %15 = getelementptr inbounds i8, ptr %0, i64 16
  %16 = load i64, ptr %15, align 8, !tbaa !14
  %17 = getelementptr [2 x %union.union_u], ptr %14, i64 %16
  br i1 %13, label %18, label %24

18:                                               ; preds = %9
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %17, ptr noundef nonnull align 8 dereferenceable(104) %1, i64 104, i1 false), !tbaa.struct !15
  %19 = load ptr, ptr %0, align 8, !tbaa !13
  %20 = load i64, ptr %15, align 8, !tbaa !14
  %21 = getelementptr inbounds [2 x %union.union_u], ptr %19, i64 %20, i64 1
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %21, i8 0, i64 104, i1 false)
  %22 = load i64, ptr %15, align 8, !tbaa !14
  %23 = add i64 %22, 1
  store i64 %23, ptr %15, align 8, !tbaa !14
  br label %34

24:                                               ; preds = %9
  %25 = getelementptr i8, ptr %17, i64 -208
  %26 = getelementptr inbounds i8, ptr %0, i64 40
  %27 = load ptr, ptr %26, align 8, !tbaa !17
  %28 = load ptr, ptr %27, align 8, !tbaa !18
  %29 = tail call i32 %28(ptr noundef byval(%union.union_u) align 8 %25, ptr noundef nonnull byval(%union.union_u) align 8 %1) #3
  %30 = icmp sgt i32 %29, 0
  %31 = getelementptr i8, ptr %17, i64 -104
  br i1 %30, label %32, label %33

32:                                               ; preds = %24
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %31, ptr noundef nonnull align 8 dereferenceable(104) %25, i64 104, i1 false), !tbaa.struct !15
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %25, ptr noundef nonnull align 8 dereferenceable(104) %1, i64 104, i1 false), !tbaa.struct !15
  br label %34

33:                                               ; preds = %24
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %31, ptr noundef nonnull align 8 dereferenceable(104) %1, i64 104, i1 false), !tbaa.struct !15
  br label %34

34:                                               ; preds = %32, %33, %18
  %35 = load i64, ptr %10, align 8, !tbaa !12
  %36 = add i64 %35, 1
  store i64 %36, ptr %10, align 8, !tbaa !12
  %37 = getelementptr inbounds i8, ptr %0, i64 32
  store i32 0, ptr %37, align 8, !tbaa !20
  %38 = icmp ugt i64 %36, 2
  br i1 %38, label %39, label %59

39:                                               ; preds = %34
  %40 = load ptr, ptr %0, align 8, !tbaa !13
  %41 = getelementptr inbounds i8, ptr %0, i64 16
  %42 = load i64, ptr %41, align 8, !tbaa !14
  %43 = add i64 %42, -2
  %44 = lshr i64 %43, 1
  %45 = getelementptr inbounds [2 x %union.union_u], ptr %40, i64 %44
  %46 = getelementptr inbounds i8, ptr %0, i64 40
  %47 = load ptr, ptr %46, align 8, !tbaa !17
  %48 = load ptr, ptr %47, align 8, !tbaa !18
  %49 = tail call i32 %48(ptr noundef byval(%union.union_u) align 8 %45, ptr noundef nonnull byval(%union.union_u) align 8 %1) #3
  %50 = icmp sgt i32 %49, 0
  br i1 %50, label %51, label %52

51:                                               ; preds = %39
  tail call void @ih6_impl_float_up_min(ptr noundef nonnull %0)
  br label %59

52:                                               ; preds = %39
  %53 = load ptr, ptr %46, align 8, !tbaa !17
  %54 = load ptr, ptr %53, align 8, !tbaa !18
  %55 = getelementptr inbounds i8, ptr %45, i64 104
  %56 = tail call i32 %54(ptr noundef nonnull byval(%union.union_u) align 8 %55, ptr noundef nonnull byval(%union.union_u) align 8 %1) #3
  %57 = icmp slt i32 %56, 0
  br i1 %57, label %58, label %59

58:                                               ; preds = %52
  tail call void @ih6_impl_float_up_max(ptr noundef nonnull %0)
  br label %59

59:                                               ; preds = %34, %52, %58, %51, %4
  %.0 = phi i1 [ false, %4 ], [ true, %51 ], [ true, %58 ], [ true, %52 ], [ true, %34 ]
  ret i1 %.0
}

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @ih6_full(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @ih6_resize(ptr noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden void @ih6_impl_float_up_min(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden void @ih6_impl_float_up_max(ptr noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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, !10, i64 8}
!6 = !{!"intervalheap6", !7, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !11, i64 32, !7, i64 40, !7, i64 48}
!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 24}
!13 = !{!6, !7, i64 0}
!14 = !{!6, !10, i64 16}
!15 = !{i64 0, i64 104, !16}
!16 = !{!8, !8, i64 0}
!17 = !{!6, !7, i64 40}
!18 = !{!19, !7, i64 0}
!19 = !{!"intervalheap6_fval", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40}
!20 = !{!6, !11, i64 32}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass