; LLVM IR from ThePhysicsGuys/Physics3D :: tests/testsMain.ll (Z12getTestFlagsRKN4Util10ParsedArgsE)

; 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.TestFlags = type { i8, i8, i8, i8 }

@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local i32 @_Z12getTestFlagsRKN4Util10ParsedArgsE(ptr noundef nonnull align 8 dereferenceable(72) %0) #0 {
  %2 = alloca %struct.TestFlags, align 1
  %3 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = call noundef zeroext i1 @_ZNK4Util10ParsedArgs7hasFlagEPKc(ptr noundef nonnull align 8 dereferenceable(72) %4, ptr noundef @.str)
  %6 = getelementptr inbounds %struct.TestFlags, ptr %2, i32 0, i32 0
  %7 = zext i1 %5 to i8
  store i8 %7, ptr %6, align 1, !tbaa !9
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = call noundef zeroext i1 @_ZNK4Util10ParsedArgs7hasFlagEPKc(ptr noundef nonnull align 8 dereferenceable(72) %8, ptr noundef @.str.3)
  %10 = xor i1 %9, true
  %11 = getelementptr inbounds %struct.TestFlags, ptr %2, i32 0, i32 2
  %12 = zext i1 %10 to i8
  store i8 %12, ptr %11, align 1, !tbaa !12
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = call noundef i64 @_ZNK4Util10ParsedArgs8argCountEv(ptr noundef nonnull align 8 dereferenceable(72) %13)
  %15 = icmp eq i64 %14, 0
  %16 = getelementptr inbounds %struct.TestFlags, ptr %2, i32 0, i32 1
  %17 = zext i1 %15 to i8
  store i8 %17, ptr %16, align 1, !tbaa !13
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = call noundef zeroext i1 @_ZNK4Util10ParsedArgs7hasFlagEPKc(ptr noundef nonnull align 8 dereferenceable(72) %18, ptr noundef @.str.4)
  %20 = getelementptr inbounds %struct.TestFlags, ptr %2, i32 0, i32 3
  %21 = zext i1 %19 to i8
  store i8 %21, ptr %20, align 1, !tbaa !14
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = call noundef zeroext i1 @_ZNK4Util10ParsedArgs7hasFlagEPKc(ptr noundef nonnull align 8 dereferenceable(72) %22, ptr noundef @.str.5)
  br i1 %23, label %24, label %26

24:                                               ; preds = %1
  %25 = getelementptr inbounds %struct.TestFlags, ptr %2, i32 0, i32 1
  store i8 0, ptr %25, align 1, !tbaa !13
  br label %26

26:                                               ; preds = %24, %1
  %27 = load i32, ptr %2, align 1
  ret i32 %27
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK4Util10ParsedArgs7hasFlagEPKc(ptr noundef nonnull align 8 dereferenceable(72), ptr noundef) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK4Util10ParsedArgs8argCountEv(ptr noundef nonnull align 8 dereferenceable(72)) #1 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 = { 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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"_ZTS9TestFlags", !11, i64 0, !11, i64 1, !11, i64 2, !11, i64 3}
!11 = !{!"bool", !7, i64 0}
!12 = !{!10, !11, i64 2}
!13 = !{!10, !11, i64 1}
!14 = !{!10, !11, i64 3}


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

@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local range(i32 0, 33554432) i32 @_Z12getTestFlagsRKN4Util10ParsedArgsE(ptr noundef nonnull align 8 dereferenceable(72) %0) local_unnamed_addr #0 {
  %2 = tail call noundef zeroext i1 @_ZNK4Util10ParsedArgs7hasFlagEPKc(ptr noundef nonnull align 8 dereferenceable(72) %0, ptr noundef nonnull @.str)
  %3 = tail call noundef zeroext i1 @_ZNK4Util10ParsedArgs7hasFlagEPKc(ptr noundef nonnull align 8 dereferenceable(72) %0, ptr noundef nonnull @.str.3)
  %4 = tail call noundef i64 @_ZNK4Util10ParsedArgs8argCountEv(ptr noundef nonnull align 8 dereferenceable(72) %0)
  %5 = icmp ne i64 %4, 0
  %6 = tail call noundef zeroext i1 @_ZNK4Util10ParsedArgs7hasFlagEPKc(ptr noundef nonnull align 8 dereferenceable(72) %0, ptr noundef nonnull @.str.4)
  %7 = tail call noundef zeroext i1 @_ZNK4Util10ParsedArgs7hasFlagEPKc(ptr noundef nonnull align 8 dereferenceable(72) %0, ptr noundef nonnull @.str.5)
  %narrow.not = or i1 %5, %7
  %.sroa.5.0.insert.shift = select i1 %6, i32 16777216, i32 0
  %.sroa.4.0.insert.shift = select i1 %3, i32 0, i32 65536
  %.sroa.2.0.insert.shift = select i1 %narrow.not, i32 0, i32 256
  %.sroa.0.0.insert.ext = zext i1 %2 to i32
  %.sroa.4.0.insert.insert = or disjoint i32 %.sroa.4.0.insert.shift, %.sroa.0.0.insert.ext
  %.sroa.2.0.insert.insert = or disjoint i32 %.sroa.4.0.insert.insert, %.sroa.5.0.insert.shift
  %.sroa.0.0.insert.insert = or disjoint i32 %.sroa.2.0.insert.insert, %.sroa.2.0.insert.shift
  ret i32 %.sroa.0.0.insert.insert
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK4Util10ParsedArgs7hasFlagEPKc(ptr noundef nonnull align 8 dereferenceable(72), ptr noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK4Util10ParsedArgs8argCountEv(ptr noundef nonnull align 8 dereferenceable(72)) local_unnamed_addr #1 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 = { 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)"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass