; LLVM IR from apple/turicreate :: src/external/boost/boost_1_68_0/tools/build/src/engine/modules (set)

; 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.frame = type { ptr, ptr, [1 x %struct._lol], ptr, ptr, i32, ptr }
%struct._lol = type { i32, [19 x ptr] }

; Function Attrs: nounwind uwtable
define dso_local ptr @set_difference(ptr noundef %0, i32 noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.frame, ptr %10, i32 0, i32 2
  %12 = getelementptr inbounds [1 x %struct._lol], ptr %11, i64 0, i64 0
  %13 = call ptr @lol_get(ptr noundef %12, i32 noundef 0)
  store ptr %13, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.frame, ptr %14, i32 0, i32 2
  %16 = getelementptr inbounds [1 x %struct._lol], ptr %15, i64 0, i64 0
  %17 = call ptr @lol_get(ptr noundef %16, i32 noundef 1)
  store ptr %17, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  store ptr null, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = call ptr @list_begin(ptr noundef %18)
  store ptr %19, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = call ptr @list_end(ptr noundef %20)
  store ptr %21, ptr %9, align 8, !tbaa !5
  br label %22

22:                                               ; preds = %39, %2
  %23 = load ptr, ptr %8, align 8, !tbaa !5
  %24 = load ptr, ptr %9, align 8, !tbaa !5
  %25 = icmp ne ptr %23, %24
  br i1 %25, label %26, label %42

26:                                               ; preds = %22
  %27 = load ptr, ptr %6, align 8, !tbaa !5
  %28 = load ptr, ptr %8, align 8, !tbaa !5
  %29 = load ptr, ptr %28, align 8, !tbaa !5
  %30 = call i32 @list_in(ptr noundef %27, ptr noundef %29)
  %31 = icmp ne i32 %30, 0
  br i1 %31, label %38, label %32

32:                                               ; preds = %26
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  %34 = load ptr, ptr %8, align 8, !tbaa !5
  %35 = load ptr, ptr %34, align 8, !tbaa !5
  %36 = call ptr @object_copy(ptr noundef %35)
  %37 = call ptr @list_push_back(ptr noundef %33, ptr noundef %36)
  store ptr %37, ptr %7, align 8, !tbaa !5
  br label %38

38:                                               ; preds = %32, %26
  br label %39

39:                                               ; preds = %38
  %40 = load ptr, ptr %8, align 8, !tbaa !5
  %41 = getelementptr inbounds ptr, ptr %40, i64 1
  store ptr %41, ptr %8, align 8, !tbaa !5
  br label %22, !llvm.loop !11

42:                                               ; preds = %22
  %43 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  ret ptr %43
}

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

declare ptr @lol_get(ptr noundef, i32 noundef) #2

declare ptr @list_begin(ptr noundef) #2

declare ptr @list_end(ptr noundef) #2

declare i32 @list_in(ptr noundef, ptr noundef) #2

declare ptr @list_push_back(ptr noundef, ptr noundef) #2

declare ptr @object_copy(ptr noundef) #2

; 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 = { "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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"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: nounwind uwtable
define dso_local ptr @set_difference(ptr noundef %0, i32 noundef %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 16
  %4 = tail call ptr @lol_get(ptr noundef nonnull %3, i32 noundef 0) #2
  %5 = tail call ptr @lol_get(ptr noundef nonnull %3, i32 noundef 1) #2
  %6 = tail call ptr @list_begin(ptr noundef %4) #2
  %7 = tail call ptr @list_end(ptr noundef %4) #2
  %.not14 = icmp eq ptr %6, %7
  br i1 %.not14, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %2, %14
  %.016 = phi ptr [ %.1, %14 ], [ null, %2 ]
  %.01215 = phi ptr [ %15, %14 ], [ %6, %2 ]
  %8 = load ptr, ptr %.01215, align 8, !tbaa !5
  %9 = tail call i32 @list_in(ptr noundef %5, ptr noundef %8) #2
  %.not13 = icmp eq i32 %9, 0
  br i1 %.not13, label %10, label %14

10:                                               ; preds = %.lr.ph
  %11 = load ptr, ptr %.01215, align 8, !tbaa !5
  %12 = tail call ptr @object_copy(ptr noundef %11) #2
  %13 = tail call ptr @list_push_back(ptr noundef %.016, ptr noundef %12) #2
  br label %14

14:                                               ; preds = %.lr.ph, %10
  %.1 = phi ptr [ %.016, %.lr.ph ], [ %13, %10 ]
  %15 = getelementptr inbounds i8, ptr %.01215, i64 8
  %.not = icmp eq ptr %15, %7
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !9

._crit_edge:                                      ; preds = %14, %2
  %.0.lcssa = phi ptr [ null, %2 ], [ %.1, %14 ]
  ret ptr %.0.lcssa
}

declare ptr @lol_get(ptr noundef, i32 noundef) local_unnamed_addr #1

declare ptr @list_begin(ptr noundef) local_unnamed_addr #1

declare ptr @list_end(ptr noundef) local_unnamed_addr #1

declare i32 @list_in(ptr noundef, ptr noundef) local_unnamed_addr #1

declare ptr @list_push_back(ptr noundef, ptr noundef) local_unnamed_addr #1

declare ptr @object_copy(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"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass