; LLVM IR from clibs/clib :: src/common (clib-package)

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

@opts = external hidden global %struct.clib_package_opts_t, align 8

; Function Attrs: nounwind uwtable
define dso_local void @clib_package_set_opts(ptr noundef byval(%struct.clib_package_opts_t) align 8 %0) #0 {
  %2 = load i32, ptr @opts, align 8, !tbaa !5
  %3 = icmp eq i32 1, %2
  br i1 %3, label %4, label %9

4:                                                ; preds = %1
  %5 = getelementptr inbounds %struct.clib_package_opts_t, ptr %0, i32 0, i32 0
  %6 = load i32, ptr %5, align 8, !tbaa !5
  %7 = icmp eq i32 0, %6
  br i1 %7, label %8, label %9

8:                                                ; preds = %4
  store i32 0, ptr @opts, align 8, !tbaa !5
  br label %18

9:                                                ; preds = %4, %1
  %10 = load i32, ptr @opts, align 8, !tbaa !5
  %11 = icmp eq i32 0, %10
  br i1 %11, label %12, label %17

12:                                               ; preds = %9
  %13 = getelementptr inbounds %struct.clib_package_opts_t, ptr %0, i32 0, i32 0
  %14 = load i32, ptr %13, align 8, !tbaa !5
  %15 = icmp eq i32 1, %14
  br i1 %15, label %16, label %17

16:                                               ; preds = %12
  store i32 1, ptr @opts, align 8, !tbaa !5
  br label %17

17:                                               ; preds = %16, %12, %9
  br label %18

18:                                               ; preds = %17, %8
  %19 = load i32, ptr getelementptr inbounds (%struct.clib_package_opts_t, ptr @opts, i32 0, i32 2), align 8, !tbaa !11
  %20 = icmp eq i32 1, %19
  br i1 %20, label %21, label %26

21:                                               ; preds = %18
  %22 = getelementptr inbounds %struct.clib_package_opts_t, ptr %0, i32 0, i32 2
  %23 = load i32, ptr %22, align 8, !tbaa !11
  %24 = icmp eq i32 0, %23
  br i1 %24, label %25, label %26

25:                                               ; preds = %21
  store i32 0, ptr getelementptr inbounds (%struct.clib_package_opts_t, ptr @opts, i32 0, i32 2), align 8, !tbaa !11
  br label %35

26:                                               ; preds = %21, %18
  %27 = load i32, ptr getelementptr inbounds (%struct.clib_package_opts_t, ptr @opts, i32 0, i32 2), align 8, !tbaa !11
  %28 = icmp eq i32 0, %27
  br i1 %28, label %29, label %34

29:                                               ; preds = %26
  %30 = getelementptr inbounds %struct.clib_package_opts_t, ptr %0, i32 0, i32 2
  %31 = load i32, ptr %30, align 8, !tbaa !11
  %32 = icmp eq i32 1, %31
  br i1 %32, label %33, label %34

33:                                               ; preds = %29
  store i32 1, ptr getelementptr inbounds (%struct.clib_package_opts_t, ptr @opts, i32 0, i32 2), align 8, !tbaa !11
  br label %34

34:                                               ; preds = %33, %29, %26
  br label %35

35:                                               ; preds = %34, %25
  %36 = load i32, ptr getelementptr inbounds (%struct.clib_package_opts_t, ptr @opts, i32 0, i32 1), align 4, !tbaa !12
  %37 = icmp eq i32 1, %36
  br i1 %37, label %38, label %43

38:                                               ; preds = %35
  %39 = getelementptr inbounds %struct.clib_package_opts_t, ptr %0, i32 0, i32 1
  %40 = load i32, ptr %39, align 4, !tbaa !12
  %41 = icmp eq i32 0, %40
  br i1 %41, label %42, label %43

42:                                               ; preds = %38
  store i32 0, ptr getelementptr inbounds (%struct.clib_package_opts_t, ptr @opts, i32 0, i32 1), align 4, !tbaa !12
  br label %52

43:                                               ; preds = %38, %35
  %44 = load i32, ptr getelementptr inbounds (%struct.clib_package_opts_t, ptr @opts, i32 0, i32 1), align 4, !tbaa !12
  %45 = icmp eq i32 0, %44
  br i1 %45, label %46, label %51

46:                                               ; preds = %43
  %47 = getelementptr inbounds %struct.clib_package_opts_t, ptr %0, i32 0, i32 1
  %48 = load i32, ptr %47, align 4, !tbaa !12
  %49 = icmp eq i32 1, %48
  br i1 %49, label %50, label %51

50:                                               ; preds = %46
  store i32 1, ptr getelementptr inbounds (%struct.clib_package_opts_t, ptr @opts, i32 0, i32 1), align 4, !tbaa !12
  br label %51

51:                                               ; preds = %50, %46, %43
  br label %52

52:                                               ; preds = %51, %42
  %53 = getelementptr inbounds %struct.clib_package_opts_t, ptr %0, i32 0, i32 3
  %54 = load ptr, ptr %53, align 8, !tbaa !13
  %55 = icmp ne ptr null, %54
  br i1 %55, label %56, label %66

56:                                               ; preds = %52
  %57 = getelementptr inbounds %struct.clib_package_opts_t, ptr %0, i32 0, i32 3
  %58 = load ptr, ptr %57, align 8, !tbaa !13
  %59 = call i64 @strlen(ptr noundef %58) #2
  %60 = icmp eq i64 0, %59
  br i1 %60, label %61, label %62

61:                                               ; preds = %56
  store ptr null, ptr getelementptr inbounds (%struct.clib_package_opts_t, ptr @opts, i32 0, i32 3), align 8, !tbaa !13
  br label %65

62:                                               ; preds = %56
  %63 = getelementptr inbounds %struct.clib_package_opts_t, ptr %0, i32 0, i32 3
  %64 = load ptr, ptr %63, align 8, !tbaa !13
  store ptr %64, ptr getelementptr inbounds (%struct.clib_package_opts_t, ptr @opts, i32 0, i32 3), align 8, !tbaa !13
  br label %65

65:                                               ; preds = %62, %61
  br label %66

66:                                               ; preds = %65, %52
  %67 = getelementptr inbounds %struct.clib_package_opts_t, ptr %0, i32 0, i32 5
  %68 = load ptr, ptr %67, align 8, !tbaa !14
  %69 = icmp ne ptr null, %68
  br i1 %69, label %70, label %80

70:                                               ; preds = %66
  %71 = getelementptr inbounds %struct.clib_package_opts_t, ptr %0, i32 0, i32 5
  %72 = load ptr, ptr %71, align 8, !tbaa !14
  %73 = call i64 @strlen(ptr noundef %72) #2
  %74 = icmp eq i64 0, %73
  br i1 %74, label %75, label %76

75:                                               ; preds = %70
  store ptr null, ptr getelementptr inbounds (%struct.clib_package_opts_t, ptr @opts, i32 0, i32 5), align 8, !tbaa !14
  br label %79

76:                                               ; preds = %70
  %77 = getelementptr inbounds %struct.clib_package_opts_t, ptr %0, i32 0, i32 5
  %78 = load ptr, ptr %77, align 8, !tbaa !14
  store ptr %78, ptr getelementptr inbounds (%struct.clib_package_opts_t, ptr @opts, i32 0, i32 5), align 8, !tbaa !14
  br label %79

79:                                               ; preds = %76, %75
  br label %80

80:                                               ; preds = %79, %66
  %81 = getelementptr inbounds %struct.clib_package_opts_t, ptr %0, i32 0, i32 4
  %82 = load i32, ptr %81, align 8, !tbaa !15
  %83 = icmp ne i32 %82, 0
  br i1 %83, label %84, label %87

84:                                               ; preds = %80
  %85 = getelementptr inbounds %struct.clib_package_opts_t, ptr %0, i32 0, i32 4
  %86 = load i32, ptr %85, align 8, !tbaa !15
  store i32 %86, ptr getelementptr inbounds (%struct.clib_package_opts_t, ptr @opts, i32 0, i32 4), align 8, !tbaa !15
  br label %93

87:                                               ; preds = %80
  %88 = getelementptr inbounds %struct.clib_package_opts_t, ptr %0, i32 0, i32 4
  %89 = load i32, ptr %88, align 8, !tbaa !15
  %90 = icmp slt i32 %89, 0
  br i1 %90, label %91, label %92

91:                                               ; preds = %87
  store i32 0, ptr getelementptr inbounds (%struct.clib_package_opts_t, ptr @opts, i32 0, i32 4), align 8, !tbaa !15
  br label %92

92:                                               ; preds = %91, %87
  br label %93

93:                                               ; preds = %92, %84
  %94 = load i32, ptr getelementptr inbounds (%struct.clib_package_opts_t, ptr @opts, i32 0, i32 4), align 8, !tbaa !15
  %95 = icmp slt i32 %94, 0
  br i1 %95, label %96, label %97

96:                                               ; preds = %93
  store i32 0, ptr getelementptr inbounds (%struct.clib_package_opts_t, ptr @opts, i32 0, i32 4), align 8, !tbaa !15
  br label %97

97:                                               ; preds = %96, %93
  ret void
}

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #1

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 = { nounwind willreturn memory(read) "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 willreturn memory(read) }

!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 0}
!6 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 16, !7, i64 24, !10, i64 32}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !7, i64 8}
!12 = !{!6, !7, i64 4}
!13 = !{!6, !10, i64 16}
!14 = !{!6, !10, i64 32}
!15 = !{!6, !7, i64 24}


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

%struct.clib_package_opts_t = type { i32, i32, i32, ptr, i32, ptr }

@opts = external hidden local_unnamed_addr global %struct.clib_package_opts_t, align 8

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: read, inaccessiblemem: none) uwtable
define dso_local void @clib_package_set_opts(ptr nocapture noundef readonly byval(%struct.clib_package_opts_t) align 8 %0) local_unnamed_addr #0 {
  %2 = load i32, ptr @opts, align 8, !tbaa !5
  %3 = icmp eq i32 %2, 1
  %4 = load i32, ptr %0, align 8
  %5 = icmp eq i32 %4, 0
  %or.cond = select i1 %3, i1 %5, i1 false
  br i1 %or.cond, label %.sink.split, label %6

6:                                                ; preds = %1
  %7 = icmp eq i32 %2, 0
  %8 = icmp eq i32 %4, 1
  %or.cond5 = select i1 %7, i1 %8, i1 false
  br i1 %or.cond5, label %.sink.split, label %9

.sink.split:                                      ; preds = %6, %1
  %.sink = phi i32 [ 0, %1 ], [ 1, %6 ]
  store i32 %.sink, ptr @opts, align 8, !tbaa !5
  br label %9

9:                                                ; preds = %.sink.split, %6
  %10 = load i32, ptr getelementptr inbounds (i8, ptr @opts, i64 8), align 8, !tbaa !11
  %11 = icmp eq i32 %10, 1
  %12 = getelementptr inbounds i8, ptr %0, i64 8
  %13 = load i32, ptr %12, align 8
  %14 = icmp eq i32 %13, 0
  %or.cond8 = select i1 %11, i1 %14, i1 false
  br i1 %or.cond8, label %.sink.split23, label %15

15:                                               ; preds = %9
  %16 = icmp eq i32 %10, 0
  %17 = icmp eq i32 %13, 1
  %or.cond11 = select i1 %16, i1 %17, i1 false
  br i1 %or.cond11, label %.sink.split23, label %18

.sink.split23:                                    ; preds = %15, %9
  %.sink24 = phi i32 [ 0, %9 ], [ 1, %15 ]
  store i32 %.sink24, ptr getelementptr inbounds (i8, ptr @opts, i64 8), align 8, !tbaa !11
  br label %18

18:                                               ; preds = %.sink.split23, %15
  %19 = load i32, ptr getelementptr inbounds (i8, ptr @opts, i64 4), align 4, !tbaa !12
  %20 = icmp eq i32 %19, 1
  %21 = getelementptr inbounds i8, ptr %0, i64 4
  %22 = load i32, ptr %21, align 4
  %23 = icmp eq i32 %22, 0
  %or.cond14 = select i1 %20, i1 %23, i1 false
  br i1 %or.cond14, label %.sink.split25, label %24

24:                                               ; preds = %18
  %25 = icmp eq i32 %19, 0
  %26 = icmp eq i32 %22, 1
  %or.cond17 = select i1 %25, i1 %26, i1 false
  br i1 %or.cond17, label %.sink.split25, label %27

.sink.split25:                                    ; preds = %24, %18
  %.sink26 = phi i32 [ 0, %18 ], [ 1, %24 ]
  store i32 %.sink26, ptr getelementptr inbounds (i8, ptr @opts, i64 4), align 4, !tbaa !12
  br label %27

27:                                               ; preds = %.sink.split25, %24
  %28 = getelementptr inbounds i8, ptr %0, i64 16
  %29 = load ptr, ptr %28, align 8, !tbaa !13
  %.not = icmp eq ptr %29, null
  br i1 %.not, label %31, label %.sink.split27

.sink.split27:                                    ; preds = %27
  %char0 = load i8, ptr %29, align 1
  %30 = icmp eq i8 %char0, 0
  %. = select i1 %30, ptr null, ptr %29
  store ptr %., ptr getelementptr inbounds (i8, ptr @opts, i64 16), align 8, !tbaa !13
  br label %31

31:                                               ; preds = %.sink.split27, %27
  %32 = getelementptr inbounds i8, ptr %0, i64 32
  %33 = load ptr, ptr %32, align 8, !tbaa !14
  %.not20 = icmp eq ptr %33, null
  br i1 %.not20, label %35, label %.sink.split29

.sink.split29:                                    ; preds = %31
  %char022 = load i8, ptr %33, align 1
  %34 = icmp eq i8 %char022, 0
  %.31 = select i1 %34, ptr null, ptr %33
  store ptr %.31, ptr getelementptr inbounds (i8, ptr @opts, i64 32), align 8, !tbaa !14
  br label %35

35:                                               ; preds = %.sink.split29, %31
  %36 = getelementptr inbounds i8, ptr %0, i64 24
  %37 = load i32, ptr %36, align 8, !tbaa !15
  %.not21 = icmp eq i32 %37, 0
  br i1 %.not21, label %thread-pre-split, label %38

38:                                               ; preds = %35
  store i32 %37, ptr getelementptr inbounds (i8, ptr @opts, i64 24), align 8, !tbaa !15
  br label %39

thread-pre-split:                                 ; preds = %35
  %.pr = load i32, ptr getelementptr inbounds (i8, ptr @opts, i64 24), align 8, !tbaa !15
  br label %39

39:                                               ; preds = %thread-pre-split, %38
  %40 = phi i32 [ %.pr, %thread-pre-split ], [ %37, %38 ]
  %41 = icmp slt i32 %40, 0
  br i1 %41, label %42, label %43

42:                                               ; preds = %39
  store i32 0, ptr getelementptr inbounds (i8, ptr @opts, i64 24), align 8, !tbaa !15
  br label %43

43:                                               ; preds = %42, %39
  ret void
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: read, inaccessiblemem: none) 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 0}
!6 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 16, !7, i64 24, !10, i64 32}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !7, i64 8}
!12 = !{!6, !7, i64 4}
!13 = !{!6, !10, i64 16}
!14 = !{!6, !10, i64 32}
!15 = !{!6, !7, i64 24}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,PostOrderFunctionAttrsPass,SimplifyCFGPass