; LLVM IR from opensim-org/opensim-core :: Vendors/lepton/src (Operation)

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

%"class.Lepton::ExpressionTreeNode" = type { ptr, %"class.std::vector" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<Lepton::ExpressionTreeNode, std::allocator<Lepton::ExpressionTreeNode>>::_Vector_impl" }
%"struct.std::_Vector_base<Lepton::ExpressionTreeNode, std::allocator<Lepton::ExpressionTreeNode>>::_Vector_impl" = type { %"struct.std::_Vector_base<Lepton::ExpressionTreeNode, std::allocator<Lepton::ExpressionTreeNode>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Lepton::ExpressionTreeNode, std::allocator<Lepton::ExpressionTreeNode>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.Lepton::Operation::Custom" = type { %"class.Lepton::Operation", %"class.std::__cxx11::basic_string", ptr, i8, %"class.std::vector.3" }
%"class.Lepton::Operation" = type { ptr }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::vector.3" = type { %"struct.std::_Vector_base.4" }
%"struct.std::_Vector_base.4" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6Lepton9Operation8ConstantC2Ed(ptr noundef nonnull align 8 dereferenceable(16), double noundef) unnamed_addr #1 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #2

declare void @_ZN6Lepton18ExpressionTreeNodeC1EPNS_9OperationE(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) unnamed_addr #3

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK6Lepton9Operation6Custom13differentiateERKSt6vectorINS_18ExpressionTreeNodeESaIS3_EES7_RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr dead_on_unwind noalias writable sret(%"class.Lepton::ExpressionTreeNode") align 8 %0, ptr noundef nonnull align 8 dereferenceable(80) %1, ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(32) %4) unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i1, align 1
  %14 = alloca %"class.Lepton::ExpressionTreeNode", align 8
  %15 = alloca i32, align 4
  %16 = alloca %"class.Lepton::ExpressionTreeNode", align 8
  %17 = alloca %"class.Lepton::ExpressionTreeNode", align 8
  %18 = alloca %"class.Lepton::ExpressionTreeNode", align 8
  store ptr %0, ptr %6, align 8
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  store ptr %4, ptr %10, align 8, !tbaa !5
  %19 = load ptr, ptr %7, align 8
  %20 = getelementptr inbounds %"class.Lepton::Operation::Custom", ptr %19, i32 0, i32 2
  %21 = load ptr, ptr %20, align 8, !tbaa !9
  %22 = load ptr, ptr %21, align 8, !tbaa !20
  %23 = getelementptr inbounds ptr, ptr %22, i64 2
  %24 = load ptr, ptr %23, align 8
  %25 = call noundef i32 %24(ptr noundef nonnull align 8 dereferenceable(8) %21)
  %26 = icmp eq i32 %25, 0
  br i1 %26, label %27, label %34

27:                                               ; preds = %5
  %28 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 16) #7
  invoke void @_ZN6Lepton9Operation8ConstantC2Ed(ptr noundef nonnull align 8 dereferenceable(16) %28, double noundef 0.000000e+00)
          to label %29 unwind label %30

29:                                               ; preds = %27
  call void @_ZN6Lepton18ExpressionTreeNodeC1EPNS_9OperationE(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef %28)
  br label %139

30:                                               ; preds = %27
  %31 = landingpad { ptr, i32 }
          cleanup
  %32 = extractvalue { ptr, i32 } %31, 0
  store ptr %32, ptr %11, align 8
  %33 = extractvalue { ptr, i32 } %31, 1
  store i32 %33, ptr %12, align 4
  call void @_ZdlPvm(ptr noundef %28, i64 noundef 16) #8
  br label %140

34:                                               ; preds = %5
  store i1 false, ptr %13, align 1
  %35 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 8) #7
  invoke void @_ZN6Lepton9Operation8MultiplyC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %35)
          to label %36 unwind label %52

36:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 32, ptr %14) #9
  %37 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 80) #7
  invoke void @_ZN6Lepton9Operation6CustomC2ERKS1_i(ptr noundef nonnull align 8 dereferenceable(80) %37, ptr noundef nonnull align 8 dereferenceable(80) %19, i32 noundef 0)
          to label %38 unwind label %56

38:                                               ; preds = %36
  %39 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZN6Lepton18ExpressionTreeNodeC1EPNS_9OperationERKSt6vectorIS0_SaIS0_EE(ptr noundef nonnull align 8 dereferenceable(32) %14, ptr noundef %37, ptr noundef nonnull align 8 dereferenceable(24) %39)
  %40 = load ptr, ptr %9, align 8, !tbaa !5
  %41 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt6vectorIN6Lepton18ExpressionTreeNodeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %40, i64 noundef 0) #9
  invoke void @_ZN6Lepton18ExpressionTreeNodeC1EPNS_9OperationERKS0_S4_(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef %35, ptr noundef nonnull align 8 dereferenceable(32) %14, ptr noundef nonnull align 8 dereferenceable(32) %41)
          to label %42 unwind label %60

42:                                               ; preds = %38
  call void @_ZN6Lepton18ExpressionTreeNodeD1Ev(ptr noundef nonnull align 8 dereferenceable(32) %14) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr %14) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #9
  store i32 1, ptr %15, align 4, !tbaa !22
  br label %43

43:                                               ; preds = %90, %42
  %44 = load i32, ptr %15, align 4, !tbaa !22
  %45 = load ptr, ptr %19, align 8, !tbaa !20
  %46 = getelementptr inbounds ptr, ptr %45, i64 4
  %47 = load ptr, ptr %46, align 8
  %48 = invoke noundef i32 %47(ptr noundef nonnull align 8 dereferenceable(80) %19)
          to label %49 unwind label %65

49:                                               ; preds = %43
  %50 = icmp slt i32 %44, %48
  br i1 %50, label %69, label %51

51:                                               ; preds = %49
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #9
  br label %135

52:                                               ; preds = %34
  %53 = landingpad { ptr, i32 }
          cleanup
  %54 = extractvalue { ptr, i32 } %53, 0
  store ptr %54, ptr %11, align 8
  %55 = extractvalue { ptr, i32 } %53, 1
  store i32 %55, ptr %12, align 4
  call void @_ZdlPvm(ptr noundef %35, i64 noundef 8) #8
  br label %140

56:                                               ; preds = %36
  %57 = landingpad { ptr, i32 }
          cleanup
  %58 = extractvalue { ptr, i32 } %57, 0
  store ptr %58, ptr %11, align 8
  %59 = extractvalue { ptr, i32 } %57, 1
  store i32 %59, ptr %12, align 4
  call void @_ZdlPvm(ptr noundef %37, i64 noundef 80) #8
  br label %64

60:                                               ; preds = %38
  %61 = landingpad { ptr, i32 }
          cleanup
  %62 = extractvalue { ptr, i32 } %61, 0
  store ptr %62, ptr %11, align 8
  %63 = extractvalue { ptr, i32 } %61, 1
  store i32 %63, ptr %12, align 4
  call void @_ZN6Lepton18ExpressionTreeNodeD1Ev(ptr noundef nonnull align 8 dereferenceable(32) %14) #9
  br label %64

64:                                               ; preds = %60, %56
  call void @llvm.lifetime.end.p0(i64 32, ptr %14) #9
  br label %140

65:                                               ; preds = %43
  %66 = landingpad { ptr, i32 }
          cleanup
  %67 = extractvalue { ptr, i32 } %66, 0
  store ptr %67, ptr %11, align 8
  %68 = extractvalue { ptr, i32 } %66, 1
  store i32 %68, ptr %12, align 4
  br label %134

69:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 32, ptr %16) #9
  %70 = invoke noalias noundef nonnull ptr @_Znwm(i64 noundef 8) #7
          to label %71 unwind label %93

