; LLVM IR from OpenFAST/openfast :: modules/map/src (mapinit)

; 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.bstrList = type { i32, i32, ptr }
%struct.OuterSolveAttributes_t = type { i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, double, double, double, double, double, double, i8, i8, i8, i32, i32, i32 }
%struct.tagbstring = type { i32, i32, ptr }

@.str.22 = external hidden unnamed_addr constant [19 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 i32 @biseqcstrcaseless(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @is_numeric(ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @check_krylov_accelerator_flag(ptr noundef %0, ptr noundef %1) #2 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 0, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  store ptr null, ptr %8, align 8, !tbaa !5
  %10 = load ptr, ptr %4, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.bstrList, ptr %10, i32 0, i32 2
  %12 = load ptr, ptr %11, align 8, !tbaa !11
  %13 = getelementptr inbounds ptr, ptr %12, i64 0
  %14 = load ptr, ptr %13, align 8, !tbaa !5
  %15 = call i32 @biseqcstrcaseless(ptr noundef %14, ptr noundef @.str.22)
  store i32 %15, ptr %7, align 4, !tbaa !9
  %16 = load i32, ptr %7, align 4, !tbaa !9
  %17 = icmp eq i32 %16, -1
  br i1 %17, label %18, label %19

18:                                               ; preds = %2
  store i32 3, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %71

19:                                               ; preds = %2
  %20 = load i32, ptr %7, align 4, !tbaa !9
  %21 = icmp ne i32 %20, 0
  br i1 %21, label %22, label %69

22:                                               ; preds = %19
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.OuterSolveAttributes_t, ptr %23, i32 0, i32 20
  store i8 1, ptr %24, align 1, !tbaa !13
  br label %25

25:                                               ; preds = %65, %22
  %26 = load i32, ptr %6, align 4, !tbaa !9
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.bstrList, ptr %27, i32 0, i32 0
  %29 = load i32, ptr %28, align 8, !tbaa !17
  %30 = sub nsw i32 %29, 1
  %31 = icmp slt i32 %26, %30
  br i1 %31, label %32, label %68

32:                                               ; preds = %25
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.bstrList, ptr %33, i32 0, i32 2
  %35 = load ptr, ptr %34, align 8, !tbaa !11
  %36 = load i32, ptr %6, align 4, !tbaa !9
  %37 = add nsw i32 %36, 1
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds ptr, ptr %35, i64 %38
  %40 = load ptr, ptr %39, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.tagbstring, ptr %40, i32 0, i32 1
  %42 = load i32, ptr %41, align 4, !tbaa !18
  %43 = icmp ne i32 %42, 0
  br i1 %43, label %44, label %64

44:                                               ; preds = %32
  %45 = load ptr, ptr %4, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.bstrList, ptr %45, i32 0, i32 2
  %47 = load ptr, ptr %46, align 8, !tbaa !11
  %48 = load i32, ptr %6, align 4, !tbaa !9
  %49 = add nsw i32 %48, 1
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds ptr, ptr %47, i64 %50
  %52 = load ptr, ptr %51, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.tagbstring, ptr %52, i32 0, i32 2
  %54 = load ptr, ptr %53, align 8, !tbaa !20
  store ptr %54, ptr %8, align 8, !tbaa !5
  %55 = load ptr, ptr %8, align 8, !tbaa !5
  %56 = call i32 @is_numeric(ptr noundef %55)
  %57 = icmp ne i32 %56, 0
  br i1 %57, label %58, label %63

58:                                               ; preds = %44
  %59 = load ptr, ptr %8, align 8, !tbaa !5
  %60 = call i32 @atoi(ptr noundef %59) #5
  %61 = load ptr, ptr %5, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.OuterSolveAttributes_t, ptr %61, i32 0, i32 22
  store i32 %60, ptr %62, align 4, !tbaa !21
  store ptr null, ptr %8, align 8, !tbaa !5
  store i32 0, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %71

63:                                               ; preds = %44
  br label %65

64:                                               ; preds = %32
  store ptr null, ptr %8, align 8, !tbaa !5
  store i32 1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %71

65:                                               ; preds = %63
  %66 = load i32, ptr %6, align 4, !tbaa !9
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr %6, align 4, !tbaa !9
  br label %25, !llvm.loop !22

68:                                               ; preds = %25
  br label %69

69:                                               ; preds = %68, %19
  br label %70

70:                                               ; preds = %69
  store ptr null, ptr %8, align 8, !tbaa !5
  store i32 0, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %71

71:                                               ; preds = %70, %64, %58, %18
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  %72 = load i32, ptr %3, align 4
  ret i32 %72
}

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr noundef nonnull) #3

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 = { inlinehint nounwind willreturn memory(read) 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 #4 = { nounwind }
attributes #5 = { 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, !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 8}
!12 = !{!"bstrList", !10, i64 0, !10, i64 4, !6, i64 8}
!13 = !{!14, !16, i64 153}
!14 = !{!"OuterSolveAttributes_t", !10, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !15, i64 104, !15, i64 112, !15, i64 120, !15, i64 128, !15, i64 136, !15, i64 144, !16, i64 152, !16, i64 153, !16, i64 154, !10, i64 156, !10, i64 160, !10, i64 164}
!15 = !{!"double", !7, i64 0}
!16 = !{!"_Bool", !7, i64 0}
!17 = !{!12, !10, i64 0}
!18 = !{!19, !10, i64 4}
!19 = !{!"tagbstring", !10, i64 0, !10, i64 4, !6, i64 8}
!20 = !{!19, !6, i64 8}
!21 = !{!14, !10, i64 156}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}


; 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.22 = external hidden unnamed_addr constant [19 x i8], align 1

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @is_numeric(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 4) i32 @check_krylov_accelerator_flag(ptr nocapture noundef readonly %0, ptr nocapture noundef writeonly %1) local_unnamed_addr #1 {
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = load ptr, ptr %4, align 8, !tbaa !11
  %6 = tail call i32 @biseqcstrcaseless(ptr noundef %5, ptr noundef nonnull @.str.22) #3
  switch i32 %6, label %7 [
    i32 -1, label %.loopexit18
    i32 0, label %.loopexit
  ]

7:                                                ; preds = %2
  %8 = getelementptr inbounds i8, ptr %1, i64 153
  store i8 1, ptr %8, align 1, !tbaa !12
  br label %9

9:                                                ; preds = %20, %7
  %indvars.iv = phi i64 [ %indvars.iv.next, %20 ], [ 0, %7 ]
  %10 = load i32, ptr %0, align 8, !tbaa !16
  %11 = add nsw i32 %10, -1
  %12 = sext i32 %11 to i64
  %13 = icmp slt i64 %indvars.iv, %12
  br i1 %13, label %14, label %.loopexit

14:                                               ; preds = %9
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %16 = getelementptr inbounds ptr, ptr %15, i64 %indvars.iv.next
  %17 = load ptr, ptr %16, align 8, !tbaa !11
  %18 = getelementptr inbounds i8, ptr %17, i64 4
  %19 = load i32, ptr %18, align 4, !tbaa !17
  %.not16 = icmp eq i32 %19, 0
  br i1 %.not16, label %.loopexit18, label %20

20:                                               ; preds = %14
  %21 = getelementptr inbounds i8, ptr %17, i64 8
  %22 = load ptr, ptr %21, align 8, !tbaa !19
  %23 = tail call i32 @is_numeric(ptr noundef %22)
  %.not17 = icmp eq i32 %23, 0
  br i1 %.not17, label %9, label %24, !llvm.loop !20

24:                                               ; preds = %20
  %25 = tail call i32 @atoi(ptr nocapture noundef %22) #4
  %26 = getelementptr inbounds i8, ptr %1, i64 156
  store i32 %25, ptr %26, align 4, !tbaa !22
  br label %.loopexit18

.loopexit:                                        ; preds = %9, %2
  br label %.loopexit18

.loopexit18:                                      ; preds = %14, %2, %.loopexit, %24
  %.014 = phi i32 [ 0, %24 ], [ 0, %.loopexit ], [ 3, %2 ], [ 1, %14 ]
  ret i32 %.014
}

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr nocapture noundef nonnull) local_unnamed_addr #2

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 = { inlinehint mustprogress nofree nounwind willreturn memory(read) 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 }
attributes #4 = { 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, !10, i64 8}
!6 = !{!"bstrList", !7, i64 0, !7, i64 4, !10, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!10, !10, i64 0}
!12 = !{!13, !15, i64 153}
!13 = !{!"OuterSolveAttributes_t", !7, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !14, i64 104, !14, i64 112, !14, i64 120, !14, i64 128, !14, i64 136, !14, i64 144, !15, i64 152, !15, i64 153, !15, i64 154, !7, i64 156, !7, i64 160, !7, i64 164}
!14 = !{!"double", !8, i64 0}
!15 = !{!"_Bool", !8, i64 0}
!16 = !{!6, !7, i64 0}
!17 = !{!18, !7, i64 4}
!18 = !{!"tagbstring", !7, i64 0, !7, i64 4, !10, i64 8}
!19 = !{!18, !10, i64 8}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = !{!13, !7, i64 156}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass