; LLVM IR from jgaeddert/liquid-dsp :: src/framing/bench (gmskframesync_benchmark)

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

; Function Attrs: nounwind uwtable
define dso_local void @benchmark_gmskframesync(ptr noundef %0, ptr noundef %1, ptr noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca float, align 4
  %11 = alloca i32, align 4
  %12 = alloca float, align 4
  %13 = alloca float, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca i64, align 8
  %18 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = load i64, ptr %19, align 8, !tbaa !9
  %21 = udiv i64 %20, 128
  store i64 %21, ptr %19, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 2, ptr %8, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 3, ptr %9, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store float 5.000000e-01, ptr %10, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 8, ptr %11, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store float 3.000000e+01, ptr %12, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %22 = load float, ptr %12, align 4, !tbaa !13
  %23 = fneg float %22
  %24 = fdiv float %23, 2.000000e+01
  %25 = call float @powf(float noundef 1.000000e+01, float noundef %24) #5
  store float %25, ptr %13, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %26 = load i32, ptr %8, align 4, !tbaa !11
  %27 = load i32, ptr %9, align 4, !tbaa !11
  %28 = load float, ptr %10, align 4, !tbaa !13
  %29 = call ptr @gmskframegen_create_set(i32 noundef %26, i32 noundef %27, float noundef %28)
  store ptr %29, ptr %14, align 8, !tbaa !5
  %30 = load ptr, ptr %14, align 8, !tbaa !5
  %31 = load i32, ptr %11, align 4, !tbaa !11
  %32 = call i32 @gmskframegen_assemble(ptr noundef %30, ptr noundef null, ptr noundef null, i32 noundef %31, i32 noundef 1, i32 noundef 1, i32 noundef 1)
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %33 = load ptr, ptr %14, align 8, !tbaa !5
  %34 = call i32 @gmskframegen_getframelen(ptr noundef %33)
  store i32 %34, ptr %15, align 4, !tbaa !11
  %35 = load i32, ptr %15, align 4, !tbaa !11
  %36 = zext i32 %35 to i64
  %37 = call ptr @llvm.stacksave.p0()
  store ptr %37, ptr %16, align 8
  %38 = alloca { float, float }, i64 %36, align 16
  store i64 %36, ptr %17, align 8
  %39 = load ptr, ptr %14, align 8, !tbaa !5
  %40 = load i32, ptr %15, align 4, !tbaa !11
  %41 = call i32 @gmskframegen_write(ptr noundef %39, ptr noundef %38, i32 noundef %40)
  store i64 0, ptr %7, align 8, !tbaa !9
  br label %42

42:                                               ; preds = %66, %3
  %43 = load i64, ptr %7, align 8, !tbaa !9
  %44 = load i32, ptr %15, align 4, !tbaa !11
  %45 = zext i32 %44 to i64
  %46 = icmp ult i64 %43, %45
  br i1 %46, label %47, label %69

47:                                               ; preds = %42
  %48 = load float, ptr %13, align 4, !tbaa !13
  %49 = call float (...) @randnf()
  %50 = call float (...) @randnf()
  %51 = fmul float 0.000000e+00, %50
  %52 = fmul float 1.000000e+00, %50
  %53 = fadd float %49, %51
  %54 = fmul float %48, %53
  %55 = fmul float %48, %52
  %56 = load i64, ptr %7, align 8, !tbaa !9
  %57 = getelementptr inbounds { float, float }, ptr %38, i64 %56
  %58 = getelementptr inbounds { float, float }, ptr %57, i32 0, i32 0
  %59 = load float, ptr %58, align 8
  %60 = getelementptr inbounds { float, float }, ptr %57, i32 0, i32 1
  %61 = load float, ptr %60, align 4
  %62 = fadd float %59, %54
  %63 = fadd float %61, %55
  %64 = getelementptr inbounds { float, float }, ptr %57, i32 0, i32 0
  %65 = getelementptr inbounds { float, float }, ptr %57, i32 0, i32 1
  store float %62, ptr %64, align 8
  store float %63, ptr %65, align 4
  br label %66

66:                                               ; preds = %47
  %67 = load i64, ptr %7, align 8, !tbaa !9
  %68 = add i64 %67, 1
  store i64 %68, ptr %7, align 8, !tbaa !9
  br label %42, !llvm.loop !15

69:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  %70 = load i32, ptr %8, align 4, !tbaa !11
  %71 = load i32, ptr %9, align 4, !tbaa !11
  %72 = load float, ptr %10, align 4, !tbaa !13
  %73 = call ptr @gmskframesync_create_set(i32 noundef %70, i32 noundef %71, float noundef %72, ptr noundef null, ptr noundef null)
  store ptr %73, ptr %18, align 8, !tbaa !5
  %74 = load ptr, ptr %4, align 8, !tbaa !5
  %75 = call i32 @getrusage(i32 noundef 0, ptr noundef %74) #5
  store i64 0, ptr %7, align 8, !tbaa !9
  br label %76

76:                                               ; preds = %85, %69
  %77 = load i64, ptr %7, align 8, !tbaa !9
  %78 = load ptr, ptr %6, align 8, !tbaa !5
  %79 = load i64, ptr %78, align 8, !tbaa !9
  %80 = icmp ult i64 %77, %79
  br i1 %80, label %81, label %88

81:                                               ; preds = %76
  %82 = load ptr, ptr %18, align 8, !tbaa !5
  %83 = load i32, ptr %15, align 4, !tbaa !11
  %84 = call i32 @gmskframesync_execute(ptr noundef %82, ptr noundef %38, i32 noundef %83)
  br label %85

85:                                               ; preds = %81
  %86 = load i64, ptr %7, align 8, !tbaa !9
  %87 = add i64 %86, 1
  store i64 %87, ptr %7, align 8, !tbaa !9
  br label %76, !llvm.loop !17

88:                                               ; preds = %76
  %89 = load ptr, ptr %5, align 8, !tbaa !5
  %90 = call i32 @getrusage(i32 noundef 0, ptr noundef %89) #5
  %91 = load ptr, ptr %14, align 8, !tbaa !5
  %92 = call i32 @gmskframegen_destroy(ptr noundef %91)
  %93 = load ptr, ptr %18, align 8, !tbaa !5
  %94 = call i32 @gmskframesync_destroy(ptr noundef %93)
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  %95 = load ptr, ptr %16, align 8
  call void @llvm.stackrestore.p0(ptr %95)
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  ret void
}

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

; Function Attrs: nounwind
declare float @powf(float noundef, float noundef) #2

declare ptr @gmskframegen_create_set(i32 noundef, i32 noundef, float noundef) #3

declare i32 @gmskframegen_assemble(ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #3

declare i32 @gmskframegen_getframelen(ptr noundef) #3

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4

declare i32 @gmskframegen_write(ptr noundef, ptr noundef, i32 noundef) #3

declare float @randnf(...) #3

declare ptr @gmskframesync_create_set(i32 noundef, i32 noundef, float noundef, ptr noundef, ptr noundef) #3

; Function Attrs: nounwind
declare i32 @getrusage(i32 noundef, ptr noundef) #2

declare i32 @gmskframesync_execute(ptr noundef, ptr noundef, i32 noundef) #3

declare i32 @gmskframegen_destroy(ptr noundef) #3

declare i32 @gmskframesync_destroy(ptr noundef) #3

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #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 = { 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 = { "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 #4 = { nocallback nofree nosync nounwind willreturn }
attributes #5 = { 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, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!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"}
!17 = distinct !{!17, !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
define dso_local void @benchmark_gmskframesync(ptr noundef %0, ptr noundef %1, ptr nocapture noundef %2) local_unnamed_addr #0 {
  %4 = load i64, ptr %2, align 8, !tbaa !5
  %5 = lshr i64 %4, 7
  store i64 %5, ptr %2, align 8, !tbaa !5
  %6 = tail call ptr @gmskframegen_create_set(i32 noundef 2, i32 noundef 3, float noundef 5.000000e-01) #3
  %7 = tail call i32 @gmskframegen_assemble(ptr noundef %6, ptr noundef null, ptr noundef null, i32 noundef 8, i32 noundef 1, i32 noundef 1, i32 noundef 1) #3
  %8 = tail call i32 @gmskframegen_getframelen(ptr noundef %6) #3
  %9 = zext i32 %8 to i64
  %10 = alloca { float, float }, i64 %9, align 16
  %11 = call i32 @gmskframegen_write(ptr noundef %6, ptr noundef nonnull %10, i32 noundef %8) #3
  %.not = icmp eq i32 %8, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %3, %.lr.ph
  %.028 = phi i64 [ %22, %.lr.ph ], [ 0, %3 ]
  %12 = call float (...) @randnf() #3
  %13 = call float (...) @randnf() #3
  %14 = fmul float %13, 0.000000e+00
  %15 = fadd float %12, %14
  %16 = getelementptr inbounds { float, float }, ptr %10, i64 %.028
  %17 = insertelement <2 x float> poison, float %15, i64 0
  %18 = insertelement <2 x float> %17, float %13, i64 1
  %19 = fmul <2 x float> %18, <float 0x3FA030DC40000000, float 0x3FA030DC40000000>
  %20 = load <2 x float>, ptr %16, align 8
  %21 = fadd <2 x float> %20, %19
  store <2 x float> %21, ptr %16, align 8
  %22 = add nuw nsw i64 %.028, 1
  %exitcond.not = icmp eq i64 %22, %9
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph, %3
  %23 = call ptr @gmskframesync_create_set(i32 noundef 2, i32 noundef 3, float noundef 5.000000e-01, ptr noundef null, ptr noundef null) #3
  %24 = call i32 @getrusage(i32 noundef 0, ptr noundef %0) #3
  %25 = load i64, ptr %2, align 8, !tbaa !5
  %.not33 = icmp eq i64 %25, 0
  br i1 %.not33, label %._crit_edge32, label %.lr.ph31

.lr.ph31:                                         ; preds = %._crit_edge, %.lr.ph31
  %.129 = phi i64 [ %27, %.lr.ph31 ], [ 0, %._crit_edge ]
  %26 = call i32 @gmskframesync_execute(ptr noundef %23, ptr noundef nonnull %10, i32 noundef %8) #3
  %27 = add nuw i64 %.129, 1
  %28 = load i64, ptr %2, align 8, !tbaa !5
  %29 = icmp ult i64 %27, %28
  br i1 %29, label %.lr.ph31, label %._crit_edge32, !llvm.loop !11

._crit_edge32:                                    ; preds = %.lr.ph31, %._crit_edge
  %30 = call i32 @getrusage(i32 noundef 0, ptr noundef %1) #3
  %31 = call i32 @gmskframegen_destroy(ptr noundef %6) #3
  %32 = call i32 @gmskframesync_destroy(ptr noundef %23) #3
  ret void
}

declare ptr @gmskframegen_create_set(i32 noundef, i32 noundef, float noundef) local_unnamed_addr #1

declare i32 @gmskframegen_assemble(ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

declare i32 @gmskframegen_getframelen(ptr noundef) local_unnamed_addr #1

declare i32 @gmskframegen_write(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

declare float @randnf(...) local_unnamed_addr #1

declare ptr @gmskframesync_create_set(i32 noundef, i32 noundef, float noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

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

declare i32 @gmskframesync_execute(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

declare i32 @gmskframegen_destroy(ptr noundef) local_unnamed_addr #1

declare i32 @gmskframesync_destroy(ptr noundef) local_unnamed_addr #1

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 = { "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 "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 = { 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass