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

; 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.InitializationData_t = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr }

; 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 void @set_universal_error(ptr noundef, ptr noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @free_init_data(ptr noundef %0, ptr noundef %1, ptr noundef %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %8

8:                                                ; preds = %3
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.InitializationData_t, ptr %9, i32 0, i32 6
  %11 = load ptr, ptr %10, align 8, !tbaa !11
  %12 = call i32 @bdestroy(ptr noundef %11)
  store i32 %12, ptr %7, align 4, !tbaa !9
  %13 = load i32, ptr %7, align 4, !tbaa !9
  %14 = icmp ne i32 %13, 0
  br i1 %14, label %15, label %18

15:                                               ; preds = %8
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  call void @set_universal_error(ptr noundef %16, ptr noundef %17, i32 noundef 131)
  br label %18

18:                                               ; preds = %15, %8
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.InitializationData_t, ptr %19, i32 0, i32 4
  %21 = load ptr, ptr %20, align 8, !tbaa !13
  %22 = call i32 @bstrListDestroy(ptr noundef %21)
  store i32 %22, ptr %7, align 4, !tbaa !9
  %23 = load i32, ptr %7, align 4, !tbaa !9
  %24 = icmp ne i32 %23, 0
  br i1 %24, label %25, label %28

25:                                               ; preds = %18
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = load ptr, ptr %6, align 8, !tbaa !5
  call void @set_universal_error(ptr noundef %26, ptr noundef %27, i32 noundef 131)
  br label %28

28:                                               ; preds = %25, %18
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.InitializationData_t, ptr %29, i32 0, i32 5
  %31 = load ptr, ptr %30, align 8, !tbaa !14
  %32 = call i32 @bstrListDestroy(ptr noundef %31)
  store i32 %32, ptr %7, align 4, !tbaa !9
  %33 = load i32, ptr %7, align 4, !tbaa !9
  %34 = icmp ne i32 %33, 0
  br i1 %34, label %35, label %38

35:                                               ; preds = %28
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = load ptr, ptr %6, align 8, !tbaa !5
  call void @set_universal_error(ptr noundef %36, ptr noundef %37, i32 noundef 131)
  br label %38

38:                                               ; preds = %35, %28
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.InitializationData_t, ptr %39, i32 0, i32 0
  %41 = load ptr, ptr %40, align 8, !tbaa !15
  %42 = call i32 @bstrListDestroy(ptr noundef %41)
  store i32 %42, ptr %7, align 4, !tbaa !9
  %43 = load i32, ptr %7, align 4, !tbaa !9
  %44 = icmp ne i32 %43, 0
  br i1 %44, label %45, label %48

45:                                               ; preds = %38
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  %47 = load ptr, ptr %6, align 8, !tbaa !5
  call void @set_universal_error(ptr noundef %46, ptr noundef %47, i32 noundef 131)
  br label %48

48:                                               ; preds = %45, %38
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.InitializationData_t, ptr %49, i32 0, i32 1
  %51 = load ptr, ptr %50, align 8, !tbaa !16
  %52 = call i32 @bstrListDestroy(ptr noundef %51)
  store i32 %52, ptr %7, align 4, !tbaa !9
  %53 = load i32, ptr %7, align 4, !tbaa !9
  %54 = icmp ne i32 %53, 0
  br i1 %54, label %55, label %58

55:                                               ; preds = %48
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  %57 = load ptr, ptr %6, align 8, !tbaa !5
  call void @set_universal_error(ptr noundef %56, ptr noundef %57, i32 noundef 131)
  br label %58

58:                                               ; preds = %55, %48
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.InitializationData_t, ptr %59, i32 0, i32 2
  %61 = load ptr, ptr %60, align 8, !tbaa !17
  %62 = call i32 @bstrListDestroy(ptr noundef %61)
  store i32 %62, ptr %7, align 4, !tbaa !9
  %63 = load i32, ptr %7, align 4, !tbaa !9
  %64 = icmp ne i32 %63, 0
  br i1 %64, label %65, label %68

65:                                               ; preds = %58
  %66 = load ptr, ptr %5, align 8, !tbaa !5
  %67 = load ptr, ptr %6, align 8, !tbaa !5
  call void @set_universal_error(ptr noundef %66, ptr noundef %67, i32 noundef 131)
  br label %68

68:                                               ; preds = %65, %58
  %69 = load ptr, ptr %4, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.InitializationData_t, ptr %69, i32 0, i32 3
  %71 = load ptr, ptr %70, align 8, !tbaa !18
  %72 = call i32 @bstrListDestroy(ptr noundef %71)
  store i32 %72, ptr %7, align 4, !tbaa !9
  %73 = load i32, ptr %7, align 4, !tbaa !9
  %74 = icmp ne i32 %73, 0
  br i1 %74, label %75, label %78

75:                                               ; preds = %68
  %76 = load ptr, ptr %5, align 8, !tbaa !5
  %77 = load ptr, ptr %6, align 8, !tbaa !5
  call void @set_universal_error(ptr noundef %76, ptr noundef %77, i32 noundef 131)
  br label %78

78:                                               ; preds = %75, %68
  br label %79

79:                                               ; preds = %78
  br label %80

80:                                               ; preds = %79
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  ret i32 0
}

declare i32 @bdestroy(ptr noundef) #1

declare i32 @bstrListDestroy(ptr noundef) #1

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 = { 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 48}
!12 = !{!"InitializationData_t", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48}
!13 = !{!12, !6, i64 32}
!14 = !{!12, !6, i64 40}
!15 = !{!12, !6, i64 0}
!16 = !{!12, !6, i64 8}
!17 = !{!12, !6, i64 16}
!18 = !{!12, !6, i64 24}


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

declare void @set_universal_error(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @free_init_data(ptr nocapture noundef readonly %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #1 {
  %4 = getelementptr inbounds i8, ptr %0, i64 48
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  %6 = tail call i32 @bdestroy(ptr noundef %5) #2
  %.not = icmp eq i32 %6, 0
  br i1 %.not, label %8, label %7

7:                                                ; preds = %3
  tail call void @set_universal_error(ptr noundef %1, ptr noundef %2, i32 noundef 131) #2
  br label %8

8:                                                ; preds = %7, %3
  %9 = getelementptr inbounds i8, ptr %0, i64 32
  %10 = load ptr, ptr %9, align 8, !tbaa !10
  %11 = tail call i32 @bstrListDestroy(ptr noundef %10) #2
  %.not27 = icmp eq i32 %11, 0
  br i1 %.not27, label %13, label %12

12:                                               ; preds = %8
  tail call void @set_universal_error(ptr noundef %1, ptr noundef %2, i32 noundef 131) #2
  br label %13

13:                                               ; preds = %12, %8
  %14 = getelementptr inbounds i8, ptr %0, i64 40
  %15 = load ptr, ptr %14, align 8, !tbaa !11
  %16 = tail call i32 @bstrListDestroy(ptr noundef %15) #2
  %.not28 = icmp eq i32 %16, 0
  br i1 %.not28, label %18, label %17

17:                                               ; preds = %13
  tail call void @set_universal_error(ptr noundef %1, ptr noundef %2, i32 noundef 131) #2
  br label %18

18:                                               ; preds = %17, %13
  %19 = load ptr, ptr %0, align 8, !tbaa !12
  %20 = tail call i32 @bstrListDestroy(ptr noundef %19) #2
  %.not29 = icmp eq i32 %20, 0
  br i1 %.not29, label %22, label %21

21:                                               ; preds = %18
  tail call void @set_universal_error(ptr noundef %1, ptr noundef %2, i32 noundef 131) #2
  br label %22

22:                                               ; preds = %21, %18
  %23 = getelementptr inbounds i8, ptr %0, i64 8
  %24 = load ptr, ptr %23, align 8, !tbaa !13
  %25 = tail call i32 @bstrListDestroy(ptr noundef %24) #2
  %.not30 = icmp eq i32 %25, 0
  br i1 %.not30, label %27, label %26

26:                                               ; preds = %22
  tail call void @set_universal_error(ptr noundef %1, ptr noundef %2, i32 noundef 131) #2
  br label %27

27:                                               ; preds = %26, %22
  %28 = getelementptr inbounds i8, ptr %0, i64 16
  %29 = load ptr, ptr %28, align 8, !tbaa !14
  %30 = tail call i32 @bstrListDestroy(ptr noundef %29) #2
  %.not31 = icmp eq i32 %30, 0
  br i1 %.not31, label %32, label %31

31:                                               ; preds = %27
  tail call void @set_universal_error(ptr noundef %1, ptr noundef %2, i32 noundef 131) #2
  br label %32

32:                                               ; preds = %31, %27
  %33 = getelementptr inbounds i8, ptr %0, i64 24
  %34 = load ptr, ptr %33, align 8, !tbaa !15
  %35 = tail call i32 @bstrListDestroy(ptr noundef %34) #2
  %.not32 = icmp eq i32 %35, 0
  br i1 %.not32, label %37, label %36

36:                                               ; preds = %32
  tail call void @set_universal_error(ptr noundef %1, ptr noundef %2, i32 noundef 131) #2
  br label %37

37:                                               ; preds = %36, %32
  ret i32 0
}

declare i32 @bdestroy(ptr noundef) local_unnamed_addr #0

declare i32 @bstrListDestroy(ptr noundef) local_unnamed_addr #0

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 = { 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, !7, i64 48}
!6 = !{!"InitializationData_t", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 32}
!11 = !{!6, !7, i64 40}
!12 = !{!6, !7, i64 0}
!13 = !{!6, !7, i64 8}
!14 = !{!6, !7, i64 16}
!15 = !{!6, !7, i64 24}


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