; LLVM IR from sfu-dis/mosaicdb :: benchmarks/egen/DateTime.ll (ZN4TPCE9CDateTime5ToStrEi)

; 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.TPCE::CDateTime" = type { i32, i32, ptr }

@_ZZN4TPCE9CDateTime5ToStrEiE13szMonthsShort = external hidden global [12 x ptr], align 16
@_ZZN4TPCE9CDateTime5ToStrEiE12szMonthsFull = external hidden global [12 x ptr], align 16
@_ZZN4TPCE9CDateTime5ToStrEiE6szAmPm = external hidden global [2 x ptr], align 16
@_ZZN4TPCE9CDateTime5ToStrEiE5iHr12 = external hidden constant [24 x i32], align 16
@.str.30 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.42 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.43 = external hidden unnamed_addr constant [13 x i8], align 1

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

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN4TPCE9CDateTime5ToStrEi(ptr noundef nonnull align 8 dereferenceable(16) %0, i32 noundef %1) #1 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i64, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i64, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  %16 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 0, ptr %12, align 4, !tbaa !9
  %17 = getelementptr inbounds %"class.TPCE::CDateTime", ptr %16, i32 0, i32 2
  %18 = load ptr, ptr %17, align 8, !tbaa !11
  %19 = icmp eq ptr %18, null
  br i1 %19, label %20, label %23

20:                                               ; preds = %2
  %21 = call noalias noundef nonnull ptr @_Znam(i64 noundef 40) #6
  %22 = getelementptr inbounds %"class.TPCE::CDateTime", ptr %16, i32 0, i32 2
  store ptr %21, ptr %22, align 8, !tbaa !11
  br label %23

23:                                               ; preds = %20, %2
  %24 = getelementptr inbounds %"class.TPCE::CDateTime", ptr %16, i32 0, i32 2
  %25 = load ptr, ptr %24, align 8, !tbaa !11
  %26 = getelementptr inbounds i8, ptr %25, i64 0
  store i8 0, ptr %26, align 1, !tbaa !13
  call void @_ZN4TPCE9CDateTime9GetYMDHMSEPiS1_S1_S1_S1_S1_S1_(ptr noundef nonnull align 8 dereferenceable(16) %16, ptr noundef %5, ptr noundef %6, ptr noundef %7, ptr noundef %8, ptr noundef %9, ptr noundef %10, ptr noundef %11)
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  store i64 40, ptr %13, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %27 = getelementptr inbounds %"class.TPCE::CDateTime", ptr %16, i32 0, i32 2
  %28 = load ptr, ptr %27, align 8, !tbaa !11
  store ptr %28, ptr %14, align 8, !tbaa !5
  %29 = load i32, ptr %4, align 4, !tbaa !9
  %30 = sdiv i32 %29, 10
  switch i32 %30, label %106 [
    i32 1, label %31
    i32 2, label %38
    i32 3, label %46
    i32 4, label %53
    i32 5, label %64
    i32 6, label %76
    i32 7, label %84
    i32 8, label %95
  ]

31:                                               ; preds = %23
  %32 = load ptr, ptr %14, align 8, !tbaa !5
  %33 = load i64, ptr %13, align 8, !tbaa !14
  %34 = load i32, ptr %5, align 4, !tbaa !9
  %35 = load i32, ptr %6, align 4, !tbaa !9
  %36 = load i32, ptr %7, align 4, !tbaa !9
  %37 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %32, i64 noundef %33, ptr noundef @.str.30, i32 noundef %34, i32 noundef %35, i32 noundef %36) #5
  store i32 %37, ptr %12, align 4, !tbaa !9
  br label %106

38:                                               ; preds = %23
  %39 = load ptr, ptr %14, align 8, !tbaa !5
  %40 = load i64, ptr %13, align 8, !tbaa !14
  %41 = load i32, ptr %6, align 4, !tbaa !9
  %42 = load i32, ptr %7, align 4, !tbaa !9
  %43 = load i32, ptr %5, align 4, !tbaa !9
  %44 = srem i32 %43, 100
  %45 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %39, i64 noundef %40, ptr noundef @.str.31, i32 noundef %41, i32 noundef %42, i32 noundef %44) #5
  store i32 %45, ptr %12, align 4, !tbaa !9
  br label %106

