; LLVM IR from holzschu/ios_system :: curl/curl/docs/examples (multi-legacy)

; 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.timeval = type { i64, i64 }
%struct.fd_set = type { [16 x i64] }
%struct.CURLMsg = type { i32, ptr, %union.anon }
%union.anon = type { ptr }

@.str = external hidden unnamed_addr constant [20 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [18 x i8], align 1
@stderr = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [37 x i8], align 1
@__const.main.wait = external hidden unnamed_addr constant %struct.timeval, align 8
@.str.3 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [39 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca [2 x ptr], align 16
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca %struct.timeval, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca %struct.fd_set, align 8
  %12 = alloca %struct.fd_set, align 8
  %13 = alloca %struct.fd_set, align 8
  %14 = alloca i32, align 4
  %15 = alloca i64, align 8
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = alloca ptr, align 8
  %20 = alloca i32, align 4
  %21 = alloca ptr, align 8
  %22 = alloca i32, align 4
  %23 = alloca %struct.timeval, align 8
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 16, ptr %2) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %26

26:                                               ; preds = %34, %0
  %27 = load i32, ptr %5, align 4, !tbaa !5
  %28 = icmp slt i32 %27, 2
  br i1 %28, label %29, label %37

29:                                               ; preds = %26
  %30 = call ptr @curl_easy_init()
  %31 = load i32, ptr %5, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [2 x ptr], ptr %2, i64 0, i64 %32
  store ptr %30, ptr %33, align 8, !tbaa !9
  br label %34

34:                                               ; preds = %29
  %35 = load i32, ptr %5, align 4, !tbaa !5
  %36 = add nsw i32 %35, 1
  store i32 %36, ptr %5, align 4, !tbaa !5
  br label %26, !llvm.loop !11

37:                                               ; preds = %26
  %38 = getelementptr inbounds [2 x ptr], ptr %2, i64 0, i64 0
  %39 = load ptr, ptr %38, align 16, !tbaa !9
  %40 = call i32 (ptr, i32, ...) @curl_easy_setopt(ptr noundef %39, i32 noundef 10002, ptr noundef @.str)
  %41 = getelementptr inbounds [2 x ptr], ptr %2, i64 0, i64 1
  %42 = load ptr, ptr %41, align 8, !tbaa !9
  %43 = call i32 (ptr, i32, ...) @curl_easy_setopt(ptr noundef %42, i32 noundef 10002, ptr noundef @.str.1)
  %44 = getelementptr inbounds [2 x ptr], ptr %2, i64 0, i64 1
  %45 = load ptr, ptr %44, align 8, !tbaa !9
  %46 = call i32 (ptr, i32, ...) @curl_easy_setopt(ptr noundef %45, i32 noundef 46, i64 noundef 1)
  %47 = call ptr @curl_multi_init()
  store ptr %47, ptr %3, align 8, !tbaa !9
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %48

48:                                               ; preds = %58, %37
  %49 = load i32, ptr %5, align 4, !tbaa !5
  %50 = icmp slt i32 %49, 2
  br i1 %50, label %51, label %61

51:                                               ; preds = %48
  %52 = load ptr, ptr %3, align 8, !tbaa !9
  %53 = load i32, ptr %5, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [2 x ptr], ptr %2, i64 0, i64 %54
  %56 = load ptr, ptr %55, align 8, !tbaa !9
  %57 = call i32 @curl_multi_add_handle(ptr noundef %52, ptr noundef %56)
  br label %58

58:                                               ; preds = %51
  %59 = load i32, ptr %5, align 4, !tbaa !5
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr %5, align 4, !tbaa !5
  br label %48, !llvm.loop !13

61:                                               ; preds = %48
  %62 = load ptr, ptr %3, align 8, !tbaa !9
  %63 = call i32 @curl_multi_perform(ptr noundef %62, ptr noundef %4)
  br label %64

64:                                               ; preds = %169, %61
  %65 = load i32, ptr %4, align 4, !tbaa !5
  %66 = icmp ne i32 %65, 0
  br i1 %66, label %67, label %170

67:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 128, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 128, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 128, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 -1, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  store i64 -1, ptr %15, align 8, !tbaa !14
  br label %68

68:                                               ; preds = %67
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  store ptr %11, ptr %17, align 8, !tbaa !9
  store i32 0, ptr %16, align 4, !tbaa !5
  br label %69

69:                                               ; preds = %79, %68
  %70 = load i32, ptr %16, align 4, !tbaa !5
  %71 = zext i32 %70 to i64
  %72 = icmp ult i64 %71, 16
  br i1 %72, label %73, label %82

73:                                               ; preds = %69
  %74 = load ptr, ptr %17, align 8, !tbaa !9
  %75 = getelementptr inbounds %struct.fd_set, ptr %74, i32 0, i32 0
  %76 = load i32, ptr %16, align 4, !tbaa !5
  %77 = zext i32 %76 to i64
  %78 = getelementptr inbounds [16 x i64], ptr %75, i64 0, i64 %77
  store i64 0, ptr %78, align 8, !tbaa !14
  br label %79

79:                                               ; preds = %73
  %80 = load i32, ptr %16, align 4, !tbaa !5
  %81 = add i32 %80, 1
  store i32 %81, ptr %16, align 4, !tbaa !5
  br label %69, !llvm.loop !16

82:                                               ; preds = %69
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  br label %83

83:                                               ; preds = %82
  br label %84

84:                                               ; preds = %83
  br label %85

85:                                               ; preds = %84
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  store ptr %12, ptr %19, align 8, !tbaa !9
  store i32 0, ptr %18, align 4, !tbaa !5
  br label %86

86:                                               ; preds = %96, %85
  %87 = load i32, ptr %18, align 4, !tbaa !5
  %88 = zext i32 %87 to i64
  %89 = icmp ult i64 %88, 16
  br i1 %89, label %90, label %99

90:                                               ; preds = %86
  %91 = load ptr, ptr %19, align 8, !tbaa !9
  %92 = getelementptr inbounds %struct.fd_set, ptr %91, i32 0, i32 0
  %93 = load i32, ptr %18, align 4, !tbaa !5
  %94 = zext i32 %93 to i64
  %95 = getelementptr inbounds [16 x i64], ptr %92, i64 0, i64 %94
  store i64 0, ptr %95, align 8, !tbaa !14
  br label %96

96:                                               ; preds = %90
  %97 = load i32, ptr %18, align 4, !tbaa !5
  %98 = add i32 %97, 1
  store i32 %98, ptr %18, align 4, !tbaa !5
  br label %86, !llvm.loop !17

99:                                               ; preds = %86
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  br label %100

100:                                              ; preds = %99
  br label %101

101:                                              ; preds = %100
  br label %102

102:                                              ; preds = %101
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #5
  store ptr %13, ptr %21, align 8, !tbaa !9
  store i32 0, ptr %20, align 4, !tbaa !5
  br label %103

103:                                              ; preds = %113, %102
  %104 = load i32, ptr %20, align 4, !tbaa !5
  %105 = zext i32 %104 to i64
  %106 = icmp ult i64 %105, 16
  br i1 %106, label %107, label %116

107:                                              ; preds = %103
  %108 = load ptr, ptr %21, align 8, !tbaa !9
  %109 = getelementptr inbounds %struct.fd_set, ptr %108, i32 0, i32 0
  %110 = load i32, ptr %20, align 4, !tbaa !5
  %111 = zext i32 %110 to i64
  %112 = getelementptr inbounds [16 x i64], ptr %109, i64 0, i64 %111
  store i64 0, ptr %112, align 8, !tbaa !14
  br label %113

113:                                              ; preds = %107
  %114 = load i32, ptr %20, align 4, !tbaa !5
  %115 = add i32 %114, 1
  store i32 %115, ptr %20, align 4, !tbaa !5
  br label %103, !llvm.loop !18

116:                                              ; preds = %103
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #5
  br label %117

117:                                              ; preds = %116
  br label %118

118:                                              ; preds = %117
  %119 = getelementptr inbounds %struct.timeval, ptr %8, i32 0, i32 0
  store i64 1, ptr %119, align 8, !tbaa !19
  %120 = getelementptr inbounds %struct.timeval, ptr %8, i32 0, i32 1
  store i64 0, ptr %120, align 8, !tbaa !21
  %121 = load ptr, ptr %3, align 8, !tbaa !9
  %122 = call i32 @curl_multi_timeout(ptr noundef %121, ptr noundef %15)
  %123 = load i64, ptr %15, align 8, !tbaa !14
  %124 = icmp sge i64 %123, 0
  br i1 %124, label %125, label %142

125:                                              ; preds = %118
  %126 = load i64, ptr %15, align 8, !tbaa !14
  %127 = sdiv i64 %126, 1000
  %128 = getelementptr inbounds %struct.timeval, ptr %8, i32 0, i32 0
  store i64 %127, ptr %128, align 8, !tbaa !19
  %129 = getelementptr inbounds %struct.timeval, ptr %8, i32 0, i32 0
  %130 = load i64, ptr %129, align 8, !tbaa !19
  %131 = icmp sgt i64 %130, 1
  br i1 %131, label %132, label %134

132:                                              ; preds = %125
  %133 = getelementptr inbounds %struct.timeval, ptr %8, i32 0, i32 0
  store i64 1, ptr %133, align 8, !tbaa !19
  br label %141

134:                                              ; preds = %125
  %135 = load i64, ptr %15, align 8, !tbaa !14
  %136 = srem i64 %135, 1000
  %137 = trunc i64 %136 to i32
  %138 = mul nsw i32 %137, 1000
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds %struct.timeval, ptr %8, i32 0, i32 1
  store i64 %139, ptr %140, align 8, !tbaa !21
  br label %141

141:                                              ; preds = %134, %132
  br label %142

142:                                              ; preds = %141, %118
  %143 = load ptr, ptr %3, align 8, !tbaa !9
  %144 = call i32 @curl_multi_fdset(ptr noundef %143, ptr noundef %11, ptr noundef %12, ptr noundef %13, ptr noundef %14)
  store i32 %144, ptr %10, align 4, !tbaa !5
  %145 = load i32, ptr %10, align 4, !tbaa !5
  %146 = icmp ne i32 %145, 0
  br i1 %146, label %147, label %151

147:                                              ; preds = %142
  %148 = load ptr, ptr @stderr, align 8, !tbaa !9
  %149 = load i32, ptr %10, align 4, !tbaa !5
  %150 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %148, ptr noundef @.str.2, i32 noundef %149) #5
  store i32 9, ptr %22, align 4
  br label %167

151:                                              ; preds = %142
  %152 = load i32, ptr %14, align 4, !tbaa !5
  %153 = icmp eq i32 %152, -1
  br i1 %153, label %154, label %156

154:                                              ; preds = %151
  call void @llvm.lifetime.start.p0(i64 16, ptr %23) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %23, ptr align 8 @__const.main.wait, i64 16, i1 false)
  %155 = call i32 @select(i32 noundef 0, ptr noundef null, ptr noundef null, ptr noundef null, ptr noundef %23)
  store i32 %155, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 16, ptr %23) #5
  br label %160

156:                                              ; preds = %151
  %157 = load i32, ptr %14, align 4, !tbaa !5
  %158 = add nsw i32 %157, 1
  %159 = call i32 @select(i32 noundef %158, ptr noundef %11, ptr noundef %12, ptr noundef %13, ptr noundef %8)
  store i32 %159, ptr %9, align 4, !tbaa !5
  br label %160

160:                                              ; preds = %156, %154
  %161 = load i32, ptr %9, align 4, !tbaa !5
  switch i32 %161, label %163 [
    i32 -1, label %166
    i32 0, label %162
  ]

162:                                              ; preds = %160
  br label %163

163:                                              ; preds = %162, %160
  %164 = load ptr, ptr %3, align 8, !tbaa !9
  %165 = call i32 @curl_multi_perform(ptr noundef %164, ptr noundef %4)
  br label %166

166:                                              ; preds = %163, %160
  store i32 0, ptr %22, align 4
  br label %167

167:                                              ; preds = %166, %147
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 128, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 128, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 128, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #5
  %168 = load i32, ptr %22, align 4
  switch i32 %168, label %234 [
    i32 0, label %169
    i32 9, label %170
  ]

169:                                              ; preds = %167
  br label %64, !llvm.loop !22

170:                                              ; preds = %167, %64
  br label %171

171:                                              ; preds = %217, %170
  %172 = load ptr, ptr %3, align 8, !tbaa !9
  %173 = call ptr @curl_multi_info_read(ptr noundef %172, ptr noundef %7)
  store ptr %173, ptr %6, align 8, !tbaa !9
  %174 = icmp ne ptr %173, null
  br i1 %174, label %175, label %218

175:                                              ; preds = %171
  %176 = load ptr, ptr %6, align 8, !tbaa !9
  %177 = getelementptr inbounds %struct.CURLMsg, ptr %176, i32 0, i32 0
  %178 = load i32, ptr %177, align 8, !tbaa !23
  %179 = icmp eq i32 %178, 1
  br i1 %179, label %180, label %217

180:                                              ; preds = %175
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #5
  store i32 0, ptr %24, align 4, !tbaa !5
  br label %181

181:                                              ; preds = %201, %180
  %182 = load i32, ptr %24, align 4, !tbaa !5
  %183 = icmp slt i32 %182, 2
  br i1 %183, label %184, label %204

184:                                              ; preds = %181
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #5
  %185 = load ptr, ptr %6, align 8, !tbaa !9
  %186 = getelementptr inbounds %struct.CURLMsg, ptr %185, i32 0, i32 1
  %187 = load ptr, ptr %186, align 8, !tbaa !25
  %188 = load i32, ptr %24, align 4, !tbaa !5
  %189 = sext i32 %188 to i64
  %190 = getelementptr inbounds [2 x ptr], ptr %2, i64 0, i64 %189
  %191 = load ptr, ptr %190, align 8, !tbaa !9
  %192 = icmp eq ptr %187, %191
  %193 = zext i1 %192 to i32
  store i32 %193, ptr %25, align 4, !tbaa !5
  %194 = load i32, ptr %25, align 4, !tbaa !5
  %195 = icmp ne i32 %194, 0
  br i1 %195, label %196, label %197

196:                                              ; preds = %184
  store i32 28, ptr %22, align 4
  br label %198

197:                                              ; preds = %184
  store i32 0, ptr %22, align 4
  br label %198

198:                                              ; preds = %197, %196
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #5
  %199 = load i32, ptr %22, align 4
  switch i32 %199, label %234 [
    i32 0, label %200
    i32 28, label %204
  ]

200:                                              ; preds = %198
  br label %201

201:                                              ; preds = %200
  %202 = load i32, ptr %24, align 4, !tbaa !5
  %203 = add nsw i32 %202, 1
  store i32 %203, ptr %24, align 4, !tbaa !5
  br label %181, !llvm.loop !26

204:                                              ; preds = %198, %181
  %205 = load i32, ptr %24, align 4, !tbaa !5
  switch i32 %205, label %216 [
    i32 0, label %206
    i32 1, label %211
  ]

206:                                              ; preds = %204
  %207 = load ptr, ptr %6, align 8, !tbaa !9
  %208 = getelementptr inbounds %struct.CURLMsg, ptr %207, i32 0, i32 2
  %209 = load i32, ptr %208, align 8, !tbaa !27
  %210 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %209)
  br label %216

211:                                              ; preds = %204
  %212 = load ptr, ptr %6, align 8, !tbaa !9
  %213 = getelementptr inbounds %struct.CURLMsg, ptr %212, i32 0, i32 2
  %214 = load i32, ptr %213, align 8, !tbaa !27
  %215 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %214)
  br label %216

216:                                              ; preds = %211, %206, %204
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #5
  br label %217

217:                                              ; preds = %216, %175
  br label %171, !llvm.loop !28

218:                                              ; preds = %171
  %219 = load ptr, ptr %3, align 8, !tbaa !9
  %220 = call i32 @curl_multi_cleanup(ptr noundef %219)
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %221

221:                                              ; preds = %229, %218
  %222 = load i32, ptr %5, align 4, !tbaa !5
  %223 = icmp slt i32 %222, 2
  br i1 %223, label %224, label %232

224:                                              ; preds = %221
  %225 = load i32, ptr %5, align 4, !tbaa !5
  %226 = sext i32 %225 to i64
  %227 = getelementptr inbounds [2 x ptr], ptr %2, i64 0, i64 %226
  %228 = load ptr, ptr %227, align 8, !tbaa !9
  call void @curl_easy_cleanup(ptr noundef %228)
  br label %229

229:                                              ; preds = %224
  %230 = load i32, ptr %5, align 4, !tbaa !5
  %231 = add nsw i32 %230, 1
  store i32 %231, ptr %5, align 4, !tbaa !5
  br label %221, !llvm.loop !29

232:                                              ; preds = %221
  store i32 0, ptr %1, align 4
  store i32 1, ptr %22, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %2) #5
  %233 = load i32, ptr %1, align 4
  ret i32 %233

234:                                              ; preds = %198, %167
  unreachable
}

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

declare ptr @curl_easy_init() #2

declare i32 @curl_easy_setopt(ptr noundef, i32 noundef, ...) #2

declare ptr @curl_multi_init() #2

declare i32 @curl_multi_add_handle(ptr noundef, ptr noundef) #2

declare i32 @curl_multi_perform(ptr noundef, ptr noundef) #2

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

declare i32 @curl_multi_timeout(ptr noundef, ptr noundef) #2

declare i32 @curl_multi_fdset(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

declare i32 @select(i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

declare ptr @curl_multi_info_read(ptr noundef, ptr noundef) #2

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

declare i32 @curl_multi_cleanup(ptr noundef) #2

declare void @curl_easy_cleanup(ptr noundef) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 = distinct !{!13, !12}
!14 = !{!15, !15, i64 0}
!15 = !{!"long", !7, i64 0}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = !{!20, !15, i64 0}
!20 = !{!"timeval", !15, i64 0, !15, i64 8}
!21 = !{!20, !15, i64 8}
!22 = distinct !{!22, !12}
!23 = !{!24, !6, i64 0}
!24 = !{!"CURLMsg", !6, i64 0, !10, i64 8, !7, i64 16}
!25 = !{!24, !10, i64 8}
!26 = distinct !{!26, !12}
!27 = !{!7, !7, i64 0}
!28 = distinct !{!28, !12}
!29 = distinct !{!29, !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.timeval = type { i64, i64 }
%struct.fd_set = type { [16 x i64] }

@.str = external hidden unnamed_addr constant [20 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [18 x i8], align 1
@stderr = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [37 x i8], align 1
@__const.main.wait = external hidden unnamed_addr constant %struct.timeval, align 8
@.str.3 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [39 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %struct.timeval, align 8
  %4 = alloca %struct.fd_set, align 8
  %5 = alloca %struct.fd_set, align 8
  %6 = alloca %struct.fd_set, align 8
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca %struct.timeval, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  store i32 0, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %10 = tail call ptr @curl_easy_init() #6
  %11 = tail call ptr @curl_easy_init() #6
  %12 = tail call i32 (ptr, i32, ...) @curl_easy_setopt(ptr noundef %10, i32 noundef 10002, ptr noundef nonnull @.str) #6
  %13 = tail call i32 (ptr, i32, ...) @curl_easy_setopt(ptr noundef %11, i32 noundef 10002, ptr noundef nonnull @.str.1) #6
  %14 = tail call i32 (ptr, i32, ...) @curl_easy_setopt(ptr noundef %11, i32 noundef 46, i64 noundef 1) #6
  %15 = tail call ptr @curl_multi_init() #6
  %16 = tail call i32 @curl_multi_add_handle(ptr noundef %15, ptr noundef %10) #6
  %17 = tail call i32 @curl_multi_add_handle(ptr noundef %15, ptr noundef %11) #6
  %18 = call i32 @curl_multi_perform(ptr noundef %15, ptr noundef nonnull %1) #6
  %.old = load i32, ptr %1, align 4, !tbaa !5
  %.not.old = icmp eq i32 %.old, 0
  br i1 %.not.old, label %.loopexit, label %.preheader64

.preheader64:                                     ; preds = %0
  %19 = getelementptr inbounds i8, ptr %3, i64 8
  br label %.preheader63.preheader

.preheader63.preheader:                           ; preds = %.preheader64, %45
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %6) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #6
  store i32 -1, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #6
  store i64 -1, ptr %8, align 8, !tbaa !9
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(128) %4, i8 0, i64 128, i1 false), !tbaa !9
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(128) %5, i8 0, i64 128, i1 false), !tbaa !9
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(128) %6, i8 0, i64 128, i1 false), !tbaa !9
  store i64 1, ptr %3, align 8, !tbaa !11
  store i64 0, ptr %19, align 8, !tbaa !13
  %20 = call i32 @curl_multi_timeout(ptr noundef %15, ptr noundef nonnull %8) #6
  %21 = load i64, ptr %8, align 8, !tbaa !9
  %.frozen = freeze i64 %21
  %22 = icmp sgt i64 %.frozen, -1
  br i1 %22, label %23, label %30

23:                                               ; preds = %.preheader63.preheader
  %24 = udiv i64 %.frozen, 1000
  store i64 %24, ptr %3, align 8, !tbaa !11
  %25 = icmp ugt i64 %.frozen, 1999
  br i1 %25, label %26, label %27

26:                                               ; preds = %23
  store i64 1, ptr %3, align 8, !tbaa !11
  br label %30

27:                                               ; preds = %23
  %.urem = add nsw i64 %.frozen, -1000
  %.cmp = icmp ult i64 %.frozen, 1000
  %28 = select i1 %.cmp, i64 %.frozen, i64 %.urem
  %29 = mul nuw nsw i64 %28, 1000
  store i64 %29, ptr %19, align 8, !tbaa !13
  br label %30

30:                                               ; preds = %26, %27, %.preheader63.preheader
  %31 = call i32 @curl_multi_fdset(ptr noundef %15, ptr noundef nonnull %4, ptr noundef nonnull %5, ptr noundef nonnull %6, ptr noundef nonnull %7) #6
  %.not56 = icmp eq i32 %31, 0
  br i1 %.not56, label %34, label %.thread

.thread:                                          ; preds = %30
  %32 = load ptr, ptr @stderr, align 8, !tbaa !14
  %33 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %32, ptr noundef nonnull @.str.2, i32 noundef %31) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #6
  br label %.loopexit

34:                                               ; preds = %30
  %35 = load i32, ptr %7, align 4, !tbaa !5
  %36 = icmp eq i32 %35, -1
  br i1 %36, label %37, label %39

37:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %9) #6
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 8 dereferenceable(16) @__const.main.wait, i64 16, i1 false)
  %38 = call i32 @select(i32 noundef 0, ptr noundef null, ptr noundef null, ptr noundef null, ptr noundef nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #6
  br label %42

39:                                               ; preds = %34
  %40 = add nuw nsw i32 %35, 1
  %41 = call i32 @select(i32 noundef %40, ptr noundef nonnull %4, ptr noundef nonnull %5, ptr noundef nonnull %6, ptr noundef nonnull %3) #6
  br label %42

42:                                               ; preds = %39, %37
  %.046 = phi i32 [ %38, %37 ], [ %41, %39 ]
  %cond = icmp eq i32 %.046, -1
  br i1 %cond, label %45, label %43

43:                                               ; preds = %42
  %44 = call i32 @curl_multi_perform(ptr noundef %15, ptr noundef nonnull %1) #6
  br label %45

45:                                               ; preds = %43, %42
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #6
  %46 = load i32, ptr %1, align 4
  %.not = icmp eq i32 %46, 0
  br i1 %.not, label %.loopexit, label %.preheader63.preheader

.loopexit:                                        ; preds = %45, %.thread, %0
  %47 = call ptr @curl_multi_info_read(ptr noundef %15, ptr noundef nonnull %2) #6
  %.not5772 = icmp eq ptr %47, null
  br i1 %.not5772, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.loopexit, %.thread88
  %48 = phi ptr [ %59, %.thread88 ], [ %47, %.loopexit ]
  %49 = load i32, ptr %48, align 8, !tbaa !16
  %50 = icmp eq i32 %49, 1
  br i1 %50, label %.preheader, label %.thread88

.preheader:                                       ; preds = %.lr.ph
  %51 = getelementptr inbounds i8, ptr %48, i64 8
  %52 = load ptr, ptr %51, align 8, !tbaa !18
  %53 = icmp eq ptr %52, %10
  br i1 %53, label %.thread88.sink.split, label %54

54:                                               ; preds = %.preheader
  %55 = icmp eq ptr %52, %11
  br i1 %55, label %.thread88.sink.split, label %.thread88

.thread88.sink.split:                             ; preds = %54, %.preheader
  %.str.3.sink = phi ptr [ @.str.3, %.preheader ], [ @.str.4, %54 ]
  %56 = getelementptr inbounds i8, ptr %48, i64 16
  %57 = load i32, ptr %56, align 8, !tbaa !19
  %58 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.3.sink, i32 noundef %57)
  br label %.thread88

.thread88:                                        ; preds = %.thread88.sink.split, %54, %.lr.ph
  %59 = call ptr @curl_multi_info_read(ptr noundef %15, ptr noundef nonnull %2) #6
  %.not57 = icmp eq ptr %59, null
  br i1 %.not57, label %._crit_edge, label %.lr.ph, !llvm.loop !20

._crit_edge:                                      ; preds = %.thread88, %.loopexit
  %60 = call i32 @curl_multi_cleanup(ptr noundef %15) #6
  call void @curl_easy_cleanup(ptr noundef %10) #6
  call void @curl_easy_cleanup(ptr noundef %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  ret i32 0
}

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

declare ptr @curl_easy_init() local_unnamed_addr #2

declare i32 @curl_easy_setopt(ptr noundef, i32 noundef, ...) local_unnamed_addr #2

declare ptr @curl_multi_init() local_unnamed_addr #2

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

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

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

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

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

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

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

declare ptr @curl_multi_info_read(ptr noundef, ptr noundef) local_unnamed_addr #2

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

declare i32 @curl_multi_cleanup(ptr noundef) local_unnamed_addr #2

declare void @curl_easy_cleanup(ptr noundef) local_unnamed_addr #2

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

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind }
attributes #7 = { cold 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 = !{!"long", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"timeval", !10, i64 0, !10, i64 8}
!13 = !{!12, !10, i64 8}
!14 = !{!15, !15, i64 0}
!15 = !{!"any pointer", !7, i64 0}
!16 = !{!17, !6, i64 0}
!17 = !{!"CURLMsg", !6, i64 0, !15, i64 8, !7, i64 16}
!18 = !{!17, !15, i64 8}
!19 = !{!7, !7, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}


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