; LLVM IR from siavashserver/neonrvm :: neonrvm (neonrvm_create_cache)

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

@.str = external hidden unnamed_addr constant [6 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [65 x i8], align 1
@__PRETTY_FUNCTION__.neonrvm_create_cache = external hidden unnamed_addr constant [61 x i8], align 1

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

9:                                                ; preds = %3
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 205, ptr noundef @__PRETTY_FUNCTION__.neonrvm_create_cache) #3
  unreachable

10:                                               ; preds = %3
  %11 = load ptr, ptr %5, align 8, !tbaa !5
  %12 = icmp eq ptr null, %11
  br i1 %12, label %19, label %13

13:                                               ; preds = %10
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = load i64, ptr %6, align 8, !tbaa !9
  %16 = call zeroext i1 @is_finite(ptr noundef %14, i64 noundef %15)
  %17 = zext i1 %16 to i32
  %18 = icmp eq i32 0, %17
  br i1 %18, label %19, label %20

19:                                               ; preds = %13, %10
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 210, ptr noundef @__PRETTY_FUNCTION__.neonrvm_create_cache) #3
  unreachable

20:                                               ; preds = %13
  %21 = load i64, ptr %6, align 8, !tbaa !9
  %22 = icmp ugt i64 2, %21
  br i1 %22, label %29, label %23

23:                                               ; preds = %20
  %24 = load i64, ptr %6, align 8, !tbaa !9
  %25 = icmp ult i64 2147483646, %24
  br i1 %25, label %29, label %26

26:                                               ; preds = %23
  %27 = load i64, ptr %6, align 8, !tbaa !9
  %28 = icmp ult i64 2305843009213693951, %27
  br i1 %28, label %29, label %30

29:                                               ; preds = %26, %23, %20
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 216, ptr noundef @__PRETTY_FUNCTION__.neonrvm_create_cache) #3
  unreachable

