; LLVM IR from holzschu/ios_system :: text_cmds/look (look)

; 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.stat = type { i64, i64, i64, i32, i32, i32, i32, i64, i64, i64, i64, %struct.timespec, %struct.timespec, %struct.timespec, [3 x i64] }
%struct.timespec = type { i64, i64 }

@.str = external hidden unnamed_addr constant [1 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@dflag = external dso_local global i32, align 4
@fflag = external dso_local global i32, align 4
@optarg = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [30 x i8], align 1
@optind = external global i32, align 4
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [7 x i8], align 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 %struct.stat, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = 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 144, ptr %6) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #8
  %15 = call ptr @setlocale(i32 noundef 0, ptr noundef @.str) #8
  store ptr null, ptr %13, align 8, !tbaa !9
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %16

16:                                               ; preds = %35, %2
  %17 = load i32, ptr %4, align 4, !tbaa !5
  %18 = load ptr, ptr %5, align 8, !tbaa !9
  %19 = call i32 @getopt(i32 noundef %17, ptr noundef %18, ptr noundef @.str.1) #8
  store i32 %19, ptr %7, align 4, !tbaa !5
  %20 = icmp ne i32 %19, -1
  br i1 %20, label %21, label %36

21:                                               ; preds = %16
  %22 = load i32, ptr %7, align 4, !tbaa !5
  switch i32 %22, label %34 [
    i32 100, label %23
    i32 102, label %24
    i32 116, label %25
    i32 63, label %33
  ]

23:                                               ; preds = %21
  store i32 1, ptr @dflag, align 4, !tbaa !5
  br label %35

24:                                               ; preds = %21
  store i32 1, ptr @fflag, align 4, !tbaa !5
  br label %35

25:                                               ; preds = %21
  %26 = load ptr, ptr @optarg, align 8, !tbaa !9
  %27 = call i64 @mbrtowc(ptr noundef %10, ptr noundef %26, i64 noundef 16, ptr noundef null) #8
  %28 = load ptr, ptr @optarg, align 8, !tbaa !9
  %29 = call i64 @strlen(ptr noundef %28) #9
  %30 = icmp ne i64 %27, %29
  br i1 %30, label %31, label %32

31:                                               ; preds = %25
  call void (i32, ptr, ...) @errx(i32 noundef 2, ptr noundef @.str.2) #10
  unreachable

32:                                               ; preds = %25
  br label %35

33:                                               ; preds = %21
  br label %34

34:                                               ; preds = %33, %21
  call void @usage()
  br label %35

35:                                               ; preds = %34, %32, %24, %23
  br label %16, !llvm.loop !11

36:                                               ; preds = %16
  %37 = load i32, ptr @optind, align 4, !tbaa !5
  %38 = load i32, ptr %4, align 4, !tbaa !5
  %39 = sub nsw i32 %38, %37
  store i32 %39, ptr %4, align 4, !tbaa !5
  %40 = load i32, ptr @optind, align 4, !tbaa !5
  %41 = load ptr, ptr %5, align 8, !tbaa !9
  %42 = sext i32 %40 to i64
  %43 = getelementptr inbounds ptr, ptr %41, i64 %42
  store ptr %43, ptr %5, align 8, !tbaa !9
  %44 = load i32, ptr %4, align 4, !tbaa !5
  %45 = icmp eq i32 %44, 0
  br i1 %45, label %46, label %47

46:                                               ; preds = %36
  call void @usage()
  br label %47

47:                                               ; preds = %46, %36
  %48 = load i32, ptr %4, align 4, !tbaa !5
  %49 = icmp eq i32 %48, 1
  br i1 %49, label %50, label %51

50:                                               ; preds = %47
  store i32 1, ptr @fflag, align 4, !tbaa !5
  store i32 1, ptr @dflag, align 4, !tbaa !5
  br label %51

51:                                               ; preds = %50, %47
  %52 = load ptr, ptr %5, align 8, !tbaa !9
  %53 = getelementptr inbounds ptr, ptr %52, i32 1
  store ptr %53, ptr %5, align 8, !tbaa !9
  %54 = load ptr, ptr %52, align 8, !tbaa !9
  %55 = load i32, ptr %10, align 4, !tbaa !5
  %56 = call ptr @prepkey(ptr noundef %54, i32 noundef %55)
  store ptr %56, ptr %14, align 8, !tbaa !9
  %57 = load i32, ptr %4, align 4, !tbaa !5
  %58 = icmp sge i32 %57, 2
  br i1 %58, label %59, label %67

59:                                               ; preds = %51
  %60 = call noalias ptr @malloc(i64 noundef 2048) #11
  store ptr %60, ptr %13, align 8, !tbaa !9
  %61 = load ptr, ptr %13, align 8, !tbaa !9
  %62 = load ptr, ptr %5, align 8, !tbaa !9
  %63 = load ptr, ptr %62, align 8, !tbaa !9
  %64 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %61, ptr noundef @.str.3, ptr noundef %63) #8
  %65 = load ptr, ptr %5, align 8, !tbaa !9
  %66 = getelementptr inbounds ptr, ptr %65, i32 1
  store ptr %66, ptr %5, align 8, !tbaa !9
  br label %67

67:                                               ; preds = %59, %51
  store i32 1, ptr %9, align 4, !tbaa !5
  %68 = load ptr, ptr %13, align 8, !tbaa !9
  %69 = icmp eq ptr %68, null
  br i1 %69, label %70, label %75

70:                                               ; preds = %67
  %71 = call noalias ptr @malloc(i64 noundef 2048) #11
  store ptr %71, ptr %13, align 8, !tbaa !9
  %72 = load ptr, ptr %13, align 8, !tbaa !9
  %73 = call ptr @getenv(ptr noundef @.str.5) #8
  %74 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %72, ptr noundef @.str.4, ptr noundef %73) #8
  br label %75

75:                                               ; preds = %70, %67
  br label %76

76:                                               ; preds = %130, %75
  %77 = load ptr, ptr %13, align 8, !tbaa !9
  %78 = call i32 (ptr, i32, ...) @open(ptr noundef %77, i32 noundef 0, i32 noundef 0)
  store i32 %78, ptr %8, align 4, !tbaa !5
  %79 = icmp slt i32 %78, 0
  br i1 %79, label %84, label %80

80:                                               ; preds = %76
  %81 = load i32, ptr %8, align 4, !tbaa !5
  %82 = call i32 @fstat(i32 noundef %81, ptr noundef %6) #8
  %83 = icmp ne i32 %82, 0
  br i1 %83, label %84, label %86

84:                                               ; preds = %80, %76
  %85 = load ptr, ptr %13, align 8, !tbaa !9
  call void (i32, ptr, ...) @err(i32 noundef 2, ptr noundef @.str.3, ptr noundef %85) #10
  unreachable

86:                                               ; preds = %80
  %87 = getelementptr inbounds %struct.stat, ptr %6, i32 0, i32 8
  %88 = load i64, ptr %87, align 8, !tbaa !13
  %89 = icmp ugt i64 %88, -1
  br i1 %89, label %90, label %93

90:                                               ; preds = %86
  %91 = load ptr, ptr %13, align 8, !tbaa !9
  %92 = call ptr @strerror(i32 noundef 27) #8
  call void (i32, ptr, ...) @errx(i32 noundef 2, ptr noundef @.str.6, ptr noundef %91, ptr noundef %92) #10
  unreachable

93:                                               ; preds = %86
  %94 = getelementptr inbounds %struct.stat, ptr %6, i32 0, i32 8
  %95 = load i64, ptr %94, align 8, !tbaa !13
  %96 = icmp eq i64 %95, 0
  br i1 %96, label %97, label %100

97:                                               ; preds = %93
  %98 = load i32, ptr %8, align 4, !tbaa !5
  %99 = call i32 @close(i32 noundef %98)
  br label %121

100:                                              ; preds = %93
  %101 = getelementptr inbounds %struct.stat, ptr %6, i32 0, i32 8
  %102 = load i64, ptr %101, align 8, !tbaa !13
  %103 = load i32, ptr %8, align 4, !tbaa !5
  %104 = call ptr @mmap(ptr noundef null, i64 noundef %102, i32 noundef 1, i32 noundef 1, i32 noundef %103, i64 noundef 0) #8
  store ptr %104, ptr %12, align 8, !tbaa !9
  %105 = icmp eq ptr %104, inttoptr (i64 -1 to ptr)
  br i1 %105, label %106, label %108

106:                                              ; preds = %100
  %107 = load ptr, ptr %13, align 8, !tbaa !9
  call void (i32, ptr, ...) @err(i32 noundef 2, ptr noundef @.str.3, ptr noundef %107) #10
  unreachable

108:                                              ; preds = %100
  %109 = load ptr, ptr %12, align 8, !tbaa !9
  %110 = getelementptr inbounds %struct.stat, ptr %6, i32 0, i32 8
  %111 = load i64, ptr %110, align 8, !tbaa !13
  %112 = getelementptr inbounds i8, ptr %109, i64 %111
  store ptr %112, ptr %11, align 8, !tbaa !9
  %113 = load ptr, ptr %14, align 8, !tbaa !9
  %114 = load ptr, ptr %12, align 8, !tbaa !9
  %115 = load ptr, ptr %11, align 8, !tbaa !9
  %116 = call i32 @look(ptr noundef %113, ptr noundef %114, ptr noundef %115)
  %117 = load i32, ptr %9, align 4, !tbaa !5
  %118 = mul nsw i32 %117, %116
  store i32 %118, ptr %9, align 4, !tbaa !5
  %119 = load i32, ptr %8, align 4, !tbaa !5
  %120 = call i32 @close(i32 noundef %119)
  br label %121

121:                                              ; preds = %108, %97
  %122 = load i32, ptr %4, align 4, !tbaa !5
  %123 = add nsw i32 %122, -1
  store i32 %123, ptr %4, align 4, !tbaa !5
  %124 = icmp sgt i32 %122, 2
  br i1 %124, label %125, label %130

125:                                              ; preds = %121
  %126 = load ptr, ptr %5, align 8, !tbaa !9
  %127 = getelementptr inbounds ptr, ptr %126, i32 1
  store ptr %127, ptr %5, align 8, !tbaa !9
  %128 = load ptr, ptr %126, align 8, !tbaa !9
  store ptr %128, ptr %13, align 8, !tbaa !9
  %129 = icmp ne ptr %128, null
  br label %130

130:                                              ; preds = %125, %121
  %131 = phi i1 [ false, %121 ], [ %129, %125 ]
  br i1 %131, label %76, label %132, !llvm.loop !17

132:                                              ; preds = %130
  %133 = load i32, ptr %9, align 4, !tbaa !5
  call void @exit(i32 noundef %133) #12
  unreachable
}

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

; Function Attrs: nounwind
declare ptr @setlocale(i32 noundef, ptr noundef) #2

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

; Function Attrs: nounwind
declare i64 @mbrtowc(ptr noundef, ptr noundef, i64 noundef, ptr noundef) #2

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #3

; Function Attrs: noreturn
declare void @errx(i32 noundef, ptr noundef, ...) #4

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

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

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

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

; Function Attrs: nounwind
declare ptr @getenv(ptr noundef) #2

declare i32 @open(ptr noundef, i32 noundef, ...) #6

; Function Attrs: nounwind
declare i32 @fstat(i32 noundef, ptr noundef) #2

; Function Attrs: noreturn
declare void @err(i32 noundef, ptr noundef, ...) #4

; Function Attrs: nounwind
declare ptr @strerror(i32 noundef) #2

declare i32 @close(i32 noundef) #6

; Function Attrs: nounwind
declare ptr @mmap(ptr noundef, i64 noundef, i32 noundef, i32 noundef, i32 noundef, i64 noundef) #2

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

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 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 = { noreturn "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 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 #6 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { 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 #8 = { nounwind }
attributes #9 = { nounwind willreturn memory(read) }
attributes #10 = { noreturn }
attributes #11 = { nounwind allocsize(0) }
attributes #12 = { 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 = !{!"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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !15, i64 48}
!14 = !{!"stat", !15, i64 0, !15, i64 8, !15, i64 16, !6, i64 24, !6, i64 28, !6, i64 32, !6, i64 36, !15, i64 40, !15, i64 48, !15, i64 56, !15, i64 64, !16, i64 72, !16, i64 88, !16, i64 104, !7, i64 120}
!15 = !{!"long", !7, i64 0}
!16 = !{!"timespec", !15, i64 0, !15, i64 8}
!17 = distinct !{!17, !12}


; 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.stat = type { i64, i64, i64, i32, i32, i32, i32, i64, i64, i64, i64, %struct.timespec, %struct.timespec, %struct.timespec, [3 x i64] }
%struct.timespec = type { i64, i64 }

@.str = external hidden unnamed_addr constant [1 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@dflag = external dso_local local_unnamed_addr global i32, align 4
@fflag = external dso_local local_unnamed_addr global i32, align 4
@optarg = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [30 x i8], align 1
@optind = external local_unnamed_addr global i32, align 4
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: noreturn nounwind uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca %struct.stat, align 8
  %4 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 144, ptr nonnull %3) #12
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #12
  %5 = tail call ptr @setlocale(i32 noundef 0, ptr noundef nonnull @.str) #12
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %6

6:                                                ; preds = %.backedge, %2
  %7 = call i32 @getopt(i32 noundef %0, ptr noundef %1, ptr noundef nonnull @.str.1) #12
  switch i32 %7, label %16 [
    i32 -1, label %17
    i32 100, label %8
    i32 102, label %9
    i32 116, label %10
  ]

8:                                                ; preds = %6
  store i32 1, ptr @dflag, align 4, !tbaa !5
  br label %.backedge

9:                                                ; preds = %6
  store i32 1, ptr @fflag, align 4, !tbaa !5
  br label %.backedge

10:                                               ; preds = %6
  %11 = load ptr, ptr @optarg, align 8, !tbaa !9
  %12 = call i64 @mbrtowc(ptr noundef nonnull %4, ptr noundef %11, i64 noundef 16, ptr noundef null) #12
  %13 = load ptr, ptr @optarg, align 8, !tbaa !9
  %14 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %13) #13
  %.not41 = icmp eq i64 %12, %14
  br i1 %.not41, label %.backedge, label %15

.backedge:                                        ; preds = %10, %16, %9, %8
  br label %6, !llvm.loop !11

15:                                               ; preds = %10
  call void (i32, ptr, ...) @errx(i32 noundef 2, ptr noundef nonnull @.str.2) #14
  unreachable

16:                                               ; preds = %6
  call void @usage()
  br label %.backedge

17:                                               ; preds = %6
  %18 = load i32, ptr @optind, align 4, !tbaa !5
  %19 = sub nsw i32 %0, %18
  %20 = sext i32 %18 to i64
  %21 = getelementptr inbounds ptr, ptr %1, i64 %20
  switch i32 %19, label %24 [
    i32 0, label %22
    i32 1, label %23
  ]

22:                                               ; preds = %17
  call void @usage()
  br label %24

23:                                               ; preds = %17
  store i32 1, ptr @fflag, align 4, !tbaa !5
  store i32 1, ptr @dflag, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %22, %17, %23
  %25 = getelementptr inbounds i8, ptr %21, i64 8
  %26 = load ptr, ptr %21, align 8, !tbaa !9
  %27 = load i32, ptr %4, align 4, !tbaa !5
  %28 = call ptr @prepkey(ptr noundef %26, i32 noundef %27)
  %29 = icmp sgt i32 %19, 1
  br i1 %29, label %30, label %.thread

30:                                               ; preds = %24
  %31 = call noalias dereferenceable_or_null(2048) ptr @malloc(i64 noundef 2048) #15
  %32 = load ptr, ptr %25, align 8, !tbaa !9
  %33 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %31, ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef %32) #12
  %34 = getelementptr inbounds i8, ptr %21, i64 16
  %35 = icmp eq ptr %31, null
  br i1 %35, label %.thread, label %39

.thread:                                          ; preds = %24, %30
  %.03045 = phi ptr [ %34, %30 ], [ %25, %24 ]
  %36 = call noalias dereferenceable_or_null(2048) ptr @malloc(i64 noundef 2048) #15
  %37 = call ptr @getenv(ptr noundef nonnull @.str.5) #12
  %38 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %36, ptr noundef nonnull dereferenceable(1) @.str.4, ptr noundef %37) #12
  br label %39

39:                                               ; preds = %.thread, %30
  %.03044 = phi ptr [ %.03045, %.thread ], [ %34, %30 ]
  %.1 = phi ptr [ %36, %.thread ], [ %31, %30 ]
  %40 = getelementptr inbounds i8, ptr %3, i64 48
  br label %41

41:                                               ; preds = %61, %39
  %.032 = phi i32 [ 1, %39 ], [ %.133, %61 ]
  %.131 = phi ptr [ %.03044, %39 ], [ %63, %61 ]
  %.2 = phi ptr [ %.1, %39 ], [ %64, %61 ]
  %.0 = phi i32 [ %19, %39 ], [ %62, %61 ]
  %42 = call i32 (ptr, i32, ...) @open(ptr noundef %.2, i32 noundef 0, i32 noundef 0) #12
  %43 = icmp slt i32 %42, 0
  br i1 %43, label %46, label %44

44:                                               ; preds = %41
  %45 = call i32 @fstat(i32 noundef %42, ptr noundef nonnull %3) #12
  %.not39 = icmp eq i32 %45, 0
  br i1 %.not39, label %47, label %46

46:                                               ; preds = %44, %41
  call void (i32, ptr, ...) @err(i32 noundef 2, ptr noundef nonnull @.str.3, ptr noundef %.2) #14
  unreachable

47:                                               ; preds = %44
  %48 = load i64, ptr %40, align 8, !tbaa !13
  %49 = icmp eq i64 %48, 0
  br i1 %49, label %58, label %50

50:                                               ; preds = %47
  %51 = call ptr @mmap(ptr noundef null, i64 noundef %48, i32 noundef 1, i32 noundef 1, i32 noundef %42, i64 noundef 0) #12
  %52 = icmp eq ptr %51, inttoptr (i64 -1 to ptr)
  br i1 %52, label %53, label %54

53:                                               ; preds = %50
  call void (i32, ptr, ...) @err(i32 noundef 2, ptr noundef nonnull @.str.3, ptr noundef %.2) #14
  unreachable

54:                                               ; preds = %50
  %55 = getelementptr inbounds i8, ptr %51, i64 %48
  %56 = call i32 @look(ptr noundef %28, ptr noundef %51, ptr noundef nonnull %55)
  %57 = mul nsw i32 %56, %.032
  br label %58

58:                                               ; preds = %47, %54
  %.133 = phi i32 [ %57, %54 ], [ %.032, %47 ]
  %59 = call i32 @close(i32 noundef %42) #12
  %60 = icmp sgt i32 %.0, 2
  br i1 %60, label %61, label %.critedge

61:                                               ; preds = %58
  %62 = add nsw i32 %.0, -1
  %63 = getelementptr inbounds i8, ptr %.131, i64 8
  %64 = load ptr, ptr %.131, align 8, !tbaa !9
  %.not40 = icmp eq ptr %64, null
  br i1 %.not40, label %.critedge, label %41, !llvm.loop !17

.critedge:                                        ; preds = %58, %61
  call void @exit(i32 noundef %.133) #14
  unreachable
}

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

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

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

; Function Attrs: nounwind
declare i64 @mbrtowc(ptr noundef, ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #2

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

; Function Attrs: noreturn
declare void @errx(i32 noundef, ptr noundef, ...) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
declare hidden void @usage() local_unnamed_addr #5

; Function Attrs: nounwind uwtable
declare dso_local ptr @prepkey(ptr noundef, i32 noundef) local_unnamed_addr #5

; 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

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

; Function Attrs: nofree nounwind memory(read)
declare noundef ptr @getenv(ptr nocapture noundef) local_unnamed_addr #8

; Function Attrs: nofree
declare noundef i32 @open(ptr nocapture noundef readonly, i32 noundef, ...) local_unnamed_addr #9

; Function Attrs: nofree nounwind
declare noundef i32 @fstat(i32 noundef, ptr nocapture noundef) local_unnamed_addr #7

; Function Attrs: noreturn
declare void @err(i32 noundef, ptr noundef, ...) local_unnamed_addr #4

declare i32 @close(i32 noundef) local_unnamed_addr #10

; Function Attrs: nounwind
declare ptr @mmap(ptr noundef, i64 noundef, i32 noundef, i32 noundef, i32 noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @look(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #5

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

attributes #0 = { noreturn 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = { 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 = { noreturn "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 uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 = { 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 #8 = { nofree nounwind 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 #9 = { nofree "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 #10 = { "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 #11 = { 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 #12 = { nounwind }
attributes #13 = { nounwind willreturn memory(read) }
attributes #14 = { noreturn nounwind }
attributes #15 = { 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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !15, i64 48}
!14 = !{!"stat", !15, i64 0, !15, i64 8, !15, i64 16, !6, i64 24, !6, i64 28, !6, i64 32, !6, i64 36, !15, i64 40, !15, i64 48, !15, i64 56, !15, i64 64, !16, i64 72, !16, i64 88, !16, i64 104, !7, i64 120}
!15 = !{!"long", !7, i64 0}
!16 = !{!"timespec", !15, i64 0, !15, i64 8}
!17 = distinct !{!17, !12}


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