; 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.VarType_t = type { ptr, ptr, double, i8, 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 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.VarType_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.VarType_t, ptr %18, i32 0, i32 0
  store ptr %17, ptr %19, align 8, !tbaa !15
  %20 = load ptr, ptr %10, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.VarType_t, ptr %20, i32 0, i32 5
  store i32 0, ptr %21, align 4, !tbaa !16
  %22 = load i32, ptr %9, align 4, !tbaa !9
  %23 = load ptr, ptr %10, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.VarType_t, ptr %23, i32 0, i32 6
  store i32 %22, ptr %24, align 8, !tbaa !17
  %25 = load ptr, ptr %11, align 8, !tbaa !5
  %26 = icmp ne ptr %25, null
  br i1 %26, label %30, label %27

27:                                               ; preds = %5
  %28 = load ptr, ptr %10, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.VarType_t, ptr %28, i32 0, i32 2
  store double 0xC08F3F3333333333, ptr %29, align 8, !tbaa !18
  br label %86

30:                                               ; preds = %5
  %31 = load ptr, ptr %11, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.tagbstring, ptr %31, i32 0, i32 2
  %33 = load ptr, ptr %32, align 8, !tbaa !19
  %34 = getelementptr inbounds i8, ptr %33, i64 0
  %35 = load i8, ptr %34, align 1, !tbaa !21
  %36 = zext i8 %35 to i32
  %37 = icmp eq i32 %36, 35
  br i1 %37, label %38, label %68

38:                                               ; preds = %30
  %39 = load ptr, ptr %10, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.VarType_t, ptr %39, i32 0, i32 3
  store i8 0, ptr %40, align 8, !tbaa !22
  %41 = load ptr, ptr %11, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.tagbstring, ptr %41, i32 0, i32 1
  %43 = load i32, ptr %42, align 4, !tbaa !23
  %44 = icmp eq i32 %43, 1
  br i1 %44, label %45, label %48

45:                                               ; preds = %38
  %46 = load ptr, ptr %10, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.VarType_t, ptr %46, i32 0, i32 2
  store double 0xC08F3F3333333333, ptr %47, align 8, !tbaa !18
  br label %67

48:                                               ; preds = %38
  %49 = load ptr, ptr %11, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.tagbstring, ptr %49, i32 0, i32 2
  %51 = load ptr, ptr %50, align 8, !tbaa !19
  %52 = call ptr @remove_first_character(ptr noundef %51)
  %53 = call i32 @is_numeric(ptr noundef %52)
  %54 = icmp ne i32 %53, 0
  br i1 %54, label %55, label %65

55:                                               ; preds = %48
  %56 = load ptr, ptr %11, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.tagbstring, ptr %56, i32 0, i32 2
  %58 = load ptr, ptr %57, align 8, !tbaa !19
  %59 = call ptr @remove_first_character(ptr noundef %58)
  %60 = call double @atof(ptr noundef %59) #3
  %61 = load ptr, ptr %10, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.VarType_t, ptr %61, i32 0, i32 2
  store double %60, ptr %62, align 8, !tbaa !18
  %63 = load ptr, ptr %10, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.VarType_t, ptr %63, i32 0, i32 4
  store i8 1, ptr %64, align 1, !tbaa !24
  br label %66

65:                                               ; preds = %48
  store i32 3, ptr %6, align 4
  br label %87

66:                                               ; preds = %55
  br label %67

67:                                               ; preds = %66, %45
  br label %85

68:                                               ; preds = %30
  %69 = load ptr, ptr %10, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.VarType_t, ptr %69, i32 0, i32 3
  store i8 1, ptr %70, align 8, !tbaa !22
  %71 = load ptr, ptr %11, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.tagbstring, ptr %71, i32 0, i32 2
  %73 = load ptr, ptr %72, align 8, !tbaa !19
  %74 = call i32 @is_numeric(ptr noundef %73)
  %75 = icmp ne i32 %74, 0
  br i1 %75, label %76, label %83

76:                                               ; preds = %68
  %77 = load ptr, ptr %11, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.tagbstring, ptr %77, i32 0, i32 2
  %79 = load ptr, ptr %78, align 8, !tbaa !19
  %80 = call double @atof(ptr noundef %79) #3
  %81 = load ptr, ptr %10, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.VarType_t, ptr %81, i32 0, i32 2
  store double %80, ptr %82, align 8, !tbaa !18
  br label %84

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

84:                                               ; preds = %76
  br label %85

85:                                               ; preds = %84, %67
  br label %86

86:                                               ; preds = %85, %27
  store i32 0, ptr %6, align 4
  br label %87

87:                                               ; preds = %86, %83, %65
  %88 = load i32, ptr %6, align 4
  ret i32 %88
}

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 = !{!"VarType_t", !6, i64 0, !6, i64 8, !13, i64 16, !14, i64 24, !14, i64 25, !10, i64 28, !10, i64 32}
!13 = !{!"double", !7, i64 0}
!14 = !{!"_Bool", !7, i64 0}
!15 = !{!12, !6, i64 0}
!16 = !{!12, !10, i64 28}
!17 = !{!12, !10, i64 32}
!18 = !{!12, !13, i64 16}
!19 = !{!20, !6, i64 8}
!20 = !{!"tagbstring", !10, i64 0, !10, i64 4, !6, i64 8}
!21 = !{!7, !7, i64 0}
!22 = !{!12, !14, i64 24}
!23 = !{!20, !10, i64 4}
!24 = !{!12, !14, i64 25}


; 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 noundef %0, ptr noundef %1, i32 noundef %2, ptr nocapture noundef writeonly %3, ptr 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 !13
  %9 = getelementptr inbounds i8, ptr %3, i64 28
  store i32 0, ptr %9, align 4, !tbaa !14
  %10 = getelementptr inbounds i8, ptr %3, i64 32
  store i32 %2, ptr %10, align 8, !tbaa !15
  %.not = icmp eq ptr %4, null
  br i1 %.not, label %11, label %13

11:                                               ; preds = %5
  %12 = getelementptr inbounds i8, ptr %3, i64 16
  store double 0xC08F3F3333333333, ptr %12, align 8, !tbaa !16
  br label %40

13:                                               ; preds = %5
  %14 = getelementptr inbounds i8, ptr %4, i64 8
  %15 = load ptr, ptr %14, align 8, !tbaa !17
  %16 = load i8, ptr %15, align 1, !tbaa !19
  %17 = icmp eq i8 %16, 35
  %18 = getelementptr inbounds i8, ptr %3, i64 24
  br i1 %17, label %19, label %34

19:                                               ; preds = %13
  store i8 0, ptr %18, align 8, !tbaa !20
  %20 = getelementptr inbounds i8, ptr %4, i64 4
  %21 = load i32, ptr %20, align 4, !tbaa !21
  %22 = icmp eq i32 %21, 1
  br i1 %22, label %23, label %25

23:                                               ; preds = %19
  %24 = getelementptr inbounds i8, ptr %3, i64 16
  store double 0xC08F3F3333333333, ptr %24, align 8, !tbaa !16
  br label %40

25:                                               ; preds = %19
  %26 = tail call ptr @remove_first_character(ptr noundef nonnull %15)
  %27 = tail call i32 @is_numeric(ptr noundef %26)
  %.not23 = icmp eq i32 %27, 0
  br i1 %.not23, label %40, label %28

28:                                               ; preds = %25
  %29 = load ptr, ptr %14, align 8, !tbaa !17
  %30 = tail call ptr @remove_first_character(ptr noundef %29)
  %31 = tail call double @atof(ptr noundef %30) #4
  %32 = getelementptr inbounds i8, ptr %3, i64 16
  store double %31, ptr %32, align 8, !tbaa !16
  %33 = getelementptr inbounds i8, ptr %3, i64 25
  store i8 1, ptr %33, align 1, !tbaa !22
  br label %40

34:                                               ; preds = %13
  store i8 1, ptr %18, align 8, !tbaa !20
  %35 = tail call i32 @is_numeric(ptr noundef nonnull %15)
  %.not22 = icmp eq i32 %35, 0
  br i1 %.not22, label %40, label %36

36:                                               ; preds = %34
  %37 = load ptr, ptr %14, align 8, !tbaa !17
  %38 = tail call double @atof(ptr noundef %37) #4
  %39 = getelementptr inbounds i8, ptr %3, i64 16
  store double %38, ptr %39, align 8, !tbaa !16
  br label %40

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


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