; 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.intervalheap0 = type { ptr, i64, i64, i64, i32, ptr, ptr }
%struct.intervalheap0_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
define dso_local zeroext i1 @ih0_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 i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  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.intervalheap0, ptr %10, i32 0, i32 4
  store i32 0, ptr %11, align 8, !tbaa !9
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.intervalheap0, ptr %12, i32 0, i32 4
  store i32 0, ptr %13, align 8, !tbaa !9
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.intervalheap0, ptr %14, i32 0, i32 3
  %16 = load i64, ptr %15, align 8, !tbaa !13
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.intervalheap0, ptr %17, i32 0, i32 3
  %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 %71

22:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #2
  store i64 0, ptr %6, align 8, !tbaa !14
  br label %23

23:                                               ; preds = %65, %22
  %24 = load i64, ptr %6, align 8, !tbaa !14
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.intervalheap0, ptr %25, i32 0, i32 3
  %27 = load i64, ptr %26, align 8, !tbaa !13
  %28 = icmp ult i64 %24, %27
  br i1 %28, label %30, label %29

29:                                               ; preds = %23
  store i32 2, ptr %7, align 4
  br label %68

30:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #2
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.intervalheap0, ptr %31, i32 0, i32 0
  %33 = load ptr, ptr %32, align 8, !tbaa !15
  %34 = load i64, ptr %6, align 8, !tbaa !14
  %35 = udiv i64 %34, 2
  %36 = getelementptr inbounds [2 x ptr], ptr %33, i64 %35
  %37 = load i64, ptr %6, align 8, !tbaa !14
  %38 = urem i64 %37, 2
  %39 = getelementptr inbounds [2 x ptr], ptr %36, i64 0, i64 %38
  %40 = load ptr, ptr %39, align 8, !tbaa !5
  store ptr %40, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #2
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.intervalheap0, ptr %41, i32 0, i32 0
  %43 = load ptr, ptr %42, align 8, !tbaa !15
  %44 = load i64, ptr %6, align 8, !tbaa !14
  %45 = udiv i64 %44, 2
  %46 = getelementptr inbounds [2 x ptr], ptr %43, i64 %45
  %47 = load i64, ptr %6, align 8, !tbaa !14
  %48 = urem i64 %47, 2
  %49 = getelementptr inbounds [2 x ptr], ptr %46, i64 0, i64 %48
  %50 = load ptr, ptr %49, align 8, !tbaa !5
  store ptr %50, ptr %9, align 8, !tbaa !5
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.intervalheap0, ptr %51, i32 0, i32 5
  %53 = load ptr, ptr %52, align 8, !tbaa !16
  %54 = getelementptr inbounds %struct.intervalheap0_fval, ptr %53, i32 0, i32 0
  %55 = load ptr, ptr %54, align 8, !tbaa !17
  %56 = load ptr, ptr %8, align 8, !tbaa !5
  %57 = load ptr, ptr %9, align 8, !tbaa !5
  %58 = call i32 %55(ptr noundef %56, ptr noundef %57)
  %59 = icmp ne i32 %58, 0
  br i1 %59, label %60, label %61

60:                                               ; preds = %30
  store i1 false, ptr %3, align 1
  store i32 1, ptr %7, align 4
  br label %62

61:                                               ; preds = %30
  store i32 0, ptr %7, align 4
  br label %62

62:                                               ; preds = %61, %60
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #2
  %63 = load i32, ptr %7, align 4
  switch i32 %63, label %68 [
    i32 0, label %64
  ]

64:                                               ; preds = %62
  br label %65

65:                                               ; preds = %64
  %66 = load i64, ptr %6, align 8, !tbaa !14
  %67 = add i64 %66, 1
  store i64 %67, ptr %6, align 8, !tbaa !14
  br label %23, !llvm.loop !19

68:                                               ; preds = %62, %29
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #2
  %69 = load i32, ptr %7, align 4
  switch i32 %69, label %73 [
    i32 2, label %70
    i32 1, label %71
  ]

70:                                               ; preds = %68
  store i1 true, ptr %3, align 1
  br label %71

71:                                               ; preds = %70, %68, %21
  %72 = load i1, ptr %3, align 1
  ret i1 %72

73:                                               ; preds = %68
  unreachable
}

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 32}
!10 = !{!"intervalheap0", !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 = !{!11, !11, i64 0}
!15 = !{!10, !6, i64 0}
!16 = !{!10, !6, i64 40}
!17 = !{!18, !6, i64 0}
!18 = !{!"intervalheap0_fval", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}


; 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
define dso_local noundef zeroext i1 @ih0_equals(ptr nocapture noundef %0, ptr nocapture noundef %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 32
  store i32 0, ptr %3, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %1, i64 32
  store i32 0, ptr %4, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 24
  %6 = load i64, ptr %5, align 8, !tbaa !12
  %7 = getelementptr inbounds i8, ptr %1, i64 24
  %8 = load i64, ptr %7, align 8, !tbaa !12
  %.not = icmp eq i64 %6, %8
  br i1 %.not, label %.preheader, label %.loopexit

.preheader:                                       ; preds = %2
  %9 = icmp eq i64 %6, 0
  br i1 %9, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader
  %10 = getelementptr inbounds i8, ptr %0, i64 40
  br label %14

11:                                               ; preds = %14
  %12 = add nuw i64 %.01822, 1
  %13 = load i64, ptr %5, align 8, !tbaa !12
  %.not25 = icmp ult i64 %12, %13
  br i1 %.not25, label %14, label %.loopexit, !llvm.loop !13

14:                                               ; preds = %.lr.ph, %11
  %.01822 = phi i64 [ 0, %.lr.ph ], [ %12, %11 ]
  %15 = load ptr, ptr %0, align 8, !tbaa !15
  %16 = lshr i64 %.01822, 1
  %17 = and i64 %.01822, 1
  %18 = getelementptr inbounds [2 x ptr], ptr %15, i64 %16, i64 %17
  %19 = load ptr, ptr %18, align 8, !tbaa !16
  %20 = load ptr, ptr %1, align 8, !tbaa !15
  %21 = getelementptr inbounds [2 x ptr], ptr %20, i64 %16, i64 %17
  %22 = load ptr, ptr %21, align 8, !tbaa !16
  %23 = load ptr, ptr %10, align 8, !tbaa !17
  %24 = load ptr, ptr %23, align 8, !tbaa !18
  %25 = tail call i32 %24(ptr noundef %19, ptr noundef %22) #1
  %.not21 = icmp eq i32 %25, 0
  br i1 %.not21, label %11, label %.loopexit

.loopexit:                                        ; preds = %11, %14, %.preheader, %2
  %.3 = phi i1 [ false, %2 ], [ true, %.preheader ], [ %.not21, %14 ], [ %.not21, %11 ]
  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 32}
!6 = !{!"intervalheap0", !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 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!6, !7, i64 0}
!16 = !{!7, !7, i64 0}
!17 = !{!6, !7, i64 40}
!18 = !{!19, !7, i64 0}
!19 = !{!"intervalheap0_fval", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40}


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