; LLVM IR from kylewray/nova :: src/mdp/utilities (mdp_model_cpu)

; 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.nova::NovaMDP" = type { i32, i32, i32, float, i32, float, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }

@stderr = external global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [33 x i8], align 1

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local i32 @mdp_uninitialize_cpu(ptr noundef %0) #1 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = icmp eq ptr %4, null
  br i1 %5, label %6, label %9

6:                                                ; preds = %1
  %7 = load ptr, ptr @stderr, align 8, !tbaa !5
  %8 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %7, ptr noundef @.str.2, ptr noundef @.str.1) #3
  store i32 1, ptr %2, align 4
  br label %82

9:                                                ; preds = %1
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = getelementptr inbounds %"struct.nova::NovaMDP", ptr %10, i32 0, i32 0
  store i32 0, ptr %11, align 8, !tbaa !9
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  %13 = getelementptr inbounds %"struct.nova::NovaMDP", ptr %12, i32 0, i32 1
  store i32 0, ptr %13, align 4, !tbaa !13
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = getelementptr inbounds %"struct.nova::NovaMDP", ptr %14, i32 0, i32 2
  store i32 0, ptr %15, align 8, !tbaa !14
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = getelementptr inbounds %"struct.nova::NovaMDP", ptr %16, i32 0, i32 3
  store float 0.000000e+00, ptr %17, align 4, !tbaa !15
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = getelementptr inbounds %"struct.nova::NovaMDP", ptr %18, i32 0, i32 4
  store i32 0, ptr %19, align 8, !tbaa !16
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = getelementptr inbounds %"struct.nova::NovaMDP", ptr %20, i32 0, i32 5
  store float 0.000000e+00, ptr %21, align 4, !tbaa !17
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = getelementptr inbounds %"struct.nova::NovaMDP", ptr %22, i32 0, i32 6
  store i32 0, ptr %23, align 8, !tbaa !18
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = getelementptr inbounds %"struct.nova::NovaMDP", ptr %24, i32 0, i32 7
  store i32 0, ptr %25, align 4, !tbaa !19
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  %27 = getelementptr inbounds %"struct.nova::NovaMDP", ptr %26, i32 0, i32 8
  %28 = load ptr, ptr %27, align 8, !tbaa !20
  %29 = icmp ne ptr %28, null
  br i1 %29, label %30, label %37

30:                                               ; preds = %9
  %31 = load ptr, ptr %3, align 8, !tbaa !5
  %32 = getelementptr inbounds %"struct.nova::NovaMDP", ptr %31, i32 0, i32 8
  %33 = load ptr, ptr %32, align 8, !tbaa !20
  %34 = icmp eq ptr %33, null
  br i1 %34, label %36, label %35

35:                                               ; preds = %30
  call void @_ZdaPv(ptr noundef %33) #4
  br label %36

36:                                               ; preds = %35, %30
  br label %37

37:                                               ; preds = %36, %9
  %38 = load ptr, ptr %3, align 8, !tbaa !5
  %39 = getelementptr inbounds %"struct.nova::NovaMDP", ptr %38, i32 0, i32 8
  store ptr null, ptr %39, align 8, !tbaa !20
  %40 = load ptr, ptr %3, align 8, !tbaa !5
  %41 = getelementptr inbounds %"struct.nova::NovaMDP", ptr %40, i32 0, i32 9
  %42 = load ptr, ptr %41, align 8, !tbaa !21
  %43 = icmp ne ptr %42, null
  br i1 %43, label %44, label %51

44:                                               ; preds = %37
  %45 = load ptr, ptr %3, align 8, !tbaa !5
  %46 = getelementptr inbounds %"struct.nova::NovaMDP", ptr %45, i32 0, i32 9
  %47 = load ptr, ptr %46, align 8, !tbaa !21
  %48 = icmp eq ptr %47, null
  br i1 %48, label %50, label %49

49:                                               ; preds = %44
  call void @_ZdaPv(ptr noundef %47) #4
  br label %50

50:                                               ; preds = %49, %44
  br label %51

51:                                               ; preds = %50, %37
  %52 = load ptr, ptr %3, align 8, !tbaa !5
  %53 = getelementptr inbounds %"struct.nova::NovaMDP", ptr %52, i32 0, i32 9
  store ptr null, ptr %53, align 8, !tbaa !21
  %54 = load ptr, ptr %3, align 8, !tbaa !5
  %55 = getelementptr inbounds %"struct.nova::NovaMDP", ptr %54, i32 0, i32 10
  %56 = load ptr, ptr %55, align 8, !tbaa !22
  %57 = icmp ne ptr %56, null
  br i1 %57, label %58, label %65

58:                                               ; preds = %51
  %59 = load ptr, ptr %3, align 8, !tbaa !5
  %60 = getelementptr inbounds %"struct.nova::NovaMDP", ptr %59, i32 0, i32 10
  %61 = load ptr, ptr %60, align 8, !tbaa !22
  %62 = icmp eq ptr %61, null
  br i1 %62, label %64, label %63

63:                                               ; preds = %58
  call void @_ZdaPv(ptr noundef %61) #4
  br label %64

64:                                               ; preds = %63, %58
  br label %65

65:                                               ; preds = %64, %51
  %66 = load ptr, ptr %3, align 8, !tbaa !5
  %67 = getelementptr inbounds %"struct.nova::NovaMDP", ptr %66, i32 0, i32 10
  store ptr null, ptr %67, align 8, !tbaa !22
  %68 = load ptr, ptr %3, align 8, !tbaa !5
  %69 = getelementptr inbounds %"struct.nova::NovaMDP", ptr %68, i32 0, i32 11
  %70 = load ptr, ptr %69, align 8, !tbaa !23
  %71 = icmp ne ptr %70, null
  br i1 %71, label %72, label %79

72:                                               ; preds = %65
  %73 = load ptr, ptr %3, align 8, !tbaa !5
  %74 = getelementptr inbounds %"struct.nova::NovaMDP", ptr %73, i32 0, i32 11
  %75 = load ptr, ptr %74, align 8, !tbaa !23
  %76 = icmp eq ptr %75, null
  br i1 %76, label %78, label %77

77:                                               ; preds = %72
  call void @_ZdaPv(ptr noundef %75) #4
  br label %78

78:                                               ; preds = %77, %72
  br label %79

79:                                               ; preds = %78, %65
  %80 = load ptr, ptr %3, align 8, !tbaa !5
  %81 = getelementptr inbounds %"struct.nova::NovaMDP", ptr %80, i32 0, i32 11
  store ptr null, ptr %81, align 8, !tbaa !23
  store i32 0, ptr %2, align 4
  br label %82

82:                                               ; preds = %79, %6
  %83 = load i32, ptr %2, align 4
  ret i32 %83
}

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) #2

attributes #0 = { 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 #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 = { nobuiltin 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 }
attributes #4 = { builtin 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, !11, i64 0}
!10 = !{!"_ZTSN4nova7NovaMDPE", !11, i64 0, !11, i64 4, !11, i64 8, !12, i64 12, !11, i64 16, !12, i64 20, !11, i64 24, !11, i64 28, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88}
!11 = !{!"int", !7, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!10, !11, i64 4}
!14 = !{!10, !11, i64 8}
!15 = !{!10, !12, i64 12}
!16 = !{!10, !11, i64 16}
!17 = !{!10, !12, i64 20}
!18 = !{!10, !11, i64 24}
!19 = !{!10, !11, i64 28}
!20 = !{!10, !6, i64 32}
!21 = !{!10, !6, i64 40}
!22 = !{!10, !6, i64 48}
!23 = !{!10, !6, i64 56}


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

@stderr = external local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [33 x i8], align 1

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local range(i32 0, 2) i32 @mdp_uninitialize_cpu(ptr noundef %0) local_unnamed_addr #1 {
  %2 = icmp eq ptr %0, null
  br i1 %2, label %3, label %6

3:                                                ; preds = %1
  %4 = load ptr, ptr @stderr, align 8, !tbaa !5
  %5 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %4, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1) #4
  br label %23

6:                                                ; preds = %1
  %7 = getelementptr inbounds i8, ptr %0, i64 32
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(32) %0, i8 0, i64 32, i1 false)
  %8 = load ptr, ptr %7, align 8, !tbaa !9
  %.not = icmp eq ptr %8, null
  br i1 %.not, label %10, label %9

9:                                                ; preds = %6
  tail call void @_ZdaPv(ptr noundef nonnull %8) #5
  br label %10

10:                                               ; preds = %9, %6
  store ptr null, ptr %7, align 8, !tbaa !9
  %11 = getelementptr inbounds i8, ptr %0, i64 40
  %12 = load ptr, ptr %11, align 8, !tbaa !13
  %.not26 = icmp eq ptr %12, null
  br i1 %.not26, label %14, label %13

13:                                               ; preds = %10
  tail call void @_ZdaPv(ptr noundef nonnull %12) #5
  br label %14

14:                                               ; preds = %13, %10
  store ptr null, ptr %11, align 8, !tbaa !13
  %15 = getelementptr inbounds i8, ptr %0, i64 48
  %16 = load ptr, ptr %15, align 8, !tbaa !14
  %.not27 = icmp eq ptr %16, null
  br i1 %.not27, label %18, label %17

17:                                               ; preds = %14
  tail call void @_ZdaPv(ptr noundef nonnull %16) #5
  br label %18

18:                                               ; preds = %17, %14
  store ptr null, ptr %15, align 8, !tbaa !14
  %19 = getelementptr inbounds i8, ptr %0, i64 56
  %20 = load ptr, ptr %19, align 8, !tbaa !15
  %.not28 = icmp eq ptr %20, null
  br i1 %.not28, label %22, label %21

21:                                               ; preds = %18
  tail call void @_ZdaPv(ptr noundef nonnull %20) #5
  br label %22

22:                                               ; preds = %21, %18
  store ptr null, ptr %19, align 8, !tbaa !15
  br label %23

23:                                               ; preds = %22, %3
  %.0 = phi i32 [ 1, %3 ], [ 0, %22 ]
  ret i32 %.0
}

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) local_unnamed_addr #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

attributes #0 = { nofree 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 #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 = { nobuiltin 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: write) }
attributes #4 = { cold nounwind }
attributes #5 = { builtin 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, !6, i64 32}
!10 = !{!"_ZTSN4nova7NovaMDPE", !11, i64 0, !11, i64 4, !11, i64 8, !12, i64 12, !11, i64 16, !12, i64 20, !11, i64 24, !11, i64 28, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88}
!11 = !{!"int", !7, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!10, !6, i64 40}
!14 = !{!10, !6, i64 48}
!15 = !{!10, !6, i64 56}


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