; LLVM IR from mbheinen/bpa-ipf-tsp :: cflow (convtbl)

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

@_pow = external hidden global [16 x double], align 16

; Function Attrs: nounwind uwtable
define dso_local float @a2f(ptr noundef %0, i32 noundef %1, i32 noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca float, align 4
  %11 = alloca [20 x i8], align 16
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  store i32 %2, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 0, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 20, ptr %11) #4
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %14

14:                                               ; preds = %107, %3
  %15 = load i32, ptr %7, align 4, !tbaa !9
  %16 = load i32, ptr %5, align 4, !tbaa !9
  %17 = icmp slt i32 %15, %16
  br i1 %17, label %18, label %110

18:                                               ; preds = %14
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = load i32, ptr %7, align 4, !tbaa !9
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds i8, ptr %19, i64 %21
  %23 = load i8, ptr %22, align 1, !tbaa !11
  %24 = load i32, ptr %7, align 4, !tbaa !9
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [20 x i8], ptr %11, i64 0, i64 %25
  store i8 %23, ptr %26, align 1, !tbaa !11
  %27 = call ptr @__ctype_b_loc() #5
  %28 = load ptr, ptr %27, align 8, !tbaa !5
  %29 = load i32, ptr %7, align 4, !tbaa !9
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [20 x i8], ptr %11, i64 0, i64 %30
  %32 = load i8, ptr %31, align 1, !tbaa !11
  %33 = sext i8 %32 to i32
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds i16, ptr %28, i64 %34
  %36 = load i16, ptr %35, align 2, !tbaa !12
  %37 = zext i16 %36 to i32
  %38 = and i32 %37, 2048
  %39 = icmp ne i32 %38, 0
  br i1 %39, label %40, label %41

40:                                               ; preds = %18
  br label %107

41:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %42 = call ptr @__ctype_toupper_loc() #5
  %43 = load ptr, ptr %42, align 8, !tbaa !5
  %44 = load i32, ptr %7, align 4, !tbaa !9
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [20 x i8], ptr %11, i64 0, i64 %45
  %47 = load i8, ptr %46, align 1, !tbaa !11
  %48 = sext i8 %47 to i32
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds i32, ptr %43, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !9
  store i32 %51, ptr %12, align 4, !tbaa !9
  %52 = load i32, ptr %12, align 4, !tbaa !9
  store i32 %52, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  %53 = load i32, ptr %13, align 4, !tbaa !9
  %54 = icmp eq i32 %53, 69
  br i1 %54, label %55, label %56

55:                                               ; preds = %41
  store i32 1, ptr %9, align 4, !tbaa !9
  br label %107

56:                                               ; preds = %41
  %57 = load i32, ptr %7, align 4, !tbaa !9
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [20 x i8], ptr %11, i64 0, i64 %58
  %60 = load i8, ptr %59, align 1, !tbaa !11
  %61 = sext i8 %60 to i32
  %62 = icmp eq i32 %61, 45
  br i1 %62, label %63, label %67

63:                                               ; preds = %56
  %64 = load i32, ptr %9, align 4, !tbaa !9
  %65 = icmp ne i32 %64, 0
  br i1 %65, label %66, label %67

66:                                               ; preds = %63
  br label %107

67:                                               ; preds = %63, %56
  %68 = load i32, ptr %7, align 4, !tbaa !9
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [20 x i8], ptr %11, i64 0, i64 %69
  %71 = load i8, ptr %70, align 1, !tbaa !11
  %72 = sext i8 %71 to i32
  %73 = icmp eq i32 %72, 45
  br i1 %73, label %74, label %79

74:                                               ; preds = %67
  %75 = load i32, ptr %7, align 4, !tbaa !9
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [20 x i8], ptr %11, i64 0, i64 %76
  store i8 48, ptr %77, align 1, !tbaa !11
  %78 = getelementptr inbounds [20 x i8], ptr %11, i64 0, i64 0
  store i8 45, ptr %78, align 16, !tbaa !11
  br label %107

79:                                               ; preds = %67
  %80 = load i32, ptr %7, align 4, !tbaa !9
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [20 x i8], ptr %11, i64 0, i64 %81
  %83 = load i8, ptr %82, align 1, !tbaa !11
  %84 = sext i8 %83 to i32
  %85 = icmp eq i32 %84, 46
  br i1 %85, label %86, label %87

86:                                               ; preds = %79
  store i32 1, ptr %8, align 4, !tbaa !9
  br label %107

87:                                               ; preds = %79
  %88 = call ptr @__ctype_b_loc() #5
  %89 = load ptr, ptr %88, align 8, !tbaa !5
  %90 = load i32, ptr %7, align 4, !tbaa !9
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [20 x i8], ptr %11, i64 0, i64 %91
  %93 = load i8, ptr %92, align 1, !tbaa !11
  %94 = sext i8 %93 to i32
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds i16, ptr %89, i64 %95
  %97 = load i16, ptr %96, align 2, !tbaa !12
  %98 = zext i16 %97 to i32
  %99 = and i32 %98, 8192
  %100 = icmp ne i32 %99, 0
  br i1 %100, label %103, label %101

101:                                              ; preds = %87
  %102 = load i32, ptr %7, align 4, !tbaa !9
  call void @conv_error(i32 noundef %102, i32 noundef 1)
  br label %103

103:                                              ; preds = %101, %87
  %104 = load i32, ptr %7, align 4, !tbaa !9
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [20 x i8], ptr %11, i64 0, i64 %105
  store i8 48, ptr %106, align 1, !tbaa !11
  br label %107

107:                                              ; preds = %103, %86, %74, %66, %55, %40
  %108 = load i32, ptr %7, align 4, !tbaa !9
  %109 = add nsw i32 %108, 1
  store i32 %109, ptr %7, align 4, !tbaa !9
  br label %14, !llvm.loop !14

110:                                              ; preds = %14
  %111 = load i32, ptr %7, align 4, !tbaa !9
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [20 x i8], ptr %11, i64 0, i64 %112
  store i8 0, ptr %113, align 1, !tbaa !11
  %114 = getelementptr inbounds [20 x i8], ptr %11, i64 0, i64 0
  %115 = call double @atof(ptr noundef %114) #6
  %116 = fptrunc double %115 to float
  store float %116, ptr %10, align 4, !tbaa !16
  %117 = load i32, ptr %8, align 4, !tbaa !9
  %118 = icmp ne i32 %117, 0
  br i1 %118, label %127, label %119

119:                                              ; preds = %110
  %120 = load i32, ptr %6, align 4, !tbaa !9
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [16 x double], ptr @_pow, i64 0, i64 %121
  %123 = load double, ptr %122, align 8, !tbaa !18
  %124 = fptrunc double %123 to float
  %125 = load float, ptr %10, align 4, !tbaa !16
  %126 = fdiv float %125, %124
  store float %126, ptr %10, align 4, !tbaa !16
  br label %127

127:                                              ; preds = %119, %110
  %128 = load float, ptr %10, align 4, !tbaa !16
  call void @llvm.lifetime.end.p0(i64 20, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  ret float %128
}

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

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__ctype_b_loc() #2

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__ctype_toupper_loc() #2

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

; Function Attrs: nounwind uwtable
declare hidden void @conv_error(i32 noundef, i32 noundef) #0

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nounwind willreturn memory(none) "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(none) }
attributes #6 = { 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 = !{!7, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"short", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!17, !17, i64 0}
!17 = !{!"float", !7, i64 0}
!18 = !{!19, !19, i64 0}
!19 = !{!"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"

@_pow = external hidden local_unnamed_addr global [16 x double], align 16

; Function Attrs: nounwind uwtable
define dso_local float @a2f(ptr nocapture noundef readonly %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #0 {
  %4 = alloca [20 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %4) #4
  %5 = icmp sgt i32 %1, 0
  br i1 %5, label %.lr.ph, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %3
  store i8 0, ptr %4, align 16, !tbaa !5
  %6 = call double @atof(ptr noundef %4) #5
  %7 = fptrunc double %6 to float
  br label %43

.lr.ph:                                           ; preds = %3
  %8 = tail call ptr @__ctype_b_loc() #6
  %wide.trip.count = zext nneg i32 %1 to i64
  br label %9

9:                                                ; preds = %.lr.ph, %37
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %37 ]
  %.02331 = phi i32 [ 0, %.lr.ph ], [ %.1, %37 ]
  %.02530 = phi i32 [ 0, %.lr.ph ], [ %.126, %37 ]
  %10 = getelementptr inbounds i8, ptr %0, i64 %indvars.iv
  %11 = load i8, ptr %10, align 1, !tbaa !5
  %12 = getelementptr inbounds [20 x i8], ptr %4, i64 0, i64 %indvars.iv
  store i8 %11, ptr %12, align 1, !tbaa !5
  %13 = load ptr, ptr %8, align 8, !tbaa !8
  %14 = sext i8 %11 to i64
  %15 = getelementptr inbounds i16, ptr %13, i64 %14
  %16 = load i16, ptr %15, align 2, !tbaa !10
  %17 = zext i16 %16 to i32
  %18 = and i32 %17, 2048
  %.not28 = icmp eq i32 %18, 0
  br i1 %.not28, label %19, label %37

19:                                               ; preds = %9
  %20 = tail call ptr @__ctype_toupper_loc() #6
  %21 = load ptr, ptr %20, align 8, !tbaa !8
  %22 = getelementptr inbounds i32, ptr %21, i64 %14
  %23 = load i32, ptr %22, align 4, !tbaa !12
  %24 = icmp eq i32 %23, 69
  br i1 %24, label %37, label %25

25:                                               ; preds = %19
  %26 = icmp eq i8 %11, 45
  %27 = icmp ne i32 %.02530, 0
  %or.cond = select i1 %26, i1 %27, i1 false
  br i1 %or.cond, label %37, label %28

28:                                               ; preds = %25
  br i1 %26, label %29, label %30

29:                                               ; preds = %28
  store i8 48, ptr %12, align 1, !tbaa !5
  store i8 45, ptr %4, align 16, !tbaa !5
  br label %37

30:                                               ; preds = %28
  %31 = icmp eq i8 %11, 46
  br i1 %31, label %37, label %32

32:                                               ; preds = %30
  %33 = and i32 %17, 8192
  %.not29 = icmp eq i32 %33, 0
  br i1 %.not29, label %34, label %36

34:                                               ; preds = %32
  %35 = trunc nuw nsw i64 %indvars.iv to i32
  tail call void @conv_error(i32 noundef %35, i32 noundef 1)
  br label %36

36:                                               ; preds = %34, %32
  store i8 48, ptr %12, align 1, !tbaa !5
  br label %37

37:                                               ; preds = %30, %19, %25, %9, %36, %29
  %.126 = phi i32 [ %.02530, %9 ], [ 1, %25 ], [ %.02530, %29 ], [ %.02530, %36 ], [ 1, %19 ], [ %.02530, %30 ]
  %.1 = phi i32 [ %.02331, %9 ], [ %.02331, %25 ], [ %.02331, %29 ], [ %.02331, %36 ], [ %.02331, %19 ], [ 1, %30 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %9, !llvm.loop !14

._crit_edge:                                      ; preds = %37
  %38 = zext nneg i32 %1 to i64
  %39 = icmp eq i32 %.1, 0
  %40 = getelementptr inbounds [20 x i8], ptr %4, i64 0, i64 %38
  store i8 0, ptr %40, align 1, !tbaa !5
  %41 = call double @atof(ptr noundef %4) #5
  %42 = fptrunc double %41 to float
  br i1 %39, label %43, label %50

43:                                               ; preds = %._crit_edge.thread, %._crit_edge
  %44 = phi float [ %7, %._crit_edge.thread ], [ %42, %._crit_edge ]
  %45 = sext i32 %2 to i64
  %46 = getelementptr inbounds [16 x double], ptr @_pow, i64 0, i64 %45
  %47 = load double, ptr %46, align 8, !tbaa !16
  %48 = fptrunc double %47 to float
  %49 = fdiv float %44, %48
  br label %50

50:                                               ; preds = %43, %._crit_edge
  %.024 = phi float [ %42, %._crit_edge ], [ %49, %43 ]
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %4) #4
  ret float %.024
}

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

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__ctype_b_loc() local_unnamed_addr #2

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__ctype_toupper_loc() local_unnamed_addr #2

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

; Function Attrs: nounwind uwtable
declare hidden void @conv_error(i32 noundef, i32 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 #3

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nosync nounwind willreturn memory(none) "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 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 #4 = { nounwind }
attributes #5 = { nounwind willreturn memory(read) }
attributes #6 = { nounwind willreturn memory(none) }

!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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !6, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"short", !6, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !6, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!17, !17, i64 0}
!17 = !{!"double", !6, i64 0}


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