; LLVM IR from DanEngelbrecht/longtail :: test/main.ll (Z22jc_test_create_fixtureP15jc_test_fixturePKcj)

; 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.jc_test_fixture = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, %struct.jc_test_stats, i32, i32, i32, i32 }
%struct.jc_test_stats = type { i32, i32, i32, i32, i64 }
%struct.jc_test_state = type { [1 x %struct.__jmp_buf_tag], [8 x i8], ptr, ptr, ptr, %struct.jc_test_stats, i64 }
%struct.__jmp_buf_tag = type { [8 x i64], i32, %struct.__sigset_t }
%struct.__sigset_t = type { [16 x i64] }

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_Z17jc_test_get_statev() #1

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

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_Z22jc_test_create_fixtureP15jc_test_fixturePKcj(ptr noundef %0, ptr noundef %1, i32 noundef %2) #1 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !9
  %8 = load ptr, ptr %4, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.jc_test_fixture, ptr %8, i32 0, i32 1
  store ptr null, ptr %9, align 8, !tbaa !11
  %10 = load ptr, ptr %4, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.jc_test_fixture, ptr %10, i32 0, i32 2
  store ptr null, ptr %11, align 8, !tbaa !15
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.jc_test_fixture, ptr %13, i32 0, i32 3
  store ptr %12, ptr %14, align 8, !tbaa !16
  %15 = load i32, ptr %6, align 4, !tbaa !9
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.jc_test_fixture, ptr %16, i32 0, i32 9
  %18 = load i32, ptr %17, align 8
  %19 = and i32 %15, 3
  %20 = shl i32 %19, 27
  %21 = and i32 %18, -402653185
  %22 = or i32 %21, %20
  store i32 %22, ptr %17, align 8
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.jc_test_fixture, ptr %23, i32 0, i32 5
  store ptr null, ptr %24, align 8, !tbaa !17
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.jc_test_fixture, ptr %25, i32 0, i32 9
  %27 = load i32, ptr %26, align 8
  %28 = and i32 %27, -134217728
  %29 = or i32 %28, 0
  store i32 %29, ptr %26, align 8
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.jc_test_fixture, ptr %30, i32 0, i32 9
  %32 = load i32, ptr %31, align 8
  %33 = and i32 %32, 2147483647
  %34 = or i32 %33, 0
  store i32 %34, ptr %31, align 8
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.jc_test_fixture, ptr %35, i32 0, i32 10
  store i32 -1, ptr %36, align 4, !tbaa !18
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.jc_test_fixture, ptr %37, i32 0, i32 12
  store i32 0, ptr %38, align 4, !tbaa !19
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.jc_test_fixture, ptr %39, i32 0, i32 9
  %41 = load i32, ptr %40, align 8
  %42 = and i32 %41, -1073741825
  %43 = or i32 %42, 1073741824
  store i32 %43, ptr %40, align 8
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.jc_test_fixture, ptr %44, i32 0, i32 9
  %46 = load i32, ptr %45, align 8
  %47 = and i32 %46, -536870913
  %48 = or i32 %47, 536870912
  store i32 %48, ptr %45, align 8
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.jc_test_fixture, ptr %49, i32 0, i32 11
  %51 = load i32, ptr %50, align 8
  %52 = and i32 %51, -256
  %53 = or i32 %52, 0
  store i32 %53, ptr %50, align 8
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.jc_test_fixture, ptr %54, i32 0, i32 6
  store ptr null, ptr %55, align 8, !tbaa !20
  %56 = load ptr, ptr %4, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.jc_test_fixture, ptr %56, i32 0, i32 7
  store ptr null, ptr %57, align 8, !tbaa !21
  %58 = load ptr, ptr %4, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.jc_test_fixture, ptr %58, i32 0, i32 8
  call void @_ZL14jc_test_memsetPvjm(ptr noundef %59, i32 noundef 0, i64 noundef 24)
  %60 = call noundef ptr @_Z17jc_test_get_statev()
  %61 = getelementptr inbounds %struct.jc_test_state, ptr %60, i32 0, i32 6
  %62 = load i64, ptr %61, align 8
  %63 = shl i64 %62, 33
  %64 = ashr i64 %63, 33
  %65 = trunc i64 %64 to i32
  %66 = add nsw i32 %65, 1
  %67 = zext i32 %66 to i64
  %68 = load i64, ptr %61, align 8
  %69 = and i64 %67, 2147483647
  %70 = and i64 %68, -2147483648
  %71 = or i64 %70, %69
  store i64 %71, ptr %61, align 8
  %72 = shl i64 %69, 33
  %73 = ashr i64 %72, 33
  %74 = trunc i64 %73 to i32
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %75 = call noundef ptr @_Z17jc_test_get_statev()
  %76 = getelementptr inbounds %struct.jc_test_state, ptr %75, i32 0, i32 4
  %77 = load ptr, ptr %76, align 8, !tbaa !22
  store ptr %77, ptr %7, align 8, !tbaa !5
  %78 = load ptr, ptr %7, align 8, !tbaa !5
  %79 = icmp ne ptr %78, null
  br i1 %79, label %84, label %80

80:                                               ; preds = %3
  %81 = load ptr, ptr %4, align 8, !tbaa !5
  %82 = call noundef ptr @_Z17jc_test_get_statev()
  %83 = getelementptr inbounds %struct.jc_test_state, ptr %82, i32 0, i32 4
  store ptr %81, ptr %83, align 8, !tbaa !22
  br label %98

84:                                               ; preds = %3
  br label %85

85:                                               ; preds = %90, %84
  %86 = load ptr, ptr %7, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.jc_test_fixture, ptr %86, i32 0, i32 1
  %88 = load ptr, ptr %87, align 8, !tbaa !11
  %89 = icmp ne ptr %88, null
  br i1 %89, label %90, label %94

90:                                               ; preds = %85
  %91 = load ptr, ptr %7, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.jc_test_fixture, ptr %91, i32 0, i32 1
  %93 = load ptr, ptr %92, align 8, !tbaa !11
  store ptr %93, ptr %7, align 8, !tbaa !5
  br label %85, !llvm.loop !24

94:                                               ; preds = %85
  %95 = load ptr, ptr %4, align 8, !tbaa !5
  %96 = load ptr, ptr %7, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.jc_test_fixture, ptr %96, i32 0, i32 1
  store ptr %95, ptr %97, align 8, !tbaa !11
  br label %98

98:                                               ; preds = %94, %80
  %99 = load ptr, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  ret ptr %99
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden void @_ZL14jc_test_memsetPvjm(ptr noundef, i32 noundef, i64 noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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 = { inlinehint mustprogress 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 8}
!12 = !{!"_ZTS15jc_test_fixture", !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !13, i64 64, !10, i64 88, !10, i64 91, !10, i64 91, !10, i64 91, !10, i64 91, !10, i64 92, !10, i64 96, !10, i64 97, !10, i64 99, !10, i64 100}
!13 = !{!"_ZTS13jc_test_stats", !10, i64 0, !10, i64 4, !10, i64 6, !10, i64 8, !10, i64 12, !14, i64 16}
!14 = !{!"long", !7, i64 0}
!15 = !{!12, !6, i64 16}
!16 = !{!12, !6, i64 24}
!17 = !{!12, !6, i64 40}
!18 = !{!12, !10, i64 92}
!19 = !{!12, !10, i64 100}
!20 = !{!12, !6, i64 48}
!21 = !{!12, !6, i64 56}
!22 = !{!23, !6, i64 224}
!23 = !{!"_ZTS13jc_test_state", !7, i64 0, !7, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !13, i64 232, !10, i64 256, !10, i64 259}
!24 = distinct !{!24, !25}
!25 = !{!"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"

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_Z17jc_test_get_statev() local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_Z22jc_test_create_fixtureP15jc_test_fixturePKcj(ptr noundef returned %0, ptr noundef %1, i32 noundef %2) local_unnamed_addr #0 {
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  %5 = getelementptr inbounds i8, ptr %0, i64 24
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %4, i8 0, i64 16, i1 false)
  store ptr %1, ptr %5, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 88
  %7 = shl i32 %2, 27
  %8 = and i32 %7, 402653184
  %9 = getelementptr inbounds i8, ptr %0, i64 40
  store ptr null, ptr %9, align 8, !tbaa !13
  %10 = getelementptr inbounds i8, ptr %0, i64 92
  store i32 -1, ptr %10, align 4, !tbaa !14
  %11 = getelementptr inbounds i8, ptr %0, i64 100
  store i32 0, ptr %11, align 4, !tbaa !15
  %12 = or disjoint i32 %8, 1610612736
  store i32 %12, ptr %6, align 8
  %13 = getelementptr inbounds i8, ptr %0, i64 96
  %14 = load i32, ptr %13, align 8
  %15 = and i32 %14, -256
  store i32 %15, ptr %13, align 8
  %16 = getelementptr inbounds i8, ptr %0, i64 48
  %17 = getelementptr inbounds i8, ptr %0, i64 64
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %16, i8 0, i64 16, i1 false)
  tail call void @_ZL14jc_test_memsetPvjm(ptr noundef nonnull %17, i32 noundef 0, i64 noundef 24)
  %18 = tail call noundef ptr @_Z17jc_test_get_statev()
  %19 = getelementptr inbounds i8, ptr %18, i64 256
  %20 = load i64, ptr %19, align 8
  %21 = add i64 %20, 1
  %22 = and i64 %21, 2147483647
  %23 = and i64 %20, -2147483648
  %24 = or disjoint i64 %22, %23
  store i64 %24, ptr %19, align 8
  %25 = tail call noundef ptr @_Z17jc_test_get_statev()
  %26 = getelementptr inbounds i8, ptr %25, i64 224
  %27 = load ptr, ptr %26, align 8, !tbaa !16
  %.not = icmp eq ptr %27, null
  br i1 %.not, label %28, label %.preheader

28:                                               ; preds = %3
  %29 = tail call noundef ptr @_Z17jc_test_get_statev()
  %30 = getelementptr inbounds i8, ptr %29, i64 224
  br label %35

.preheader:                                       ; preds = %3, %.preheader
  %.0 = phi ptr [ %32, %.preheader ], [ %27, %3 ]
  %31 = getelementptr inbounds i8, ptr %.0, i64 8
  %32 = load ptr, ptr %31, align 8, !tbaa !18
  %.not25 = icmp eq ptr %32, null
  br i1 %.not25, label %33, label %.preheader, !llvm.loop !19

33:                                               ; preds = %.preheader
  %34 = getelementptr inbounds i8, ptr %.0, i64 8
  br label %35

35:                                               ; preds = %33, %28
  %.sink = phi ptr [ %34, %33 ], [ %30, %28 ]
  store ptr %0, ptr %.sink, align 8, !tbaa !21
  ret ptr %0
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden void @_ZL14jc_test_memsetPvjm(ptr noundef, i32 noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

attributes #0 = { mustprogress 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 = { inlinehint mustprogress 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }

!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 24}
!6 = !{!"_ZTS15jc_test_fixture", !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !10, i64 64, !11, i64 88, !11, i64 91, !11, i64 91, !11, i64 91, !11, i64 91, !11, i64 92, !11, i64 96, !11, i64 97, !11, i64 99, !11, i64 100}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTS13jc_test_stats", !11, i64 0, !11, i64 4, !11, i64 6, !11, i64 8, !11, i64 12, !12, i64 16}
!11 = !{!"int", !8, i64 0}
!12 = !{!"long", !8, i64 0}
!13 = !{!6, !7, i64 40}
!14 = !{!6, !11, i64 92}
!15 = !{!6, !11, i64 100}
!16 = !{!17, !7, i64 224}
!17 = !{!"_ZTS13jc_test_state", !8, i64 0, !8, i64 200, !7, i64 208, !7, i64 216, !7, i64 224, !10, i64 232, !11, i64 256, !11, i64 259}
!18 = !{!6, !7, i64 8}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!7, !7, i64 0}


; Effective O3 passes: DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LICMPass,LoopSimplifyPass,LoopUnrollPass,MemCpyOptPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass