; LLVM IR from ryanlayer/giggle :: test/unit/unity (unity)

; 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._Unity = type { ptr, ptr, ptr, ptr, i64, i64, i64, i64, i64, i64, [1 x %struct.__jmp_buf_tag] }
%struct.__jmp_buf_tag = type { [8 x i64], i32, %struct.__sigset_t }
%struct.__sigset_t = type { [16 x i64] }

@Unity = external dso_local global %struct._Unity, align 8
@UnityStrExpected = external hidden constant [11 x i8], align 1
@UnityStrWas = external hidden constant [6 x i8], align 1
@__const.UnityAssertFloatSpecial.trait_names = external hidden unnamed_addr constant [4 x ptr], align 16
@UnityStrInvalidFloatTrait = external hidden constant [20 x i8], align 16
@UnityStrNot = external hidden constant [5 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @UnityPrint(ptr noundef) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nounwind uwtable
declare hidden void @UnityTestResultsFailBegin(i64 noundef) #0

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

; Function Attrs: noreturn nounwind
declare void @longjmp(ptr noundef, i32 noundef) #2

; Function Attrs: nounwind uwtable
define dso_local void @UnityAssertFloatSpecial(float noundef %0, ptr noundef %1, i64 noundef %2, i32 noundef %3) #0 {
  %5 = alloca float, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca [4 x ptr], align 16
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i32, align 4
  store float %0, ptr %5, align 4, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !9
  store i64 %2, ptr %7, align 8, !tbaa !11
  store i32 %3, ptr %8, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 32, ptr %9) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %9, ptr align 16 @__const.UnityAssertFloatSpecial.trait_names, i64 32, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %14 = load i32, ptr %8, align 4, !tbaa !13
  %15 = zext i32 %14 to i64
  %16 = and i64 %15, 1
  store i64 %16, ptr %10, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %17 = load i64, ptr %10, align 8, !tbaa !11
  %18 = icmp ne i64 %17, 0
  %19 = xor i1 %18, true
  %20 = zext i1 %19 to i32
  %21 = sext i32 %20 to i64
  store i64 %21, ptr %11, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %22 = load i32, ptr %8, align 4, !tbaa !13
  %23 = lshr i32 %22, 1
  %24 = zext i32 %23 to i64
  store i64 %24, ptr %12, align 8, !tbaa !11
  %25 = load i64, ptr getelementptr inbounds (%struct._Unity, ptr @Unity, i32 0, i32 8), align 8, !tbaa !15
  %26 = icmp ne i64 %25, 0
  br i1 %26, label %30, label %27

27:                                               ; preds = %4
  %28 = load i64, ptr getelementptr inbounds (%struct._Unity, ptr @Unity, i32 0, i32 9), align 8, !tbaa !17
  %29 = icmp ne i64 %28, 0
  br i1 %29, label %30, label %31

30:                                               ; preds = %27, %4
  store i32 1, ptr %13, align 4
  br label %106

31:                                               ; preds = %27
  %32 = load i32, ptr %8, align 4, !tbaa !13
  switch i32 %32, label %82 [
    i32 1, label %33
    i32 0, label %33
    i32 3, label %47
    i32 2, label %47
    i32 5, label %61
    i32 4, label %61
    i32 7, label %67
    i32 6, label %67
  ]

33:                                               ; preds = %31, %31
  %34 = load float, ptr %5, align 4, !tbaa !5
  %35 = call float @llvm.fabs.f32(float %34) #6
  %36 = fcmp oeq float %35, 0x7FF0000000000000
  %37 = bitcast float %34 to i32
  %38 = icmp slt i32 %37, 0
  %39 = select i1 %38, i32 -1, i32 1
  %40 = select i1 %36, i32 %39, i32 0
  %41 = load float, ptr %5, align 4, !tbaa !5
  %42 = fcmp ogt float %41, 0.000000e+00
  %43 = zext i1 %42 to i64
  %44 = select i1 %42, i32 1, i32 0
  %45 = and i32 %40, %44
  %46 = sext i32 %45 to i64
  store i64 %46, ptr %11, align 8, !tbaa !11
  br label %84

47:                                               ; preds = %31, %31
  %48 = load float, ptr %5, align 4, !tbaa !5
  %49 = call float @llvm.fabs.f32(float %48) #6
  %50 = fcmp oeq float %49, 0x7FF0000000000000
  %51 = bitcast float %48 to i32
  %52 = icmp slt i32 %51, 0
  %53 = select i1 %52, i32 -1, i32 1
  %54 = select i1 %50, i32 %53, i32 0
  %55 = load float, ptr %5, align 4, !tbaa !5
  %56 = fcmp olt float %55, 0.000000e+00
  %57 = zext i1 %56 to i64
  %58 = select i1 %56, i32 1, i32 0
  %59 = and i32 %54, %58
  %60 = sext i32 %59 to i64
  store i64 %60, ptr %11, align 8, !tbaa !11
  br label %84

61:                                               ; preds = %31, %31
  %62 = load float, ptr %5, align 4, !tbaa !5
  %63 = call i1 @llvm.is.fpclass.f32(float %62, i32 3)
  %64 = zext i1 %63 to i64
  %65 = select i1 %63, i32 1, i32 0
  %66 = sext i32 %65 to i64
  store i64 %66, ptr %11, align 8, !tbaa !11
  br label %84

67:                                               ; preds = %31, %31
  %68 = load float, ptr %5, align 4, !tbaa !5
  %69 = call float @llvm.fabs.f32(float %68) #6
  %70 = fcmp oeq float %69, 0x7FF0000000000000
  %71 = bitcast float %68 to i32
  %72 = icmp slt i32 %71, 0
  %73 = select i1 %72, i32 -1, i32 1
  %74 = select i1 %70, i32 %73, i32 0
  %75 = icmp ne i32 %74, 0
  br i1 %75, label %79, label %76

76:                                               ; preds = %67
  %77 = load float, ptr %5, align 4, !tbaa !5
  %78 = call i1 @llvm.is.fpclass.f32(float %77, i32 3)
  br i1 %78, label %79, label %80

79:                                               ; preds = %76, %67
  store i64 0, ptr %11, align 8, !tbaa !11
  br label %81

80:                                               ; preds = %76
  store i64 1, ptr %11, align 8, !tbaa !11
  br label %81

81:                                               ; preds = %80, %79
  br label %84

82:                                               ; preds = %31
  store i64 0, ptr %12, align 8, !tbaa !11
  %83 = getelementptr inbounds [4 x ptr], ptr %9, i64 0, i64 0
  store ptr @UnityStrInvalidFloatTrait, ptr %83, align 16, !tbaa !9
  br label %84

84:                                               ; preds = %82, %81, %61, %47, %33
  %85 = load i64, ptr %11, align 8, !tbaa !11
  %86 = load i64, ptr %10, align 8, !tbaa !11
  %87 = icmp ne i64 %85, %86
  br i1 %87, label %88, label %105

88:                                               ; preds = %84
  %89 = load i64, ptr %7, align 8, !tbaa !11
  call void @UnityTestResultsFailBegin(i64 noundef %89)
  call void @UnityPrint(ptr noundef @UnityStrExpected)
  %90 = load i64, ptr %10, align 8, !tbaa !11
  %91 = icmp ne i64 %90, 0
  br i1 %91, label %93, label %92

92:                                               ; preds = %88
  call void @UnityPrint(ptr noundef @UnityStrNot)
  br label %93

93:                                               ; preds = %92, %88
  %94 = load i64, ptr %12, align 8, !tbaa !11
  %95 = getelementptr inbounds [4 x ptr], ptr %9, i64 0, i64 %94
  %96 = load ptr, ptr %95, align 8, !tbaa !9
  call void @UnityPrint(ptr noundef %96)
  call void @UnityPrint(ptr noundef @UnityStrWas)
  %97 = load i64, ptr %10, align 8, !tbaa !11
  %98 = icmp ne i64 %97, 0
  br i1 %98, label %99, label %100

99:                                               ; preds = %93
  call void @UnityPrint(ptr noundef @UnityStrNot)
  br label %100

100:                                              ; preds = %99, %93
  %101 = load i64, ptr %12, align 8, !tbaa !11
  %102 = getelementptr inbounds [4 x ptr], ptr %9, i64 0, i64 %101
  %103 = load ptr, ptr %102, align 8, !tbaa !9
  call void @UnityPrint(ptr noundef %103)
  %104 = load ptr, ptr %6, align 8, !tbaa !9
  call void @UnityAddMsgIfSpecified(ptr noundef %104)
  store i64 1, ptr getelementptr inbounds (%struct._Unity, ptr @Unity, i32 0, i32 8), align 8, !tbaa !15
  call void @longjmp(ptr noundef getelementptr inbounds (%struct._Unity, ptr @Unity, i32 0, i32 10), i32 noundef 1) #7
  unreachable

105:                                              ; preds = %84
  store i32 0, ptr %13, align 4
  br label %106

106:                                              ; preds = %105, %30
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #5
  %107 = load i32, ptr %13, align 4
  switch i32 %107, label %109 [
    i32 0, label %108
    i32 1, label %108
  ]

108:                                              ; preds = %106, %106
  ret void

109:                                              ; preds = %106
  unreachable
}

; 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) #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fabs.f32(float) #4

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i1 @llvm.is.fpclass.f32(float, i32 immarg) #4

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { noreturn nounwind "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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
attributes #6 = { memory(none) }
attributes #7 = { noreturn 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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!16, !12, i64 64}
!16 = !{!"_Unity", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !12, i64 32, !12, i64 40, !12, i64 48, !12, i64 56, !12, i64 64, !12, i64 72, !7, i64 80}
!17 = !{!16, !12, i64 72}


; 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._Unity = type { ptr, ptr, ptr, ptr, i64, i64, i64, i64, i64, i64, [1 x %struct.__jmp_buf_tag] }
%struct.__jmp_buf_tag = type { [8 x i64], i32, %struct.__sigset_t }
%struct.__sigset_t = type { [16 x i64] }

@Unity = external dso_local global %struct._Unity, align 8
@UnityStrExpected = external hidden constant [11 x i8], align 1
@UnityStrWas = external hidden constant [6 x i8], align 1
@__const.UnityAssertFloatSpecial.trait_names = external hidden unnamed_addr constant [4 x ptr], align 16
@UnityStrInvalidFloatTrait = external hidden constant [20 x i8], align 16
@UnityStrNot = external hidden constant [5 x i8], align 1

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

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

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

; Function Attrs: noreturn nounwind
declare void @longjmp(ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local void @UnityAssertFloatSpecial(float noundef %0, ptr noundef %1, i64 noundef %2, i32 noundef %3) local_unnamed_addr #0 {
  %5 = alloca [4 x ptr], align 16
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #5
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %5, ptr noundef nonnull align 16 dereferenceable(32) @__const.UnityAssertFloatSpecial.trait_names, i64 32, i1 false)
  %6 = and i32 %3, 1
  %.not = icmp eq i32 %6, 0
  %7 = load i64, ptr getelementptr inbounds (i8, ptr @Unity, i64 64), align 8, !tbaa !5
  %8 = icmp ne i64 %7, 0
  %9 = load i64, ptr getelementptr inbounds (i8, ptr @Unity, i64 72), align 8
  %10 = icmp ne i64 %9, 0
  %or.cond = select i1 %8, i1 true, i1 %10
  br i1 %or.cond, label %30, label %11

11:                                               ; preds = %4
  switch i32 %3, label %.thread [
    i32 1, label %12
    i32 0, label %12
    i32 3, label %14
    i32 2, label %14
    i32 5, label %16
    i32 4, label %16
    i32 7, label %18
    i32 6, label %18
  ]

12:                                               ; preds = %11, %11
  %13 = fcmp oeq float %0, 0x7FF0000000000000
  br label %20

14:                                               ; preds = %11, %11
  %15 = fcmp oeq float %0, 0xFFF0000000000000
  br label %20

16:                                               ; preds = %11, %11
  %17 = fcmp uno float %0, 0.000000e+00
  br label %20

18:                                               ; preds = %11, %11
  %19 = tail call float @llvm.fabs.f32(float %0)
  %or.cond21 = fcmp one float %19, 0x7FF0000000000000
  br label %20

.thread:                                          ; preds = %11
  store ptr @UnityStrInvalidFloatTrait, ptr %5, align 16, !tbaa !11
  br label %23

20:                                               ; preds = %18, %16, %14, %12
  %.019.in = phi i1 [ %17, %16 ], [ %15, %14 ], [ %13, %12 ], [ %or.cond21, %18 ]
  %.0.shrunk = phi i64 [ 2, %16 ], [ 1, %14 ], [ 0, %12 ], [ 3, %18 ]
  %21 = trunc i32 %3 to i1
  %22 = xor i1 %.019.in, %21
  br i1 %22, label %23, label %30

23:                                               ; preds = %.thread, %20
  %.026 = phi i64 [ 0, %.thread ], [ %.0.shrunk, %20 ]
  tail call void @UnityTestResultsFailBegin(i64 noundef %2)
  tail call void @UnityPrint(ptr noundef nonnull @UnityStrExpected)
  br i1 %.not, label %24, label %25

24:                                               ; preds = %23
  tail call void @UnityPrint(ptr noundef nonnull @UnityStrNot)
  br label %25

25:                                               ; preds = %24, %23
  %26 = getelementptr inbounds [4 x ptr], ptr %5, i64 0, i64 %.026
  %27 = load ptr, ptr %26, align 8, !tbaa !11
  tail call void @UnityPrint(ptr noundef %27)
  tail call void @UnityPrint(ptr noundef nonnull @UnityStrWas)
  br i1 %.not, label %29, label %28

28:                                               ; preds = %25
  tail call void @UnityPrint(ptr noundef nonnull @UnityStrNot)
  br label %29

29:                                               ; preds = %28, %25
  tail call void @UnityPrint(ptr noundef %27)
  tail call void @UnityAddMsgIfSpecified(ptr noundef %1)
  store i64 1, ptr getelementptr inbounds (i8, ptr @Unity, i64 64), align 8, !tbaa !5
  tail call void @longjmp(ptr noundef nonnull getelementptr inbounds (i8, ptr @Unity, i64 80), i32 noundef 1) #6
  unreachable

30:                                               ; preds = %20, %4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #5
  ret void
}

; 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) #3

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fabs.f32(float) #4

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { noreturn nounwind "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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
attributes #6 = { noreturn 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 64}
!6 = !{!"_Unity", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !8, i64 80}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!7, !7, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass