; LLVM IR from microsoft/LightAIMD :: src (scf)

; 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.scf_context = type { ptr, i64, i64, i64, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, double, i64, double, double, double, i64, double, double, i64, double, i64, i64, ptr, ptr, ptr, i64, i64, i64, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, double, ptr, ptr, ptr, ptr, i64 }

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

declare void @x_free(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @scf_finalize(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = getelementptr inbounds %struct.scf_context, ptr %3, i32 0, i32 51
  %5 = load ptr, ptr %4, align 8, !tbaa !9
  call void @x_free(ptr noundef %5)
  %6 = load ptr, ptr %2, align 8, !tbaa !5
  %7 = getelementptr inbounds %struct.scf_context, ptr %6, i32 0, i32 52
  %8 = load ptr, ptr %7, align 8, !tbaa !13
  call void @x_free(ptr noundef %8)
  %9 = load ptr, ptr %2, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.scf_context, ptr %9, i32 0, i32 53
  %11 = load ptr, ptr %10, align 8, !tbaa !14
  call void @x_free(ptr noundef %11)
  %12 = load ptr, ptr %2, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.scf_context, ptr %12, i32 0, i32 34
  %14 = load i64, ptr %13, align 8, !tbaa !15
  %15 = icmp ne i64 %14, 0
  br i1 %15, label %16, label %21

16:                                               ; preds = %1
  %17 = load ptr, ptr %2, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.scf_context, ptr %17, i32 0, i32 38
  %19 = load ptr, ptr %18, align 8, !tbaa !16
  call void @x_free(ptr noundef %19)
  %20 = load ptr, ptr %2, align 8, !tbaa !5
  call void @free_basis(ptr noundef %20)
  br label %25

21:                                               ; preds = %1
  %22 = load ptr, ptr %2, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.scf_context, ptr %22, i32 0, i32 9
  %24 = load ptr, ptr %23, align 8, !tbaa !17
  call void @x_free(ptr noundef %24)
  br label %25

25:                                               ; preds = %21, %16
  %26 = load ptr, ptr %2, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.scf_context, ptr %26, i32 0, i32 19
  %28 = load ptr, ptr %27, align 8, !tbaa !18
  call void @x_free(ptr noundef %28)
  %29 = load ptr, ptr %2, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.scf_context, ptr %29, i32 0, i32 20
  %31 = load ptr, ptr %30, align 8, !tbaa !19
  call void @x_free(ptr noundef %31)
  %32 = load ptr, ptr %2, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.scf_context, ptr %32, i32 0, i32 21
  %34 = load ptr, ptr %33, align 8, !tbaa !20
  call void @x_free(ptr noundef %34)
  %35 = load ptr, ptr %2, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.scf_context, ptr %35, i32 0, i32 8
  %37 = load ptr, ptr %36, align 8, !tbaa !21
  call void @x_free(ptr noundef %37)
  %38 = load ptr, ptr %2, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.scf_context, ptr %38, i32 0, i32 6
  %40 = load ptr, ptr %39, align 8, !tbaa !22
  call void @x_free(ptr noundef %40)
  %41 = load ptr, ptr %2, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.scf_context, ptr %41, i32 0, i32 22
  %43 = load ptr, ptr %42, align 8, !tbaa !23
  call void @x_free(ptr noundef %43)
  %44 = load ptr, ptr %2, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.scf_context, ptr %44, i32 0, i32 23
  %46 = load ptr, ptr %45, align 8, !tbaa !24
  call void @x_free(ptr noundef %46)
  %47 = load ptr, ptr %2, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.scf_context, ptr %47, i32 0, i32 42
  %49 = load ptr, ptr %48, align 8, !tbaa !25
  call void @x_free(ptr noundef %49)
  %50 = load ptr, ptr %2, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.scf_context, ptr %50, i32 0, i32 43
  %52 = load ptr, ptr %51, align 8, !tbaa !26
  call void @x_free(ptr noundef %52)
  %53 = load ptr, ptr %2, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.scf_context, ptr %53, i32 0, i32 44
  %55 = load ptr, ptr %54, align 8, !tbaa !27
  call void @x_free(ptr noundef %55)
  %56 = load ptr, ptr %2, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.scf_context, ptr %56, i32 0, i32 45
  %58 = load ptr, ptr %57, align 8, !tbaa !28
  call void @x_free(ptr noundef %58)
  %59 = load ptr, ptr %2, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.scf_context, ptr %59, i32 0, i32 46
  %61 = load ptr, ptr %60, align 8, !tbaa !29
  call void @x_free(ptr noundef %61)
  %62 = load ptr, ptr %2, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.scf_context, ptr %62, i32 0, i32 47
  %64 = load ptr, ptr %63, align 8, !tbaa !30
  call void @x_free(ptr noundef %64)
  %65 = load ptr, ptr %2, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.scf_context, ptr %65, i32 0, i32 48
  %67 = load ptr, ptr %66, align 8, !tbaa !31
  call void @x_free(ptr noundef %67)
  %68 = load ptr, ptr %2, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.scf_context, ptr %68, i32 0, i32 49
  %70 = load ptr, ptr %69, align 8, !tbaa !32
  call void @x_free(ptr noundef %70)
  %71 = load ptr, ptr %2, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.scf_context, ptr %71, i32 0, i32 7
  %73 = load ptr, ptr %72, align 8, !tbaa !33
  call void @x_free(ptr noundef %73)
  %74 = load ptr, ptr %2, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.scf_context, ptr %74, i32 0, i32 37
  %76 = load ptr, ptr %75, align 8, !tbaa !34
  call void @x_free(ptr noundef %76)
  %77 = load ptr, ptr %2, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.scf_context, ptr %77, i32 0, i32 36
  %79 = load ptr, ptr %78, align 8, !tbaa !35
  call void @threadpool_finalize(ptr noundef %79)
  %80 = load ptr, ptr %2, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.scf_context, ptr %80, i32 0, i32 18
  %82 = load ptr, ptr %81, align 8, !tbaa !36
  call void @x_free(ptr noundef %82)
  %83 = load ptr, ptr %2, align 8, !tbaa !5
  call void @x_free(ptr noundef %83)
  ret void
}

declare void @threadpool_finalize(ptr noundef) #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" }

!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, !6, i64 408}
!10 = !{!"scf_context", !6, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !12, i64 192, !11, i64 200, !12, i64 208, !12, i64 216, !12, i64 224, !11, i64 232, !12, i64 240, !12, i64 248, !11, i64 256, !12, i64 264, !11, i64 272, !11, i64 280, !6, i64 288, !6, i64 296, !6, i64 304, !11, i64 312, !11, i64 320, !11, i64 328, !6, i64 336, !6, i64 344, !6, i64 352, !6, i64 360, !6, i64 368, !6, i64 376, !6, i64 384, !6, i64 392, !12, i64 400, !6, i64 408, !6, i64 416, !6, i64 424, !6, i64 432, !11, i64 440}
!11 = !{!"long", !7, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!10, !6, i64 416}
!14 = !{!10, !6, i64 424}
!15 = !{!10, !11, i64 272}
!16 = !{!10, !6, i64 304}
!17 = !{!10, !6, i64 72}
!18 = !{!10, !6, i64 152}
!19 = !{!10, !6, i64 160}
!20 = !{!10, !6, i64 168}
!21 = !{!10, !6, i64 64}
!22 = !{!10, !6, i64 48}
!23 = !{!10, !6, i64 176}
!24 = !{!10, !6, i64 184}
!25 = !{!10, !6, i64 336}
!26 = !{!10, !6, i64 344}
!27 = !{!10, !6, i64 352}
!28 = !{!10, !6, i64 360}
!29 = !{!10, !6, i64 368}
!30 = !{!10, !6, i64 376}
!31 = !{!10, !6, i64 384}
!32 = !{!10, !6, i64 392}
!33 = !{!10, !6, i64 56}
!34 = !{!10, !6, i64 296}
!35 = !{!10, !6, i64 288}
!36 = !{!10, !6, i64 144}


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

declare void @x_free(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @scf_finalize(ptr noundef %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 408
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  tail call void @x_free(ptr noundef %3) #2
  %4 = getelementptr inbounds i8, ptr %0, i64 416
  %5 = load ptr, ptr %4, align 8, !tbaa !12
  tail call void @x_free(ptr noundef %5) #2
  %6 = getelementptr inbounds i8, ptr %0, i64 424
  %7 = load ptr, ptr %6, align 8, !tbaa !13
  tail call void @x_free(ptr noundef %7) #2
  %8 = getelementptr inbounds i8, ptr %0, i64 272
  %9 = load i64, ptr %8, align 8, !tbaa !14
  %.not = icmp eq i64 %9, 0
  br i1 %.not, label %13, label %10

10:                                               ; preds = %1
  %11 = getelementptr inbounds i8, ptr %0, i64 304
  %12 = load ptr, ptr %11, align 8, !tbaa !15
  tail call void @x_free(ptr noundef %12) #2
  tail call void @free_basis(ptr noundef nonnull %0)
  br label %16

13:                                               ; preds = %1
  %14 = getelementptr inbounds i8, ptr %0, i64 72
  %15 = load ptr, ptr %14, align 8, !tbaa !16
  tail call void @x_free(ptr noundef %15) #2
  br label %16

16:                                               ; preds = %13, %10
  %17 = getelementptr inbounds i8, ptr %0, i64 152
  %18 = load ptr, ptr %17, align 8, !tbaa !17
  tail call void @x_free(ptr noundef %18) #2
  %19 = getelementptr inbounds i8, ptr %0, i64 160
  %20 = load ptr, ptr %19, align 8, !tbaa !18
  tail call void @x_free(ptr noundef %20) #2
  %21 = getelementptr inbounds i8, ptr %0, i64 168
  %22 = load ptr, ptr %21, align 8, !tbaa !19
  tail call void @x_free(ptr noundef %22) #2
  %23 = getelementptr inbounds i8, ptr %0, i64 64
  %24 = load ptr, ptr %23, align 8, !tbaa !20
  tail call void @x_free(ptr noundef %24) #2
  %25 = getelementptr inbounds i8, ptr %0, i64 48
  %26 = load ptr, ptr %25, align 8, !tbaa !21
  tail call void @x_free(ptr noundef %26) #2
  %27 = getelementptr inbounds i8, ptr %0, i64 176
  %28 = load ptr, ptr %27, align 8, !tbaa !22
  tail call void @x_free(ptr noundef %28) #2
  %29 = getelementptr inbounds i8, ptr %0, i64 184
  %30 = load ptr, ptr %29, align 8, !tbaa !23
  tail call void @x_free(ptr noundef %30) #2
  %31 = getelementptr inbounds i8, ptr %0, i64 336
  %32 = load ptr, ptr %31, align 8, !tbaa !24
  tail call void @x_free(ptr noundef %32) #2
  %33 = getelementptr inbounds i8, ptr %0, i64 344
  %34 = load ptr, ptr %33, align 8, !tbaa !25
  tail call void @x_free(ptr noundef %34) #2
  %35 = getelementptr inbounds i8, ptr %0, i64 352
  %36 = load ptr, ptr %35, align 8, !tbaa !26
  tail call void @x_free(ptr noundef %36) #2
  %37 = getelementptr inbounds i8, ptr %0, i64 360
  %38 = load ptr, ptr %37, align 8, !tbaa !27
  tail call void @x_free(ptr noundef %38) #2
  %39 = getelementptr inbounds i8, ptr %0, i64 368
  %40 = load ptr, ptr %39, align 8, !tbaa !28
  tail call void @x_free(ptr noundef %40) #2
  %41 = getelementptr inbounds i8, ptr %0, i64 376
  %42 = load ptr, ptr %41, align 8, !tbaa !29
  tail call void @x_free(ptr noundef %42) #2
  %43 = getelementptr inbounds i8, ptr %0, i64 384
  %44 = load ptr, ptr %43, align 8, !tbaa !30
  tail call void @x_free(ptr noundef %44) #2
  %45 = getelementptr inbounds i8, ptr %0, i64 392
  %46 = load ptr, ptr %45, align 8, !tbaa !31
  tail call void @x_free(ptr noundef %46) #2
  %47 = getelementptr inbounds i8, ptr %0, i64 56
  %48 = load ptr, ptr %47, align 8, !tbaa !32
  tail call void @x_free(ptr noundef %48) #2
  %49 = getelementptr inbounds i8, ptr %0, i64 296
  %50 = load ptr, ptr %49, align 8, !tbaa !33
  tail call void @x_free(ptr noundef %50) #2
  %51 = getelementptr inbounds i8, ptr %0, i64 288
  %52 = load ptr, ptr %51, align 8, !tbaa !34
  tail call void @threadpool_finalize(ptr noundef %52) #2
  %53 = getelementptr inbounds i8, ptr %0, i64 144
  %54 = load ptr, ptr %53, align 8, !tbaa !35
  tail call void @x_free(ptr noundef %54) #2
  tail call void @x_free(ptr noundef nonnull %0) #2
  ret void
}

declare void @threadpool_finalize(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 }

!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, !7, i64 408}
!6 = !{!"scf_context", !7, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !7, i64 88, !7, i64 96, !7, i64 104, !7, i64 112, !7, i64 120, !7, i64 128, !7, i64 136, !7, i64 144, !7, i64 152, !7, i64 160, !7, i64 168, !7, i64 176, !7, i64 184, !11, i64 192, !10, i64 200, !11, i64 208, !11, i64 216, !11, i64 224, !10, i64 232, !11, i64 240, !11, i64 248, !10, i64 256, !11, i64 264, !10, i64 272, !10, i64 280, !7, i64 288, !7, i64 296, !7, i64 304, !10, i64 312, !10, i64 320, !10, i64 328, !7, i64 336, !7, i64 344, !7, i64 352, !7, i64 360, !7, i64 368, !7, i64 376, !7, i64 384, !7, i64 392, !11, i64 400, !7, i64 408, !7, i64 416, !7, i64 424, !7, i64 432, !10, i64 440}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!"double", !8, i64 0}
!12 = !{!6, !7, i64 416}
!13 = !{!6, !7, i64 424}
!14 = !{!6, !10, i64 272}
!15 = !{!6, !7, i64 304}
!16 = !{!6, !7, i64 72}
!17 = !{!6, !7, i64 152}
!18 = !{!6, !7, i64 160}
!19 = !{!6, !7, i64 168}
!20 = !{!6, !7, i64 64}
!21 = !{!6, !7, i64 48}
!22 = !{!6, !7, i64 176}
!23 = !{!6, !7, i64 184}
!24 = !{!6, !7, i64 336}
!25 = !{!6, !7, i64 344}
!26 = !{!6, !7, i64 352}
!27 = !{!6, !7, i64 360}
!28 = !{!6, !7, i64 368}
!29 = !{!6, !7, i64 376}
!30 = !{!6, !7, i64 384}
!31 = !{!6, !7, i64 392}
!32 = !{!6, !7, i64 56}
!33 = !{!6, !7, i64 296}
!34 = !{!6, !7, i64 288}
!35 = !{!6, !7, i64 144}


; Effective O3 passes: CorrelatedValuePropagationPass,GlobalOptPass,InstCombinePass,SROAPass,TailCallElimPass