; LLVM IR from likle/cwalk :: test (absolute_test)

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

@__const.absolute_check.relative_paths = external hidden unnamed_addr constant [6 x ptr], align 16
@__const.absolute_check.absolute_paths = external hidden unnamed_addr constant [6 x ptr], align 16

; Function Attrs: nounwind uwtable
define dso_local i32 @absolute_check() #0 {
  %1 = alloca i32, align 4
  %2 = alloca [6 x ptr], align 16
  %3 = alloca [6 x ptr], align 16
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 48, ptr %2) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %2, ptr align 16 @__const.absolute_check.relative_paths, i64 48, i1 false)
  call void @llvm.lifetime.start.p0(i64 48, ptr %3) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %3, ptr align 16 @__const.absolute_check.absolute_paths, i64 48, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  call void @cwk_path_set_style(i32 noundef 1)
  store i64 0, ptr %4, align 8, !tbaa !5
  br label %6

6:                                                ; preds = %16, %0
  %7 = load i64, ptr %4, align 8, !tbaa !5
  %8 = icmp ult i64 %7, 6
  br i1 %8, label %9, label %19

9:                                                ; preds = %6
  %10 = load i64, ptr %4, align 8, !tbaa !5
  %11 = getelementptr inbounds [6 x ptr], ptr %2, i64 0, i64 %10
  %12 = load ptr, ptr %11, align 8, !tbaa !9
  %13 = call zeroext i1 @cwk_path_is_absolute(ptr noundef %12)
  br i1 %13, label %14, label %15

14:                                               ; preds = %9
  store i32 1, ptr %1, align 4
  store i32 1, ptr %5, align 4
  br label %34

15:                                               ; preds = %9
  br label %16

16:                                               ; preds = %15
  %17 = load i64, ptr %4, align 8, !tbaa !5
  %18 = add i64 %17, 1
  store i64 %18, ptr %4, align 8, !tbaa !5
  br label %6, !llvm.loop !11

19:                                               ; preds = %6
  store i64 0, ptr %4, align 8, !tbaa !5
  br label %20

20:                                               ; preds = %30, %19
  %21 = load i64, ptr %4, align 8, !tbaa !5
  %22 = icmp ult i64 %21, 6
  br i1 %22, label %23, label %33

23:                                               ; preds = %20
  %24 = load i64, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds [6 x ptr], ptr %3, i64 0, i64 %24
  %26 = load ptr, ptr %25, align 8, !tbaa !9
  %27 = call zeroext i1 @cwk_path_is_absolute(ptr noundef %26)
  br i1 %27, label %29, label %28

28:                                               ; preds = %23
  store i32 1, ptr %1, align 4
  store i32 1, ptr %5, align 4
  br label %34

29:                                               ; preds = %23
  br label %30

30:                                               ; preds = %29
  %31 = load i64, ptr %4, align 8, !tbaa !5
  %32 = add i64 %31, 1
  store i64 %32, ptr %4, align 8, !tbaa !5
  br label %20, !llvm.loop !13

33:                                               ; preds = %20
  store i32 0, ptr %1, align 4
  store i32 1, ptr %5, align 4
  br label %34

34:                                               ; preds = %33, %28, %14
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 48, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 48, ptr %2) #4
  %35 = load i32, ptr %1, align 4
  ret i32 %35
}

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

declare void @cwk_path_set_style(i32 noundef) #3

declare zeroext i1 @cwk_path_is_absolute(ptr noundef) #3

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}


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

@__const.absolute_check.relative_paths = external hidden unnamed_addr constant [6 x ptr], align 16
@__const.absolute_check.absolute_paths = external hidden unnamed_addr constant [6 x ptr], align 16

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @absolute_check() local_unnamed_addr #0 {
  tail call void @cwk_path_set_style(i32 noundef 1) #2
  %1 = load ptr, ptr @__const.absolute_check.relative_paths, align 16, !tbaa !5
  %2 = tail call zeroext i1 @cwk_path_is_absolute(ptr noundef %1) #2
  br i1 %2, label %.loopexit, label %3

3:                                                ; preds = %0
  %4 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.absolute_check.relative_paths, i64 8), align 8, !tbaa !5
  %5 = tail call zeroext i1 @cwk_path_is_absolute(ptr noundef %4) #2
  br i1 %5, label %.loopexit, label %6

6:                                                ; preds = %3
  %7 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.absolute_check.relative_paths, i64 16), align 16, !tbaa !5
  %8 = tail call zeroext i1 @cwk_path_is_absolute(ptr noundef %7) #2
  br i1 %8, label %.loopexit, label %9

9:                                                ; preds = %6
  %10 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.absolute_check.relative_paths, i64 24), align 8, !tbaa !5
  %11 = tail call zeroext i1 @cwk_path_is_absolute(ptr noundef %10) #2
  br i1 %11, label %.loopexit, label %12

12:                                               ; preds = %9
  %13 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.absolute_check.relative_paths, i64 32), align 16, !tbaa !5
  %14 = tail call zeroext i1 @cwk_path_is_absolute(ptr noundef %13) #2
  br i1 %14, label %.loopexit, label %15

15:                                               ; preds = %12
  %16 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.absolute_check.relative_paths, i64 40), align 8, !tbaa !5
  %17 = tail call zeroext i1 @cwk_path_is_absolute(ptr noundef %16) #2
  br i1 %17, label %.loopexit, label %.preheader.preheader

.preheader.preheader:                             ; preds = %15
  %18 = load ptr, ptr @__const.absolute_check.absolute_paths, align 16, !tbaa !5
  %19 = tail call zeroext i1 @cwk_path_is_absolute(ptr noundef %18) #2
  br i1 %19, label %.preheader.1, label %.loopexit

.preheader.1:                                     ; preds = %.preheader.preheader
  %20 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.absolute_check.absolute_paths, i64 8), align 8, !tbaa !5
  %21 = tail call zeroext i1 @cwk_path_is_absolute(ptr noundef %20) #2
  br i1 %21, label %.preheader.2, label %.loopexit

.preheader.2:                                     ; preds = %.preheader.1
  %22 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.absolute_check.absolute_paths, i64 16), align 16, !tbaa !5
  %23 = tail call zeroext i1 @cwk_path_is_absolute(ptr noundef %22) #2
  br i1 %23, label %.preheader.3, label %.loopexit

.preheader.3:                                     ; preds = %.preheader.2
  %24 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.absolute_check.absolute_paths, i64 24), align 8, !tbaa !5
  %25 = tail call zeroext i1 @cwk_path_is_absolute(ptr noundef %24) #2
  br i1 %25, label %.preheader.4, label %.loopexit

.preheader.4:                                     ; preds = %.preheader.3
  %26 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.absolute_check.absolute_paths, i64 32), align 16, !tbaa !5
  %27 = tail call zeroext i1 @cwk_path_is_absolute(ptr noundef %26) #2
  br i1 %27, label %.preheader.5, label %.loopexit

.preheader.5:                                     ; preds = %.preheader.4
  %28 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.absolute_check.absolute_paths, i64 40), align 8, !tbaa !5
  %29 = tail call zeroext i1 @cwk_path_is_absolute(ptr noundef %28) #2
  %not. = xor i1 %29, true
  %spec.select = zext i1 %not. to i32
  br label %.loopexit

.loopexit:                                        ; preds = %.preheader.5, %0, %3, %6, %9, %12, %15, %.preheader.preheader, %.preheader.1, %.preheader.2, %.preheader.3, %.preheader.4
  %.07 = phi i32 [ 1, %.preheader.preheader ], [ 1, %.preheader.1 ], [ 1, %.preheader.2 ], [ 1, %.preheader.3 ], [ 1, %.preheader.4 ], [ 1, %15 ], [ 1, %12 ], [ 1, %9 ], [ 1, %6 ], [ 1, %3 ], [ 1, %0 ], [ %spec.select, %.preheader.5 ]
  ret i32 %.07
}

declare void @cwk_path_set_style(i32 noundef) local_unnamed_addr #1

declare zeroext i1 @cwk_path_is_absolute(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 = { 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"}


; Effective O3 passes: GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,SROAPass,SimplifyCFGPass,TailCallElimPass