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

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

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @ih0_remove_min(ptr noundef %0) #0 {
  %2 = alloca i1, align 1
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = call zeroext i1 @ih0_empty(ptr noundef %8)
  br i1 %9, label %10, label %13

10:                                               ; preds = %1
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.intervalheap0, ptr %11, i32 0, i32 4
  store i32 2, ptr %12, align 8, !tbaa !9
  store i1 false, ptr %2, align 1
  br label %81

13:                                               ; preds = %1
  %14 = load ptr, ptr %3, 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 = icmp eq i64 %16, 1
  br i1 %17, label %18, label %33

18:                                               ; preds = %13
  store ptr null, ptr %4, align 8, !tbaa !5
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.intervalheap0, ptr %20, i32 0, i32 0
  %22 = load ptr, ptr %21, align 8, !tbaa !14
  %23 = getelementptr inbounds [2 x ptr], ptr %22, i64 0
  %24 = getelementptr inbounds [2 x ptr], ptr %23, i64 0, i64 0
  store ptr %19, ptr %24, align 8, !tbaa !5
  %25 = load ptr, ptr %3, 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 = add i64 %27, -1
  store i64 %28, ptr %26, align 8, !tbaa !13
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.intervalheap0, ptr %29, i32 0, i32 2
  %31 = load i64, ptr %30, align 8, !tbaa !15
  %32 = add i64 %31, -1
  store i64 %32, ptr %30, align 8, !tbaa !15
  br label %78

33:                                               ; preds = %13
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.intervalheap0, ptr %34, i32 0, i32 0
  %36 = load ptr, ptr %35, align 8, !tbaa !14
  %37 = load ptr, ptr %3, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.intervalheap0, ptr %37, i32 0, i32 2
  %39 = load i64, ptr %38, align 8, !tbaa !15
  %40 = sub i64 %39, 1
  %41 = getelementptr inbounds [2 x ptr], ptr %36, i64 %40
  store ptr %41, ptr %5, align 8, !tbaa !5
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = getelementptr inbounds [2 x ptr], ptr %42, i64 0, i64 0
  %44 = load ptr, ptr %43, align 8, !tbaa !5
  %45 = load ptr, ptr %3, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.intervalheap0, ptr %45, i32 0, i32 0
  %47 = load ptr, ptr %46, align 8, !tbaa !14
  %48 = getelementptr inbounds [2 x ptr], ptr %47, i64 0
  %49 = getelementptr inbounds [2 x ptr], ptr %48, i64 0, i64 0
  store ptr %44, ptr %49, align 8, !tbaa !5
  %50 = load ptr, ptr %3, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.intervalheap0, ptr %50, i32 0, i32 3
  %52 = load i64, ptr %51, align 8, !tbaa !13
  %53 = urem i64 %52, 2
  %54 = icmp eq i64 %53, 1
  br i1 %54, label %55, label %63

55:                                               ; preds = %33
  store ptr null, ptr %6, align 8, !tbaa !5
  %56 = load ptr, ptr %6, align 8, !tbaa !5
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = getelementptr inbounds [2 x ptr], ptr %57, i64 0, i64 0
  store ptr %56, ptr %58, align 8, !tbaa !5
  %59 = load ptr, ptr %3, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.intervalheap0, ptr %59, i32 0, i32 2
  %61 = load i64, ptr %60, align 8, !tbaa !15
  %62 = add i64 %61, -1
  store i64 %62, ptr %60, align 8, !tbaa !15
  br label %72

63:                                               ; preds = %33
  %64 = load ptr, ptr %5, align 8, !tbaa !5
  %65 = getelementptr inbounds [2 x ptr], ptr %64, i64 0, i64 1
  %66 = load ptr, ptr %65, align 8, !tbaa !5
  %67 = load ptr, ptr %5, align 8, !tbaa !5
  %68 = getelementptr inbounds [2 x ptr], ptr %67, i64 0, i64 0
  store ptr %66, ptr %68, align 8, !tbaa !5
  store ptr null, ptr %7, align 8, !tbaa !5
  %69 = load ptr, ptr %7, align 8, !tbaa !5
  %70 = load ptr, ptr %5, align 8, !tbaa !5
  %71 = getelementptr inbounds [2 x ptr], ptr %70, i64 0, i64 1
  store ptr %69, ptr %71, align 8, !tbaa !5
  br label %72

72:                                               ; preds = %63, %55
  %73 = load ptr, ptr %3, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.intervalheap0, ptr %73, i32 0, i32 3
  %75 = load i64, ptr %74, align 8, !tbaa !13
  %76 = add i64 %75, -1
  store i64 %76, ptr %74, align 8, !tbaa !13
  %77 = load ptr, ptr %3, align 8, !tbaa !5
  call void @ih0_impl_float_down_min(ptr noundef %77)
  br label %78

78:                                               ; preds = %72, %18
  %79 = load ptr, ptr %3, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.intervalheap0, ptr %79, i32 0, i32 4
  store i32 0, ptr %80, align 8, !tbaa !9
  store i1 true, ptr %2, align 1
  br label %81

81:                                               ; preds = %78, %10
  %82 = load i1, ptr %2, align 1
  ret i1 %82
}

; Function Attrs: nounwind uwtable
declare hidden void @ih0_impl_float_down_min(ptr noundef) #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, !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 = !{!10, !6, i64 0}
!15 = !{!10, !11, i64 16}


; 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 dso_local zeroext i1 @ih0_empty(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local noundef zeroext i1 @ih0_remove_min(ptr noundef %0) local_unnamed_addr #0 {
  %2 = tail call zeroext i1 @ih0_empty(ptr noundef %0)
  br i1 %2, label %26, label %3

3:                                                ; preds = %1
  %4 = getelementptr inbounds i8, ptr %0, i64 24
  %5 = load i64, ptr %4, align 8, !tbaa !5
  %6 = icmp eq i64 %5, 1
  %7 = load ptr, ptr %0, align 8, !tbaa !12
  br i1 %6, label %8, label %12

8:                                                ; preds = %3
  store ptr null, ptr %7, align 8, !tbaa !13
  store i64 0, ptr %4, align 8, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %0, i64 16
  %10 = load i64, ptr %9, align 8, !tbaa !14
  %11 = add i64 %10, -1
  store i64 %11, ptr %9, align 8, !tbaa !14
  br label %26

12:                                               ; preds = %3
  %13 = getelementptr inbounds i8, ptr %0, i64 16
  %14 = load i64, ptr %13, align 8, !tbaa !14
  %15 = getelementptr [2 x ptr], ptr %7, i64 %14
  %16 = getelementptr i8, ptr %15, i64 -16
  %17 = load ptr, ptr %16, align 8, !tbaa !13
  store ptr %17, ptr %7, align 8, !tbaa !13
  %18 = and i64 %5, 1
  %.not = icmp eq i64 %18, 0
  br i1 %.not, label %21, label %19

19:                                               ; preds = %12
  %20 = add i64 %14, -1
  store i64 %20, ptr %13, align 8, !tbaa !14
  br label %24

21:                                               ; preds = %12
  %22 = getelementptr i8, ptr %15, i64 -8
  %23 = load ptr, ptr %22, align 8, !tbaa !13
  store ptr null, ptr %22, align 8, !tbaa !13
  br label %24

24:                                               ; preds = %21, %19
  %.sink = phi ptr [ %23, %21 ], [ null, %19 ]
  store ptr %.sink, ptr %16, align 8
  %25 = add i64 %5, -1
  store i64 %25, ptr %4, align 8, !tbaa !5
  tail call void @ih0_impl_float_down_min(ptr noundef nonnull %0)
  br label %26

26:                                               ; preds = %8, %24, %1
  %.sink23 = phi i32 [ 2, %1 ], [ 0, %24 ], [ 0, %8 ]
  %27 = getelementptr inbounds i8, ptr %0, i64 32
  store i32 %.sink23, ptr %27, align 8, !tbaa !15
  %.0 = xor i1 %2, true
  ret i1 %.0
}

; Function Attrs: nounwind uwtable
declare hidden void @ih0_impl_float_down_min(ptr noundef) local_unnamed_addr #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, !10, i64 24}
!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, !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = !{!6, !10, i64 16}
!15 = !{!6, !11, i64 32}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InstCombinePass,MergedLoadStoreMotionPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass