; LLVM IR from kylewray/nova :: src/pomdp/utilities (pomdp_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::NovaPOMDP" = type { i32, i32, i32, i32, i32, i32, float, i32, ptr, ptr, ptr, ptr, 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.6 = external hidden unnamed_addr constant [35 x i8], align 1

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local i32 @pomdp_uninitialize_cpu(ptr noundef %0) #2 {
  %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.6, ptr noundef @.str.1) #3
  store i32 1, ptr %2, align 4
  br label %110

9:                                                ; preds = %1
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = getelementptr inbounds %"struct.nova::NovaPOMDP", 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::NovaPOMDP", 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::NovaPOMDP", 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::NovaPOMDP", ptr %16, i32 0, i32 3
  store i32 0, ptr %17, align 4, !tbaa !15
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = getelementptr inbounds %"struct.nova::NovaPOMDP", 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::NovaPOMDP", ptr %20, i32 0, i32 5
  store i32 0, ptr %21, align 4, !tbaa !17
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = getelementptr inbounds %"struct.nova::NovaPOMDP", ptr %22, i32 0, i32 6
  store float 0.000000e+00, ptr %23, align 8, !tbaa !18
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = getelementptr inbounds %"struct.nova::NovaPOMDP", 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::NovaPOMDP", 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::NovaPOMDP", 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::NovaPOMDP", 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::NovaPOMDP", 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::NovaPOMDP", 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::NovaPOMDP", 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::NovaPOMDP", 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::NovaPOMDP", 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::NovaPOMDP", 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::NovaPOMDP", 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::NovaPOMDP", 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::NovaPOMDP", ptr %80, i32 0, i32 11
  store ptr null, ptr %81, align 8, !tbaa !23
  %82 = load ptr, ptr %3, align 8, !tbaa !5
  %83 = getelementptr inbounds %"struct.nova::NovaPOMDP", ptr %82, i32 0, i32 12
  %84 = load ptr, ptr %83, align 8, !tbaa !24
  %85 = icmp ne ptr %84, null
  br i1 %85, label %86, label %93

86:                                               ; preds = %79
  %87 = load ptr, ptr %3, align 8, !tbaa !5
  %88 = getelementptr inbounds %"struct.nova::NovaPOMDP", ptr %87, i32 0, i32 12
  %89 = load ptr, ptr %88, align 8, !tbaa !24
  %90 = icmp eq ptr %89, null
  br i1 %90, label %92, label %91

91:                                               ; preds = %86
  call void @_ZdaPv(ptr noundef %89) #4
  br label %92

92:                                               ; preds = %91, %86
  br label %93

93:                                               ; preds = %92, %79
  %94 = load ptr, ptr %3, align 8, !tbaa !5
  %95 = getelementptr inbounds %"struct.nova::NovaPOMDP", ptr %94, i32 0, i32 12
  store ptr null, ptr %95, align 8, !tbaa !24
  %96 = load ptr, ptr %3, align 8, !tbaa !5
  %97 = getelementptr inbounds %"struct.nova::NovaPOMDP", ptr %96, i32 0, i32 13
  %98 = load ptr, ptr %97, align 8, !tbaa !25
  %99 = icmp ne ptr %98, null
  br i1 %99, label %100, label %107

100:                                              ; preds = %93
  %101 = load ptr, ptr %3, align 8, !tbaa !5
  %102 = getelementptr inbounds %"struct.nova::NovaPOMDP", ptr %101, i32 0, i32 13
  %103 = load ptr, ptr %102, align 8, !tbaa !25
  %104 = icmp eq ptr %103, null
  br i1 %104, label %106, label %105

105:                                              ; preds = %100
  call void @_ZdaPv(ptr noundef %103) #4
  br label %106

106:                                              ; preds = %105, %100
  br label %107

107:                                              ; preds = %106, %93
  %108 = load ptr, ptr %3, align 8, !tbaa !5
  %109 = getelementptr inbounds %"struct.nova::NovaPOMDP", ptr %108, i32 0, i32 13
  store ptr null, ptr %109, align 8, !tbaa !25
  store i32 0, ptr %2, align 4
  br label %110

110:                                              ; preds = %107, %6
  %111 = load i32, ptr %2, align 4
  ret i32 %111
}

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 = { 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 #2 = { 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 #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 = !{!"_ZTSN4nova9NovaPOMDPE", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !12, 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, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120}
!11 = !{!"int", !7, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!10, !11, i64 4}
!14 = !{!10, !11, i64 8}
!15 = !{!10, !11, i64 12}
!16 = !{!10, !11, i64 16}
!17 = !{!10, !11, i64 20}
!18 = !{!10, !12, 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}
!24 = !{!10, !6, i64 64}
!25 = !{!10, !6, 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"

@stderr = external local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [35 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: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
define dso_local range(i32 0, 2) i32 @pomdp_uninitialize_cpu(ptr noundef %0) local_unnamed_addr #2 {
  %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.6, ptr noundef nonnull @.str.1) #4
  br label %31

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
  %.not34 = icmp eq ptr %12, null
  br i1 %.not34, 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
  %.not35 = icmp eq ptr %16, null
  br i1 %.not35, 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
  %.not36 = icmp eq ptr %20, null
  br i1 %.not36, 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
  %23 = getelementptr inbounds i8, ptr %0, i64 64
  %24 = load ptr, ptr %23, align 8, !tbaa !16
  %.not37 = icmp eq ptr %24, null
  br i1 %.not37, label %26, label %25

25:                                               ; preds = %22
  tail call void @_ZdaPv(ptr noundef nonnull %24) #5
  br label %26

26:                                               ; preds = %25, %22
  store ptr null, ptr %23, align 8, !tbaa !16
  %27 = getelementptr inbounds i8, ptr %0, i64 72
  %28 = load ptr, ptr %27, align 8, !tbaa !17
  %.not38 = icmp eq ptr %28, null
  br i1 %.not38, label %30, label %29

29:                                               ; preds = %26
  tail call void @_ZdaPv(ptr noundef nonnull %28) #5
  br label %30

30:                                               ; preds = %29, %26
  store ptr null, ptr %27, align 8, !tbaa !17
  br label %31

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

; 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 = { 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 #2 = { 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 #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 = !{!"_ZTSN4nova9NovaPOMDPE", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !12, 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, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120}
!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}
!16 = !{!10, !6, i64 64}
!17 = !{!10, !6, i64 72}


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