; 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.fileinfo = type { ptr, i32, ptr, ptr, ptr, ptr, i32, [1 x i8] }
%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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind uwtable
define dso_local i32 @fpp_addfile(ptr noundef %0, ptr noundef %1, ptr noundef %2) #1 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  %11 = load ptr, ptr %5, align 8, !tbaa !5
  %12 = load ptr, ptr %7, align 8, !tbaa !5
  %13 = call i32 @fpp_getfile(ptr noundef %11, i64 noundef 512, ptr noundef %12, ptr noundef %8)
  store i32 %13, ptr %9, align 4, !tbaa !9
  %14 = load i32, ptr %9, align 4, !tbaa !9
  %15 = icmp ne i32 %14, 0
  br i1 %15, label %16, label %18

16:                                               ; preds = %3
  %17 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %17, ptr %4, align 4
  store i32 1, ptr %10, align 4
  br label %29

18:                                               ; preds = %3
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = load ptr, ptr %8, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.fileinfo, ptr %20, i32 0, i32 2
  store ptr %19, ptr %21, align 8, !tbaa !11
  %22 = load ptr, ptr %8, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.fileinfo, ptr %22, i32 0, i32 7
  %24 = getelementptr inbounds [1 x i8], ptr %23, i64 0, i64 0
  store i8 0, ptr %24, align 4, !tbaa !13
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.Global, ptr %25, i32 0, i32 0
  store i32 1, ptr %26, align 8, !tbaa !14
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.Global, ptr %27, i32 0, i32 1
  store i32 1, ptr %28, align 4, !tbaa !17
  store i32 0, ptr %4, align 4
  store i32 1, ptr %10, align 4
  br label %29

29:                                               ; preds = %18, %16
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  %30 = load i32, ptr %4, align 4
  ret i32 %30
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

declare i32 @fpp_getfile(ptr noundef, i64 noundef, ptr noundef, ptr noundef) #2

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 = { "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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 16}
!12 = !{!"fileinfo", !6, i64 0, !10, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !10, i64 48, !7, i64 52}
!13 = !{!7, !7, i64 0}
!14 = !{!15, !10, i64 0}
!15 = !{!"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, !16, 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}
!16 = !{!"long", !7, i64 0}
!17 = !{!15, !10, i64 4}


; 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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind uwtable
define dso_local i32 @fpp_addfile(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #1 {
  %4 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  %5 = call i32 @fpp_getfile(ptr noundef %0, i64 noundef 512, ptr noundef %2, ptr noundef nonnull %4) #3
  %.not = icmp eq i32 %5, 0
  br i1 %.not, label %6, label %11

6:                                                ; preds = %3
  %7 = load ptr, ptr %4, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %7, i64 16
  store ptr %1, ptr %8, align 8, !tbaa !9
  %9 = getelementptr inbounds i8, ptr %7, i64 52
  store i8 0, ptr %9, align 4, !tbaa !12
  store i32 1, ptr %0, align 8, !tbaa !13
  %10 = getelementptr inbounds i8, ptr %0, i64 4
  store i32 1, ptr %10, align 4, !tbaa !16
  br label %11

11:                                               ; preds = %3, %6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  ret i32 %5
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

declare i32 @fpp_getfile(ptr noundef, i64 noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

attributes #0 = { mustprogress 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 = { "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, !6, i64 16}
!10 = !{!"fileinfo", !6, i64 0, !11, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !11, i64 48, !7, i64 52}
!11 = !{!"int", !7, i64 0}
!12 = !{!7, !7, i64 0}
!13 = !{!14, !11, i64 0}
!14 = !{!"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, !15, 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}
!15 = !{!"long", !7, i64 0}
!16 = !{!14, !11, i64 4}


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