46:                                               ; preds = %23
  %47 = load ptr, ptr %14, align 8, !tbaa !5
  %48 = load i64, ptr %13, align 8, !tbaa !14
  %49 = load i32, ptr %6, align 4, !tbaa !9
  %50 = load i32, ptr %7, align 4, !tbaa !9
  %51 = load i32, ptr %5, align 4, !tbaa !9
  %52 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %47, i64 noundef %48, ptr noundef @.str.32, i32 noundef %49, i32 noundef %50, i32 noundef %51) #5
  store i32 %52, ptr %12, align 4, !tbaa !9
  br label %106

53:                                               ; preds = %23
  %54 = load ptr, ptr %14, align 8, !tbaa !5
  %55 = load i64, ptr %13, align 8, !tbaa !14
  %56 = load i32, ptr %7, align 4, !tbaa !9
  %57 = load i32, ptr %6, align 4, !tbaa !9
  %58 = sub nsw i32 %57, 1
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [12 x ptr], ptr @_ZZN4TPCE9CDateTime5ToStrEiE13szMonthsShort, i64 0, i64 %59
  %61 = load ptr, ptr %60, align 8, !tbaa !5
  %62 = load i32, ptr %5, align 4, !tbaa !9
  %63 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %54, i64 noundef %55, ptr noundef @.str.33, i32 noundef %56, ptr noundef %61, i32 noundef %62) #5
  store i32 %63, ptr %12, align 4, !tbaa !9
  br label %106

64:                                               ; preds = %23
  %65 = load ptr, ptr %14, align 8, !tbaa !5
  %66 = load i64, ptr %13, align 8, !tbaa !14
  %67 = load i32, ptr %7, align 4, !tbaa !9
  %68 = load i32, ptr %6, align 4, !tbaa !9
  %69 = sub nsw i32 %68, 1
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [12 x ptr], ptr @_ZZN4TPCE9CDateTime5ToStrEiE13szMonthsShort, i64 0, i64 %70
  %72 = load ptr, ptr %71, align 8, !tbaa !5
  %73 = load i32, ptr %5, align 4, !tbaa !9
  %74 = srem i32 %73, 100
  %75 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %65, i64 noundef %66, ptr noundef @.str.34, i32 noundef %67, ptr noundef %72, i32 noundef %74) #5
  store i32 %75, ptr %12, align 4, !tbaa !9
  br label %106

76:                                               ; preds = %23
  %77 = load ptr, ptr %14, align 8, !tbaa !5
  %78 = load i64, ptr %13, align 8, !tbaa !14
  %79 = load i32, ptr %6, align 4, !tbaa !9
  %80 = load i32, ptr %7, align 4, !tbaa !9
  %81 = load i32, ptr %5, align 4, !tbaa !9
  %82 = srem i32 %81, 100
  %83 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %77, i64 noundef %78, ptr noundef @.str.35, i32 noundef %79, i32 noundef %80, i32 noundef %82) #5
  store i32 %83, ptr %12, align 4, !tbaa !9
  br label %106

84:                                               ; preds = %23
  %85 = load ptr, ptr %14, align 8, !tbaa !5
  %86 = load i64, ptr %13, align 8, !tbaa !14
  %87 = load i32, ptr %6, align 4, !tbaa !9
  %88 = sub nsw i32 %87, 1
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [12 x ptr], ptr @_ZZN4TPCE9CDateTime5ToStrEiE13szMonthsShort, i64 0, i64 %89
  %91 = load ptr, ptr %90, align 8, !tbaa !5
  %92 = load i32, ptr %7, align 4, !tbaa !9
  %93 = load i32, ptr %5, align 4, !tbaa !9
  %94 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %85, i64 noundef %86, ptr noundef @.str.36, ptr noundef %91, i32 noundef %92, i32 noundef %93) #5
  store i32 %94, ptr %12, align 4, !tbaa !9
  br label %106

95:                                               ; preds = %23
  %96 = load ptr, ptr %14, align 8, !tbaa !5
  %97 = load i64, ptr %13, align 8, !tbaa !14
  %98 = load i32, ptr %6, align 4, !tbaa !9
  %99 = sub nsw i32 %98, 1
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [12 x ptr], ptr @_ZZN4TPCE9CDateTime5ToStrEiE12szMonthsFull, i64 0, i64 %100
  %102 = load ptr, ptr %101, align 8, !tbaa !5
  %103 = load i32, ptr %7, align 4, !tbaa !9
  %104 = load i32, ptr %5, align 4, !tbaa !9
  %105 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %96, i64 noundef %97, ptr noundef @.str.37, ptr noundef %102, i32 noundef %103, i32 noundef %104) #5
  store i32 %105, ptr %12, align 4, !tbaa !9
  br label %106

106:                                              ; preds = %95, %84, %76, %64, %53, %46, %38, %31, %23
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %107 = load i64, ptr %13, align 8, !tbaa !14
  %108 = load i32, ptr %12, align 4, !tbaa !9
  %109 = sext i32 %108 to i64
  %110 = sub i64 %107, %109
  store i64 %110, ptr %15, align 8, !tbaa !14
  %111 = getelementptr inbounds %"class.TPCE::CDateTime", ptr %16, i32 0, i32 2
  %112 = load ptr, ptr %111, align 8, !tbaa !11
  %113 = load i32, ptr %12, align 4, !tbaa !9
  %114 = trunc i32 %113 to i8
  %115 = sext i8 %114 to i32
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds i8, ptr %112, i64 %116
  store ptr %117, ptr %14, align 8, !tbaa !5
  %118 = load i32, ptr %4, align 4, !tbaa !9
  %119 = srem i32 %118, 10
  switch i32 %119, label %198 [
    i32 1, label %120
    i32 2, label %129
    i32 3, label %139
    i32 4, label %147
    i32 5, label %164
    i32 6, label %182
  ]

120:                                              ; preds = %106
  %121 = load ptr, ptr %14, align 8, !tbaa !5
  %122 = load i64, ptr %15, align 8, !tbaa !14
  %123 = load i32, ptr %8, align 4, !tbaa !9
  %124 = load i32, ptr %9, align 4, !tbaa !9
  %125 = load i32, ptr %10, align 4, !tbaa !9
  %126 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %121, i64 noundef %122, ptr noundef @.str.38, i32 noundef %123, i32 noundef %124, i32 noundef %125) #5
  %127 = load i32, ptr %12, align 4, !tbaa !9
  %128 = add nsw i32 %127, %126
  store i32 %128, ptr %12, align 4, !tbaa !9
  br label %198

129:                                              ; preds = %106
  %130 = load ptr, ptr %14, align 8, !tbaa !5
  %131 = load i64, ptr %15, align 8, !tbaa !14
  %132 = load i32, ptr %8, align 4, !tbaa !9
  %133 = load i32, ptr %9, align 4, !tbaa !9
  %134 = load i32, ptr %10, align 4, !tbaa !9
  %135 = load i32, ptr %11, align 4, !tbaa !9
  %136 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %130, i64 noundef %131, ptr noundef @.str.39, i32 noundef %132, i32 noundef %133, i32 noundef %134, i32 noundef %135) #5
  %137 = load i32, ptr %12, align 4, !tbaa !9
  %138 = add nsw i32 %137, %136
  store i32 %138, ptr %12, align 4, !tbaa !9
  br label %198

139:                                              ; preds = %106
  %140 = load ptr, ptr %14, align 8, !tbaa !5
  %141 = load i64, ptr %15, align 8, !tbaa !14
  %142 = load i32, ptr %8, align 4, !tbaa !9
  %143 = load i32, ptr %9, align 4, !tbaa !9
  %144 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %140, i64 noundef %141, ptr noundef @.str.40, i32 noundef %142, i32 noundef %143) #5
  %145 = load i32, ptr %12, align 4, !tbaa !9
  %146 = add nsw i32 %145, %144
  store i32 %146, ptr %12, align 4, !tbaa !9
  br label %198

147:                                              ; preds = %106
  %148 = load ptr, ptr %14, align 8, !tbaa !5
  %149 = load i64, ptr %15, align 8, !tbaa !14
  %150 = load i32, ptr %8, align 4, !tbaa !9
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds [24 x i32], ptr @_ZZN4TPCE9CDateTime5ToStrEiE5iHr12, i64 0, i64 %151
  %153 = load i32, ptr %152, align 4, !tbaa !9
  %154 = load i32, ptr %9, align 4, !tbaa !9
  %155 = load i32, ptr %10, align 4, !tbaa !9
  %156 = load i32, ptr %8, align 4, !tbaa !9
  %157 = sdiv i32 %156, 12
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds [2 x ptr], ptr @_ZZN4TPCE9CDateTime5ToStrEiE6szAmPm, i64 0, i64 %158
  %160 = load ptr, ptr %159, align 8, !tbaa !5
  %161 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %148, i64 noundef %149, ptr noundef @.str.41, i32 noundef %153, i32 noundef %154, i32 noundef %155, ptr noundef %160) #5
  %162 = load i32, ptr %12, align 4, !tbaa !9
  %163 = add nsw i32 %162, %161
  store i32 %163, ptr %12, align 4, !tbaa !9
  br label %198

164:                                              ; preds = %106
  %165 = load ptr, ptr %14, align 8, !tbaa !5
  %166 = load i64, ptr %15, align 8, !tbaa !14
  %167 = load i32, ptr %8, align 4, !tbaa !9
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds [24 x i32], ptr @_ZZN4TPCE9CDateTime5ToStrEiE5iHr12, i64 0, i64 %168
  %170 = load i32, ptr %169, align 4, !tbaa !9
  %171 = load i32, ptr %9, align 4, !tbaa !9
  %172 = load i32, ptr %10, align 4, !tbaa !9
  %173 = load i32, ptr %11, align 4, !tbaa !9
  %174 = load i32, ptr %8, align 4, !tbaa !9
  %175 = sdiv i32 %174, 12
  %176 = sext i32 %175 to i64
  %177 = getelementptr inbounds [2 x ptr], ptr @_ZZN4TPCE9CDateTime5ToStrEiE6szAmPm, i64 0, i64 %176
  %178 = load ptr, ptr %177, align 8, !tbaa !5
  %179 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %165, i64 noundef %166, ptr noundef @.str.42, i32 noundef %170, i32 noundef %171, i32 noundef %172, i32 noundef %173, ptr noundef %178) #5
  %180 = load i32, ptr %12, align 4, !tbaa !9
  %181 = add nsw i32 %180, %179
  store i32 %181, ptr %12, align 4, !tbaa !9
  br label %198

182:                                              ; preds = %106
  %183 = load ptr, ptr %14, align 8, !tbaa !5
  %184 = load i64, ptr %15, align 8, !tbaa !14
  %185 = load i32, ptr %8, align 4, !tbaa !9
  %186 = sext i32 %185 to i64
  %187 = getelementptr inbounds [24 x i32], ptr @_ZZN4TPCE9CDateTime5ToStrEiE5iHr12, i64 0, i64 %186
  %188 = load i32, ptr %187, align 4, !tbaa !9
  %189 = load i32, ptr %9, align 4, !tbaa !9
  %190 = load i32, ptr %8, align 4, !tbaa !9
  %191 = sdiv i32 %190, 12
  %192 = sext i32 %191 to i64
  %193 = getelementptr inbounds [2 x ptr], ptr @_ZZN4TPCE9CDateTime5ToStrEiE6szAmPm, i64 0, i64 %192
  %194 = load ptr, ptr %193, align 8, !tbaa !5
  %195 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %183, i64 noundef %184, ptr noundef @.str.43, i32 noundef %188, i32 noundef %189, ptr noundef %194) #5
  %196 = load i32, ptr %12, align 4, !tbaa !9
  %197 = add nsw i32 %196, %195
  store i32 %197, ptr %12, align 4, !tbaa !9
  br label %198

198:                                              ; preds = %182, %164, %147, %139, %129, %120, %106
  %199 = load i32, ptr %12, align 4, !tbaa !9
  %200 = icmp sgt i32 %199, 0
  br i1 %200, label %201, label %218

201:                                              ; preds = %198
  %202 = getelementptr inbounds %"class.TPCE::CDateTime", ptr %16, i32 0, i32 2
  %203 = load ptr, ptr %202, align 8, !tbaa !11
  %204 = load i32, ptr %12, align 4, !tbaa !9
  %205 = sub nsw i32 %204, 1
  %206 = sext i32 %205 to i64
  %207 = getelementptr inbounds i8, ptr %203, i64 %206
  %208 = load i8, ptr %207, align 1, !tbaa !13
  %209 = sext i8 %208 to i32
  %210 = icmp eq i32 %209, 32
  br i1 %210, label %211, label %218

211:                                              ; preds = %201
  %212 = getelementptr inbounds %"class.TPCE::CDateTime", ptr %16, i32 0, i32 2
  %213 = load ptr, ptr %212, align 8, !tbaa !11
  %214 = load i32, ptr %12, align 4, !tbaa !9
  %215 = sub nsw i32 %214, 1
  %216 = sext i32 %215 to i64
  %217 = getelementptr inbounds i8, ptr %213, i64 %216
  store i8 0, ptr %217, align 1, !tbaa !13
  br label %218

218:                                              ; preds = %211, %201, %198
  %219 = getelementptr inbounds %"class.TPCE::CDateTime", ptr %16, i32 0, i32 2
  %220 = load ptr, ptr %219, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  ret ptr %220
}

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

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

; Function Attrs: nounwind
declare i32 @snprintf(ptr noundef, i64 noundef, ptr noundef, ...) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 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 = { 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 = { nounwind }
attributes #6 = { 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, !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 = !{!12, !6, i64 8}
!12 = !{!"_ZTSN4TPCE9CDateTimeE", !10, i64 0, !10, i64 4, !6, i64 8}
!13 = !{!7, !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"long", !7, 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"

@_ZZN4TPCE9CDateTime5ToStrEiE13szMonthsShort = external hidden local_unnamed_addr global [12 x ptr], align 16
@_ZZN4TPCE9CDateTime5ToStrEiE12szMonthsFull = external hidden local_unnamed_addr global [12 x ptr], align 16
@_ZZN4TPCE9CDateTime5ToStrEiE6szAmPm = external hidden local_unnamed_addr global [2 x ptr], align 16
@_ZZN4TPCE9CDateTime5ToStrEiE5iHr12 = external hidden local_unnamed_addr constant [24 x i32], align 16
@.str.30 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.42 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.43 = external hidden unnamed_addr constant [13 x i8], align 1

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

; Function Attrs: mustprogress 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 noundef ptr @_ZN4TPCE9CDateTime5ToStrEi(ptr noundef nonnull align 8 dereferenceable(16) %0, i32 noundef %1) local_unnamed_addr #1 align 2 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #5
  %10 = getelementptr inbounds i8, ptr %0, i64 8
  %11 = load ptr, ptr %10, align 8, !tbaa !5
  %12 = icmp eq ptr %11, null
  br i1 %12, label %13, label %15

13:                                               ; preds = %2
  %14 = tail call noalias noundef nonnull dereferenceable(40) ptr @_Znam(i64 noundef 40) #6
  store ptr %14, ptr %10, align 8, !tbaa !5
  br label %15

15:                                               ; preds = %13, %2
  %16 = phi ptr [ %14, %13 ], [ %11, %2 ]
  store i8 0, ptr %16, align 1, !tbaa !11
  call void @_ZN4TPCE9CDateTime9GetYMDHMSEPiS1_S1_S1_S1_S1_S1_(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull %3, ptr noundef nonnull %4, ptr noundef nonnull %5, ptr noundef nonnull %6, ptr noundef nonnull %7, ptr noundef nonnull %8, ptr noundef nonnull %9)
  %17 = load ptr, ptr %10, align 8, !tbaa !5
  %18 = sdiv i32 %1, 10
  %19 = srem i32 %1, 10
  switch i32 %18, label %79 [
    i32 1, label %20
    i32 2, label %25
    i32 3, label %31
    i32 4, label %36
    i32 5, label %45
    i32 6, label %55
    i32 7, label %61
    i32 8, label %70
  ]

20:                                               ; preds = %15
  %21 = load i32, ptr %3, align 4, !tbaa !12
  %22 = load i32, ptr %4, align 4, !tbaa !12
  %23 = load i32, ptr %5, align 4, !tbaa !12
  %24 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %17, i64 noundef 40, ptr noundef nonnull @.str.30, i32 noundef %21, i32 noundef %22, i32 noundef %23) #5
  br label %79

25:                                               ; preds = %15
  %26 = load i32, ptr %4, align 4, !tbaa !12
  %27 = load i32, ptr %5, align 4, !tbaa !12
  %28 = load i32, ptr %3, align 4, !tbaa !12
  %29 = srem i32 %28, 100
  %30 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %17, i64 noundef 40, ptr noundef nonnull @.str.31, i32 noundef %26, i32 noundef %27, i32 noundef %29) #5
  br label %79

31:                                               ; preds = %15
  %32 = load i32, ptr %4, align 4, !tbaa !12
  %33 = load i32, ptr %5, align 4, !tbaa !12
  %34 = load i32, ptr %3, align 4, !tbaa !12
  %35 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %17, i64 noundef 40, ptr noundef nonnull @.str.32, i32 noundef %32, i32 noundef %33, i32 noundef %34) #5
  br label %79

36:                                               ; preds = %15
  %37 = load i32, ptr %5, align 4, !tbaa !12
  %38 = load i32, ptr %4, align 4, !tbaa !12
  %39 = add nsw i32 %38, -1
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [12 x ptr], ptr @_ZZN4TPCE9CDateTime5ToStrEiE13szMonthsShort, i64 0, i64 %40
  %42 = load ptr, ptr %41, align 8, !tbaa !13
  %43 = load i32, ptr %3, align 4, !tbaa !12
  %44 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %17, i64 noundef 40, ptr noundef nonnull @.str.33, i32 noundef %37, ptr noundef %42, i32 noundef %43) #5
  br label %79

45:                                               ; preds = %15
  %46 = load i32, ptr %5, align 4, !tbaa !12
  %47 = load i32, ptr %4, align 4, !tbaa !12
  %48 = add nsw i32 %47, -1
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [12 x ptr], ptr @_ZZN4TPCE9CDateTime5ToStrEiE13szMonthsShort, i64 0, i64 %49
  %51 = load ptr, ptr %50, align 8, !tbaa !13
  %52 = load i32, ptr %3, align 4, !tbaa !12
  %53 = srem i32 %52, 100
  %54 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %17, i64 noundef 40, ptr noundef nonnull @.str.34, i32 noundef %46, ptr noundef %51, i32 noundef %53) #5
  br label %79

55:                                               ; preds = %15
  %56 = load i32, ptr %4, align 4, !tbaa !12
  %57 = load i32, ptr %5, align 4, !tbaa !12
  %58 = load i32, ptr %3, align 4, !tbaa !12
  %59 = srem i32 %58, 100
  %60 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %17, i64 noundef 40, ptr noundef nonnull @.str.35, i32 noundef %56, i32 noundef %57, i32 noundef %59) #5
  br label %79

61:                                               ; preds = %15
  %62 = load i32, ptr %4, align 4, !tbaa !12
  %63 = add nsw i32 %62, -1
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [12 x ptr], ptr @_ZZN4TPCE9CDateTime5ToStrEiE13szMonthsShort, i64 0, i64 %64
  %66 = load ptr, ptr %65, align 8, !tbaa !13
  %67 = load i32, ptr %5, align 4, !tbaa !12
  %68 = load i32, ptr %3, align 4, !tbaa !12
  %69 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %17, i64 noundef 40, ptr noundef nonnull @.str.36, ptr noundef %66, i32 noundef %67, i32 noundef %68) #5
  br label %79

70:                                               ; preds = %15
  %71 = load i32, ptr %4, align 4, !tbaa !12
  %72 = add nsw i32 %71, -1
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [12 x ptr], ptr @_ZZN4TPCE9CDateTime5ToStrEiE12szMonthsFull, i64 0, i64 %73
  %75 = load ptr, ptr %74, align 8, !tbaa !13
  %76 = load i32, ptr %5, align 4, !tbaa !12
  %77 = load i32, ptr %3, align 4, !tbaa !12
  %78 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %17, i64 noundef 40, ptr noundef nonnull @.str.37, ptr noundef %75, i32 noundef %76, i32 noundef %77) #5
  br label %79

79:                                               ; preds = %70, %61, %55, %45, %36, %31, %25, %20, %15
  %.0 = phi i32 [ 0, %15 ], [ %78, %70 ], [ %69, %61 ], [ %60, %55 ], [ %54, %45 ], [ %44, %36 ], [ %35, %31 ], [ %30, %25 ], [ %24, %20 ]
  %80 = sext i32 %.0 to i64
  %81 = sub nsw i64 40, %80
  %82 = load ptr, ptr %10, align 8, !tbaa !5
  %sext = shl i32 %.0, 24
  %83 = ashr exact i32 %sext, 24
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds i8, ptr %82, i64 %84
  switch i32 %19, label %143 [
    i32 1, label %86
    i32 2, label %92
    i32 3, label %99
    i32 4, label %104
    i32 5, label %117
    i32 6, label %131
  ]

86:                                               ; preds = %79
  %87 = load i32, ptr %6, align 4, !tbaa !12
  %88 = load i32, ptr %7, align 4, !tbaa !12
  %89 = load i32, ptr %8, align 4, !tbaa !12
  %90 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %85, i64 noundef %81, ptr noundef nonnull @.str.38, i32 noundef %87, i32 noundef %88, i32 noundef %89) #5
  %91 = add nsw i32 %90, %.0
  br label %143

92:                                               ; preds = %79
  %93 = load i32, ptr %6, align 4, !tbaa !12
  %94 = load i32, ptr %7, align 4, !tbaa !12
  %95 = load i32, ptr %8, align 4, !tbaa !12
  %96 = load i32, ptr %9, align 4, !tbaa !12
  %97 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %85, i64 noundef %81, ptr noundef nonnull @.str.39, i32 noundef %93, i32 noundef %94, i32 noundef %95, i32 noundef %96) #5
  %98 = add nsw i32 %97, %.0
  br label %143

99:                                               ; preds = %79
  %100 = load i32, ptr %6, align 4, !tbaa !12
  %101 = load i32, ptr %7, align 4, !tbaa !12
  %102 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %85, i64 noundef %81, ptr noundef nonnull @.str.40, i32 noundef %100, i32 noundef %101) #5
  %103 = add nsw i32 %102, %.0
  br label %143

104:                                              ; preds = %79
  %105 = load i32, ptr %6, align 4, !tbaa !12
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [24 x i32], ptr @_ZZN4TPCE9CDateTime5ToStrEiE5iHr12, i64 0, i64 %106
  %108 = load i32, ptr %107, align 4, !tbaa !12
  %109 = load i32, ptr %7, align 4, !tbaa !12
  %110 = load i32, ptr %8, align 4, !tbaa !12
  %111 = sdiv i32 %105, 12
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [2 x ptr], ptr @_ZZN4TPCE9CDateTime5ToStrEiE6szAmPm, i64 0, i64 %112
  %114 = load ptr, ptr %113, align 8, !tbaa !13
  %115 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %85, i64 noundef %81, ptr noundef nonnull @.str.41, i32 noundef %108, i32 noundef %109, i32 noundef %110, ptr noundef %114) #5
  %116 = add nsw i32 %115, %.0
  br label %143

