; LLVM IR from kazunetakahashi/atcoder :: 2018/0224_AGC021/B.ll (Z11convex_hullPSt7complexIdEi)

; 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.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::complex<double>, std::allocator<std::complex<double>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::complex<double>, std::allocator<std::complex<double>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::complex<double>, std::allocator<std::complex<double>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::complex<double>, std::allocator<std::complex<double>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::allocator" = type { i8 }
%"class.std::complex" = type { { double, double } }

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z5cmp_xRKSt7complexIdES2_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_Z3detSt7complexIdES0_(double, double, double, double) #0

; 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 willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z11convex_hullPSt7complexIdEi(ptr dead_on_unwind noalias writable sret(%"class.std::vector") align 8 %0, ptr noundef %1, i32 noundef %2) #0 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i1, align 1
  %9 = alloca %"class.std::allocator", align 1
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca %"class.std::complex", align 8
  %14 = alloca %"class.std::complex", align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca %"class.std::complex", align 8
  %18 = alloca %"class.std::complex", align 8
  store ptr %0, ptr %4, align 8
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !9
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = load i32, ptr %6, align 4, !tbaa !9
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds %"class.std::complex", ptr %20, i64 %22
  call void @_ZSt4sortIPSt7complexIdEPFbRKS1_S4_EEvT_S7_T0_(ptr noundef %19, ptr noundef %23, ptr noundef @_Z5cmp_xRKSt7complexIdES2_)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !9
  store i1 false, ptr %8, align 1
  %24 = load i32, ptr %6, align 4, !tbaa !9
  %25 = mul nsw i32 %24, 2
  %26 = sext i32 %25 to i64
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #5
  call void @_ZNSaISt7complexIdEEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %9) #5
  invoke void @_ZNSt6vectorISt7complexIdESaIS1_EEC2EmRKS2_(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %26, ptr noundef nonnull align 1 dereferenceable(1) %9)
          to label %27 unwind label %33

27:                                               ; preds = %3
  call void @_ZNSt15__new_allocatorISt7complexIdEED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %9) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %28

28:                                               ; preds = %101, %27
  %29 = load i32, ptr %12, align 4, !tbaa !9
  %30 = load i32, ptr %6, align 4, !tbaa !9
  %31 = icmp slt i32 %29, %30
  br i1 %31, label %37, label %32

32:                                               ; preds = %28
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %104

33:                                               ; preds = %3
  %34 = landingpad { ptr, i32 }
          cleanup
  %35 = extractvalue { ptr, i32 } %34, 0
  store ptr %35, ptr %10, align 8
  %36 = extractvalue { ptr, i32 } %34, 1
  store i32 %36, ptr %11, align 4
  call void @_ZNSt15__new_allocatorISt7complexIdEED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %9) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #5
  br label %193

37:                                               ; preds = %28
  br label %38

38:                                               ; preds = %85, %37
  %39 = load i32, ptr %7, align 4, !tbaa !9
  %40 = icmp sgt i32 %39, 1
  br i1 %40, label %41, label %83

41:                                               ; preds = %38
  %42 = load i32, ptr %7, align 4, !tbaa !9
  %43 = sub nsw i32 %42, 1
  %44 = sext i32 %43 to i64
  %45 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt7complexIdESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %44) #5
  %46 = load i32, ptr %7, align 4, !tbaa !9
  %47 = sub nsw i32 %46, 2
  %48 = sext i32 %47 to i64
  %49 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt7complexIdESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %48) #5
  %50 = invoke { double, double } @_ZStmiIdESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 8 dereferenceable(16) %45, ptr noundef nonnull align 8 dereferenceable(16) %49)
          to label %51 unwind label %88

51:                                               ; preds = %41
  %52 = getelementptr inbounds %"class.std::complex", ptr %13, i32 0, i32 0
  %53 = getelementptr inbounds { double, double }, ptr %52, i32 0, i32 0
  %54 = extractvalue { double, double } %50, 0
  store double %54, ptr %53, align 8
  %55 = getelementptr inbounds { double, double }, ptr %52, i32 0, i32 1
  %56 = extractvalue { double, double } %50, 1
  store double %56, ptr %55, align 8
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = load i32, ptr %12, align 4, !tbaa !9
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds %"class.std::complex", ptr %57, i64 %59
  %61 = load i32, ptr %7, align 4, !tbaa !9
  %62 = sub nsw i32 %61, 1
  %63 = sext i32 %62 to i64
  %64 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt7complexIdESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %63) #5
  %65 = invoke { double, double } @_ZStmiIdESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 8 dereferenceable(16) %60, ptr noundef nonnull align 8 dereferenceable(16) %64)
          to label %66 unwind label %88

66:                                               ; preds = %51
  %67 = getelementptr inbounds %"class.std::complex", ptr %14, i32 0, i32 0
  %68 = getelementptr inbounds { double, double }, ptr %67, i32 0, i32 0
  %69 = extractvalue { double, double } %65, 0
  store double %69, ptr %68, align 8
  %70 = getelementptr inbounds { double, double }, ptr %67, i32 0, i32 1
  %71 = extractvalue { double, double } %65, 1
  store double %71, ptr %70, align 8
  %72 = getelementptr inbounds { double, double }, ptr %13, i32 0, i32 0
  %73 = load double, ptr %72, align 8
  %74 = getelementptr inbounds { double, double }, ptr %13, i32 0, i32 1
  %75 = load double, ptr %74, align 8
  %76 = getelementptr inbounds { double, double }, ptr %14, i32 0, i32 0
  %77 = load double, ptr %76, align 8
  %78 = getelementptr inbounds { double, double }, ptr %14, i32 0, i32 1
  %79 = load double, ptr %78, align 8
  %80 = invoke noundef double @_Z3detSt7complexIdES0_(double %73, double %75, double %77, double %79)
          to label %81 unwind label %88

81:                                               ; preds = %66
  %82 = fcmp ole double %80, 0.000000e+00
  br label %83

83:                                               ; preds = %81, %38
  %84 = phi i1 [ false, %38 ], [ %82, %81 ]
  br i1 %84, label %85, label %92

85:                                               ; preds = %83
  %86 = load i32, ptr %7, align 4, !tbaa !9
  %87 = add nsw i32 %86, -1
  store i32 %87, ptr %7, align 4, !tbaa !9
  br label %38, !llvm.loop !11

88:                                               ; preds = %66, %51, %41
  %89 = landingpad { ptr, i32 }
          cleanup
  %90 = extractvalue { ptr, i32 } %89, 0
  store ptr %90, ptr %10, align 8
  %91 = extractvalue { ptr, i32 } %89, 1
  store i32 %91, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %192

92:                                               ; preds = %83
  %93 = load ptr, ptr %5, align 8, !tbaa !5
  %94 = load i32, ptr %12, align 4, !tbaa !9
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds %"class.std::complex", ptr %93, i64 %95
  %97 = load i32, ptr %7, align 4, !tbaa !9
  %98 = add nsw i32 %97, 1
  store i32 %98, ptr %7, align 4, !tbaa !9
  %99 = sext i32 %97 to i64
  %100 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt7complexIdESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %99) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %100, ptr align 8 %96, i64 16, i1 false), !tbaa.struct !13
  br label %101

101:                                              ; preds = %92
  %102 = load i32, ptr %12, align 4, !tbaa !9
  %103 = add nsw i32 %102, 1
  store i32 %103, ptr %12, align 4, !tbaa !9
  br label %28, !llvm.loop !15

104:                                              ; preds = %32
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %105 = load i32, ptr %6, align 4, !tbaa !9
  %106 = sub nsw i32 %105, 2
  store i32 %106, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  %107 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %107, ptr %16, align 4, !tbaa !9
  br label %108

108:                                              ; preds = %177, %104
  %109 = load i32, ptr %15, align 4, !tbaa !9
  %110 = icmp sge i32 %109, 0
  br i1 %110, label %112, label %111

111:                                              ; preds = %108
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %180

112:                                              ; preds = %108
  br label %113

113:                                              ; preds = %161, %112
  %114 = load i32, ptr %7, align 4, !tbaa !9
  %115 = load i32, ptr %16, align 4, !tbaa !9
  %116 = icmp sgt i32 %114, %115
  br i1 %116, label %117, label %159

117:                                              ; preds = %113
  %118 = load i32, ptr %7, align 4, !tbaa !9
  %119 = sub nsw i32 %118, 1
  %120 = sext i32 %119 to i64
  %121 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt7complexIdESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %120) #5
  %122 = load i32, ptr %7, align 4, !tbaa !9
  %123 = sub nsw i32 %122, 2
  %124 = sext i32 %123 to i64
  %125 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt7complexIdESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %124) #5
  %126 = invoke { double, double } @_ZStmiIdESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 8 dereferenceable(16) %121, ptr noundef nonnull align 8 dereferenceable(16) %125)
          to label %127 unwind label %164

127:                                              ; preds = %117
  %128 = getelementptr inbounds %"class.std::complex", ptr %17, i32 0, i32 0
  %129 = getelementptr inbounds { double, double }, ptr %128, i32 0, i32 0
  %130 = extractvalue { double, double } %126, 0
  store double %130, ptr %129, align 8
  %131 = getelementptr inbounds { double, double }, ptr %128, i32 0, i32 1
  %132 = extractvalue { double, double } %126, 1
  store double %132, ptr %131, align 8
  %133 = load ptr, ptr %5, align 8, !tbaa !5
  %134 = load i32, ptr %15, align 4, !tbaa !9
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds %"class.std::complex", ptr %133, i64 %135
  %137 = load i32, ptr %7, align 4, !tbaa !9
  %138 = sub nsw i32 %137, 1
  %139 = sext i32 %138 to i64
  %140 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt7complexIdESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %139) #5
  %141 = invoke { double, double } @_ZStmiIdESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 8 dereferenceable(16) %136, ptr noundef nonnull align 8 dereferenceable(16) %140)
          to label %142 unwind label %164

142:                                              ; preds = %127
  %143 = getelementptr inbounds %"class.std::complex", ptr %18, i32 0, i32 0
  %144 = getelementptr inbounds { double, double }, ptr %143, i32 0, i32 0
  %145 = extractvalue { double, double } %141, 0
  store double %145, ptr %144, align 8
  %146 = getelementptr inbounds { double, double }, ptr %143, i32 0, i32 1
  %147 = extractvalue { double, double } %141, 1
  store double %147, ptr %146, align 8
  %148 = getelementptr inbounds { double, double }, ptr %17, i32 0, i32 0
  %149 = load double, ptr %148, align 8
  %150 = getelementptr inbounds { double, double }, ptr %17, i32 0, i32 1
  %151 = load double, ptr %150, align 8
  %152 = getelementptr inbounds { double, double }, ptr %18, i32 0, i32 0
  %153 = load double, ptr %152, align 8
  %154 = getelementptr inbounds { double, double }, ptr %18, i32 0, i32 1
  %155 = load double, ptr %154, align 8
  %156 = invoke noundef double @_Z3detSt7complexIdES0_(double %149, double %151, double %153, double %155)
          to label %157 unwind label %164

157:                                              ; preds = %142
  %158 = fcmp ole double %156, 0.000000e+00
  br label %159

159:                                              ; preds = %157, %113
  %160 = phi i1 [ false, %113 ], [ %158, %157 ]
  br i1 %160, label %161, label %168

161:                                              ; preds = %159
  %162 = load i32, ptr %7, align 4, !tbaa !9
  %163 = add nsw i32 %162, -1
  store i32 %163, ptr %7, align 4, !tbaa !9
  br label %113, !llvm.loop !16

164:                                              ; preds = %142, %127, %117
  %165 = landingpad { ptr, i32 }
          cleanup
  %166 = extractvalue { ptr, i32 } %165, 0
  store ptr %166, ptr %10, align 8
  %167 = extractvalue { ptr, i32 } %165, 1
  store i32 %167, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %192

168:                                              ; preds = %159
  %169 = load ptr, ptr %5, align 8, !tbaa !5
  %170 = load i32, ptr %15, align 4, !tbaa !9
  %171 = sext i32 %170 to i64
  %172 = getelementptr inbounds %"class.std::complex", ptr %169, i64 %171
  %173 = load i32, ptr %7, align 4, !tbaa !9
  %174 = add nsw i32 %173, 1
  store i32 %174, ptr %7, align 4, !tbaa !9
  %175 = sext i32 %173 to i64
  %176 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt7complexIdESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %175) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %176, ptr align 8 %172, i64 16, i1 false), !tbaa.struct !13
  br label %177

177:                                              ; preds = %168
  %178 = load i32, ptr %15, align 4, !tbaa !9
  %179 = add nsw i32 %178, -1
  store i32 %179, ptr %15, align 4, !tbaa !9
  br label %108, !llvm.loop !17

180:                                              ; preds = %111
  %181 = load i32, ptr %7, align 4, !tbaa !9
  %182 = sub nsw i32 %181, 1
  %183 = sext i32 %182 to i64
  invoke void @_ZNSt6vectorISt7complexIdESaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %183)
          to label %184 unwind label %186

184:                                              ; preds = %180
  store i1 true, ptr %8, align 1
  %185 = load i1, ptr %8, align 1
  br i1 %185, label %191, label %190

186:                                              ; preds = %180
  %187 = landingpad { ptr, i32 }
          cleanup
  %188 = extractvalue { ptr, i32 } %187, 0
  store ptr %188, ptr %10, align 8
  %189 = extractvalue { ptr, i32 } %187, 1
  store i32 %189, ptr %11, align 4
  br label %192

190:                                              ; preds = %184
  call void @_ZNSt6vectorISt7complexIdESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  br label %191

191:                                              ; preds = %190, %184
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  ret void

192:                                              ; preds = %186, %164, %88
  call void @_ZNSt6vectorISt7complexIdESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  br label %193

193:                                              ; preds = %192, %33
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %194

194:                                              ; preds = %193
  %195 = load ptr, ptr %10, align 8
  %196 = load i32, ptr %11, align 4
  %197 = insertvalue { ptr, i32 } poison, ptr %195, 0
  %198 = insertvalue { ptr, i32 } %197, i32 %196, 1
  resume { ptr, i32 } %198
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPSt7complexIdEPFbRKS1_S4_EEvT_S7_T0_(ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSaISt7complexIdEEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorISt7complexIdESaIS1_EEC2EmRKS2_(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { double, double } @_ZStmiIdESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt7complexIdESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #3 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorISt7complexIdESaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorISt7complexIdESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorISt7complexIdEED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 align 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint 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 #3 = { 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{i64 0, i64 16, !14}
!14 = !{!7, !7, i64 0}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}


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

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::complex<double>, std::allocator<std::complex<double>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::complex<double>, std::allocator<std::complex<double>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::complex<double>, std::allocator<std::complex<double>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::complex<double>, std::allocator<std::complex<double>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::allocator" = type { i8 }
%"class.std::complex" = type { { double, double } }

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z5cmp_xRKSt7complexIdES2_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_Z3detSt7complexIdES0_(double, double, double, double) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z11convex_hullPSt7complexIdEi(ptr dead_on_unwind noalias writable sret(%"class.std::vector") align 8 %0, ptr noundef %1, i32 noundef %2) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"class.std::allocator", align 1
  %5 = sext i32 %2 to i64
  %6 = getelementptr inbounds %"class.std::complex", ptr %1, i64 %5
  tail call void @_ZSt4sortIPSt7complexIdEPFbRKS1_S4_EEvT_S7_T0_(ptr noundef %1, ptr noundef %6, ptr noundef nonnull @_Z5cmp_xRKSt7complexIdES2_)
  %7 = shl nsw i32 %2, 1
  %8 = sext i32 %7 to i64
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #6
  call void @_ZNSaISt7complexIdEEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #6
  invoke void @_ZNSt6vectorISt7complexIdESaIS1_EEC2EmRKS2_(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %8, ptr noundef nonnull align 1 dereferenceable(1) %4)
          to label %9 unwind label %16

9:                                                ; preds = %3
  call void @_ZNSt15__new_allocatorISt7complexIdEED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #6
  %10 = icmp sgt i32 %2, 0
  br i1 %10, label %.preheader52.preheader, label %._crit_edge61

.preheader52.preheader:                           ; preds = %9
  %wide.trip.count = zext nneg i32 %2 to i64
  br label %.preheader52

.preheader52:                                     ; preds = %.preheader52.preheader, %.critedge
  %indvars.iv67 = phi i64 [ 0, %.preheader52.preheader ], [ %indvars.iv.next68, %.critedge ]
  %.058 = phi i32 [ 0, %.preheader52.preheader ], [ %40, %.critedge ]
  %11 = getelementptr inbounds %"class.std::complex", ptr %1, i64 %indvars.iv67
  %12 = zext i32 %.058 to i64
  %smin = call i32 @llvm.smin.i32(i32 %.058, i32 1)
  br label %18

._crit_edge:                                      ; preds = %.critedge
  %.not = icmp eq i32 %2, 1
  br i1 %.not, label %._crit_edge61, label %.preheader.preheader

.preheader.preheader:                             ; preds = %._crit_edge
  %13 = add nsw i32 %2, -2
  %14 = sext i32 %40 to i64
  %15 = zext nneg i32 %13 to i64
  br label %.preheader

16:                                               ; preds = %3
  %17 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorISt7complexIdEED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #6
  br label %75

18:                                               ; preds = %.preheader52, %36
  %indvars.iv = phi i64 [ %12, %.preheader52 ], [ %22, %36 ]
  %19 = trunc nuw i64 %indvars.iv to i32
  %20 = icmp sgt i32 %19, 1
  br i1 %20, label %21, label %.critedge

21:                                               ; preds = %18
  %22 = add nsw i64 %indvars.iv, -1
  %23 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt7complexIdESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %22) #6
  %24 = add nsw i64 %indvars.iv, -2
  %25 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt7complexIdESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %24) #6
  %26 = invoke { double, double } @_ZStmiIdESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 8 dereferenceable(16) %23, ptr noundef nonnull align 8 dereferenceable(16) %25)
          to label %27 unwind label %38

27:                                               ; preds = %21
  %28 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt7complexIdESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %22) #6
  %29 = invoke { double, double } @_ZStmiIdESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 8 dereferenceable(16) %11, ptr noundef nonnull align 8 dereferenceable(16) %28)
          to label %30 unwind label %38

30:                                               ; preds = %27
  %31 = extractvalue { double, double } %26, 1
  %32 = extractvalue { double, double } %26, 0
  %33 = extractvalue { double, double } %29, 0
  %34 = extractvalue { double, double } %29, 1
  %35 = invoke noundef double @_Z3detSt7complexIdES0_(double %32, double %31, double %33, double %34)
          to label %36 unwind label %38

36:                                               ; preds = %30
  %37 = fcmp ugt double %35, 0.000000e+00
  br i1 %37, label %.critedge, label %18, !llvm.loop !5

38:                                               ; preds = %30, %27, %21
  %39 = landingpad { ptr, i32 }
          cleanup
  br label %74

.critedge:                                        ; preds = %18, %36
  %.1.lcssa = phi i32 [ %smin, %18 ], [ %19, %36 ]
  %40 = add nsw i32 %.1.lcssa, 1
  %41 = sext i32 %.1.lcssa to i64
  %42 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt7complexIdESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %41) #6
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %42, ptr noundef nonnull align 8 dereferenceable(16) %11, i64 16, i1 false), !tbaa.struct !7
  %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next68, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.preheader52, !llvm.loop !11

.preheader:                                       ; preds = %.preheader.preheader, %.critedge2
  %indvars.iv74 = phi i64 [ %15, %.preheader.preheader ], [ %indvars.iv.next75, %.critedge2 ]
  %.260 = phi i32 [ %40, %.preheader.preheader ], [ %67, %.critedge2 ]
  %43 = getelementptr inbounds %"class.std::complex", ptr %1, i64 %indvars.iv74
  %44 = sext i32 %.260 to i64
  %smin72 = call i32 @llvm.smin.i32(i32 %.260, i32 %40)
  br label %46

._crit_edge61:                                    ; preds = %.critedge2, %9, %._crit_edge
  %.2.lcssa = phi i32 [ %.1.lcssa, %._crit_edge ], [ -1, %9 ], [ %.3.lcssa, %.critedge2 ]
  %45 = sext i32 %.2.lcssa to i64
  invoke void @_ZNSt6vectorISt7complexIdESaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %45)
          to label %73 unwind label %71

46:                                               ; preds = %.preheader, %62
  %indvars.iv70 = phi i64 [ %44, %.preheader ], [ %indvars.iv.next71, %62 ]
  %47 = icmp sgt i64 %indvars.iv70, %14
  br i1 %47, label %48, label %.critedge2

48:                                               ; preds = %46
  %indvars.iv.next71 = add nsw i64 %indvars.iv70, -1
  %49 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt7complexIdESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %indvars.iv.next71) #6
  %50 = add nsw i64 %indvars.iv70, -2
  %51 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt7complexIdESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %50) #6
  %52 = invoke { double, double } @_ZStmiIdESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 8 dereferenceable(16) %49, ptr noundef nonnull align 8 dereferenceable(16) %51)
          to label %53 unwind label %64

53:                                               ; preds = %48
  %54 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt7complexIdESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %indvars.iv.next71) #6
  %55 = invoke { double, double } @_ZStmiIdESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 8 dereferenceable(16) %43, ptr noundef nonnull align 8 dereferenceable(16) %54)
          to label %56 unwind label %64

56:                                               ; preds = %53
  %57 = extractvalue { double, double } %52, 1
  %58 = extractvalue { double, double } %52, 0
  %59 = extractvalue { double, double } %55, 0
  %60 = extractvalue { double, double } %55, 1
  %61 = invoke noundef double @_Z3detSt7complexIdES0_(double %58, double %57, double %59, double %60)
          to label %62 unwind label %64

62:                                               ; preds = %56
  %63 = fcmp ugt double %61, 0.000000e+00
  br i1 %63, label %.critedge2.split.loop.exit79, label %46, !llvm.loop !12

64:                                               ; preds = %56, %53, %48
  %65 = landingpad { ptr, i32 }
          cleanup
  br label %74

.critedge2.split.loop.exit79:                     ; preds = %62
  %66 = trunc nsw i64 %indvars.iv70 to i32
  br label %.critedge2

.critedge2:                                       ; preds = %46, %.critedge2.split.loop.exit79
  %.3.lcssa = phi i32 [ %66, %.critedge2.split.loop.exit79 ], [ %smin72, %46 ]
  %67 = add nsw i32 %.3.lcssa, 1
  %68 = sext i32 %.3.lcssa to i64
  %69 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt7complexIdESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %68) #6
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %69, ptr noundef nonnull align 8 dereferenceable(16) %43, i64 16, i1 false), !tbaa.struct !7
  %indvars.iv.next75 = add nsw i64 %indvars.iv74, -1
  %70 = icmp sgt i64 %indvars.iv74, 0
  br i1 %70, label %.preheader, label %._crit_edge61, !llvm.loop !13

71:                                               ; preds = %._crit_edge61
  %72 = landingpad { ptr, i32 }
          cleanup
  br label %74

73:                                               ; preds = %._crit_edge61
  ret void

74:                                               ; preds = %71, %64, %38
  %.pn = phi { ptr, i32 } [ %39, %38 ], [ %65, %64 ], [ %72, %71 ]
  call void @_ZNSt6vectorISt7complexIdESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #6
  br label %75

75:                                               ; preds = %74, %16
  %.pn.pn = phi { ptr, i32 } [ %.pn, %74 ], [ %17, %16 ]
  resume { ptr, i32 } %.pn.pn
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPSt7complexIdEPFbRKS1_S4_EEvT_S7_T0_(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSaISt7complexIdEEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorISt7complexIdESaIS1_EEC2EmRKS2_(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { double, double } @_ZStmiIdESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt7complexIdESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #3 align 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) #4

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorISt7complexIdESaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorISt7complexIdESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorISt7complexIdEED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 align 2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #5

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint 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 #3 = { 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 #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{i64 0, i64 16, !8}
!8 = !{!9, !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = distinct !{!11, !6}
!12 = distinct !{!12, !6}
!13 = distinct !{!13, !6}


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