; LLVM IR from mnovak42/hepemshow :: Simulation/src/Geometry.ll (ZN8Geometry16UpdateParametersEv)

; 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.Geometry = type { i32, double, double, double, double, double, double, double, ptr, ptr, ptr, ptr, ptr }

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8Geometry16UpdateParametersEv(ptr noundef nonnull align 8 dereferenceable(104) %0) #1 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca double, align 8
  %4 = alloca double, align 8
  %5 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %6 = load ptr, ptr %2, align 8
  %7 = getelementptr inbounds %class.Geometry, ptr %6, i32 0, i32 1
  %8 = load double, ptr %7, align 8, !tbaa !9
  %9 = getelementptr inbounds %class.Geometry, ptr %6, i32 0, i32 2
  %10 = load double, ptr %9, align 8, !tbaa !13
  %11 = fadd double %8, %10
  %12 = getelementptr inbounds %class.Geometry, ptr %6, i32 0, i32 3
  store double %11, ptr %12, align 8, !tbaa !14
  %13 = getelementptr inbounds %class.Geometry, ptr %6, i32 0, i32 0
  %14 = load i32, ptr %13, align 8, !tbaa !15
  %15 = sitofp i32 %14 to double
  %16 = getelementptr inbounds %class.Geometry, ptr %6, i32 0, i32 3
  %17 = load double, ptr %16, align 8, !tbaa !14
  %18 = fmul double %15, %17
  %19 = getelementptr inbounds %class.Geometry, ptr %6, i32 0, i32 4
  store double %18, ptr %19, align 8, !tbaa !16
  %20 = getelementptr inbounds %class.Geometry, ptr %6, i32 0, i32 4
  %21 = load double, ptr %20, align 8, !tbaa !16
  %22 = fmul double -5.000000e-01, %21
  %23 = getelementptr inbounds %class.Geometry, ptr %6, i32 0, i32 6
  store double %22, ptr %23, align 8, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  %24 = getelementptr inbounds %class.Geometry, ptr %6, i32 0, i32 4
  %25 = load double, ptr %24, align 8, !tbaa !16
  %26 = fmul double 1.100000e+00, %25
  store double %26, ptr %3, align 8, !tbaa !18
  %27 = load double, ptr %3, align 8, !tbaa !18
  %28 = getelementptr inbounds %class.Geometry, ptr %6, i32 0, i32 4
  %29 = load double, ptr %28, align 8, !tbaa !16
  %30 = fadd double %27, %29
  %31 = fmul double -2.500000e-01, %30
  %32 = getelementptr inbounds %class.Geometry, ptr %6, i32 0, i32 7
  store double %31, ptr %32, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  %33 = getelementptr inbounds %class.Geometry, ptr %6, i32 0, i32 5
  %34 = load double, ptr %33, align 8, !tbaa !20
  %35 = fmul double 5.000000e-01, %34
  store double %35, ptr %4, align 8, !tbaa !18
  %36 = getelementptr inbounds %class.Geometry, ptr %6, i32 0, i32 8
  %37 = load ptr, ptr %36, align 8, !tbaa !21
  %38 = load double, ptr %3, align 8, !tbaa !18
  %39 = fmul double 5.000000e-01, %38
  call void @_ZN3Box13SetHalfLengthEdi(ptr noundef nonnull align 8 dereferenceable(80) %37, double noundef %39, i32 noundef 0)
  %40 = getelementptr inbounds %class.Geometry, ptr %6, i32 0, i32 8
  %41 = load ptr, ptr %40, align 8, !tbaa !21
  %42 = load double, ptr %4, align 8, !tbaa !18
  %43 = fmul double 1.100000e+00, %42
  call void @_ZN3Box13SetHalfLengthEdi(ptr noundef nonnull align 8 dereferenceable(80) %41, double noundef %43, i32 noundef 1)
  %44 = getelementptr inbounds %class.Geometry, ptr %6, i32 0, i32 8
  %45 = load ptr, ptr %44, align 8, !tbaa !21
  %46 = load double, ptr %4, align 8, !tbaa !18
  %47 = fmul double 1.100000e+00, %46
  call void @_ZN3Box13SetHalfLengthEdi(ptr noundef nonnull align 8 dereferenceable(80) %45, double noundef %47, i32 noundef 2)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 0, ptr %5, align 4, !tbaa !22
  %48 = getelementptr inbounds %class.Geometry, ptr %6, i32 0, i32 9
  %49 = load ptr, ptr %48, align 8, !tbaa !23
  %50 = load i32, ptr %5, align 4, !tbaa !22
  call void @_ZN3Box15SetMaterialIndxEi(ptr noundef nonnull align 8 dereferenceable(80) %49, i32 noundef %50)
  %51 = getelementptr inbounds %class.Geometry, ptr %6, i32 0, i32 9
  %52 = load ptr, ptr %51, align 8, !tbaa !23
  %53 = getelementptr inbounds %class.Geometry, ptr %6, i32 0, i32 4
  %54 = load double, ptr %53, align 8, !tbaa !16
  %55 = fmul double 5.000000e-01, %54
  call void @_ZN3Box13SetHalfLengthEdi(ptr noundef nonnull align 8 dereferenceable(80) %52, double noundef %55, i32 noundef 0)
  %56 = getelementptr inbounds %class.Geometry, ptr %6, i32 0, i32 9
  %57 = load ptr, ptr %56, align 8, !tbaa !23
  %58 = load double, ptr %4, align 8, !tbaa !18
  call void @_ZN3Box13SetHalfLengthEdi(ptr noundef nonnull align 8 dereferenceable(80) %57, double noundef %58, i32 noundef 1)
  %59 = getelementptr inbounds %class.Geometry, ptr %6, i32 0, i32 9
  %60 = load ptr, ptr %59, align 8, !tbaa !23
  %61 = load double, ptr %4, align 8, !tbaa !18
  call void @_ZN3Box13SetHalfLengthEdi(ptr noundef nonnull align 8 dereferenceable(80) %60, double noundef %61, i32 noundef 2)
  %62 = getelementptr inbounds %class.Geometry, ptr %6, i32 0, i32 10
  %63 = load ptr, ptr %62, align 8, !tbaa !24
  %64 = getelementptr inbounds %class.Geometry, ptr %6, i32 0, i32 3
  %65 = load double, ptr %64, align 8, !tbaa !14
  %66 = fmul double 5.000000e-01, %65
  call void @_ZN3Box13SetHalfLengthEdi(ptr noundef nonnull align 8 dereferenceable(80) %63, double noundef %66, i32 noundef 0)
  %67 = getelementptr inbounds %class.Geometry, ptr %6, i32 0, i32 10
  %68 = load ptr, ptr %67, align 8, !tbaa !24
  %69 = load double, ptr %4, align 8, !tbaa !18
  call void @_ZN3Box13SetHalfLengthEdi(ptr noundef nonnull align 8 dereferenceable(80) %68, double noundef %69, i32 noundef 1)
  %70 = getelementptr inbounds %class.Geometry, ptr %6, i32 0, i32 10
  %71 = load ptr, ptr %70, align 8, !tbaa !24
  %72 = load double, ptr %4, align 8, !tbaa !18
  call void @_ZN3Box13SetHalfLengthEdi(ptr noundef nonnull align 8 dereferenceable(80) %71, double noundef %72, i32 noundef 2)
  %73 = getelementptr inbounds %class.Geometry, ptr %6, i32 0, i32 11
  %74 = load ptr, ptr %73, align 8, !tbaa !25
  %75 = getelementptr inbounds %class.Geometry, ptr %6, i32 0, i32 1
  %76 = load double, ptr %75, align 8, !tbaa !9
  %77 = fmul double 5.000000e-01, %76
  call void @_ZN3Box13SetHalfLengthEdi(ptr noundef nonnull align 8 dereferenceable(80) %74, double noundef %77, i32 noundef 0)
  %78 = getelementptr inbounds %class.Geometry, ptr %6, i32 0, i32 11
  %79 = load ptr, ptr %78, align 8, !tbaa !25
  %80 = load double, ptr %4, align 8, !tbaa !18
  call void @_ZN3Box13SetHalfLengthEdi(ptr noundef nonnull align 8 dereferenceable(80) %79, double noundef %80, i32 noundef 1)
  %81 = getelementptr inbounds %class.Geometry, ptr %6, i32 0, i32 11
  %82 = load ptr, ptr %81, align 8, !tbaa !25
  %83 = load double, ptr %4, align 8, !tbaa !18
  call void @_ZN3Box13SetHalfLengthEdi(ptr noundef nonnull align 8 dereferenceable(80) %82, double noundef %83, i32 noundef 2)
  %84 = getelementptr inbounds %class.Geometry, ptr %6, i32 0, i32 12
  %85 = load ptr, ptr %84, align 8, !tbaa !26
  %86 = getelementptr inbounds %class.Geometry, ptr %6, i32 0, i32 2
  %87 = load double, ptr %86, align 8, !tbaa !13
  %88 = fmul double 5.000000e-01, %87
  call void @_ZN3Box13SetHalfLengthEdi(ptr noundef nonnull align 8 dereferenceable(80) %85, double noundef %88, i32 noundef 0)
  %89 = getelementptr inbounds %class.Geometry, ptr %6, i32 0, i32 12
  %90 = load ptr, ptr %89, align 8, !tbaa !26
  %91 = load double, ptr %4, align 8, !tbaa !18
  call void @_ZN3Box13SetHalfLengthEdi(ptr noundef nonnull align 8 dereferenceable(80) %90, double noundef %91, i32 noundef 1)
  %92 = getelementptr inbounds %class.Geometry, ptr %6, i32 0, i32 12
  %93 = load ptr, ptr %92, align 8, !tbaa !26
  %94 = load double, ptr %4, align 8, !tbaa !18
  call void @_ZN3Box13SetHalfLengthEdi(ptr noundef nonnull align 8 dereferenceable(80) %93, double noundef %94, i32 noundef 2)
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  ret void
}

declare void @_ZN3Box13SetHalfLengthEdi(ptr noundef nonnull align 8 dereferenceable(80), double noundef, i32 noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3Box15SetMaterialIndxEi(ptr noundef nonnull align 8 dereferenceable(80), i32 noundef) #3 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { "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 = { 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 #4 = { 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, !12, i64 8}
!10 = !{!"_ZTS8Geometry", !11, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !12, i64 48, !12, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96}
!11 = !{!"int", !7, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!10, !12, i64 16}
!14 = !{!10, !12, i64 24}
!15 = !{!10, !11, i64 0}
!16 = !{!10, !12, i64 32}
!17 = !{!10, !12, i64 48}
!18 = !{!12, !12, i64 0}
!19 = !{!10, !12, i64 56}
!20 = !{!10, !12, i64 40}
!21 = !{!10, !6, i64 64}
!22 = !{!11, !11, i64 0}
!23 = !{!10, !6, i64 72}
!24 = !{!10, !6, i64 80}
!25 = !{!10, !6, i64 88}
!26 = !{!10, !6, i64 96}


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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8Geometry16UpdateParametersEv(ptr nocapture noundef nonnull align 8 dereferenceable(104) %0) local_unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 8
  %3 = load double, ptr %2, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 16
  %5 = load double, ptr %4, align 8, !tbaa !12
  %6 = fadd double %3, %5
  %7 = getelementptr inbounds i8, ptr %0, i64 24
  store double %6, ptr %7, align 8, !tbaa !13
  %8 = load i32, ptr %0, align 8, !tbaa !14
  %9 = sitofp i32 %8 to double
  %10 = getelementptr inbounds i8, ptr %0, i64 32
  %11 = getelementptr inbounds i8, ptr %0, i64 48
  %12 = fmul double %6, %9
  store double %12, ptr %10, align 8, !tbaa !15
  %13 = fmul double %12, 1.100000e+00
  %14 = fadd double %12, %13
  %15 = insertelement <2 x double> poison, double %12, i64 0
  %16 = insertelement <2 x double> %15, double %14, i64 1
  %17 = fmul <2 x double> %16, <double -5.000000e-01, double -2.500000e-01>
  store <2 x double> %17, ptr %11, align 8, !tbaa !16
  %18 = getelementptr inbounds i8, ptr %0, i64 40
  %19 = load double, ptr %18, align 8, !tbaa !17
  %20 = fmul double %19, 5.000000e-01
  %21 = getelementptr inbounds i8, ptr %0, i64 64
  %22 = load ptr, ptr %21, align 8, !tbaa !18
  %23 = fmul double %13, 5.000000e-01
  tail call void @_ZN3Box13SetHalfLengthEdi(ptr noundef nonnull align 8 dereferenceable(80) %22, double noundef %23, i32 noundef 0)
  %24 = load ptr, ptr %21, align 8, !tbaa !18
  %25 = fmul double %20, 1.100000e+00
  tail call void @_ZN3Box13SetHalfLengthEdi(ptr noundef nonnull align 8 dereferenceable(80) %24, double noundef %25, i32 noundef 1)
  %26 = load ptr, ptr %21, align 8, !tbaa !18
  tail call void @_ZN3Box13SetHalfLengthEdi(ptr noundef nonnull align 8 dereferenceable(80) %26, double noundef %25, i32 noundef 2)
  %27 = getelementptr inbounds i8, ptr %0, i64 72
  %28 = load ptr, ptr %27, align 8, !tbaa !19
  tail call void @_ZN3Box15SetMaterialIndxEi(ptr noundef nonnull align 8 dereferenceable(80) %28, i32 noundef 0)
  %29 = load ptr, ptr %27, align 8, !tbaa !19
  %30 = load double, ptr %10, align 8, !tbaa !15
  %31 = fmul double %30, 5.000000e-01
  tail call void @_ZN3Box13SetHalfLengthEdi(ptr noundef nonnull align 8 dereferenceable(80) %29, double noundef %31, i32 noundef 0)
  %32 = load ptr, ptr %27, align 8, !tbaa !19
  tail call void @_ZN3Box13SetHalfLengthEdi(ptr noundef nonnull align 8 dereferenceable(80) %32, double noundef %20, i32 noundef 1)
  %33 = load ptr, ptr %27, align 8, !tbaa !19
  tail call void @_ZN3Box13SetHalfLengthEdi(ptr noundef nonnull align 8 dereferenceable(80) %33, double noundef %20, i32 noundef 2)
  %34 = getelementptr inbounds i8, ptr %0, i64 80
  %35 = load ptr, ptr %34, align 8, !tbaa !20
  %36 = load double, ptr %7, align 8, !tbaa !13
  %37 = fmul double %36, 5.000000e-01
  tail call void @_ZN3Box13SetHalfLengthEdi(ptr noundef nonnull align 8 dereferenceable(80) %35, double noundef %37, i32 noundef 0)
  %38 = load ptr, ptr %34, align 8, !tbaa !20
  tail call void @_ZN3Box13SetHalfLengthEdi(ptr noundef nonnull align 8 dereferenceable(80) %38, double noundef %20, i32 noundef 1)
  %39 = load ptr, ptr %34, align 8, !tbaa !20
  tail call void @_ZN3Box13SetHalfLengthEdi(ptr noundef nonnull align 8 dereferenceable(80) %39, double noundef %20, i32 noundef 2)
  %40 = getelementptr inbounds i8, ptr %0, i64 88
  %41 = load ptr, ptr %40, align 8, !tbaa !21
  %42 = load double, ptr %2, align 8, !tbaa !5
  %43 = fmul double %42, 5.000000e-01
  tail call void @_ZN3Box13SetHalfLengthEdi(ptr noundef nonnull align 8 dereferenceable(80) %41, double noundef %43, i32 noundef 0)
  %44 = load ptr, ptr %40, align 8, !tbaa !21
  tail call void @_ZN3Box13SetHalfLengthEdi(ptr noundef nonnull align 8 dereferenceable(80) %44, double noundef %20, i32 noundef 1)
  %45 = load ptr, ptr %40, align 8, !tbaa !21
  tail call void @_ZN3Box13SetHalfLengthEdi(ptr noundef nonnull align 8 dereferenceable(80) %45, double noundef %20, i32 noundef 2)
  %46 = getelementptr inbounds i8, ptr %0, i64 96
  %47 = load ptr, ptr %46, align 8, !tbaa !22
  %48 = load double, ptr %4, align 8, !tbaa !12
  %49 = fmul double %48, 5.000000e-01
  tail call void @_ZN3Box13SetHalfLengthEdi(ptr noundef nonnull align 8 dereferenceable(80) %47, double noundef %49, i32 noundef 0)
  %50 = load ptr, ptr %46, align 8, !tbaa !22
  tail call void @_ZN3Box13SetHalfLengthEdi(ptr noundef nonnull align 8 dereferenceable(80) %50, double noundef %20, i32 noundef 1)
  %51 = load ptr, ptr %46, align 8, !tbaa !22
  tail call void @_ZN3Box13SetHalfLengthEdi(ptr noundef nonnull align 8 dereferenceable(80) %51, double noundef %20, i32 noundef 2)
  ret void
}

declare void @_ZN3Box13SetHalfLengthEdi(ptr noundef nonnull align 8 dereferenceable(80), double noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3Box15SetMaterialIndxEi(ptr noundef nonnull align 8 dereferenceable(80), i32 noundef) local_unnamed_addr #2 align 2

attributes #0 = { 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 #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 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" }

!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 8}
!6 = !{!"_ZTS8Geometry", !7, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !11, i64 64, !11, i64 72, !11, i64 80, !11, i64 88, !11, i64 96}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"double", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!6, !10, i64 16}
!13 = !{!6, !10, i64 24}
!14 = !{!6, !7, i64 0}
!15 = !{!6, !10, i64 32}
!16 = !{!10, !10, i64 0}
!17 = !{!6, !10, i64 40}
!18 = !{!6, !11, i64 64}
!19 = !{!6, !11, i64 72}
!20 = !{!6, !11, i64 80}
!21 = !{!6, !11, i64 88}
!22 = !{!6, !11, i64 96}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,TailCallElimPass