; LLVM IR from wumo/vkg :: src/par/test (test_msquares)

; 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.par_color_context = type { ptr, [4 x i8], i32, i32, i32 }

; 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
define dso_local ptr @par_msquares_color(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, i32 noundef %6) #1 {
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca %struct.par_color_context, align 8
  store ptr %0, ptr %8, align 8, !tbaa !5
  store i32 %1, ptr %9, align 4, !tbaa !9
  store i32 %2, ptr %10, align 4, !tbaa !9
  store i32 %3, ptr %11, align 4, !tbaa !9
  store i32 %4, ptr %12, align 4, !tbaa !9
  store i32 %5, ptr %13, align 4, !tbaa !9
  store i32 %6, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 24, ptr %15) #2
  %16 = load i32, ptr %13, align 4, !tbaa !9
  %17 = getelementptr inbounds %struct.par_color_context, ptr %15, i32 0, i32 2
  store i32 %16, ptr %17, align 4, !tbaa !11
  %18 = load i32, ptr %14, align 4, !tbaa !9
  %19 = and i32 %18, 64
  %20 = icmp ne i32 %19, 0
  br i1 %20, label %21, label %46

21:                                               ; preds = %7
  %22 = load i32, ptr %12, align 4, !tbaa !9
  %23 = lshr i32 %22, 0
  %24 = and i32 %23, 255
  %25 = trunc i32 %24 to i8
  %26 = getelementptr inbounds %struct.par_color_context, ptr %15, i32 0, i32 1
  %27 = getelementptr inbounds [4 x i8], ptr %26, i64 0, i64 0
  store i8 %25, ptr %27, align 8, !tbaa !13
  %28 = load i32, ptr %12, align 4, !tbaa !9
  %29 = lshr i32 %28, 8
  %30 = and i32 %29, 255
  %31 = trunc i32 %30 to i8
  %32 = getelementptr inbounds %struct.par_color_context, ptr %15, i32 0, i32 1
  %33 = getelementptr inbounds [4 x i8], ptr %32, i64 0, i64 1
  store i8 %31, ptr %33, align 1, !tbaa !13
  %34 = load i32, ptr %12, align 4, !tbaa !9
  %35 = lshr i32 %34, 16
  %36 = and i32 %35, 255
  %37 = trunc i32 %36 to i8
  %38 = getelementptr inbounds %struct.par_color_context, ptr %15, i32 0, i32 1
  %39 = getelementptr inbounds [4 x i8], ptr %38, i64 0, i64 2
  store i8 %37, ptr %39, align 2, !tbaa !13
  %40 = load i32, ptr %12, align 4, !tbaa !9
  %41 = lshr i32 %40, 24
  %42 = and i32 %41, 255
  %43 = trunc i32 %42 to i8
  %44 = getelementptr inbounds %struct.par_color_context, ptr %15, i32 0, i32 1
  %45 = getelementptr inbounds [4 x i8], ptr %44, i64 0, i64 3
  store i8 %43, ptr %45, align 1, !tbaa !13
  br label %71

46:                                               ; preds = %7
  %47 = load i32, ptr %12, align 4, !tbaa !9
  %48 = lshr i32 %47, 16
  %49 = and i32 %48, 255
  %50 = trunc i32 %49 to i8
  %51 = getelementptr inbounds %struct.par_color_context, ptr %15, i32 0, i32 1
  %52 = getelementptr inbounds [4 x i8], ptr %51, i64 0, i64 0
  store i8 %50, ptr %52, align 8, !tbaa !13
  %53 = load i32, ptr %12, align 4, !tbaa !9
  %54 = lshr i32 %53, 8
  %55 = and i32 %54, 255
  %56 = trunc i32 %55 to i8
  %57 = getelementptr inbounds %struct.par_color_context, ptr %15, i32 0, i32 1
  %58 = getelementptr inbounds [4 x i8], ptr %57, i64 0, i64 1
  store i8 %56, ptr %58, align 1, !tbaa !13
  %59 = load i32, ptr %12, align 4, !tbaa !9
  %60 = lshr i32 %59, 0
  %61 = and i32 %60, 255
  %62 = trunc i32 %61 to i8
  %63 = getelementptr inbounds %struct.par_color_context, ptr %15, i32 0, i32 1
  %64 = getelementptr inbounds [4 x i8], ptr %63, i64 0, i64 2
  store i8 %62, ptr %64, align 2, !tbaa !13
  %65 = load i32, ptr %12, align 4, !tbaa !9
  %66 = lshr i32 %65, 24
  %67 = and i32 %66, 255
  %68 = trunc i32 %67 to i8
  %69 = getelementptr inbounds %struct.par_color_context, ptr %15, i32 0, i32 1
  %70 = getelementptr inbounds [4 x i8], ptr %69, i64 0, i64 3
  store i8 %68, ptr %70, align 1, !tbaa !13
  br label %71

71:                                               ; preds = %46, %21
  %72 = load ptr, ptr %8, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.par_color_context, ptr %15, i32 0, i32 0
  store ptr %72, ptr %73, align 8, !tbaa !14
  %74 = load i32, ptr %9, align 4, !tbaa !9
  %75 = getelementptr inbounds %struct.par_color_context, ptr %15, i32 0, i32 3
  store i32 %74, ptr %75, align 8, !tbaa !15
  %76 = load i32, ptr %10, align 4, !tbaa !9
  %77 = getelementptr inbounds %struct.par_color_context, ptr %15, i32 0, i32 4
  store i32 %76, ptr %77, align 4, !tbaa !16
  %78 = load i32, ptr %9, align 4, !tbaa !9
  %79 = load i32, ptr %10, align 4, !tbaa !9
  %80 = load i32, ptr %11, align 4, !tbaa !9
  %81 = load i32, ptr %14, align 4, !tbaa !9
  %82 = call ptr @par_msquares_function(i32 noundef %78, i32 noundef %79, i32 noundef %80, i32 noundef %81, ptr noundef %15, ptr noundef @color_inside, ptr noundef @color_height)
  call void @llvm.lifetime.end.p0(i64 24, ptr %15) #2
  ret ptr %82
}

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

; Function Attrs: nounwind uwtable
declare hidden i32 @color_inside(i32 noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden float @color_height(float noundef, float noundef, ptr noundef) #1

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 = { 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, !10, i64 12}
!12 = !{!"", !6, i64 0, !7, i64 8, !10, i64 12, !10, i64 16, !10, i64 20}
!13 = !{!7, !7, i64 0}
!14 = !{!12, !6, i64 0}
!15 = !{!12, !10, i64 16}
!16 = !{!12, !10, i64 20}


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

%struct.par_color_context = type { ptr, [4 x i8], i32, i32, i32 }

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

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

; Function Attrs: nounwind uwtable
define dso_local ptr @par_msquares_color(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, i32 noundef %6) local_unnamed_addr #1 {
  %8 = alloca %struct.par_color_context, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8) #2
  %9 = getelementptr inbounds i8, ptr %8, i64 12
  store i32 %5, ptr %9, align 4, !tbaa !5
  %10 = and i32 %6, 64
  %.not = icmp eq i32 %10, 0
  %11 = lshr i32 %4, 16
  %. = select i1 %.not, i32 %11, i32 %4
  %.19 = select i1 %.not, i32 %4, i32 %11
  %.sink.in = lshr i32 %4, 24
  %.sink = trunc nuw i32 %.sink.in to i8
  %.sink16 = trunc i32 %.19 to i8
  %.sink17.in = lshr i32 %4, 8
  %.sink17 = trunc i32 %.sink17.in to i8
  %.sink18 = trunc i32 %. to i8
  %12 = getelementptr inbounds i8, ptr %8, i64 8
  store i8 %.sink18, ptr %12, align 8
  %13 = getelementptr inbounds i8, ptr %8, i64 9
  store i8 %.sink17, ptr %13, align 1
  %14 = getelementptr inbounds i8, ptr %8, i64 10
  store i8 %.sink16, ptr %14, align 2
  %15 = getelementptr inbounds i8, ptr %8, i64 11
  store i8 %.sink, ptr %15, align 1
  store ptr %0, ptr %8, align 8, !tbaa !11
  %16 = getelementptr inbounds i8, ptr %8, i64 16
  store i32 %1, ptr %16, align 8, !tbaa !12
  %17 = getelementptr inbounds i8, ptr %8, i64 20
  store i32 %2, ptr %17, align 4, !tbaa !13
  %18 = call ptr @par_msquares_function(i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %6, ptr noundef nonnull %8, ptr noundef nonnull @color_inside, ptr noundef nonnull @color_height)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #2
  ret ptr %18
}

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

; Function Attrs: nounwind uwtable
declare hidden i32 @color_inside(i32 noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden float @color_height(float noundef, float noundef, ptr noundef) #1

attributes #0 = { mustprogress 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 = { 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, !10, i64 12}
!6 = !{!"", !7, i64 0, !8, i64 8, !10, i64 12, !10, i64 16, !10, i64 20}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !7, i64 0}
!12 = !{!6, !10, i64 16}
!13 = !{!6, !10, i64 20}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,MergedLoadStoreMotionPass,SROAPass,SimplifyCFGPass