; LLVM IR from jgaeddert/liquid-dsp :: examples (gasearch_knapsack_example)

; 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.knapsack_s = type { i32, ptr, ptr, float }

@.str.7 = external hidden unnamed_addr constant [13 x i8], align 1
@optarg = external global ptr, align 8
@stderr = external global ptr, align 8
@.str.8 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [56 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [57 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [24 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @usage() #0

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

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca float, align 4
  %9 = alloca i32, align 4
  %10 = alloca float, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca %struct.knapsack_s, align 8
  %15 = alloca ptr, align 8
  %16 = alloca float, align 4
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  store i32 1000, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store i32 2000, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store float 2.000000e+01, ptr %8, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  store i32 100, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  store float 0x3FD99999A0000000, ptr %10, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  br label %19

19:                                               ; preds = %45, %2
  %20 = load i32, ptr %4, align 4, !tbaa !5
  %21 = load ptr, ptr %5, align 8, !tbaa !9
  %22 = call i32 @getopt(i32 noundef %20, ptr noundef %21, ptr noundef @.str.7) #7
  store i32 %22, ptr %11, align 4, !tbaa !5
  %23 = icmp ne i32 %22, -1
  br i1 %23, label %24, label %46

24:                                               ; preds = %19
  %25 = load i32, ptr %11, align 4, !tbaa !5
  switch i32 %25, label %44 [
    i32 104, label %26
    i32 117, label %26
    i32 110, label %27
    i32 105, label %30
    i32 99, label %33
    i32 112, label %37
    i32 109, label %40
  ]

26:                                               ; preds = %24, %24
  call void @usage()
  store i32 0, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %203

27:                                               ; preds = %24
  %28 = load ptr, ptr @optarg, align 8, !tbaa !9
  %29 = call i32 @atoi(ptr noundef %28) #8
  store i32 %29, ptr %6, align 4, !tbaa !5
  br label %45

30:                                               ; preds = %24
  %31 = load ptr, ptr @optarg, align 8, !tbaa !9
  %32 = call i32 @atoi(ptr noundef %31) #8
  store i32 %32, ptr %7, align 4, !tbaa !5
  br label %45

33:                                               ; preds = %24
  %34 = load ptr, ptr @optarg, align 8, !tbaa !9
  %35 = call double @atof(ptr noundef %34) #8
  %36 = fptrunc double %35 to float
  store float %36, ptr %8, align 4, !tbaa !11
  br label %45

37:                                               ; preds = %24
  %38 = load ptr, ptr @optarg, align 8, !tbaa !9
  %39 = call i32 @atoi(ptr noundef %38) #8
  store i32 %39, ptr %9, align 4, !tbaa !5
  br label %45

40:                                               ; preds = %24
  %41 = load ptr, ptr @optarg, align 8, !tbaa !9
  %42 = call double @atof(ptr noundef %41) #8
  %43 = fptrunc double %42 to float
  store float %43, ptr %10, align 4, !tbaa !11
  br label %45

44:                                               ; preds = %24
  call void @exit(i32 noundef 1) #9
  unreachable

45:                                               ; preds = %40, %37, %33, %30, %27
  br label %19, !llvm.loop !13

46:                                               ; preds = %19
  %47 = load i32, ptr %6, align 4, !tbaa !5
  %48 = icmp eq i32 %47, 0
  br i1 %48, label %49, label %55

49:                                               ; preds = %46
  %50 = load ptr, ptr @stderr, align 8, !tbaa !9
  %51 = load ptr, ptr %5, align 8, !tbaa !9
  %52 = getelementptr inbounds ptr, ptr %51, i64 0
  %53 = load ptr, ptr %52, align 8, !tbaa !9
  %54 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %50, ptr noundef @.str.8, ptr noundef %53) #7
  call void @exit(i32 noundef 1) #9
  unreachable

55:                                               ; preds = %46
  %56 = load float, ptr %8, align 4, !tbaa !11
  %57 = fcmp ole float %56, 0.000000e+00
  br i1 %57, label %58, label %64

58:                                               ; preds = %55
  %59 = load ptr, ptr @stderr, align 8, !tbaa !9
  %60 = load ptr, ptr %5, align 8, !tbaa !9
  %61 = getelementptr inbounds ptr, ptr %60, i64 0
  %62 = load ptr, ptr %61, align 8, !tbaa !9
  %63 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %59, ptr noundef @.str.9, ptr noundef %62) #7
  call void @exit(i32 noundef 1) #9
  unreachable

64:                                               ; preds = %55
  %65 = load i32, ptr %9, align 4, !tbaa !5
  %66 = icmp ule i32 %65, 0
  br i1 %66, label %67, label %73

67:                                               ; preds = %64
  %68 = load ptr, ptr @stderr, align 8, !tbaa !9
  %69 = load ptr, ptr %5, align 8, !tbaa !9
  %70 = getelementptr inbounds ptr, ptr %69, i64 0
  %71 = load ptr, ptr %70, align 8, !tbaa !9
  %72 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %68, ptr noundef @.str.10, ptr noundef %71) #7
  call void @exit(i32 noundef 1) #9
  unreachable

73:                                               ; preds = %64
  %74 = load float, ptr %10, align 4, !tbaa !11
  %75 = fcmp olt float %74, 0.000000e+00
  br i1 %75, label %79, label %76

76:                                               ; preds = %73
  %77 = load float, ptr %10, align 4, !tbaa !11
  %78 = fcmp ogt float %77, 1.000000e+00
  br i1 %78, label %79, label %85

79:                                               ; preds = %76, %73
  %80 = load ptr, ptr @stderr, align 8, !tbaa !9
  %81 = load ptr, ptr %5, align 8, !tbaa !9
  %82 = getelementptr inbounds ptr, ptr %81, i64 0
  %83 = load ptr, ptr %82, align 8, !tbaa !9
  %84 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %80, ptr noundef @.str.11, ptr noundef %83) #7
  call void @exit(i32 noundef 1) #9
  unreachable

85:                                               ; preds = %76
  br label %86

86:                                               ; preds = %85
  br label %87

87:                                               ; preds = %86
  br label %88

88:                                               ; preds = %87
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr %14) #7
  %89 = load i32, ptr %6, align 4, !tbaa !5
  %90 = getelementptr inbounds %struct.knapsack_s, ptr %14, i32 0, i32 0
  store i32 %89, ptr %90, align 8, !tbaa !15
  %91 = load float, ptr %8, align 4, !tbaa !11
  %92 = getelementptr inbounds %struct.knapsack_s, ptr %14, i32 0, i32 3
  store float %91, ptr %92, align 8, !tbaa !17
  %93 = getelementptr inbounds %struct.knapsack_s, ptr %14, i32 0, i32 0
  %94 = load i32, ptr %93, align 8, !tbaa !15
  %95 = zext i32 %94 to i64
  %96 = mul i64 %95, 4
  %97 = call noalias ptr @malloc(i64 noundef %96) #10
  %98 = getelementptr inbounds %struct.knapsack_s, ptr %14, i32 0, i32 1
  store ptr %97, ptr %98, align 8, !tbaa !18
  %99 = getelementptr inbounds %struct.knapsack_s, ptr %14, i32 0, i32 0
  %100 = load i32, ptr %99, align 8, !tbaa !15
  %101 = zext i32 %100 to i64
  %102 = mul i64 %101, 4
  %103 = call noalias ptr @malloc(i64 noundef %102) #10
  %104 = getelementptr inbounds %struct.knapsack_s, ptr %14, i32 0, i32 2
  store ptr %103, ptr %104, align 8, !tbaa !19
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %105

105:                                              ; preds = %122, %88
  %106 = load i32, ptr %13, align 4, !tbaa !5
  %107 = load i32, ptr %6, align 4, !tbaa !5
  %108 = icmp ult i32 %106, %107
  br i1 %108, label %109, label %125

109:                                              ; preds = %105
  %110 = call float (...) @randf()
  %111 = getelementptr inbounds %struct.knapsack_s, ptr %14, i32 0, i32 1
  %112 = load ptr, ptr %111, align 8, !tbaa !18
  %113 = load i32, ptr %13, align 4, !tbaa !5
  %114 = zext i32 %113 to i64
  %115 = getelementptr inbounds float, ptr %112, i64 %114
  store float %110, ptr %115, align 4, !tbaa !11
  %116 = call float (...) @randf()
  %117 = getelementptr inbounds %struct.knapsack_s, ptr %14, i32 0, i32 2
  %118 = load ptr, ptr %117, align 8, !tbaa !19
  %119 = load i32, ptr %13, align 4, !tbaa !5
  %120 = zext i32 %119 to i64
  %121 = getelementptr inbounds float, ptr %118, i64 %120
  store float %116, ptr %121, align 4, !tbaa !11
  br label %122

122:                                              ; preds = %109
  %123 = load i32, ptr %13, align 4, !tbaa !5
  %124 = add i32 %123, 1
  store i32 %124, ptr %13, align 4, !tbaa !5
  br label %105, !llvm.loop !20

125:                                              ; preds = %105
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  %126 = load i32, ptr %6, align 4, !tbaa !5
  %127 = call ptr @chromosome_create_basic(i32 noundef %126, i32 noundef 1)
  store ptr %127, ptr %15, align 8, !tbaa !9
  %128 = load ptr, ptr %15, align 8, !tbaa !9
  %129 = call i32 @chromosome_print(ptr noundef %128)
  %130 = load ptr, ptr %15, align 8, !tbaa !9
  call void @knapsack_print(ptr noundef %14, ptr noundef %130)
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  %131 = call noalias ptr @fopen(ptr noundef @.str.12, ptr noundef @.str.13)
  store ptr %131, ptr %17, align 8, !tbaa !9
  %132 = load ptr, ptr %17, align 8, !tbaa !9
  %133 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %132, ptr noundef @.str.14, ptr noundef @.str.12) #7
  %134 = load ptr, ptr %17, align 8, !tbaa !9
  %135 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %134, ptr noundef @.str.15) #7
  %136 = load ptr, ptr %17, align 8, !tbaa !9
  %137 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %136, ptr noundef @.str.16) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  %138 = load ptr, ptr %15, align 8, !tbaa !9
  %139 = load i32, ptr %9, align 4, !tbaa !5
  %140 = load float, ptr %10, align 4, !tbaa !11
  %141 = call ptr @gasearch_create_advanced(ptr noundef @knapsack_utility, ptr noundef %14, ptr noundef %138, i32 noundef 1, i32 noundef %139, float noundef %140)
  store ptr %141, ptr %18, align 8, !tbaa !9
  %142 = load ptr, ptr %17, align 8, !tbaa !9
  %143 = load i32, ptr %7, align 4, !tbaa !5
  %144 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %142, ptr noundef @.str.17, i32 noundef %143) #7
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %145

145:                                              ; preds = %172, %125
  %146 = load i32, ptr %13, align 4, !tbaa !5
  %147 = load i32, ptr %7, align 4, !tbaa !5
  %148 = icmp ult i32 %146, %147
  br i1 %148, label %149, label %175

149:                                              ; preds = %145
  %150 = load ptr, ptr %18, align 8, !tbaa !9
  %151 = call i32 @gasearch_evolve(ptr noundef %150)
  %152 = load ptr, ptr %18, align 8, !tbaa !9
  %153 = load ptr, ptr %15, align 8, !tbaa !9
  %154 = call i32 @gasearch_getopt(ptr noundef %152, ptr noundef %153, ptr noundef %16)
  %155 = load i32, ptr %13, align 4, !tbaa !5
  %156 = add i32 %155, 1
  %157 = urem i32 %156, 100
  %158 = icmp eq i32 %157, 0
  br i1 %158, label %159, label %165

159:                                              ; preds = %149
  %160 = load i32, ptr %13, align 4, !tbaa !5
  %161 = add i32 %160, 1
  %162 = load float, ptr %16, align 4, !tbaa !11
  %163 = fpext float %162 to double
  %164 = call i32 (ptr, ...) @printf(ptr noundef @.str.18, i32 noundef %161, double noundef %163)
  br label %165

165:                                              ; preds = %159, %149
  %166 = load ptr, ptr %17, align 8, !tbaa !9
  %167 = load i32, ptr %13, align 4, !tbaa !5
  %168 = add i32 %167, 1
  %169 = load float, ptr %16, align 4, !tbaa !11
  %170 = fpext float %169 to double
  %171 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %166, ptr noundef @.str.19, i32 noundef %168, double noundef %170) #7
  br label %172

172:                                              ; preds = %165
  %173 = load i32, ptr %13, align 4, !tbaa !5
  %174 = add i32 %173, 1
  store i32 %174, ptr %13, align 4, !tbaa !5
  br label %145, !llvm.loop !21

175:                                              ; preds = %145
  %176 = load ptr, ptr %18, align 8, !tbaa !9
  %177 = load ptr, ptr %15, align 8, !tbaa !9
  %178 = call i32 @gasearch_getopt(ptr noundef %176, ptr noundef %177, ptr noundef %16)
  %179 = load ptr, ptr %15, align 8, !tbaa !9
  call void @knapsack_print(ptr noundef %14, ptr noundef %179)
  %180 = load ptr, ptr %17, align 8, !tbaa !9
  %181 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %180, ptr noundef @.str.20) #7
  %182 = load ptr, ptr %17, align 8, !tbaa !9
  %183 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %182, ptr noundef @.str.21) #7
  %184 = load ptr, ptr %17, align 8, !tbaa !9
  %185 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %184, ptr noundef @.str.22) #7
  %186 = load ptr, ptr %17, align 8, !tbaa !9
  %187 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %186, ptr noundef @.str.23) #7
  %188 = load ptr, ptr %17, align 8, !tbaa !9
  %189 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %188, ptr noundef @.str.24) #7
  %190 = load ptr, ptr %17, align 8, !tbaa !9
  %191 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %190, ptr noundef @.str.25) #7
  %192 = load ptr, ptr %17, align 8, !tbaa !9
  %193 = call i32 @fclose(ptr noundef %192)
  %194 = call i32 (ptr, ...) @printf(ptr noundef @.str.26, ptr noundef @.str.12)
  %195 = load ptr, ptr %15, align 8, !tbaa !9
  %196 = call i32 @chromosome_destroy(ptr noundef %195)
  %197 = load ptr, ptr %18, align 8, !tbaa !9
  %198 = call i32 @gasearch_destroy(ptr noundef %197)
  %199 = getelementptr inbounds %struct.knapsack_s, ptr %14, i32 0, i32 2
  %200 = load ptr, ptr %199, align 8, !tbaa !19
  call void @free(ptr noundef %200) #7
  %201 = getelementptr inbounds %struct.knapsack_s, ptr %14, i32 0, i32 1
  %202 = load ptr, ptr %201, align 8, !tbaa !18
  call void @free(ptr noundef %202) #7
  store i32 0, ptr %3, align 4
  store i32 1, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %203

203:                                              ; preds = %175, %26
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  %204 = load i32, ptr %3, align 4
  ret i32 %204
}

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

; Function Attrs: nounwind
declare i32 @getopt(i32 noundef, ptr noundef, ptr noundef) #3

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

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare double @atof(ptr noundef nonnull) #4

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #5

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

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #6

declare float @randf(...) #1

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

declare i32 @chromosome_print(ptr noundef) #1

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

declare noalias ptr @fopen(ptr noundef, ptr noundef) #1

declare ptr @gasearch_create_advanced(ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef, float noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local float @knapsack_utility(ptr noundef, ptr noundef) #0

declare i32 @gasearch_evolve(ptr noundef) #1

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

declare i32 @fclose(ptr noundef) #1

declare i32 @chromosome_destroy(ptr noundef) #1

declare i32 @gasearch_destroy(ptr noundef) #1

; Function Attrs: nounwind
declare void @free(ptr noundef) #3

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

attributes #0 = { 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 #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 = { inlinehint nounwind willreturn memory(read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 #6 = { nounwind allocsize(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 #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(read) }
attributes #9 = { noreturn nounwind }
attributes #10 = { nounwind allocsize(0) }

!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 = !{!"float", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !6, i64 0}
!16 = !{!"knapsack_s", !6, i64 0, !10, i64 8, !10, i64 16, !12, i64 24}
!17 = !{!16, !12, i64 24}
!18 = !{!16, !10, i64 8}
!19 = !{!16, !10, i64 16}
!20 = distinct !{!20, !14}
!21 = distinct !{!21, !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.knapsack_s = type { i32, ptr, ptr, float }

@.str.7 = external hidden unnamed_addr constant [13 x i8], align 1
@optarg = external local_unnamed_addr global ptr, align 8
@stderr = external local_unnamed_addr global ptr, align 8
@.str.8 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [56 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [57 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [24 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @usage() local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca %struct.knapsack_s, align 8
  %4 = alloca float, align 4
  br label %.outer

.outer:                                           ; preds = %18, %2
  %.062.ph = phi i32 [ %20, %18 ], [ 100, %2 ]
  %.060.ph = phi float [ %.060.ph109, %18 ], [ 0x3FD99999A0000000, %2 ]
  %.058.ph = phi float [ %.058.ph114, %18 ], [ 2.000000e+01, %2 ]
  %.054.ph = phi i32 [ %.054.ph118, %18 ], [ 2000, %2 ]
  %.053.ph = phi i32 [ %.053, %18 ], [ 1000, %2 ]
  br label %.outer108

.outer108:                                        ; preds = %.outer, %21
  %.060.ph109 = phi float [ %.060.ph, %.outer ], [ %24, %21 ]
  %.058.ph110 = phi float [ %.058.ph, %.outer ], [ %.058.ph114, %21 ]
  %.054.ph111 = phi i32 [ %.054.ph, %.outer ], [ %.054.ph118, %21 ]
  %.053.ph112 = phi i32 [ %.053.ph, %.outer ], [ %.053, %21 ]
  br label %.outer113

.outer113:                                        ; preds = %.outer108, %14
  %.058.ph114 = phi float [ %.058.ph110, %.outer108 ], [ %17, %14 ]
  %.054.ph115 = phi i32 [ %.054.ph111, %.outer108 ], [ %.054.ph118, %14 ]
  %.053.ph116 = phi i32 [ %.053.ph112, %.outer108 ], [ %.053, %14 ]
  br label %.outer117

.outer117:                                        ; preds = %.outer113, %11
  %.054.ph118 = phi i32 [ %.054.ph115, %.outer113 ], [ %13, %11 ]
  %.053.ph119 = phi i32 [ %.053.ph116, %.outer113 ], [ %.053, %11 ]
  br label %5

5:                                                ; preds = %.outer117, %8
  %.053 = phi i32 [ %10, %8 ], [ %.053.ph119, %.outer117 ]
  %6 = tail call i32 @getopt(i32 noundef %0, ptr noundef %1, ptr noundef nonnull @.str.7) #9
  switch i32 %6, label %25 [
    i32 -1, label %26
    i32 104, label %7
    i32 117, label %7
    i32 110, label %8
    i32 105, label %11
    i32 99, label %14
    i32 112, label %18
    i32 109, label %21
  ]

7:                                                ; preds = %5, %5
  tail call void @usage()
  br label %99

8:                                                ; preds = %5
  %9 = load ptr, ptr @optarg, align 8, !tbaa !5
  %10 = tail call i32 @atoi(ptr nocapture noundef %9) #10
  br label %5, !llvm.loop !9

11:                                               ; preds = %5
  %12 = load ptr, ptr @optarg, align 8, !tbaa !5
  %13 = tail call i32 @atoi(ptr nocapture noundef %12) #10
  br label %.outer117, !llvm.loop !9

14:                                               ; preds = %5
  %15 = load ptr, ptr @optarg, align 8, !tbaa !5
  %16 = tail call double @atof(ptr noundef %15) #10
  %17 = fptrunc double %16 to float
  br label %.outer113, !llvm.loop !9

18:                                               ; preds = %5
  %19 = load ptr, ptr @optarg, align 8, !tbaa !5
  %20 = tail call i32 @atoi(ptr nocapture noundef %19) #10
  br label %.outer, !llvm.loop !9

21:                                               ; preds = %5
  %22 = load ptr, ptr @optarg, align 8, !tbaa !5
  %23 = tail call double @atof(ptr noundef %22) #10
  %24 = fptrunc double %23 to float
  br label %.outer108, !llvm.loop !9

25:                                               ; preds = %5
  tail call void @exit(i32 noundef 1) #11
  unreachable

26:                                               ; preds = %5
  %27 = icmp eq i32 %.053, 0
  br i1 %27, label %28, label %32

28:                                               ; preds = %26
  %29 = load ptr, ptr @stderr, align 8, !tbaa !5
  %30 = load ptr, ptr %1, align 8, !tbaa !5
  %31 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %29, ptr noundef nonnull @.str.8, ptr noundef %30) #12
  tail call void @exit(i32 noundef 1) #11
  unreachable

32:                                               ; preds = %26
  %33 = fcmp ugt float %.058.ph114, 0.000000e+00
  br i1 %33, label %38, label %34

34:                                               ; preds = %32
  %35 = load ptr, ptr @stderr, align 8, !tbaa !5
  %36 = load ptr, ptr %1, align 8, !tbaa !5
  %37 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %35, ptr noundef nonnull @.str.9, ptr noundef %36) #12
  tail call void @exit(i32 noundef 1) #11
  unreachable

38:                                               ; preds = %32
  %39 = icmp eq i32 %.062.ph, 0
  br i1 %39, label %40, label %44

40:                                               ; preds = %38
  %41 = load ptr, ptr @stderr, align 8, !tbaa !5
  %42 = load ptr, ptr %1, align 8, !tbaa !5
  %43 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %41, ptr noundef nonnull @.str.10, ptr noundef %42) #12
  tail call void @exit(i32 noundef 1) #11
  unreachable

44:                                               ; preds = %38
  %45 = fcmp olt float %.060.ph109, 0.000000e+00
  %46 = fcmp ogt float %.060.ph109, 1.000000e+00
  %or.cond = or i1 %45, %46
  br i1 %or.cond, label %47, label %51

47:                                               ; preds = %44
  %48 = load ptr, ptr @stderr, align 8, !tbaa !5
  %49 = load ptr, ptr %1, align 8, !tbaa !5
  %50 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %48, ptr noundef nonnull @.str.11, ptr noundef %49) #12
  tail call void @exit(i32 noundef 1) #11
  unreachable

51:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #9
  store i32 %.053, ptr %3, align 8, !tbaa !11
  %52 = getelementptr inbounds i8, ptr %3, i64 24
  store float %.058.ph114, ptr %52, align 8, !tbaa !15
  %53 = zext i32 %.053 to i64
  %54 = shl nuw nsw i64 %53, 2
  %55 = tail call noalias ptr @malloc(i64 noundef %54) #13
  %56 = getelementptr inbounds i8, ptr %3, i64 8
  store ptr %55, ptr %56, align 8, !tbaa !16
  %57 = tail call noalias ptr @malloc(i64 noundef %54) #13
  %58 = getelementptr inbounds i8, ptr %3, i64 16
  store ptr %57, ptr %58, align 8, !tbaa !17
  br label %59

59:                                               ; preds = %51, %59
  %indvars.iv = phi i64 [ 0, %51 ], [ %indvars.iv.next, %59 ]
  %60 = tail call float (...) @randf() #9
  %61 = getelementptr inbounds float, ptr %55, i64 %indvars.iv
  store float %60, ptr %61, align 4, !tbaa !18
  %62 = tail call float (...) @randf() #9
  %63 = getelementptr inbounds float, ptr %57, i64 %indvars.iv
  store float %62, ptr %63, align 4, !tbaa !18
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %53
  br i1 %exitcond.not, label %64, label %59, !llvm.loop !19

64:                                               ; preds = %59
  %65 = tail call ptr @chromosome_create_basic(i32 noundef %.053, i32 noundef 1) #9
  %66 = tail call i32 @chromosome_print(ptr noundef %65) #9
  call void @knapsack_print(ptr noundef nonnull %3, ptr noundef %65)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #9
  %67 = call noalias ptr @fopen(ptr noundef nonnull @.str.12, ptr noundef nonnull @.str.13)
  %68 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %67, ptr noundef nonnull @.str.14, ptr noundef nonnull @.str.12) #9
  %69 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %67, ptr noundef nonnull @.str.15) #9
  %70 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %67, ptr noundef nonnull @.str.16) #9
  %71 = call ptr @gasearch_create_advanced(ptr noundef nonnull @knapsack_utility, ptr noundef nonnull %3, ptr noundef %65, i32 noundef 1, i32 noundef %.062.ph, float noundef %.060.ph109) #9
  %72 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %67, ptr noundef nonnull @.str.17, i32 noundef %.054.ph118) #9
  %.not = icmp eq i32 %.054.ph118, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %64, %82
  %.15775 = phi i32 [ %75, %82 ], [ 0, %64 ]
  %73 = call i32 @gasearch_evolve(ptr noundef %71) #9
  %74 = call i32 @gasearch_getopt(ptr noundef %71, ptr noundef %65, ptr noundef nonnull %4) #9
  %75 = add nuw i32 %.15775, 1
  %76 = urem i32 %75, 100
  %77 = icmp eq i32 %76, 0
  br i1 %77, label %78, label %82

78:                                               ; preds = %.lr.ph
  %79 = load float, ptr %4, align 4, !tbaa !18
  %80 = fpext float %79 to double
  %81 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.18, i32 noundef %75, double noundef %80)
  br label %82

82:                                               ; preds = %78, %.lr.ph
  %83 = load float, ptr %4, align 4, !tbaa !18
  %84 = fpext float %83 to double
  %85 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %67, ptr noundef nonnull @.str.19, i32 noundef %75, double noundef %84) #9
  %exitcond87.not = icmp eq i32 %75, %.054.ph118
  br i1 %exitcond87.not, label %._crit_edge, label %.lr.ph, !llvm.loop !20

._crit_edge:                                      ; preds = %82, %64
  %86 = call i32 @gasearch_getopt(ptr noundef %71, ptr noundef %65, ptr noundef nonnull %4) #9
  call void @knapsack_print(ptr noundef nonnull %3, ptr noundef %65)
  %87 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %67, ptr noundef nonnull @.str.20) #9
  %88 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %67, ptr noundef nonnull @.str.21) #9
  %89 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %67, ptr noundef nonnull @.str.22) #9
  %90 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %67, ptr noundef nonnull @.str.23) #9
  %91 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %67, ptr noundef nonnull @.str.24) #9
  %92 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %67, ptr noundef nonnull @.str.25) #9
  %93 = call i32 @fclose(ptr noundef %67)
  %94 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.26, ptr noundef nonnull @.str.12)
  %95 = call i32 @chromosome_destroy(ptr noundef %65) #9
  %96 = call i32 @gasearch_destroy(ptr noundef %71) #9
  %97 = load ptr, ptr %58, align 8, !tbaa !17
  call void @free(ptr noundef %97) #9
  %98 = load ptr, ptr %56, align 8, !tbaa !16
  call void @free(ptr noundef %98) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #9
  br label %99

99:                                               ; preds = %._crit_edge, %7
  ret i32 0
}

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

; Function Attrs: nounwind
declare i32 @getopt(i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

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

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare double @atof(ptr nocapture noundef nonnull) local_unnamed_addr #4

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #5

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

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #6

declare float @randf(...) local_unnamed_addr #7

declare ptr @chromosome_create_basic(i32 noundef, i32 noundef) local_unnamed_addr #7

declare i32 @chromosome_print(ptr noundef) local_unnamed_addr #7

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

; Function Attrs: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #1

declare ptr @gasearch_create_advanced(ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef, float noundef) local_unnamed_addr #7

; Function Attrs: nounwind uwtable
declare dso_local float @knapsack_utility(ptr noundef, ptr noundef) #0

declare i32 @gasearch_evolve(ptr noundef) local_unnamed_addr #7

declare i32 @gasearch_getopt(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #7

; Function Attrs: nofree nounwind
declare noundef i32 @fclose(ptr nocapture noundef) local_unnamed_addr #1

declare i32 @chromosome_destroy(ptr noundef) local_unnamed_addr #7

declare i32 @gasearch_destroy(ptr noundef) local_unnamed_addr #7

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #8

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

attributes #0 = { 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 #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 = { inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 #6 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { "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 #8 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 #9 = { nounwind }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { noreturn nounwind }
attributes #12 = { cold nounwind }
attributes #13 = { nounwind allocsize(0) }

!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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !13, i64 0}
!12 = !{!"knapsack_s", !13, i64 0, !6, i64 8, !6, i64 16, !14, i64 24}
!13 = !{!"int", !7, i64 0}
!14 = !{!"float", !7, i64 0}
!15 = !{!12, !14, i64 24}
!16 = !{!12, !6, i64 8}
!17 = !{!12, !6, i64 16}
!18 = !{!14, !14, i64 0}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}


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