; LLVM IR from dkitch/maxsat-ising :: src/ccls/akmaxsat_1.1_src/clauses.ll (ZN7Clauses13doubleStorageEv)

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

%class.Clauses = type <{ ptr, i32, i32, ptr, ptr, i32, [4 x i8] }>

@.str = external hidden unnamed_addr constant [17 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [91 x i8], align 1
@__PRETTY_FUNCTION__._ZN7Clauses13doubleStorageEv = external hidden unnamed_addr constant [30 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [34 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7Clauses13doubleStorageEv(ptr noundef nonnull align 8 dereferenceable(36) %0) #0 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %5 = load ptr, ptr %2, align 8
  %6 = getelementptr inbounds %class.Clauses, ptr %5, i32 0, i32 1
  %7 = load i32, ptr %6, align 8, !tbaa !9
  %8 = shl i32 %7, 1
  store i32 %8, ptr %6, align 8, !tbaa !9
  %9 = getelementptr inbounds %class.Clauses, ptr %5, i32 0, i32 2
  %10 = load i32, ptr %9, align 4, !tbaa !12
  %11 = add nsw i32 %10, 1
  store i32 %11, ptr %9, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #7
  %12 = getelementptr inbounds %class.Clauses, ptr %5, i32 0, i32 1
  %13 = load i32, ptr %12, align 8, !tbaa !9
  %14 = sext i32 %13 to i64
  %15 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %14, i64 4)
  %16 = extractvalue { i64, i1 } %15, 1
  %17 = extractvalue { i64, i1 } %15, 0
  %18 = select i1 %16, i64 -1, i64 %17
  %19 = call noalias noundef nonnull ptr @_Znam(i64 noundef %18) #8
  store ptr %19, ptr %3, align 8, !tbaa !5
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = icmp ne ptr %20, null
  br i1 %21, label %22, label %23

22:                                               ; preds = %1
  br label %25

23:                                               ; preds = %1
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 28, ptr noundef @__PRETTY_FUNCTION__._ZN7Clauses13doubleStorageEv) #9
  unreachable

24:                                               ; No predecessors!
  br label %25

25:                                               ; preds = %24, %22
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  %27 = getelementptr inbounds %class.Clauses, ptr %5, i32 0, i32 0
  %28 = load ptr, ptr %27, align 8, !tbaa !13
  %29 = getelementptr inbounds %class.Clauses, ptr %5, i32 0, i32 1
  %30 = load i32, ptr %29, align 8, !tbaa !9
  %31 = sext i32 %30 to i64
  %32 = mul i64 4, %31
  %33 = udiv i64 %32, 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %26, ptr align 4 %28, i64 %33, i1 false)
  %34 = getelementptr inbounds %class.Clauses, ptr %5, i32 0, i32 0
  %35 = load ptr, ptr %34, align 8, !tbaa !13
  %36 = icmp eq ptr %35, null
  br i1 %36, label %38, label %37

37:                                               ; preds = %25
  call void @_ZdaPv(ptr noundef %35) #10
  br label %38

38:                                               ; preds = %37, %25
  %39 = load ptr, ptr %3, align 8, !tbaa !5
  %40 = getelementptr inbounds %class.Clauses, ptr %5, i32 0, i32 0
  store ptr %39, ptr %40, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #7
  %41 = getelementptr inbounds %class.Clauses, ptr %5, i32 0, i32 2
  %42 = load i32, ptr %41, align 4, !tbaa !12
  %43 = sext i32 %42 to i64
  %44 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %43, i64 4)
  %45 = extractvalue { i64, i1 } %44, 1
  %46 = extractvalue { i64, i1 } %44, 0
  %47 = select i1 %45, i64 -1, i64 %46
  %48 = call noalias noundef nonnull ptr @_Znam(i64 noundef %47) #8
  store ptr %48, ptr %4, align 8, !tbaa !5
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = icmp ne ptr %49, null
  br i1 %50, label %51, label %52

51:                                               ; preds = %38
  br label %54

52:                                               ; preds = %38
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 33, ptr noundef @__PRETTY_FUNCTION__._ZN7Clauses13doubleStorageEv) #9
  unreachable

53:                                               ; No predecessors!
  br label %54

54:                                               ; preds = %53, %51
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = getelementptr inbounds %class.Clauses, ptr %5, i32 0, i32 3
  %57 = load ptr, ptr %56, align 8, !tbaa !14
  %58 = getelementptr inbounds %class.Clauses, ptr %5, i32 0, i32 2
  %59 = load i32, ptr %58, align 4, !tbaa !12
  %60 = sub nsw i32 %59, 1
  %61 = sext i32 %60 to i64
  %62 = mul i64 4, %61
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %55, ptr align 4 %57, i64 %62, i1 false)
  %63 = getelementptr inbounds %class.Clauses, ptr %5, i32 0, i32 3
  %64 = load ptr, ptr %63, align 8, !tbaa !14
  %65 = icmp eq ptr %64, null
  br i1 %65, label %67, label %66

66:                                               ; preds = %54
  call void @_ZdaPv(ptr noundef %64) #10
  br label %67

67:                                               ; preds = %66, %54
  %68 = load ptr, ptr %4, align 8, !tbaa !5
  %69 = getelementptr inbounds %class.Clauses, ptr %5, i32 0, i32 3
  store ptr %68, ptr %69, align 8, !tbaa !14
  %70 = getelementptr inbounds %class.Clauses, ptr %5, i32 0, i32 3
  %71 = load ptr, ptr %70, align 8, !tbaa !14
  %72 = getelementptr inbounds %class.Clauses, ptr %5, i32 0, i32 2
  %73 = load i32, ptr %72, align 4, !tbaa !12
  %74 = sub nsw i32 %73, 2
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds i32, ptr %71, i64 %75
  %77 = load i32, ptr %76, align 4, !tbaa !15
  %78 = icmp eq i32 %77, 0
  br i1 %78, label %79, label %80

79:                                               ; preds = %67
  br label %82

80:                                               ; preds = %67
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 37, ptr noundef @__PRETTY_FUNCTION__._ZN7Clauses13doubleStorageEv) #9
  unreachable

81:                                               ; No predecessors!
  br label %82

82:                                               ; preds = %81, %79
  %83 = getelementptr inbounds %class.Clauses, ptr %5, i32 0, i32 1
  %84 = load i32, ptr %83, align 8, !tbaa !9
  %85 = sdiv i32 %84, 2
  %86 = getelementptr inbounds %class.Clauses, ptr %5, i32 0, i32 3
  %87 = load ptr, ptr %86, align 8, !tbaa !14
  %88 = getelementptr inbounds %class.Clauses, ptr %5, i32 0, i32 2
  %89 = load i32, ptr %88, align 4, !tbaa !12
  %90 = sub nsw i32 %89, 2
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds i32, ptr %87, i64 %91
  store i32 %85, ptr %92, align 4, !tbaa !15
  %93 = getelementptr inbounds %class.Clauses, ptr %5, i32 0, i32 3
  %94 = load ptr, ptr %93, align 8, !tbaa !14
  %95 = getelementptr inbounds %class.Clauses, ptr %5, i32 0, i32 2
  %96 = load i32, ptr %95, align 4, !tbaa !12
  %97 = sub nsw i32 %96, 1
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds i32, ptr %94, i64 %98
  store i32 0, ptr %99, align 4, !tbaa !15
  %100 = getelementptr inbounds %class.Clauses, ptr %5, i32 0, i32 0
  %101 = load ptr, ptr %100, align 8, !tbaa !13
  %102 = getelementptr inbounds %class.Clauses, ptr %5, i32 0, i32 1
  %103 = load i32, ptr %102, align 8, !tbaa !9
  %104 = sdiv i32 %103, 2
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds i32, ptr %101, i64 %105
  store i32 0, ptr %106, align 4, !tbaa !15
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #7
  ret void
}

; 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 nosync nounwind speculatable willreturn memory(none)
declare { i64, i1 } @llvm.umul.with.overflow.i64(i64, i64) #2

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) #3

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #4

; 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) #5

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) #6

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { nobuiltin allocsize(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 = { noreturn 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 #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nobuiltin 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 #7 = { nounwind }
attributes #8 = { builtin allocsize(0) }
attributes #9 = { noreturn nounwind }
attributes #10 = { builtin 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, !11, i64 8}
!10 = !{!"_ZTS7Clauses", !6, i64 0, !11, i64 8, !11, i64 12, !6, i64 16, !6, i64 24, !11, i64 32}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 12}
!13 = !{!10, !6, i64 0}
!14 = !{!10, !6, i64 16}
!15 = !{!11, !11, 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"

@.str.1 = external hidden unnamed_addr constant [91 x i8], align 1
@__PRETTY_FUNCTION__._ZN7Clauses13doubleStorageEv = external hidden unnamed_addr constant [30 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [34 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7Clauses13doubleStorageEv(ptr nocapture noundef nonnull align 8 dereferenceable(36) %0) local_unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 8
  %3 = load i32, ptr %2, align 8, !tbaa !5
  %4 = shl i32 %3, 1
  store i32 %4, ptr %2, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 12
  %6 = load i32, ptr %5, align 4, !tbaa !11
  %7 = add nsw i32 %6, 1
  store i32 %7, ptr %5, align 4, !tbaa !11
  %8 = sext i32 %4 to i64
  %9 = icmp slt i32 %4, 0
  %10 = shl nsw i64 %8, 2
  %11 = select i1 %9, i64 -1, i64 %10
  %12 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %11) #5
  %13 = load ptr, ptr %0, align 8, !tbaa !12
  %14 = shl nsw i64 %8, 1
  %15 = and i64 %14, 9223372036854775804
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 4 %12, ptr align 4 %13, i64 %15, i1 false)
  %16 = icmp eq ptr %13, null
  br i1 %16, label %18, label %17

17:                                               ; preds = %1
  tail call void @_ZdaPv(ptr noundef nonnull %13) #6
  %.pre = load i32, ptr %5, align 4, !tbaa !11
  br label %18

18:                                               ; preds = %17, %1
  %19 = phi i32 [ %.pre, %17 ], [ %7, %1 ]
  store ptr %12, ptr %0, align 8, !tbaa !12
  %20 = sext i32 %19 to i64
  %21 = icmp slt i32 %19, 0
  %22 = shl nsw i64 %20, 2
  %23 = select i1 %21, i64 -1, i64 %22
  %24 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %23) #5
  %25 = getelementptr inbounds i8, ptr %0, i64 16
  %26 = load ptr, ptr %25, align 8, !tbaa !13
  %27 = add nsw i32 %19, -1
  %28 = sext i32 %27 to i64
  %29 = shl nsw i64 %28, 2
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 4 %24, ptr align 4 %26, i64 %29, i1 false)
  %30 = icmp eq ptr %26, null
  br i1 %30, label %32, label %31

31:                                               ; preds = %18
  tail call void @_ZdaPv(ptr noundef nonnull %26) #6
  %.pre8 = load i32, ptr %5, align 4, !tbaa !11
  %.pre9 = sext i32 %.pre8 to i64
  br label %32

32:                                               ; preds = %31, %18
  %.pre-phi = phi i64 [ %.pre9, %31 ], [ %20, %18 ]
  store ptr %24, ptr %25, align 8, !tbaa !13
  %33 = getelementptr i32, ptr %24, i64 %.pre-phi
  %34 = getelementptr i8, ptr %33, i64 -8
  %35 = load i32, ptr %34, align 4, !tbaa !14
  %36 = icmp eq i32 %35, 0
  br i1 %36, label %38, label %37

37:                                               ; preds = %32
  tail call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 37, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN7Clauses13doubleStorageEv) #7
  unreachable

38:                                               ; preds = %32
  %39 = load i32, ptr %2, align 8, !tbaa !5
  %40 = sdiv i32 %39, 2
  store i32 %40, ptr %34, align 4, !tbaa !14
  %41 = getelementptr i8, ptr %33, i64 -4
  store i32 0, ptr %41, align 4, !tbaa !14
  %42 = load ptr, ptr %0, align 8, !tbaa !12
  %43 = sext i32 %40 to i64
  %44 = getelementptr inbounds i32, ptr %42, i64 %43
  store i32 0, ptr %44, align 4, !tbaa !14
  ret void
}

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) local_unnamed_addr #1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress 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) #3

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) local_unnamed_addr #4

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 = { nobuiltin allocsize(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 = { noreturn 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 #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nobuiltin 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 #5 = { builtin allocsize(0) }
attributes #6 = { builtin nounwind }
attributes #7 = { noreturn 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 8}
!6 = !{!"_ZTS7Clauses", !7, i64 0, !10, i64 8, !10, i64 12, !7, i64 16, !7, i64 24, !10, i64 32}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !10, i64 12}
!12 = !{!6, !7, i64 0}
!13 = !{!6, !7, i64 16}
!14 = !{!10, !10, i64 0}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass