; LLVM IR from penn-graphics-research/HOT :: Lib/Ziran/CS/Util/StackTrace.ll (ZN5ZIRAN10stackTraceB5cxx11Ei)

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

@.str = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZN5ZIRAN16stackTraceStringB5cxx11Ev() #0

; Function Attrs: mustprogress uwtable
define dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZN5ZIRAN10stackTraceB5cxx11Ei(i32 noundef %0) #0 {
  %2 = alloca i32, align 4
  %3 = alloca i64, align 8
  %4 = alloca [50 x ptr], align 16
  %5 = alloca i64, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  store i32 %0, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  store i64 50, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 400, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  %21 = getelementptr inbounds [50 x ptr], ptr %4, i64 0, i64 0
  %22 = call i32 @backtrace(ptr noundef %21, i32 noundef 50)
  %23 = sext i32 %22 to i64
  store i64 %23, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %24 = getelementptr inbounds [50 x ptr], ptr %4, i64 0, i64 0
  %25 = load i64, ptr %5, align 8, !tbaa !9
  %26 = trunc i64 %25 to i32
  %27 = call ptr @backtrace_symbols(ptr noundef %24, i32 noundef %26) #5
  store ptr %27, ptr %6, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %28 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN5ZIRAN16stackTraceStringB5cxx11Ev()
  store ptr %28, ptr %7, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  store i64 %30, ptr %8, align 8, !tbaa !9
  br label %31

31:                                               ; preds = %213, %1
  %32 = load i64, ptr %8, align 8, !tbaa !9
  %33 = load i64, ptr %5, align 8, !tbaa !9
  %34 = icmp ult i64 %32, %33
  br i1 %34, label %35, label %38

35:                                               ; preds = %31
  %36 = load ptr, ptr %6, align 8, !tbaa !11
  %37 = icmp ne ptr %36, null
  br label %38

38:                                               ; preds = %35, %31
  %39 = phi i1 [ false, %31 ], [ %37, %35 ]
  br i1 %39, label %41, label %40

40:                                               ; preds = %38
  store i32 2, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  br label %216

41:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  store ptr null, ptr %10, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  store ptr null, ptr %11, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  store ptr null, ptr %12, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %42 = load ptr, ptr %6, align 8, !tbaa !11
  %43 = load i64, ptr %8, align 8, !tbaa !9
  %44 = getelementptr inbounds ptr, ptr %42, i64 %43
  %45 = load ptr, ptr %44, align 8, !tbaa !11
  store ptr %45, ptr %13, align 8, !tbaa !11
  br label %46

46:                                               ; preds = %75, %41
  %47 = load ptr, ptr %13, align 8, !tbaa !11
  %48 = load i8, ptr %47, align 1, !tbaa !13
  %49 = icmp ne i8 %48, 0
  br i1 %49, label %51, label %50

50:                                               ; preds = %46
  store i32 5, ptr %9, align 4
  br label %78

51:                                               ; preds = %46
  %52 = load ptr, ptr %13, align 8, !tbaa !11
  %53 = load i8, ptr %52, align 1, !tbaa !13
  %54 = sext i8 %53 to i32
  %55 = icmp eq i32 %54, 40
  br i1 %55, label %56, label %58

56:                                               ; preds = %51
  %57 = load ptr, ptr %13, align 8, !tbaa !11
  store ptr %57, ptr %10, align 8, !tbaa !11
  br label %74

58:                                               ; preds = %51
  %59 = load ptr, ptr %13, align 8, !tbaa !11
  %60 = load i8, ptr %59, align 1, !tbaa !13
  %61 = sext i8 %60 to i32
  %62 = icmp eq i32 %61, 43
  br i1 %62, label %63, label %65

63:                                               ; preds = %58
  %64 = load ptr, ptr %13, align 8, !tbaa !11
  store ptr %64, ptr %11, align 8, !tbaa !11
  br label %73

65:                                               ; preds = %58
  %66 = load ptr, ptr %13, align 8, !tbaa !11
  %67 = load i8, ptr %66, align 1, !tbaa !13
  %68 = sext i8 %67 to i32
  %69 = icmp eq i32 %68, 41
  br i1 %69, label %70, label %72

70:                                               ; preds = %65
  %71 = load ptr, ptr %13, align 8, !tbaa !11
  store ptr %71, ptr %12, align 8, !tbaa !11
  store i32 5, ptr %9, align 4
  br label %78

72:                                               ; preds = %65
  br label %73

73:                                               ; preds = %72, %63
  br label %74

74:                                               ; preds = %73, %56
  br label %75

75:                                               ; preds = %74
  %76 = load ptr, ptr %13, align 8, !tbaa !11
  %77 = getelementptr inbounds i8, ptr %76, i32 1
  store ptr %77, ptr %13, align 8, !tbaa !11
  br label %46, !llvm.loop !14

78:                                               ; preds = %70, %50
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %79

79:                                               ; preds = %78
  %80 = load ptr, ptr %10, align 8, !tbaa !11
  %81 = icmp ne ptr %80, null
  br i1 %81, label %82, label %181

82:                                               ; preds = %79
  %83 = load ptr, ptr %11, align 8, !tbaa !11
  %84 = icmp ne ptr %83, null
  br i1 %84, label %85, label %181

85:                                               ; preds = %82
  %86 = load ptr, ptr %12, align 8, !tbaa !11
  %87 = icmp ne ptr %86, null
  br i1 %87, label %88, label %181

88:                                               ; preds = %85
  %89 = load ptr, ptr %10, align 8, !tbaa !11
  %90 = load ptr, ptr %11, align 8, !tbaa !11
  %91 = icmp ult ptr %89, %90
  br i1 %91, label %92, label %181

92:                                               ; preds = %88
  %93 = load ptr, ptr %10, align 8, !tbaa !11
  %94 = getelementptr inbounds i8, ptr %93, i32 1
  store ptr %94, ptr %10, align 8, !tbaa !11
  store i8 0, ptr %93, align 1, !tbaa !13
  %95 = load ptr, ptr %11, align 8, !tbaa !11
  %96 = getelementptr inbounds i8, ptr %95, i32 1
  store ptr %96, ptr %11, align 8, !tbaa !11
  store i8 0, ptr %95, align 1, !tbaa !13
  %97 = load ptr, ptr %12, align 8, !tbaa !11
  %98 = getelementptr inbounds i8, ptr %97, i32 1
  store ptr %98, ptr %12, align 8, !tbaa !11
  store i8 0, ptr %97, align 1, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %99 = load ptr, ptr %10, align 8, !tbaa !11
  %100 = call ptr @__cxa_demangle(ptr noundef %99, ptr noundef null, ptr noundef null, ptr noundef %14)
  store ptr %100, ptr %15, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  %101 = load i64, ptr %8, align 8, !tbaa !9
  %102 = load i32, ptr %2, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = sub i64 %101, %103
  %105 = add i64 %104, 1
  %106 = trunc i64 %105 to i32
  store i32 %106, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  %107 = load i32, ptr %16, align 4, !tbaa !5
  %108 = sdiv i32 %107, 10
  store i32 %108, ptr %17, align 4, !tbaa !5
  %109 = load i32, ptr %17, align 4, !tbaa !5
  %110 = icmp eq i32 %109, 0
  br i1 %110, label %111, label %112

111:                                              ; preds = %92
  br label %115

112:                                              ; preds = %92
  %113 = load i32, ptr %17, align 4, !tbaa !5
  %114 = add nsw i32 48, %113
  br label %115

115:                                              ; preds = %112, %111
  %116 = phi i32 [ 32, %111 ], [ %114, %112 ]
  %117 = trunc i32 %116 to i8
  %118 = load ptr, ptr %7, align 8, !tbaa !11
  %119 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %118, i8 noundef signext %117)
  %120 = load i32, ptr %16, align 4, !tbaa !5
  %121 = srem i32 %120, 10
  %122 = add nsw i32 48, %121
  %123 = trunc i32 %122 to i8
  %124 = load ptr, ptr %7, align 8, !tbaa !11
  %125 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %124, i8 noundef signext %123)
  %126 = load ptr, ptr %7, align 8, !tbaa !11
  %127 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEPKc(ptr noundef nonnull align 8 dereferenceable(32) %126, ptr noundef @.str)
  %128 = load ptr, ptr %6, align 8, !tbaa !11
  %129 = load i64, ptr %8, align 8, !tbaa !9
  %130 = getelementptr inbounds ptr, ptr %128, i64 %129
  %131 = load ptr, ptr %130, align 8, !tbaa !11
  %132 = load ptr, ptr %7, align 8, !tbaa !11
  %133 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEPKc(ptr noundef nonnull align 8 dereferenceable(32) %132, ptr noundef %131)
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  %134 = load ptr, ptr %6, align 8, !tbaa !11
  %135 = load i64, ptr %8, align 8, !tbaa !9
  %136 = getelementptr inbounds ptr, ptr %134, i64 %135
  %137 = load ptr, ptr %136, align 8, !tbaa !11
  %138 = call i64 @strlen(ptr noundef %137) #6
  %139 = sub i64 34, %138
  %140 = trunc i64 %139 to i32
  store i32 %140, ptr %18, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #5
  store i32 0, ptr %19, align 4, !tbaa !5
  br label %141

141:                                              ; preds = %149, %115
  %142 = load i32, ptr %19, align 4, !tbaa !5
  %143 = load i32, ptr %18, align 4, !tbaa !5
  %144 = icmp slt i32 %142, %143
  br i1 %144, label %146, label %145

145:                                              ; preds = %141
  store i32 8, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  br label %152

146:                                              ; preds = %141
  %147 = load ptr, ptr %7, align 8, !tbaa !11
  %148 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %147, i8 noundef signext 32)
  br label %149

149:                                              ; preds = %146
  %150 = load i32, ptr %19, align 4, !tbaa !5
  %151 = add nsw i32 %150, 1
  store i32 %151, ptr %19, align 4, !tbaa !5
  br label %141, !llvm.loop !16

152:                                              ; preds = %145
  %153 = load i32, ptr %14, align 4, !tbaa !5
  %154 = icmp eq i32 %153, 0
  br i1 %154, label %155, label %163

155:                                              ; preds = %152
  %156 = load ptr, ptr %7, align 8, !tbaa !11
  %157 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEPKc(ptr noundef nonnull align 8 dereferenceable(32) %156, ptr noundef @.str)
  %158 = load ptr, ptr %15, align 8, !tbaa !11
  %159 = load ptr, ptr %7, align 8, !tbaa !11
  %160 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEPKc(ptr noundef nonnull align 8 dereferenceable(32) %159, ptr noundef %158)
  %161 = load ptr, ptr %7, align 8, !tbaa !11
  %162 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %161, i8 noundef signext 43)
  br label %171

163:                                              ; preds = %152
  %164 = load ptr, ptr %7, align 8, !tbaa !11
  %165 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEPKc(ptr noundef nonnull align 8 dereferenceable(32) %164, ptr noundef @.str)
  %166 = load ptr, ptr %10, align 8, !tbaa !11
  %167 = load ptr, ptr %7, align 8, !tbaa !11
  %168 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEPKc(ptr noundef nonnull align 8 dereferenceable(32) %167, ptr noundef %166)
  %169 = load ptr, ptr %7, align 8, !tbaa !11
  %170 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %169, i8 noundef signext 43)
  br label %171

171:                                              ; preds = %163, %155
  %172 = load ptr, ptr %11, align 8, !tbaa !11
  %173 = load ptr, ptr %7, align 8, !tbaa !11
  %174 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEPKc(ptr noundef nonnull align 8 dereferenceable(32) %173, ptr noundef %172)
  %175 = load ptr, ptr %12, align 8, !tbaa !11
  %176 = load ptr, ptr %7, align 8, !tbaa !11
  %177 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEPKc(ptr noundef nonnull align 8 dereferenceable(32) %176, ptr noundef %175)
  %178 = load ptr, ptr %7, align 8, !tbaa !11
  %179 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %178, i8 noundef signext 10)
  %180 = load ptr, ptr %15, align 8, !tbaa !11
  call void @free(ptr noundef %180) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %212

181:                                              ; preds = %88, %85, %82, %79
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #5
  %182 = load i64, ptr %8, align 8, !tbaa !9
  %183 = udiv i64 %182, 10
  %184 = trunc i64 %183 to i32
  store i32 %184, ptr %20, align 4, !tbaa !5
  %185 = load i32, ptr %20, align 4, !tbaa !5
  %186 = icmp eq i32 %185, 0
  br i1 %186, label %187, label %188

187:                                              ; preds = %181
  br label %191

188:                                              ; preds = %181
  %189 = load i32, ptr %20, align 4, !tbaa !5
  %190 = add nsw i32 48, %189
  br label %191

191:                                              ; preds = %188, %187
  %192 = phi i32 [ 32, %187 ], [ %190, %188 ]
  %193 = trunc i32 %192 to i8
  %194 = load ptr, ptr %7, align 8, !tbaa !11
  %195 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %194, i8 noundef signext %193)
  %196 = load i64, ptr %8, align 8, !tbaa !9
  %197 = urem i64 %196, 10
  %198 = add i64 48, %197
  %199 = trunc i64 %198 to i8
  %200 = load ptr, ptr %7, align 8, !tbaa !11
  %201 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %200, i8 noundef signext %199)
  %202 = load ptr, ptr %7, align 8, !tbaa !11
  %203 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEPKc(ptr noundef nonnull align 8 dereferenceable(32) %202, ptr noundef @.str)
  %204 = load ptr, ptr %6, align 8, !tbaa !11
  %205 = load i64, ptr %8, align 8, !tbaa !9
  %206 = getelementptr inbounds ptr, ptr %204, i64 %205
  %207 = load ptr, ptr %206, align 8, !tbaa !11
  %208 = load ptr, ptr %7, align 8, !tbaa !11
  %209 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEPKc(ptr noundef nonnull align 8 dereferenceable(32) %208, ptr noundef %207)
  %210 = load ptr, ptr %7, align 8, !tbaa !11
  %211 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %210, i8 noundef signext 10)
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #5
  br label %212

212:                                              ; preds = %191, %171
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %213

213:                                              ; preds = %212
  %214 = load i64, ptr %8, align 8, !tbaa !9
  %215 = add i64 %214, 1
  store i64 %215, ptr %8, align 8, !tbaa !9
  br label %31, !llvm.loop !17

216:                                              ; preds = %40
  %217 = load ptr, ptr %6, align 8, !tbaa !11
  call void @free(ptr noundef %217) #5
  %218 = load ptr, ptr %7, align 8, !tbaa !11
  store i32 1, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 400, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  ret ptr %218
}

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

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

; Function Attrs: nounwind
declare ptr @backtrace_symbols(ptr noundef, i32 noundef) #3

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32), i8 noundef signext) #0 align 2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEPKc(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) #0 align 2

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #4

; Function Attrs: nounwind
declare void @free(ptr noundef) #3

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 = { "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 "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 = { nounwind willreturn memory(read) "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 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = distinct !{!17, !15}


; 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 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZN5ZIRAN16stackTraceStringB5cxx11Ev() local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZN5ZIRAN10stackTraceB5cxx11Ei(i32 noundef %0) local_unnamed_addr #0 {
  %2 = alloca [50 x ptr], align 16
  %3 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %2) #6
  %4 = call i32 @backtrace(ptr noundef nonnull %2, i32 noundef 50)
  %5 = sext i32 %4 to i64
  %6 = call ptr @backtrace_symbols(ptr noundef nonnull %2, i32 noundef %4) #6
  %7 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN5ZIRAN16stackTraceStringB5cxx11Ev()
  %8 = icmp ne ptr %6, null
  %9 = icmp ugt i32 %4, %0
  %10 = select i1 %9, i1 %8, i1 false
  br i1 %10, label %.lr.ph90.preheader, label %._crit_edge91

.lr.ph90.preheader:                               ; preds = %1
  %11 = sext i32 %0 to i64
  br label %.lr.ph90

._crit_edge91:                                    ; preds = %79, %1
  call void @free(ptr noundef %6) #6
  call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %2) #6
  ret ptr %7

.lr.ph90:                                         ; preds = %.lr.ph90.preheader, %79
  %.088 = phi i64 [ %80, %79 ], [ %11, %.lr.ph90.preheader ]
  %12 = getelementptr inbounds ptr, ptr %6, i64 %.088
  %13 = load ptr, ptr %12, align 8, !tbaa !5
  br label %14

14:                                               ; preds = %17, %.lr.ph90
  %.077 = phi ptr [ %13, %.lr.ph90 ], [ %18, %17 ]
  %.074 = phi ptr [ null, %.lr.ph90 ], [ %.175, %17 ]
  %.073 = phi ptr [ null, %.lr.ph90 ], [ %.1, %17 ]
  %15 = load i8, ptr %.077, align 1, !tbaa !9
  switch i8 %15, label %.fold.split [
    i8 0, label %.loopexit.loopexit
    i8 40, label %17
    i8 43, label %16
    i8 41, label %.loopexit
  ]

16:                                               ; preds = %14
  br label %17

.fold.split:                                      ; preds = %14
  br label %17

17:                                               ; preds = %14, %.fold.split, %16
  %.175 = phi ptr [ %.077, %16 ], [ %.074, %14 ], [ %.074, %.fold.split ]
  %.1 = phi ptr [ %.073, %16 ], [ %.077, %14 ], [ %.073, %.fold.split ]
  %18 = getelementptr inbounds i8, ptr %.077, i64 1
  br label %14, !llvm.loop !10

.loopexit.loopexit:                               ; preds = %14
  br label %.loopexit

.loopexit:                                        ; preds = %14, %.loopexit.loopexit
  %.076 = phi ptr [ null, %.loopexit.loopexit ], [ %.077, %14 ]
  %19 = icmp ne ptr %.073, null
  %20 = icmp ne ptr %.074, null
  %or.cond = select i1 %19, i1 %20, i1 false
  %21 = icmp ne ptr %.076, null
  %or.cond3 = and i1 %or.cond, %21
  %22 = icmp ult ptr %.073, %.074
  %or.cond81 = select i1 %or.cond3, i1 %22, i1 false
  br i1 %or.cond81, label %23, label %63

23:                                               ; preds = %.loopexit
  %24 = getelementptr inbounds i8, ptr %.073, i64 1
  store i8 0, ptr %.073, align 1, !tbaa !9
  %25 = getelementptr inbounds i8, ptr %.074, i64 1
  store i8 0, ptr %.074, align 1, !tbaa !9
  %26 = getelementptr inbounds i8, ptr %.076, i64 1
  store i8 0, ptr %.076, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %27 = call ptr @__cxa_demangle(ptr noundef nonnull %24, ptr noundef null, ptr noundef null, ptr noundef nonnull %3)
  %28 = trunc i64 %.088 to i32
  %29 = sub i32 %28, %0
  %30 = add i32 %29, 1
  %31 = sdiv i32 %30, 10
  %.off = add i32 %29, 10
  %32 = icmp ult i32 %.off, 19
  %33 = trunc i32 %31 to i8
  %34 = add i8 %33, 48
  %35 = select i1 %32, i8 32, i8 %34
  %36 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %7, i8 noundef signext %35)
  %37 = srem i32 %30, 10
  %38 = trunc nsw i32 %37 to i8
  %39 = add nsw i8 %38, 48
  %40 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %7, i8 noundef signext %39)
  %41 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEPKc(ptr noundef nonnull align 8 dereferenceable(32) %7, ptr noundef nonnull @.str)
  %42 = load ptr, ptr %12, align 8, !tbaa !5
  %43 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEPKc(ptr noundef nonnull align 8 dereferenceable(32) %7, ptr noundef %42)
  %44 = load ptr, ptr %12, align 8, !tbaa !5
  %45 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %44) #7
  %46 = trunc i64 %45 to i32
  %47 = sub i32 34, %46
  %48 = icmp sgt i32 %47, 0
  br i1 %48, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %23
  %49 = load i32, ptr %3, align 4, !tbaa !12
  %50 = icmp eq i32 %49, 0
  %51 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEPKc(ptr noundef nonnull align 8 dereferenceable(32) %7, ptr noundef nonnull @.str)
  br i1 %50, label %54, label %56

.lr.ph:                                           ; preds = %23, %.lr.ph
  %.07287 = phi i32 [ %53, %.lr.ph ], [ 0, %23 ]
  %52 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %7, i8 noundef signext 32)
  %53 = add nuw nsw i32 %.07287, 1
  %exitcond.not = icmp eq i32 %53, %47
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !14

54:                                               ; preds = %._crit_edge
  %55 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEPKc(ptr noundef nonnull align 8 dereferenceable(32) %7, ptr noundef %27)
  br label %58

56:                                               ; preds = %._crit_edge
  %57 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEPKc(ptr noundef nonnull align 8 dereferenceable(32) %7, ptr noundef nonnull %24)
  br label %58

58:                                               ; preds = %56, %54
  %59 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %7, i8 noundef signext 43)
  %60 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEPKc(ptr noundef nonnull align 8 dereferenceable(32) %7, ptr noundef nonnull %25)
  %61 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEPKc(ptr noundef nonnull align 8 dereferenceable(32) %7, ptr noundef nonnull %26)
  %62 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %7, i8 noundef signext 10)
  call void @free(ptr noundef %27) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  br label %79

63:                                               ; preds = %.loopexit
  %64 = udiv i64 %.088, 10
  %65 = and i64 %64, 4294967295
  %66 = icmp eq i64 %65, 0
  %67 = trunc i64 %64 to i8
  %68 = add i8 %67, 48
  %69 = select i1 %66, i8 32, i8 %68
  %70 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %7, i8 noundef signext %69)
  %71 = urem i64 %.088, 10
  %72 = trunc nuw nsw i64 %71 to i8
  %73 = or disjoint i8 %72, 48
  %74 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %7, i8 noundef signext %73)
  %75 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEPKc(ptr noundef nonnull align 8 dereferenceable(32) %7, ptr noundef nonnull @.str)
  %76 = load ptr, ptr %12, align 8, !tbaa !5
  %77 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEPKc(ptr noundef nonnull align 8 dereferenceable(32) %7, ptr noundef %76)
  %78 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %7, i8 noundef signext 10)
  br label %79

79:                                               ; preds = %63, %58
  %80 = add i64 %.088, 1
  %81 = icmp ult i64 %80, %5
  br i1 %81, label %.lr.ph90, label %._crit_edge91, !llvm.loop !15
}

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

declare i32 @backtrace(ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind
declare ptr @backtrace_symbols(ptr noundef, i32 noundef) local_unnamed_addr #3

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

declare ptr @__cxa_demangle(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32), i8 noundef signext) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEPKc(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #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 = { "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 "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 nofree nounwind willreturn memory(argmem: read) "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 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }

!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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = distinct !{!14, !11}
!15 = distinct !{!15, !11}


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