; LLVM IR from kmilo17pet/qlibs :: qltisys (qLTISys_SetIntegrationMethod)

; 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._qLTISys_s = type { ptr, ptr, ptr, ptr, ptr, %struct.qTDL_t, float, float, float, float, i64, i64, i64, ptr }
%struct.qTDL_t = type { ptr, ptr, ptr, ptr, i64 }

; 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

declare float @qNumA_IntegralTr(ptr noundef, float noundef, float noundef, i1 noundef zeroext) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @qLTISys_SetIntegrationMethod(ptr noundef %0, ptr noundef %1) #2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  store i32 0, ptr %5, align 4, !tbaa !9
  %6 = load ptr, ptr %3, align 8, !tbaa !5
  %7 = icmp ne ptr null, %6
  br i1 %7, label %8, label %25

8:                                                ; preds = %2
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = icmp ne ptr null, %9
  br i1 %10, label %11, label %25

11:                                               ; preds = %8
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = icmp eq ptr %12, @qNumA_IntegralRe
  br i1 %13, label %20, label %14

14:                                               ; preds = %11
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = icmp eq ptr %15, @qNumA_IntegralTr
  br i1 %16, label %20, label %17

17:                                               ; preds = %14
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = icmp eq ptr %18, @qNumA_IntegralSi
  br i1 %19, label %20, label %24

20:                                               ; preds = %17, %14, %11
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct._qLTISys_s, ptr %22, i32 0, i32 13
  store ptr %21, ptr %23, align 8, !tbaa !11
  store i32 1, ptr %5, align 4, !tbaa !9
  br label %24

24:                                               ; preds = %20, %17
  br label %25

25:                                               ; preds = %24, %8, %2
  %26 = load i32, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  ret i32 %26
}

declare float @qNumA_IntegralRe(ptr noundef, float noundef, float noundef, i1 noundef zeroext) #1

declare float @qNumA_IntegralSi(ptr noundef, float noundef, float noundef, i1 noundef zeroext) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 }

!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 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 120}
!12 = !{!"_qLTISys_s", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !13, i64 40, !15, i64 80, !15, i64 84, !15, i64 88, !15, i64 92, !14, i64 96, !14, i64 104, !14, i64 112, !6, i64 120}
!13 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !14, i64 32}
!14 = !{!"long", !7, i64 0}
!15 = !{!"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"

declare float @qNumA_IntegralTr(ptr noundef, float noundef, float noundef, i1 noundef zeroext) #0

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable
define dso_local range(i32 0, 2) i32 @qLTISys_SetIntegrationMethod(ptr noundef writeonly %0, ptr noundef %1) local_unnamed_addr #1 {
  %3 = icmp ne ptr %0, null
  %4 = icmp ne ptr %1, null
  %or.cond = and i1 %3, %4
  br i1 %or.cond, label %5, label %11

5:                                                ; preds = %2
  %6 = icmp eq ptr %1, @qNumA_IntegralRe
  %7 = icmp eq ptr %1, @qNumA_IntegralTr
  %or.cond3 = or i1 %6, %7
  %8 = icmp eq ptr %1, @qNumA_IntegralSi
  %or.cond5 = or i1 %8, %or.cond3
  br i1 %or.cond5, label %9, label %11

9:                                                ; preds = %5
  %10 = getelementptr inbounds i8, ptr %0, i64 120
  store ptr %1, ptr %10, align 8, !tbaa !5
  br label %11

11:                                               ; preds = %9, %5, %2
  %.0 = phi i32 [ 1, %9 ], [ 0, %5 ], [ 0, %2 ]
  ret i32 %.0
}

declare float @qNumA_IntegralRe(ptr noundef, float noundef, float noundef, i1 noundef zeroext) #0

declare float @qNumA_IntegralSi(ptr noundef, float noundef, float noundef, i1 noundef zeroext) #0

attributes #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 nofree norecurse nosync nounwind willreturn memory(argmem: write) 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, !7, i64 120}
!6 = !{!"_qLTISys_s", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !10, i64 40, !12, i64 80, !12, i64 84, !12, i64 88, !12, i64 92, !11, i64 96, !11, i64 104, !11, i64 112, !7, i64 120}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !11, i64 32}
!11 = !{!"long", !8, i64 0}
!12 = !{!"float", !8, i64 0}


; Effective O3 passes: GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass