; LLVM IR from NVIDIA/FasterTransformer :: src/fastertransformer/models/swin (swin_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 [143 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [16 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.10 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [105 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [107 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.14 = 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 ptr, align 8
  %18 = alloca i64, align 8
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i64, align 8
  %23 = alloca i64, align 8
  %24 = alloca i64, align 8
  %25 = alloca i32, align 4
  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
  %26 = load i32, ptr %4, align 4, !tbaa !5
  %27 = icmp ne i32 %26, 8
  br i1 %27, label %28, label %31

28:                                               ; preds = %2
  %29 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  %30 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  store i32 0, ptr %3, align 4
  br label %179

31:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  %32 = load ptr, ptr %5, align 8, !tbaa !9
  %33 = getelementptr inbounds ptr, ptr %32, i64 1
  %34 = load ptr, ptr %33, align 8, !tbaa !9
  %35 = call i32 @atoi(ptr noundef %34) #7
  store i32 %35, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %36 = load ptr, ptr %5, align 8, !tbaa !9
  %37 = getelementptr inbounds ptr, ptr %36, i64 2
  %38 = load ptr, ptr %37, align 8, !tbaa !9
  %39 = call i32 @atoi(ptr noundef %38) #7
  store i32 %39, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %40 = load ptr, ptr %5, align 8, !tbaa !9
  %41 = getelementptr inbounds ptr, ptr %40, i64 3
  %42 = load ptr, ptr %41, align 8, !tbaa !9
  %43 = call i32 @atoi(ptr noundef %42) #7
  store i32 %43, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %44 = load ptr, ptr %5, align 8, !tbaa !9
  %45 = getelementptr inbounds ptr, ptr %44, i64 4
  %46 = load ptr, ptr %45, align 8, !tbaa !9
  %47 = call i32 @atoi(ptr noundef %46) #7
  store i32 %47, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %48 = load ptr, ptr %5, align 8, !tbaa !9
  %49 = getelementptr inbounds ptr, ptr %48, i64 5
  %50 = load ptr, ptr %49, align 8, !tbaa !9
  %51 = call i32 @atoi(ptr noundef %50) #7
  store i32 %51, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %52 = load ptr, ptr %5, align 8, !tbaa !9
  %53 = getelementptr inbounds ptr, ptr %52, i64 6
  %54 = load ptr, ptr %53, align 8, !tbaa !9
  %55 = call i32 @atoi(ptr noundef %54) #7
  store i32 %55, ptr %11, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  %56 = load ptr, ptr %5, align 8, !tbaa !9
  %57 = getelementptr inbounds ptr, ptr %56, i64 7
  %58 = load ptr, ptr %57, align 8, !tbaa !9
  %59 = call i32 @atoi(ptr noundef %58) #7
  store i32 %59, ptr %12, align 4, !tbaa !5
  %60 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  %61 = load i32, ptr %6, align 4, !tbaa !5
  %62 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %61)
  %63 = load i32, ptr %7, align 4, !tbaa !5
  %64 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %63)
  %65 = load i32, ptr %8, align 4, !tbaa !5
  %66 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef %65)
  %67 = load i32, ptr %9, align 4, !tbaa !5
  %68 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, i32 noundef %67)
  %69 = load i32, ptr %10, align 4, !tbaa !5
  %70 = call i32 (ptr, ...) @printf(ptr noundef @.str.7, i32 noundef %69)
  %71 = load i32, ptr %11, align 4, !tbaa !11
  %72 = call i32 (ptr, ...) @printf(ptr noundef @.str.8, i32 noundef %71)
  %73 = load i32, ptr %12, align 4, !tbaa !5
  %74 = call i32 (ptr, ...) @printf(ptr noundef @.str.9, i32 noundef %73)
  %75 = 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 4, ptr %13) #6
  store i32 4, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  %76 = load i32, ptr %6, align 4, !tbaa !5
  %77 = load i32, ptr %7, align 4, !tbaa !5
  %78 = load i32, ptr %8, align 4, !tbaa !5
  %79 = mul nsw i32 4, %78
  %80 = sdiv i32 %77, %79
  %81 = mul nsw i32 %76, %80
  %82 = load i32, ptr %7, align 4, !tbaa !5
  %83 = load i32, ptr %8, align 4, !tbaa !5
  %84 = mul nsw i32 4, %83
  %85 = sdiv i32 %82, %84
  %86 = mul nsw i32 %81, %85
  store i32 %86, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  %87 = load i32, ptr %8, align 4, !tbaa !5
  %88 = load i32, ptr %8, align 4, !tbaa !5
  %89 = mul nsw i32 %87, %88
  store i32 %89, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  %90 = load i32, ptr %9, align 4, !tbaa !5
  %91 = mul nsw i32 4, %90
  %92 = load i32, ptr %10, align 4, !tbaa !5
  %93 = mul nsw i32 %91, %92
  store i32 %93, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  %94 = load i32, ptr %14, align 4, !tbaa !5
  %95 = load i32, ptr %15, align 4, !tbaa !5
  %96 = load i32, ptr %9, align 4, !tbaa !5
  %97 = load i32, ptr %10, align 4, !tbaa !5
  %98 = load i32, ptr %16, align 4, !tbaa !5
  %99 = call noundef i64 @_ZN17fastertransformer24calGemmTestBufSizeInByteEiiiiiiiNS_14CublasDataTypeE(i32 noundef %94, i32 noundef %95, i32 noundef %96, i32 noundef %97, i32 noundef %98, i32 noundef 0, i32 noundef 1, i32 noundef 0)
  store i64 %99, ptr %18, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  %100 = load i32, ptr %14, align 4, !tbaa !5
  store i32 %100, ptr %19, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  %101 = load i32, ptr %9, align 4, !tbaa !5
  store i32 %101, ptr %20, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  store i32 1, ptr %21, align 4, !tbaa !5
  br label %102

102:                                              ; preds = %128, %31
  %103 = load i32, ptr %21, align 4, !tbaa !5
  %104 = icmp slt i32 %103, 4
  br i1 %104, label %106, label %105

105:                                              ; preds = %102
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  br label %131

106:                                              ; preds = %102
  %107 = load i32, ptr %19, align 4, !tbaa !5
  %108 = sdiv i32 %107, 4
  store i32 %108, ptr %19, align 4, !tbaa !5
  %109 = load i32, ptr %20, align 4, !tbaa !5
  %110 = mul nsw i32 %109, 2
  store i32 %110, ptr %20, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #6
  %111 = load i32, ptr %19, align 4, !tbaa !5
  %112 = load i32, ptr %15, align 4, !tbaa !5
  %113 = load i32, ptr %20, align 4, !tbaa !5
  %114 = load i32, ptr %10, align 4, !tbaa !5
  %115 = load i32, ptr %20, align 4, !tbaa !5
  %116 = mul nsw i32 4, %115
  %117 = load i32, ptr %10, align 4, !tbaa !5
  %118 = mul nsw i32 %116, %117
  %119 = load i32, ptr %12, align 4, !tbaa !5
  %120 = load i32, ptr %11, align 4, !tbaa !11
  %121 = call noundef i64 @_ZN17fastertransformer24calGemmTestBufSizeInByteEiiiiiiiNS_14CublasDataTypeE(i32 noundef %111, i32 noundef %112, i32 noundef %113, i32 noundef %114, i32 noundef %118, i32 noundef 0, i32 noundef %119, i32 noundef %120)
  store i64 %121, ptr %22, align 8, !tbaa !13
  %122 = load i64, ptr %22, align 8, !tbaa !13
  %123 = load i64, ptr %18, align 8, !tbaa !13
  %124 = icmp ugt i64 %122, %123
  br i1 %124, label %125, label %127

125:                                              ; preds = %106
  %126 = load i64, ptr %22, align 8, !tbaa !13
  store i64 %126, ptr %18, align 8, !tbaa !13
  br label %127

127:                                              ; preds = %125, %106
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #6
  br label %128

128:                                              ; preds = %127
  %129 = load i32, ptr %21, align 4, !tbaa !5
  %130 = add nsw i32 %129, 1
  store i32 %130, ptr %21, align 4, !tbaa !5
  br label %102, !llvm.loop !15

131:                                              ; preds = %105
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #6
  %132 = call i32 @cudaMemGetInfo(ptr noundef %24, ptr noundef %23)
  call void @_ZN17fastertransformer5checkI9cudaErrorEEvT_PKcS4_i(i32 noundef %132, ptr noundef @.str.10, ptr noundef @.str.11, i32 noundef 71)
  %133 = load i64, ptr %24, align 8, !tbaa !13
  %134 = load i64, ptr %18, align 8, !tbaa !13
  %135 = add i64 %134, 10485760
  %136 = icmp ult i64 %133, %135
  br i1 %136, label %137, label %141

137:                                              ; preds = %131
  %138 = load i64, ptr %18, align 8, !tbaa !13
  %139 = load i64, ptr %24, align 8, !tbaa !13
  %140 = call i32 (ptr, ...) @printf(ptr noundef @.str.12, i64 noundef %138, i64 noundef %139)
  store ptr null, ptr %17, align 8, !tbaa !9
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %25, align 4
  br label %178

141:                                              ; preds = %131
  %142 = load i64, ptr %18, align 8, !tbaa !13
  call void @_ZN17fastertransformer12deviceMallocIcEEvPPT_mb(ptr noundef %17, i64 noundef %142, i1 noundef zeroext true)
  br label %143

143:                                              ; preds = %141
  %144 = load i32, ptr %12, align 4, !tbaa !5
  %145 = icmp ne i32 %144, 0
  br i1 %145, label %146, label %153

146:                                              ; preds = %143
  %147 = load i32, ptr %14, align 4, !tbaa !5
  %148 = load i32, ptr %15, align 4, !tbaa !5
  %149 = load i32, ptr %9, align 4, !tbaa !5
  %150 = load i32, ptr %10, align 4, !tbaa !5
  %151 = load ptr, ptr %17, align 8, !tbaa !9
  %152 = call noundef i32 @_ZN17fastertransformer26generate_swin_igemm_configEiiiiPvb(i32 noundef %147, i32 noundef %148, i32 noundef %149, i32 noundef %150, ptr noundef %151, i1 noundef zeroext false)
  br label %175

153:                                              ; preds = %143
  %154 = load i32, ptr %11, align 4, !tbaa !11
  %155 = icmp eq i32 %154, 0
  br i1 %155, label %156, label %162

156:                                              ; preds = %153
  %157 = load i32, ptr %14, align 4, !tbaa !5
  %158 = load i32, ptr %15, align 4, !tbaa !5
  %159 = load i32, ptr %9, align 4, !tbaa !5
  %160 = load i32, ptr %10, align 4, !tbaa !5
  %161 = load ptr, ptr %17, align 8, !tbaa !9
  call void @_ZN17fastertransformer25generate_swin_gemm_configIfEEviiiiPvb(i32 noundef %157, i32 noundef %158, i32 noundef %159, i32 noundef %160, ptr noundef %161, i1 noundef zeroext false)
  br label %174

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

165:                                              ; preds = %162
  %166 = load i32, ptr %14, align 4, !tbaa !5
  %167 = load i32, ptr %15, align 4, !tbaa !5
  %168 = load i32, ptr %9, align 4, !tbaa !5
  %169 = load i32, ptr %10, align 4, !tbaa !5
  %170 = load ptr, ptr %17, align 8, !tbaa !9
  call void @_ZN17fastertransformer25generate_swin_gemm_configI6__halfEEviiiiPvb(i32 noundef %166, i32 noundef %167, i32 noundef %168, i32 noundef %169, ptr noundef %170, i1 noundef zeroext false)
  br label %173

171:                                              ; preds = %162
  %172 = call i32 (ptr, ...) @printf(ptr noundef @.str.13)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %25, align 4
  br label %178

173:                                              ; preds = %165
  br label %174

174:                                              ; preds = %173, %156
  br label %175

175:                                              ; preds = %174, %146
  %176 = load ptr, ptr %17, align 8, !tbaa !9
  %177 = call i32 @cudaFree(ptr noundef %176)
  call void @_ZN17fastertransformer5checkI9cudaErrorEEvT_PKcS4_i(i32 noundef %177, ptr noundef @.str.14, ptr noundef @.str.11, i32 noundef 105)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %25, align 4
  br label %178

178:                                              ; preds = %175, %171, %137
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 8, 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
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  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 %179

179:                                              ; preds = %178, %28
  %180 = load i32, ptr %3, align 4
  ret i32 %180
}

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

; 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 @_ZN17fastertransformer26generate_swin_igemm_configEiiiiPvb(i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef, i1 noundef zeroext) #1

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

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

declare i32 @cudaFree(ptr noundef) #1

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}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"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 [143 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [16 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.10 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [105 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [107 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.14 = 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, 8
  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 %82

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) #8
  %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) #8
  %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) #8
  %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) #8
  %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) #8
  %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) #8
  %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) #8
  %31 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  %32 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %12)
  %33 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %15)
  %34 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %18)
  %35 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %21)
  %36 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %24)
  %37 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, i32 noundef %27)
  %38 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9, i32 noundef %30)
  %39 = 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_)
  %40 = shl nsw i32 %18, 2
  %41 = sdiv i32 %15, %40
  %42 = mul nsw i32 %41, %12
  %43 = mul nsw i32 %42, %41
  %44 = mul nsw i32 %18, %18
  %45 = shl nsw i32 %21, 2
  %46 = mul nsw i32 %45, %24
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #9
  %47 = tail call noundef i64 @_ZN17fastertransformer24calGemmTestBufSizeInByteEiiiiiiiNS_14CublasDataTypeE(i32 noundef %43, i32 noundef %44, i32 noundef %21, i32 noundef %24, i32 noundef %46, i32 noundef 0, i32 noundef 1, i32 noundef 0)
  %48 = shl i32 %24, 3
  %49 = sdiv i32 %43, 4
  %50 = shl nsw i32 %21, 1
  %51 = mul i32 %48, %21
  %52 = tail call noundef i64 @_ZN17fastertransformer24calGemmTestBufSizeInByteEiiiiiiiNS_14CublasDataTypeE(i32 noundef %49, i32 noundef %44, i32 noundef %50, i32 noundef %24, i32 noundef %51, i32 noundef 0, i32 noundef %30, i32 noundef %27)
  %spec.select = tail call i64 @llvm.umax.i64(i64 %52, i64 %47)
  %53 = sdiv i32 %43, 16
  %54 = shl nsw i32 %21, 2
  %55 = mul i32 %48, %50
  %56 = tail call noundef i64 @_ZN17fastertransformer24calGemmTestBufSizeInByteEiiiiiiiNS_14CublasDataTypeE(i32 noundef %53, i32 noundef %44, i32 noundef %54, i32 noundef %24, i32 noundef %55, i32 noundef 0, i32 noundef %30, i32 noundef %27)
  %spec.select.1 = tail call i64 @llvm.umax.i64(i64 %56, i64 %spec.select)
  %57 = sdiv i32 %43, 64
  %58 = shl nsw i32 %21, 3
  %59 = mul i32 %48, %54
  %60 = tail call noundef i64 @_ZN17fastertransformer24calGemmTestBufSizeInByteEiiiiiiiNS_14CublasDataTypeE(i32 noundef %57, i32 noundef %44, i32 noundef %58, i32 noundef %24, i32 noundef %59, i32 noundef 0, i32 noundef %30, i32 noundef %27)
  %spec.select.2 = tail call i64 @llvm.umax.i64(i64 %60, i64 %spec.select.1)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #9
  %61 = call i32 @cudaMemGetInfo(ptr noundef nonnull %5, ptr noundef nonnull %4)
  call void @_ZN17fastertransformer5checkI9cudaErrorEEvT_PKcS4_i(i32 noundef %61, ptr noundef nonnull @.str.10, ptr noundef nonnull @.str.11, i32 noundef 71)
  %62 = load i64, ptr %5, align 8, !tbaa !9
  %63 = add i64 %spec.select.2, 10485760
  %64 = icmp ult i64 %62, %63
  br i1 %64, label %65, label %67

65:                                               ; preds = %9
  %66 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12, i64 noundef %spec.select.2, i64 noundef %62)
  br label %81

67:                                               ; preds = %9
  call void @_ZN17fastertransformer12deviceMallocIcEEvPPT_mb(ptr noundef nonnull %3, i64 noundef %spec.select.2, i1 noundef zeroext true)
  %.not72 = icmp eq i32 %30, 0
  br i1 %.not72, label %71, label %68

68:                                               ; preds = %67
  %69 = load ptr, ptr %3, align 8, !tbaa !5
  %70 = call noundef i32 @_ZN17fastertransformer26generate_swin_igemm_configEiiiiPvb(i32 noundef %43, i32 noundef %44, i32 noundef %21, i32 noundef %24, ptr noundef %69, i1 noundef zeroext false)
  br label %78

71:                                               ; preds = %67
  switch i32 %27, label %76 [
    i32 0, label %72
    i32 1, label %74
  ]

72:                                               ; preds = %71
  %73 = load ptr, ptr %3, align 8, !tbaa !5
  call void @_ZN17fastertransformer25generate_swin_gemm_configIfEEviiiiPvb(i32 noundef %43, i32 noundef %44, i32 noundef %21, i32 noundef %24, ptr noundef %73, i1 noundef zeroext false)
  br label %78

74:                                               ; preds = %71
  %75 = load ptr, ptr %3, align 8, !tbaa !5
  call void @_ZN17fastertransformer25generate_swin_gemm_configI6__halfEEviiiiPvb(i32 noundef %43, i32 noundef %44, i32 noundef %21, i32 noundef %24, ptr noundef %75, i1 noundef zeroext false)
  br label %78

76:                                               ; preds = %71
  %77 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.13)
  br label %81

78:                                               ; preds = %72, %74, %68
  %79 = load ptr, ptr %3, align 8, !tbaa !5
  %80 = call i32 @cudaFree(ptr noundef %79)
  call void @_ZN17fastertransformer5checkI9cudaErrorEEvT_PKcS4_i(i32 noundef %80, ptr noundef nonnull @.str.14, ptr noundef nonnull @.str.11, i32 noundef 105)
  br label %81

81:                                               ; preds = %78, %76, %65
  %.0 = phi i32 [ -1, %65 ], [ 0, %78 ], [ -1, %76 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #9
  br label %82

82:                                               ; preds = %81, %6
  %.1 = phi i32 [ 0, %6 ], [ %.0, %81 ]
  ret i32 %.1
}

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

; 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 @_ZN17fastertransformer26generate_swin_igemm_configEiiiiPvb(i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef, i1 noundef zeroext) local_unnamed_addr #6

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

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

declare i32 @cudaFree(ptr noundef) local_unnamed_addr #6

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umax.i64(i64, i64) #7

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind willreturn memory(read) }
attributes #9 = { 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,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LCSSAPass,LICMPass,LoopRotatePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass