; LLVM IR from libxsmm/libxsmm :: src (libxsmm_barrier)

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

%struct.libxsmm_barrier = type { ptr, ptr, i32, i32, i32, i32, i32, i8 }
%struct.internal_sync_thread_tag = type { i32, ptr }
%struct.internal_sync_core_tag = type { i8, i8, ptr, [2 x ptr], [2 x ptr], i8, i8 }

@.str = external hidden unnamed_addr constant [10 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [71 x i8], align 1
@__PRETTY_FUNCTION__.libxsmm_barrier_init = external hidden unnamed_addr constant [50 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

declare noalias ptr @libxsmm_aligned_malloc(i64 noundef, i64 noundef) #1

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

; Function Attrs: nounwind uwtable
define dso_local void @libxsmm_barrier_init(ptr noundef %0, i32 noundef %1) #2 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  %13 = icmp ne ptr null, %12
  br i1 %13, label %14, label %273

14:                                               ; preds = %2
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.libxsmm_barrier, ptr %15, i32 0, i32 4
  %17 = load i32, ptr %16, align 8, !tbaa !11
  %18 = icmp slt i32 1, %17
  br i1 %18, label %19, label %273

19:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %20 = load i32, ptr %4, align 4, !tbaa !9
  %21 = load ptr, ptr %3, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.libxsmm_barrier, ptr %21, i32 0, i32 3
  %23 = load i32, ptr %22, align 4, !tbaa !13
  %24 = sdiv i32 %20, %23
  store i32 %24, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  store ptr null, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.libxsmm_barrier, ptr %25, i32 0, i32 7
  %27 = load volatile i8, ptr %26, align 4, !tbaa !14
  %28 = zext i8 %27 to i32
  %29 = icmp eq i32 %28, 2
  br i1 %29, label %30, label %31

30:                                               ; preds = %19
  store i32 1, ptr %9, align 4
  br label %270

31:                                               ; preds = %19
  %32 = call noalias ptr @libxsmm_aligned_malloc(i64 noundef 16, i64 noundef 64)
  store ptr %32, ptr %8, align 8, !tbaa !5
  %33 = load ptr, ptr %8, align 8, !tbaa !5
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.libxsmm_barrier, ptr %34, i32 0, i32 1
  %36 = load ptr, ptr %35, align 8, !tbaa !15
  %37 = load i32, ptr %4, align 4, !tbaa !9
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds ptr, ptr %36, i64 %38
  store ptr %33, ptr %39, align 8, !tbaa !5
  %40 = load i32, ptr %4, align 4, !tbaa !9
  %41 = load ptr, ptr %3, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.libxsmm_barrier, ptr %41, i32 0, i32 3
  %43 = load i32, ptr %42, align 4, !tbaa !13
  %44 = load i32, ptr %5, align 4, !tbaa !9
  %45 = mul nsw i32 %43, %44
  %46 = sub nsw i32 %40, %45
  %47 = load ptr, ptr %8, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.internal_sync_thread_tag, ptr %47, i32 0, i32 0
  store i32 %46, ptr %48, align 8, !tbaa !16
  %49 = load ptr, ptr %8, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.internal_sync_thread_tag, ptr %49, i32 0, i32 0
  %51 = load i32, ptr %50, align 8, !tbaa !16
  %52 = icmp eq i32 0, %51
  br i1 %52, label %53, label %128

53:                                               ; preds = %31
  %54 = call noalias ptr @libxsmm_aligned_malloc(i64 noundef 56, i64 noundef 64)
  store ptr %54, ptr %6, align 8, !tbaa !5
  %55 = load i32, ptr %5, align 4, !tbaa !9
  %56 = trunc i32 %55 to i8
  %57 = load ptr, ptr %6, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.internal_sync_core_tag, ptr %57, i32 0, i32 0
  store i8 %56, ptr %58, align 8, !tbaa !18
  %59 = load ptr, ptr %6, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.internal_sync_core_tag, ptr %59, i32 0, i32 1
  store volatile i8 1, ptr %60, align 1, !tbaa !20
  %61 = load ptr, ptr %3, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.libxsmm_barrier, ptr %61, i32 0, i32 3
  %63 = load i32, ptr %62, align 4, !tbaa !13
  %64 = sext i32 %63 to i64
  %65 = mul i64 %64, 1
  %66 = call noalias ptr @libxsmm_aligned_malloc(i64 noundef %65, i64 noundef 64)
  %67 = load ptr, ptr %6, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.internal_sync_core_tag, ptr %67, i32 0, i32 2
  store ptr %66, ptr %68, align 8, !tbaa !21
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %69

69:                                               ; preds = %82, %53
  %70 = load i32, ptr %7, align 4, !tbaa !9
  %71 = load ptr, ptr %3, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.libxsmm_barrier, ptr %71, i32 0, i32 3
  %73 = load i32, ptr %72, align 4, !tbaa !13
  %74 = icmp slt i32 %70, %73
  br i1 %74, label %75, label %85

75:                                               ; preds = %69
  %76 = load ptr, ptr %6, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.internal_sync_core_tag, ptr %76, i32 0, i32 2
  %78 = load ptr, ptr %77, align 8, !tbaa !21
  %79 = load i32, ptr %7, align 4, !tbaa !9
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds i8, ptr %78, i64 %80
  store volatile i8 1, ptr %81, align 1, !tbaa !22
  br label %82

82:                                               ; preds = %75
  %83 = load i32, ptr %7, align 4, !tbaa !9
  %84 = add nsw i32 %83, 1
  store i32 %84, ptr %7, align 4, !tbaa !9
  br label %69, !llvm.loop !23

85:                                               ; preds = %69
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %86

86:                                               ; preds = %113, %85
  %87 = load i32, ptr %7, align 4, !tbaa !9
  %88 = icmp slt i32 %87, 2
  br i1 %88, label %89, label %116

89:                                               ; preds = %86
  %90 = load ptr, ptr %3, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.libxsmm_barrier, ptr %90, i32 0, i32 5
  %92 = load i32, ptr %91, align 4, !tbaa !25
  %93 = sext i32 %92 to i64
  %94 = mul i64 %93, 1
  %95 = mul i64 %94, 64
  %96 = call noalias ptr @libxsmm_aligned_malloc(i64 noundef %95, i64 noundef 64)
  %97 = load ptr, ptr %6, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.internal_sync_core_tag, ptr %97, i32 0, i32 3
  %99 = load i32, ptr %7, align 4, !tbaa !9
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [2 x ptr], ptr %98, i64 0, i64 %100
  store ptr %96, ptr %101, align 8, !tbaa !5
  %102 = load ptr, ptr %3, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.libxsmm_barrier, ptr %102, i32 0, i32 5
  %104 = load i32, ptr %103, align 4, !tbaa !25
  %105 = sext i32 %104 to i64
  %106 = mul i64 %105, 8
  %107 = call noalias ptr @libxsmm_aligned_malloc(i64 noundef %106, i64 noundef 64)
  %108 = load ptr, ptr %6, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.internal_sync_core_tag, ptr %108, i32 0, i32 4
  %110 = load i32, ptr %7, align 4, !tbaa !9
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [2 x ptr], ptr %109, i64 0, i64 %111
  store ptr %107, ptr %112, align 8, !tbaa !5
  br label %113

113:                                              ; preds = %89
  %114 = load i32, ptr %7, align 4, !tbaa !9
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr %7, align 4, !tbaa !9
  br label %86, !llvm.loop !26

116:                                              ; preds = %86
  %117 = load ptr, ptr %6, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.internal_sync_core_tag, ptr %117, i32 0, i32 5
  store i8 0, ptr %118, align 8, !tbaa !27
  %119 = load ptr, ptr %6, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.internal_sync_core_tag, ptr %119, i32 0, i32 6
  store i8 1, ptr %120, align 1, !tbaa !28
  %121 = load ptr, ptr %6, align 8, !tbaa !5
  %122 = load ptr, ptr %3, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.libxsmm_barrier, ptr %122, i32 0, i32 0
  %124 = load ptr, ptr %123, align 8, !tbaa !29
  %125 = load i32, ptr %5, align 4, !tbaa !9
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds ptr, ptr %124, i64 %126
  store ptr %121, ptr %127, align 8, !tbaa !5
  br label %128

128:                                              ; preds = %116, %31
  %129 = load ptr, ptr %3, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.libxsmm_barrier, ptr %129, i32 0, i32 6
  %131 = atomicrmw sub ptr %130, i32 1 seq_cst, align 8
  %132 = sub i32 %131, 1
  %133 = icmp eq i32 0, %132
  br i1 %133, label %134, label %142

134:                                              ; preds = %128
  %135 = load ptr, ptr %3, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.libxsmm_barrier, ptr %135, i32 0, i32 4
  %137 = load i32, ptr %136, align 8, !tbaa !11
  %138 = load ptr, ptr %3, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.libxsmm_barrier, ptr %138, i32 0, i32 6
  store volatile i32 %137, ptr %139, align 8, !tbaa !30
  %140 = load ptr, ptr %3, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.libxsmm_barrier, ptr %140, i32 0, i32 7
  store volatile i8 1, ptr %141, align 4, !tbaa !14
  br label %151

142:                                              ; preds = %128
  br label %143

143:                                              ; preds = %149, %142
  %144 = load ptr, ptr %3, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.libxsmm_barrier, ptr %144, i32 0, i32 7
  %146 = load volatile i8, ptr %145, align 4, !tbaa !14
  %147 = zext i8 %146 to i32
  %148 = icmp eq i32 0, %147
  br i1 %148, label %149, label %150

149:                                              ; preds = %143
  br label %143, !llvm.loop !31

150:                                              ; preds = %143
  br label %151

151:                                              ; preds = %150, %134
  %152 = load ptr, ptr %3, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.libxsmm_barrier, ptr %152, i32 0, i32 0
  %154 = load ptr, ptr %153, align 8, !tbaa !29
  %155 = load i32, ptr %5, align 4, !tbaa !9
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds ptr, ptr %154, i64 %156
  %158 = load ptr, ptr %157, align 8, !tbaa !5
  %159 = load ptr, ptr %8, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.internal_sync_thread_tag, ptr %159, i32 0, i32 1
  store ptr %158, ptr %160, align 8, !tbaa !32
  %161 = load ptr, ptr %8, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.internal_sync_thread_tag, ptr %161, i32 0, i32 0
  %163 = load i32, ptr %162, align 8, !tbaa !16
  %164 = icmp eq i32 0, %163
  br i1 %164, label %165, label %246

165:                                              ; preds = %151
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 0, ptr %10, align 4, !tbaa !9
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %166

166:                                              ; preds = %240, %165
  %167 = load i32, ptr %7, align 4, !tbaa !9
  %168 = load ptr, ptr %3, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct.libxsmm_barrier, ptr %168, i32 0, i32 5
  %170 = load i32, ptr %169, align 4, !tbaa !25
  %171 = icmp slt i32 %167, %170
  br i1 %171, label %172, label %245

172:                                              ; preds = %166
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %173 = load i32, ptr %5, align 4, !tbaa !9
  %174 = load i32, ptr %7, align 4, !tbaa !9
  %175 = shl i32 1, %174
  %176 = add nsw i32 %173, %175
  %177 = load ptr, ptr %3, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct.libxsmm_barrier, ptr %177, i32 0, i32 2
  %179 = load i32, ptr %178, align 8, !tbaa !33
  %180 = srem i32 %176, %179
  store i32 %180, ptr %11, align 4, !tbaa !9
  %181 = load ptr, ptr %6, align 8, !tbaa !5
  %182 = icmp ne ptr null, %181
  br i1 %182, label %183, label %184

183:                                              ; preds = %172
  br label %185

184:                                              ; preds = %172
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 137, ptr noundef @__PRETTY_FUNCTION__.libxsmm_barrier_init) #5
  unreachable

185:                                              ; preds = %183
  %186 = load ptr, ptr %6, align 8, !tbaa !5
  %187 = getelementptr inbounds %struct.internal_sync_core_tag, ptr %186, i32 0, i32 3
  %188 = getelementptr inbounds [2 x ptr], ptr %187, i64 0, i64 1
  %189 = load ptr, ptr %188, align 8, !tbaa !5
  %190 = load i32, ptr %10, align 4, !tbaa !9
  %191 = sext i32 %190 to i64
  %192 = getelementptr inbounds i8, ptr %189, i64 %191
  store volatile i8 0, ptr %192, align 1, !tbaa !22
  %193 = load ptr, ptr %6, align 8, !tbaa !5
  %194 = getelementptr inbounds %struct.internal_sync_core_tag, ptr %193, i32 0, i32 3
  %195 = getelementptr inbounds [2 x ptr], ptr %194, i64 0, i64 0
  %196 = load ptr, ptr %195, align 8, !tbaa !5
  %197 = load i32, ptr %10, align 4, !tbaa !9
  %198 = sext i32 %197 to i64
  %199 = getelementptr inbounds i8, ptr %196, i64 %198
  store volatile i8 0, ptr %199, align 1, !tbaa !22
  %200 = load ptr, ptr %3, align 8, !tbaa !5
  %201 = getelementptr inbounds %struct.libxsmm_barrier, ptr %200, i32 0, i32 0
  %202 = load ptr, ptr %201, align 8, !tbaa !29
  %203 = load i32, ptr %11, align 4, !tbaa !9
  %204 = sext i32 %203 to i64
  %205 = getelementptr inbounds ptr, ptr %202, i64 %204
  %206 = load ptr, ptr %205, align 8, !tbaa !5
  %207 = getelementptr inbounds %struct.internal_sync_core_tag, ptr %206, i32 0, i32 3
  %208 = getelementptr inbounds [2 x ptr], ptr %207, i64 0, i64 0
  %209 = load ptr, ptr %208, align 8, !tbaa !5
  %210 = load i32, ptr %10, align 4, !tbaa !9
  %211 = sext i32 %210 to i64
  %212 = getelementptr inbounds i8, ptr %209, i64 %211
  %213 = load ptr, ptr %6, align 8, !tbaa !5
  %214 = getelementptr inbounds %struct.internal_sync_core_tag, ptr %213, i32 0, i32 4
  %215 = getelementptr inbounds [2 x ptr], ptr %214, i64 0, i64 0
  %216 = load ptr, ptr %215, align 8, !tbaa !5
  %217 = load i32, ptr %7, align 4, !tbaa !9
  %218 = sext i32 %217 to i64
  %219 = getelementptr inbounds ptr, ptr %216, i64 %218
  store ptr %212, ptr %219, align 8, !tbaa !5
  %220 = load ptr, ptr %3, align 8, !tbaa !5
  %221 = getelementptr inbounds %struct.libxsmm_barrier, ptr %220, i32 0, i32 0
  %222 = load ptr, ptr %221, align 8, !tbaa !29
  %223 = load i32, ptr %11, align 4, !tbaa !9
  %224 = sext i32 %223 to i64
  %225 = getelementptr inbounds ptr, ptr %222, i64 %224
  %226 = load ptr, ptr %225, align 8, !tbaa !5
  %227 = getelementptr inbounds %struct.internal_sync_core_tag, ptr %226, i32 0, i32 3
  %228 = getelementptr inbounds [2 x ptr], ptr %227, i64 0, i64 1
  %229 = load ptr, ptr %228, align 8, !tbaa !5
  %230 = load i32, ptr %10, align 4, !tbaa !9
  %231 = sext i32 %230 to i64
  %232 = getelementptr inbounds i8, ptr %229, i64 %231
  %233 = load ptr, ptr %6, align 8, !tbaa !5
  %234 = getelementptr inbounds %struct.internal_sync_core_tag, ptr %233, i32 0, i32 4
  %235 = getelementptr inbounds [2 x ptr], ptr %234, i64 0, i64 1
  %236 = load ptr, ptr %235, align 8, !tbaa !5
  %237 = load i32, ptr %7, align 4, !tbaa !9
  %238 = sext i32 %237 to i64
  %239 = getelementptr inbounds ptr, ptr %236, i64 %238
  store ptr %232, ptr %239, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %240

240:                                              ; preds = %185
  %241 = load i32, ptr %7, align 4, !tbaa !9
  %242 = add nsw i32 %241, 1
  store i32 %242, ptr %7, align 4, !tbaa !9
  %243 = load i32, ptr %10, align 4, !tbaa !9
  %244 = add nsw i32 %243, 64
  store i32 %244, ptr %10, align 4, !tbaa !9
  br label %166, !llvm.loop !34

245:                                              ; preds = %166
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %246

246:                                              ; preds = %245, %151
  %247 = load ptr, ptr %3, align 8, !tbaa !5
  %248 = getelementptr inbounds %struct.libxsmm_barrier, ptr %247, i32 0, i32 6
  %249 = atomicrmw sub ptr %248, i32 1 seq_cst, align 8
  %250 = sub i32 %249, 1
  %251 = icmp eq i32 0, %250
  br i1 %251, label %252, label %260

252:                                              ; preds = %246
  %253 = load ptr, ptr %3, align 8, !tbaa !5
  %254 = getelementptr inbounds %struct.libxsmm_barrier, ptr %253, i32 0, i32 4
  %255 = load i32, ptr %254, align 8, !tbaa !11
  %256 = load ptr, ptr %3, align 8, !tbaa !5
  %257 = getelementptr inbounds %struct.libxsmm_barrier, ptr %256, i32 0, i32 6
  store volatile i32 %255, ptr %257, align 8, !tbaa !30
  %258 = load ptr, ptr %3, align 8, !tbaa !5
  %259 = getelementptr inbounds %struct.libxsmm_barrier, ptr %258, i32 0, i32 7
  store volatile i8 2, ptr %259, align 4, !tbaa !14
  br label %269

260:                                              ; preds = %246
  br label %261

261:                                              ; preds = %267, %260
  %262 = load ptr, ptr %3, align 8, !tbaa !5
  %263 = getelementptr inbounds %struct.libxsmm_barrier, ptr %262, i32 0, i32 7
  %264 = load volatile i8, ptr %263, align 4, !tbaa !14
  %265 = zext i8 %264 to i32
  %266 = icmp ne i32 2, %265
  br i1 %266, label %267, label %268

267:                                              ; preds = %261
  br label %261, !llvm.loop !35

268:                                              ; preds = %261
  br label %269

269:                                              ; preds = %268, %252
  store i32 0, ptr %9, align 4
  br label %270

270:                                              ; preds = %269, %30
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  %271 = load i32, ptr %9, align 4
  switch i32 %271, label %274 [
    i32 0, label %272
    i32 1, label %273
  ]

272:                                              ; preds = %270
  br label %273

273:                                              ; preds = %272, %270, %14, %2
  ret void

274:                                              ; preds = %270
  unreachable
}

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #3 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { noreturn 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 24}
!12 = !{!"libxsmm_barrier", !6, i64 0, !6, i64 8, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !7, i64 36}
!13 = !{!12, !10, i64 20}
!14 = !{!12, !7, i64 36}
!15 = !{!12, !6, i64 8}
!16 = !{!17, !10, i64 0}
!17 = !{!"internal_sync_thread_tag", !10, i64 0, !6, i64 8}
!18 = !{!19, !7, i64 0}
!19 = !{!"internal_sync_core_tag", !7, i64 0, !7, i64 1, !6, i64 8, !7, i64 16, !7, i64 32, !7, i64 48, !7, i64 49}
!20 = !{!19, !7, i64 1}
!21 = !{!19, !6, i64 8}
!22 = !{!7, !7, i64 0}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = !{!12, !10, i64 28}
!26 = distinct !{!26, !24}
!27 = !{!19, !7, i64 48}
!28 = !{!19, !7, i64 49}
!29 = !{!12, !6, i64 0}
!30 = !{!12, !10, i64 32}
!31 = distinct !{!31, !24}
!32 = !{!17, !6, i64 8}
!33 = !{!12, !10, i64 16}
!34 = distinct !{!34, !24}
!35 = distinct !{!35, !24}


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

@.str = external hidden unnamed_addr constant [10 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [71 x i8], align 1
@__PRETTY_FUNCTION__.libxsmm_barrier_init = external hidden unnamed_addr constant [50 x i8], align 1

declare noalias ptr @libxsmm_aligned_malloc(i64 noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @libxsmm_barrier_init(ptr noundef %0, i32 noundef %1) local_unnamed_addr #1 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %.loopexit, label %3

3:                                                ; preds = %2
  %4 = getelementptr inbounds i8, ptr %0, i64 24
  %5 = load i32, ptr %4, align 8, !tbaa !5
  %6 = icmp sgt i32 %5, 1
  br i1 %6, label %7, label %.loopexit

7:                                                ; preds = %3
  %8 = getelementptr inbounds i8, ptr %0, i64 20
  %9 = load i32, ptr %8, align 4, !tbaa !11
  %10 = sdiv i32 %1, %9
  %11 = getelementptr inbounds i8, ptr %0, i64 36
  %12 = load volatile i8, ptr %11, align 4, !tbaa !12
  %13 = icmp eq i8 %12, 2
  br i1 %13, label %.loopexit, label %14

14:                                               ; preds = %7
  %15 = tail call noalias ptr @libxsmm_aligned_malloc(i64 noundef 16, i64 noundef 64) #3
  %16 = getelementptr inbounds i8, ptr %0, i64 8
  %17 = load ptr, ptr %16, align 8, !tbaa !13
  %18 = sext i32 %1 to i64
  %19 = getelementptr inbounds ptr, ptr %17, i64 %18
  store ptr %15, ptr %19, align 8, !tbaa !14
  %20 = load i32, ptr %8, align 4, !tbaa !11
  %21 = mul nsw i32 %20, %10
  %22 = sub nsw i32 %1, %21
  store i32 %22, ptr %15, align 8, !tbaa !15
  %23 = icmp eq i32 %21, %1
  br i1 %23, label %24, label %65

24:                                               ; preds = %14
  %25 = tail call noalias ptr @libxsmm_aligned_malloc(i64 noundef 56, i64 noundef 64) #3
  %26 = trunc i32 %10 to i8
  store i8 %26, ptr %25, align 8, !tbaa !17
  %27 = getelementptr inbounds i8, ptr %25, i64 1
  store volatile i8 1, ptr %27, align 1, !tbaa !19
  %28 = load i32, ptr %8, align 4, !tbaa !11
  %29 = sext i32 %28 to i64
  %30 = tail call noalias ptr @libxsmm_aligned_malloc(i64 noundef %29, i64 noundef 64) #3
  %31 = getelementptr inbounds i8, ptr %25, i64 8
  store ptr %30, ptr %31, align 8, !tbaa !20
  %32 = load i32, ptr %8, align 4, !tbaa !11
  %33 = icmp sgt i32 %32, 0
  br i1 %33, label %.lr.ph, label %.preheader80

.preheader80:                                     ; preds = %.lr.ph, %24
  %34 = getelementptr inbounds i8, ptr %0, i64 28
  %35 = getelementptr inbounds i8, ptr %25, i64 16
  %36 = getelementptr inbounds i8, ptr %25, i64 32
  %37 = load i32, ptr %34, align 4, !tbaa !21
  %38 = sext i32 %37 to i64
  %39 = shl nsw i64 %38, 6
  %40 = tail call noalias ptr @libxsmm_aligned_malloc(i64 noundef %39, i64 noundef 64) #3
  store ptr %40, ptr %35, align 8, !tbaa !14
  %41 = load i32, ptr %34, align 4, !tbaa !21
  %42 = sext i32 %41 to i64
  %43 = shl nsw i64 %42, 3
  %44 = tail call noalias ptr @libxsmm_aligned_malloc(i64 noundef %43, i64 noundef 64) #3
  store ptr %44, ptr %36, align 8, !tbaa !14
  %45 = load i32, ptr %34, align 4, !tbaa !21
  %46 = sext i32 %45 to i64
  %47 = shl nsw i64 %46, 6
  %48 = tail call noalias ptr @libxsmm_aligned_malloc(i64 noundef %47, i64 noundef 64) #3
  %49 = getelementptr inbounds i8, ptr %25, i64 24
  store ptr %48, ptr %49, align 8, !tbaa !14
  %50 = load i32, ptr %34, align 4, !tbaa !21
  %51 = sext i32 %50 to i64
  %52 = shl nsw i64 %51, 3
  %53 = tail call noalias ptr @libxsmm_aligned_malloc(i64 noundef %52, i64 noundef 64) #3
  %54 = getelementptr inbounds i8, ptr %25, i64 40
  store ptr %53, ptr %54, align 8, !tbaa !14
  %55 = getelementptr inbounds i8, ptr %25, i64 48
  store i8 0, ptr %55, align 8, !tbaa !22
  %56 = getelementptr inbounds i8, ptr %25, i64 49
  store i8 1, ptr %56, align 1, !tbaa !23
  %57 = load ptr, ptr %0, align 8, !tbaa !24
  %58 = sext i32 %10 to i64
  %59 = getelementptr inbounds ptr, ptr %57, i64 %58
  store ptr %25, ptr %59, align 8, !tbaa !14
  br label %65

.lr.ph:                                           ; preds = %24, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %24 ]
  %60 = load ptr, ptr %31, align 8, !tbaa !20
  %61 = getelementptr inbounds i8, ptr %60, i64 %indvars.iv
  store volatile i8 1, ptr %61, align 1, !tbaa !25
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %62 = load i32, ptr %8, align 4, !tbaa !11
  %63 = sext i32 %62 to i64
  %64 = icmp slt i64 %indvars.iv.next, %63
  br i1 %64, label %.lr.ph, label %.preheader80, !llvm.loop !26

65:                                               ; preds = %.preheader80, %14
  %.0 = phi ptr [ %25, %.preheader80 ], [ null, %14 ]
  %66 = getelementptr inbounds i8, ptr %0, i64 32
  %67 = atomicrmw sub ptr %66, i32 1 seq_cst, align 8
  %68 = icmp eq i32 %67, 1
  br i1 %68, label %69, label %.preheader78

69:                                               ; preds = %65
  %70 = load i32, ptr %4, align 8, !tbaa !5
  store volatile i32 %70, ptr %66, align 8, !tbaa !28
  store volatile i8 1, ptr %11, align 4, !tbaa !12
  br label %.loopexit79

.preheader78:                                     ; preds = %65, %.preheader78
  %71 = load volatile i8, ptr %11, align 4, !tbaa !12
  %72 = icmp eq i8 %71, 0
  br i1 %72, label %.preheader78, label %.loopexit79, !llvm.loop !29

.loopexit79:                                      ; preds = %.preheader78, %69
  %73 = load ptr, ptr %0, align 8, !tbaa !24
  %74 = sext i32 %10 to i64
  %75 = getelementptr inbounds ptr, ptr %73, i64 %74
  %76 = load ptr, ptr %75, align 8, !tbaa !14
  %77 = getelementptr inbounds i8, ptr %15, i64 8
  store ptr %76, ptr %77, align 8, !tbaa !30
  %78 = load i32, ptr %15, align 8, !tbaa !15
  %79 = icmp eq i32 %78, 0
  br i1 %79, label %.preheader76, label %.loopexit77

.preheader76:                                     ; preds = %.loopexit79
  %80 = getelementptr inbounds i8, ptr %0, i64 28
  %81 = load i32, ptr %80, align 4, !tbaa !21
  %82 = icmp sgt i32 %81, 0
  br i1 %82, label %.lr.ph85, label %.loopexit77

.lr.ph85:                                         ; preds = %.preheader76
  %.not75 = icmp eq ptr %.0, null
  %83 = getelementptr inbounds i8, ptr %0, i64 16
  %84 = getelementptr inbounds i8, ptr %.0, i64 16
  %85 = getelementptr inbounds i8, ptr %.0, i64 24
  %86 = getelementptr inbounds i8, ptr %.0, i64 32
  %87 = getelementptr inbounds i8, ptr %.0, i64 40
  br i1 %.not75, label %117, label %.lr.ph85.split

.lr.ph85.split:                                   ; preds = %.lr.ph85, %.lr.ph85.split
  %indvars.iv92 = phi i64 [ %indvars.iv.next93, %.lr.ph85.split ], [ 0, %.lr.ph85 ]
  %indvars.iv90 = phi i64 [ %indvars.iv.next91, %.lr.ph85.split ], [ 0, %.lr.ph85 ]
  %88 = trunc nuw nsw i64 %indvars.iv92 to i32
  %89 = shl nuw i32 1, %88
  %90 = add nsw i32 %89, %10
  %91 = load i32, ptr %83, align 8, !tbaa !31
  %92 = srem i32 %90, %91
  %93 = load ptr, ptr %85, align 8, !tbaa !14
  %94 = getelementptr inbounds i8, ptr %93, i64 %indvars.iv90
  store volatile i8 0, ptr %94, align 1, !tbaa !25
  %95 = load ptr, ptr %84, align 8, !tbaa !14
  %96 = getelementptr inbounds i8, ptr %95, i64 %indvars.iv90
  store volatile i8 0, ptr %96, align 1, !tbaa !25
  %97 = load ptr, ptr %0, align 8, !tbaa !24
  %98 = sext i32 %92 to i64
  %99 = getelementptr inbounds ptr, ptr %97, i64 %98
  %100 = load ptr, ptr %99, align 8, !tbaa !14
  %101 = getelementptr inbounds i8, ptr %100, i64 16
  %102 = load ptr, ptr %101, align 8, !tbaa !14
  %103 = getelementptr inbounds i8, ptr %102, i64 %indvars.iv90
  %104 = load ptr, ptr %86, align 8, !tbaa !14
  %105 = getelementptr inbounds ptr, ptr %104, i64 %indvars.iv92
  store ptr %103, ptr %105, align 8, !tbaa !14
  %106 = load ptr, ptr %0, align 8, !tbaa !24
  %107 = getelementptr inbounds ptr, ptr %106, i64 %98
  %108 = load ptr, ptr %107, align 8, !tbaa !14
  %109 = getelementptr inbounds i8, ptr %108, i64 24
  %110 = load ptr, ptr %109, align 8, !tbaa !14
  %111 = getelementptr inbounds i8, ptr %110, i64 %indvars.iv90
  %112 = load ptr, ptr %87, align 8, !tbaa !14
  %113 = getelementptr inbounds ptr, ptr %112, i64 %indvars.iv92
  store ptr %111, ptr %113, align 8, !tbaa !14
  %indvars.iv.next93 = add nuw nsw i64 %indvars.iv92, 1
  %indvars.iv.next91 = add nuw nsw i64 %indvars.iv90, 64
  %114 = load i32, ptr %80, align 4, !tbaa !21
  %115 = sext i32 %114 to i64
  %116 = icmp slt i64 %indvars.iv.next93, %115
  br i1 %116, label %.lr.ph85.split, label %.loopexit77, !llvm.loop !32

117:                                              ; preds = %.lr.ph85
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 137, ptr noundef nonnull @__PRETTY_FUNCTION__.libxsmm_barrier_init) #4
  unreachable