117:                                              ; preds = %79
  %118 = load i32, ptr %6, align 4, !tbaa !12
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [24 x i32], ptr @_ZZN4TPCE9CDateTime5ToStrEiE5iHr12, i64 0, i64 %119
  %121 = load i32, ptr %120, align 4, !tbaa !12
  %122 = load i32, ptr %7, align 4, !tbaa !12
  %123 = load i32, ptr %8, align 4, !tbaa !12
  %124 = load i32, ptr %9, align 4, !tbaa !12
  %125 = sdiv i32 %118, 12
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [2 x ptr], ptr @_ZZN4TPCE9CDateTime5ToStrEiE6szAmPm, i64 0, i64 %126
  %128 = load ptr, ptr %127, align 8, !tbaa !13
  %129 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %85, i64 noundef %81, ptr noundef nonnull @.str.42, i32 noundef %121, i32 noundef %122, i32 noundef %123, i32 noundef %124, ptr noundef %128) #5
  %130 = add nsw i32 %129, %.0
  br label %143

131:                                              ; preds = %79
  %132 = load i32, ptr %6, align 4, !tbaa !12
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [24 x i32], ptr @_ZZN4TPCE9CDateTime5ToStrEiE5iHr12, i64 0, i64 %133
  %135 = load i32, ptr %134, align 4, !tbaa !12
  %136 = load i32, ptr %7, align 4, !tbaa !12
  %137 = sdiv i32 %132, 12
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [2 x ptr], ptr @_ZZN4TPCE9CDateTime5ToStrEiE6szAmPm, i64 0, i64 %138
  %140 = load ptr, ptr %139, align 8, !tbaa !13
  %141 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %85, i64 noundef %81, ptr noundef nonnull @.str.43, i32 noundef %135, i32 noundef %136, ptr noundef %140) #5
  %142 = add nsw i32 %141, %.0
  br label %143

143:                                              ; preds = %131, %117, %104, %99, %92, %86, %79
  %.1 = phi i32 [ %.0, %79 ], [ %142, %131 ], [ %130, %117 ], [ %116, %104 ], [ %103, %99 ], [ %98, %92 ], [ %91, %86 ]
  %144 = icmp sgt i32 %.1, 0
  %.pre42 = load ptr, ptr %10, align 8, !tbaa !5
  br i1 %144, label %145, label %152

145:                                              ; preds = %143
  %146 = zext nneg i32 %.1 to i64
  %147 = getelementptr i8, ptr %.pre42, i64 %146
  %148 = getelementptr i8, ptr %147, i64 -1
  %149 = load i8, ptr %148, align 1, !tbaa !11
  %150 = icmp eq i8 %149, 32
  br i1 %150, label %151, label %152

151:                                              ; preds = %145
  store i8 0, ptr %148, align 1, !tbaa !11
  %.pre = load ptr, ptr %10, align 8, !tbaa !5
  br label %152

152:                                              ; preds = %151, %145, %143
  %153 = phi ptr [ %.pre, %151 ], [ %.pre42, %145 ], [ %.pre42, %143 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  ret ptr %153
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4TPCE9CDateTime9GetYMDHMSEPiS1_S1_S1_S1_S1_S1_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3 align 2

; Function Attrs: nofree nounwind
declare noundef i32 @snprintf(ptr noalias nocapture noundef writeonly, i64 noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #4

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 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 = { nofree 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 = { nounwind }
attributes #6 = { 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, !10, i64 8}
!6 = !{!"_ZTSN4TPCE9CDateTimeE", !7, i64 0, !7, i64 4, !10, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!8, !8, i64 0}
!12 = !{!7, !7, i64 0}
!13 = !{!10, !10, i64 0}


; Effective O3 passes: DivRemPairsPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,TailCallElimPass