; LLVM IR from redhatdragon/EchoEngine :: HAL/ExampleImplimentations/Windows/OpenMP3 (openmp3)

; 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.OpenMP3::FrameData" = type { i32, [2 x [4 x i32]], [2 x [2 x i32]], [2 x [2 x i32]], [2 x [2 x float]], [2 x [2 x i32]], [2 x [2 x i8]], [2 x [2 x i8]], [2 x [2 x i32]], [2 x [2 x [3 x i32]]], [2 x [2 x [3 x float]]], [2 x [2 x i32]], [2 x [2 x i32]], [2 x [2 x i32]], [2 x [2 x i32]], [2 x [2 x i32]], [2 x [2 x i32]], [2 x [2 x [21 x i32]]], [2 x [2 x [12 x [3 x i32]]]], [2 x [2 x [576 x float]]] }

@_ZN7OpenMP33kCSE = external dso_local constant [8 x float], align 16
@_ZN7OpenMP33kCaE = external dso_local constant [8 x float], align 16

; 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: mustprogress nounwind uwtable
define dso_local void @_ZN7OpenMP39AntialiasERKNS_9FrameDataEjjPf(ptr noundef nonnull align 4 dereferenceable(10444) %0, i32 noundef %1, i32 noundef %2, ptr noundef %3) #1 {
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i8, align 1
  %10 = alloca i8, align 1
  %11 = alloca i8, align 1
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca float, align 4
  %19 = alloca float, align 4
  %20 = alloca float, align 4
  %21 = alloca float, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store i32 %2, ptr %7, align 4, !tbaa !9
  store ptr %3, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #3
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = getelementptr inbounds %"struct.OpenMP3::FrameData", ptr %22, i32 0, i32 6
  %24 = load i32, ptr %6, align 4, !tbaa !9
  %25 = zext i32 %24 to i64
  %26 = getelementptr inbounds [2 x [2 x i8]], ptr %23, i64 0, i64 %25
  %27 = load i32, ptr %7, align 4, !tbaa !9
  %28 = zext i32 %27 to i64
  %29 = getelementptr inbounds [2 x i8], ptr %26, i64 0, i64 %28
  %30 = load i8, ptr %29, align 1, !tbaa !11, !range !13, !noundef !14
  %31 = trunc i8 %30 to i1
  %32 = zext i1 %31 to i8
  store i8 %32, ptr %9, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #3
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = getelementptr inbounds %"struct.OpenMP3::FrameData", ptr %33, i32 0, i32 8
  %35 = load i32, ptr %6, align 4, !tbaa !9
  %36 = zext i32 %35 to i64
  %37 = getelementptr inbounds [2 x [2 x i32]], ptr %34, i64 0, i64 %36
  %38 = load i32, ptr %7, align 4, !tbaa !9
  %39 = zext i32 %38 to i64
  %40 = getelementptr inbounds [2 x i32], ptr %37, i64 0, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !9
  %42 = icmp eq i32 %41, 2
  %43 = zext i1 %42 to i8
  store i8 %43, ptr %10, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #3
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = getelementptr inbounds %"struct.OpenMP3::FrameData", ptr %44, i32 0, i32 7
  %46 = load i32, ptr %6, align 4, !tbaa !9
  %47 = zext i32 %46 to i64
  %48 = getelementptr inbounds [2 x [2 x i8]], ptr %45, i64 0, i64 %47
  %49 = load i32, ptr %7, align 4, !tbaa !9
  %50 = zext i32 %49 to i64
  %51 = getelementptr inbounds [2 x i8], ptr %48, i64 0, i64 %50
  %52 = load i8, ptr %51, align 1, !tbaa !11, !range !13, !noundef !14
  %53 = trunc i8 %52 to i1
  %54 = zext i1 %53 to i8
  store i8 %54, ptr %11, align 1, !tbaa !11
  %55 = load i8, ptr %9, align 1, !tbaa !11, !range !13, !noundef !14
  %56 = trunc i8 %55 to i1
  br i1 %56, label %57, label %64

57:                                               ; preds = %4
  %58 = load i8, ptr %10, align 1, !tbaa !11, !range !13, !noundef !14
  %59 = trunc i8 %58 to i1
  br i1 %59, label %60, label %64

60:                                               ; preds = %57
  %61 = load i8, ptr %11, align 1, !tbaa !11, !range !13, !noundef !14
  %62 = trunc i8 %61 to i1
  br i1 %62, label %64, label %63

63:                                               ; preds = %60
  store i32 1, ptr %12, align 4
  br label %152

64:                                               ; preds = %60, %57, %4
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  %65 = load i8, ptr %9, align 1, !tbaa !11, !range !13, !noundef !14
  %66 = trunc i8 %65 to i1
  br i1 %66, label %67, label %73

67:                                               ; preds = %64
  %68 = load i8, ptr %10, align 1, !tbaa !11, !range !13, !noundef !14
  %69 = trunc i8 %68 to i1
  br i1 %69, label %70, label %73

70:                                               ; preds = %67
  %71 = load i8, ptr %11, align 1, !tbaa !11, !range !13, !noundef !14
  %72 = trunc i8 %71 to i1
  br label %73

73:                                               ; preds = %70, %67, %64
  %74 = phi i1 [ false, %67 ], [ false, %64 ], [ %72, %70 ]
  %75 = zext i1 %74 to i64
  %76 = select i1 %74, i32 2, i32 32
  store i32 %76, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  store i32 1, ptr %14, align 4, !tbaa !9
  br label %77

77:                                               ; preds = %148, %73
  %78 = load i32, ptr %14, align 4, !tbaa !9
  %79 = load i32, ptr %13, align 4, !tbaa !9
  %80 = icmp ult i32 %78, %79
  br i1 %80, label %82, label %81

81:                                               ; preds = %77
  store i32 2, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  br label %151

82:                                               ; preds = %77
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %83

83:                                               ; preds = %144, %82
  %84 = load i32, ptr %15, align 4, !tbaa !9
  %85 = icmp ult i32 %84, 8
  br i1 %85, label %87, label %86

86:                                               ; preds = %83
  store i32 5, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  br label %147

87:                                               ; preds = %83
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #3
  %88 = load i32, ptr %14, align 4, !tbaa !9
  %89 = mul i32 18, %88
  %90 = sub i32 %89, 1
  %91 = load i32, ptr %15, align 4, !tbaa !9
  %92 = sub i32 %90, %91
  store i32 %92, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #3
  %93 = load i32, ptr %14, align 4, !tbaa !9
  %94 = mul i32 18, %93
  %95 = load i32, ptr %15, align 4, !tbaa !9
  %96 = add i32 %94, %95
  store i32 %96, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #3
  %97 = load i32, ptr %15, align 4, !tbaa !9
  %98 = zext i32 %97 to i64
  %99 = getelementptr inbounds [8 x float], ptr @_ZN7OpenMP33kCSE, i64 0, i64 %98
  %100 = load float, ptr %99, align 4, !tbaa !15
  store float %100, ptr %18, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #3
  %101 = load i32, ptr %15, align 4, !tbaa !9
  %102 = zext i32 %101 to i64
  %103 = getelementptr inbounds [8 x float], ptr @_ZN7OpenMP33kCaE, i64 0, i64 %102
  %104 = load float, ptr %103, align 4, !tbaa !15
  store float %104, ptr %19, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #3
  %105 = load ptr, ptr %8, align 8, !tbaa !5
  %106 = load i32, ptr %16, align 4, !tbaa !9
  %107 = zext i32 %106 to i64
  %108 = getelementptr inbounds float, ptr %105, i64 %107
  %109 = load float, ptr %108, align 4, !tbaa !15
  %110 = load float, ptr %18, align 4, !tbaa !15
  %111 = load ptr, ptr %8, align 8, !tbaa !5
  %112 = load i32, ptr %17, align 4, !tbaa !9
  %113 = zext i32 %112 to i64
  %114 = getelementptr inbounds float, ptr %111, i64 %113
  %115 = load float, ptr %114, align 4, !tbaa !15
  %116 = load float, ptr %19, align 4, !tbaa !15
  %117 = fmul float %115, %116
  %118 = fneg float %117
  %119 = call float @llvm.fmuladd.f32(float %109, float %110, float %118)
  store float %119, ptr %20, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #3
  %120 = load ptr, ptr %8, align 8, !tbaa !5
  %121 = load i32, ptr %17, align 4, !tbaa !9
  %122 = zext i32 %121 to i64
  %123 = getelementptr inbounds float, ptr %120, i64 %122
  %124 = load float, ptr %123, align 4, !tbaa !15
  %125 = load float, ptr %18, align 4, !tbaa !15
  %126 = load ptr, ptr %8, align 8, !tbaa !5
  %127 = load i32, ptr %16, align 4, !tbaa !9
  %128 = zext i32 %127 to i64
  %129 = getelementptr inbounds float, ptr %126, i64 %128
  %130 = load float, ptr %129, align 4, !tbaa !15
  %131 = load float, ptr %19, align 4, !tbaa !15
  %132 = fmul float %130, %131
  %133 = call float @llvm.fmuladd.f32(float %124, float %125, float %132)
  store float %133, ptr %21, align 4, !tbaa !15
  %134 = load float, ptr %20, align 4, !tbaa !15
  %135 = load ptr, ptr %8, align 8, !tbaa !5
  %136 = load i32, ptr %16, align 4, !tbaa !9
  %137 = zext i32 %136 to i64
  %138 = getelementptr inbounds float, ptr %135, i64 %137
  store float %134, ptr %138, align 4, !tbaa !15
  %139 = load float, ptr %21, align 4, !tbaa !15
  %140 = load ptr, ptr %8, align 8, !tbaa !5
  %141 = load i32, ptr %17, align 4, !tbaa !9
  %142 = zext i32 %141 to i64
  %143 = getelementptr inbounds float, ptr %140, i64 %142
  store float %139, ptr %143, align 4, !tbaa !15
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  br label %144

144:                                              ; preds = %87
  %145 = load i32, ptr %15, align 4, !tbaa !9
  %146 = add i32 %145, 1
  store i32 %146, ptr %15, align 4, !tbaa !9
  br label %83, !llvm.loop !17

147:                                              ; preds = %86
  br label %148

148:                                              ; preds = %147
  %149 = load i32, ptr %14, align 4, !tbaa !9
  %150 = add i32 %149, 1
  store i32 %150, ptr %14, align 4, !tbaa !9
  br label %77, !llvm.loop !19

151:                                              ; preds = %81
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  store i32 0, ptr %12, align 4
  br label %152

152:                                              ; preds = %151, %63
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #3
  %153 = load i32, ptr %12, align 4
  switch i32 %153, label %155 [
    i32 0, label %154
    i32 1, label %154
  ]

154:                                              ; preds = %152, %152
  ret void

155:                                              ; preds = %152
  unreachable
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!16, !16, i64 0}
!16 = !{!"float", !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}


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

@_ZN7OpenMP33kCSE = external dso_local local_unnamed_addr constant [8 x float], align 16
@_ZN7OpenMP33kCaE = external dso_local local_unnamed_addr constant [8 x float], align 16

; Function Attrs: mustprogress nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @_ZN7OpenMP39AntialiasERKNS_9FrameDataEjjPf(ptr nocapture noundef nonnull readonly align 4 dereferenceable(10444) %0, i32 noundef %1, i32 noundef %2, ptr nocapture noundef %3) local_unnamed_addr #0 {
  %5 = getelementptr inbounds i8, ptr %0, i64 100
  %6 = zext i32 %1 to i64
  %7 = zext i32 %2 to i64
  %8 = getelementptr inbounds [2 x [2 x i8]], ptr %5, i64 0, i64 %6, i64 %7
  %9 = load i8, ptr %8, align 1, !tbaa !5, !range !9, !noundef !10
  %10 = trunc nuw i8 %9 to i1
  %11 = getelementptr inbounds i8, ptr %0, i64 108
  %12 = getelementptr inbounds [2 x [2 x i32]], ptr %11, i64 0, i64 %6, i64 %7
  %13 = load i32, ptr %12, align 4, !tbaa !11
  %14 = icmp ne i32 %13, 2
  %15 = getelementptr inbounds i8, ptr %0, i64 104
  %16 = getelementptr inbounds [2 x [2 x i8]], ptr %15, i64 0, i64 %6, i64 %7
  %17 = load i8, ptr %16, align 1, !tbaa !5, !range !9, !noundef !10
  %18 = trunc nuw i8 %17 to i1
  %.not = xor i1 %10, true
  %brmerge = select i1 %.not, i1 true, i1 %14
  %brmerge45 = select i1 %brmerge, i1 true, i1 %18
  br i1 %brmerge45, label %19, label %.loopexit

19:                                               ; preds = %4
  %20 = select i1 %18, i64 2, i64 32
  %spec.select = select i1 %14, i64 32, i64 %20
  %wide.trip.count = select i1 %10, i64 %spec.select, i64 32
  %21 = load <4 x float>, ptr getelementptr inbounds (i8, ptr @_ZN7OpenMP33kCSE, i64 16), align 16, !tbaa !13
  %22 = load <4 x float>, ptr getelementptr inbounds (i8, ptr @_ZN7OpenMP33kCaE, i64 16), align 16, !tbaa !13
  %23 = load <4 x float>, ptr @_ZN7OpenMP33kCSE, align 16, !tbaa !13
  %24 = load <4 x float>, ptr @_ZN7OpenMP33kCaE, align 16, !tbaa !13
  %invariant.gep67 = getelementptr i8, ptr %3, i64 -16
  %invariant.gep73 = getelementptr inbounds i8, ptr %3, i64 16
  %invariant.gep83 = getelementptr i8, ptr %3, i64 -32
  br label %.preheader

.preheader:                                       ; preds = %19, %.preheader
  %indvars.iv = phi i64 [ 1, %19 ], [ %indvars.iv.next, %.preheader ]
  %25 = mul nuw nsw i64 %indvars.iv, 18
  %26 = getelementptr inbounds float, ptr %3, i64 %25
  %gep68 = getelementptr float, ptr %invariant.gep67, i64 %25
  %27 = load <4 x float>, ptr %gep68, align 4, !tbaa !13
  %28 = shufflevector <4 x float> %27, <4 x float> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
  %29 = load <4 x float>, ptr %26, align 4, !tbaa !13
  %30 = fneg <4 x float> %29
  %31 = fmul <4 x float> %24, %30
  %32 = tail call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %28, <4 x float> %23, <4 x float> %31)
  %33 = shufflevector <4 x float> %32, <4 x float> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
  store <4 x float> %33, ptr %gep68, align 4, !tbaa !13
  %34 = fmul <4 x float> %24, %28
  %35 = tail call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %29, <4 x float> %23, <4 x float> %34)
  store <4 x float> %35, ptr %26, align 4, !tbaa !13
  %gep74 = getelementptr inbounds float, ptr %invariant.gep73, i64 %25
  %gep84 = getelementptr float, ptr %invariant.gep83, i64 %25
  %36 = load <4 x float>, ptr %gep84, align 4, !tbaa !13
  %37 = shufflevector <4 x float> %36, <4 x float> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
  %38 = load <4 x float>, ptr %gep74, align 4, !tbaa !13
  %39 = fneg <4 x float> %38
  %40 = fmul <4 x float> %22, %39
  %41 = tail call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %37, <4 x float> %21, <4 x float> %40)
  %42 = shufflevector <4 x float> %41, <4 x float> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
  store <4 x float> %42, ptr %gep84, align 4, !tbaa !13
  %43 = fmul <4 x float> %22, %37
  %44 = tail call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %38, <4 x float> %21, <4 x float> %43)
  store <4 x float> %44, ptr %gep74, align 4, !tbaa !13
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.loopexit, label %.preheader, !llvm.loop !15

.loopexit:                                        ; preds = %.preheader, %4
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x float> @llvm.fmuladd.v4f32(<4 x float>, <4 x float>, <4 x float>) #1

attributes #0 = { mustprogress nofree norecurse nosync nounwind memory(argmem: readwrite) 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 speculatable willreturn memory(none) }

!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 = !{!"bool", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{i8 0, i8 2}
!10 = !{}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"float", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalDCEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass