; LLVM IR from NVIDIA/FasterTransformer :: src/fastertransformer/models/vit (vit_gemm)

; 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::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@.str = external hidden unnamed_addr constant [107 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [62 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [62 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.13 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [103 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [107 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [24 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %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 i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca ptr, align 8
  %20 = alloca i64, align 8
  %21 = alloca i64, align 8
  %22 = alloca i64, align 8
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  %23 = load i32, ptr %4, align 4, !tbaa !5
  %24 = icmp ne i32 %23, 9
  br i1 %24, label %25, label %28

25:                                               ; preds = %2
  %26 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  %27 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  store i32 0, ptr %3, align 4
  br label %189

28:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  %29 = load ptr, ptr %5, align 8, !tbaa !9
  %30 = getelementptr inbounds ptr, ptr %29, i64 1
  %31 = load ptr, ptr %30, align 8, !tbaa !9
  %32 = call i32 @atoi(ptr noundef %31) #7
  store i32 %32, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %33 = load ptr, ptr %5, align 8, !tbaa !9
  %34 = getelementptr inbounds ptr, ptr %33, i64 2
  %35 = load ptr, ptr %34, align 8, !tbaa !9
  %36 = call i32 @atoi(ptr noundef %35) #7
  store i32 %36, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %37 = load ptr, ptr %5, align 8, !tbaa !9
  %38 = getelementptr inbounds ptr, ptr %37, i64 3
  %39 = load ptr, ptr %38, align 8, !tbaa !9
  %40 = call i32 @atoi(ptr noundef %39) #7
  store i32 %40, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %41 = load ptr, ptr %5, align 8, !tbaa !9
  %42 = getelementptr inbounds ptr, ptr %41, i64 4
  %43 = load ptr, ptr %42, align 8, !tbaa !9
  %44 = call i32 @atoi(ptr noundef %43) #7
  store i32 %44, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %45 = load ptr, ptr %5, align 8, !tbaa !9
  %46 = getelementptr inbounds ptr, ptr %45, i64 5
  %47 = load ptr, ptr %46, align 8, !tbaa !9
  %48 = call i32 @atoi(ptr noundef %47) #7
  store i32 %48, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %49 = load ptr, ptr %5, align 8, !tbaa !9
  %50 = getelementptr inbounds ptr, ptr %49, i64 6
  %51 = load ptr, ptr %50, align 8, !tbaa !9
  %52 = call i32 @atoi(ptr noundef %51) #7
  store i32 %52, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  %53 = load ptr, ptr %5, align 8, !tbaa !9
  %54 = getelementptr inbounds ptr, ptr %53, i64 7
  %55 = load ptr, ptr %54, align 8, !tbaa !9
  %56 = call i32 @atoi(ptr noundef %55) #7
  store i32 %56, ptr %12, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  %57 = load ptr, ptr %5, align 8, !tbaa !9
  %58 = getelementptr inbounds ptr, ptr %57, i64 8
  %59 = load ptr, ptr %58, align 8, !tbaa !9
  %60 = call i32 @atoi(ptr noundef %59) #7
  store i32 %60, ptr %13, align 4, !tbaa !5
  %61 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  %62 = load i32, ptr %6, align 4, !tbaa !5
  %63 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %62)
  %64 = load i32, ptr %7, align 4, !tbaa !5
  %65 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %64)
  %66 = load i32, ptr %8, align 4, !tbaa !5
  %67 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef %66)
  %68 = load i32, ptr %9, align 4, !tbaa !5
  %69 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, i32 noundef %68)
  %70 = load i32, ptr %10, align 4, !tbaa !5
  %71 = call i32 (ptr, ...) @printf(ptr noundef @.str.7, i32 noundef %70)
  %72 = load i32, ptr %11, align 4, !tbaa !5
  %73 = call i32 (ptr, ...) @printf(ptr noundef @.str.8, i32 noundef %72)
  %74 = load i32, ptr %12, align 4, !tbaa !11
  %75 = call i32 (ptr, ...) @printf(ptr noundef @.str.9, i32 noundef %74)
  %76 = load i32, ptr %13, align 4, !tbaa !5
  %77 = call i32 (ptr, ...) @printf(ptr noundef @.str.10, i32 noundef %76)
  %78 = load i32, ptr %7, align 4, !tbaa !5
  %79 = load i32, ptr %8, align 4, !tbaa !5
  %80 = srem i32 %78, %79
  %81 = icmp ne i32 %80, 0
  br i1 %81, label %82, label %86

82:                                               ; preds = %28
  %83 = load i32, ptr %7, align 4, !tbaa !5
  %84 = load i32, ptr %8, align 4, !tbaa !5
  %85 = call i32 (ptr, ...) @printf(ptr noundef @.str.11, i32 noundef %83, i32 noundef %84)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %188

86:                                               ; preds = %28
  %87 = load i32, ptr %9, align 4, !tbaa !5
  %88 = load i32, ptr %10, align 4, !tbaa !5
  %89 = srem i32 %87, %88
  %90 = icmp ne i32 %89, 0
  br i1 %90, label %91, label %95

91:                                               ; preds = %86
  %92 = load i32, ptr %9, align 4, !tbaa !5
  %93 = load i32, ptr %10, align 4, !tbaa !5
  %94 = call i32 (ptr, ...) @printf(ptr noundef @.str.12, i32 noundef %92, i32 noundef %93)
  br label %95

95:                                               ; preds = %91, %86
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  %96 = load i32, ptr %7, align 4, !tbaa !5
  %97 = load i32, ptr %8, align 4, !tbaa !5
  %98 = sdiv i32 %96, %97
  store i32 %98, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  %99 = load i32, ptr %15, align 4, !tbaa !5
  %100 = load i32, ptr %15, align 4, !tbaa !5
  %101 = mul nsw i32 %99, %100
  %102 = load i32, ptr %11, align 4, !tbaa !5
  %103 = icmp ne i32 %102, 0
  %104 = zext i1 %103 to i64
  %105 = select i1 %103, i32 1, i32 0
  %106 = add nsw i32 %101, %105
  store i32 %106, ptr %16, align 4, !tbaa !5
  %107 = load ptr, ptr %5, align 8, !tbaa !9
  %108 = getelementptr inbounds ptr, ptr %107, i64 7
  %109 = load ptr, ptr %108, align 8, !tbaa !9
  %110 = call i32 @atoi(ptr noundef %109) #7
  %111 = icmp eq i32 %110, 1
  br i1 %111, label %112, label %124

112:                                              ; preds = %95
  %113 = load i32, ptr %16, align 4, !tbaa !5
  %114 = icmp sgt i32 %113, 384
  br i1 %114, label %115, label %124

115:                                              ; preds = %112
  %116 = load i32, ptr %16, align 4, !tbaa !5
  %117 = srem i32 %116, 8
  %118 = icmp ne i32 %117, 0
  br i1 %118, label %119, label %124

119:                                              ; preds = %115
  %120 = load i32, ptr %16, align 4, !tbaa !5
  %121 = add nsw i32 %120, 7
  %122 = sdiv i32 %121, 8
  %123 = mul nsw i32 %122, 8
  store i32 %123, ptr %16, align 4, !tbaa !5
  br label %124

124:                                              ; preds = %119, %115, %112, %95
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  %125 = load i32, ptr %9, align 4, !tbaa !5
  %126 = load i32, ptr %10, align 4, !tbaa !5
  %127 = sdiv i32 %125, %126
  store i32 %127, ptr %17, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  %128 = load i32, ptr %10, align 4, !tbaa !5
  %129 = mul nsw i32 4, %128
  %130 = load i32, ptr %17, align 4, !tbaa !5
  %131 = mul nsw i32 %129, %130
  store i32 %131, ptr %18, align 4, !tbaa !5
  %132 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #6
  %133 = load i32, ptr %6, align 4, !tbaa !5
  %134 = load i32, ptr %16, align 4, !tbaa !5
  %135 = load i32, ptr %10, align 4, !tbaa !5
  %136 = load i32, ptr %17, align 4, !tbaa !5
  %137 = load i32, ptr %18, align 4, !tbaa !5
  %138 = load i32, ptr %13, align 4, !tbaa !5
  %139 = load i32, ptr %12, align 4, !tbaa !11
  %140 = call noundef i64 @_ZN17fastertransformer24calGemmTestBufSizeInByteEiiiiiiiNS_14CublasDataTypeE(i32 noundef %133, i32 noundef %134, i32 noundef %135, i32 noundef %136, i32 noundef %137, i32 noundef 0, i32 noundef %138, i32 noundef %139)
  store i64 %140, ptr %20, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #6
  %141 = call i32 @cudaMemGetInfo(ptr noundef %22, ptr noundef %21)
  call void @_ZN17fastertransformer5checkI9cudaErrorEEvT_PKcS4_i(i32 noundef %141, ptr noundef @.str.13, ptr noundef @.str.14, i32 noundef 75)
  %142 = load i64, ptr %22, align 8, !tbaa !13
  %143 = load i64, ptr %20, align 8, !tbaa !13
  %144 = add i64 %143, 10485760
  %145 = icmp ult i64 %142, %144
  br i1 %145, label %146, label %150

146:                                              ; preds = %124
  %147 = load i64, ptr %20, align 8, !tbaa !13
  %148 = load i64, ptr %22, align 8, !tbaa !13
  %149 = call i32 (ptr, ...) @printf(ptr noundef @.str.15, i64 noundef %147, i64 noundef %148)
  store ptr null, ptr %19, align 8, !tbaa !9
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %187

150:                                              ; preds = %124
  %151 = load i64, ptr %20, align 8, !tbaa !13
  call void @_ZN17fastertransformer12deviceMallocIcEEvPPT_mb(ptr noundef %19, i64 noundef %151, i1 noundef zeroext false)
  br label %152

152:                                              ; preds = %150
  %153 = load i32, ptr %13, align 4, !tbaa !5
  %154 = icmp ne i32 %153, 0
  br i1 %154, label %155, label %162

155:                                              ; preds = %152
  %156 = load i32, ptr %6, align 4, !tbaa !5
  %157 = load i32, ptr %16, align 4, !tbaa !5
  %158 = load i32, ptr %10, align 4, !tbaa !5
  %159 = load i32, ptr %17, align 4, !tbaa !5
  %160 = load ptr, ptr %19, align 8, !tbaa !9
  %161 = call noundef i32 @_ZN17fastertransformer29generate_encoder_igemm_configEiiiiPvb(i32 noundef %156, i32 noundef %157, i32 noundef %158, i32 noundef %159, ptr noundef %160, i1 noundef zeroext false)
  br label %184

162:                                              ; preds = %152
  %163 = load i32, ptr %12, align 4, !tbaa !11
  %164 = icmp eq i32 %163, 0
  br i1 %164, label %165, label %171

165:                                              ; preds = %162
  %166 = load i32, ptr %6, align 4, !tbaa !5
  %167 = load i32, ptr %16, align 4, !tbaa !5
  %168 = load i32, ptr %10, align 4, !tbaa !5
  %169 = load i32, ptr %17, align 4, !tbaa !5
  %170 = load ptr, ptr %19, align 8, !tbaa !9
  call void @_ZN17fastertransformer28generate_encoder_gemm_configIfEEviiiiPvbi(i32 noundef %166, i32 noundef %167, i32 noundef %168, i32 noundef %169, ptr noundef %170, i1 noundef zeroext false, i32 noundef 1)
  br label %183

171:                                              ; preds = %162
  %172 = load i32, ptr %12, align 4, !tbaa !11
  %173 = icmp eq i32 %172, 1
  br i1 %173, label %174, label %180

174:                                              ; preds = %171
  %175 = load i32, ptr %6, align 4, !tbaa !5
  %176 = load i32, ptr %16, align 4, !tbaa !5
  %177 = load i32, ptr %10, align 4, !tbaa !5
  %178 = load i32, ptr %17, align 4, !tbaa !5
  %179 = load ptr, ptr %19, align 8, !tbaa !9
  call void @_ZN17fastertransformer28generate_encoder_gemm_configI6__halfEEviiiiPvbi(i32 noundef %175, i32 noundef %176, i32 noundef %177, i32 noundef %178, ptr noundef %179, i1 noundef zeroext false, i32 noundef 1)
  br label %182

180:                                              ; preds = %171
  %181 = call i32 (ptr, ...) @printf(ptr noundef @.str.16)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %187

182:                                              ; preds = %174
  br label %183

183:                                              ; preds = %182, %165
  br label %184

184:                                              ; preds = %183, %155
  %185 = load ptr, ptr %19, align 8, !tbaa !9
  %186 = call i32 @cudaFree(ptr noundef %185)
  call void @_ZN17fastertransformer5checkI9cudaErrorEEvT_PKcS4_i(i32 noundef %186, ptr noundef @.str.17, ptr noundef @.str.14, i32 noundef 102)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %187

187:                                              ; preds = %184, %180, %146
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  br label %188

188:                                              ; preds = %187, %82
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %189

189:                                              ; preds = %188, %25
  %190 = load i32, ptr %3, align 4
  ret i32 %190
}

declare i32 @printf(ptr noundef, ...) #1

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

; Function Attrs: inlinehint mustprogress nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr noundef nonnull) #3

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #5

declare noundef i64 @_ZN17fastertransformer24calGemmTestBufSizeInByteEiiiiiiiNS_14CublasDataTypeE(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN17fastertransformer5checkI9cudaErrorEEvT_PKcS4_i(i32 noundef, ptr noundef, ptr noundef, i32 noundef) #4

declare i32 @cudaMemGetInfo(ptr noundef, ptr noundef) #1

declare void @_ZN17fastertransformer12deviceMallocIcEEvPPT_mb(ptr noundef, i64 noundef, i1 noundef zeroext) #1

declare noundef i32 @_ZN17fastertransformer29generate_encoder_igemm_configEiiiiPvb(i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef, i1 noundef zeroext) #1

declare void @_ZN17fastertransformer28generate_encoder_gemm_configIfEEviiiiPvbi(i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef, i1 noundef zeroext, i32 noundef) #1

declare void @_ZN17fastertransformer28generate_encoder_gemm_configI6__halfEEviiiiPvbi(i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef, i1 noundef zeroext, i32 noundef) #1

declare i32 @cudaFree(ptr noundef) #1

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

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint mustprogress nounwind willreturn memory(read) 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 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 #5 = { 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 #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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"_ZTSN17fastertransformer14CublasDataTypeE", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"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"

%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@.str = external hidden unnamed_addr constant [107 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [62 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [62 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.13 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [103 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [107 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [24 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef range(i32 -1, 1) i32 @main(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %.not = icmp eq i32 %0, 9
  br i1 %.not, label %9, label %6

6:                                                ; preds = %2
  %7 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %8 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  br label %89

9:                                                ; preds = %2
  %10 = getelementptr inbounds i8, ptr %1, i64 8
  %11 = load ptr, ptr %10, align 8, !tbaa !5
  %12 = tail call i32 @atoi(ptr nocapture noundef %11) #7
  %13 = getelementptr inbounds i8, ptr %1, i64 16
  %14 = load ptr, ptr %13, align 8, !tbaa !5
  %15 = tail call i32 @atoi(ptr nocapture noundef %14) #7
  %16 = getelementptr inbounds i8, ptr %1, i64 24
  %17 = load ptr, ptr %16, align 8, !tbaa !5
  %18 = tail call i32 @atoi(ptr nocapture noundef %17) #7
  %19 = getelementptr inbounds i8, ptr %1, i64 32
  %20 = load ptr, ptr %19, align 8, !tbaa !5
  %21 = tail call i32 @atoi(ptr nocapture noundef %20) #7
  %22 = getelementptr inbounds i8, ptr %1, i64 40
  %23 = load ptr, ptr %22, align 8, !tbaa !5
  %24 = tail call i32 @atoi(ptr nocapture noundef %23) #7
  %25 = getelementptr inbounds i8, ptr %1, i64 48
  %26 = load ptr, ptr %25, align 8, !tbaa !5
  %27 = tail call i32 @atoi(ptr nocapture noundef %26) #7
  %28 = getelementptr inbounds i8, ptr %1, i64 56
  %29 = load ptr, ptr %28, align 8, !tbaa !5
  %30 = tail call i32 @atoi(ptr nocapture noundef %29) #7
  %31 = getelementptr inbounds i8, ptr %1, i64 64
  %32 = load ptr, ptr %31, align 8, !tbaa !5
  %33 = tail call i32 @atoi(ptr nocapture noundef %32) #7
  %34 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  %35 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %12)
  %36 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %15)
  %37 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %18)
  %38 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %21)
  %39 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %24)
  %40 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, i32 noundef %27)
  %41 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9, i32 noundef %30)
  %42 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10, i32 noundef %33)
  %43 = srem i32 %15, %18
  %44 = sdiv i32 %15, %18
  %.not68 = icmp eq i32 %43, 0
  br i1 %.not68, label %47, label %45

45:                                               ; preds = %9
  %46 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11, i32 noundef %15, i32 noundef %18)
  br label %89

47:                                               ; preds = %9
  %48 = srem i32 %21, %24
  %49 = sdiv i32 %21, %24
  %.not69 = icmp eq i32 %48, 0
  br i1 %.not69, label %52, label %50

50:                                               ; preds = %47
  %51 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12, i32 noundef %21, i32 noundef %24)
  br label %52

52:                                               ; preds = %50, %47
  %53 = mul nsw i32 %44, %44
  %.not70 = icmp ne i32 %27, 0
  %54 = zext i1 %.not70 to i32
  %55 = add nuw nsw i32 %53, %54
  %56 = load ptr, ptr %28, align 8, !tbaa !5
  %57 = tail call i32 @atoi(ptr nocapture noundef %56) #7
  %58 = icmp ne i32 %57, 1
  %59 = icmp ult i32 %55, 385
  %60 = and i32 %55, 7
  %.not71 = icmp eq i32 %60, 0
  %61 = or i1 %59, %.not71
  %or.cond73 = select i1 %58, i1 true, i1 %61
  %62 = add nuw nsw i32 %55, 7
  %63 = and i32 %62, 2147483640
  %.064 = select i1 %or.cond73, i32 %55, i32 %63
  %64 = shl nsw i32 %24, 2
  %65 = mul nsw i32 %64, %49
  %66 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #8
  %67 = tail call noundef i64 @_ZN17fastertransformer24calGemmTestBufSizeInByteEiiiiiiiNS_14CublasDataTypeE(i32 noundef %12, i32 noundef %.064, i32 noundef %24, i32 noundef %49, i32 noundef %65, i32 noundef 0, i32 noundef %33, i32 noundef %30)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #8
  %68 = call i32 @cudaMemGetInfo(ptr noundef nonnull %5, ptr noundef nonnull %4)
  call void @_ZN17fastertransformer5checkI9cudaErrorEEvT_PKcS4_i(i32 noundef %68, ptr noundef nonnull @.str.13, ptr noundef nonnull @.str.14, i32 noundef 75)
  %69 = load i64, ptr %5, align 8, !tbaa !9
  %70 = add i64 %67, 10485760
  %71 = icmp ult i64 %69, %70
  br i1 %71, label %72, label %74

72:                                               ; preds = %52
  %73 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.15, i64 noundef %67, i64 noundef %69)
  br label %88

74:                                               ; preds = %52
  call void @_ZN17fastertransformer12deviceMallocIcEEvPPT_mb(ptr noundef nonnull %3, i64 noundef %67, i1 noundef zeroext false)
  %.not72 = icmp eq i32 %33, 0
  br i1 %.not72, label %78, label %75

75:                                               ; preds = %74
  %76 = load ptr, ptr %3, align 8, !tbaa !5
  %77 = call noundef i32 @_ZN17fastertransformer29generate_encoder_igemm_configEiiiiPvb(i32 noundef %12, i32 noundef %.064, i32 noundef %24, i32 noundef %49, ptr noundef %76, i1 noundef zeroext false)
  br label %85

78:                                               ; preds = %74
  switch i32 %30, label %83 [
    i32 0, label %79
    i32 1, label %81
  ]

79:                                               ; preds = %78
  %80 = load ptr, ptr %3, align 8, !tbaa !5
  call void @_ZN17fastertransformer28generate_encoder_gemm_configIfEEviiiiPvbi(i32 noundef %12, i32 noundef %.064, i32 noundef %24, i32 noundef %49, ptr noundef %80, i1 noundef zeroext false, i32 noundef 1)
  br label %85

81:                                               ; preds = %78
  %82 = load ptr, ptr %3, align 8, !tbaa !5
  call void @_ZN17fastertransformer28generate_encoder_gemm_configI6__halfEEviiiiPvbi(i32 noundef %12, i32 noundef %.064, i32 noundef %24, i32 noundef %49, ptr noundef %82, i1 noundef zeroext false, i32 noundef 1)
  br label %85

83:                                               ; preds = %78
  %84 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.16)
  br label %88

85:                                               ; preds = %79, %81, %75
  %86 = load ptr, ptr %3, align 8, !tbaa !5
  %87 = call i32 @cudaFree(ptr noundef %86)
  call void @_ZN17fastertransformer5checkI9cudaErrorEEvT_PKcS4_i(i32 noundef %87, ptr noundef nonnull @.str.17, ptr noundef nonnull @.str.14, i32 noundef 102)
  br label %88

88:                                               ; preds = %85, %83, %72
  %.0 = phi i32 [ -1, %72 ], [ 0, %85 ], [ -1, %83 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #8
  br label %89

89:                                               ; preds = %45, %88, %6
  %.2 = phi i32 [ 0, %6 ], [ -1, %45 ], [ %.0, %88 ]
  ret i32 %.2
}

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1

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

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr nocapture noundef nonnull) local_unnamed_addr #3

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #5

declare noundef i64 @_ZN17fastertransformer24calGemmTestBufSizeInByteEiiiiiiiNS_14CublasDataTypeE(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #6

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN17fastertransformer5checkI9cudaErrorEEvT_PKcS4_i(i32 noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #4

declare i32 @cudaMemGetInfo(ptr noundef, ptr noundef) local_unnamed_addr #6

declare void @_ZN17fastertransformer12deviceMallocIcEEvPPT_mb(ptr noundef, i64 noundef, i1 noundef zeroext) local_unnamed_addr #6

declare noundef i32 @_ZN17fastertransformer29generate_encoder_igemm_configEiiiiPvb(i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef, i1 noundef zeroext) local_unnamed_addr #6

declare void @_ZN17fastertransformer28generate_encoder_gemm_configIfEEviiiiPvbi(i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef, i1 noundef zeroext, i32 noundef) local_unnamed_addr #6

declare void @_ZN17fastertransformer28generate_encoder_gemm_configI6__halfEEviiiiPvbi(i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef, i1 noundef zeroext, i32 noundef) local_unnamed_addr #6

declare i32 @cudaFree(ptr noundef) local_unnamed_addr #6

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

attributes #0 = { mustprogress norecurse 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 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint mustprogress nofree nounwind willreturn memory(read) 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 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 #5 = { 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 #6 = { "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 #7 = { nounwind willreturn memory(read) }
attributes #8 = { 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 = !{!"long", !7, i64 0}


; Effective O3 passes: DSEPass,DivRemPairsPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass