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

; 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] }>

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

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

; 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 void @_ZN7ClausesC2Ev(ptr noundef nonnull align 8 dereferenceable(36) %0) unnamed_addr #3 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %4 = load ptr, ptr %2, align 8
  %5 = getelementptr inbounds %class.Clauses, ptr %4, i32 0, i32 4
  store ptr null, ptr %5, align 8, !tbaa !9
  %6 = getelementptr inbounds %class.Clauses, ptr %4, i32 0, i32 2
  store i32 16, ptr %6, align 4, !tbaa !12
  %7 = getelementptr inbounds %class.Clauses, ptr %4, i32 0, i32 2
  %8 = load i32, ptr %7, align 4, !tbaa !12
  %9 = shl i32 1, %8
  %10 = getelementptr inbounds %class.Clauses, ptr %4, i32 0, i32 1
  store i32 %9, ptr %10, align 8, !tbaa !13
  %11 = getelementptr inbounds %class.Clauses, ptr %4, i32 0, i32 1
  %12 = load i32, ptr %11, align 8, !tbaa !13
  %13 = sext i32 %12 to i64
  %14 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %13, i64 4)
  %15 = extractvalue { i64, i1 } %14, 1
  %16 = extractvalue { i64, i1 } %14, 0
  %17 = select i1 %15, i64 -1, i64 %16
  %18 = call noalias noundef nonnull ptr @_Znam(i64 noundef %17) #4
  %19 = getelementptr inbounds %class.Clauses, ptr %4, i32 0, i32 0
  store ptr %18, ptr %19, align 8, !tbaa !14
  %20 = getelementptr inbounds %class.Clauses, ptr %4, i32 0, i32 2
  %21 = load i32, ptr %20, align 4, !tbaa !12
  %22 = sext i32 %21 to i64
  %23 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %22, i64 4)
  %24 = extractvalue { i64, i1 } %23, 1
  %25 = extractvalue { i64, i1 } %23, 0
  %26 = select i1 %24, i64 -1, i64 %25
  %27 = call noalias noundef nonnull ptr @_Znam(i64 noundef %26) #4
  %28 = getelementptr inbounds %class.Clauses, ptr %4, i32 0, i32 3
  store ptr %27, ptr %28, align 8, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 0, ptr %3, align 4, !tbaa !16
  br label %29

29:                                               ; preds = %50, %1
  %30 = load i32, ptr %3, align 4, !tbaa !16
  %31 = add nsw i32 %30, 1
  %32 = getelementptr inbounds %class.Clauses, ptr %4, i32 0, i32 2
  %33 = load i32, ptr %32, align 4, !tbaa !12
  %34 = icmp slt i32 %31, %33
  br i1 %34, label %36, label %35

35:                                               ; preds = %29
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %53

36:                                               ; preds = %29
  %37 = load i32, ptr %3, align 4, !tbaa !16
  %38 = shl i32 1, %37
  %39 = getelementptr inbounds %class.Clauses, ptr %4, i32 0, i32 3
  %40 = load ptr, ptr %39, align 8, !tbaa !15
  %41 = load i32, ptr %3, align 4, !tbaa !16
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds i32, ptr %40, i64 %42
  store i32 %38, ptr %43, align 4, !tbaa !16
  %44 = getelementptr inbounds %class.Clauses, ptr %4, i32 0, i32 0
  %45 = load ptr, ptr %44, align 8, !tbaa !14
  %46 = load i32, ptr %3, align 4, !tbaa !16
  %47 = shl i32 1, %46
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds i32, ptr %45, i64 %48
  store i32 0, ptr %49, align 4, !tbaa !16
  br label %50

50:                                               ; preds = %36
  %51 = load i32, ptr %3, align 4, !tbaa !16
  %52 = add nsw i32 %51, 1
  store i32 %52, ptr %3, align 4, !tbaa !16
  br label %29, !llvm.loop !17

53:                                               ; preds = %35
  %54 = getelementptr inbounds %class.Clauses, ptr %4, i32 0, i32 3
  %55 = load ptr, ptr %54, align 8, !tbaa !15
  %56 = getelementptr inbounds %class.Clauses, ptr %4, i32 0, i32 2
  %57 = load i32, ptr %56, align 4, !tbaa !12
  %58 = sub nsw i32 %57, 1
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds i32, ptr %55, i64 %59
  store i32 0, ptr %60, align 4, !tbaa !16
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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 #3 = { 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 #4 = { builtin allocsize(0) }
attributes #5 = { 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, !6, i64 24}
!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, !11, i64 8}
!14 = !{!10, !6, i64 0}
!15 = !{!10, !6, i64 16}
!16 = !{!11, !11, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"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: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7ClausesC2Ev(ptr nocapture noundef nonnull writeonly align 8 dereferenceable(36) %0) unnamed_addr #1 align 2 {
.lr.ph.preheader:
  %1 = getelementptr inbounds i8, ptr %0, i64 24
  store ptr null, ptr %1, align 8, !tbaa !5
  %2 = getelementptr inbounds i8, ptr %0, i64 12
  store i32 16, ptr %2, align 4, !tbaa !11
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  store i32 65536, ptr %3, align 8, !tbaa !12
  %4 = tail call noalias noundef nonnull dereferenceable(262144) ptr @_Znam(i64 noundef 262144) #2
  store ptr %4, ptr %0, align 8, !tbaa !13
  %5 = tail call noalias noundef nonnull dereferenceable(64) ptr @_Znam(i64 noundef 64) #2
  %6 = getelementptr inbounds i8, ptr %0, i64 16
  store ptr %5, ptr %6, align 8, !tbaa !14
  store i32 1, ptr %5, align 4, !tbaa !15
  %7 = getelementptr inbounds i8, ptr %4, i64 4
  store i32 0, ptr %7, align 4, !tbaa !15
  %8 = getelementptr inbounds i8, ptr %5, i64 4
  store i32 2, ptr %8, align 4, !tbaa !15
  %9 = getelementptr inbounds i8, ptr %4, i64 8
  store i32 0, ptr %9, align 4, !tbaa !15
  %10 = getelementptr inbounds i8, ptr %5, i64 8
  store i32 4, ptr %10, align 4, !tbaa !15
  %11 = getelementptr inbounds i8, ptr %4, i64 16
  store i32 0, ptr %11, align 4, !tbaa !15
  %12 = getelementptr inbounds i8, ptr %5, i64 12
  store i32 8, ptr %12, align 4, !tbaa !15
  %13 = getelementptr inbounds i8, ptr %4, i64 32
  store i32 0, ptr %13, align 4, !tbaa !15
  %14 = getelementptr inbounds i8, ptr %5, i64 16
  store i32 16, ptr %14, align 4, !tbaa !15
  %15 = getelementptr inbounds i8, ptr %4, i64 64
  store i32 0, ptr %15, align 4, !tbaa !15
  %16 = getelementptr inbounds i8, ptr %5, i64 20
  store i32 32, ptr %16, align 4, !tbaa !15
  %17 = getelementptr inbounds i8, ptr %4, i64 128
  store i32 0, ptr %17, align 4, !tbaa !15
  %18 = getelementptr inbounds i8, ptr %5, i64 24
  store i32 64, ptr %18, align 4, !tbaa !15
  %19 = getelementptr inbounds i8, ptr %4, i64 256
  store i32 0, ptr %19, align 4, !tbaa !15
  %20 = getelementptr inbounds i8, ptr %5, i64 28
  store i32 128, ptr %20, align 4, !tbaa !15
  %21 = getelementptr inbounds i8, ptr %4, i64 512
  store i32 0, ptr %21, align 4, !tbaa !15
  %22 = getelementptr inbounds i8, ptr %5, i64 32
  store i32 256, ptr %22, align 4, !tbaa !15
  %23 = getelementptr inbounds i8, ptr %4, i64 1024
  store i32 0, ptr %23, align 4, !tbaa !15
  %24 = getelementptr inbounds i8, ptr %5, i64 36
  store i32 512, ptr %24, align 4, !tbaa !15
  %25 = getelementptr inbounds i8, ptr %4, i64 2048
  store i32 0, ptr %25, align 4, !tbaa !15
  %26 = getelementptr inbounds i8, ptr %5, i64 40
  store i32 1024, ptr %26, align 4, !tbaa !15
  %27 = getelementptr inbounds i8, ptr %4, i64 4096
  store i32 0, ptr %27, align 4, !tbaa !15
  %28 = getelementptr inbounds i8, ptr %5, i64 44
  store i32 2048, ptr %28, align 4, !tbaa !15
  %29 = getelementptr inbounds i8, ptr %4, i64 8192
  store i32 0, ptr %29, align 4, !tbaa !15
  %30 = getelementptr inbounds i8, ptr %5, i64 48
  store i32 4096, ptr %30, align 4, !tbaa !15
  %31 = getelementptr inbounds i8, ptr %4, i64 16384
  store i32 0, ptr %31, align 4, !tbaa !15
  %32 = getelementptr inbounds i8, ptr %5, i64 52
  store i32 8192, ptr %32, align 4, !tbaa !15
  %33 = getelementptr inbounds i8, ptr %4, i64 32768
  store i32 0, ptr %33, align 4, !tbaa !15
  %34 = getelementptr inbounds i8, ptr %5, i64 56
  store i32 16384, ptr %34, align 4, !tbaa !15
  %35 = getelementptr inbounds i8, ptr %4, i64 65536
  store i32 0, ptr %35, align 4, !tbaa !15
  %36 = getelementptr inbounds i8, ptr %5, i64 60
  store i32 0, ptr %36, align 4, !tbaa !15
  ret void
}

attributes #0 = { 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 #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 = { builtin allocsize(0) }

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


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass