; LLVM IR from jovanlanik/wip :: src (wip_input)

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

@wip_globalMotionName = external global [7 x [64 x i8]], align 16
@__func__.wip_loadBindings = external hidden unnamed_addr constant [17 x i8], align 1
@.str = external hidden unnamed_addr constant [6 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

; Function Attrs: nounwind uwtable
declare dso_local void @wip_bindMotion(i32 noundef, i32 noundef) #1

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

4:                                                ; preds = %25, %0
  %5 = load i32, ptr %2, align 4, !tbaa !9
  %6 = icmp slt i32 %5, 7
  br i1 %6, label %8, label %7

7:                                                ; preds = %4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  br label %28

8:                                                ; preds = %4
  %9 = load ptr, ptr %1, align 8, !tbaa !5
  %10 = call ptr @strcpy(ptr noundef %9, ptr noundef @.str) #4
  %11 = load ptr, ptr %1, align 8, !tbaa !5
  %12 = load i32, ptr %2, align 4, !tbaa !9
  %13 = sext i32 %12 to i64
  %14 = getelementptr inbounds [7 x [64 x i8]], ptr @wip_globalMotionName, i64 0, i64 %13
  %15 = getelementptr inbounds [64 x i8], ptr %14, i64 0, i64 0
  %16 = call ptr @strcat(ptr noundef %11, ptr noundef %15) #4
  %17 = load ptr, ptr %1, align 8, !tbaa !5
  %18 = call zeroext i1 @wip_findConfStr(ptr noundef %17)
  br i1 %18, label %19, label %24

19:                                               ; preds = %8
  %20 = load i32, ptr %2, align 4, !tbaa !9
  %21 = load ptr, ptr %1, align 8, !tbaa !5
  %22 = call ptr @wip_getConfStr(ptr noundef %21)
  %23 = call i32 @wip_findKey(ptr noundef %22)
  call void @wip_bindMotion(i32 noundef %20, i32 noundef %23)
  br label %24

24:                                               ; preds = %19, %8
  br label %25

25:                                               ; preds = %24
  %26 = load i32, ptr %2, align 4, !tbaa !9
  %27 = add nsw i32 %26, 1
  store i32 %27, ptr %2, align 4, !tbaa !9
  br label %4, !llvm.loop !11

28:                                               ; preds = %7
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #4
  ret void
}

declare ptr @_wip_alloc(i64 noundef, ptr noundef) #2

; Function Attrs: nounwind
declare ptr @strcpy(ptr noundef, ptr noundef) #3

; Function Attrs: nounwind
declare ptr @strcat(ptr noundef, ptr noundef) #3

declare zeroext i1 @wip_findConfStr(ptr noundef) #2

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

declare ptr @wip_getConfStr(ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { "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 "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 }

!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 = distinct !{!11, !12}
!12 = !{!"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"

@wip_globalMotionName = external global [7 x [64 x i8]], align 16
@__func__.wip_loadBindings = external hidden unnamed_addr constant [17 x i8], align 1
@.str = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @wip_bindMotion(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @wip_loadBindings() local_unnamed_addr #0 {
  %1 = tail call ptr @_wip_alloc(i64 noundef 69, ptr noundef nonnull @__func__.wip_loadBindings) #3
  %2 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) @.str) #3
  %3 = tail call ptr @strcat(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) @wip_globalMotionName) #3
  %4 = tail call zeroext i1 @wip_findConfStr(ptr noundef %1) #3
  br i1 %4, label %5, label %8

5:                                                ; preds = %0
  %6 = tail call ptr @wip_getConfStr(ptr noundef %1) #3
  %7 = tail call i32 @wip_findKey(ptr noundef %6)
  tail call void @wip_bindMotion(i32 noundef 0, i32 noundef %7)
  br label %8

8:                                                ; preds = %0, %5
  %9 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) @.str) #3
  %10 = tail call ptr @strcat(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @wip_globalMotionName, i64 64)) #3
  %11 = tail call zeroext i1 @wip_findConfStr(ptr noundef %1) #3
  br i1 %11, label %12, label %15

12:                                               ; preds = %8
  %13 = tail call ptr @wip_getConfStr(ptr noundef %1) #3
  %14 = tail call i32 @wip_findKey(ptr noundef %13)
  tail call void @wip_bindMotion(i32 noundef 1, i32 noundef %14)
  br label %15

15:                                               ; preds = %12, %8
  %16 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) @.str) #3
  %17 = tail call ptr @strcat(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @wip_globalMotionName, i64 128)) #3
  %18 = tail call zeroext i1 @wip_findConfStr(ptr noundef %1) #3
  br i1 %18, label %19, label %22

19:                                               ; preds = %15
  %20 = tail call ptr @wip_getConfStr(ptr noundef %1) #3
  %21 = tail call i32 @wip_findKey(ptr noundef %20)
  tail call void @wip_bindMotion(i32 noundef 2, i32 noundef %21)
  br label %22

22:                                               ; preds = %19, %15
  %23 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) @.str) #3
  %24 = tail call ptr @strcat(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @wip_globalMotionName, i64 192)) #3
  %25 = tail call zeroext i1 @wip_findConfStr(ptr noundef %1) #3
  br i1 %25, label %26, label %29

26:                                               ; preds = %22
  %27 = tail call ptr @wip_getConfStr(ptr noundef %1) #3
  %28 = tail call i32 @wip_findKey(ptr noundef %27)
  tail call void @wip_bindMotion(i32 noundef 3, i32 noundef %28)
  br label %29

29:                                               ; preds = %26, %22
  %30 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) @.str) #3
  %31 = tail call ptr @strcat(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @wip_globalMotionName, i64 256)) #3
  %32 = tail call zeroext i1 @wip_findConfStr(ptr noundef %1) #3
  br i1 %32, label %33, label %36

33:                                               ; preds = %29
  %34 = tail call ptr @wip_getConfStr(ptr noundef %1) #3
  %35 = tail call i32 @wip_findKey(ptr noundef %34)
  tail call void @wip_bindMotion(i32 noundef 4, i32 noundef %35)
  br label %36

36:                                               ; preds = %33, %29
  %37 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) @.str) #3
  %38 = tail call ptr @strcat(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @wip_globalMotionName, i64 320)) #3
  %39 = tail call zeroext i1 @wip_findConfStr(ptr noundef %1) #3
  br i1 %39, label %40, label %43

40:                                               ; preds = %36
  %41 = tail call ptr @wip_getConfStr(ptr noundef %1) #3
  %42 = tail call i32 @wip_findKey(ptr noundef %41)
  tail call void @wip_bindMotion(i32 noundef 5, i32 noundef %42)
  br label %43

43:                                               ; preds = %40, %36
  %44 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) @.str) #3
  %45 = tail call ptr @strcat(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @wip_globalMotionName, i64 384)) #3
  %46 = tail call zeroext i1 @wip_findConfStr(ptr noundef %1) #3
  br i1 %46, label %47, label %50

47:                                               ; preds = %43
  %48 = tail call ptr @wip_getConfStr(ptr noundef %1) #3
  %49 = tail call i32 @wip_findKey(ptr noundef %48)
  tail call void @wip_bindMotion(i32 noundef 6, i32 noundef %49)
  br label %50

50:                                               ; preds = %47, %43
  ret void
}

declare ptr @_wip_alloc(i64 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #2

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcat(ptr noalias noundef returned, ptr noalias nocapture noundef readonly) local_unnamed_addr #2

declare zeroext i1 @wip_findConfStr(ptr noundef) local_unnamed_addr #1

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

declare ptr @wip_getConfStr(ptr noundef) local_unnamed_addr #1

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 = { "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 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "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)"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,SROAPass,SimplifyCFGPass,TailCallElimPass