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

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

; Function Attrs: nounwind uwtable
declare dso_local void @fpp_cerror(ptr noundef, i32 noundef, ...) #0

; Function Attrs: nounwind uwtable
define dso_local i32 @fpp_save(ptr noundef %0, i32 noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  %6 = load ptr, ptr %4, align 8, !tbaa !5
  %7 = getelementptr inbounds %struct.Global, ptr %6, i32 0, i32 13
  %8 = load ptr, ptr %7, align 8, !tbaa !11
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.Global, ptr %9, i32 0, i32 12
  %11 = getelementptr inbounds [513 x i8], ptr %10, i64 0, i64 512
  %12 = icmp uge ptr %8, %11
  br i1 %12, label %13, label %15

13:                                               ; preds = %2
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  call void (ptr, i32, ...) @fpp_cerror(ptr noundef %14, i32 noundef 64)
  store i32 7, ptr %3, align 4
  br label %23

15:                                               ; preds = %2
  %16 = load i32, ptr %5, align 4, !tbaa !9
  %17 = trunc i32 %16 to i8
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.Global, ptr %18, i32 0, i32 13
  %20 = load ptr, ptr %19, align 8, !tbaa !11
  %21 = getelementptr inbounds i8, ptr %20, i32 1
  store ptr %21, ptr %19, align 8, !tbaa !11
  store i8 %17, ptr %20, align 1, !tbaa !14
  br label %22

22:                                               ; preds = %15
  store i32 0, ptr %3, align 4
  br label %23

23:                                               ; preds = %22, %13
  %24 = load i32, ptr %3, align 4
  ret i32 %24
}

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

!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 584}
!12 = !{!"Global", !10, i64 0, !10, i64 4, !6, i64 8, !6, i64 16, !10, i64 24, !10, i64 28, !10, i64 32, !6, i64 40, !10, i64 48, !10, i64 52, !10, i64 56, !10, 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, !10, i64 988, !7, i64 992, !7, i64 1032, !7, i64 1072, !6, i64 1080, !7, i64 1088, !6, i64 2120, !7, i64 2128, !10, i64 2376, !6, i64 2384, !7, i64 2392, !10, 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, !13, 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, !10, i64 3160, !7, i64 3164, !7, i64 3165, !7, i64 3166, !6, i64 3168}
!13 = !{!"long", !7, i64 0}
!14 = !{!7, !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"

; Function Attrs: nounwind uwtable
declare dso_local void @fpp_cerror(ptr noundef, i32 noundef, ...) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 8) i32 @fpp_save(ptr noundef %0, i32 noundef %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 584
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 576
  %.not = icmp ult ptr %4, %5
  br i1 %.not, label %7, label %6

6:                                                ; preds = %2
  tail call void (ptr, i32, ...) @fpp_cerror(ptr noundef nonnull %0, i32 noundef 64)
  br label %10

7:                                                ; preds = %2
  %8 = trunc i32 %1 to i8
  %9 = getelementptr inbounds i8, ptr %4, i64 1
  store ptr %9, ptr %3, align 8, !tbaa !5
  store i8 %8, ptr %4, align 1, !tbaa !12
  br label %10

10:                                               ; preds = %7, %6
  %.0 = phi i32 [ 7, %6 ], [ 0, %7 ]
  ret i32 %.0
}

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

!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, !10, i64 584}
!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 = !{!8, !8, i64 0}


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