; LLVM IR from kmilo17pet/qlibs :: qfis (qFIS_SetDeFuzzMethod)

; 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._qFIS_s = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i64, i64, i64, i64, i64, i64, i64, i64, float, i8, i32 }

@qFIS_SetDeFuzzMethod.method = external hidden constant [7 x ptr], align 16

; 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: nounwind uwtable
define dso_local i32 @qFIS_SetDeFuzzMethod(ptr noundef %0, i32 noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #2
  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 %11, label %8

8:                                                ; preds = %2
  %9 = load i32, ptr %4, align 4, !tbaa !9
  %10 = icmp ult i32 %9, 7
  br i1 %10, label %11, label %46

11:                                               ; preds = %8, %2
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct._qFIS_s, ptr %12, i32 0, i32 24
  %14 = load i32, ptr %13, align 8, !tbaa !11
  %15 = icmp eq i32 0, %14
  br i1 %15, label %16, label %19

16:                                               ; preds = %11
  %17 = load i32, ptr %4, align 4, !tbaa !9
  %18 = icmp ule i32 %17, 4
  br i1 %18, label %38, label %19

19:                                               ; preds = %16, %11
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct._qFIS_s, ptr %20, i32 0, i32 24
  %22 = load i32, ptr %21, align 8, !tbaa !11
  %23 = icmp eq i32 1, %22
  br i1 %23, label %24, label %30

24:                                               ; preds = %19
  %25 = load i32, ptr %4, align 4, !tbaa !9
  %26 = icmp uge i32 %25, 5
  br i1 %26, label %27, label %30

27:                                               ; preds = %24
  %28 = load i32, ptr %4, align 4, !tbaa !9
  %29 = icmp ule i32 %28, 6
  br i1 %29, label %38, label %30

30:                                               ; preds = %27, %24, %19
  %31 = load ptr, ptr %3, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct._qFIS_s, ptr %31, i32 0, i32 24
  %33 = load i32, ptr %32, align 8, !tbaa !11
  %34 = icmp eq i32 2, %33
  br i1 %34, label %35, label %45

35:                                               ; preds = %30
  %36 = load i32, ptr %4, align 4, !tbaa !9
  %37 = icmp eq i32 5, %36
  br i1 %37, label %38, label %45

38:                                               ; preds = %35, %27, %16
  %39 = load i32, ptr %4, align 4, !tbaa !9
  %40 = zext i32 %39 to i64
  %41 = getelementptr inbounds [7 x ptr], ptr @qFIS_SetDeFuzzMethod.method, i64 0, i64 %40
  %42 = load ptr, ptr %41, align 8, !tbaa !5
  %43 = load ptr, ptr %3, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct._qFIS_s, ptr %43, i32 0, i32 10
  store ptr %42, ptr %44, align 8, !tbaa !15
  store i32 1, ptr %5, align 4, !tbaa !9
  br label %45

45:                                               ; preds = %38, %35, %30
  br label %46

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { 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, !10, i64 184}
!12 = !{!"_qFIS_s", !6, i64 0, !6, 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, !13, i64 112, !13, i64 120, !13, i64 128, !13, i64 136, !13, i64 144, !13, i64 152, !13, i64 160, !13, i64 168, !14, i64 176, !7, i64 180, !10, i64 184}
!13 = !{!"long", !7, i64 0}
!14 = !{!"float", !7, i64 0}
!15 = !{!12, !6, i64 80}


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

@qFIS_SetDeFuzzMethod.method = external hidden local_unnamed_addr constant [7 x ptr], align 16

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

5:                                                ; preds = %2
  %6 = getelementptr inbounds i8, ptr %0, i64 184
  %7 = load i32, ptr %6, align 8, !tbaa !5
  %8 = icmp eq i32 %7, 0
  %9 = icmp ult i32 %1, 5
  %or.cond3 = and i1 %9, %8
  br i1 %or.cond3, label %17, label %10

10:                                               ; preds = %5
  %11 = icmp eq i32 %7, 1
  %12 = add i32 %1, -5
  %13 = icmp ult i32 %12, 2
  %or.cond7 = and i1 %13, %11
  br i1 %or.cond7, label %17, label %14

14:                                               ; preds = %10
  %15 = icmp eq i32 %7, 2
  %16 = icmp eq i32 %1, 5
  %or.cond9 = and i1 %16, %15
  br i1 %or.cond9, label %17, label %22

17:                                               ; preds = %14, %10, %5
  %18 = zext nneg i32 %1 to i64
  %19 = getelementptr inbounds [7 x ptr], ptr @qFIS_SetDeFuzzMethod.method, i64 0, i64 %18
  %20 = load ptr, ptr %19, align 8, !tbaa !13
  %21 = getelementptr inbounds i8, ptr %0, i64 80
  store ptr %20, ptr %21, align 8, !tbaa !14
  br label %22

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

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) 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, !12, i64 184}
!6 = !{!"_qFIS_s", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !7, i64 88, !7, i64 96, !7, i64 104, !10, i64 112, !10, i64 120, !10, i64 128, !10, i64 136, !10, i64 144, !10, i64 152, !10, i64 160, !10, i64 168, !11, i64 176, !8, i64 180, !12, i64 184}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!"float", !8, i64 0}
!12 = !{!"int", !8, i64 0}
!13 = !{!7, !7, i64 0}
!14 = !{!6, !7, i64 80}


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