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

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

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare double @atof(ptr noundef nonnull) #1

declare ptr @bstrcpy(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local ptr @remove_first_character(ptr noundef) #0

declare ptr @bfromcstr(ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @set_vartype_ptr(ptr noundef %0, ptr noundef %1, i32 noundef %2, ptr noundef %3, ptr noundef %4) #0 {
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store i32 %2, ptr %9, align 4, !tbaa !9
  store ptr %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !5
  %12 = load ptr, ptr %8, align 8, !tbaa !5
  %13 = call ptr @bstrcpy(ptr noundef %12)
  %14 = load ptr, ptr %10, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.VarTypePtr_t, ptr %14, i32 0, i32 1
  store ptr %13, ptr %15, align 8, !tbaa !11
  %16 = load ptr, ptr %7, align 8, !tbaa !5
  %17 = call ptr @bfromcstr(ptr noundef %16)
  %18 = load ptr, ptr %10, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.VarTypePtr_t, ptr %18, i32 0, i32 0
  store ptr %17, ptr %19, align 8, !tbaa !14
  %20 = load ptr, ptr %10, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.VarTypePtr_t, ptr %20, i32 0, i32 4
  store i32 0, ptr %21, align 4, !tbaa !15
  %22 = load i32, ptr %9, align 4, !tbaa !9
  %23 = load ptr, ptr %10, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.VarTypePtr_t, ptr %23, i32 0, i32 5
  store i32 %22, ptr %24, align 8, !tbaa !16
  %25 = load ptr, ptr %11, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.tagbstring, ptr %25, i32 0, i32 2
  %27 = load ptr, ptr %26, align 8, !tbaa !17
  %28 = getelementptr inbounds i8, ptr %27, i64 0
  %29 = load i8, ptr %28, align 1, !tbaa !19
  %30 = zext i8 %29 to i32
  %31 = icmp eq i32 %30, 35
  br i1 %31, label %32, label %62

32:                                               ; preds = %5
  %33 = load ptr, ptr %10, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.VarTypePtr_t, ptr %33, i32 0, i32 3
  store i8 0, ptr %34, align 8, !tbaa !20
  %35 = load ptr, ptr %11, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.tagbstring, ptr %35, i32 0, i32 1
  %37 = load i32, ptr %36, align 4, !tbaa !21
  %38 = icmp eq i32 %37, 1
  br i1 %38, label %39, label %43

39:                                               ; preds = %32
  %40 = load ptr, ptr %10, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.VarTypePtr_t, ptr %40, i32 0, i32 2
  %42 = load ptr, ptr %41, align 8, !tbaa !22
  store double 0xC08F3F3333333333, ptr %42, align 8, !tbaa !23
  br label %61

43:                                               ; preds = %32
  %44 = load ptr, ptr %11, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.tagbstring, ptr %44, i32 0, i32 2
  %46 = load ptr, ptr %45, align 8, !tbaa !17
  %47 = call ptr @remove_first_character(ptr noundef %46)
  %48 = call i32 @is_numeric(ptr noundef %47)
  %49 = icmp ne i32 %48, 0
  br i1 %49, label %50, label %59

50:                                               ; preds = %43
  %51 = load ptr, ptr %11, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.tagbstring, ptr %51, i32 0, i32 2
  %53 = load ptr, ptr %52, align 8, !tbaa !17
  %54 = call ptr @remove_first_character(ptr noundef %53)
  %55 = call double @atof(ptr noundef %54) #3
  %56 = load ptr, ptr %10, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.VarTypePtr_t, ptr %56, i32 0, i32 2
  %58 = load ptr, ptr %57, align 8, !tbaa !22
  store double %55, ptr %58, align 8, !tbaa !23
  br label %60

59:                                               ; preds = %43
  store i32 3, ptr %6, align 4
  br label %83

60:                                               ; preds = %50
  br label %61

61:                                               ; preds = %60, %39
  br label %82

62:                                               ; preds = %5
  %63 = load ptr, ptr %10, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.VarTypePtr_t, ptr %63, i32 0, i32 3
  store i8 1, ptr %64, align 8, !tbaa !20
  %65 = load ptr, ptr %11, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.tagbstring, ptr %65, i32 0, i32 2
  %67 = load ptr, ptr %66, align 8, !tbaa !17
  %68 = call i32 @is_numeric(ptr noundef %67)
  %69 = zext i32 %68 to i64
  %70 = inttoptr i64 %69 to ptr
  %71 = icmp ne ptr %70, null
  br i1 %71, label %72, label %80

72:                                               ; preds = %62
  %73 = load ptr, ptr %11, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.tagbstring, ptr %73, i32 0, i32 2
  %75 = load ptr, ptr %74, align 8, !tbaa !17
  %76 = call double @atof(ptr noundef %75) #3
  %77 = load ptr, ptr %10, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.VarTypePtr_t, ptr %77, i32 0, i32 2
  %79 = load ptr, ptr %78, align 8, !tbaa !22
  store double %76, ptr %79, align 8, !tbaa !23
  br label %81

80:                                               ; preds = %62
  store i32 3, ptr %6, align 4
  br label %83

81:                                               ; preds = %72
  br label %82

82:                                               ; preds = %81, %61
  store i32 0, ptr %6, align 4
  br label %83

83:                                               ; preds = %82, %80, %59
  %84 = load i32, ptr %6, align 4
  ret i32 %84
}

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" }
attributes #1 = { 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 #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 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 = !{!"VarTypePtr_t", !6, i64 0, !6, i64 8, !6, i64 16, !13, i64 24, !10, i64 28, !10, i64 32}
!13 = !{!"_Bool", !7, i64 0}
!14 = !{!12, !6, i64 0}
!15 = !{!12, !10, i64 28}
!16 = !{!12, !10, i64 32}
!17 = !{!18, !6, i64 8}
!18 = !{!"tagbstring", !10, i64 0, !10, i64 4, !6, i64 8}
!19 = !{!7, !7, i64 0}
!20 = !{!12, !13, i64 24}
!21 = !{!18, !10, i64 4}
!22 = !{!12, !6, i64 16}
!23 = !{!24, !24, i64 0}
!24 = !{!"double", !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 i32 @is_numeric(ptr noundef) local_unnamed_addr #0

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare double @atof(ptr nocapture noundef nonnull) local_unnamed_addr #1

declare ptr @bstrcpy(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local ptr @remove_first_character(ptr noundef) local_unnamed_addr #0

declare ptr @bfromcstr(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 4) i32 @set_vartype_ptr(ptr noundef %0, ptr noundef %1, i32 noundef %2, ptr nocapture noundef %3, ptr nocapture noundef readonly %4) local_unnamed_addr #0 {
  %6 = tail call ptr @bstrcpy(ptr noundef %1) #3
  %7 = getelementptr inbounds i8, ptr %3, i64 8
  store ptr %6, ptr %7, align 8, !tbaa !5
  %8 = tail call ptr @bfromcstr(ptr noundef %0) #3
  store ptr %8, ptr %3, align 8, !tbaa !12
  %9 = getelementptr inbounds i8, ptr %3, i64 28
  store i32 0, ptr %9, align 4, !tbaa !13
  %10 = getelementptr inbounds i8, ptr %3, i64 32
  store i32 %2, ptr %10, align 8, !tbaa !14
  %11 = getelementptr inbounds i8, ptr %4, i64 8
  %12 = load ptr, ptr %11, align 8, !tbaa !15
  %13 = load i8, ptr %12, align 1, !tbaa !17
  %14 = icmp eq i8 %13, 35
  %15 = getelementptr inbounds i8, ptr %3, i64 24
  br i1 %14, label %16, label %26

16:                                               ; preds = %5
  store i8 0, ptr %15, align 8, !tbaa !18
  %17 = getelementptr inbounds i8, ptr %4, i64 4
  %18 = load i32, ptr %17, align 4, !tbaa !19
  %19 = icmp eq i32 %18, 1
  br i1 %19, label %.sink.split, label %20

20:                                               ; preds = %16
  %21 = tail call ptr @remove_first_character(ptr noundef nonnull %12)
  %22 = tail call i32 @is_numeric(ptr noundef %21)
  %.not18 = icmp eq i32 %22, 0
  br i1 %.not18, label %33, label %23

23:                                               ; preds = %20
  %24 = load ptr, ptr %11, align 8, !tbaa !15
  %25 = tail call ptr @remove_first_character(ptr noundef %24)
  br label %.sink.split.sink.split

26:                                               ; preds = %5
  store i8 1, ptr %15, align 8, !tbaa !18
  %27 = tail call i32 @is_numeric(ptr noundef nonnull %12)
  %.not = icmp eq i32 %27, 0
  br i1 %.not, label %33, label %28

28:                                               ; preds = %26
  %29 = load ptr, ptr %11, align 8, !tbaa !15
  br label %.sink.split.sink.split

.sink.split.sink.split:                           ; preds = %28, %23
  %.sink21 = phi ptr [ %25, %23 ], [ %29, %28 ]
  %30 = tail call double @atof(ptr noundef %.sink21) #4
  br label %.sink.split

.sink.split:                                      ; preds = %.sink.split.sink.split, %16
  %.sink = phi double [ 0xC08F3F3333333333, %16 ], [ %30, %.sink.split.sink.split ]
  %31 = getelementptr inbounds i8, ptr %3, i64 16
  %32 = load ptr, ptr %31, align 8, !tbaa !20
  store double %.sink, ptr %32, align 8, !tbaa !21
  br label %33

33:                                               ; preds = %.sink.split, %26, %20
  %.0 = phi i32 [ 3, %20 ], [ 3, %26 ], [ 0, %.sink.split ]
  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" }
attributes #1 = { 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 #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 }
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, !7, i64 8}
!6 = !{!"VarTypePtr_t", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24, !11, i64 28, !11, i64 32}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"_Bool", !8, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!6, !7, i64 0}
!13 = !{!6, !11, i64 28}
!14 = !{!6, !11, i64 32}
!15 = !{!16, !7, i64 8}
!16 = !{!"tagbstring", !11, i64 0, !11, i64 4, !7, i64 8}
!17 = !{!8, !8, i64 0}
!18 = !{!6, !10, i64 24}
!19 = !{!16, !11, i64 4}
!20 = !{!6, !7, i64 16}
!21 = !{!22, !22, i64 0}
!22 = !{!"double", !8, i64 0}


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