71:                                               ; preds = %69
  invoke void @_ZN6Lepton9Operation3AddC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %70)
          to label %72 unwind label %97

72:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 32, ptr %17) #9
  %73 = invoke noalias noundef nonnull ptr @_Znwm(i64 noundef 8) #7
          to label %74 unwind label %101

74:                                               ; preds = %72
  invoke void @_ZN6Lepton9Operation8MultiplyC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %73)
          to label %75 unwind label %105

75:                                               ; preds = %74
  call void @llvm.lifetime.start.p0(i64 32, ptr %18) #9
  %76 = invoke noalias noundef nonnull ptr @_Znwm(i64 noundef 80) #7
          to label %77 unwind label %109

77:                                               ; preds = %75
  %78 = load i32, ptr %15, align 4, !tbaa !22
  invoke void @_ZN6Lepton9Operation6CustomC2ERKS1_i(ptr noundef nonnull align 8 dereferenceable(80) %76, ptr noundef nonnull align 8 dereferenceable(80) %19, i32 noundef %78)
          to label %79 unwind label %113

79:                                               ; preds = %77
  %80 = load ptr, ptr %8, align 8, !tbaa !5
  invoke void @_ZN6Lepton18ExpressionTreeNodeC1EPNS_9OperationERKSt6vectorIS0_SaIS0_EE(ptr noundef nonnull align 8 dereferenceable(32) %18, ptr noundef %76, ptr noundef nonnull align 8 dereferenceable(24) %80)
          to label %81 unwind label %109

81:                                               ; preds = %79
  %82 = load ptr, ptr %9, align 8, !tbaa !5
  %83 = load i32, ptr %15, align 4, !tbaa !22
  %84 = sext i32 %83 to i64
  %85 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt6vectorIN6Lepton18ExpressionTreeNodeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %82, i64 noundef %84) #9
  invoke void @_ZN6Lepton18ExpressionTreeNodeC1EPNS_9OperationERKS0_S4_(ptr noundef nonnull align 8 dereferenceable(32) %17, ptr noundef %73, ptr noundef nonnull align 8 dereferenceable(32) %18, ptr noundef nonnull align 8 dereferenceable(32) %85)
          to label %86 unwind label %117

86:                                               ; preds = %81
  invoke void @_ZN6Lepton18ExpressionTreeNodeC1EPNS_9OperationERKS0_S4_(ptr noundef nonnull align 8 dereferenceable(32) %16, ptr noundef %70, ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(32) %17)
          to label %87 unwind label %121

87:                                               ; preds = %86
  %88 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZN6Lepton18ExpressionTreeNodeaSERKS0_(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(32) %16)
          to label %89 unwind label %125

89:                                               ; preds = %87
  call void @_ZN6Lepton18ExpressionTreeNodeD1Ev(ptr noundef nonnull align 8 dereferenceable(32) %16) #9
  call void @_ZN6Lepton18ExpressionTreeNodeD1Ev(ptr noundef nonnull align 8 dereferenceable(32) %17) #9
  call void @_ZN6Lepton18ExpressionTreeNodeD1Ev(ptr noundef nonnull align 8 dereferenceable(32) %18) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr %18) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr %17) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr %16) #9
  br label %90

90:                                               ; preds = %89
  %91 = load i32, ptr %15, align 4, !tbaa !22
  %92 = add nsw i32 %91, 1
  store i32 %92, ptr %15, align 4, !tbaa !22
  br label %43, !llvm.loop !24

93:                                               ; preds = %69
  %94 = landingpad { ptr, i32 }
          cleanup
  %95 = extractvalue { ptr, i32 } %94, 0
  store ptr %95, ptr %11, align 8
  %96 = extractvalue { ptr, i32 } %94, 1
  store i32 %96, ptr %12, align 4
  br label %133

97:                                               ; preds = %71
  %98 = landingpad { ptr, i32 }
          cleanup
  %99 = extractvalue { ptr, i32 } %98, 0
  store ptr %99, ptr %11, align 8
  %100 = extractvalue { ptr, i32 } %98, 1
  store i32 %100, ptr %12, align 4
  call void @_ZdlPvm(ptr noundef %70, i64 noundef 8) #8
  br label %133

101:                                              ; preds = %72
  %102 = landingpad { ptr, i32 }
          cleanup
  %103 = extractvalue { ptr, i32 } %102, 0
  store ptr %103, ptr %11, align 8
  %104 = extractvalue { ptr, i32 } %102, 1
  store i32 %104, ptr %12, align 4
  br label %132

105:                                              ; preds = %74
  %106 = landingpad { ptr, i32 }
          cleanup
  %107 = extractvalue { ptr, i32 } %106, 0
  store ptr %107, ptr %11, align 8
  %108 = extractvalue { ptr, i32 } %106, 1
  store i32 %108, ptr %12, align 4
  call void @_ZdlPvm(ptr noundef %73, i64 noundef 8) #8
  br label %132

109:                                              ; preds = %79, %75
  %110 = landingpad { ptr, i32 }
          cleanup
  %111 = extractvalue { ptr, i32 } %110, 0
  store ptr %111, ptr %11, align 8
  %112 = extractvalue { ptr, i32 } %110, 1
  store i32 %112, ptr %12, align 4
  br label %131

113:                                              ; preds = %77
  %114 = landingpad { ptr, i32 }
          cleanup
  %115 = extractvalue { ptr, i32 } %114, 0
  store ptr %115, ptr %11, align 8
  %116 = extractvalue { ptr, i32 } %114, 1
  store i32 %116, ptr %12, align 4
  call void @_ZdlPvm(ptr noundef %76, i64 noundef 80) #8
  br label %131

117:                                              ; preds = %81
  %118 = landingpad { ptr, i32 }
          cleanup
  %119 = extractvalue { ptr, i32 } %118, 0
  store ptr %119, ptr %11, align 8
  %120 = extractvalue { ptr, i32 } %118, 1
  store i32 %120, ptr %12, align 4
  br label %130

121:                                              ; preds = %86
  %122 = landingpad { ptr, i32 }
          cleanup
  %123 = extractvalue { ptr, i32 } %122, 0
  store ptr %123, ptr %11, align 8
  %124 = extractvalue { ptr, i32 } %122, 1
  store i32 %124, ptr %12, align 4
  br label %129

125:                                              ; preds = %87
  %126 = landingpad { ptr, i32 }
          cleanup
  %127 = extractvalue { ptr, i32 } %126, 0
  store ptr %127, ptr %11, align 8
  %128 = extractvalue { ptr, i32 } %126, 1
  store i32 %128, ptr %12, align 4
  call void @_ZN6Lepton18ExpressionTreeNodeD1Ev(ptr noundef nonnull align 8 dereferenceable(32) %16) #9
  br label %129

129:                                              ; preds = %125, %121
  call void @_ZN6Lepton18ExpressionTreeNodeD1Ev(ptr noundef nonnull align 8 dereferenceable(32) %17) #9
  br label %130

130:                                              ; preds = %129, %117
  call void @_ZN6Lepton18ExpressionTreeNodeD1Ev(ptr noundef nonnull align 8 dereferenceable(32) %18) #9
  br label %131

131:                                              ; preds = %130, %113, %109
  call void @llvm.lifetime.end.p0(i64 32, ptr %18) #9
  br label %132

132:                                              ; preds = %131, %105, %101
  call void @llvm.lifetime.end.p0(i64 32, ptr %17) #9
  br label %133

133:                                              ; preds = %132, %97, %93
  call void @llvm.lifetime.end.p0(i64 32, ptr %16) #9
  br label %134

134:                                              ; preds = %133, %65
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #9
  call void @_ZN6Lepton18ExpressionTreeNodeD1Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) #9
  br label %140

135:                                              ; preds = %51
  store i1 true, ptr %13, align 1
  %136 = load i1, ptr %13, align 1
  br i1 %136, label %138, label %137

137:                                              ; preds = %135
  call void @_ZN6Lepton18ExpressionTreeNodeD1Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) #9
  br label %138

138:                                              ; preds = %137, %135
  br label %139

139:                                              ; preds = %138, %29
  ret void

140:                                              ; preds = %134, %64, %52, %30
  %141 = load ptr, ptr %11, align 8
  %142 = load i32, ptr %12, align 4
  %143 = insertvalue { ptr, i32 } poison, ptr %141, 0
  %144 = insertvalue { ptr, i32 } %143, i32 %142, 1
  resume { ptr, i32 } %144
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6Lepton9Operation8MultiplyC2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6Lepton9Operation6CustomC2ERKS1_i(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 8 dereferenceable(80), i32 noundef) unnamed_addr #4 align 2

declare void @_ZN6Lepton18ExpressionTreeNodeC1EPNS_9OperationERKSt6vectorIS0_SaIS0_EE(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt6vectorIN6Lepton18ExpressionTreeNodeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 align 2

declare void @_ZN6Lepton18ExpressionTreeNodeC1EPNS_9OperationERKS0_S4_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3

; Function Attrs: nounwind
declare void @_ZN6Lepton18ExpressionTreeNodeD1Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #6

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6Lepton9Operation3AddC2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1 align 2

declare noundef nonnull align 8 dereferenceable(32) ptr @_ZN6Lepton18ExpressionTreeNodeaSERKS0_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) #3

attributes #0 = { nobuiltin allocsize(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 = { 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 = { "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 #4 = { mustprogress 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 #5 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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 #7 = { builtin allocsize(0) }
attributes #8 = { builtin nounwind }
attributes #9 = { 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 40}
!10 = !{!"_ZTSN6Lepton9Operation6CustomE", !11, i64 0, !12, i64 8, !6, i64 40, !15, i64 48, !16, i64 56}
!11 = !{!"_ZTSN6Lepton9OperationE"}
!12 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !13, i64 0, !14, i64 8, !7, i64 16}
!13 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!"bool", !7, i64 0}
!16 = !{!"_ZTSSt6vectorIiSaIiEE", !17, i64 0}
!17 = !{!"_ZTSSt12_Vector_baseIiSaIiEE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE12_Vector_implE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!20 = !{!21, !21, i64 0}
!21 = !{!"vtable pointer", !8, i64 0}
!22 = !{!23, !23, i64 0}
!23 = !{!"int", !7, i64 0}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}


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

%"class.Lepton::ExpressionTreeNode" = type { ptr, %"class.std::vector" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<Lepton::ExpressionTreeNode, std::allocator<Lepton::ExpressionTreeNode>>::_Vector_impl" }
%"struct.std::_Vector_base<Lepton::ExpressionTreeNode, std::allocator<Lepton::ExpressionTreeNode>>::_Vector_impl" = type { %"struct.std::_Vector_base<Lepton::ExpressionTreeNode, std::allocator<Lepton::ExpressionTreeNode>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Lepton::ExpressionTreeNode, std::allocator<Lepton::ExpressionTreeNode>>::_Vector_impl_data" = type { ptr, ptr, ptr }

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6Lepton9Operation8ConstantC2Ed(ptr noundef nonnull align 8 dereferenceable(16), double noundef) unnamed_addr #1 align 2

declare i32 @__gxx_personality_v0(...)

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

declare void @_ZN6Lepton18ExpressionTreeNodeC1EPNS_9OperationE(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) unnamed_addr #3

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK6Lepton9Operation6Custom13differentiateERKSt6vectorINS_18ExpressionTreeNodeESaIS3_EES7_RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr dead_on_unwind noalias writable sret(%"class.Lepton::ExpressionTreeNode") align 8 %0, ptr noundef nonnull align 8 dereferenceable(80) %1, ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(24) %3, ptr nocapture noundef nonnull readnone align 8 dereferenceable(32) %4) unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca %"class.Lepton::ExpressionTreeNode", align 8
  %7 = alloca %"class.Lepton::ExpressionTreeNode", align 8
  %8 = alloca %"class.Lepton::ExpressionTreeNode", align 8
  %9 = alloca %"class.Lepton::ExpressionTreeNode", align 8
  %10 = getelementptr inbounds i8, ptr %1, i64 40
  %11 = load ptr, ptr %10, align 8, !tbaa !5
  %12 = load ptr, ptr %11, align 8, !tbaa !19
  %13 = getelementptr inbounds i8, ptr %12, i64 16
  %14 = load ptr, ptr %13, align 8
  %15 = tail call noundef i32 %14(ptr noundef nonnull align 8 dereferenceable(8) %11)
  %16 = icmp eq i32 %15, 0
  br i1 %16, label %17, label %19

17:                                               ; preds = %5
  %18 = tail call noalias noundef nonnull dereferenceable(16) ptr @_Znwm(i64 noundef 16) #7
  tail call void @_ZN6Lepton9Operation8ConstantC2Ed(ptr noundef nonnull align 8 dereferenceable(16) %18, double noundef 0.000000e+00)
  tail call void @_ZN6Lepton18ExpressionTreeNodeC1EPNS_9OperationE(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull %18)
  br label %.loopexit

19:                                               ; preds = %5
  %20 = tail call noalias noundef nonnull dereferenceable(8) ptr @_Znwm(i64 noundef 8) #7
  tail call void @_ZN6Lepton9Operation8MultiplyC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %20)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %6) #8
  %21 = tail call noalias noundef nonnull dereferenceable(80) ptr @_Znwm(i64 noundef 80) #7
  invoke void @_ZN6Lepton9Operation6CustomC2ERKS1_i(ptr noundef nonnull align 8 dereferenceable(80) %21, ptr noundef nonnull align 8 dereferenceable(80) %1, i32 noundef 0)
          to label %22 unwind label %33

22:                                               ; preds = %19
  call void @_ZN6Lepton18ExpressionTreeNodeC1EPNS_9OperationERKSt6vectorIS0_SaIS0_EE(ptr noundef nonnull align 8 dereferenceable(32) %6, ptr noundef nonnull %21, ptr noundef nonnull align 8 dereferenceable(24) %2)
  %23 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt6vectorIN6Lepton18ExpressionTreeNodeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef 0) #8
  invoke void @_ZN6Lepton18ExpressionTreeNodeC1EPNS_9OperationERKS0_S4_(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull %20, ptr noundef nonnull align 8 dereferenceable(32) %6, ptr noundef nonnull align 8 dereferenceable(32) %23)
          to label %24 unwind label %35

24:                                               ; preds = %22
  call void @_ZN6Lepton18ExpressionTreeNodeD1Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #8
  br label %25

25:                                               ; preds = %54, %24
  %indvars.iv = phi i64 [ %indvars.iv.next, %54 ], [ 1, %24 ]
  %26 = load ptr, ptr %1, align 8, !tbaa !19
  %27 = getelementptr inbounds i8, ptr %26, i64 32
  %28 = load ptr, ptr %27, align 8
  %29 = invoke noundef i32 %28(ptr noundef nonnull align 8 dereferenceable(80) %1)
          to label %30 unwind label %38

30:                                               ; preds = %25
  %31 = sext i32 %29 to i64
  %32 = icmp slt i64 %indvars.iv, %31
  br i1 %32, label %40, label %.loopexit

33:                                               ; preds = %19
  %34 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %21, i64 noundef 80) #9
  br label %37

35:                                               ; preds = %22
  %36 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN6Lepton18ExpressionTreeNodeD1Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #8
  br label %37

37:                                               ; preds = %35, %33
  %.pn = phi { ptr, i32 } [ %36, %35 ], [ %34, %33 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #8
  br label %75

38:                                               ; preds = %25
  %39 = landingpad { ptr, i32 }
          cleanup
  br label %74

40:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %7) #8
  %41 = invoke noalias noundef nonnull dereferenceable(8) ptr @_Znwm(i64 noundef 8) #7
          to label %42 unwind label %55

42:                                               ; preds = %40
  call void @_ZN6Lepton9Operation3AddC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %41)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %8) #8
  %43 = invoke noalias noundef nonnull dereferenceable(8) ptr @_Znwm(i64 noundef 8) #7
          to label %44 unwind label %57

44:                                               ; preds = %42
  call void @_ZN6Lepton9Operation8MultiplyC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %43)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %9) #8
  %45 = invoke noalias noundef nonnull dereferenceable(80) ptr @_Znwm(i64 noundef 80) #7
          to label %46 unwind label %59

46:                                               ; preds = %44
  %47 = trunc nuw nsw i64 %indvars.iv to i32
  invoke void @_ZN6Lepton9Operation6CustomC2ERKS1_i(ptr noundef nonnull align 8 dereferenceable(80) %45, ptr noundef nonnull align 8 dereferenceable(80) %1, i32 noundef %47)
          to label %48 unwind label %61

48:                                               ; preds = %46
  invoke void @_ZN6Lepton18ExpressionTreeNodeC1EPNS_9OperationERKSt6vectorIS0_SaIS0_EE(ptr noundef nonnull align 8 dereferenceable(32) %9, ptr noundef nonnull %45, ptr noundef nonnull align 8 dereferenceable(24) %2)
          to label %49 unwind label %59

49:                                               ; preds = %48
  %50 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt6vectorIN6Lepton18ExpressionTreeNodeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %indvars.iv) #8
  invoke void @_ZN6Lepton18ExpressionTreeNodeC1EPNS_9OperationERKS0_S4_(ptr noundef nonnull align 8 dereferenceable(32) %8, ptr noundef nonnull %43, ptr noundef nonnull align 8 dereferenceable(32) %9, ptr noundef nonnull align 8 dereferenceable(32) %50)
          to label %51 unwind label %63

51:                                               ; preds = %49
  invoke void @_ZN6Lepton18ExpressionTreeNodeC1EPNS_9OperationERKS0_S4_(ptr noundef nonnull align 8 dereferenceable(32) %7, ptr noundef nonnull %41, ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(32) %8)
          to label %52 unwind label %65

52:                                               ; preds = %51
  %53 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZN6Lepton18ExpressionTreeNodeaSERKS0_(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(32) %7)
          to label %54 unwind label %67

54:                                               ; preds = %52
  call void @_ZN6Lepton18ExpressionTreeNodeD1Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #8
  call void @_ZN6Lepton18ExpressionTreeNodeD1Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #8
  call void @_ZN6Lepton18ExpressionTreeNodeD1Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #8
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  br label %25, !llvm.loop !21

55:                                               ; preds = %40
  %56 = landingpad { ptr, i32 }
          cleanup
  br label %73

57:                                               ; preds = %42
  %58 = landingpad { ptr, i32 }
          cleanup
  br label %72

59:                                               ; preds = %48, %44
  %60 = landingpad { ptr, i32 }
          cleanup
  br label %71

61:                                               ; preds = %46
  %62 = landingpad { ptr, i32 }
          cleanup
  call void @_ZdlPvm(ptr noundef nonnull %45, i64 noundef 80) #9
  br label %71

63:                                               ; preds = %49
  %64 = landingpad { ptr, i32 }
          cleanup
  br label %70

65:                                               ; preds = %51
  %66 = landingpad { ptr, i32 }
          cleanup
  br label %69

67:                                               ; preds = %52
  %68 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN6Lepton18ExpressionTreeNodeD1Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #8
  br label %69

69:                                               ; preds = %67, %65
  %.pn21 = phi { ptr, i32 } [ %68, %67 ], [ %66, %65 ]
  call void @_ZN6Lepton18ExpressionTreeNodeD1Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #8
  br label %70

70:                                               ; preds = %69, %63
  %.pn21.pn = phi { ptr, i32 } [ %.pn21, %69 ], [ %64, %63 ]
  call void @_ZN6Lepton18ExpressionTreeNodeD1Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #8
  br label %71

71:                                               ; preds = %70, %61, %59
  %.pn21.pn.pn = phi { ptr, i32 } [ %.pn21.pn, %70 ], [ %60, %59 ], [ %62, %61 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #8
  br label %72

72:                                               ; preds = %71, %57
  %.pn21.pn.pn.pn = phi { ptr, i32 } [ %.pn21.pn.pn, %71 ], [ %58, %57 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #8
  br label %73

73:                                               ; preds = %72, %55
  %.pn21.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn21.pn.pn.pn, %72 ], [ %56, %55 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #8
  br label %74

74:                                               ; preds = %73, %38
  %.pn21.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn21.pn.pn.pn.pn, %73 ], [ %39, %38 ]
  call void @_ZN6Lepton18ExpressionTreeNodeD1Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) #8
  br label %75

.loopexit:                                        ; preds = %30, %17
  ret void

75:                                               ; preds = %74, %37
  %.pn21.pn.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn21.pn.pn.pn.pn.pn, %74 ], [ %.pn, %37 ]
  resume { ptr, i32 } %.pn21.pn.pn.pn.pn.pn.pn
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6Lepton9Operation8MultiplyC2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6Lepton9Operation6CustomC2ERKS1_i(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 8 dereferenceable(80), i32 noundef) unnamed_addr #4 align 2

declare void @_ZN6Lepton18ExpressionTreeNodeC1EPNS_9OperationERKSt6vectorIS0_SaIS0_EE(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt6vectorIN6Lepton18ExpressionTreeNodeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #1 align 2

declare void @_ZN6Lepton18ExpressionTreeNodeC1EPNS_9OperationERKS0_S4_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3

; Function Attrs: nounwind
declare void @_ZN6Lepton18ExpressionTreeNodeD1Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #6

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6Lepton9Operation3AddC2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1 align 2

declare noundef nonnull align 8 dereferenceable(32) ptr @_ZN6Lepton18ExpressionTreeNodeaSERKS0_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3

attributes #0 = { nobuiltin allocsize(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 = { 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 = { "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 #4 = { mustprogress 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 #5 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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 #7 = { builtin allocsize(0) }
attributes #8 = { nounwind }
attributes #9 = { 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, !10, i64 40}
!6 = !{!"_ZTSN6Lepton9Operation6CustomE", !7, i64 0, !8, i64 8, !10, i64 40, !14, i64 48, !15, i64 56}
!7 = !{!"_ZTSN6Lepton9OperationE"}
!8 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !9, i64 0, !13, i64 8, !11, i64 16}
!9 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !10, i64 0}
!10 = !{!"any pointer", !11, i64 0}
!11 = !{!"omnipotent char", !12, i64 0}
!12 = !{!"Simple C++ TBAA"}
!13 = !{!"long", !11, i64 0}
!14 = !{!"bool", !11, i64 0}
!15 = !{!"_ZTSSt6vectorIiSaIiEE", !16, i64 0}
!16 = !{!"_ZTSSt12_Vector_baseIiSaIiEE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE12_Vector_implE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE17_Vector_impl_dataE", !10, i64 0, !10, i64 8, !10, i64 16}
!19 = !{!20, !20, i64 0}
!20 = !{!"vtable pointer", !12, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass