; LLVM IR from Slingshot-Physics/slingshot-community :: datamodel (data_matrix33)

; 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.matrix33 = type { [3 x [3 x float]] }

@.str = external hidden unnamed_addr constant [16 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @matrix33_to_json(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca [9 x float], align 16
  %7 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %8 = load ptr, ptr %4, align 8, !tbaa !5
  %9 = icmp eq ptr %8, null
  br i1 %9, label %10, label %11

10:                                               ; preds = %2
  store i32 0, ptr %3, align 4
  br label %81

11:                                               ; preds = %2
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = icmp eq ptr %12, null
  br i1 %13, label %14, label %15

14:                                               ; preds = %11
  store i32 0, ptr %3, align 4
  br label %81

15:                                               ; preds = %11
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = call i32 @add_typename(ptr noundef %16, ptr noundef @.str)
  %18 = icmp ne i32 %17, 0
  br i1 %18, label %20, label %19

19:                                               ; preds = %15
  store i32 0, ptr %3, align 4
  br label %81

20:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 36, ptr %6) #3
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.matrix33, ptr %21, i32 0, i32 0
  %23 = getelementptr inbounds [3 x [3 x float]], ptr %22, i64 0, i64 0
  %24 = getelementptr inbounds [3 x float], ptr %23, i64 0, i64 0
  %25 = load float, ptr %24, align 4, !tbaa !9
  store float %25, ptr %6, align 4, !tbaa !9
  %26 = getelementptr inbounds float, ptr %6, i64 1
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.matrix33, ptr %27, i32 0, i32 0
  %29 = getelementptr inbounds [3 x [3 x float]], ptr %28, i64 0, i64 0
  %30 = getelementptr inbounds [3 x float], ptr %29, i64 0, i64 1
  %31 = load float, ptr %30, align 4, !tbaa !9
  store float %31, ptr %26, align 4, !tbaa !9
  %32 = getelementptr inbounds float, ptr %6, i64 2
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.matrix33, ptr %33, i32 0, i32 0
  %35 = getelementptr inbounds [3 x [3 x float]], ptr %34, i64 0, i64 0
  %36 = getelementptr inbounds [3 x float], ptr %35, i64 0, i64 2
  %37 = load float, ptr %36, align 4, !tbaa !9
  store float %37, ptr %32, align 4, !tbaa !9
  %38 = getelementptr inbounds float, ptr %6, i64 3
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.matrix33, ptr %39, i32 0, i32 0
  %41 = getelementptr inbounds [3 x [3 x float]], ptr %40, i64 0, i64 1
  %42 = getelementptr inbounds [3 x float], ptr %41, i64 0, i64 0
  %43 = load float, ptr %42, align 4, !tbaa !9
  store float %43, ptr %38, align 4, !tbaa !9
  %44 = getelementptr inbounds float, ptr %6, i64 4
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.matrix33, ptr %45, i32 0, i32 0
  %47 = getelementptr inbounds [3 x [3 x float]], ptr %46, i64 0, i64 1
  %48 = getelementptr inbounds [3 x float], ptr %47, i64 0, i64 1
  %49 = load float, ptr %48, align 4, !tbaa !9
  store float %49, ptr %44, align 4, !tbaa !9
  %50 = getelementptr inbounds float, ptr %6, i64 5
  %51 = load ptr, ptr %5, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.matrix33, ptr %51, i32 0, i32 0
  %53 = getelementptr inbounds [3 x [3 x float]], ptr %52, i64 0, i64 1
  %54 = getelementptr inbounds [3 x float], ptr %53, i64 0, i64 2
  %55 = load float, ptr %54, align 4, !tbaa !9
  store float %55, ptr %50, align 4, !tbaa !9
  %56 = getelementptr inbounds float, ptr %6, i64 6
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.matrix33, ptr %57, i32 0, i32 0
  %59 = getelementptr inbounds [3 x [3 x float]], ptr %58, i64 0, i64 2
  %60 = getelementptr inbounds [3 x float], ptr %59, i64 0, i64 0
  %61 = load float, ptr %60, align 4, !tbaa !9
  store float %61, ptr %56, align 4, !tbaa !9
  %62 = getelementptr inbounds float, ptr %6, i64 7
  %63 = load ptr, ptr %5, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.matrix33, ptr %63, i32 0, i32 0
  %65 = getelementptr inbounds [3 x [3 x float]], ptr %64, i64 0, i64 2
  %66 = getelementptr inbounds [3 x float], ptr %65, i64 0, i64 1
  %67 = load float, ptr %66, align 4, !tbaa !9
  store float %67, ptr %62, align 4, !tbaa !9
  %68 = getelementptr inbounds float, ptr %6, i64 8
  %69 = load ptr, ptr %5, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.matrix33, ptr %69, i32 0, i32 0
  %71 = getelementptr inbounds [3 x [3 x float]], ptr %70, i64 0, i64 2
  %72 = getelementptr inbounds [3 x float], ptr %71, i64 0, i64 2
  %73 = load float, ptr %72, align 4, !tbaa !9
  store float %73, ptr %68, align 4, !tbaa !9
  %74 = load ptr, ptr %4, align 8, !tbaa !5
  %75 = getelementptr inbounds [9 x float], ptr %6, i64 0, i64 0
  %76 = call i32 @add_fixed_float_array_field(ptr noundef %74, ptr noundef @.str.1, i32 noundef 9, ptr noundef %75)
  %77 = icmp ne i32 %76, 0
  br i1 %77, label %79, label %78

78:                                               ; preds = %20
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %80

79:                                               ; preds = %20
  store i32 1, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %80

80:                                               ; preds = %79, %78
  call void @llvm.lifetime.end.p0(i64 36, ptr %6) #3
  br label %81

81:                                               ; preds = %80, %19, %14, %10
  %82 = load i32, ptr %3, align 4
  ret i32 %82
}

declare i32 @add_typename(ptr noundef, ptr noundef) #1

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

declare i32 @add_fixed_float_array_field(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { "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 nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, 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 [16 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @matrix33_to_json(ptr noundef %0, ptr noundef readonly %1) local_unnamed_addr #0 {
  %3 = alloca [9 x float], align 16
  %4 = icmp eq ptr %0, null
  %5 = icmp eq ptr %1, null
  %or.cond = or i1 %4, %5
  br i1 %or.cond, label %17, label %6

6:                                                ; preds = %2
  %7 = tail call i32 @add_typename(ptr noundef nonnull %0, ptr noundef nonnull @.str) #3
  %.not = icmp eq i32 %7, 0
  br i1 %.not, label %17, label %8

8:                                                ; preds = %6
  call void @llvm.lifetime.start.p0(i64 36, ptr nonnull %3) #3
  %9 = load <4 x float>, ptr %1, align 4, !tbaa !5
  store <4 x float> %9, ptr %3, align 16, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %3, i64 16
  %11 = getelementptr inbounds i8, ptr %1, i64 16
  %12 = load <4 x float>, ptr %11, align 4, !tbaa !5
  store <4 x float> %12, ptr %10, align 16, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %3, i64 32
  %14 = getelementptr inbounds i8, ptr %1, i64 32
  %15 = load float, ptr %14, align 4, !tbaa !5
  store float %15, ptr %13, align 16, !tbaa !5
  %16 = call i32 @add_fixed_float_array_field(ptr noundef nonnull %0, ptr noundef nonnull @.str.1, i32 noundef 9, ptr noundef nonnull %3) #3
  %.not15 = icmp ne i32 %16, 0
  %. = zext i1 %.not15 to i32
  call void @llvm.lifetime.end.p0(i64 36, ptr nonnull %3) #3
  br label %17

17:                                               ; preds = %6, %2, %8
  %.1 = phi i32 [ %., %8 ], [ 0, %2 ], [ 0, %6 ]
  ret i32 %.1
}

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

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { "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 nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


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