.loopexit77:                                      ; preds = %.lr.ph85.split, %.preheader76, %.loopexit79
  %118 = atomicrmw sub ptr %66, i32 1 seq_cst, align 8
  %119 = icmp eq i32 %118, 1
  br i1 %119, label %120, label %.preheader

120:                                              ; preds = %.loopexit77
  %121 = load i32, ptr %4, align 8, !tbaa !5
  store volatile i32 %121, ptr %66, align 8, !tbaa !28
  store volatile i8 2, ptr %11, align 4, !tbaa !12
  br label %.loopexit

.preheader:                                       ; preds = %.loopexit77, %.preheader
  %122 = load volatile i8, ptr %11, align 4, !tbaa !12
  %.not74 = icmp eq i8 %122, 2
  br i1 %.not74, label %.loopexit, label %.preheader, !llvm.loop !33

.loopexit:                                        ; preds = %.preheader, %7, %120, %3, %2
  ret void
}

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

attributes #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 = { 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 #2 = { noreturn 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 #3 = { nounwind }
attributes #4 = { noreturn 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, !10, i64 24}
!6 = !{!"libxsmm_barrier", !7, i64 0, !7, i64 8, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !8, i64 36}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !10, i64 20}
!12 = !{!6, !8, i64 36}
!13 = !{!6, !7, i64 8}
!14 = !{!7, !7, i64 0}
!15 = !{!16, !10, i64 0}
!16 = !{!"internal_sync_thread_tag", !10, i64 0, !7, i64 8}
!17 = !{!18, !8, i64 0}
!18 = !{!"internal_sync_core_tag", !8, i64 0, !8, i64 1, !7, i64 8, !8, i64 16, !8, i64 32, !8, i64 48, !8, i64 49}
!19 = !{!18, !8, i64 1}
!20 = !{!18, !7, i64 8}
!21 = !{!6, !10, i64 28}
!22 = !{!18, !8, i64 48}
!23 = !{!18, !8, i64 49}
!24 = !{!6, !7, i64 0}
!25 = !{!8, !8, i64 0}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}
!28 = !{!6, !10, i64 32}
!29 = distinct !{!29, !27}
!30 = !{!16, !7, i64 8}
!31 = !{!6, !10, i64 16}
!32 = distinct !{!32, !27}
!33 = distinct !{!33, !27}


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