; LLVM IR from bkaradzic/bgfx :: 3rdparty/fcpp (cpp3)

; 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.Global = type { i32, i32, ptr, ptr, i32, i32, i32, ptr, i32, i32, i32, i32, [513 x i8], ptr, i8, i8, i8, i8, i8, [32 x i8], ptr, [20 x ptr], ptr, [20 x ptr], [20 x i8], i32, [5 x ptr], [5 x ptr], i8, ptr, [1025 x i8], ptr, [31 x ptr], i32, ptr, [64 x ptr], i32, ptr, ptr, ptr, ptr, ptr, ptr, i8, i8, i8, i8, i8, i8, i8, i8, ptr, i64, i8, i8, i8, i8, i8, i8, ptr, [20 x ptr], i32, i8, i8, i8, ptr }

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

; 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 ptr @fpp_defendel(ptr noundef, ptr noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @fpp_delbuiltindefines(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  %4 = load ptr, ptr %2, align 8, !tbaa !5
  %5 = getelementptr inbounds %struct.Global, ptr %4, i32 0, i32 18
  %6 = load i8, ptr %5, align 4, !tbaa !9
  %7 = sext i8 %6 to i32
  %8 = icmp slt i32 %7, 2
  br i1 %8, label %9, label %26

9:                                                ; preds = %1
  %10 = load ptr, ptr %2, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.Global, ptr %10, i32 0, i32 26
  %12 = getelementptr inbounds [5 x ptr], ptr %11, i64 0, i64 0
  store ptr %12, ptr %3, align 8, !tbaa !5
  br label %13

13:                                               ; preds = %22, %9
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = load ptr, ptr %14, align 8, !tbaa !5
  %16 = icmp ne ptr %15, null
  br i1 %16, label %17, label %25

17:                                               ; preds = %13
  %18 = load ptr, ptr %2, align 8, !tbaa !5
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = load ptr, ptr %19, align 8, !tbaa !5
  %21 = call ptr @fpp_defendel(ptr noundef %18, ptr noundef %20, i32 noundef 1)
  br label %22

22:                                               ; preds = %17
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = getelementptr inbounds ptr, ptr %23, i32 1
  store ptr %24, ptr %3, align 8, !tbaa !5
  br label %13, !llvm.loop !13

25:                                               ; preds = %13
  br label %26

26:                                               ; preds = %25, %1
  %27 = load ptr, ptr %2, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.Global, ptr %27, i32 0, i32 27
  %29 = getelementptr inbounds [5 x ptr], ptr %28, i64 0, i64 0
  store ptr %29, ptr %3, align 8, !tbaa !5
  br label %30

30:                                               ; preds = %39, %26
  %31 = load ptr, ptr %3, align 8, !tbaa !5
  %32 = load ptr, ptr %31, align 8, !tbaa !5
  %33 = icmp ne ptr %32, null
  br i1 %33, label %34, label %42

34:                                               ; preds = %30
  %35 = load ptr, ptr %2, align 8, !tbaa !5
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = load ptr, ptr %36, align 8, !tbaa !5
  %38 = call ptr @fpp_defendel(ptr noundef %35, ptr noundef %37, i32 noundef 1)
  br label %39

39:                                               ; preds = %34
  %40 = load ptr, ptr %3, align 8, !tbaa !5
  %41 = getelementptr inbounds ptr, ptr %40, i32 1
  store ptr %41, ptr %3, align 8, !tbaa !5
  br label %30, !llvm.loop !15

42:                                               ; preds = %30
  %43 = load ptr, ptr %2, align 8, !tbaa !5
  %44 = call ptr @fpp_defendel(ptr noundef %43, ptr noundef @.str.4, i32 noundef 1)
  %45 = load ptr, ptr %2, align 8, !tbaa !5
  %46 = call ptr @fpp_defendel(ptr noundef %45, ptr noundef @.str.6, i32 noundef 1)
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  ret void
}

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, !7, i64 596}
!10 = !{!"Global", !11, i64 0, !11, i64 4, !6, i64 8, !6, i64 16, !11, i64 24, !11, i64 28, !11, i64 32, !6, i64 40, !11, i64 48, !11, i64 52, !11, i64 56, !11, i64 60, !7, i64 64, !6, i64 584, !7, i64 592, !7, i64 593, !7, i64 594, !7, i64 595, !7, i64 596, !7, i64 597, !6, i64 632, !7, i64 640, !6, i64 800, !7, i64 808, !7, i64 968, !11, i64 988, !7, i64 992, !7, i64 1032, !7, i64 1072, !6, i64 1080, !7, i64 1088, !6, i64 2120, !7, i64 2128, !11, i64 2376, !6, i64 2384, !7, i64 2392, !11, i64 2904, !6, i64 2912, !6, i64 2920, !6, i64 2928, !6, i64 2936, !6, i64 2944, !6, i64 2952, !7, i64 2960, !7, i64 2961, !7, i64 2962, !7, i64 2963, !7, i64 2964, !7, i64 2965, !7, i64 2966, !7, i64 2967, !6, i64 2968, !12, i64 2976, !7, i64 2984, !7, i64 2985, !7, i64 2986, !7, i64 2987, !7, i64 2988, !7, i64 2989, !6, i64 2992, !7, i64 3000, !11, i64 3160, !7, i64 3164, !7, i64 3165, !7, i64 3166, !6, i64 3168}
!11 = !{!"int", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


; 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.4 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [9 x i8], align 1

declare ptr @fpp_defendel(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @fpp_delbuiltindefines(ptr noundef %0) local_unnamed_addr #1 {
  %2 = getelementptr inbounds i8, ptr %0, i64 596
  %3 = load i8, ptr %2, align 4, !tbaa !5
  %4 = icmp slt i8 %3, 2
  br i1 %4, label %5, label %.loopexit

5:                                                ; preds = %1
  %6 = getelementptr inbounds i8, ptr %0, i64 992
  %7 = load ptr, ptr %6, align 8, !tbaa !12
  %.not16 = icmp eq ptr %7, null
  br i1 %.not16, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %5, %.lr.ph
  %8 = phi ptr [ %11, %.lr.ph ], [ %7, %5 ]
  %.017 = phi ptr [ %10, %.lr.ph ], [ %6, %5 ]
  %9 = tail call ptr @fpp_defendel(ptr noundef %0, ptr noundef nonnull %8, i32 noundef 1) #2
  %10 = getelementptr inbounds i8, ptr %.017, i64 8
  %11 = load ptr, ptr %10, align 8, !tbaa !12
  %.not = icmp eq ptr %11, null
  br i1 %.not, label %.loopexit, label %.lr.ph, !llvm.loop !13

.loopexit:                                        ; preds = %.lr.ph, %5, %1
  %12 = getelementptr inbounds i8, ptr %0, i64 1032
  %13 = load ptr, ptr %12, align 8, !tbaa !12
  %.not1518 = icmp eq ptr %13, null
  br i1 %.not1518, label %._crit_edge, label %.lr.ph20

.lr.ph20:                                         ; preds = %.loopexit, %.lr.ph20
  %14 = phi ptr [ %17, %.lr.ph20 ], [ %13, %.loopexit ]
  %.119 = phi ptr [ %16, %.lr.ph20 ], [ %12, %.loopexit ]
  %15 = tail call ptr @fpp_defendel(ptr noundef %0, ptr noundef nonnull %14, i32 noundef 1) #2
  %16 = getelementptr inbounds i8, ptr %.119, i64 8
  %17 = load ptr, ptr %16, align 8, !tbaa !12
  %.not15 = icmp eq ptr %17, null
  br i1 %.not15, label %._crit_edge, label %.lr.ph20, !llvm.loop !15

._crit_edge:                                      ; preds = %.lr.ph20, %.loopexit
  %18 = tail call ptr @fpp_defendel(ptr noundef %0, ptr noundef nonnull @.str.4, i32 noundef 1) #2
  %19 = tail call ptr @fpp_defendel(ptr noundef %0, ptr noundef nonnull @.str.6, i32 noundef 1) #2
  ret void
}

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 = { 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, !8, i64 596}
!6 = !{!"Global", !7, i64 0, !7, i64 4, !10, i64 8, !10, i64 16, !7, i64 24, !7, i64 28, !7, i64 32, !10, i64 40, !7, i64 48, !7, i64 52, !7, i64 56, !7, i64 60, !8, i64 64, !10, i64 584, !8, i64 592, !8, i64 593, !8, i64 594, !8, i64 595, !8, i64 596, !8, i64 597, !10, i64 632, !8, i64 640, !10, i64 800, !8, i64 808, !8, i64 968, !7, i64 988, !8, i64 992, !8, i64 1032, !8, i64 1072, !10, i64 1080, !8, i64 1088, !10, i64 2120, !8, i64 2128, !7, i64 2376, !10, i64 2384, !8, i64 2392, !7, i64 2904, !10, i64 2912, !10, i64 2920, !10, i64 2928, !10, i64 2936, !10, i64 2944, !10, i64 2952, !8, i64 2960, !8, i64 2961, !8, i64 2962, !8, i64 2963, !8, i64 2964, !8, i64 2965, !8, i64 2966, !8, i64 2967, !10, i64 2968, !11, i64 2976, !8, i64 2984, !8, i64 2985, !8, i64 2986, !8, i64 2987, !8, i64 2988, !8, i64 2989, !10, i64 2992, !8, i64 3000, !7, i64 3160, !8, i64 3164, !8, i64 3165, !8, i64 3166, !10, i64 3168}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"long", !8, i64 0}
!12 = !{!10, !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass