; 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.intervalheap2 = type { ptr, i64, i64, i64, i32, ptr, ptr }
%struct.intervalheap2_fval = type { ptr, ptr, ptr, ptr, ptr, ptr }

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

; Function Attrs: nounwind uwtable
declare hidden void @ih2_impl_float_down_min(ptr noundef) #0

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

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

11:                                               ; preds = %2
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.intervalheap2, ptr %12, i32 0, i32 3
  %14 = load i64, ptr %13, align 8, !tbaa !14
  %15 = icmp eq i64 %14, 1
  br i1 %15, label %16, label %23

16:                                               ; preds = %11
  %17 = load i32, ptr %5, align 4, !tbaa !9
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.intervalheap2, ptr %18, i32 0, i32 0
  %20 = load ptr, ptr %19, align 8, !tbaa !15
  %21 = getelementptr inbounds [2 x i32], ptr %20, i64 0
  %22 = getelementptr inbounds [2 x i32], ptr %21, i64 0, i64 0
  store i32 %17, ptr %22, align 4, !tbaa !9
  br label %66

23:                                               ; preds = %11
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.intervalheap2, ptr %24, i32 0, i32 5
  %26 = load ptr, ptr %25, align 8, !tbaa !16
  %27 = getelementptr inbounds %struct.intervalheap2_fval, ptr %26, i32 0, i32 0
  %28 = load ptr, ptr %27, align 8, !tbaa !17
  %29 = load i32, ptr %5, align 4, !tbaa !9
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.intervalheap2, ptr %30, i32 0, i32 0
  %32 = load ptr, ptr %31, align 8, !tbaa !15
  %33 = getelementptr inbounds [2 x i32], ptr %32, i64 0
  %34 = getelementptr inbounds [2 x i32], ptr %33, i64 0, i64 1
  %35 = load i32, ptr %34, align 4, !tbaa !9
  %36 = call i32 %28(i32 noundef %29, i32 noundef %35)
  %37 = icmp sgt i32 %36, 0
  br i1 %37, label %38, label %57

38:                                               ; preds = %23
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.intervalheap2, ptr %39, i32 0, i32 0
  %41 = load ptr, ptr %40, align 8, !tbaa !15
  %42 = getelementptr inbounds [2 x i32], ptr %41, i64 0
  %43 = getelementptr inbounds [2 x i32], ptr %42, i64 0, i64 1
  %44 = load i32, ptr %43, align 4, !tbaa !9
  %45 = load ptr, ptr %4, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.intervalheap2, ptr %45, i32 0, i32 0
  %47 = load ptr, ptr %46, align 8, !tbaa !15
  %48 = getelementptr inbounds [2 x i32], ptr %47, i64 0
  %49 = getelementptr inbounds [2 x i32], ptr %48, i64 0, i64 0
  store i32 %44, ptr %49, align 4, !tbaa !9
  %50 = load i32, ptr %5, align 4, !tbaa !9
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.intervalheap2, ptr %51, i32 0, i32 0
  %53 = load ptr, ptr %52, align 8, !tbaa !15
  %54 = getelementptr inbounds [2 x i32], ptr %53, i64 0
  %55 = getelementptr inbounds [2 x i32], ptr %54, i64 0, i64 1
  store i32 %50, ptr %55, align 4, !tbaa !9
  %56 = load ptr, ptr %4, align 8, !tbaa !5
  call void @ih2_impl_float_down_min(ptr noundef %56)
  br label %65

57:                                               ; preds = %23
  %58 = load i32, ptr %5, align 4, !tbaa !9
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.intervalheap2, ptr %59, i32 0, i32 0
  %61 = load ptr, ptr %60, align 8, !tbaa !15
  %62 = getelementptr inbounds [2 x i32], ptr %61, i64 0
  %63 = getelementptr inbounds [2 x i32], ptr %62, i64 0, i64 0
  store i32 %58, ptr %63, align 4, !tbaa !9
  %64 = load ptr, ptr %4, align 8, !tbaa !5
  call void @ih2_impl_float_down_min(ptr noundef %64)
  br label %65

65:                                               ; preds = %57, %38
  br label %66

66:                                               ; preds = %65, %16
  %67 = load ptr, ptr %4, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.intervalheap2, ptr %67, i32 0, i32 4
  store i32 0, ptr %68, align 8, !tbaa !11
  store i1 true, ptr %3, align 1
  br label %69

69:                                               ; preds = %66, %8
  %70 = load i1, ptr %3, align 1
  ret i1 %70
}

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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 32}
!12 = !{!"intervalheap2", !6, i64 0, !13, i64 8, !13, i64 16, !13, i64 24, !10, i64 32, !6, i64 40, !6, i64 48}
!13 = !{!"long", !7, i64 0}
!14 = !{!12, !13, i64 24}
!15 = !{!12, !6, i64 0}
!16 = !{!12, !6, i64 40}
!17 = !{!18, !6, i64 0}
!18 = !{!"intervalheap2_fval", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}


; 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 @ih2_empty(ptr noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
define dso_local noundef zeroext i1 @ih2_update_min(ptr noundef %0, i32 noundef %1) local_unnamed_addr #0 {
  %3 = tail call zeroext i1 @ih2_empty(ptr noundef %0)
  br i1 %3, label %24, label %4

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

8:                                                ; preds = %4
  %9 = load ptr, ptr %0, align 8, !tbaa !12
  store i32 %1, ptr %9, align 4, !tbaa !13
  br label %24

10:                                               ; preds = %4
  %11 = getelementptr inbounds i8, ptr %0, i64 40
  %12 = load ptr, ptr %11, align 8, !tbaa !14
  %13 = load ptr, ptr %12, align 8, !tbaa !15
  %14 = load ptr, ptr %0, align 8, !tbaa !12
  %15 = getelementptr inbounds i8, ptr %14, i64 4
  %16 = load i32, ptr %15, align 4, !tbaa !13
  %17 = tail call i32 %13(i32 noundef %1, i32 noundef %16) #1
  %18 = icmp sgt i32 %17, 0
  %19 = load ptr, ptr %0, align 8, !tbaa !12
  br i1 %18, label %20, label %23

20:                                               ; preds = %10
  %21 = getelementptr inbounds i8, ptr %19, i64 4
  %22 = load i32, ptr %21, align 4, !tbaa !13
  store i32 %22, ptr %19, align 4, !tbaa !13
  store i32 %1, ptr %21, align 4, !tbaa !13
  tail call void @ih2_impl_float_down_min(ptr noundef nonnull %0)
  br label %24

23:                                               ; preds = %10
  store i32 %1, ptr %19, align 4, !tbaa !13
  tail call void @ih2_impl_float_down_min(ptr noundef nonnull %0)
  br label %24

24:                                               ; preds = %8, %23, %20, %2
  %.sink = phi i32 [ 2, %2 ], [ 0, %20 ], [ 0, %23 ], [ 0, %8 ]
  %25 = getelementptr inbounds i8, ptr %0, i64 32
  store i32 %.sink, ptr %25, align 8, !tbaa !17
  %.0 = xor i1 %3, true
  ret i1 %.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" }
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, !10, i64 24}
!6 = !{!"intervalheap2", !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 = !{!11, !11, i64 0}
!14 = !{!6, !7, i64 40}
!15 = !{!16, !7, i64 0}
!16 = !{!"intervalheap2_fval", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40}
!17 = !{!6, !11, i64 32}


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