30:                                               ; preds = %26
  %31 = call ptr @nmalloc(i64 noundef 1, i64 noundef 152)
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %31, ptr %32, align 8, !tbaa !5
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = load ptr, ptr %33, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.neonrvm_cache, ptr %34, i32 0, i32 1
  store double 0.000000e+00, ptr %35, align 8, !tbaa !11
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = load ptr, ptr %36, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.neonrvm_cache, ptr %37, i32 0, i32 2
  store ptr null, ptr %38, align 8, !tbaa !15
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = load ptr, ptr %39, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.neonrvm_cache, ptr %40, i32 0, i32 3
  store ptr null, ptr %41, align 8, !tbaa !16
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  %43 = load ptr, ptr %42, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.neonrvm_cache, ptr %43, i32 0, i32 4
  store ptr null, ptr %44, align 8, !tbaa !17
  %45 = load ptr, ptr %4, align 8, !tbaa !5
  %46 = load ptr, ptr %45, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.neonrvm_cache, ptr %46, i32 0, i32 5
  store ptr null, ptr %47, align 8, !tbaa !18
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = load ptr, ptr %48, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.neonrvm_cache, ptr %49, i32 0, i32 6
  store ptr null, ptr %50, align 8, !tbaa !19
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = load ptr, ptr %51, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.neonrvm_cache, ptr %52, i32 0, i32 7
  store ptr null, ptr %53, align 8, !tbaa !20
  %54 = load i64, ptr %6, align 8, !tbaa !9
  %55 = call ptr @nmalloc(i64 noundef %54, i64 noundef 8)
  %56 = load ptr, ptr %4, align 8, !tbaa !5
  %57 = load ptr, ptr %56, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.neonrvm_cache, ptr %57, i32 0, i32 8
  store ptr %55, ptr %58, align 8, !tbaa !21
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = load ptr, ptr %59, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.neonrvm_cache, ptr %60, i32 0, i32 9
  store ptr null, ptr %61, align 8, !tbaa !22
  %62 = load ptr, ptr %4, align 8, !tbaa !5
  %63 = load ptr, ptr %62, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.neonrvm_cache, ptr %63, i32 0, i32 10
  store ptr null, ptr %64, align 8, !tbaa !23
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = load ptr, ptr %65, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.neonrvm_cache, ptr %66, i32 0, i32 11
  store ptr null, ptr %67, align 8, !tbaa !24
  %68 = load i64, ptr %6, align 8, !tbaa !9
  %69 = call ptr @nmalloc(i64 noundef %68, i64 noundef 8)
  %70 = load ptr, ptr %4, align 8, !tbaa !5
  %71 = load ptr, ptr %70, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.neonrvm_cache, ptr %71, i32 0, i32 12
  store ptr %69, ptr %72, align 8, !tbaa !25
  %73 = load ptr, ptr %4, align 8, !tbaa !5
  %74 = load ptr, ptr %73, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.neonrvm_cache, ptr %74, i32 0, i32 12
  %76 = load ptr, ptr %75, align 8, !tbaa !25
  %77 = load ptr, ptr %5, align 8, !tbaa !5
  %78 = load i64, ptr %6, align 8, !tbaa !9
  %79 = mul i64 %78, 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %76, ptr align 8 %77, i64 %79, i1 false)
  %80 = load ptr, ptr %4, align 8, !tbaa !5
  %81 = load ptr, ptr %80, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.neonrvm_cache, ptr %81, i32 0, i32 13
  store ptr null, ptr %82, align 8, !tbaa !26
  %83 = load i64, ptr %6, align 8, !tbaa !9
  %84 = load ptr, ptr %4, align 8, !tbaa !5
  %85 = load ptr, ptr %84, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.neonrvm_cache, ptr %85, i32 0, i32 14
  store i64 %83, ptr %86, align 8, !tbaa !27
  %87 = load ptr, ptr %4, align 8, !tbaa !5
  %88 = load ptr, ptr %87, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.neonrvm_cache, ptr %88, i32 0, i32 15
  store i64 0, ptr %89, align 8, !tbaa !28
  %90 = load ptr, ptr %4, align 8, !tbaa !5
  %91 = load ptr, ptr %90, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.neonrvm_cache, ptr %91, i32 0, i32 16
  store i64 0, ptr %92, align 8, !tbaa !29
  %93 = load ptr, ptr %4, align 8, !tbaa !5
  %94 = load ptr, ptr %93, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.neonrvm_cache, ptr %94, i32 0, i32 17
  store i64 0, ptr %95, align 8, !tbaa !30
  %96 = load ptr, ptr %4, align 8, !tbaa !5
  %97 = load ptr, ptr %96, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.neonrvm_cache, ptr %97, i32 0, i32 18
  store i8 0, ptr %98, align 8, !tbaa !31
  %99 = load ptr, ptr %4, align 8, !tbaa !5
  %100 = load ptr, ptr %99, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.neonrvm_cache, ptr %100, i32 0, i32 0
  store i64 44252, ptr %101, align 8, !tbaa !32
  ret i32 0
}

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @is_finite(ptr noundef, i64 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden ptr @nmalloc(i64 noundef, i64 noundef) #0

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

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 = { noreturn 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { noreturn 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, !13, i64 8}
!12 = !{!"neonrvm_cache", !10, i64 0, !13, i64 8, !6, i64 16, !6, 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, !10, i64 112, !10, i64 120, !10, i64 128, !10, i64 136, !14, i64 144}
!13 = !{!"double", !7, i64 0}
!14 = !{!"_Bool", !7, i64 0}
!15 = !{!12, !6, i64 16}
!16 = !{!12, !6, i64 24}
!17 = !{!12, !6, i64 32}
!18 = !{!12, !6, i64 40}
!19 = !{!12, !6, i64 48}
!20 = !{!12, !6, i64 56}
!21 = !{!12, !6, i64 64}
!22 = !{!12, !6, i64 72}
!23 = !{!12, !6, i64 80}
!24 = !{!12, !6, i64 88}
!25 = !{!12, !6, i64 96}
!26 = !{!12, !6, i64 104}
!27 = !{!12, !10, i64 112}
!28 = !{!12, !10, i64 120}
!29 = !{!12, !10, i64 128}
!30 = !{!12, !10, i64 136}
!31 = !{!12, !14, i64 144}
!32 = !{!12, !10, i64 0}


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

@.str = external hidden unnamed_addr constant [6 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [65 x i8], align 1
@__PRETTY_FUNCTION__.neonrvm_create_cache = external hidden unnamed_addr constant [61 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @neonrvm_create_cache(ptr noundef %0, ptr noundef %1, i64 noundef %2) local_unnamed_addr #0 {
  %4 = icmp eq ptr %0, null
  br i1 %4, label %5, label %6

5:                                                ; preds = %3
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 205, ptr noundef nonnull @__PRETTY_FUNCTION__.neonrvm_create_cache) #4
  unreachable

6:                                                ; preds = %3
  %7 = icmp eq ptr %1, null
  br i1 %7, label %10, label %8

8:                                                ; preds = %6
  %9 = tail call zeroext i1 @is_finite(ptr noundef nonnull %1, i64 noundef %2)
  br i1 %9, label %11, label %10

10:                                               ; preds = %8, %6
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 210, ptr noundef nonnull @__PRETTY_FUNCTION__.neonrvm_create_cache) #4
  unreachable

11:                                               ; preds = %8
  %12 = add i64 %2, -2147483647
  %or.cond3 = icmp ult i64 %12, -2147483645
  br i1 %or.cond3, label %13, label %14

13:                                               ; preds = %11
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 216, ptr noundef nonnull @__PRETTY_FUNCTION__.neonrvm_create_cache) #4
  unreachable

14:                                               ; preds = %11
  %15 = tail call ptr @nmalloc(i64 noundef 1, i64 noundef 152)
  store ptr %15, ptr %0, align 8, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %15, i64 8
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %16, i8 0, i64 16, i1 false)
  %17 = load ptr, ptr %0, align 8, !tbaa !5
  %18 = getelementptr inbounds i8, ptr %17, i64 24
  store ptr null, ptr %18, align 8, !tbaa !9
  %19 = load ptr, ptr %0, align 8, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %19, i64 32
  store ptr null, ptr %20, align 8, !tbaa !14
  %21 = load ptr, ptr %0, align 8, !tbaa !5
  %22 = getelementptr inbounds i8, ptr %21, i64 40
  store ptr null, ptr %22, align 8, !tbaa !15
  %23 = load ptr, ptr %0, align 8, !tbaa !5
  %24 = getelementptr inbounds i8, ptr %23, i64 48
  store ptr null, ptr %24, align 8, !tbaa !16
  %25 = load ptr, ptr %0, align 8, !tbaa !5
  %26 = getelementptr inbounds i8, ptr %25, i64 56
  store ptr null, ptr %26, align 8, !tbaa !17
  %27 = tail call ptr @nmalloc(i64 noundef %2, i64 noundef 8)
  %28 = load ptr, ptr %0, align 8, !tbaa !5
  %29 = getelementptr inbounds i8, ptr %28, i64 64
  store ptr %27, ptr %29, align 8, !tbaa !18
  %30 = load ptr, ptr %0, align 8, !tbaa !5
  %31 = getelementptr inbounds i8, ptr %30, i64 72
  store ptr null, ptr %31, align 8, !tbaa !19
  %32 = load ptr, ptr %0, align 8, !tbaa !5
  %33 = getelementptr inbounds i8, ptr %32, i64 80
  store ptr null, ptr %33, align 8, !tbaa !20
  %34 = load ptr, ptr %0, align 8, !tbaa !5
  %35 = getelementptr inbounds i8, ptr %34, i64 88
  store ptr null, ptr %35, align 8, !tbaa !21
  %36 = tail call ptr @nmalloc(i64 noundef %2, i64 noundef 8)
  %37 = load ptr, ptr %0, align 8, !tbaa !5
  %38 = getelementptr inbounds i8, ptr %37, i64 96
  store ptr %36, ptr %38, align 8, !tbaa !22
  %39 = load ptr, ptr %0, align 8, !tbaa !5
  %40 = getelementptr inbounds i8, ptr %39, i64 96
  %41 = load ptr, ptr %40, align 8, !tbaa !22
  %42 = shl nuw nsw i64 %2, 3
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 8 %41, ptr nonnull align 8 %1, i64 %42, i1 false)
  %43 = load ptr, ptr %0, align 8, !tbaa !5
  %44 = getelementptr inbounds i8, ptr %43, i64 104
  store ptr null, ptr %44, align 8, !tbaa !23
  %45 = load ptr, ptr %0, align 8, !tbaa !5
  %46 = getelementptr inbounds i8, ptr %45, i64 112
  store i64 %2, ptr %46, align 8, !tbaa !24
  %47 = getelementptr inbounds i8, ptr %45, i64 120
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(25) %47, i8 0, i64 25, i1 false)
  store i64 44252, ptr %45, align 8, !tbaa !25
  ret i32 0
}

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @is_finite(ptr noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden ptr @nmalloc(i64 noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #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 = { 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 = { noreturn 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 nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { noreturn 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, !6, i64 24}
!10 = !{!"neonrvm_cache", !11, i64 0, !12, i64 8, !6, i64 16, !6, 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, !11, i64 112, !11, i64 120, !11, i64 128, !11, i64 136, !13, i64 144}
!11 = !{!"long", !7, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!"_Bool", !7, i64 0}
!14 = !{!10, !6, i64 32}
!15 = !{!10, !6, i64 40}
!16 = !{!10, !6, i64 48}
!17 = !{!10, !6, i64 56}
!18 = !{!10, !6, i64 64}
!19 = !{!10, !6, i64 72}
!20 = !{!10, !6, i64 80}
!21 = !{!10, !6, i64 88}
!22 = !{!10, !6, i64 96}
!23 = !{!10, !6, i64 104}
!24 = !{!10, !11, i64 112}
!25 = !{!10, !11, i64 0}


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