; LLVM IR from sourceryinstitute/MORFEUS-Source :: src/FV/src/mesh_optimize/OptMS (SMfunc3d)

; 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.DERIV_TYPE = type { double, [3 x double] }

@stderr = external global ptr, align 8
@.str.17 = external hidden unnamed_addr constant [91 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [63 x i8], align 1

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

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

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #1

; Function Attrs: noreturn nounwind
declare void @abort() #2

; Function Attrs: nounwind uwtable
define dso_local i32 @vGradCosineDihedrals(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) #3 {
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca [3 x %struct.DERIV_TYPE], align 16
  %16 = alloca [3 x %struct.DERIV_TYPE], align 16
  %17 = alloca [3 x %struct.DERIV_TYPE], align 16
  %18 = alloca [3 x %struct.DERIV_TYPE], align 16
  %19 = alloca [6 x %struct.DERIV_TYPE], align 16
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  %27 = alloca i32, align 4
  %28 = alloca i32, align 4
  %29 = alloca i32, align 4
  %30 = alloca i32, align 4
  %31 = alloca i32, align 4
  %32 = alloca i32, align 4
  %33 = alloca i32, align 4
  %34 = alloca double, align 8
  %35 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !5
  store ptr %5, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.start.p0(i64 96, ptr %15) #5
  call void @llvm.lifetime.start.p0(i64 96, ptr %16) #5
  call void @llvm.lifetime.start.p0(i64 96, ptr %17) #5
  call void @llvm.lifetime.start.p0(i64 96, ptr %18) #5
  call void @llvm.lifetime.start.p0(i64 192, ptr %19) #5
  br label %36

36:                                               ; preds = %6
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #5
  store i32 3, ptr %20, align 4, !tbaa !9
  %37 = load i32, ptr %20, align 4, !tbaa !9
  %38 = icmp ne i32 %37, 3
  br i1 %38, label %39, label %43

39:                                               ; preds = %36
  %40 = load ptr, ptr @stderr, align 8, !tbaa !5
  %41 = load i32, ptr %20, align 4, !tbaa !9
  %42 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %40, ptr noundef @.str.17, i32 noundef %41, i32 noundef 3) #5
  call void @abort() #6
  unreachable

43:                                               ; preds = %36
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #5
  br label %44

44:                                               ; preds = %43
  br label %45

45:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #5
  store i32 0, ptr %21, align 4, !tbaa !9
  br label %46

46:                                               ; preds = %59, %45
  %47 = load i32, ptr %21, align 4, !tbaa !9
  %48 = icmp slt i32 %47, 3
  br i1 %48, label %49, label %62

49:                                               ; preds = %46
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  %51 = load i32, ptr %21, align 4, !tbaa !9
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds double, ptr %50, i64 %52
  %54 = load double, ptr %53, align 8, !tbaa !11
  %55 = load i32, ptr %21, align 4, !tbaa !9
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [3 x %struct.DERIV_TYPE], ptr %15, i64 0, i64 %56
  %58 = getelementptr inbounds %struct.DERIV_TYPE, ptr %57, i32 0, i32 0
  store double %54, ptr %58, align 16, !tbaa !13
  br label %59

59:                                               ; preds = %49
  %60 = load i32, ptr %21, align 4, !tbaa !9
  %61 = add nsw i32 %60, 1
  store i32 %61, ptr %21, align 4, !tbaa !9
  br label %46, !llvm.loop !15

62:                                               ; preds = %46
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #5
  store i32 0, ptr %22, align 4, !tbaa !9
  br label %63

63:                                               ; preds = %76, %62
  %64 = load i32, ptr %22, align 4, !tbaa !9
  %65 = icmp slt i32 %64, 3
  br i1 %65, label %66, label %79

66:                                               ; preds = %63
  %67 = load ptr, ptr %8, align 8, !tbaa !5
  %68 = load i32, ptr %22, align 4, !tbaa !9
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds double, ptr %67, i64 %69
  %71 = load double, ptr %70, align 8, !tbaa !11
  %72 = load i32, ptr %22, align 4, !tbaa !9
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [3 x %struct.DERIV_TYPE], ptr %16, i64 0, i64 %73
  %75 = getelementptr inbounds %struct.DERIV_TYPE, ptr %74, i32 0, i32 0
  store double %71, ptr %75, align 16, !tbaa !13
  br label %76

76:                                               ; preds = %66
  %77 = load i32, ptr %22, align 4, !tbaa !9
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr %22, align 4, !tbaa !9
  br label %63, !llvm.loop !17

79:                                               ; preds = %63
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #5
  store i32 0, ptr %23, align 4, !tbaa !9
  br label %80

80:                                               ; preds = %93, %79
  %81 = load i32, ptr %23, align 4, !tbaa !9
  %82 = icmp slt i32 %81, 3
  br i1 %82, label %83, label %96

83:                                               ; preds = %80
  %84 = load ptr, ptr %9, align 8, !tbaa !5
  %85 = load i32, ptr %23, align 4, !tbaa !9
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds double, ptr %84, i64 %86
  %88 = load double, ptr %87, align 8, !tbaa !11
  %89 = load i32, ptr %23, align 4, !tbaa !9
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [3 x %struct.DERIV_TYPE], ptr %17, i64 0, i64 %90
  %92 = getelementptr inbounds %struct.DERIV_TYPE, ptr %91, i32 0, i32 0
  store double %88, ptr %92, align 16, !tbaa !13
  br label %93

93:                                               ; preds = %83
  %94 = load i32, ptr %23, align 4, !tbaa !9
  %95 = add nsw i32 %94, 1
  store i32 %95, ptr %23, align 4, !tbaa !9
  br label %80, !llvm.loop !18

96:                                               ; preds = %80
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #5
  store i32 0, ptr %24, align 4, !tbaa !9
  br label %97

97:                                               ; preds = %110, %96
  %98 = load i32, ptr %24, align 4, !tbaa !9
  %99 = icmp slt i32 %98, 3
  br i1 %99, label %100, label %113

100:                                              ; preds = %97
  %101 = load ptr, ptr %10, align 8, !tbaa !5
  %102 = load i32, ptr %24, align 4, !tbaa !9
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds double, ptr %101, i64 %103
  %105 = load double, ptr %104, align 8, !tbaa !11
  %106 = load i32, ptr %24, align 4, !tbaa !9
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [3 x %struct.DERIV_TYPE], ptr %18, i64 0, i64 %107
  %109 = getelementptr inbounds %struct.DERIV_TYPE, ptr %108, i32 0, i32 0
  store double %105, ptr %109, align 16, !tbaa !13
  br label %110

110:                                              ; preds = %100
  %111 = load i32, ptr %24, align 4, !tbaa !9
  %112 = add nsw i32 %111, 1
  store i32 %112, ptr %24, align 4, !tbaa !9
  br label %97, !llvm.loop !19

113:                                              ; preds = %97
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #5
  store i32 0, ptr %25, align 4, !tbaa !9
  br label %114

114:                                              ; preds = %136, %113
  %115 = load i32, ptr %25, align 4, !tbaa !9
  %116 = icmp slt i32 %115, 3
  br i1 %116, label %117, label %139

117:                                              ; preds = %114
  br label %118

118:                                              ; preds = %117
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #5
  store i32 0, ptr %26, align 4, !tbaa !9
  br label %119

119:                                              ; preds = %130, %118
  %120 = load i32, ptr %26, align 4, !tbaa !9
  %121 = icmp slt i32 %120, 3
  br i1 %121, label %122, label %133

122:                                              ; preds = %119
  %123 = load i32, ptr %25, align 4, !tbaa !9
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [3 x %struct.DERIV_TYPE], ptr %15, i64 0, i64 %124
  %126 = getelementptr inbounds %struct.DERIV_TYPE, ptr %125, i32 0, i32 1
  %127 = load i32, ptr %26, align 4, !tbaa !9
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [3 x double], ptr %126, i64 0, i64 %128
  store double 0.000000e+00, ptr %129, align 8, !tbaa !11
  br label %130

130:                                              ; preds = %122
  %131 = load i32, ptr %26, align 4, !tbaa !9
  %132 = add nsw i32 %131, 1
  store i32 %132, ptr %26, align 4, !tbaa !9
  br label %119, !llvm.loop !20

133:                                              ; preds = %119
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #5
  br label %134

134:                                              ; preds = %133
  br label %135

135:                                              ; preds = %134
  br label %136

136:                                              ; preds = %135
  %137 = load i32, ptr %25, align 4, !tbaa !9
  %138 = add nsw i32 %137, 1
  store i32 %138, ptr %25, align 4, !tbaa !9
  br label %114, !llvm.loop !21

139:                                              ; preds = %114
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #5
  store i32 0, ptr %27, align 4, !tbaa !9
  br label %140

140:                                              ; preds = %162, %139
  %141 = load i32, ptr %27, align 4, !tbaa !9
  %142 = icmp slt i32 %141, 3
  br i1 %142, label %143, label %165

143:                                              ; preds = %140
  br label %144

144:                                              ; preds = %143
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #5
  store i32 0, ptr %28, align 4, !tbaa !9
  br label %145

145:                                              ; preds = %156, %144
  %146 = load i32, ptr %28, align 4, !tbaa !9
  %147 = icmp slt i32 %146, 3
  br i1 %147, label %148, label %159

148:                                              ; preds = %145
  %149 = load i32, ptr %27, align 4, !tbaa !9
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [3 x %struct.DERIV_TYPE], ptr %16, i64 0, i64 %150
  %152 = getelementptr inbounds %struct.DERIV_TYPE, ptr %151, i32 0, i32 1
  %153 = load i32, ptr %28, align 4, !tbaa !9
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [3 x double], ptr %152, i64 0, i64 %154
  store double 0.000000e+00, ptr %155, align 8, !tbaa !11
  br label %156

156:                                              ; preds = %148
  %157 = load i32, ptr %28, align 4, !tbaa !9
  %158 = add nsw i32 %157, 1
  store i32 %158, ptr %28, align 4, !tbaa !9
  br label %145, !llvm.loop !22

159:                                              ; preds = %145
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #5
  br label %160

160:                                              ; preds = %159
  br label %161

161:                                              ; preds = %160
  br label %162

162:                                              ; preds = %161
  %163 = load i32, ptr %27, align 4, !tbaa !9
  %164 = add nsw i32 %163, 1
  store i32 %164, ptr %27, align 4, !tbaa !9
  br label %140, !llvm.loop !23

165:                                              ; preds = %140
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #5
  store i32 0, ptr %29, align 4, !tbaa !9
  br label %166

166:                                              ; preds = %188, %165
  %167 = load i32, ptr %29, align 4, !tbaa !9
  %168 = icmp slt i32 %167, 3
  br i1 %168, label %169, label %191

169:                                              ; preds = %166
  br label %170

170:                                              ; preds = %169
  call void @llvm.lifetime.start.p0(i64 4, ptr %30) #5
  store i32 0, ptr %30, align 4, !tbaa !9
  br label %171

171:                                              ; preds = %182, %170
  %172 = load i32, ptr %30, align 4, !tbaa !9
  %173 = icmp slt i32 %172, 3
  br i1 %173, label %174, label %185

174:                                              ; preds = %171
  %175 = load i32, ptr %29, align 4, !tbaa !9
  %176 = sext i32 %175 to i64
  %177 = getelementptr inbounds [3 x %struct.DERIV_TYPE], ptr %17, i64 0, i64 %176
  %178 = getelementptr inbounds %struct.DERIV_TYPE, ptr %177, i32 0, i32 1
  %179 = load i32, ptr %30, align 4, !tbaa !9
  %180 = sext i32 %179 to i64
  %181 = getelementptr inbounds [3 x double], ptr %178, i64 0, i64 %180
  store double 0.000000e+00, ptr %181, align 8, !tbaa !11
  br label %182

182:                                              ; preds = %174
  %183 = load i32, ptr %30, align 4, !tbaa !9
  %184 = add nsw i32 %183, 1
  store i32 %184, ptr %30, align 4, !tbaa !9
  br label %171, !llvm.loop !24

185:                                              ; preds = %171
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #5
  br label %186

186:                                              ; preds = %185
  br label %187

187:                                              ; preds = %186
  br label %188

188:                                              ; preds = %187
  %189 = load i32, ptr %29, align 4, !tbaa !9
  %190 = add nsw i32 %189, 1
  store i32 %190, ptr %29, align 4, !tbaa !9
  br label %166, !llvm.loop !25

191:                                              ; preds = %166
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %31) #5
  store i32 0, ptr %31, align 4, !tbaa !9
  br label %192

192:                                              ; preds = %214, %191
  %193 = load i32, ptr %31, align 4, !tbaa !9
  %194 = icmp slt i32 %193, 3
  br i1 %194, label %195, label %217

195:                                              ; preds = %192
  br label %196

196:                                              ; preds = %195
  call void @llvm.lifetime.start.p0(i64 4, ptr %32) #5
  store i32 0, ptr %32, align 4, !tbaa !9
  br label %197

197:                                              ; preds = %208, %196
  %198 = load i32, ptr %32, align 4, !tbaa !9
  %199 = icmp slt i32 %198, 3
  br i1 %199, label %200, label %211

200:                                              ; preds = %197
  %201 = load i32, ptr %31, align 4, !tbaa !9
  %202 = sext i32 %201 to i64
  %203 = getelementptr inbounds [3 x %struct.DERIV_TYPE], ptr %18, i64 0, i64 %202
  %204 = getelementptr inbounds %struct.DERIV_TYPE, ptr %203, i32 0, i32 1
  %205 = load i32, ptr %32, align 4, !tbaa !9
  %206 = sext i32 %205 to i64
  %207 = getelementptr inbounds [3 x double], ptr %204, i64 0, i64 %206
  store double 0.000000e+00, ptr %207, align 8, !tbaa !11
  br label %208

208:                                              ; preds = %200
  %209 = load i32, ptr %32, align 4, !tbaa !9
  %210 = add nsw i32 %209, 1
  store i32 %210, ptr %32, align 4, !tbaa !9
  br label %197, !llvm.loop !26

211:                                              ; preds = %197
  call void @llvm.lifetime.end.p0(i64 4, ptr %32) #5
  br label %212

212:                                              ; preds = %211
  br label %213

213:                                              ; preds = %212
  br label %214

214:                                              ; preds = %213
  %215 = load i32, ptr %31, align 4, !tbaa !9
  %216 = add nsw i32 %215, 1
  store i32 %216, ptr %31, align 4, !tbaa !9
  br label %192, !llvm.loop !27

217:                                              ; preds = %192
  call void @llvm.lifetime.end.p0(i64 4, ptr %31) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %33) #5
  store i32 0, ptr %33, align 4, !tbaa !9
  br label %218

218:                                              ; preds = %243, %217
  %219 = load i32, ptr %33, align 4, !tbaa !9
  %220 = icmp slt i32 %219, 3
  br i1 %220, label %221, label %246

221:                                              ; preds = %218
  call void @llvm.lifetime.start.p0(i64 8, ptr %34) #5
  store double 1.000000e+00, ptr %34, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %35) #5
  %222 = load i32, ptr %33, align 4, !tbaa !9
  %223 = add nsw i32 1, %222
  store i32 %223, ptr %35, align 4, !tbaa !9
  %224 = load i32, ptr %35, align 4, !tbaa !9
  %225 = icmp sle i32 %224, 0
  br i1 %225, label %229, label %226

226:                                              ; preds = %221
  %227 = load i32, ptr %35, align 4, !tbaa !9
  %228 = icmp sgt i32 %227, 3
  br i1 %228, label %229, label %233

229:                                              ; preds = %226, %221
  %230 = load ptr, ptr @stderr, align 8, !tbaa !5
  %231 = load i32, ptr %35, align 4, !tbaa !9
  %232 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %230, ptr noundef @.str.18, i32 noundef %231, i32 noundef 3) #5
  call void @abort() #6
  unreachable

233:                                              ; preds = %226
  %234 = load double, ptr %34, align 8, !tbaa !11
  %235 = load i32, ptr %33, align 4, !tbaa !9
  %236 = sext i32 %235 to i64
  %237 = getelementptr inbounds [3 x %struct.DERIV_TYPE], ptr %15, i64 0, i64 %236
  %238 = getelementptr inbounds %struct.DERIV_TYPE, ptr %237, i32 0, i32 1
  %239 = load i32, ptr %35, align 4, !tbaa !9
  %240 = sub nsw i32 %239, 1
  %241 = sext i32 %240 to i64
  %242 = getelementptr inbounds [3 x double], ptr %238, i64 0, i64 %241
  store double %234, ptr %242, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %35) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %34) #5
  br label %243

243:                                              ; preds = %233
  %244 = load i32, ptr %33, align 4, !tbaa !9
  %245 = add nsw i32 %244, 1
  store i32 %245, ptr %33, align 4, !tbaa !9
  br label %218, !llvm.loop !28

246:                                              ; preds = %218
  call void @llvm.lifetime.end.p0(i64 4, ptr %33) #5
  %247 = getelementptr inbounds [3 x %struct.DERIV_TYPE], ptr %15, i64 0, i64 0
  %248 = getelementptr inbounds [3 x %struct.DERIV_TYPE], ptr %16, i64 0, i64 0
  %249 = getelementptr inbounds [3 x %struct.DERIV_TYPE], ptr %17, i64 0, i64 0
  %250 = getelementptr inbounds [3 x %struct.DERIV_TYPE], ptr %18, i64 0, i64 0
  %251 = getelementptr inbounds [6 x %struct.DERIV_TYPE], ptr %19, i64 0, i64 0
  %252 = load ptr, ptr %12, align 8, !tbaa !5
  %253 = call i32 @g_ad_vCosineDihedrals(ptr noundef %247, ptr noundef %248, ptr noundef %249, ptr noundef %250, ptr noundef %251, ptr noundef %252)
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %254

254:                                              ; preds = %294, %246
  %255 = load i32, ptr %14, align 4, !tbaa !9
  %256 = icmp slt i32 %255, 6
  br i1 %256, label %257, label %297

257:                                              ; preds = %254
  %258 = load i32, ptr %14, align 4, !tbaa !9
  %259 = sext i32 %258 to i64
  %260 = getelementptr inbounds [6 x %struct.DERIV_TYPE], ptr %19, i64 0, i64 %259
  %261 = getelementptr inbounds %struct.DERIV_TYPE, ptr %260, i32 0, i32 1
  %262 = getelementptr inbounds [3 x double], ptr %261, i64 0, i64 0
  %263 = load double, ptr %262, align 8, !tbaa !11
  %264 = load ptr, ptr %11, align 8, !tbaa !5
  %265 = load i32, ptr %14, align 4, !tbaa !9
  %266 = sext i32 %265 to i64
  %267 = getelementptr inbounds ptr, ptr %264, i64 %266
  %268 = load ptr, ptr %267, align 8, !tbaa !5
  %269 = getelementptr inbounds double, ptr %268, i64 0
  store double %263, ptr %269, align 8, !tbaa !11
  %270 = load i32, ptr %14, align 4, !tbaa !9
  %271 = sext i32 %270 to i64
  %272 = getelementptr inbounds [6 x %struct.DERIV_TYPE], ptr %19, i64 0, i64 %271
  %273 = getelementptr inbounds %struct.DERIV_TYPE, ptr %272, i32 0, i32 1
  %274 = getelementptr inbounds [3 x double], ptr %273, i64 0, i64 1
  %275 = load double, ptr %274, align 8, !tbaa !11
  %276 = load ptr, ptr %11, align 8, !tbaa !5
  %277 = load i32, ptr %14, align 4, !tbaa !9
  %278 = sext i32 %277 to i64
  %279 = getelementptr inbounds ptr, ptr %276, i64 %278
  %280 = load ptr, ptr %279, align 8, !tbaa !5
  %281 = getelementptr inbounds double, ptr %280, i64 1
  store double %275, ptr %281, align 8, !tbaa !11
  %282 = load i32, ptr %14, align 4, !tbaa !9
  %283 = sext i32 %282 to i64
  %284 = getelementptr inbounds [6 x %struct.DERIV_TYPE], ptr %19, i64 0, i64 %283
  %285 = getelementptr inbounds %struct.DERIV_TYPE, ptr %284, i32 0, i32 1
  %286 = getelementptr inbounds [3 x double], ptr %285, i64 0, i64 2
  %287 = load double, ptr %286, align 8, !tbaa !11
  %288 = load ptr, ptr %11, align 8, !tbaa !5
  %289 = load i32, ptr %14, align 4, !tbaa !9
  %290 = sext i32 %289 to i64
  %291 = getelementptr inbounds ptr, ptr %288, i64 %290
  %292 = load ptr, ptr %291, align 8, !tbaa !5
  %293 = getelementptr inbounds double, ptr %292, i64 2
  store double %287, ptr %293, align 8, !tbaa !11
  br label %294

294:                                              ; preds = %257
  %295 = load i32, ptr %14, align 4, !tbaa !9
  %296 = add nsw i32 %295, 1
  store i32 %296, ptr %14, align 4, !tbaa !9
  br label %254, !llvm.loop !29

297:                                              ; preds = %254
  store i32 0, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 192, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 96, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 96, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 96, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 96, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  ret i32 0
}

declare i32 @g_ad_vCosineDihedrals(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { 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 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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
attributes #6 = { 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, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!14, !12, i64 0}
!14 = !{!"DERIV_TYPE", !12, i64 0, !7, i64 8}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !16}
!20 = distinct !{!20, !16}
!21 = distinct !{!21, !16}
!22 = distinct !{!22, !16}
!23 = distinct !{!23, !16}
!24 = distinct !{!24, !16}
!25 = distinct !{!25, !16}
!26 = distinct !{!26, !16}
!27 = distinct !{!27, !16}
!28 = distinct !{!28, !16}
!29 = distinct !{!29, !16}


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

%struct.DERIV_TYPE = type { double, [3 x double] }

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

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

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @vGradCosineDihedrals(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, ptr nocapture noundef readonly %2, ptr nocapture noundef readonly %3, ptr nocapture noundef readonly %4, ptr noundef %5) local_unnamed_addr #1 {
.preheader91.preheader:
  %6 = alloca [3 x %struct.DERIV_TYPE], align 16
  %7 = alloca [3 x %struct.DERIV_TYPE], align 16
  %8 = alloca [3 x %struct.DERIV_TYPE], align 16
  %9 = alloca [3 x %struct.DERIV_TYPE], align 16
  %10 = alloca [6 x %struct.DERIV_TYPE], align 16
  call void @llvm.lifetime.start.p0(i64 96, ptr nonnull %6) #4
  call void @llvm.lifetime.start.p0(i64 96, ptr nonnull %7) #4
  call void @llvm.lifetime.start.p0(i64 96, ptr nonnull %8) #4
  call void @llvm.lifetime.start.p0(i64 96, ptr nonnull %9) #4
  call void @llvm.lifetime.start.p0(i64 192, ptr nonnull %10) #4
  %11 = load double, ptr %0, align 8, !tbaa !5
  store double %11, ptr %6, align 16, !tbaa !9
  %12 = getelementptr inbounds i8, ptr %0, i64 8
  %13 = load double, ptr %12, align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %6, i64 32
  store double %13, ptr %14, align 16, !tbaa !9
  %15 = getelementptr inbounds i8, ptr %0, i64 16
  %16 = load double, ptr %15, align 8, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %6, i64 64
  store double %16, ptr %17, align 16, !tbaa !9
  %18 = load double, ptr %1, align 8, !tbaa !5
  store double %18, ptr %7, align 16, !tbaa !9
  %19 = getelementptr inbounds i8, ptr %1, i64 8
  %20 = load double, ptr %19, align 8, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %7, i64 32
  store double %20, ptr %21, align 16, !tbaa !9
  %22 = getelementptr inbounds i8, ptr %1, i64 16
  %23 = load double, ptr %22, align 8, !tbaa !5
  %24 = getelementptr inbounds i8, ptr %7, i64 64
  store double %23, ptr %24, align 16, !tbaa !9
  %25 = load double, ptr %2, align 8, !tbaa !5
  store double %25, ptr %8, align 16, !tbaa !9
  %26 = getelementptr inbounds i8, ptr %2, i64 8
  %27 = load double, ptr %26, align 8, !tbaa !5
  %28 = getelementptr inbounds i8, ptr %8, i64 32
  store double %27, ptr %28, align 16, !tbaa !9
  %29 = getelementptr inbounds i8, ptr %2, i64 16
  %30 = load double, ptr %29, align 8, !tbaa !5
  %31 = getelementptr inbounds i8, ptr %8, i64 64
  store double %30, ptr %31, align 16, !tbaa !9
  %32 = load double, ptr %3, align 8, !tbaa !5
  store double %32, ptr %9, align 16, !tbaa !9
  %33 = getelementptr inbounds i8, ptr %3, i64 8
  %34 = load double, ptr %33, align 8, !tbaa !5
  %35 = getelementptr inbounds i8, ptr %9, i64 32
  store double %34, ptr %35, align 16, !tbaa !9
  %36 = getelementptr inbounds i8, ptr %3, i64 16
  %37 = load double, ptr %36, align 8, !tbaa !5
  %38 = getelementptr inbounds i8, ptr %9, i64 64
  store double %37, ptr %38, align 16, !tbaa !9
  %scevgep = getelementptr inbounds i8, ptr %6, i64 8
  %39 = getelementptr inbounds i8, ptr %6, i64 16
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(24) %39, i8 0, i64 16, i1 false), !tbaa !5
  %scevgep.1 = getelementptr inbounds i8, ptr %6, i64 40
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %scevgep.1, i8 0, i64 24, i1 false), !tbaa !5
  %scevgep.2 = getelementptr inbounds i8, ptr %6, i64 72
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %scevgep.2, i8 0, i64 16, i1 false), !tbaa !5
  %scevgep112 = getelementptr inbounds i8, ptr %7, i64 8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %scevgep112, i8 0, i64 24, i1 false), !tbaa !5
  %scevgep112.1 = getelementptr inbounds i8, ptr %7, i64 40
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %scevgep112.1, i8 0, i64 24, i1 false), !tbaa !5
  %scevgep112.2 = getelementptr inbounds i8, ptr %7, i64 72
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %scevgep112.2, i8 0, i64 24, i1 false), !tbaa !5
  %scevgep115 = getelementptr inbounds i8, ptr %8, i64 8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %scevgep115, i8 0, i64 24, i1 false), !tbaa !5
  %scevgep115.1 = getelementptr inbounds i8, ptr %8, i64 40
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %scevgep115.1, i8 0, i64 24, i1 false), !tbaa !5
  %scevgep115.2 = getelementptr inbounds i8, ptr %8, i64 72
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %scevgep115.2, i8 0, i64 24, i1 false), !tbaa !5
  %scevgep118 = getelementptr inbounds i8, ptr %9, i64 8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %scevgep118, i8 0, i64 24, i1 false), !tbaa !5
  %scevgep118.1 = getelementptr inbounds i8, ptr %9, i64 40
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %scevgep118.1, i8 0, i64 24, i1 false), !tbaa !5
  %scevgep118.2 = getelementptr inbounds i8, ptr %9, i64 72
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %scevgep118.2, i8 0, i64 24, i1 false), !tbaa !5
  store double 1.000000e+00, ptr %scevgep, align 8, !tbaa !5
  %40 = getelementptr inbounds i8, ptr %6, i64 48
  store double 1.000000e+00, ptr %40, align 16, !tbaa !5
  %41 = getelementptr inbounds i8, ptr %6, i64 88
  store double 1.000000e+00, ptr %41, align 8, !tbaa !5
  %42 = call i32 @g_ad_vCosineDihedrals(ptr noundef nonnull %6, ptr noundef nonnull %7, ptr noundef nonnull %8, ptr noundef nonnull %9, ptr noundef nonnull %10, ptr noundef %5) #4
  %43 = getelementptr inbounds i8, ptr %10, i64 8
  %44 = load double, ptr %43, align 8, !tbaa !5
  %45 = load ptr, ptr %4, align 8, !tbaa !11
  store double %44, ptr %45, align 8, !tbaa !5
  %46 = getelementptr inbounds i8, ptr %10, i64 16
  %47 = load double, ptr %46, align 16, !tbaa !5
  %48 = getelementptr inbounds i8, ptr %45, i64 8
  store double %47, ptr %48, align 8, !tbaa !5
  %49 = getelementptr inbounds i8, ptr %10, i64 24
  %50 = load double, ptr %49, align 8, !tbaa !5
  %51 = getelementptr inbounds i8, ptr %45, i64 16
  store double %50, ptr %51, align 8, !tbaa !5
  %52 = getelementptr inbounds i8, ptr %10, i64 40
  %53 = load double, ptr %52, align 8, !tbaa !5
  %54 = getelementptr inbounds i8, ptr %4, i64 8
  %55 = load ptr, ptr %54, align 8, !tbaa !11
  store double %53, ptr %55, align 8, !tbaa !5
  %56 = getelementptr inbounds i8, ptr %10, i64 48
  %57 = load double, ptr %56, align 16, !tbaa !5
  %58 = getelementptr inbounds i8, ptr %55, i64 8
  store double %57, ptr %58, align 8, !tbaa !5
  %59 = getelementptr inbounds i8, ptr %10, i64 56
  %60 = load double, ptr %59, align 8, !tbaa !5
  %61 = getelementptr inbounds i8, ptr %55, i64 16
  store double %60, ptr %61, align 8, !tbaa !5
  %62 = getelementptr inbounds i8, ptr %10, i64 72
  %63 = load double, ptr %62, align 8, !tbaa !5
  %64 = getelementptr inbounds i8, ptr %4, i64 16
  %65 = load ptr, ptr %64, align 8, !tbaa !11
  store double %63, ptr %65, align 8, !tbaa !5
  %66 = getelementptr inbounds i8, ptr %10, i64 80
  %67 = load double, ptr %66, align 16, !tbaa !5
  %68 = getelementptr inbounds i8, ptr %65, i64 8
  store double %67, ptr %68, align 8, !tbaa !5
  %69 = getelementptr inbounds i8, ptr %10, i64 88
  %70 = load double, ptr %69, align 8, !tbaa !5
  %71 = getelementptr inbounds i8, ptr %65, i64 16
  store double %70, ptr %71, align 8, !tbaa !5
  %72 = getelementptr inbounds i8, ptr %10, i64 104
  %73 = load double, ptr %72, align 8, !tbaa !5
  %74 = getelementptr inbounds i8, ptr %4, i64 24
  %75 = load ptr, ptr %74, align 8, !tbaa !11
  store double %73, ptr %75, align 8, !tbaa !5
  %76 = getelementptr inbounds i8, ptr %10, i64 112
  %77 = load double, ptr %76, align 16, !tbaa !5
  %78 = getelementptr inbounds i8, ptr %75, i64 8
  store double %77, ptr %78, align 8, !tbaa !5
  %79 = getelementptr inbounds i8, ptr %10, i64 120
  %80 = load double, ptr %79, align 8, !tbaa !5
  %81 = getelementptr inbounds i8, ptr %75, i64 16
  store double %80, ptr %81, align 8, !tbaa !5
  %82 = getelementptr inbounds i8, ptr %10, i64 136
  %83 = load double, ptr %82, align 8, !tbaa !5
  %84 = getelementptr inbounds i8, ptr %4, i64 32
  %85 = load ptr, ptr %84, align 8, !tbaa !11
  store double %83, ptr %85, align 8, !tbaa !5
  %86 = getelementptr inbounds i8, ptr %10, i64 144
  %87 = load double, ptr %86, align 16, !tbaa !5
  %88 = getelementptr inbounds i8, ptr %85, i64 8
  store double %87, ptr %88, align 8, !tbaa !5
  %89 = getelementptr inbounds i8, ptr %10, i64 152
  %90 = load double, ptr %89, align 8, !tbaa !5
  %91 = getelementptr inbounds i8, ptr %85, i64 16
  store double %90, ptr %91, align 8, !tbaa !5
  %92 = getelementptr inbounds i8, ptr %10, i64 168
  %93 = load double, ptr %92, align 8, !tbaa !5
  %94 = getelementptr inbounds i8, ptr %4, i64 40
  %95 = load ptr, ptr %94, align 8, !tbaa !11
  store double %93, ptr %95, align 8, !tbaa !5
  %96 = getelementptr inbounds i8, ptr %10, i64 176
  %97 = load double, ptr %96, align 16, !tbaa !5
  %98 = getelementptr inbounds i8, ptr %95, i64 8
  store double %97, ptr %98, align 8, !tbaa !5
  %99 = getelementptr inbounds i8, ptr %10, i64 184
  %100 = load double, ptr %99, align 8, !tbaa !5
  %101 = getelementptr inbounds i8, ptr %95, i64 16
  store double %100, ptr %101, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 192, ptr nonnull %10) #4
  call void @llvm.lifetime.end.p0(i64 96, ptr nonnull %9) #4
  call void @llvm.lifetime.end.p0(i64 96, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 96, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 96, ptr nonnull %6) #4
  ret i32 0
}

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

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


; Effective O3 passes: DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopIdiomRecognizePass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass