; LLVM IR from Dynmi/AlexNet :: src (alexnet)

; 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.network = type { ptr, ptr, i16, %struct.conv_op, %struct.batch_norm_op, %struct.nonlinear_op, %struct.max_pooling_op, %struct.conv_op, %struct.batch_norm_op, %struct.nonlinear_op, %struct.max_pooling_op, %struct.conv_op, %struct.batch_norm_op, %struct.nonlinear_op, %struct.conv_op, %struct.batch_norm_op, %struct.nonlinear_op, %struct.conv_op, %struct.batch_norm_op, %struct.nonlinear_op, %struct.max_pooling_op, %struct.fc_op, %struct.nonlinear_op, %struct.fc_op, %struct.nonlinear_op, %struct.fc_op }
%struct.conv_op = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i16 }
%struct.batch_norm_op = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i16, ptr, ptr, ptr }
%struct.max_pooling_op = type { ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i16 }
%struct.nonlinear_op = type { ptr, ptr, ptr, ptr, i32, i16 }
%struct.fc_op = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i16 }

@main.net = external hidden global %struct.network, align 8
@.str.7 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [29 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

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

; Function Attrs: nounwind uwtable
declare dso_local void @malloc_alexnet(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @free_alexnet(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @save_alexnet(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @setup_alexnet(ptr noundef, i16 noundef signext) #2

; Function Attrs: nounwind uwtable
declare dso_local void @alexnet_init_weights(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #2 {
  %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 i16, align 2
  %9 = alloca i16, align 2
  %10 = alloca [256 x i8], align 16
  %11 = alloca [256 x i8], align 16
  %12 = alloca i32, align 4
  %13 = alloca [256 x i8], align 16
  %14 = alloca [256 x i8], align 16
  %15 = 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
  %16 = load ptr, ptr %5, align 8, !tbaa !9
  %17 = getelementptr inbounds ptr, ptr %16, i64 1
  %18 = load ptr, ptr %17, align 8, !tbaa !9
  %19 = call i32 @strcmp(ptr noundef %18, ptr noundef @.str.7) #5
  %20 = icmp eq i32 0, %19
  br i1 %20, label %21, label %117

21:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 8, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 1000, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 2, ptr %8) #6
  store i16 0, ptr %8, align 2, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 2, ptr %9) #6
  store i16 0, ptr %9, align 2, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 256, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 256, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 2, ptr %12, align 4, !tbaa !5
  br label %22

22:                                               ; preds = %95, %21
  %23 = load i32, ptr %12, align 4, !tbaa !5
  %24 = load i32, ptr %4, align 4, !tbaa !5
  %25 = sub nsw i32 %24, 1
  %26 = icmp slt i32 %23, %25
  br i1 %26, label %28, label %27

27:                                               ; preds = %22
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %98

28:                                               ; preds = %22
  %29 = load ptr, ptr %5, align 8, !tbaa !9
  %30 = load i32, ptr %12, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds ptr, ptr %29, i64 %31
  %33 = load ptr, ptr %32, align 8, !tbaa !9
  %34 = call i32 @strcmp(ptr noundef %33, ptr noundef @.str.8) #5
  %35 = icmp eq i32 0, %34
  br i1 %35, label %36, label %44

36:                                               ; preds = %28
  %37 = load ptr, ptr %5, align 8, !tbaa !9
  %38 = load i32, ptr %12, align 4, !tbaa !5
  %39 = add nsw i32 %38, 1
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds ptr, ptr %37, i64 %40
  %42 = load ptr, ptr %41, align 8, !tbaa !9
  %43 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %42, ptr noundef @.str.9, ptr noundef %6) #6
  br label %44

44:                                               ; preds = %36, %28
  %45 = load ptr, ptr %5, align 8, !tbaa !9
  %46 = load i32, ptr %12, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds ptr, ptr %45, i64 %47
  %49 = load ptr, ptr %48, align 8, !tbaa !9
  %50 = call i32 @strcmp(ptr noundef %49, ptr noundef @.str.10) #5
  %51 = icmp eq i32 0, %50
  br i1 %51, label %52, label %60

52:                                               ; preds = %44
  %53 = load ptr, ptr %5, align 8, !tbaa !9
  %54 = load i32, ptr %12, align 4, !tbaa !5
  %55 = add nsw i32 %54, 1
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds ptr, ptr %53, i64 %56
  %58 = load ptr, ptr %57, align 8, !tbaa !9
  %59 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %58, ptr noundef @.str.9, ptr noundef %7) #6
  br label %60

60:                                               ; preds = %52, %44
  %61 = load ptr, ptr %5, align 8, !tbaa !9
  %62 = load i32, ptr %12, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds ptr, ptr %61, i64 %63
  %65 = load ptr, ptr %64, align 8, !tbaa !9
  %66 = call i32 @strcmp(ptr noundef %65, ptr noundef @.str.11) #5
  %67 = icmp eq i32 0, %66
  br i1 %67, label %68, label %77

68:                                               ; preds = %60
  store i16 1, ptr %9, align 2, !tbaa !11
  %69 = getelementptr inbounds [256 x i8], ptr %10, i64 0, i64 0
  %70 = load ptr, ptr %5, align 8, !tbaa !9
  %71 = load i32, ptr %12, align 4, !tbaa !5
  %72 = add nsw i32 %71, 1
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds ptr, ptr %70, i64 %73
  %75 = load ptr, ptr %74, align 8, !tbaa !9
  %76 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %69, ptr noundef @.str.12, ptr noundef %75) #6
  br label %77

77:                                               ; preds = %68, %60
  %78 = load ptr, ptr %5, align 8, !tbaa !9
  %79 = load i32, ptr %12, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds ptr, ptr %78, i64 %80
  %82 = load ptr, ptr %81, align 8, !tbaa !9
  %83 = call i32 @strcmp(ptr noundef %82, ptr noundef @.str.13) #5
  %84 = icmp eq i32 0, %83
  br i1 %84, label %85, label %94

85:                                               ; preds = %77
  store i16 1, ptr %8, align 2, !tbaa !11
  %86 = getelementptr inbounds [256 x i8], ptr %11, i64 0, i64 0
  %87 = load ptr, ptr %5, align 8, !tbaa !9
  %88 = load i32, ptr %12, align 4, !tbaa !5
  %89 = add nsw i32 %88, 1
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds ptr, ptr %87, i64 %90
  %92 = load ptr, ptr %91, align 8, !tbaa !9
  %93 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %86, ptr noundef @.str.12, ptr noundef %92) #6
  br label %94

94:                                               ; preds = %85, %77
  br label %95

95:                                               ; preds = %94
  %96 = load i32, ptr %12, align 4, !tbaa !5
  %97 = add nsw i32 %96, 1
  store i32 %97, ptr %12, align 4, !tbaa !5
  br label %22, !llvm.loop !13

98:                                               ; preds = %27
  %99 = load i32, ptr %6, align 4, !tbaa !5
  %100 = call i32 (ptr, ...) @printf(ptr noundef @.str.14, i32 noundef %99)
  %101 = load i32, ptr %7, align 4, !tbaa !5
  %102 = call i32 (ptr, ...) @printf(ptr noundef @.str.15, i32 noundef %101)
  %103 = load i32, ptr %6, align 4, !tbaa !5
  %104 = trunc i32 %103 to i16
  call void @setup_alexnet(ptr noundef @main.net, i16 noundef signext %104)
  call void @malloc_alexnet(ptr noundef @main.net)
  %105 = load i16, ptr %9, align 2, !tbaa !11
  %106 = icmp ne i16 %105, 0
  br i1 %106, label %107, label %109

107:                                              ; preds = %98
  %108 = getelementptr inbounds [256 x i8], ptr %10, i64 0, i64 0
  call void @alexnet_init_weights(ptr noundef @main.net, ptr noundef %108)
  br label %110

109:                                              ; preds = %98
  call void @alexnet_init_weights(ptr noundef @main.net, ptr noundef null)
  br label %110

110:                                              ; preds = %109, %107
  %111 = load i32, ptr %7, align 4, !tbaa !5
  call void @alexnet_train(ptr noundef @main.net, i32 noundef %111)
  %112 = load i16, ptr %8, align 2, !tbaa !11
  %113 = icmp ne i16 %112, 0
  br i1 %113, label %114, label %116

114:                                              ; preds = %110
  %115 = getelementptr inbounds [256 x i8], ptr %11, i64 0, i64 0
  call void @save_alexnet(ptr noundef @main.net, ptr noundef %115)
  br label %116

116:                                              ; preds = %114, %110
  call void @free_alexnet(ptr noundef @main.net)
  call void @llvm.lifetime.end.p0(i64 256, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 256, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 2, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 2, 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 %177

117:                                              ; preds = %2
  %118 = load ptr, ptr %5, align 8, !tbaa !9
  %119 = getelementptr inbounds ptr, ptr %118, i64 1
  %120 = load ptr, ptr %119, align 8, !tbaa !9
  %121 = call i32 @strcmp(ptr noundef %120, ptr noundef @.str.16) #5
  %122 = icmp eq i32 0, %121
  br i1 %122, label %123, label %174

123:                                              ; preds = %117
  call void @llvm.lifetime.start.p0(i64 256, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 256, ptr %14) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  store i32 2, ptr %15, align 4, !tbaa !5
  br label %124

124:                                              ; preds = %165, %123
  %125 = load i32, ptr %15, align 4, !tbaa !5
  %126 = load i32, ptr %4, align 4, !tbaa !5
  %127 = sub nsw i32 %126, 1
  %128 = icmp slt i32 %125, %127
  br i1 %128, label %130, label %129

129:                                              ; preds = %124
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  br label %168

130:                                              ; preds = %124
  %131 = load ptr, ptr %5, align 8, !tbaa !9
  %132 = load i32, ptr %15, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds ptr, ptr %131, i64 %133
  %135 = load ptr, ptr %134, align 8, !tbaa !9
  %136 = call i32 @strcmp(ptr noundef %135, ptr noundef @.str.17) #5
  %137 = icmp eq i32 0, %136
  br i1 %137, label %138, label %147

138:                                              ; preds = %130
  %139 = getelementptr inbounds [256 x i8], ptr %13, i64 0, i64 0
  %140 = load ptr, ptr %5, align 8, !tbaa !9
  %141 = load i32, ptr %15, align 4, !tbaa !5
  %142 = add nsw i32 %141, 1
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds ptr, ptr %140, i64 %143
  %145 = load ptr, ptr %144, align 8, !tbaa !9
  %146 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %139, ptr noundef @.str.12, ptr noundef %145) #6
  br label %147

147:                                              ; preds = %138, %130
  %148 = load ptr, ptr %5, align 8, !tbaa !9
  %149 = load i32, ptr %15, align 4, !tbaa !5
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds ptr, ptr %148, i64 %150
  %152 = load ptr, ptr %151, align 8, !tbaa !9
  %153 = call i32 @strcmp(ptr noundef %152, ptr noundef @.str.18) #5
  %154 = icmp eq i32 0, %153
  br i1 %154, label %155, label %164

155:                                              ; preds = %147
  %156 = getelementptr inbounds [256 x i8], ptr %14, i64 0, i64 0
  %157 = load ptr, ptr %5, align 8, !tbaa !9
  %158 = load i32, ptr %15, align 4, !tbaa !5
  %159 = add nsw i32 %158, 1
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds ptr, ptr %157, i64 %160
  %162 = load ptr, ptr %161, align 8, !tbaa !9
  %163 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %156, ptr noundef @.str.12, ptr noundef %162) #6
  br label %164

164:                                              ; preds = %155, %147
  br label %165

165:                                              ; preds = %164
  %166 = load i32, ptr %15, align 4, !tbaa !5
  %167 = add nsw i32 %166, 1
  store i32 %167, ptr %15, align 4, !tbaa !5
  br label %124, !llvm.loop !15

168:                                              ; preds = %129
  call void @setup_alexnet(ptr noundef @main.net, i16 noundef signext 1)
  call void @malloc_alexnet(ptr noundef @main.net)
  %169 = getelementptr inbounds [256 x i8], ptr %14, i64 0, i64 0
  call void @alexnet_init_weights(ptr noundef @main.net, ptr noundef %169)
  %170 = call i32 (ptr, ...) @printf(ptr noundef @.str.19)
  %171 = load ptr, ptr %5, align 8, !tbaa !9
  %172 = getelementptr inbounds ptr, ptr %171, i64 2
  %173 = load ptr, ptr %172, align 8, !tbaa !9
  call void @alexnet_inference(ptr noundef @main.net, ptr noundef %173)
  call void @free_alexnet(ptr noundef @main.net)
  call void @llvm.lifetime.end.p0(i64 256, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 256, ptr %13) #6
  br label %176

174:                                              ; preds = %117
  %175 = call i32 (ptr, ...) @printf(ptr noundef @.str.20)
  br label %176

176:                                              ; preds = %174, %168
  br label %177

177:                                              ; preds = %176, %116
  %178 = load i32, ptr %3, align 4
  ret i32 %178
}

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #3

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

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

declare void @alexnet_train(ptr noundef, i32 noundef) #1

declare void @alexnet_inference(ptr noundef, ptr noundef) #1

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 = { nounwind willreturn memory(read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind willreturn memory(read) }
attributes #6 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


; 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.network = type { ptr, ptr, i16, %struct.conv_op, %struct.batch_norm_op, %struct.nonlinear_op, %struct.max_pooling_op, %struct.conv_op, %struct.batch_norm_op, %struct.nonlinear_op, %struct.max_pooling_op, %struct.conv_op, %struct.batch_norm_op, %struct.nonlinear_op, %struct.conv_op, %struct.batch_norm_op, %struct.nonlinear_op, %struct.conv_op, %struct.batch_norm_op, %struct.nonlinear_op, %struct.max_pooling_op, %struct.fc_op, %struct.nonlinear_op, %struct.fc_op, %struct.nonlinear_op, %struct.fc_op }
%struct.conv_op = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i16 }
%struct.batch_norm_op = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i16, ptr, ptr, ptr }
%struct.max_pooling_op = type { ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i16 }
%struct.nonlinear_op = type { ptr, ptr, ptr, ptr, i32, i16 }
%struct.fc_op = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i16 }

@main.net = external hidden global %struct.network, align 8
@.str.7 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [29 x i8], align 1

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @malloc_alexnet(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local void @free_alexnet(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local void @save_alexnet(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local void @setup_alexnet(ptr noundef, i16 noundef signext) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local void @alexnet_init_weights(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #2 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca [256 x i8], align 16
  %6 = alloca [256 x i8], align 16
  %7 = alloca [256 x i8], align 16
  %8 = alloca [256 x i8], align 16
  %9 = getelementptr inbounds i8, ptr %1, i64 8
  %10 = load ptr, ptr %9, align 8, !tbaa !5
  %11 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %10, ptr noundef nonnull dereferenceable(1) @.str.7) #5
  %12 = icmp eq i32 %11, 0
  br i1 %12, label %13, label %63

13:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  store i32 8, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  store i32 1000, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %6) #6
  %14 = icmp sgt i32 %0, 3
  br i1 %14, label %.lr.ph45.preheader, label %._crit_edge46

.lr.ph45.preheader:                               ; preds = %13
  %15 = add nsw i32 %0, -1
  %wide.trip.count51 = zext nneg i32 %15 to i64
  br label %.lr.ph45

._crit_edge46.loopexit:                           ; preds = %56
  %.pre56 = load i32, ptr %3, align 4, !tbaa !9
  %16 = icmp eq i16 %.1, 0
  %17 = icmp eq i16 %.138, 0
  br label %._crit_edge46

._crit_edge46:                                    ; preds = %._crit_edge46.loopexit, %13
  %18 = phi i32 [ 8, %13 ], [ %.pre56, %._crit_edge46.loopexit ]
  %.037.lcssa = phi i1 [ true, %13 ], [ %17, %._crit_edge46.loopexit ]
  %.036.lcssa = phi i1 [ true, %13 ], [ %16, %._crit_edge46.loopexit ]
  %19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.14, i32 noundef %18)
  %20 = load i32, ptr %4, align 4, !tbaa !9
  %21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.15, i32 noundef %20)
  %22 = load i32, ptr %3, align 4, !tbaa !9
  %23 = trunc i32 %22 to i16
  call void @setup_alexnet(ptr noundef nonnull @main.net, i16 noundef signext %23)
  call void @malloc_alexnet(ptr noundef nonnull @main.net)
  br i1 %.036.lcssa, label %58, label %57

.lr.ph45:                                         ; preds = %.lr.ph45.preheader, %56
  %indvars.iv49 = phi i64 [ 2, %.lr.ph45.preheader ], [ %indvars.iv.next50, %56 ]
  %.03642 = phi i16 [ 0, %.lr.ph45.preheader ], [ %.1, %56 ]
  %.03741 = phi i16 [ 0, %.lr.ph45.preheader ], [ %.138, %56 ]
  %24 = getelementptr inbounds ptr, ptr %1, i64 %indvars.iv49
  %25 = load ptr, ptr %24, align 8, !tbaa !5
  %26 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %25, ptr noundef nonnull dereferenceable(1) @.str.8) #5
  %27 = icmp eq i32 %26, 0
  br i1 %27, label %28, label %32

28:                                               ; preds = %.lr.ph45
  %29 = getelementptr inbounds i8, ptr %24, i64 8
  %30 = load ptr, ptr %29, align 8, !tbaa !5
  %31 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %30, ptr noundef nonnull @.str.9, ptr noundef nonnull %3) #6
  %.pre53 = load ptr, ptr %24, align 8, !tbaa !5
  br label %32

32:                                               ; preds = %28, %.lr.ph45
  %33 = phi ptr [ %.pre53, %28 ], [ %25, %.lr.ph45 ]
  %34 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %33, ptr noundef nonnull dereferenceable(1) @.str.10) #5
  %35 = icmp eq i32 %34, 0
  br i1 %35, label %36, label %40

36:                                               ; preds = %32
  %37 = getelementptr inbounds i8, ptr %24, i64 8
  %38 = load ptr, ptr %37, align 8, !tbaa !5
  %39 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %38, ptr noundef nonnull @.str.9, ptr noundef nonnull %4) #6
  %.pre54 = load ptr, ptr %24, align 8, !tbaa !5
  br label %40

40:                                               ; preds = %36, %32
  %41 = phi ptr [ %.pre54, %36 ], [ %33, %32 ]
  %42 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %41, ptr noundef nonnull dereferenceable(1) @.str.11) #5
  %43 = icmp eq i32 %42, 0
  br i1 %43, label %44, label %48

44:                                               ; preds = %40
  %45 = getelementptr inbounds i8, ptr %24, i64 8
  %46 = load ptr, ptr %45, align 8, !tbaa !5
  %47 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %5, ptr noundef nonnull dereferenceable(1) @.str.12, ptr noundef %46) #6
  %.pre55 = load ptr, ptr %24, align 8, !tbaa !5
  br label %48

48:                                               ; preds = %44, %40
  %49 = phi ptr [ %.pre55, %44 ], [ %41, %40 ]
  %.1 = phi i16 [ 1, %44 ], [ %.03642, %40 ]
  %50 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %49, ptr noundef nonnull dereferenceable(1) @.str.13) #5
  %51 = icmp eq i32 %50, 0
  br i1 %51, label %52, label %56

52:                                               ; preds = %48
  %53 = getelementptr inbounds i8, ptr %24, i64 8
  %54 = load ptr, ptr %53, align 8, !tbaa !5
  %55 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %6, ptr noundef nonnull dereferenceable(1) @.str.12, ptr noundef %54) #6
  br label %56

56:                                               ; preds = %48, %52
  %.138 = phi i16 [ 1, %52 ], [ %.03741, %48 ]
  %indvars.iv.next50 = add nuw nsw i64 %indvars.iv49, 1
  %exitcond52.not = icmp eq i64 %indvars.iv.next50, %wide.trip.count51
  br i1 %exitcond52.not, label %._crit_edge46.loopexit, label %.lr.ph45, !llvm.loop !11

57:                                               ; preds = %._crit_edge46
  call void @alexnet_init_weights(ptr noundef nonnull @main.net, ptr noundef nonnull %5)
  br label %59

58:                                               ; preds = %._crit_edge46
  call void @alexnet_init_weights(ptr noundef nonnull @main.net, ptr noundef null)
  br label %59

59:                                               ; preds = %58, %57
  %60 = load i32, ptr %4, align 4, !tbaa !9
  call void @alexnet_train(ptr noundef nonnull @main.net, i32 noundef %60) #6
  br i1 %.037.lcssa, label %62, label %61

61:                                               ; preds = %59
  call void @save_alexnet(ptr noundef nonnull @main.net, ptr noundef nonnull %6)
  br label %62

62:                                               ; preds = %61, %59
  call void @free_alexnet(ptr noundef nonnull @main.net)
  call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  br label %91

63:                                               ; preds = %2
  %64 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %10, ptr noundef nonnull dereferenceable(1) @.str.16) #5
  %65 = icmp eq i32 %64, 0
  br i1 %65, label %66, label %89

66:                                               ; preds = %63
  call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %7) #6
  call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %8) #6
  %67 = icmp sgt i32 %0, 3
  br i1 %67, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %66
  %68 = add nsw i32 %0, -1
  %wide.trip.count = zext nneg i32 %68 to i64
  br label %.lr.ph

._crit_edge:                                      ; preds = %88, %66
  tail call void @setup_alexnet(ptr noundef nonnull @main.net, i16 noundef signext 1)
  tail call void @malloc_alexnet(ptr noundef nonnull @main.net)
  call void @alexnet_init_weights(ptr noundef nonnull @main.net, ptr noundef nonnull %8)
  %69 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.19)
  %70 = getelementptr inbounds i8, ptr %1, i64 16
  %71 = load ptr, ptr %70, align 8, !tbaa !5
  call void @alexnet_inference(ptr noundef nonnull @main.net, ptr noundef %71) #6
  call void @free_alexnet(ptr noundef nonnull @main.net)
  call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %7) #6
  br label %91

.lr.ph:                                           ; preds = %.lr.ph.preheader, %88
  %indvars.iv = phi i64 [ 2, %.lr.ph.preheader ], [ %indvars.iv.next, %88 ]
  %72 = getelementptr inbounds ptr, ptr %1, i64 %indvars.iv
  %73 = load ptr, ptr %72, align 8, !tbaa !5
  %74 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %73, ptr noundef nonnull dereferenceable(1) @.str.17) #5
  %75 = icmp eq i32 %74, 0
  br i1 %75, label %76, label %80

76:                                               ; preds = %.lr.ph
  %77 = getelementptr inbounds i8, ptr %72, i64 8
  %78 = load ptr, ptr %77, align 8, !tbaa !5
  %79 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %7, ptr noundef nonnull dereferenceable(1) @.str.12, ptr noundef %78) #6
  %.pre = load ptr, ptr %72, align 8, !tbaa !5
  br label %80

80:                                               ; preds = %76, %.lr.ph
  %81 = phi ptr [ %.pre, %76 ], [ %73, %.lr.ph ]
  %82 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %81, ptr noundef nonnull dereferenceable(1) @.str.18) #5
  %83 = icmp eq i32 %82, 0
  br i1 %83, label %84, label %88

84:                                               ; preds = %80
  %85 = getelementptr inbounds i8, ptr %72, i64 8
  %86 = load ptr, ptr %85, align 8, !tbaa !5
  %87 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %8, ptr noundef nonnull dereferenceable(1) @.str.12, ptr noundef %86) #6
  br label %88

88:                                               ; preds = %80, %84
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !13

89:                                               ; preds = %63
  %90 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.20)
  br label %91

91:                                               ; preds = %._crit_edge, %89, %62
  ret i32 0
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3

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

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

declare void @alexnet_train(ptr noundef, i32 noundef) local_unnamed_addr #4

declare void @alexnet_inference(ptr noundef, ptr noundef) local_unnamed_addr #4

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 willreturn memory(read) }
attributes #6 = { 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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass