Source_Code
stringlengths
69
484k
IR_Original
stringlengths
2.05k
17.9M
#include <stdio.h> int main(){ char s[105],t[105]; scanf("%s %s",s,t); printf("%s%s\n",t,s); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183467/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183467/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [6 x i8] c"%s %s\00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"%s%s\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %s = alloca [105 x i8], align 16 %t = alloca [105 x i8], align 16 call void @llvm.lifetime.start.p0(i64 105, ptr nonnull %s) #3 call void @llvm.lifetime.start.p0(i64 105, ptr nonnull %t) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s, ptr noundef nonnull %t) %call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %t, ptr noundef nonnull %s) call void @llvm.lifetime.end.p0(i64 105, ptr nonnull %t) #3 call void @llvm.lifetime.end.p0(i64 105, ptr nonnull %s) #3 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 attributes #0 = { nofree 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 = { 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 #3 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
#include <stdlib.h> #include <stdio.h> #include <math.h> long long min(long long a,long long b){ if (a<b) { return a; } return b; } int main() { int t; scanf("%d",&t); while (t) { long long a,b; scanf("%lld %lld",&a,&b); t--; long long first=llabs(a-b); if (first==0) { printf("%d %d\n",0,0); }else{ long long second=min(a%first, first-a%first); printf("%lld %lld\n",first,second); } } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_18351/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_18351/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [10 x i8] c"%lld %lld\00", align 1 @.str.2 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1 @.str.3 = private unnamed_addr constant [11 x i8] c"%lld %lld\0A\00", align 1 ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i64 @min(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 { entry: %a.b = tail call i64 @llvm.smin.i64(i64 %a, i64 %b) ret i64 %a.b } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %t = alloca i32, align 4 %a = alloca i64, align 8 %b = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #6 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t) %0 = load i32, ptr %t, align 4, !tbaa !5 %tobool.not11 = icmp eq i32 %0, 0 br i1 %tobool.not11, label %while.end, label %while.body while.body: ; preds = %entry, %if.end call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #6 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #6 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %b) %1 = load i32, ptr %t, align 4, !tbaa !5 %dec = add nsw i32 %1, -1 store i32 %dec, ptr %t, align 4, !tbaa !5 %2 = load i64, ptr %a, align 8, !tbaa !9 %3 = load i64, ptr %b, align 8, !tbaa !9 %cmp = icmp eq i64 %2, %3 br i1 %cmp, label %if.then, label %if.else if.then: ; preds = %while.body %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 0, i32 noundef 0) br label %if.end if.else: ; preds = %while.body %sub = sub nsw i64 %2, %3 %4 = call i64 @llvm.abs.i64(i64 %sub, i1 true) %rem = srem i64 %2, %4 %sub4 = sub nsw i64 %4, %rem %a.b.i = call i64 @llvm.smin.i64(i64 %rem, i64 %sub4) %call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %4, i64 noundef %a.b.i) br label %if.end if.end: ; preds = %if.else, %if.then call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #6 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #6 %5 = load i32, ptr %t, align 4, !tbaa !5 %tobool.not = icmp eq i32 %5, 0 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !11 while.end: ; preds = %if.end, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #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) #2 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.abs.i64(i64, i1 immarg) #4 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smin.i64(i64, i64) #5 attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) 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 uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } 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 nosync nounwind speculatable willreturn memory(none) } attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #6 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !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 long", !7, i64 0} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #include <string.h> int main(void) { char s[200],t[202]; scanf("%s%s",s,t); strcat(t,s); printf("%s",t); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183553/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183553/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %s = alloca [200 x i8], align 16 %t = alloca [202 x i8], align 16 call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %s) #4 call void @llvm.lifetime.start.p0(i64 202, ptr nonnull %t) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s, ptr noundef nonnull %t) %call4 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %t, ptr noundef nonnull dereferenceable(1) %s) #4 %call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %t) call void @llvm.lifetime.end.p0(i64 202, ptr nonnull %t) #4 call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %s) #4 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite) declare ptr @strcat(ptr noalias noundef returned, ptr noalias nocapture noundef readonly) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 attributes #0 = { nofree 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 = { 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 #3 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nounwind } !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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
#include<stdio.h> int main() { char str[100],str1[100]; scanf("%s%s",&str,&str1); printf("%s%s",str1,str); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183597/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183597/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %str = alloca [100 x i8], align 16 %str1 = alloca [100 x i8], align 16 call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %str) #3 call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %str1) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str, ptr noundef nonnull %str1) %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull %str1, ptr noundef nonnull %str) call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %str1) #3 call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %str) #3 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 attributes #0 = { nofree 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 = { 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 #3 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
#include<stdio.h> typedef unsigned u; int main() { u p,a[11],i,m=0xffffffffu,l,v,V,o=1; scanf("%u",&p); for(i=0;i++<9;) { scanf("%u",&a[i]); if(a[i]<=m) { m=a[i];v=i; } } l=p/m;V=9; if(l) { p-=l*m; while(l--) { if(o)for(o=0,i=V;i>v;i--)if(p>=a[i]-m) { p-=a[i]-m; o=1;V=i; break; } putchar(i+'0'); } } else{putchar('-');putchar('1');} putchar('\n'); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_18364/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_18364/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%u\00", align 1 @stdout = external local_unnamed_addr global ptr, align 8 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %p = alloca i32, align 4 %a = alloca [11 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %p) #4 call void @llvm.lifetime.start.p0(i64 44, ptr nonnull %a) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %p) %arrayidx = getelementptr inbounds [11 x i32], ptr %a, i64 0, i64 1 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %0 = load i32, ptr %arrayidx, align 4, !tbaa !5 %arrayidx.1 = getelementptr inbounds [11 x i32], ptr %a, i64 0, i64 2 %call1.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.1) %1 = load i32, ptr %arrayidx.1, align 8, !tbaa !5 %cmp4.not.1 = icmp ugt i32 %1, %0 %spec.select.1 = call i32 @llvm.umin.i32(i32 %1, i32 %0) %spec.select49.1 = select i1 %cmp4.not.1, i32 1, i32 2 %arrayidx.2 = getelementptr inbounds [11 x i32], ptr %a, i64 0, i64 3 %call1.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.2) %2 = load i32, ptr %arrayidx.2, align 4, !tbaa !5 %cmp4.not.2 = icmp ugt i32 %2, %spec.select.1 %spec.select.2 = call i32 @llvm.umin.i32(i32 %2, i32 %spec.select.1) %spec.select49.2 = select i1 %cmp4.not.2, i32 %spec.select49.1, i32 3 %arrayidx.3 = getelementptr inbounds [11 x i32], ptr %a, i64 0, i64 4 %call1.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.3) %3 = load i32, ptr %arrayidx.3, align 16, !tbaa !5 %cmp4.not.3 = icmp ugt i32 %3, %spec.select.2 %spec.select.3 = call i32 @llvm.umin.i32(i32 %3, i32 %spec.select.2) %spec.select49.3 = select i1 %cmp4.not.3, i32 %spec.select49.2, i32 4 %arrayidx.4 = getelementptr inbounds [11 x i32], ptr %a, i64 0, i64 5 %call1.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.4) %4 = load i32, ptr %arrayidx.4, align 4, !tbaa !5 %cmp4.not.4 = icmp ugt i32 %4, %spec.select.3 %spec.select.4 = call i32 @llvm.umin.i32(i32 %4, i32 %spec.select.3) %spec.select49.4 = select i1 %cmp4.not.4, i32 %spec.select49.3, i32 5 %arrayidx.5 = getelementptr inbounds [11 x i32], ptr %a, i64 0, i64 6 %call1.5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.5) %5 = load i32, ptr %arrayidx.5, align 8, !tbaa !5 %cmp4.not.5 = icmp ugt i32 %5, %spec.select.4 %spec.select.5 = call i32 @llvm.umin.i32(i32 %5, i32 %spec.select.4) %spec.select49.5 = select i1 %cmp4.not.5, i32 %spec.select49.4, i32 6 %arrayidx.6 = getelementptr inbounds [11 x i32], ptr %a, i64 0, i64 7 %call1.6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.6) %6 = load i32, ptr %arrayidx.6, align 4, !tbaa !5 %cmp4.not.6 = icmp ugt i32 %6, %spec.select.5 %spec.select.6 = call i32 @llvm.umin.i32(i32 %6, i32 %spec.select.5) %spec.select49.6 = select i1 %cmp4.not.6, i32 %spec.select49.5, i32 7 %arrayidx.7 = getelementptr inbounds [11 x i32], ptr %a, i64 0, i64 8 %call1.7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.7) %7 = load i32, ptr %arrayidx.7, align 16, !tbaa !5 %cmp4.not.7 = icmp ugt i32 %7, %spec.select.6 %spec.select.7 = call i32 @llvm.umin.i32(i32 %7, i32 %spec.select.6) %spec.select49.7 = select i1 %cmp4.not.7, i32 %spec.select49.6, i32 8 %arrayidx.8 = getelementptr inbounds [11 x i32], ptr %a, i64 0, i64 9 %call1.8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.8) %8 = load i32, ptr %arrayidx.8, align 4, !tbaa !5 %cmp4.not.8 = icmp ugt i32 %8, %spec.select.7 %spec.select.8 = call i32 @llvm.umin.i32(i32 %8, i32 %spec.select.7) %spec.select49.8 = select i1 %cmp4.not.8, i32 %spec.select49.7, i32 9 %9 = load i32, ptr %p, align 4, !tbaa !5 %tobool.not = icmp ugt i32 %spec.select.8, %9 br i1 %tobool.not, label %if.else, label %while.body.preheader while.body.preheader: ; preds = %entry %div = udiv i32 %9, %spec.select.8 %mul = mul i32 %div, %spec.select.8 %sub.recomposed = urem i32 %9, %spec.select.8 store i32 %sub.recomposed, ptr %p, align 4, !tbaa !5 br label %while.body while.body: ; preds = %while.body.preheader, %if.end26 %dec64.in = phi i32 [ %dec64, %if.end26 ], [ %div, %while.body.preheader ] %o.063 = phi i32 [ %o.1, %if.end26 ], [ 1, %while.body.preheader ] %V.062 = phi i32 [ %V.1, %if.end26 ], [ 9, %while.body.preheader ] %i.161 = phi i32 [ %i.3, %if.end26 ], [ 10, %while.body.preheader ] %dec64 = add i32 %dec64.in, -1 %tobool9.not = icmp eq i32 %o.063, 0 br i1 %tobool9.not, label %if.end26, label %for.cond11.preheader for.cond11.preheader: ; preds = %while.body %cmp1257 = icmp ugt i32 %V.062, %spec.select49.8 br i1 %cmp1257, label %for.body13.lr.ph, label %if.end26 for.body13.lr.ph: ; preds = %for.cond11.preheader %10 = load i32, ptr %p, align 4, !tbaa !5 br label %for.body13 for.body13: ; preds = %for.body13.lr.ph, %for.inc %i.258 = phi i32 [ %V.062, %for.body13.lr.ph ], [ %dec24, %for.inc ] %idxprom14 = zext i32 %i.258 to i64 %arrayidx15 = getelementptr inbounds [11 x i32], ptr %a, i64 0, i64 %idxprom14 %11 = load i32, ptr %arrayidx15, align 4, !tbaa !5 %sub16 = sub i32 %11, %spec.select.8 %cmp17.not = icmp ult i32 %10, %sub16 br i1 %cmp17.not, label %for.inc, label %if.then18 if.then18: ; preds = %for.body13 %sub22 = sub i32 %10, %sub16 store i32 %sub22, ptr %p, align 4, !tbaa !5 br label %if.end26 for.inc: ; preds = %for.body13 %dec24 = add i32 %i.258, -1 %cmp12 = icmp ugt i32 %dec24, %spec.select49.8 br i1 %cmp12, label %for.body13, label %if.end26, !llvm.loop !9 if.end26: ; preds = %for.inc, %for.cond11.preheader, %if.then18, %while.body %i.3 = phi i32 [ %i.258, %if.then18 ], [ %i.161, %while.body ], [ %V.062, %for.cond11.preheader ], [ %spec.select49.8, %for.inc ] %V.1 = phi i32 [ %i.258, %if.then18 ], [ %V.062, %while.body ], [ %V.062, %for.cond11.preheader ], [ %V.062, %for.inc ] %o.1 = phi i32 [ 1, %if.then18 ], [ 0, %while.body ], [ 0, %for.cond11.preheader ], [ 0, %for.inc ] %add = add i32 %i.3, 48 %12 = load ptr, ptr @stdout, align 8, !tbaa !11 %call.i = call i32 @putc(i32 noundef %add, ptr noundef %12) %tobool8.not = icmp eq i32 %dec64, 0 br i1 %tobool8.not, label %if.end30, label %while.body, !llvm.loop !13 if.else: ; preds = %entry %13 = load ptr, ptr @stdout, align 8, !tbaa !11 %call.i50 = call i32 @putc(i32 noundef 45, ptr noundef %13) %14 = load ptr, ptr @stdout, align 8, !tbaa !11 %call.i51 = call i32 @putc(i32 noundef 49, ptr noundef %14) br label %if.end30 if.end30: ; preds = %if.end26, %if.else %15 = load ptr, ptr @stdout, align 8, !tbaa !11 %call.i52 = call i32 @putc(i32 noundef 10, ptr noundef %15) call void @llvm.lifetime.end.p0(i64 44, ptr nonnull %a) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %p) #4 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nofree nounwind declare noundef i32 @putc(i32 noundef, ptr nocapture noundef) local_unnamed_addr #2 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.umin.i32(i32, i32) #3 attributes #0 = { nofree 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 = { 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 #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!12, !12, i64 0} !12 = !{!"any pointer", !7, i64 0} !13 = distinct !{!13, !10}
#include <stdio.h> int main(void) { char s[101], t[101]; scanf("%s %s", s, t); printf("%s%s", t, s); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183683/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183683/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [6 x i8] c"%s %s\00", align 1 @.str.1 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %s = alloca [101 x i8], align 16 %t = alloca [101 x i8], align 16 call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %s) #3 call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %t) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s, ptr noundef nonnull %t) %call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %t, ptr noundef nonnull %s) call void @llvm.lifetime.end.p0(i64 101, ptr nonnull %t) #3 call void @llvm.lifetime.end.p0(i64 101, ptr nonnull %s) #3 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 attributes #0 = { nofree 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 = { 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 #3 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
#include <stdio.h> int main(void){ char S[100]; char T[100]; scanf("%s",S); scanf("%s",T); printf("%s%s\n",T,S); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183726/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183726/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"%s%s\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %S = alloca [100 x i8], align 16 %T = alloca [100 x i8], align 16 call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %S) #3 call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %T) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S) %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %T) %call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %T, ptr noundef nonnull %S) call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %T) #3 call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %S) #3 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 attributes #0 = { nofree 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 = { 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 #3 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
#include <stdio.h> #include <stdlib.h> int main() { int amount = 0, ca = 0, i = 0, li = 0, len = 0; int prices[9]; scanf("%d", &amount); for (i = 0; i < 9; i++) { scanf("%d", &prices[i]); if (prices[i] <= prices[li]) li = i; } len = amount / prices[li]; ca = amount % prices[li]; if (len <= 0) { printf("-1"); return 0; } for (i = 8; i > li; i--) { while (ca >= (prices[i] - prices[li])) { putchar('1' + i); ca -= (prices[i] - prices[li]); len--; } } while (len) { putchar('1' + li); len--; } printf("\n"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_18377/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_18377/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"-1\00", align 1 @stdout = external local_unnamed_addr global ptr, align 8 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %amount = alloca i32, align 4 %prices = alloca [9 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %amount) #3 store i32 0, ptr %amount, align 4, !tbaa !5 call void @llvm.lifetime.start.p0(i64 36, ptr nonnull %prices) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %amount) %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %prices) %arrayidx.1 = getelementptr inbounds [9 x i32], ptr %prices, i64 0, i64 1 %call1.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.1) %0 = load i32, ptr %arrayidx.1, align 4, !tbaa !5 %1 = load i32, ptr %prices, align 16, !tbaa !5 %cmp6.not.1 = icmp sle i32 %0, %1 %spec.select.1 = zext i1 %cmp6.not.1 to i32 %arrayidx.2 = getelementptr inbounds [9 x i32], ptr %prices, i64 0, i64 2 %call1.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.2) %2 = load i32, ptr %arrayidx.2, align 8, !tbaa !5 %idxprom4.2 = zext i1 %cmp6.not.1 to i64 %arrayidx5.2 = getelementptr inbounds [9 x i32], ptr %prices, i64 0, i64 %idxprom4.2 %3 = load i32, ptr %arrayidx5.2, align 4, !tbaa !5 %cmp6.not.2 = icmp sgt i32 %2, %3 %spec.select.2 = select i1 %cmp6.not.2, i32 %spec.select.1, i32 2 %arrayidx.3 = getelementptr inbounds [9 x i32], ptr %prices, i64 0, i64 3 %call1.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.3) %4 = load i32, ptr %arrayidx.3, align 4, !tbaa !5 %idxprom4.3 = zext i32 %spec.select.2 to i64 %arrayidx5.3 = getelementptr inbounds [9 x i32], ptr %prices, i64 0, i64 %idxprom4.3 %5 = load i32, ptr %arrayidx5.3, align 4, !tbaa !5 %cmp6.not.3 = icmp sgt i32 %4, %5 %spec.select.3 = select i1 %cmp6.not.3, i32 %spec.select.2, i32 3 %arrayidx.4 = getelementptr inbounds [9 x i32], ptr %prices, i64 0, i64 4 %call1.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.4) %6 = load i32, ptr %arrayidx.4, align 16, !tbaa !5 %idxprom4.4 = zext i32 %spec.select.3 to i64 %arrayidx5.4 = getelementptr inbounds [9 x i32], ptr %prices, i64 0, i64 %idxprom4.4 %7 = load i32, ptr %arrayidx5.4, align 4, !tbaa !5 %cmp6.not.4 = icmp sgt i32 %6, %7 %spec.select.4 = select i1 %cmp6.not.4, i32 %spec.select.3, i32 4 %arrayidx.5 = getelementptr inbounds [9 x i32], ptr %prices, i64 0, i64 5 %call1.5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.5) %8 = load i32, ptr %arrayidx.5, align 4, !tbaa !5 %idxprom4.5 = zext i32 %spec.select.4 to i64 %arrayidx5.5 = getelementptr inbounds [9 x i32], ptr %prices, i64 0, i64 %idxprom4.5 %9 = load i32, ptr %arrayidx5.5, align 4, !tbaa !5 %cmp6.not.5 = icmp sgt i32 %8, %9 %spec.select.5 = select i1 %cmp6.not.5, i32 %spec.select.4, i32 5 %arrayidx.6 = getelementptr inbounds [9 x i32], ptr %prices, i64 0, i64 6 %call1.6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.6) %10 = load i32, ptr %arrayidx.6, align 8, !tbaa !5 %idxprom4.6 = zext i32 %spec.select.5 to i64 %arrayidx5.6 = getelementptr inbounds [9 x i32], ptr %prices, i64 0, i64 %idxprom4.6 %11 = load i32, ptr %arrayidx5.6, align 4, !tbaa !5 %cmp6.not.6 = icmp sgt i32 %10, %11 %spec.select.6 = select i1 %cmp6.not.6, i32 %spec.select.5, i32 6 %arrayidx.7 = getelementptr inbounds [9 x i32], ptr %prices, i64 0, i64 7 %call1.7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.7) %12 = load i32, ptr %arrayidx.7, align 4, !tbaa !5 %idxprom4.7 = zext i32 %spec.select.6 to i64 %arrayidx5.7 = getelementptr inbounds [9 x i32], ptr %prices, i64 0, i64 %idxprom4.7 %13 = load i32, ptr %arrayidx5.7, align 4, !tbaa !5 %cmp6.not.7 = icmp sgt i32 %12, %13 %spec.select.7 = select i1 %cmp6.not.7, i32 %spec.select.6, i32 7 %arrayidx.8 = getelementptr inbounds [9 x i32], ptr %prices, i64 0, i64 8 %call1.8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.8) %14 = load i32, ptr %arrayidx.8, align 16, !tbaa !5 %idxprom4.8 = zext i32 %spec.select.7 to i64 %arrayidx5.8 = getelementptr inbounds [9 x i32], ptr %prices, i64 0, i64 %idxprom4.8 %15 = load i32, ptr %arrayidx5.8, align 4, !tbaa !5 %cmp6.not.8 = icmp sgt i32 %14, %15 %spec.select.8 = select i1 %cmp6.not.8, i32 %spec.select.7, i32 8 %16 = load i32, ptr %amount, align 4, !tbaa !5 %idxprom7 = zext i32 %spec.select.8 to i64 %arrayidx8 = getelementptr inbounds [9 x i32], ptr %prices, i64 0, i64 %idxprom7 %17 = load i32, ptr %arrayidx8, align 4, !tbaa !5 %div = sdiv i32 %16, %17 %rem = srem i32 %16, %17 %cmp11 = icmp slt i32 %div, 1 br i1 %cmp11, label %if.then12, label %if.end14 if.then12: ; preds = %entry %call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1) br label %cleanup if.end14: ; preds = %entry br i1 %cmp6.not.8, label %while.cond.preheader, label %while.body34.lr.ph while.cond.preheader: ; preds = %if.end14, %for.inc30 %18 = phi i32 [ %25, %for.inc30 ], [ %17, %if.end14 ] %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc30 ], [ 8, %if.end14 ] %len.076 = phi i32 [ %len.1.lcssa, %for.inc30 ], [ %div, %if.end14 ] %ca.074 = phi i32 [ %ca.1.lcssa, %for.inc30 ], [ %rem, %if.end14 ] %arrayidx19 = getelementptr inbounds [9 x i32], ptr %prices, i64 0, i64 %indvars.iv %19 = load i32, ptr %arrayidx19, align 4, !tbaa !5 %sub68 = sub nsw i32 %19, %18 %cmp22.not69 = icmp slt i32 %ca.074, %sub68 br i1 %cmp22.not69, label %for.inc30, label %while.body.lr.ph while.body.lr.ph: ; preds = %while.cond.preheader %20 = trunc i64 %indvars.iv to i32 %21 = add i32 %20, 49 br label %while.body while.cond33.preheader: ; preds = %for.inc30 %tobool.not78 = icmp eq i32 %len.1.lcssa, 0 br i1 %tobool.not78, label %while.end38, label %while.body34.lr.ph while.body34.lr.ph: ; preds = %if.end14, %while.cond33.preheader %len.0.lcssa85 = phi i32 [ %len.1.lcssa, %while.cond33.preheader ], [ %div, %if.end14 ] %add35 = add nuw nsw i32 %spec.select.8, 49 br label %while.body34 while.body: ; preds = %while.body.lr.ph, %while.body %len.171 = phi i32 [ %len.076, %while.body.lr.ph ], [ %dec, %while.body ] %ca.170 = phi i32 [ %ca.074, %while.body.lr.ph ], [ %sub29, %while.body ] %22 = load ptr, ptr @stdout, align 8, !tbaa !9 %call.i = call noundef i32 @putc(i32 noundef %21, ptr noundef %22) %23 = load i32, ptr %arrayidx19, align 4, !tbaa !5 %24 = load i32, ptr %arrayidx8, align 4, !tbaa !5 %sub28.neg = sub i32 %ca.170, %23 %sub29 = add i32 %sub28.neg, %24 %dec = add nsw i32 %len.171, -1 %sub = sub nsw i32 %23, %24 %cmp22.not = icmp slt i32 %sub29, %sub br i1 %cmp22.not, label %for.inc30, label %while.body, !llvm.loop !11 for.inc30: ; preds = %while.body, %while.cond.preheader %25 = phi i32 [ %18, %while.cond.preheader ], [ %24, %while.body ] %ca.1.lcssa = phi i32 [ %ca.074, %while.cond.preheader ], [ %sub29, %while.body ] %len.1.lcssa = phi i32 [ %len.076, %while.cond.preheader ], [ %dec, %while.body ] %indvars.iv.next = add nsw i64 %indvars.iv, -1 %cmp16 = icmp sgt i64 %indvars.iv.next, %idxprom7 br i1 %cmp16, label %while.cond.preheader, label %while.cond33.preheader, !llvm.loop !13 while.body34: ; preds = %while.body34.lr.ph, %while.body34 %len.279 = phi i32 [ %len.0.lcssa85, %while.body34.lr.ph ], [ %dec37, %while.body34 ] %26 = load ptr, ptr @stdout, align 8, !tbaa !9 %call.i64 = call noundef i32 @putc(i32 noundef %add35, ptr noundef %26) %dec37 = add nsw i32 %len.279, -1 %tobool.not = icmp eq i32 %dec37, 0 br i1 %tobool.not, label %while.end38, label %while.body34, !llvm.loop !14 while.end38: ; preds = %while.body34, %while.cond33.preheader %27 = load ptr, ptr @stdout, align 8, !tbaa !9 %call.i65 = call noundef i32 @putc(i32 noundef 10, ptr noundef %27) br label %cleanup cleanup: ; preds = %while.end38, %if.then12 call void @llvm.lifetime.end.p0(i64 36, ptr nonnull %prices) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %amount) #3 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nofree nounwind declare noundef i32 @putc(i32 noundef, ptr nocapture noundef) local_unnamed_addr #2 attributes #0 = { nofree 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 = { 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 #3 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !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 = distinct !{!14, !12}
#include<stdio.h> int main(void){ char S[101],T[101]; int i; scanf("%s %s",S,T); printf("%s%s\n",T,S); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183812/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183812/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [6 x i8] c"%s %s\00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"%s%s\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %S = alloca [101 x i8], align 16 %T = alloca [101 x i8], align 16 call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %S) #3 call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %T) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S, ptr noundef nonnull %T) %call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %T, ptr noundef nonnull %S) call void @llvm.lifetime.end.p0(i64 101, ptr nonnull %T) #3 call void @llvm.lifetime.end.p0(i64 101, ptr nonnull %S) #3 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 attributes #0 = { nofree 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 = { 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 #3 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
#include <stdio.h> #include <string.h> int main() { int n, m; int h[105]; int target[100]; int cnt[105] = { 0 }; int i, j; scanf("%d%d", &n, &m); for (i = 0;i < m;i++) { scanf("%d", &target[i]); } for(i=0;i<m;i++){ for (j = 1;j <= n;j++){ scanf("%d", &h[j]); if (h[j] == target[i])cnt[j] += 1; else cnt[target[i]] += 1; } } for (i = 1;i <= n;i++) { printf("%d\n", cnt[i]); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183856/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183856/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %m = alloca i32, align 4 %h = alloca [105 x i32], align 16 %target = alloca [100 x i32], align 16 %cnt = alloca [105 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4 call void @llvm.lifetime.start.p0(i64 420, ptr nonnull %h) #4 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %target) #4 call void @llvm.lifetime.start.p0(i64 420, ptr nonnull %cnt) #4 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(420) %cnt, i8 0, i64 420, i1 false) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m) %0 = load i32, ptr %m, align 4, !tbaa !5 %cmp51 = icmp sgt i32 %0, 0 br i1 %cmp51, label %for.body, label %for.cond2.preheader.thread for.cond2.preheader.thread: ; preds = %entry %.pre7072 = load i32, ptr %n, align 4, !tbaa !5 br label %for.cond29.preheader for.cond2.preheader: ; preds = %for.body %cmp355 = icmp sgt i32 %2, 0 %.pre70 = load i32, ptr %n, align 4, !tbaa !5 br i1 %cmp355, label %for.cond5.preheader.lr.ph, label %for.cond29.preheader for.cond5.preheader.lr.ph: ; preds = %for.cond2.preheader %1 = icmp slt i32 %.pre70, 1 br i1 %1, label %for.end37, label %for.cond5.preheader for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100 x i32], ptr %target, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %2 = load i32, ptr %m, align 4, !tbaa !5 %3 = sext i32 %2 to i64 %cmp = icmp slt i64 %indvars.iv.next, %3 br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9 for.cond5.preheader: ; preds = %for.cond5.preheader.lr.ph, %for.inc26 %4 = phi i32 [ %12, %for.inc26 ], [ %2, %for.cond5.preheader.lr.ph ] %5 = phi i32 [ %13, %for.inc26 ], [ %.pre70, %for.cond5.preheader.lr.ph ] %indvars.iv64 = phi i64 [ %indvars.iv.next65, %for.inc26 ], [ 0, %for.cond5.preheader.lr.ph ] %cmp6.not53 = icmp slt i32 %5, 1 br i1 %cmp6.not53, label %for.inc26, label %for.body7.lr.ph for.body7.lr.ph: ; preds = %for.cond5.preheader %arrayidx14 = getelementptr inbounds [100 x i32], ptr %target, i64 0, i64 %indvars.iv64 br label %for.body7 for.cond29.preheader: ; preds = %for.inc26, %for.cond2.preheader.thread, %for.cond2.preheader %6 = phi i32 [ %.pre70, %for.cond2.preheader ], [ %.pre7072, %for.cond2.preheader.thread ], [ %13, %for.inc26 ] %cmp30.not57 = icmp slt i32 %6, 1 br i1 %cmp30.not57, label %for.end37, label %for.body31 for.body7: ; preds = %for.body7.lr.ph, %for.body7 %indvars.iv61 = phi i64 [ 1, %for.body7.lr.ph ], [ %indvars.iv.next62, %for.body7 ] %arrayidx9 = getelementptr inbounds [105 x i32], ptr %h, i64 0, i64 %indvars.iv61 %call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx9) %7 = load i32, ptr %arrayidx9, align 4, !tbaa !5 %8 = load i32, ptr %arrayidx14, align 4, !tbaa !5 %cmp15 = icmp eq i32 %7, %8 %idxprom20 = sext i32 %8 to i64 %indvars.iv61.sink = select i1 %cmp15, i64 %indvars.iv61, i64 %idxprom20 %arrayidx17 = getelementptr inbounds [105 x i32], ptr %cnt, i64 0, i64 %indvars.iv61.sink %9 = load i32, ptr %arrayidx17, align 4, !tbaa !5 %add = add nsw i32 %9, 1 store i32 %add, ptr %arrayidx17, align 4, !tbaa !5 %indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1 %10 = load i32, ptr %n, align 4, !tbaa !5 %11 = sext i32 %10 to i64 %cmp6.not.not = icmp slt i64 %indvars.iv61, %11 br i1 %cmp6.not.not, label %for.body7, label %for.inc26.loopexit, !llvm.loop !11 for.inc26.loopexit: ; preds = %for.body7 %.pre = load i32, ptr %m, align 4, !tbaa !5 br label %for.inc26 for.inc26: ; preds = %for.inc26.loopexit, %for.cond5.preheader %12 = phi i32 [ %.pre, %for.inc26.loopexit ], [ %4, %for.cond5.preheader ] %13 = phi i32 [ %10, %for.inc26.loopexit ], [ %5, %for.cond5.preheader ] %indvars.iv.next65 = add nuw nsw i64 %indvars.iv64, 1 %14 = sext i32 %12 to i64 %cmp3 = icmp slt i64 %indvars.iv.next65, %14 br i1 %cmp3, label %for.cond5.preheader, label %for.cond29.preheader, !llvm.loop !12 for.body31: ; preds = %for.cond29.preheader, %for.body31 %indvars.iv67 = phi i64 [ %indvars.iv.next68, %for.body31 ], [ 1, %for.cond29.preheader ] %arrayidx33 = getelementptr inbounds [105 x i32], ptr %cnt, i64 0, i64 %indvars.iv67 %15 = load i32, ptr %arrayidx33, align 4, !tbaa !5 %call34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %15) %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1 %16 = load i32, ptr %n, align 4, !tbaa !5 %17 = sext i32 %16 to i64 %cmp30.not.not = icmp slt i64 %indvars.iv67, %17 br i1 %cmp30.not.not, label %for.body31, label %for.end37, !llvm.loop !14 for.end37: ; preds = %for.body31, %for.cond5.preheader.lr.ph, %for.cond29.preheader call void @llvm.lifetime.end.p0(i64 420, ptr nonnull %cnt) #4 call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %target) #4 call void @llvm.lifetime.end.p0(i64 420, ptr nonnull %h) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 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 ; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) } 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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10, !13} !13 = !{!"llvm.loop.unswitch.partial.disable"} !14 = distinct !{!14, !10}
//WA #include <stdio.h> int main() { int n, k; scanf("%d%d", &n ,&k); long d = n/k; long ans = 0; ans += d*d*d; if (k%2 == 0) { d = n/(k/2) - d; ans += d*d*d; } printf("%ld\n", ans); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183920/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183920/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1 @.str.1 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %k = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k) %0 = load i32, ptr %n, align 4, !tbaa !5 %1 = load i32, ptr %k, align 4, !tbaa !5 %div = sdiv i32 %0, %1 %conv = sext i32 %div to i64 %mul = mul nsw i64 %conv, %conv %mul1 = mul nsw i64 %mul, %conv %2 = and i32 %1, 1 %cmp = icmp eq i32 %2, 0 br i1 %cmp, label %if.then, label %if.end if.then: ; preds = %entry %div3 = sdiv i32 %1, 2 %div4 = sdiv i32 %0, %div3 %conv5 = sext i32 %div4 to i64 %sub = sub nsw i64 %conv5, %conv %mul6 = mul nsw i64 %sub, %sub %mul7 = mul nsw i64 %mul6, %sub %add8 = add nsw i64 %mul7, %mul1 br label %if.end if.end: ; preds = %if.then, %entry %ans.0 = phi i64 [ %add8, %if.then ], [ %mul1, %entry ] %call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.0) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 attributes #0 = { nofree 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 = { 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 #3 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> int main(void){ int N,K; long int n,m,n_min,n_max; int i,j,k; int a,b,c; long int ans=0; scanf("%d %d",&N,&K); for(i=1;i<=N;i++){ a=i; if((2*a)%K==0){ n_min=a/K; n_max=(N+a)/K; n=n_max-n_min; ans+=n*n; } } printf("%ld\n",ans); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183964/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183964/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.1 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %N = alloca i32, align 4 %K = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %K) %0 = load i32, ptr %N, align 4, !tbaa !5 %cmp.not13 = icmp slt i32 %0, 1 br i1 %cmp.not13, label %for.end, label %for.body.lr.ph for.body.lr.ph: ; preds = %entry %1 = load i32, ptr %K, align 4, !tbaa !5 br label %for.body for.body: ; preds = %for.body.lr.ph, %for.inc %ans.015 = phi i64 [ 0, %for.body.lr.ph ], [ %ans.1, %for.inc ] %i.014 = phi i32 [ 1, %for.body.lr.ph ], [ %inc, %for.inc ] %mul = shl nuw nsw i32 %i.014, 1 %rem = srem i32 %mul, %1 %cmp1 = icmp eq i32 %rem, 0 br i1 %cmp1, label %if.then, label %for.inc if.then: ; preds = %for.body %div = sdiv i32 %i.014, %1 %conv = sext i32 %div to i64 %add = add nsw i32 %0, %i.014 %div2 = sdiv i32 %add, %1 %conv3 = sext i32 %div2 to i64 %sub = sub nsw i64 %conv3, %conv %mul4 = mul nsw i64 %sub, %sub %add5 = add nsw i64 %mul4, %ans.015 br label %for.inc for.inc: ; preds = %for.body, %if.then %ans.1 = phi i64 [ %add5, %if.then ], [ %ans.015, %for.body ] %inc = add nuw i32 %i.014, 1 %exitcond.not = icmp eq i32 %i.014, %0 br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !9 for.end: ; preds = %for.inc, %entry %ans.0.lcssa = phi i64 [ 0, %entry ], [ %ans.1, %for.inc ] %call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 attributes #0 = { nofree 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 = { 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 #3 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #define MAX_N 40 #define MAX_A 10 #define MAX_B 10 #define INF 1000000007 int min(int x, int y) { return (x < y) ? x : y; } int main() { int n, ma, mb; scanf("%d %d %d", &n, &ma, &mb); int dp[MAX_N * MAX_A + 1][MAX_N * MAX_B + 1]; for (int i = 0; i <= MAX_N * MAX_A; i++) { for (int j = 0; j <= MAX_N * MAX_B; j++) { dp[i][j] = INF; } } dp[0][0] = 0; for (int k = 0; k < n; k++) { int a, b, c; scanf("%d %d %d", &a, &b, &c); for (int i = MAX_N * MAX_A; i >= a; i--) { for (int j = MAX_N * MAX_B; j >= b; j--) { dp[i][j] = min(dp[i][j], dp[i - a][j - b] + c); } } } int ans = INF; for (int ia = ma, ib = mb; ia <= MAX_N * MAX_A && ib <= MAX_N * MAX_B; ia += ma, ib += mb) { ans = min(dp[ia][ib], ans); } printf("%d\n", (ans == INF) ? -1 : ans); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184013/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184013/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i32 @min(i32 noundef %x, i32 noundef %y) local_unnamed_addr #0 { entry: %cond = tail call i32 @llvm.smin.i32(i32 %x, i32 %y) ret i32 %cond } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %n = alloca i32, align 4 %ma = alloca i32, align 4 %mb = alloca i32, align 4 %dp = alloca [401 x [401 x i32]], align 16 %a = alloca i32, align 4 %b = alloca i32, align 4 %c = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %ma) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %mb) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %ma, ptr noundef nonnull %mb) call void @llvm.lifetime.start.p0(i64 643204, ptr nonnull %dp) #5 br label %vector.ph vector.ph: ; preds = %vector.ph, %entry %indvars.iv100 = phi i64 [ 0, %entry ], [ %indvars.iv.next101, %vector.ph ] %0 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 0 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %0, align 4, !tbaa !5 %1 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 4 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %1, align 4, !tbaa !5 %2 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 8 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %2, align 4, !tbaa !5 %3 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 12 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %3, align 4, !tbaa !5 %4 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 16 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %4, align 4, !tbaa !5 %5 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 20 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %5, align 4, !tbaa !5 %6 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 24 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %6, align 4, !tbaa !5 %7 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 28 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %7, align 4, !tbaa !5 %8 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 32 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %8, align 4, !tbaa !5 %9 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 36 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %9, align 4, !tbaa !5 %10 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 40 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %10, align 4, !tbaa !5 %11 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 44 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %11, align 4, !tbaa !5 %12 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 48 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %12, align 4, !tbaa !5 %13 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 52 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %13, align 4, !tbaa !5 %14 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 56 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %14, align 4, !tbaa !5 %15 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 60 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %15, align 4, !tbaa !5 %16 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 64 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %16, align 4, !tbaa !5 %17 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 68 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %17, align 4, !tbaa !5 %18 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 72 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %18, align 4, !tbaa !5 %19 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 76 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %19, align 4, !tbaa !5 %20 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 80 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %20, align 4, !tbaa !5 %21 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 84 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %21, align 4, !tbaa !5 %22 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 88 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %22, align 4, !tbaa !5 %23 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 92 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %23, align 4, !tbaa !5 %24 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 96 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %24, align 4, !tbaa !5 %25 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 100 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %25, align 4, !tbaa !5 %26 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 104 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %26, align 4, !tbaa !5 %27 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 108 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %27, align 4, !tbaa !5 %28 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 112 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %28, align 4, !tbaa !5 %29 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 116 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %29, align 4, !tbaa !5 %30 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 120 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %30, align 4, !tbaa !5 %31 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 124 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %31, align 4, !tbaa !5 %32 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 128 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %32, align 4, !tbaa !5 %33 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 132 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %33, align 4, !tbaa !5 %34 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 136 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %34, align 4, !tbaa !5 %35 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 140 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %35, align 4, !tbaa !5 %36 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 144 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %36, align 4, !tbaa !5 %37 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 148 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %37, align 4, !tbaa !5 %38 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 152 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %38, align 4, !tbaa !5 %39 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 156 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %39, align 4, !tbaa !5 %40 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 160 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %40, align 4, !tbaa !5 %41 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 164 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %41, align 4, !tbaa !5 %42 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 168 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %42, align 4, !tbaa !5 %43 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 172 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %43, align 4, !tbaa !5 %44 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 176 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %44, align 4, !tbaa !5 %45 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 180 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %45, align 4, !tbaa !5 %46 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 184 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %46, align 4, !tbaa !5 %47 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 188 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %47, align 4, !tbaa !5 %48 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 192 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %48, align 4, !tbaa !5 %49 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 196 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %49, align 4, !tbaa !5 %50 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 200 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %50, align 4, !tbaa !5 %51 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 204 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %51, align 4, !tbaa !5 %52 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 208 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %52, align 4, !tbaa !5 %53 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 212 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %53, align 4, !tbaa !5 %54 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 216 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %54, align 4, !tbaa !5 %55 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 220 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %55, align 4, !tbaa !5 %56 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 224 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %56, align 4, !tbaa !5 %57 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 228 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %57, align 4, !tbaa !5 %58 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 232 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %58, align 4, !tbaa !5 %59 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 236 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %59, align 4, !tbaa !5 %60 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 240 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %60, align 4, !tbaa !5 %61 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 244 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %61, align 4, !tbaa !5 %62 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 248 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %62, align 4, !tbaa !5 %63 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 252 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %63, align 4, !tbaa !5 %64 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 256 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %64, align 4, !tbaa !5 %65 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 260 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %65, align 4, !tbaa !5 %66 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 264 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %66, align 4, !tbaa !5 %67 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 268 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %67, align 4, !tbaa !5 %68 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 272 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %68, align 4, !tbaa !5 %69 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 276 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %69, align 4, !tbaa !5 %70 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 280 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %70, align 4, !tbaa !5 %71 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 284 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %71, align 4, !tbaa !5 %72 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 288 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %72, align 4, !tbaa !5 %73 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 292 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %73, align 4, !tbaa !5 %74 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 296 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %74, align 4, !tbaa !5 %75 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 300 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %75, align 4, !tbaa !5 %76 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 304 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %76, align 4, !tbaa !5 %77 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 308 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %77, align 4, !tbaa !5 %78 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 312 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %78, align 4, !tbaa !5 %79 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 316 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %79, align 4, !tbaa !5 %80 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 320 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %80, align 4, !tbaa !5 %81 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 324 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %81, align 4, !tbaa !5 %82 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 328 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %82, align 4, !tbaa !5 %83 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 332 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %83, align 4, !tbaa !5 %84 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 336 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %84, align 4, !tbaa !5 %85 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 340 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %85, align 4, !tbaa !5 %86 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 344 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %86, align 4, !tbaa !5 %87 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 348 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %87, align 4, !tbaa !5 %88 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 352 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %88, align 4, !tbaa !5 %89 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 356 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %89, align 4, !tbaa !5 %90 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 360 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %90, align 4, !tbaa !5 %91 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 364 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %91, align 4, !tbaa !5 %92 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 368 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %92, align 4, !tbaa !5 %93 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 372 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %93, align 4, !tbaa !5 %94 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 376 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %94, align 4, !tbaa !5 %95 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 380 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %95, align 4, !tbaa !5 %96 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 384 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %96, align 4, !tbaa !5 %97 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 388 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %97, align 4, !tbaa !5 %98 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 392 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %98, align 4, !tbaa !5 %99 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 396 store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %99, align 4, !tbaa !5 %arrayidx6 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv100, i64 400 store i32 1000000007, ptr %arrayidx6, align 4, !tbaa !5 %indvars.iv.next101 = add nuw nsw i64 %indvars.iv100, 1 %exitcond103.not = icmp eq i64 %indvars.iv.next101, 401 br i1 %exitcond103.not, label %for.cond.cleanup, label %vector.ph, !llvm.loop !9 for.cond.cleanup: ; preds = %vector.ph store i32 0, ptr %dp, align 16, !tbaa !5 %100 = load i32, ptr %n, align 4, !tbaa !5 %cmp1391 = icmp sgt i32 %100, 0 br i1 %cmp1391, label %for.body15.preheader, label %for.cond.cleanup14 for.body15.preheader: ; preds = %for.cond.cleanup %invariant.gep155 = getelementptr i8, ptr %dp, i64 641600 %invariant.gep = getelementptr i8, ptr %dp, i64 643204 %invariant.gep149 = getelementptr i8, ptr %dp, i64 641600 %invariant.gep151 = getelementptr i8, ptr %dp, i64 643204 %invariant.gep157 = getelementptr i8, ptr %dp, i64 643200 %invariant.gep153 = getelementptr i8, ptr %dp, i64 643200 br label %for.body15 for.cond.cleanup14: ; preds = %for.cond.cleanup20, %for.cond.cleanup %101 = load i32, ptr %ma, align 4, !tbaa !5 %102 = load i32, ptr %mb, align 4, !tbaa !5 %cmp5093 = icmp slt i32 %101, 401 %cmp5194 = icmp slt i32 %102, 401 %103 = select i1 %cmp5093, i1 %cmp5194, i1 false br i1 %103, label %for.body53.preheader, label %for.cond.cleanup52.thread for.body53.preheader: ; preds = %for.cond.cleanup14 %104 = sext i32 %102 to i64 %105 = sext i32 %101 to i64 br label %for.body53 for.body15: ; preds = %for.body15.preheader, %for.cond.cleanup20 %k.092 = phi i32 [ %inc47, %for.cond.cleanup20 ], [ 0, %for.body15.preheader ] call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #5 %call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c) %106 = load i32, ptr %a, align 4, !tbaa !5 %cmp19.not89 = icmp sgt i32 %106, 400 br i1 %cmp19.not89, label %for.cond.cleanup20, label %for.cond23.preheader.lr.ph for.cond23.preheader.lr.ph: ; preds = %for.body15 %107 = load i32, ptr %b, align 4, !tbaa !5 %cmp24.not87 = icmp sgt i32 %107, 400 %108 = load i32, ptr %c, align 4 br i1 %cmp24.not87, label %for.cond.cleanup20, label %for.cond23.preheader.preheader for.cond23.preheader.preheader: ; preds = %for.cond23.preheader.lr.ph %109 = sext i32 %107 to i64 %110 = sext i32 %106 to i64 %111 = shl nsw i64 %109, 2 %.neg = mul nsw i64 %110, -1604 %reass.sub = sub nsw i64 %.neg, %111 %112 = shl nsw i64 %109, 2 %113 = mul nsw i64 %110, 1604 %114 = add nsw i64 %112, %113 %115 = sub nsw i64 401, %109 %gep156 = getelementptr i8, ptr %invariant.gep155, i64 %112 %min.iters.check = icmp ult i64 %115, 20 %gep158 = getelementptr i8, ptr %invariant.gep157, i64 %reass.sub %.neg147 = shl nsw i64 %109, 2 %.neg148 = shl nsw i64 %109, 2 %notsub = add nsw i64 %109, -401 %mul.overflow125 = icmp ult i64 %notsub, -4611686018427387904 %n.vec = and i64 %115, -8 %ind.end = sub nsw i64 400, %n.vec %broadcast.splatinsert = insertelement <4 x i32> poison, i32 %108, i64 0 %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer %cmp.n = icmp eq i64 %115, %n.vec br label %for.cond23.preheader for.cond23.preheader: ; preds = %for.cond23.preheader.preheader, %for.cond23.for.cond.cleanup25_crit_edge %indvar = phi i64 [ 0, %for.cond23.preheader.preheader ], [ %indvar.next, %for.cond23.for.cond.cleanup25_crit_edge ] %indvars.iv108 = phi i64 [ 400, %for.cond23.preheader.preheader ], [ %indvars.iv.next109, %for.cond23.for.cond.cleanup25_crit_edge ] %116 = mul nsw i64 %indvar, -1604 %scevgep126 = getelementptr i8, ptr %gep156, i64 %116 %gep = getelementptr i8, ptr %invariant.gep, i64 %116 %reass.sub145 = sub i64 %116, %113 %gep150 = getelementptr i8, ptr %invariant.gep149, i64 %reass.sub145 %reass.sub146 = sub i64 %116, %114 %gep152 = getelementptr i8, ptr %invariant.gep151, i64 %reass.sub146 %117 = sub nsw i64 %indvars.iv108, %110 br i1 %min.iters.check, label %for.body26.preheader, label %vector.scevcheck vector.scevcheck: ; preds = %for.cond23.preheader %118 = mul nsw i64 %indvar, -1604 %scevgep122 = getelementptr i8, ptr %gep158, i64 %118 %gep154 = getelementptr i8, ptr %invariant.gep153, i64 %118 %119 = getelementptr i8, ptr %gep154, i64 %.neg147 %120 = getelementptr i8, ptr %119, i64 -1600 %121 = icmp ugt ptr %120, %gep154 %122 = getelementptr i8, ptr %scevgep122, i64 %.neg148 %123 = getelementptr i8, ptr %122, i64 -1600 %124 = icmp ugt ptr %123, %scevgep122 %125 = or i1 %124, %mul.overflow125 %126 = or i1 %121, %125 br i1 %126, label %for.body26.preheader, label %vector.memcheck vector.memcheck: ; preds = %vector.scevcheck %bound0 = icmp ult ptr %scevgep126, %gep152 %bound1 = icmp ult ptr %gep150, %gep %found.conflict = and i1 %bound0, %bound1 br i1 %found.conflict, label %for.body26.preheader, label %vector.body134 vector.body134: ; preds = %vector.memcheck, %vector.body134 %index135 = phi i64 [ %index.next144, %vector.body134 ], [ 0, %vector.memcheck ] %offset.idx = sub i64 400, %index135 %127 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv108, i64 %offset.idx %128 = getelementptr inbounds i32, ptr %127, i64 -3 %wide.load = load <4 x i32>, ptr %128, align 4, !tbaa !5, !alias.scope !11, !noalias !14 %reverse = shufflevector <4 x i32> %wide.load, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0> %129 = getelementptr inbounds i32, ptr %127, i64 -7 %wide.load136 = load <4 x i32>, ptr %129, align 4, !tbaa !5, !alias.scope !11, !noalias !14 %reverse137 = shufflevector <4 x i32> %wide.load136, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0> %130 = sub nsw i64 %offset.idx, %109 %131 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %117, i64 %130 %132 = getelementptr inbounds i32, ptr %131, i64 -3 %wide.load138 = load <4 x i32>, ptr %132, align 4, !tbaa !5, !alias.scope !14 %reverse139 = shufflevector <4 x i32> %wide.load138, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0> %133 = getelementptr inbounds i32, ptr %131, i64 -7 %wide.load140 = load <4 x i32>, ptr %133, align 4, !tbaa !5, !alias.scope !14 %reverse141 = shufflevector <4 x i32> %wide.load140, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0> %134 = add nsw <4 x i32> %broadcast.splat, %reverse139 %135 = add nsw <4 x i32> %broadcast.splat, %reverse141 %136 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %reverse, <4 x i32> %134) %137 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %reverse137, <4 x i32> %135) %reverse142 = shufflevector <4 x i32> %136, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0> store <4 x i32> %reverse142, ptr %128, align 4, !tbaa !5, !alias.scope !11, !noalias !14 %reverse143 = shufflevector <4 x i32> %137, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0> store <4 x i32> %reverse143, ptr %129, align 4, !tbaa !5, !alias.scope !11, !noalias !14 %index.next144 = add nuw i64 %index135, 8 %138 = icmp eq i64 %index.next144, %n.vec br i1 %138, label %middle.block130, label %vector.body134, !llvm.loop !16 middle.block130: ; preds = %vector.body134 br i1 %cmp.n, label %for.cond23.for.cond.cleanup25_crit_edge, label %for.body26.preheader for.body26.preheader: ; preds = %vector.memcheck, %vector.scevcheck, %for.cond23.preheader, %middle.block130 %indvars.iv104.ph = phi i64 [ 400, %vector.memcheck ], [ 400, %vector.scevcheck ], [ 400, %for.cond23.preheader ], [ %ind.end, %middle.block130 ] br label %for.body26 for.cond.cleanup20: ; preds = %for.cond23.for.cond.cleanup25_crit_edge, %for.cond23.preheader.lr.ph, %for.body15 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5 %inc47 = add nuw nsw i32 %k.092, 1 %139 = load i32, ptr %n, align 4, !tbaa !5 %cmp13 = icmp slt i32 %inc47, %139 br i1 %cmp13, label %for.body15, label %for.cond.cleanup14, !llvm.loop !19 for.cond23.for.cond.cleanup25_crit_edge: ; preds = %for.body26, %middle.block130 %indvars.iv.next109 = add nsw i64 %indvars.iv108, -1 %cmp19.not.not = icmp sgt i64 %indvars.iv108, %110 %indvar.next = add i64 %indvar, 1 br i1 %cmp19.not.not, label %for.cond23.preheader, label %for.cond.cleanup20, !llvm.loop !20 for.body26: ; preds = %for.body26.preheader, %for.body26 %indvars.iv104 = phi i64 [ %indvars.iv.next105, %for.body26 ], [ %indvars.iv104.ph, %for.body26.preheader ] %arrayidx30 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv108, i64 %indvars.iv104 %140 = load i32, ptr %arrayidx30, align 4, !tbaa !5 %141 = sub nsw i64 %indvars.iv104, %109 %arrayidx35 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %117, i64 %141 %142 = load i32, ptr %arrayidx35, align 4, !tbaa !5 %add = add nsw i32 %108, %142 %cond.i = call i32 @llvm.smin.i32(i32 %140, i32 %add) store i32 %cond.i, ptr %arrayidx30, align 4, !tbaa !5 %indvars.iv.next105 = add nsw i64 %indvars.iv104, -1 %cmp24.not.not = icmp sgt i64 %indvars.iv104, %109 br i1 %cmp24.not.not, label %for.body26, label %for.cond23.for.cond.cleanup25_crit_edge, !llvm.loop !21 for.cond.cleanup52: ; preds = %for.body53 %cmp63 = icmp eq i32 %cond.i84, 1000000007 br i1 %cmp63, label %for.cond.cleanup52.thread, label %143 for.cond.cleanup52.thread: ; preds = %for.cond.cleanup14, %for.cond.cleanup52 br label %143 143: ; preds = %for.cond.cleanup52, %for.cond.cleanup52.thread %144 = phi i32 [ -1, %for.cond.cleanup52.thread ], [ %cond.i84, %for.cond.cleanup52 ] %call64 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %144) call void @llvm.lifetime.end.p0(i64 643204, ptr nonnull %dp) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %mb) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %ma) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 ret i32 0 for.body53: ; preds = %for.body53.preheader, %for.body53 %indvars.iv114 = phi i64 [ %105, %for.body53.preheader ], [ %indvars.iv.next115, %for.body53 ] %indvars.iv112 = phi i64 [ %104, %for.body53.preheader ], [ %indvars.iv.next113, %for.body53 ] %ans.095 = phi i32 [ 1000000007, %for.body53.preheader ], [ %cond.i84, %for.body53 ] %arrayidx57 = getelementptr inbounds [401 x [401 x i32]], ptr %dp, i64 0, i64 %indvars.iv114, i64 %indvars.iv112 %145 = load i32, ptr %arrayidx57, align 4, !tbaa !5 %.fr = freeze i32 %145 %cond.i84 = call i32 @llvm.smin.i32(i32 %.fr, i32 %ans.095) %indvars.iv.next115 = add i64 %indvars.iv114, %105 %indvars.iv.next113 = add i64 %indvars.iv112, %104 %cmp50 = icmp slt i64 %indvars.iv.next115, 401 %cmp51 = icmp slt i64 %indvars.iv.next113, 401 %146 = select i1 %cmp50, i1 %cmp51, i1 false br i1 %146, label %for.body53, label %for.cond.cleanup52, !llvm.loop !22 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare <4 x i32> @llvm.smin.v4i32(<4 x i32>, <4 x i32>) #4 attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) 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 uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!12} !12 = distinct !{!12, !13} !13 = distinct !{!13, !"LVerDomain"} !14 = !{!15} !15 = distinct !{!15, !13} !16 = distinct !{!16, !10, !17, !18} !17 = !{!"llvm.loop.isvectorized", i32 1} !18 = !{!"llvm.loop.unroll.runtime.disable"} !19 = distinct !{!19, !10} !20 = distinct !{!20, !10} !21 = distinct !{!21, !10, !17} !22 = distinct !{!22, !10}
#include<stdio.h> #include<stdlib.h> int main() { int N,i,j,sum=0; int A[100050]={0}; scanf("%d",&N); for(i=1;i<N+1;i++) scanf("%d",&A[i]); for(i=1;i<N+1;i++) sum+=abs(A[i]-A[i-1]); sum+=abs(A[N]-A[0]); for(i=1;i<=N;i++) printf("%d\n",sum-abs(A[i]-A[i-1])-abs(A[i+1]-A[i])+abs(A[i+1]-A[i-1])); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184071/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184071/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %N = alloca i32, align 4 %A = alloca [100050 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #6 call void @llvm.lifetime.start.p0(i64 400200, ptr nonnull %A) #6 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400200) %A, i8 0, i64 400200, i1 false) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N) %0 = load i32, ptr %N, align 4, !tbaa !5 %cmp.not67 = icmp slt i32 %0, 1 br i1 %cmp.not67, label %for.end48, label %for.body for.cond2.preheader: ; preds = %for.body %cmp4.not69 = icmp slt i32 %15, 1 br i1 %cmp4.not69, label %for.end48, label %for.body5.preheader for.body5.preheader: ; preds = %for.cond2.preheader %1 = add nuw i32 %15, 1 %wide.trip.count = zext i32 %1 to i64 %.pre = load i32, ptr %A, align 16, !tbaa !5 %2 = add nsw i64 %wide.trip.count, -1 %min.iters.check = icmp ult i32 %15, 8 br i1 %min.iters.check, label %for.body5.preheader91, label %vector.ph vector.ph: ; preds = %for.body5.preheader %n.vec = and i64 %2, -8 %ind.end = or i64 %n.vec, 1 %vector.recur.init = insertelement <4 x i32> poison, i32 %.pre, i64 3 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %vector.recur = phi <4 x i32> [ %vector.recur.init, %vector.ph ], [ %wide.load90, %vector.body ] %vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %11, %vector.body ] %vec.phi89 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %12, %vector.body ] %offset.idx = or i64 %index, 1 %3 = getelementptr inbounds [100050 x i32], ptr %A, i64 0, i64 %offset.idx %wide.load = load <4 x i32>, ptr %3, align 4, !tbaa !5 %4 = getelementptr inbounds i32, ptr %3, i64 4 %wide.load90 = load <4 x i32>, ptr %4, align 4, !tbaa !5 %5 = shufflevector <4 x i32> %vector.recur, <4 x i32> %wide.load, <4 x i32> <i32 3, i32 4, i32 5, i32 6> %6 = shufflevector <4 x i32> %wide.load, <4 x i32> %wide.load90, <4 x i32> <i32 3, i32 4, i32 5, i32 6> %7 = sub nsw <4 x i32> %wide.load, %5 %8 = sub nsw <4 x i32> %wide.load90, %6 %9 = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %7, i1 true) %10 = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %8, i1 true) %11 = add <4 x i32> %9, %vec.phi %12 = add <4 x i32> %10, %vec.phi89 %index.next = add nuw i64 %index, 8 %13 = icmp eq i64 %index.next, %n.vec br i1 %13, label %middle.block, label %vector.body, !llvm.loop !9 middle.block: ; preds = %vector.body %bin.rdx = add <4 x i32> %12, %11 %14 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx) %cmp.n = icmp eq i64 %2, %n.vec %vector.recur.extract = extractelement <4 x i32> %wide.load90, i64 3 br i1 %cmp.n, label %for.end14, label %for.body5.preheader91 for.body5.preheader91: ; preds = %for.body5.preheader, %middle.block %scalar.recur.ph = phi i32 [ %vector.recur.extract, %middle.block ], [ %.pre, %for.body5.preheader ] %indvars.iv77.ph = phi i64 [ %ind.end, %middle.block ], [ 1, %for.body5.preheader ] %sum.071.ph = phi i32 [ %14, %middle.block ], [ 0, %for.body5.preheader ] br label %for.body5 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ] %arrayidx = getelementptr inbounds [100050 x i32], ptr %A, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %15 = load i32, ptr %N, align 4, !tbaa !5 %16 = sext i32 %15 to i64 %cmp.not.not = icmp slt i64 %indvars.iv, %16 br i1 %cmp.not.not, label %for.body, label %for.cond2.preheader, !llvm.loop !13 for.body5: ; preds = %for.body5.preheader91, %for.body5 %scalar.recur = phi i32 [ %17, %for.body5 ], [ %scalar.recur.ph, %for.body5.preheader91 ] %indvars.iv77 = phi i64 [ %indvars.iv.next78, %for.body5 ], [ %indvars.iv77.ph, %for.body5.preheader91 ] %sum.071 = phi i32 [ %add11, %for.body5 ], [ %sum.071.ph, %for.body5.preheader91 ] %arrayidx7 = getelementptr inbounds [100050 x i32], ptr %A, i64 0, i64 %indvars.iv77 %17 = load i32, ptr %arrayidx7, align 4, !tbaa !5 %sub10 = sub nsw i32 %17, %scalar.recur %18 = call i32 @llvm.abs.i32(i32 %sub10, i1 true) %add11 = add nuw nsw i32 %18, %sum.071 %indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1 %exitcond.not = icmp eq i64 %indvars.iv.next78, %wide.trip.count br i1 %exitcond.not, label %for.end14, label %for.body5, !llvm.loop !14 for.end14: ; preds = %for.body5, %middle.block %add11.lcssa = phi i32 [ %14, %middle.block ], [ %add11, %for.body5 ] br i1 %cmp4.not69, label %for.end48, label %for.body22.lr.ph for.body22.lr.ph: ; preds = %for.end14 %idxprom15 = zext i32 %15 to i64 %arrayidx16 = getelementptr inbounds [100050 x i32], ptr %A, i64 0, i64 %idxprom15 %19 = load i32, ptr %arrayidx16, align 4, !tbaa !5 %20 = load i32, ptr %A, align 16, !tbaa !5 %sub18 = sub nsw i32 %19, %20 %21 = call i32 @llvm.abs.i32(i32 %sub18, i1 true) %.neg66 = add nuw i32 %21, %add11.lcssa br label %for.body22 for.body22: ; preds = %for.body22.lr.ph, %for.body22 %indvars.iv81 = phi i64 [ 1, %for.body22.lr.ph ], [ %indvars.iv.next82, %for.body22 ] %arrayidx24 = getelementptr inbounds [100050 x i32], ptr %A, i64 0, i64 %indvars.iv81 %22 = load i32, ptr %arrayidx24, align 4, !tbaa !5 %23 = add nsw i64 %indvars.iv81, -1 %arrayidx27 = getelementptr inbounds [100050 x i32], ptr %A, i64 0, i64 %23 %24 = load i32, ptr %arrayidx27, align 4, !tbaa !5 %sub28 = sub nsw i32 %22, %24 %25 = call i32 @llvm.abs.i32(i32 %sub28, i1 true) %indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1 %arrayidx32 = getelementptr inbounds [100050 x i32], ptr %A, i64 0, i64 %indvars.iv.next82 %26 = load i32, ptr %arrayidx32, align 4, !tbaa !5 %sub35 = sub nsw i32 %26, %22 %27 = call i32 @llvm.abs.i32(i32 %sub35, i1 true) %sub43 = sub nsw i32 %26, %24 %28 = call i32 @llvm.abs.i32(i32 %sub43, i1 true) %29 = add nuw i32 %25, %27 %sub36 = sub i32 %.neg66, %29 %add44 = add nsw i32 %sub36, %28 %call45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add44) %30 = load i32, ptr %N, align 4, !tbaa !5 %31 = sext i32 %30 to i64 %cmp21.not.not = icmp slt i64 %indvars.iv81, %31 br i1 %cmp21.not.not, label %for.body22, label %for.end48, !llvm.loop !15 for.end48: ; preds = %for.body22, %entry, %for.cond2.preheader, %for.end14 call void @llvm.lifetime.end.p0(i64 400200, ptr nonnull %A) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #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 ; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.abs.i32(i32, i1 immarg) #4 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare <4 x i32> @llvm.abs.v4i32(<4 x i32>, i1 immarg) #5 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #5 attributes #0 = { nofree 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) } 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 nosync nounwind speculatable willreturn memory(none) } attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #6 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10, !11, !12} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!"llvm.loop.isvectorized", i32 1} !12 = !{!"llvm.loop.unroll.runtime.disable"} !13 = distinct !{!13, !10} !14 = distinct !{!14, !10, !12, !11} !15 = distinct !{!15, !10}
#include <stdio.h> int main(){ long long int a,b,c,d,ans1,ans2,ans3,ans4; int i = 0; scanf("%lld %lld %lld %lld", &a,&b,&c,&d); ans1 = a * c; ans2 = b * d; ans3 = a * d; ans4 = b * c; if(ans1 >= ans2 && ans1 >= ans3 && ans1 >= ans4){ printf("%lld\n", ans1); }else if(ans2 >= ans1 && ans2 >= ans3 && ans2 >= ans4){ printf("%lld\n", ans2); }else if(ans3 >= ans2 && ans3 >= ans1 && ans3 >= ans4){ printf("%lld\n", ans3); }else if(ans4 >= ans2 && ans4 >= ans3 && ans4 >= ans1){ printf("%lld\n", ans4); } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184114/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184114/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [20 x i8] c"%lld %lld %lld %lld\00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i64, align 8 %b = alloca i64, align 8 %c = alloca i64, align 8 %d = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #3 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #3 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #3 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %d) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d) %0 = load i64, ptr %a, align 8, !tbaa !5 %1 = load i64, ptr %c, align 8, !tbaa !5 %mul = mul nsw i64 %1, %0 %2 = load i64, ptr %b, align 8, !tbaa !5 %3 = load i64, ptr %d, align 8, !tbaa !5 %mul1 = mul nsw i64 %3, %2 %mul2 = mul nsw i64 %3, %0 %mul3 = mul nsw i64 %2, %1 %cmp.not = icmp slt i64 %mul, %mul1 %cmp4.not = icmp slt i64 %mul, %mul2 %or.cond = select i1 %cmp.not, i1 true, i1 %cmp4.not %cmp6.not = icmp slt i64 %mul, %mul3 %or.cond58 = select i1 %or.cond, i1 true, i1 %cmp6.not br i1 %or.cond58, label %if.else, label %if.end33.sink.split if.else: ; preds = %entry %cmp8.not = icmp slt i64 %mul1, %mul %cmp10.not = icmp slt i64 %mul1, %mul2 %or.cond59 = select i1 %cmp8.not, i1 true, i1 %cmp10.not %cmp12.not = icmp slt i64 %mul1, %mul3 %or.cond60 = select i1 %or.cond59, i1 true, i1 %cmp12.not br i1 %or.cond60, label %if.else15, label %if.end33.sink.split if.else15: ; preds = %if.else %cmp16.not = icmp slt i64 %mul2, %mul1 %cmp18.not = icmp slt i64 %mul2, %mul %or.cond61 = or i1 %cmp16.not, %cmp18.not %cmp20.not = icmp slt i64 %mul2, %mul3 %or.cond62 = select i1 %or.cond61, i1 true, i1 %cmp20.not br i1 %or.cond62, label %if.else23, label %if.end33.sink.split if.else23: ; preds = %if.else15 %cmp24.not = icmp slt i64 %mul3, %mul1 %cmp26.not = icmp slt i64 %mul3, %mul2 %or.cond63 = select i1 %cmp24.not, i1 true, i1 %cmp26.not %cmp28.not = icmp slt i64 %mul3, %mul %or.cond64 = or i1 %cmp28.not, %or.cond63 br i1 %or.cond64, label %if.end33, label %if.end33.sink.split if.end33.sink.split: ; preds = %if.else23, %if.else15, %if.else, %entry %mul1.sink = phi i64 [ %mul, %entry ], [ %mul1, %if.else ], [ %mul2, %if.else15 ], [ %mul3, %if.else23 ] %call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %mul1.sink) br label %if.end33 if.end33: ; preds = %if.end33.sink.split, %if.else23 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #3 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #3 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #3 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #3 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 attributes #0 = { nofree 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 = { 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 #3 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"long long", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> int main(){ long long a, b, c, d; long long multiac, multiad, multibc, multibd ; scanf("%lld%lld%lld%lld", &a, &b, &c, &d); multiac = a * c; multiad = a * d; multibc = b * c; multibd = b * d; if(multiac > multiad && multiac > multibc && multiac > multibd) printf("%lld", multiac); else if(multiad > multiac && multiad > multibc && multiad > multibd) printf("%lld", multiad); else if(multibc > multiac && multibc > multiad && multibc > multibd) printf("%lld", multibc); else printf("%lld", multibd); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184158/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184158/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [17 x i8] c"%lld%lld%lld%lld\00", align 1 @.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i64, align 8 %b = alloca i64, align 8 %c = alloca i64, align 8 %d = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #3 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #3 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #3 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %d) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d) %0 = load i64, ptr %a, align 8, !tbaa !5 %1 = load i64, ptr %c, align 8, !tbaa !5 %mul = mul nsw i64 %1, %0 %2 = load i64, ptr %d, align 8, !tbaa !5 %mul1 = mul nsw i64 %2, %0 %3 = load i64, ptr %b, align 8, !tbaa !5 %mul2 = mul nsw i64 %3, %1 %mul3 = mul nsw i64 %3, %2 %cmp = icmp sgt i64 %mul, %mul1 %cmp4 = icmp sgt i64 %mul, %mul2 %or.cond = select i1 %cmp, i1 %cmp4, i1 false %cmp6 = icmp sgt i64 %mul, %mul3 %or.cond45 = select i1 %or.cond, i1 %cmp6, i1 false br i1 %or.cond45, label %if.end26, label %if.else if.else: ; preds = %entry %cmp8 = icmp sgt i64 %mul1, %mul %cmp10 = icmp sgt i64 %mul1, %mul2 %or.cond46 = select i1 %cmp8, i1 %cmp10, i1 false %cmp12 = icmp sgt i64 %mul1, %mul3 %or.cond47 = select i1 %or.cond46, i1 %cmp12, i1 false br i1 %or.cond47, label %if.end26, label %if.else15 if.else15: ; preds = %if.else %cmp16 = icmp sgt i64 %mul2, %mul %cmp18 = icmp sgt i64 %mul2, %mul1 %or.cond48 = and i1 %cmp16, %cmp18 %cmp20 = icmp sgt i64 %mul2, %mul3 %or.cond49 = select i1 %or.cond48, i1 %cmp20, i1 false %mul2.mul3 = select i1 %or.cond49, i64 %mul2, i64 %mul3 br label %if.end26 if.end26: ; preds = %if.else15, %if.else, %entry %mul1.sink = phi i64 [ %mul, %entry ], [ %mul1, %if.else ], [ %mul2.mul3, %if.else15 ] %call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %mul1.sink) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #3 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #3 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #3 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #3 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 attributes #0 = { nofree 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 = { 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 #3 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"long long", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> int main(int i,char**v){ long a,b,c,d; scanf("%ld %ld %ld %ld",&a,&b,&c,&d); long val[4]; val[0]=a*c; val[1]=a*d; val[2]=b*c; val[3]=b*d; long max=val[0]; for(i=1;i<4;i++){ if(val[i]>max)max=val[i]; } printf("%ld\n",max); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184200/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184200/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [16 x i8] c"%ld %ld %ld %ld\00", align 1 @.str.1 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main(i32 noundef %i, ptr nocapture noundef readnone %v) local_unnamed_addr #0 { entry: %a = alloca i64, align 8 %b = alloca i64, align 8 %c = alloca i64, align 8 %d = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #4 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #4 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #4 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %d) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d) %0 = load i64, ptr %a, align 8, !tbaa !5 %1 = load i64, ptr %c, align 8, !tbaa !5 %mul = mul nsw i64 %1, %0 %2 = load i64, ptr %d, align 8, !tbaa !5 %mul1 = mul nsw i64 %2, %0 %3 = load i64, ptr %b, align 8, !tbaa !5 %mul3 = mul nsw i64 %3, %1 %mul5 = mul nsw i64 %3, %2 %spec.select = call i64 @llvm.smax.i64(i64 %mul1, i64 %mul) %spec.select.1 = call i64 @llvm.smax.i64(i64 %mul3, i64 %spec.select) %spec.select.2 = call i64 @llvm.smax.i64(i64 %mul5, i64 %spec.select.1) %call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %spec.select.2) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #4 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #4 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #4 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #4 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smax.i64(i64, i64) #3 attributes #0 = { nofree 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 = { 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 #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"long", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> int main(void) { int a,b,c,d; signed long long x1, x2, x3, x4; long long ans; scanf("%d %d %d %d", &a, &b, &c, &d); // printf("%d %d %d %d\n", a, b, c, d); x1 = (long long)a * c; x2 = (long long)a * d; x3 = (long long)b * c; x4 = (long long)b * d; // printf("%lld %lld %lld %lld\n", x1,x2,x3,x4); ans = x1; if ( ans < x2 ) { ans = x2; } if ( ans < x3 ) { ans = x3; } if ( ans < x4 ) { ans = x4; } printf("%lld\n", ans); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184244/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184244/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [12 x i8] c"%d %d %d %d\00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i32, align 4 %b = alloca i32, align 4 %c = alloca i32, align 4 %d = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d) %0 = load i32, ptr %a, align 4, !tbaa !5 %conv = sext i32 %0 to i64 %1 = load i32, ptr %c, align 4, !tbaa !5 %conv1 = sext i32 %1 to i64 %mul = mul nsw i64 %conv1, %conv %2 = load i32, ptr %d, align 4, !tbaa !5 %conv3 = sext i32 %2 to i64 %mul4 = mul nsw i64 %conv3, %conv %3 = load i32, ptr %b, align 4, !tbaa !5 %conv5 = sext i32 %3 to i64 %mul7 = mul nsw i64 %conv5, %conv1 %mul10 = mul nsw i64 %conv5, %conv3 %spec.select = call i64 @llvm.smax.i64(i64 %mul, i64 %mul4) %ans.1 = call i64 @llvm.smax.i64(i64 %spec.select, i64 %mul7) %ans.2 = call i64 @llvm.smax.i64(i64 %ans.1, i64 %mul10) %call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.2) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smax.i64(i64, i64) #3 attributes #0 = { nofree 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 = { 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 #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> #define MAX 500 //配列の大きさは500*500で十分です。 int main(void){ while(1){ //問題ではn, m, t, pとして与えられますが、 //nはw、mはhとして変数を用意します。 int w, h, t, p; scanf(" %d %d %d %d", &w, &h, &t, &p); if(!w && !h && !t && !p) break; //2次元配列は行列のように、i行j列(kami[i][j])として考えます。 //そのため、座標(x, y)は kami[y][x] となります。 int kami[MAX][MAX] = {0}; for(int i=0; i<h; i++){ for(int j=0; j<w; j++){ kami[i][j] = 1;//折り紙が存在する部分を1で初期化 } } int origin_x = 0, origin_y =0; //折り紙左上の角の座標を原点として記憶(kami[origin_y][origin_x]) for(int k=0; k<t; k++){ int d, c; scanf(" %d %d", &d, &c); if(d == 1){ //もし d が 1 なら,左端から c だけ右側を通る垂直の折り線の左側を右側に折り重ねる. int dist = 1; //distは折られる前の座標と、折る先の座標の差の絶対値。 for(int j=origin_x+c; j<origin_x+(2*c); j++){ //折られる先のx座標 for(int i=origin_y; i<MAX; i++){ //垂直方向に折るループ kami[i][j] += kami[i][j-dist]; } dist += 2; } origin_x += c; } else{ //このプログラムの場合は、上下を入れ替えています。 // →もし d が 2 なら,上端から c だけ下側を通る水平の折り線の上側を下側に折り重ねる。 int dist = 1; //distは折られる前の座標と、折る先の座標の差の絶対値。 for(int i=origin_y+c; i<origin_y+(2*c); i++){ //折られる先のy座標 for(int j=origin_x; j<MAX; j++){ //水平方向に折るループ kami[i][j] += kami[i-dist][j]; } dist += 2; } origin_y += c; } } for(int k=0; k<p; k++){ int x, y; scanf(" %d %d", &x, &y); printf("%d\n", kami[origin_y+y][origin_x+x]); } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184288/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184288/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [13 x i8] c" %d %d %d %d\00", align 1 @.str.1 = private unnamed_addr constant [7 x i8] c" %d %d\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %w = alloca i32, align 4 %h = alloca i32, align 4 %t = alloca i32, align 4 %p = alloca i32, align 4 %kami = alloca [500 x [500 x i32]], align 16 %d = alloca i32, align 4 %c = alloca i32, align 4 %x = alloca i32, align 4 %y = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %p) #4 %call161 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w, ptr noundef nonnull %h, ptr noundef nonnull %t, ptr noundef nonnull %p) %0 = load i32, ptr %w, align 4, !tbaa !5 %tobool162 = icmp ne i32 %0, 0 %1 = load i32, ptr %h, align 4 %tobool1163 = icmp ne i32 %1, 0 %or.cond164 = select i1 %tobool162, i1 true, i1 %tobool1163 %2 = load i32, ptr %t, align 4 %tobool3165 = icmp ne i32 %2, 0 %or.cond105166 = select i1 %or.cond164, i1 true, i1 %tobool3165 %3 = load i32, ptr %p, align 4 %tobool5167 = icmp ne i32 %3, 0 %or.cond106168 = select i1 %or.cond105166, i1 true, i1 %tobool5167 br i1 %or.cond106168, label %if.end.preheader, label %while.end if.end.preheader: ; preds = %entry %invariant.gep = getelementptr i8, ptr %kami, i64 -2000 br label %if.end if.end: ; preds = %if.end.preheader, %cleanup %4 = phi i32 [ %72, %cleanup ], [ %3, %if.end.preheader ] %5 = phi i32 [ %71, %cleanup ], [ %2, %if.end.preheader ] %6 = phi i32 [ %70, %cleanup ], [ %1, %if.end.preheader ] %7 = phi i32 [ %69, %cleanup ], [ %0, %if.end.preheader ] call void @llvm.lifetime.start.p0(i64 1000000, ptr nonnull %kami) #4 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1000000) %kami, i8 0, i64 1000000, i1 false) %cmp140 = icmp sgt i32 %6, 0 %cmp7138 = icmp sgt i32 %7, 0 %or.cond207 = and i1 %cmp140, %cmp7138 br i1 %or.cond207, label %for.cond6.preheader.us.preheader, label %for.cond15.preheader for.cond6.preheader.us.preheader: ; preds = %if.end %wide.trip.count177 = zext i32 %6 to i64 %wide.trip.count = zext i32 %7 to i64 %min.iters.check219 = icmp ult i32 %7, 8 %n.vec222 = and i64 %wide.trip.count, 4294967288 %cmp.n224 = icmp eq i64 %n.vec222, %wide.trip.count br label %for.cond6.preheader.us for.cond6.preheader.us: ; preds = %for.cond6.preheader.us.preheader, %for.cond6.for.cond.cleanup8_crit_edge.us %indvars.iv174 = phi i64 [ 0, %for.cond6.preheader.us.preheader ], [ %indvars.iv.next175, %for.cond6.for.cond.cleanup8_crit_edge.us ] br i1 %min.iters.check219, label %for.body9.us.preheader, label %vector.body225 vector.body225: ; preds = %for.cond6.preheader.us, %vector.body225 %index226 = phi i64 [ %index.next227, %vector.body225 ], [ 0, %for.cond6.preheader.us ] %8 = getelementptr inbounds [500 x [500 x i32]], ptr %kami, i64 0, i64 %indvars.iv174, i64 %index226 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %8, align 16, !tbaa !5 %9 = getelementptr inbounds i32, ptr %8, i64 4 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %9, align 16, !tbaa !5 %index.next227 = add nuw i64 %index226, 8 %10 = icmp eq i64 %index.next227, %n.vec222 br i1 %10, label %middle.block217, label %vector.body225, !llvm.loop !9 middle.block217: ; preds = %vector.body225 br i1 %cmp.n224, label %for.cond6.for.cond.cleanup8_crit_edge.us, label %for.body9.us.preheader for.body9.us.preheader: ; preds = %for.cond6.preheader.us, %middle.block217 %indvars.iv.ph = phi i64 [ 0, %for.cond6.preheader.us ], [ %n.vec222, %middle.block217 ] br label %for.body9.us for.body9.us: ; preds = %for.body9.us.preheader, %for.body9.us %indvars.iv = phi i64 [ %indvars.iv.next, %for.body9.us ], [ %indvars.iv.ph, %for.body9.us.preheader ] %arrayidx11.us = getelementptr inbounds [500 x [500 x i32]], ptr %kami, i64 0, i64 %indvars.iv174, i64 %indvars.iv store i32 1, ptr %arrayidx11.us, align 4, !tbaa !5 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count br i1 %exitcond.not, label %for.cond6.for.cond.cleanup8_crit_edge.us, label %for.body9.us, !llvm.loop !13 for.cond6.for.cond.cleanup8_crit_edge.us: ; preds = %for.body9.us, %middle.block217 %indvars.iv.next175 = add nuw nsw i64 %indvars.iv174, 1 %exitcond178.not = icmp eq i64 %indvars.iv.next175, %wide.trip.count177 br i1 %exitcond178.not, label %for.cond15.preheader, label %for.cond6.preheader.us, !llvm.loop !14 for.cond15.preheader: ; preds = %for.cond6.for.cond.cleanup8_crit_edge.us, %if.end %cmp16152 = icmp sgt i32 %5, 0 br i1 %cmp16152, label %for.body18, label %for.cond87.preheader for.cond87.preheader.loopexit: ; preds = %if.end82 %.pre = load i32, ptr %p, align 4, !tbaa !5 br label %for.cond87.preheader for.cond87.preheader: ; preds = %for.cond87.preheader.loopexit, %for.cond15.preheader %11 = phi i32 [ %4, %for.cond15.preheader ], [ %.pre, %for.cond87.preheader.loopexit ] %origin_x.0.lcssa = phi i32 [ 0, %for.cond15.preheader ], [ %origin_x.1, %for.cond87.preheader.loopexit ] %origin_y.0.lcssa = phi i32 [ 0, %for.cond15.preheader ], [ %origin_y.1, %for.cond87.preheader.loopexit ] %cmp88159 = icmp sgt i32 %11, 0 br i1 %cmp88159, label %for.body90, label %cleanup for.body18: ; preds = %for.cond15.preheader, %if.end82 %k.0157 = phi i32 [ %inc84, %if.end82 ], [ 0, %for.cond15.preheader ] %origin_y.0155 = phi i32 [ %origin_y.1, %if.end82 ], [ 0, %for.cond15.preheader ] %origin_x.0153 = phi i32 [ %origin_x.1, %if.end82 ], [ 0, %for.cond15.preheader ] call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4 %call19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %d, ptr noundef nonnull %c) %12 = load i32, ptr %d, align 4, !tbaa !5 %cmp20 = icmp eq i32 %12, 1 %13 = load i32, ptr %c, align 4, !tbaa !5 %mul = shl nsw i32 %13, 1 %cmp25149 = icmp slt i32 %13, %mul br i1 %cmp20, label %if.then21, label %if.else if.then21: ; preds = %for.body18 %add = add i32 %13, %origin_x.0153 %cmp30147 = icmp slt i32 %origin_y.0155, 500 %or.cond208 = select i1 %cmp25149, i1 %cmp30147, i1 false br i1 %or.cond208, label %for.cond29.preheader.us.preheader, label %if.end82 for.cond29.preheader.us.preheader: ; preds = %if.then21 %add24 = add nsw i32 %mul, %origin_x.0153 %14 = sext i32 %origin_y.0155 to i64 %15 = sext i32 %add to i64 %16 = sext i32 %add24 to i64 br label %for.cond29.preheader.us for.cond29.preheader.us: ; preds = %for.cond29.preheader.us.preheader, %for.cond29.for.cond.cleanup31_crit_edge.us %indvars.iv200 = phi i64 [ 1, %for.cond29.preheader.us.preheader ], [ %indvars.iv.next201, %for.cond29.for.cond.cleanup31_crit_edge.us ] %indvars.iv197 = phi i64 [ %15, %for.cond29.preheader.us.preheader ], [ %indvars.iv.next198, %for.cond29.for.cond.cleanup31_crit_edge.us ] %17 = sub nsw i64 %indvars.iv197, %indvars.iv200 br label %for.body32.us for.body32.us: ; preds = %for.cond29.preheader.us, %for.body32.us %indvars.iv192 = phi i64 [ %14, %for.cond29.preheader.us ], [ %indvars.iv.next193, %for.body32.us ] %arrayidx36.us = getelementptr inbounds [500 x [500 x i32]], ptr %kami, i64 0, i64 %indvars.iv192, i64 %17 %18 = load i32, ptr %arrayidx36.us, align 4, !tbaa !5 %arrayidx40.us = getelementptr inbounds [500 x [500 x i32]], ptr %kami, i64 0, i64 %indvars.iv192, i64 %indvars.iv197 %19 = load i32, ptr %arrayidx40.us, align 4, !tbaa !5 %add41.us = add nsw i32 %19, %18 store i32 %add41.us, ptr %arrayidx40.us, align 4, !tbaa !5 %indvars.iv.next193 = add nsw i64 %indvars.iv192, 1 %20 = and i64 %indvars.iv.next193, 4294967295 %exitcond196.not = icmp eq i64 %20, 500 br i1 %exitcond196.not, label %for.cond29.for.cond.cleanup31_crit_edge.us, label %for.body32.us, !llvm.loop !15 for.cond29.for.cond.cleanup31_crit_edge.us: ; preds = %for.body32.us %indvars.iv.next201 = add nuw nsw i64 %indvars.iv200, 2 %indvars.iv.next198 = add nsw i64 %indvars.iv197, 1 %cmp25.us = icmp slt i64 %indvars.iv.next198, %16 br i1 %cmp25.us, label %for.cond29.preheader.us, label %if.end82, !llvm.loop !16 if.else: ; preds = %for.body18 %add52 = add i32 %13, %origin_y.0155 %cmp61142 = icmp slt i32 %origin_x.0153, 500 %or.cond209 = select i1 %cmp25149, i1 %cmp61142, i1 false br i1 %or.cond209, label %for.cond60.preheader.us.preheader, label %if.end82 for.cond60.preheader.us.preheader: ; preds = %if.else %add55 = add nsw i32 %mul, %origin_y.0155 %21 = sext i32 %origin_x.0153 to i64 %22 = sext i32 %add52 to i64 %23 = sext i32 %add55 to i64 %24 = add i32 %origin_x.0153, 1 %25 = zext i32 %24 to i64 %26 = sub nsw i64 500, %25 %27 = mul nsw i64 %22, 2000 %28 = shl nsw i64 %21, 2 %29 = add nsw i64 %27, 2004 %30 = add nsw i64 %29, %28 %31 = add i32 %origin_x.0153, 1 %32 = zext i32 %31 to i64 %33 = shl nuw nsw i64 %32, 2 %34 = sub nsw i64 %30, %33 %35 = or i64 %27, 4 %36 = add nsw i64 %35, %28 %37 = sub nsw i64 %36, %33 %38 = add i32 %origin_x.0153, 1 %39 = zext i32 %38 to i64 %40 = sub nsw i64 501, %39 %41 = getelementptr i8, ptr %kami, i64 %27 %42 = getelementptr i8, ptr %41, i64 %28 %43 = getelementptr i8, ptr %kami, i64 %34 %gep = getelementptr i8, ptr %invariant.gep, i64 %27 %44 = getelementptr i8, ptr %gep, i64 %28 %45 = getelementptr i8, ptr %kami, i64 %37 %min.iters.check = icmp ult i64 %40, 12 %46 = trunc i64 %26 to i32 %47 = sub i32 -2, %origin_x.0153 %48 = icmp ult i32 %47, %46 %49 = icmp ugt i64 %26, 4294967295 %50 = or i1 %48, %49 %n.vec = and i64 %40, -8 %ind.end = add nsw i64 %n.vec, %21 %cmp.n = icmp eq i64 %40, %n.vec br label %for.cond60.preheader.us for.cond60.preheader.us: ; preds = %for.cond60.preheader.us.preheader, %for.cond60.for.cond.cleanup62_crit_edge.us %indvar = phi i64 [ 0, %for.cond60.preheader.us.preheader ], [ %indvar.next, %for.cond60.for.cond.cleanup62_crit_edge.us ] %indvars.iv186 = phi i64 [ 1, %for.cond60.preheader.us.preheader ], [ %indvars.iv.next187, %for.cond60.for.cond.cleanup62_crit_edge.us ] %indvars.iv183 = phi i64 [ %22, %for.cond60.preheader.us.preheader ], [ %indvars.iv.next184, %for.cond60.for.cond.cleanup62_crit_edge.us ] %51 = mul nuw nsw i64 %indvar, 2000 %scevgep = getelementptr i8, ptr %42, i64 %51 %scevgep211 = getelementptr i8, ptr %43, i64 %51 %52 = mul nsw i64 %indvar, -2000 %scevgep212 = getelementptr i8, ptr %44, i64 %52 %scevgep213 = getelementptr i8, ptr %45, i64 %52 %53 = sub nsw i64 %indvars.iv183, %indvars.iv186 %brmerge = select i1 %min.iters.check, i1 true, i1 %50 br i1 %brmerge, label %for.body63.us.preheader, label %vector.memcheck vector.memcheck: ; preds = %for.cond60.preheader.us %bound0 = icmp ult ptr %scevgep, %scevgep213 %bound1 = icmp ult ptr %scevgep212, %scevgep211 %found.conflict = and i1 %bound0, %bound1 br i1 %found.conflict, label %for.body63.us.preheader, label %vector.body vector.body: ; preds = %vector.memcheck, %vector.body %index = phi i64 [ %index.next, %vector.body ], [ 0, %vector.memcheck ] %offset.idx = add i64 %index, %21 %54 = getelementptr inbounds [500 x [500 x i32]], ptr %kami, i64 0, i64 %53, i64 %offset.idx %wide.load = load <4 x i32>, ptr %54, align 4, !tbaa !5, !alias.scope !17 %55 = getelementptr inbounds i32, ptr %54, i64 4 %wide.load214 = load <4 x i32>, ptr %55, align 4, !tbaa !5, !alias.scope !17 %56 = getelementptr inbounds [500 x [500 x i32]], ptr %kami, i64 0, i64 %indvars.iv183, i64 %offset.idx %wide.load215 = load <4 x i32>, ptr %56, align 4, !tbaa !5, !alias.scope !20, !noalias !17 %57 = getelementptr inbounds i32, ptr %56, i64 4 %wide.load216 = load <4 x i32>, ptr %57, align 4, !tbaa !5, !alias.scope !20, !noalias !17 %58 = add nsw <4 x i32> %wide.load215, %wide.load %59 = add nsw <4 x i32> %wide.load216, %wide.load214 store <4 x i32> %58, ptr %56, align 4, !tbaa !5, !alias.scope !20, !noalias !17 store <4 x i32> %59, ptr %57, align 4, !tbaa !5, !alias.scope !20, !noalias !17 %index.next = add nuw i64 %index, 8 %60 = icmp eq i64 %index.next, %n.vec br i1 %60, label %middle.block, label %vector.body, !llvm.loop !22 middle.block: ; preds = %vector.body br i1 %cmp.n, label %for.cond60.for.cond.cleanup62_crit_edge.us, label %for.body63.us.preheader for.body63.us.preheader: ; preds = %for.cond60.preheader.us, %vector.memcheck, %middle.block %indvars.iv179.ph = phi i64 [ %21, %vector.memcheck ], [ %21, %for.cond60.preheader.us ], [ %ind.end, %middle.block ] br label %for.body63.us for.body63.us: ; preds = %for.body63.us.preheader, %for.body63.us %indvars.iv179 = phi i64 [ %indvars.iv.next180, %for.body63.us ], [ %indvars.iv179.ph, %for.body63.us.preheader ] %arrayidx68.us = getelementptr inbounds [500 x [500 x i32]], ptr %kami, i64 0, i64 %53, i64 %indvars.iv179 %61 = load i32, ptr %arrayidx68.us, align 4, !tbaa !5 %arrayidx72.us = getelementptr inbounds [500 x [500 x i32]], ptr %kami, i64 0, i64 %indvars.iv183, i64 %indvars.iv179 %62 = load i32, ptr %arrayidx72.us, align 4, !tbaa !5 %add73.us = add nsw i32 %62, %61 store i32 %add73.us, ptr %arrayidx72.us, align 4, !tbaa !5 %indvars.iv.next180 = add nsw i64 %indvars.iv179, 1 %63 = and i64 %indvars.iv.next180, 4294967295 %exitcond182.not = icmp eq i64 %63, 500 br i1 %exitcond182.not, label %for.cond60.for.cond.cleanup62_crit_edge.us, label %for.body63.us, !llvm.loop !23 for.cond60.for.cond.cleanup62_crit_edge.us: ; preds = %for.body63.us, %middle.block %indvars.iv.next187 = add nuw nsw i64 %indvars.iv186, 2 %indvars.iv.next184 = add nsw i64 %indvars.iv183, 1 %cmp56.us = icmp slt i64 %indvars.iv.next184, %23 %indvar.next = add i64 %indvar, 1 br i1 %cmp56.us, label %for.cond60.preheader.us, label %if.end82, !llvm.loop !24 if.end82: ; preds = %for.cond60.for.cond.cleanup62_crit_edge.us, %for.cond29.for.cond.cleanup31_crit_edge.us, %if.else, %if.then21 %origin_x.1 = phi i32 [ %add, %if.then21 ], [ %origin_x.0153, %if.else ], [ %add, %for.cond29.for.cond.cleanup31_crit_edge.us ], [ %origin_x.0153, %for.cond60.for.cond.cleanup62_crit_edge.us ] %origin_y.1 = phi i32 [ %origin_y.0155, %if.then21 ], [ %add52, %if.else ], [ %origin_y.0155, %for.cond29.for.cond.cleanup31_crit_edge.us ], [ %add52, %for.cond60.for.cond.cleanup62_crit_edge.us ] call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #4 %inc84 = add nuw nsw i32 %k.0157, 1 %64 = load i32, ptr %t, align 4, !tbaa !5 %cmp16 = icmp slt i32 %inc84, %64 br i1 %cmp16, label %for.body18, label %for.cond87.preheader.loopexit, !llvm.loop !25 for.body90: ; preds = %for.cond87.preheader, %for.body90 %k86.0160 = phi i32 [ %inc100, %for.body90 ], [ 0, %for.cond87.preheader ] call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #4 %call91 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x, ptr noundef nonnull %y) %65 = load i32, ptr %y, align 4, !tbaa !5 %add92 = add nsw i32 %65, %origin_y.0.lcssa %idxprom93 = sext i32 %add92 to i64 %66 = load i32, ptr %x, align 4, !tbaa !5 %add95 = add nsw i32 %66, %origin_x.0.lcssa %idxprom96 = sext i32 %add95 to i64 %arrayidx97 = getelementptr inbounds [500 x [500 x i32]], ptr %kami, i64 0, i64 %idxprom93, i64 %idxprom96 %67 = load i32, ptr %arrayidx97, align 4, !tbaa !5 %call98 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %67) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4 %inc100 = add nuw nsw i32 %k86.0160, 1 %68 = load i32, ptr %p, align 4, !tbaa !5 %cmp88 = icmp slt i32 %inc100, %68 br i1 %cmp88, label %for.body90, label %cleanup, !llvm.loop !26 cleanup: ; preds = %for.body90, %for.cond87.preheader call void @llvm.lifetime.end.p0(i64 1000000, ptr nonnull %kami) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %p) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %p) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w, ptr noundef nonnull %h, ptr noundef nonnull %t, ptr noundef nonnull %p) %69 = load i32, ptr %w, align 4, !tbaa !5 %tobool = icmp ne i32 %69, 0 %70 = load i32, ptr %h, align 4 %tobool1 = icmp ne i32 %70, 0 %or.cond = select i1 %tobool, i1 true, i1 %tobool1 %71 = load i32, ptr %t, align 4 %tobool3 = icmp ne i32 %71, 0 %or.cond105 = select i1 %or.cond, i1 true, i1 %tobool3 %72 = load i32, ptr %p, align 4 %tobool5 = icmp ne i32 %72, 0 %or.cond106 = select i1 %or.cond105, i1 true, i1 %tobool5 br i1 %or.cond106, label %if.end, label %while.end while.end: ; preds = %cleanup, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %p) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 attributes #0 = { nofree 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 = { 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 #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10, !11, !12} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!"llvm.loop.isvectorized", i32 1} !12 = !{!"llvm.loop.unroll.runtime.disable"} !13 = distinct !{!13, !10, !12, !11} !14 = distinct !{!14, !10} !15 = distinct !{!15, !10} !16 = distinct !{!16, !10} !17 = !{!18} !18 = distinct !{!18, !19} !19 = distinct !{!19, !"LVerDomain"} !20 = !{!21} !21 = distinct !{!21, !19} !22 = distinct !{!22, !10, !11, !12} !23 = distinct !{!23, !10, !11} !24 = distinct !{!24, !10} !25 = distinct !{!25, !10} !26 = distinct !{!26, !10}
#include <stdio.h> #include <math.h> typedef struct point { double x; double y; } POINT; void calc_circum_circle(POINT *p0, POINT *pa, POINT *pb, POINT *c, double *r); int main() { int n; POINT p0, pa, pb, c; double r; scanf("%d", &n); for (; n > 0; n--) { scanf("%lf %lf %lf %lf %lf %lf", &p0.x, &p0.y, &pa.x, &pa.y, &pb.x, &pb.y); calc_circum_circle(&p0, &pa, &pb, &c, &r); printf("%.3lf %.3lf %.3lf\n", c.x, c.y, r); } return 0; } void calc_circum_circle(POINT *p0, POINT *pa, POINT *pb, POINT *c, double *r) { double ax, ay, bx, by, a2, b2, ab, s, t, r2; /* a = pa - p0, b = pb - p0 */ ax = pa->x - p0->x; ay = pa->y - p0->y; bx = pb->x - p0->x; by = pb->y - p0->y; a2 = ax * ax + ay * ay; b2 = bx * bx + by * by; ab = ax * bx + ay * by; /* c = p0 + (sa + tb) */ s = (a2 * b2 - ab * b2) / (2.0 * (a2 * b2 - ab * ab)); t = (a2 * b2 - ab * a2) / (2.0 * (a2 * b2 - ab * ab)); c->x = p0->x + s * ax + t * bx; c->y = p0->y + s * ay + t * by; /* r2 = (sa + sb)^2 */ r2 = (s*ax + t*bx)*(s*ax + t*bx) + (s*ay + t*by)*(s*ay + t*by); *r = sqrt(r2); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184330/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184330/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" %struct.point = type { double, double } @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [24 x i8] c"%lf %lf %lf %lf %lf %lf\00", align 1 @.str.2 = private unnamed_addr constant [19 x i8] c"%.3lf %.3lf %.3lf\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %p0 = alloca %struct.point, align 8 %pa = alloca %struct.point, align 8 %pb = alloca %struct.point, align 8 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6 call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %p0) #6 call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %pa) #6 call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %pb) #6 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %.pr = load i32, ptr %n, align 4, !tbaa !5 %cmp9 = icmp sgt i32 %.pr, 0 br i1 %cmp9, label %for.body.lr.ph, label %for.end for.body.lr.ph: ; preds = %entry %y = getelementptr inbounds %struct.point, ptr %p0, i64 0, i32 1 %y2 = getelementptr inbounds %struct.point, ptr %pa, i64 0, i32 1 %y4 = getelementptr inbounds %struct.point, ptr %pb, i64 0, i32 1 br label %for.body for.body: ; preds = %for.body.lr.ph, %for.body %call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %p0, ptr noundef nonnull %y, ptr noundef nonnull %pa, ptr noundef nonnull %y2, ptr noundef nonnull %pb, ptr noundef nonnull %y4) %0 = load double, ptr %pa, align 8, !tbaa !9 %1 = load double, ptr %p0, align 8, !tbaa !9 %sub.i = fsub double %0, %1 %2 = load double, ptr %y2, align 8, !tbaa !12 %3 = load double, ptr %y, align 8, !tbaa !12 %sub3.i = fsub double %2, %3 %4 = load double, ptr %pb, align 8, !tbaa !9 %sub6.i = fsub double %4, %1 %5 = load double, ptr %y4, align 8, !tbaa !12 %sub9.i = fsub double %5, %3 %mul10.i = fmul double %sub3.i, %sub3.i %6 = call double @llvm.fmuladd.f64(double %sub.i, double %sub.i, double %mul10.i) %mul11.i = fmul double %sub9.i, %sub9.i %7 = call double @llvm.fmuladd.f64(double %sub6.i, double %sub6.i, double %mul11.i) %mul12.i = fmul double %sub3.i, %sub9.i %8 = call double @llvm.fmuladd.f64(double %sub.i, double %sub6.i, double %mul12.i) %9 = fneg double %8 %neg.i = fmul double %7, %9 %10 = call double @llvm.fmuladd.f64(double %6, double %7, double %neg.i) %neg15.i = fmul double %8, %9 %11 = call double @llvm.fmuladd.f64(double %6, double %7, double %neg15.i) %mul.i = fmul double %11, 2.000000e+00 %div.i = fdiv double %10, %mul.i %neg18.i = fmul double %6, %9 %12 = call double @llvm.fmuladd.f64(double %6, double %7, double %neg18.i) %div23.i = fdiv double %12, %mul.i %13 = call double @llvm.fmuladd.f64(double %div.i, double %sub.i, double %1) %14 = call double @llvm.fmuladd.f64(double %div23.i, double %sub6.i, double %13) %15 = call double @llvm.fmuladd.f64(double %div.i, double %sub3.i, double %3) %16 = call double @llvm.fmuladd.f64(double %div23.i, double %sub9.i, double %15) %mul33.i = fmul double %sub6.i, %div23.i %17 = call double @llvm.fmuladd.f64(double %div.i, double %sub.i, double %mul33.i) %mul38.i = fmul double %sub9.i, %div23.i %18 = call double @llvm.fmuladd.f64(double %div.i, double %sub3.i, double %mul38.i) %mul41.i = fmul double %18, %18 %19 = call double @llvm.fmuladd.f64(double %17, double %17, double %mul41.i) %sqrt.i = call double @llvm.sqrt.f64(double %19) %call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %14, double noundef %16, double noundef %sqrt.i) %20 = load i32, ptr %n, align 4, !tbaa !5 %dec = add nsw i32 %20, -1 store i32 %dec, ptr %n, align 4, !tbaa !5 %cmp = icmp sgt i32 %20, 1 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !13 for.end: ; preds = %for.body, %entry call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %pb) #6 call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %pa) #6 call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %p0) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: readwrite) uwtable define dso_local void @calc_circum_circle(ptr nocapture noundef readonly %p0, ptr nocapture noundef readonly %pa, ptr nocapture noundef readonly %pb, ptr nocapture noundef writeonly %c, ptr nocapture noundef writeonly %r) local_unnamed_addr #3 { entry: %0 = load <2 x double>, ptr %pa, align 8, !tbaa !15 %1 = load <2 x double>, ptr %p0, align 8, !tbaa !15 %2 = fsub <2 x double> %0, %1 %3 = load <2 x double>, ptr %pb, align 8, !tbaa !15 %4 = fsub <2 x double> %3, %1 %5 = extractelement <2 x double> %2, i64 1 %mul10 = fmul double %5, %5 %6 = extractelement <2 x double> %2, i64 0 %7 = tail call double @llvm.fmuladd.f64(double %6, double %6, double %mul10) %8 = extractelement <2 x double> %4, i64 1 %mul11 = fmul double %8, %8 %9 = extractelement <2 x double> %4, i64 0 %10 = tail call double @llvm.fmuladd.f64(double %9, double %9, double %mul11) %mul12 = fmul double %5, %8 %11 = tail call double @llvm.fmuladd.f64(double %6, double %9, double %mul12) %12 = fneg double %11 %neg = fmul double %10, %12 %13 = tail call double @llvm.fmuladd.f64(double %7, double %10, double %neg) %neg15 = fmul double %11, %12 %14 = tail call double @llvm.fmuladd.f64(double %7, double %10, double %neg15) %mul = fmul double %14, 2.000000e+00 %div = fdiv double %13, %mul %neg18 = fmul double %7, %12 %15 = tail call double @llvm.fmuladd.f64(double %7, double %10, double %neg18) %div23 = fdiv double %15, %mul %16 = insertelement <2 x double> poison, double %div, i64 0 %17 = shufflevector <2 x double> %16, <2 x double> poison, <2 x i32> zeroinitializer %18 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %17, <2 x double> %2, <2 x double> %1) %19 = insertelement <2 x double> poison, double %div23, i64 0 %20 = shufflevector <2 x double> %19, <2 x double> poison, <2 x i32> zeroinitializer %21 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %20, <2 x double> %4, <2 x double> %18) store <2 x double> %21, ptr %c, align 8, !tbaa !15 %mul33 = fmul double %9, %div23 %22 = tail call double @llvm.fmuladd.f64(double %div, double %6, double %mul33) %mul38 = fmul double %8, %div23 %23 = tail call double @llvm.fmuladd.f64(double %div, double %5, double %mul38) %mul41 = fmul double %23, %23 %24 = tail call double @llvm.fmuladd.f64(double %22, double %22, double %mul41) %sqrt = tail call double @llvm.sqrt.f64(double %24) store double %sqrt, ptr %r, align 8, !tbaa !15 ret void } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) declare double @llvm.fmuladd.f64(double, double, double) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare double @llvm.sqrt.f64(double) #5 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #5 attributes #0 = { nofree 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 = { 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 #3 = { mustprogress nofree nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #6 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!10, !11, i64 0} !10 = !{!"point", !11, i64 0, !11, i64 8} !11 = !{!"double", !7, i64 0} !12 = !{!10, !11, i64 8} !13 = distinct !{!13, !14} !14 = !{!"llvm.loop.mustprogress"} !15 = !{!11, !11, i64 0}
#include <stdio.h> #include <math.h> int main() { int setcount; float x1, y1, x2, y2, x3, y3; float nx1, ny1, nx2, ny2; float nr1, nr2; float xp, yp, r; float tmp; int i; scanf("%d", &setcount); for(i=0; i<setcount; i++){ scanf("%f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3); nx1=x2-x1; ny1=y2-y1; nx2=x3-x1; ny2=y3-y1; nr1=nx1*nx1+ny1*ny1; nr2=nx2*nx2+ny2*ny2; nr1*=0.5f; nr2*=0.5f; if(nx1==0.0f){ nr1/=ny1; ny1=1.0f; nr2-=nr1*ny2; ny2=0.0f; nr2/=nx2; nx2=1.0f; tmp=nr1; nr1=nr2; nr2=tmp; } else if(nx2==0.0f){ nr2/=ny2; ny2=1.0f; nr1-=nr2*ny1; ny1=0.0f; nr1/=nx1; nx1=1.0f; } else if(ny2==0.0f){ nr2/=nx2; nx2=1.0f; nr1-=nr2*nx1; nx1=0.0f; nr1/=ny1; ny1=1.0f; tmp=nr1; nr1=nr2; nr2=tmp; } else { //normalize ny1/=nx1; nr1/=nx1; nx1=1.0f; //subtraction ny2-=ny1*nx2; nr2-=nr1*nx2; nx2=0.0f; //normalize nr2/=ny2; ny2=1.0f; //subtraction nr1-=nr2*ny1; ny1=0.0f; } xp=nr1+x1; yp=nr2+y1; r=sqrt(nr1*nr1+nr2*nr2); printf("%.3f %.3f %.3f\n", xp, yp, r); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184381/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184381/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [18 x i8] c"%f %f %f %f %f %f\00", align 1 @.str.2 = private unnamed_addr constant [16 x i8] c"%.3f %.3f %.3f\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %setcount = alloca i32, align 4 %x1 = alloca float, align 4 %y1 = alloca float, align 4 %x2 = alloca float, align 4 %y2 = alloca float, align 4 %x3 = alloca float, align 4 %y3 = alloca float, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %setcount) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x1) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y1) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x2) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y2) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x3) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y3) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %setcount) %0 = load i32, ptr %setcount, align 4, !tbaa !5 %cmp100 = icmp sgt i32 %0, 0 br i1 %cmp100, label %for.body, label %for.end for.body: ; preds = %entry, %if.end35 %i.0101 = phi i32 [ %inc, %if.end35 ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x1, ptr noundef nonnull %y1, ptr noundef nonnull %x2, ptr noundef nonnull %y2, ptr noundef nonnull %x3, ptr noundef nonnull %y3) %1 = load float, ptr %x2, align 4, !tbaa !9 %2 = load float, ptr %x1, align 4, !tbaa !9 %sub = fsub float %1, %2 %3 = load float, ptr %y2, align 4, !tbaa !9 %4 = load float, ptr %y1, align 4, !tbaa !9 %sub2 = fsub float %3, %4 %5 = load float, ptr %x3, align 4, !tbaa !9 %sub3 = fsub float %5, %2 %6 = load float, ptr %y3, align 4, !tbaa !9 %sub4 = fsub float %6, %4 %mul5 = fmul float %sub2, %sub2 %7 = call float @llvm.fmuladd.f32(float %sub, float %sub, float %mul5) %mul6 = fmul float %sub4, %sub4 %8 = call float @llvm.fmuladd.f32(float %sub3, float %sub3, float %mul6) %mul = fmul float %7, 5.000000e-01 %mul7 = fmul float %8, 5.000000e-01 %cmp8 = fcmp oeq float %sub, 0.000000e+00 br i1 %cmp8, label %if.then, label %if.else if.then: ; preds = %for.body %div = fdiv float %mul, %sub2 %neg = fneg float %div %9 = call float @llvm.fmuladd.f32(float %neg, float %sub4, float %mul7) %div10 = fdiv float %9, %sub3 br label %if.end35 if.else: ; preds = %for.body %cmp11 = fcmp oeq float %sub3, 0.000000e+00 br i1 %cmp11, label %if.then12, label %if.else17 if.then12: ; preds = %if.else %div13 = fdiv float %mul7, %sub4 %neg15 = fneg float %div13 %10 = call float @llvm.fmuladd.f32(float %neg15, float %sub2, float %mul) %div16 = fdiv float %10, %sub br label %if.end35 if.else17: ; preds = %if.else %cmp18 = fcmp oeq float %sub4, 0.000000e+00 br i1 %cmp18, label %if.then19, label %if.else24 if.then19: ; preds = %if.else17 %div20 = fdiv float %mul7, %sub3 %neg22 = fneg float %div20 %11 = call float @llvm.fmuladd.f32(float %neg22, float %sub, float %mul) %div23 = fdiv float %11, %sub2 br label %if.end35 if.else24: ; preds = %if.else17 %12 = insertelement <2 x float> poison, float %mul, i64 0 %13 = insertelement <2 x float> %12, float %sub2, i64 1 %14 = insertelement <2 x float> poison, float %sub, i64 0 %15 = shufflevector <2 x float> %14, <2 x float> poison, <2 x i32> zeroinitializer %16 = fdiv <2 x float> %13, %15 %17 = fneg <2 x float> %16 %18 = insertelement <2 x float> poison, float %sub3, i64 0 %19 = shufflevector <2 x float> %18, <2 x float> poison, <2 x i32> zeroinitializer %20 = insertelement <2 x float> poison, float %mul7, i64 0 %21 = insertelement <2 x float> %20, float %sub4, i64 1 %22 = call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %17, <2 x float> %19, <2 x float> %21) %23 = extractelement <2 x float> %22, i64 0 %24 = extractelement <2 x float> %22, i64 1 %div31 = fdiv float %23, %24 %neg33 = fneg float %div31 %25 = extractelement <2 x float> %16, i64 0 %26 = extractelement <2 x float> %16, i64 1 %27 = call float @llvm.fmuladd.f32(float %neg33, float %26, float %25) br label %if.end35 if.end35: ; preds = %if.then12, %if.else24, %if.then19, %if.then %nr1.0 = phi float [ %div10, %if.then ], [ %div16, %if.then12 ], [ %div20, %if.then19 ], [ %27, %if.else24 ] %nr2.0 = phi float [ %div, %if.then ], [ %div13, %if.then12 ], [ %div23, %if.then19 ], [ %div31, %if.else24 ] %add = fadd float %2, %nr1.0 %add36 = fadd float %4, %nr2.0 %mul38 = fmul float %nr2.0, %nr2.0 %28 = call float @llvm.fmuladd.f32(float %nr1.0, float %nr1.0, float %mul38) %sqrt = call float @llvm.sqrt.f32(float %28) %conv41 = fpext float %add to double %conv42 = fpext float %add36 to double %conv43 = fpext float %sqrt to double %call44 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %conv41, double noundef %conv42, double noundef %conv43) %inc = add nuw nsw i32 %i.0101, 1 %29 = load i32, ptr %setcount, align 4, !tbaa !5 %cmp = icmp slt i32 %inc, %29 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11 for.end: ; preds = %if.end35, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y3) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x3) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y2) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x2) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y1) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x1) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %setcount) #5 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) declare float @llvm.fmuladd.f32(float, float, float) #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare float @llvm.sqrt.f32(float) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare <2 x float> @llvm.fmuladd.v2f32(<2 x float>, <2 x float>, <2 x float>) #4 attributes #0 = { nofree 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 = { 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 #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !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 = !{!"float", !7, i64 0} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.mustprogress"}
#include<stdio.h> #include<math.h> int main(void) { double x, y, r; double x1, x2, x3, y1, y2, y3; double ecm[2][3]; //enlarged coefficient matrix:拡大係数行列 double a, b, A; int i; int n; scanf("%d", &n); for(i = 0; i < n; i++) { scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3); ecm[0][0] = x1 - x2; ecm[0][1] = y1 - y2; ecm[0][2] = (x2 * x2 + y2 * y2) - (x1 * x1 + y1 * y1); ecm[1][0] = x1 - x3; ecm[1][1] = y1 - y3; ecm[1][2] = (x3 * x3 + y3 * y3) - (x1 * x1 + y1 * y1); A = (ecm[0][0] * ecm[1][1]) - (ecm[0][1] * ecm[1][0]); a = ((ecm[0][2] * ecm[1][1]) - (ecm[0][1] * ecm[1][2])) / A + 0; b = ((ecm[0][0] * ecm[1][2]) - (ecm[0][2] * ecm[1][0])) / A + 0; x = (a / -2.0); y = (b / -2.0); r = sqrt(pow(x1 - x, 2) + pow(y1 - y, 2)); printf("%.3f %.3f %.3f\n", x, y, r); //四捨五入は自動的にされる } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184424/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184424/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [24 x i8] c"%lf %lf %lf %lf %lf %lf\00", align 1 @.str.2 = private unnamed_addr constant [16 x i8] c"%.3f %.3f %.3f\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %x1 = alloca double, align 8 %x2 = alloca double, align 8 %x3 = alloca double, align 8 %y1 = alloca double, align 8 %y2 = alloca double, align 8 %y3 = alloca double, align 8 %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x1) #5 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x2) #5 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x3) #5 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y1) #5 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y2) #5 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y3) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp73 = icmp sgt i32 %0, 0 br i1 %cmp73, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %i.074 = phi i32 [ %inc, %for.body ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x1, ptr noundef nonnull %y1, ptr noundef nonnull %x2, ptr noundef nonnull %y2, ptr noundef nonnull %x3, ptr noundef nonnull %y3) %1 = load double, ptr %x1, align 8, !tbaa !9 %2 = load double, ptr %x2, align 8, !tbaa !9 %3 = load double, ptr %y1, align 8, !tbaa !9 %4 = load double, ptr %y2, align 8, !tbaa !9 %sub3 = fsub double %3, %4 %mul6 = fmul double %4, %4 %5 = call double @llvm.fmuladd.f64(double %2, double %2, double %mul6) %mul7 = fmul double %3, %3 %6 = call double @llvm.fmuladd.f64(double %1, double %1, double %mul7) %7 = load double, ptr %x3, align 8, !tbaa !9 %8 = load double, ptr %y3, align 8, !tbaa !9 %sub14 = fsub double %3, %8 %mul17 = fmul double %8, %8 %9 = call double @llvm.fmuladd.f64(double %7, double %7, double %mul17) %10 = fneg double %sub3 %11 = insertelement <2 x double> poison, double %5, i64 0 %12 = insertelement <2 x double> %11, double %1, i64 1 %13 = insertelement <2 x double> poison, double %6, i64 0 %14 = insertelement <2 x double> %13, double %2, i64 1 %15 = fsub <2 x double> %12, %14 %16 = insertelement <2 x double> %12, double %9, i64 0 %17 = insertelement <2 x double> %14, double %7, i64 1 %18 = fsub <2 x double> %16, %17 %19 = insertelement <2 x double> poison, double %10, i64 0 %20 = shufflevector <2 x double> %19, <2 x double> poison, <2 x i32> zeroinitializer %21 = fmul <2 x double> %18, %20 %22 = insertelement <2 x double> poison, double %sub14, i64 0 %23 = shufflevector <2 x double> %22, <2 x double> poison, <2 x i32> zeroinitializer %24 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %15, <2 x double> %23, <2 x double> %21) %25 = extractelement <2 x double> %15, i64 0 %26 = fneg double %25 %27 = extractelement <2 x double> %18, i64 1 %neg50 = fmul double %27, %26 %28 = extractelement <2 x double> %15, i64 1 %29 = extractelement <2 x double> %18, i64 0 %30 = call double @llvm.fmuladd.f64(double %28, double %29, double %neg50) %31 = shufflevector <2 x double> %24, <2 x double> poison, <2 x i32> <i32 poison, i32 0> %32 = insertelement <2 x double> %31, double %30, i64 0 %33 = shufflevector <2 x double> %24, <2 x double> poison, <2 x i32> <i32 1, i32 1> %34 = fdiv <2 x double> %32, %33 %35 = fadd <2 x double> %34, zeroinitializer %36 = fmul <2 x double> %35, <double -5.000000e-01, double -5.000000e-01> %37 = insertelement <2 x double> poison, double %3, i64 0 %38 = insertelement <2 x double> %37, double %1, i64 1 %39 = fsub <2 x double> %38, %36 %40 = fmul <2 x double> %39, %39 %shift = shufflevector <2 x double> %40, <2 x double> poison, <2 x i32> <i32 1, i32 poison> %41 = fadd <2 x double> %40, %shift %add59 = extractelement <2 x double> %41, i64 0 %sqrt = call double @llvm.sqrt.f64(double %add59) %42 = extractelement <2 x double> %36, i64 0 %43 = extractelement <2 x double> %36, i64 1 %call61 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %43, double noundef %42, double noundef %sqrt) %inc = add nuw nsw i32 %i.074, 1 %44 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc, %44 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11 for.end: ; preds = %for.body, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y3) #5 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y2) #5 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y1) #5 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x3) #5 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x2) #5 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x1) #5 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) declare double @llvm.fmuladd.f64(double, double, double) #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare double @llvm.sqrt.f64(double) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #4 attributes #0 = { nofree 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 = { 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 #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !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 = !{!"double", !7, i64 0} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.mustprogress"}
#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #include<stdio.h> #include<math.h> #include<string.h> #include<stdlib.h> #include<stdarg.h> #include<malloc.h> double round(double); int main() { int i, n; double x1, y1, x2, y2, x3, y3; double px, py, r; double a1, a2, b1, b2, c1, c2; scanf("%d", &n); for(i=0; i<n; i++){ scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3); a1 = 2*(x1-x2); a2 = 2*(x2-x3); b1 = 2*(y1-y2); b2 = 2*(y2-y3); c1 = x1*x1 - x2*x2 + y1*y1 - y2*y2; c2 = x2*x2 - x3*x3 + y2*y2 - y3*y3; px = (b2*c1 - b1*c2) / (a1*b2 - b1*a2); py = (a1*c2 - a2*c1) / (a1*b2 - b1*a2); r = sqrt(pow((x1-px),2)+pow((y1-py),2)); px = px * 1000; py = py * 1000; r = r * 1000; px = round(px); py = round(py); r = round(r); px = px / 1000; py = py / 1000; r = r / 1000; if(fabs(px) < 1e-6) px = 0; if(fabs(py) < 1e-6) py = 0; if(fabs(r) < 1e-6) r = 0; printf("%5.3f %5.3f %5.3f\n", px, py, r); } return 0; } double round(double x) { if(x>=0) x = floor(x + 0.5); else x = -1.0 * floor(fabs(x) + 0.5); return x; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184468/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184468/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [19 x i8] c"%lf%lf%lf%lf%lf%lf\00", align 1 @.str.2 = private unnamed_addr constant [19 x i8] c"%5.3f %5.3f %5.3f\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %x1 = alloca double, align 8 %y1 = alloca double, align 8 %x2 = alloca double, align 8 %y2 = alloca double, align 8 %x3 = alloca double, align 8 %y3 = alloca double, align 8 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x1) #6 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y1) #6 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x2) #6 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y2) #6 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x3) #6 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y3) #6 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp77 = icmp sgt i32 %0, 0 br i1 %cmp77, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %i.078 = phi i32 [ %inc, %for.body ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x1, ptr noundef nonnull %y1, ptr noundef nonnull %x2, ptr noundef nonnull %y2, ptr noundef nonnull %x3, ptr noundef nonnull %y3) %1 = load double, ptr %x1, align 8, !tbaa !9 %2 = load double, ptr %x2, align 8, !tbaa !9 %3 = load double, ptr %x3, align 8, !tbaa !9 %sub2 = fsub double %2, %3 %mul3 = fmul double %sub2, 2.000000e+00 %4 = load double, ptr %y1, align 8, !tbaa !9 %5 = load double, ptr %y2, align 8, !tbaa !9 %sub4 = fsub double %4, %5 %6 = load double, ptr %y3, align 8, !tbaa !9 %7 = fneg double %2 %neg = fmul double %2, %7 %8 = call double @llvm.fmuladd.f64(double %1, double %1, double %neg) %9 = call double @llvm.fmuladd.f64(double %4, double %4, double %8) %neg12 = fneg double %5 %10 = call double @llvm.fmuladd.f64(double %neg12, double %5, double %9) %11 = fneg double %3 %neg15 = fmul double %3, %11 %12 = call double @llvm.fmuladd.f64(double %2, double %2, double %neg15) %13 = call double @llvm.fmuladd.f64(double %5, double %5, double %12) %neg18 = fneg double %6 %14 = call double @llvm.fmuladd.f64(double %neg18, double %6, double %13) %15 = fmul double %sub4, -2.000000e+00 %16 = insertelement <2 x double> poison, double %5, i64 0 %17 = insertelement <2 x double> %16, double %1, i64 1 %18 = insertelement <2 x double> poison, double %6, i64 0 %19 = insertelement <2 x double> %18, double %2, i64 1 %20 = fsub <2 x double> %17, %19 %21 = fmul <2 x double> %20, <double 2.000000e+00, double 2.000000e+00> %22 = insertelement <2 x double> poison, double %14, i64 0 %23 = insertelement <2 x double> %22, double %mul3, i64 1 %24 = insertelement <2 x double> poison, double %15, i64 0 %25 = shufflevector <2 x double> %24, <2 x double> poison, <2 x i32> zeroinitializer %26 = fmul <2 x double> %23, %25 %27 = shufflevector <2 x double> %21, <2 x double> poison, <2 x i32> <i32 poison, i32 0> %28 = insertelement <2 x double> %27, double %10, i64 0 %29 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %21, <2 x double> %28, <2 x double> %26) %30 = fneg double %mul3 %neg27 = fmul double %10, %30 %31 = extractelement <2 x double> %21, i64 1 %32 = call double @llvm.fmuladd.f64(double %31, double %14, double %neg27) %33 = insertelement <2 x double> %29, double %32, i64 1 %34 = shufflevector <2 x double> %29, <2 x double> poison, <2 x i32> <i32 1, i32 1> %35 = fdiv <2 x double> %33, %34 %36 = insertelement <2 x double> poison, double %1, i64 0 %37 = insertelement <2 x double> %36, double %4, i64 1 %38 = fsub <2 x double> %37, %35 %39 = fmul <2 x double> %38, %38 %shift = shufflevector <2 x double> %39, <2 x double> poison, <2 x i32> <i32 1, i32 poison> %40 = fadd <2 x double> %39, %shift %add = extractelement <2 x double> %40, i64 0 %sqrt = call double @llvm.sqrt.f64(double %add) %41 = extractelement <2 x double> %35, i64 0 %mul37 = fmul double %41, 1.000000e+03 %42 = call double @llvm.round.f64(double %mul37) %div40 = fdiv double %42, 1.000000e+03 %43 = call double @llvm.fabs.f64(double %div40) %cmp43 = fcmp olt double %43, 0x3EB0C6F7A0B5ED8D %px.0 = select i1 %cmp43, double 0.000000e+00, double %div40 %44 = insertelement <2 x double> %35, double %sqrt, i64 0 %45 = fmul <2 x double> %44, <double 1.000000e+03, double 1.000000e+03> %46 = call <2 x double> @llvm.round.v2f64(<2 x double> %45) %47 = fdiv <2 x double> %46, <double 1.000000e+03, double 1.000000e+03> %48 = call <2 x double> @llvm.fabs.v2f64(<2 x double> %47) %49 = fcmp olt <2 x double> %48, <double 0x3EB0C6F7A0B5ED8D, double 0x3EB0C6F7A0B5ED8D> %50 = extractelement <2 x i1> %49, i64 1 %51 = extractelement <2 x double> %47, i64 1 %py.0 = select i1 %50, double 0.000000e+00, double %51 %52 = extractelement <2 x i1> %49, i64 0 %53 = extractelement <2 x double> %47, i64 0 %r.0 = select i1 %52, double 0.000000e+00, double %53 %call50 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %px.0, double noundef %py.0, double noundef %r.0) %inc = add nuw nsw i32 %i.078, 1 %54 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc, %54 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11 for.end: ; preds = %for.body, %entry call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y3) #6 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x3) #6 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y2) #6 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x2) #6 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y1) #6 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x1) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) declare double @llvm.fmuladd.f64(double, double, double) #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) declare double @llvm.round.f64(double) #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) declare double @llvm.fabs.f64(double) #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local double @round(double noundef %x) local_unnamed_addr #4 { entry: %cmp = fcmp ult double %x, 0.000000e+00 br i1 %cmp, label %if.else, label %if.then if.then: ; preds = %entry %add = fadd double %x, 5.000000e-01 %0 = tail call double @llvm.floor.f64(double %add) br label %if.end if.else: ; preds = %entry %1 = tail call double @llvm.fabs.f64(double %x) %add1 = fadd double %1, 5.000000e-01 %2 = tail call double @llvm.floor.f64(double %add1) %mul = fneg double %2 br label %if.end if.end: ; preds = %if.else, %if.then %x.addr.0 = phi double [ %0, %if.then ], [ %mul, %if.else ] ret double %x.addr.0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) declare double @llvm.floor.f64(double) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare double @llvm.sqrt.f64(double) #5 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #5 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare <2 x double> @llvm.round.v2f64(<2 x double>) #5 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare <2 x double> @llvm.fabs.v2f64(<2 x double>) #5 attributes #0 = { nofree 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 = { 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 #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #4 = { mustprogress nofree nosync nounwind willreturn memory(none) 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #6 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !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 = !{!"double", !7, i64 0} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.mustprogress"}
# include "stdio.h" int main(){ int n; scanf("%d",&n); int a[n]; for(int i=0;i<n;i++) scanf("%d",&a[i]); int f[100000]; for(int i=0;i<100000;i++) f[i]=0; for(int i=0;i<n;i++) f[a[i]]++; int c0=0,c2=0,out=0; if((n%2&&f[0]==1)||(n%2==0)){ for(int i=1;i<100000;i++){ if(f[i]==2) c2++; if(f[i]!=0&&f[i]!=2) out=1; } }else{ printf("0\n"); return 0; } if(out){ printf("0\n"); return 0; } int ans=1; for(int i=0;i<c2;i++){ ans*=2; ans=ans%1000000007; } printf("%d\n",ans%1000000007); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184510/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184510/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 @str.3 = private unnamed_addr constant [2 x i8] c"0\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %f = alloca [100000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %1 = zext i32 %0 to i64 %2 = call ptr @llvm.stacksave.p0() %vla = alloca i32, i64 %1, align 16 %3 = load i32, ptr %n, align 4, !tbaa !5 %cmp90 = icmp sgt i32 %3, 0 br i1 %cmp90, label %for.body, label %for.cond.cleanup.thread for.cond.cleanup.thread: ; preds = %entry call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %f) #6 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400000) %f, i8 0, i64 400000, i1 false), !tbaa !5 br label %for.cond.cleanup15 for.cond.cleanup: ; preds = %for.body call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %f) #6 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400000) %f, i8 0, i64 400000, i1 false), !tbaa !5 %cmp1493 = icmp sgt i32 %4, 0 br i1 %cmp1493, label %for.body16.preheader, label %for.cond.cleanup15 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %4 = load i32, ptr %n, align 4, !tbaa !5 %5 = sext i32 %4 to i64 %cmp = icmp slt i64 %indvars.iv.next, %5 br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9 for.body16.preheader: ; preds = %for.cond.cleanup %wide.trip.count = zext i32 %4 to i64 %xtraiter = and i64 %wide.trip.count, 3 %6 = icmp ult i32 %4, 4 br i1 %6, label %for.cond.cleanup15.loopexit.unr-lcssa, label %for.body16.preheader.new for.body16.preheader.new: ; preds = %for.body16.preheader %unroll_iter = and i64 %wide.trip.count, 4294967292 br label %for.body16 for.cond.cleanup15.loopexit.unr-lcssa: ; preds = %for.body16, %for.body16.preheader %indvars.iv107.unr = phi i64 [ 0, %for.body16.preheader ], [ %indvars.iv.next108.3, %for.body16 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond.cleanup15.loopexit, label %for.body16.epil for.body16.epil: ; preds = %for.cond.cleanup15.loopexit.unr-lcssa, %for.body16.epil %indvars.iv107.epil = phi i64 [ %indvars.iv.next108.epil, %for.body16.epil ], [ %indvars.iv107.unr, %for.cond.cleanup15.loopexit.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body16.epil ], [ 0, %for.cond.cleanup15.loopexit.unr-lcssa ] %arrayidx18.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv107.epil %7 = load i32, ptr %arrayidx18.epil, align 4, !tbaa !5 %idxprom19.epil = sext i32 %7 to i64 %arrayidx20.epil = getelementptr inbounds [100000 x i32], ptr %f, i64 0, i64 %idxprom19.epil %8 = load i32, ptr %arrayidx20.epil, align 4, !tbaa !5 %inc21.epil = add nsw i32 %8, 1 store i32 %inc21.epil, ptr %arrayidx20.epil, align 4, !tbaa !5 %indvars.iv.next108.epil = add nuw nsw i64 %indvars.iv107.epil, 1 %epil.iter.next = add i64 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %for.cond.cleanup15.loopexit, label %for.body16.epil, !llvm.loop !11 for.cond.cleanup15.loopexit: ; preds = %for.body16.epil, %for.cond.cleanup15.loopexit.unr-lcssa %.pre = load i32, ptr %f, align 16 %9 = icmp eq i32 %.pre, 1 br label %for.cond.cleanup15 for.cond.cleanup15: ; preds = %for.cond.cleanup.thread, %for.cond.cleanup15.loopexit, %for.cond.cleanup %.lcssa117 = phi i32 [ %4, %for.cond.cleanup15.loopexit ], [ %4, %for.cond.cleanup ], [ %3, %for.cond.cleanup.thread ] %cmp26 = phi i1 [ %9, %for.cond.cleanup15.loopexit ], [ false, %for.cond.cleanup ], [ false, %for.cond.cleanup.thread ] %10 = and i32 %.lcssa117, 1 %cmp28 = icmp eq i32 %10, 0 %or.cond89 = select i1 %cmp28, i1 true, i1 %cmp26 br i1 %or.cond89, label %for.body33.outer, label %if.else for.body33.outer: ; preds = %for.cond.cleanup15, %for.inc48.thread %indvars.iv110.ph = phi i64 [ %indvars.iv.next111119, %for.inc48.thread ], [ 1, %for.cond.cleanup15 ] %tobool53.not = phi i1 [ false, %for.inc48.thread ], [ true, %for.cond.cleanup15 ] %c2.095.ph = phi i32 [ %spec.select, %for.inc48.thread ], [ 0, %for.cond.cleanup15 ] br label %for.body33 for.body16: ; preds = %for.body16, %for.body16.preheader.new %indvars.iv107 = phi i64 [ 0, %for.body16.preheader.new ], [ %indvars.iv.next108.3, %for.body16 ] %niter = phi i64 [ 0, %for.body16.preheader.new ], [ %niter.next.3, %for.body16 ] %arrayidx18 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv107 %11 = load i32, ptr %arrayidx18, align 16, !tbaa !5 %idxprom19 = sext i32 %11 to i64 %arrayidx20 = getelementptr inbounds [100000 x i32], ptr %f, i64 0, i64 %idxprom19 %12 = load i32, ptr %arrayidx20, align 4, !tbaa !5 %inc21 = add nsw i32 %12, 1 store i32 %inc21, ptr %arrayidx20, align 4, !tbaa !5 %indvars.iv.next108 = or i64 %indvars.iv107, 1 %arrayidx18.1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next108 %13 = load i32, ptr %arrayidx18.1, align 4, !tbaa !5 %idxprom19.1 = sext i32 %13 to i64 %arrayidx20.1 = getelementptr inbounds [100000 x i32], ptr %f, i64 0, i64 %idxprom19.1 %14 = load i32, ptr %arrayidx20.1, align 4, !tbaa !5 %inc21.1 = add nsw i32 %14, 1 store i32 %inc21.1, ptr %arrayidx20.1, align 4, !tbaa !5 %indvars.iv.next108.1 = or i64 %indvars.iv107, 2 %arrayidx18.2 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next108.1 %15 = load i32, ptr %arrayidx18.2, align 8, !tbaa !5 %idxprom19.2 = sext i32 %15 to i64 %arrayidx20.2 = getelementptr inbounds [100000 x i32], ptr %f, i64 0, i64 %idxprom19.2 %16 = load i32, ptr %arrayidx20.2, align 4, !tbaa !5 %inc21.2 = add nsw i32 %16, 1 store i32 %inc21.2, ptr %arrayidx20.2, align 4, !tbaa !5 %indvars.iv.next108.2 = or i64 %indvars.iv107, 3 %arrayidx18.3 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next108.2 %17 = load i32, ptr %arrayidx18.3, align 4, !tbaa !5 %idxprom19.3 = sext i32 %17 to i64 %arrayidx20.3 = getelementptr inbounds [100000 x i32], ptr %f, i64 0, i64 %idxprom19.3 %18 = load i32, ptr %arrayidx20.3, align 4, !tbaa !5 %inc21.3 = add nsw i32 %18, 1 store i32 %inc21.3, ptr %arrayidx20.3, align 4, !tbaa !5 %indvars.iv.next108.3 = add nuw nsw i64 %indvars.iv107, 4 %niter.next.3 = add i64 %niter, 4 %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter br i1 %niter.ncmp.3, label %for.cond.cleanup15.loopexit.unr-lcssa, label %for.body16, !llvm.loop !13 for.cond.cleanup32: ; preds = %for.inc48 br i1 %tobool53.not, label %for.cond58.preheader, label %if.then54 for.cond58.preheader: ; preds = %for.cond.cleanup32 %cmp5998.not = icmp eq i32 %spec.select, 0 br i1 %cmp5998.not, label %for.cond.cleanup60, label %for.body61.preheader for.body61.preheader: ; preds = %for.cond58.preheader %19 = add i32 %c2.095, -1 %20 = zext i1 %cmp36 to i32 %21 = add i32 %19, %20 %xtraiter135 = and i32 %spec.select, 3 %22 = icmp ult i32 %21, 3 br i1 %22, label %for.cond.cleanup60.loopexit.unr-lcssa, label %for.body61.preheader.new for.body61.preheader.new: ; preds = %for.body61.preheader %unroll_iter139 = and i32 %spec.select, -4 br label %for.body61 for.body33: ; preds = %for.body33.outer, %for.inc48 %indvars.iv110 = phi i64 [ %indvars.iv.next111, %for.inc48 ], [ %indvars.iv110.ph, %for.body33.outer ] %c2.095 = phi i32 [ %spec.select, %for.inc48 ], [ %c2.095.ph, %for.body33.outer ] %arrayidx35 = getelementptr inbounds [100000 x i32], ptr %f, i64 0, i64 %indvars.iv110 %23 = load i32, ptr %arrayidx35, align 4, !tbaa !5 %cmp36 = icmp eq i32 %23, 2 %inc38 = zext i1 %cmp36 to i32 %spec.select = add i32 %c2.095, %inc38 switch i32 %23, label %for.inc48.thread [ i32 0, label %for.inc48 i32 2, label %for.inc48 ] for.inc48: ; preds = %for.body33, %for.body33 %indvars.iv.next111 = add nuw nsw i64 %indvars.iv110, 1 %exitcond113.not = icmp eq i64 %indvars.iv.next111, 100000 br i1 %exitcond113.not, label %for.cond.cleanup32, label %for.body33, !llvm.loop !14 for.inc48.thread: ; preds = %for.body33 %indvars.iv.next111119 = add nuw nsw i64 %indvars.iv110, 1 %exitcond113.not120 = icmp eq i64 %indvars.iv.next111119, 100000 br i1 %exitcond113.not120, label %if.then54, label %for.body33.outer, !llvm.loop !14 if.else: ; preds = %for.cond.cleanup15 %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.3) br label %cleanup if.then54: ; preds = %for.inc48.thread, %for.cond.cleanup32 %puts88 = call i32 @puts(ptr nonnull dereferenceable(1) @str.3) br label %cleanup for.cond.cleanup60.loopexit.unr-lcssa: ; preds = %for.body61, %for.body61.preheader %rem62.lcssa.ph = phi i32 [ undef, %for.body61.preheader ], [ %rem62.3, %for.body61 ] %ans.099.unr = phi i32 [ 1, %for.body61.preheader ], [ %rem62.3, %for.body61 ] %lcmp.mod137.not = icmp eq i32 %xtraiter135, 0 br i1 %lcmp.mod137.not, label %for.cond.cleanup60, label %for.body61.epil for.body61.epil: ; preds = %for.cond.cleanup60.loopexit.unr-lcssa, %for.body61.epil %ans.099.epil = phi i32 [ %rem62.epil, %for.body61.epil ], [ %ans.099.unr, %for.cond.cleanup60.loopexit.unr-lcssa ] %epil.iter136 = phi i32 [ %epil.iter136.next, %for.body61.epil ], [ 0, %for.cond.cleanup60.loopexit.unr-lcssa ] %mul.epil = shl nsw i32 %ans.099.epil, 1 %rem62.epil = srem i32 %mul.epil, 1000000007 %epil.iter136.next = add i32 %epil.iter136, 1 %epil.iter136.cmp.not = icmp eq i32 %epil.iter136.next, %xtraiter135 br i1 %epil.iter136.cmp.not, label %for.cond.cleanup60, label %for.body61.epil, !llvm.loop !15 for.cond.cleanup60: ; preds = %for.cond.cleanup60.loopexit.unr-lcssa, %for.body61.epil, %for.cond58.preheader %ans.0.lcssa = phi i32 [ 1, %for.cond58.preheader ], [ %rem62.lcssa.ph, %for.cond.cleanup60.loopexit.unr-lcssa ], [ %rem62.epil, %for.body61.epil ] %call67 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ans.0.lcssa) br label %cleanup for.body61: ; preds = %for.body61, %for.body61.preheader.new %ans.099 = phi i32 [ 1, %for.body61.preheader.new ], [ %rem62.3, %for.body61 ] %niter140 = phi i32 [ 0, %for.body61.preheader.new ], [ %niter140.next.3, %for.body61 ] %mul = shl nsw i32 %ans.099, 1 %rem62 = srem i32 %mul, 1000000007 %mul.1 = shl nsw i32 %rem62, 1 %rem62.1 = srem i32 %mul.1, 1000000007 %mul.2 = shl nsw i32 %rem62.1, 1 %rem62.2 = srem i32 %mul.2, 1000000007 %mul.3 = shl nsw i32 %rem62.2, 1 %rem62.3 = srem i32 %mul.3, 1000000007 %niter140.next.3 = add i32 %niter140, 4 %niter140.ncmp.3 = icmp eq i32 %niter140.next.3, %unroll_iter139 br i1 %niter140.ncmp.3, label %for.cond.cleanup60.loopexit.unr-lcssa, label %for.body61, !llvm.loop !16 cleanup: ; preds = %for.cond.cleanup60, %if.then54, %if.else call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %f) #6 call void @llvm.stackrestore.p0(ptr %2) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare ptr @llvm.stacksave.p0() #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare void @llvm.stackrestore.p0(ptr) #3 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4 ; 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 = { nofree 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 = { 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 #3 = { mustprogress nocallback nofree nosync nounwind willreturn } attributes #4 = { nofree nounwind } attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) } attributes #6 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.unroll.disable"} !13 = distinct !{!13, !10} !14 = distinct !{!14, !10} !15 = distinct !{!15, !12} !16 = distinct !{!16, !10}
#include<stdio.h> #include <stdlib.h> #define FOR(i,a,b) for(int i=a;i<b;i++) int main(){ int n; scanf("%d",&n); int ai,*check = (int *)calloc(n,sizeof(int)); FOR(i,0,n){ scanf("%d",&ai); check[ai]++; } int tmp = n-1,ans = 0; while(tmp>0){ if(check[tmp] != 2) ans++; tmp -= 2; } if(n%2 == 0 && check[0] != 0) ans++; if(n%2 == 1 && check[0] != 1) ans++; if(ans != 0) printf("0\n"); else{ int pow = 1; FOR(i,0,n/2) pow = (pow * 2) % 1000000007; printf("%d",pow); } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184554/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184554/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @str = private unnamed_addr constant [2 x i8] c"0\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %ai = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %ai) #5 %0 = load i32, ptr %n, align 4, !tbaa !5 %conv = sext i32 %0 to i64 %call1 = call noalias ptr @calloc(i64 noundef %conv, i64 noundef 4) #6 %cmp60 = icmp sgt i32 %0, 0 br i1 %cmp60, label %for.body, label %while.end for.cond.cleanup: ; preds = %for.body %cmp562 = icmp sgt i32 %3, 1 br i1 %cmp562, label %while.body.preheader, label %while.end while.body.preheader: ; preds = %for.cond.cleanup %sub = add nsw i32 %3, -1 br label %while.body for.body: ; preds = %entry, %for.body %i.061 = phi i32 [ %inc4, %for.body ], [ 0, %entry ] %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ai) %1 = load i32, ptr %ai, align 4, !tbaa !5 %idxprom = sext i32 %1 to i64 %arrayidx = getelementptr inbounds i32, ptr %call1, i64 %idxprom %2 = load i32, ptr %arrayidx, align 4, !tbaa !5 %inc = add nsw i32 %2, 1 store i32 %inc, ptr %arrayidx, align 4, !tbaa !5 %inc4 = add nuw nsw i32 %i.061, 1 %3 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc4, %3 br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9 while.body: ; preds = %while.body.preheader, %while.body %ans.064 = phi i32 [ %spec.select, %while.body ], [ 0, %while.body.preheader ] %tmp.063 = phi i32 [ %sub12, %while.body ], [ %sub, %while.body.preheader ] %idxprom7 = zext i32 %tmp.063 to i64 %arrayidx8 = getelementptr inbounds i32, ptr %call1, i64 %idxprom7 %4 = load i32, ptr %arrayidx8, align 4, !tbaa !5 %cmp9.not = icmp ne i32 %4, 2 %inc11 = zext i1 %cmp9.not to i32 %spec.select = add nuw nsw i32 %ans.064, %inc11 %sub12 = add nsw i32 %tmp.063, -2 %cmp5 = icmp ugt i32 %tmp.063, 2 br i1 %cmp5, label %while.body, label %while.end, !llvm.loop !11 while.end: ; preds = %while.body, %entry, %for.cond.cleanup %cmp56274 = phi i1 [ false, %for.cond.cleanup ], [ false, %entry ], [ %cmp562, %while.body ] %.lcssa73 = phi i32 [ %3, %for.cond.cleanup ], [ %0, %entry ], [ %3, %while.body ] %ans.0.lcssa = phi i32 [ 0, %for.cond.cleanup ], [ 0, %entry ], [ %spec.select, %while.body ] %5 = and i32 %.lcssa73, 1 %cmp13 = icmp eq i32 %5, 0 br i1 %cmp13, label %land.lhs.true, label %if.end20 land.lhs.true: ; preds = %while.end %6 = load i32, ptr %call1, align 4, !tbaa !5 %cmp16.not = icmp ne i32 %6, 0 %inc19 = zext i1 %cmp16.not to i32 %spec.select58 = add nsw i32 %ans.0.lcssa, %inc19 br label %if.end20 if.end20: ; preds = %land.lhs.true, %while.end %ans.2 = phi i32 [ %ans.0.lcssa, %while.end ], [ %spec.select58, %land.lhs.true ] %7 = and i32 %.lcssa73, -2147483647 %cmp22 = icmp eq i32 %7, 1 br i1 %cmp22, label %land.lhs.true24, label %if.end30 land.lhs.true24: ; preds = %if.end20 %8 = load i32, ptr %call1, align 4, !tbaa !5 %cmp26.not = icmp ne i32 %8, 1 %inc29 = zext i1 %cmp26.not to i32 %spec.select59 = add nsw i32 %ans.2, %inc29 br label %if.end30 if.end30: ; preds = %land.lhs.true24, %if.end20 %ans.3 = phi i32 [ %ans.2, %if.end20 ], [ %spec.select59, %land.lhs.true24 ] %cmp31.not = icmp eq i32 %ans.3, 0 br i1 %cmp31.not, label %for.cond36.preheader, label %if.then33 for.cond36.preheader: ; preds = %if.end30 %div = sdiv i32 %.lcssa73, 2 br i1 %cmp56274, label %for.body40.preheader, label %for.cond.cleanup39 for.body40.preheader: ; preds = %for.cond36.preheader %9 = add nsw i32 %div, -1 %xtraiter = and i32 %div, 3 %10 = icmp ult i32 %9, 3 br i1 %10, label %for.cond.cleanup39.loopexit.unr-lcssa, label %for.body40.preheader.new for.body40.preheader.new: ; preds = %for.body40.preheader %unroll_iter = and i32 %div, -4 br label %for.body40 if.then33: ; preds = %if.end30 %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) br label %if.end46 for.cond.cleanup39.loopexit.unr-lcssa: ; preds = %for.body40, %for.body40.preheader %rem41.lcssa.ph = phi i32 [ undef, %for.body40.preheader ], [ %rem41.3, %for.body40 ] %pow.067.unr = phi i32 [ 1, %for.body40.preheader ], [ %rem41.3, %for.body40 ] %lcmp.mod.not = icmp eq i32 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond.cleanup39, label %for.body40.epil for.body40.epil: ; preds = %for.cond.cleanup39.loopexit.unr-lcssa, %for.body40.epil %pow.067.epil = phi i32 [ %rem41.epil, %for.body40.epil ], [ %pow.067.unr, %for.cond.cleanup39.loopexit.unr-lcssa ] %epil.iter = phi i32 [ %epil.iter.next, %for.body40.epil ], [ 0, %for.cond.cleanup39.loopexit.unr-lcssa ] %mul.epil = shl nsw i32 %pow.067.epil, 1 %rem41.epil = srem i32 %mul.epil, 1000000007 %epil.iter.next = add i32 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i32 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %for.cond.cleanup39, label %for.body40.epil, !llvm.loop !12 for.cond.cleanup39: ; preds = %for.cond.cleanup39.loopexit.unr-lcssa, %for.body40.epil, %for.cond36.preheader %pow.0.lcssa = phi i32 [ 1, %for.cond36.preheader ], [ %rem41.lcssa.ph, %for.cond.cleanup39.loopexit.unr-lcssa ], [ %rem41.epil, %for.body40.epil ] %call45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %pow.0.lcssa) br label %if.end46 for.body40: ; preds = %for.body40, %for.body40.preheader.new %pow.067 = phi i32 [ 1, %for.body40.preheader.new ], [ %rem41.3, %for.body40 ] %niter = phi i32 [ 0, %for.body40.preheader.new ], [ %niter.next.3, %for.body40 ] %mul = shl nsw i32 %pow.067, 1 %rem41 = srem i32 %mul, 1000000007 %mul.1 = shl nsw i32 %rem41, 1 %rem41.1 = srem i32 %mul.1, 1000000007 %mul.2 = shl nsw i32 %rem41.1, 1 %rem41.2 = srem i32 %mul.2, 1000000007 %mul.3 = shl nsw i32 %rem41.2, 1 %rem41.3 = srem i32 %mul.3, 1000000007 %niter.next.3 = add i32 %niter, 4 %niter.ncmp.3 = icmp eq i32 %niter.next.3, %unroll_iter br i1 %niter.ncmp.3, label %for.cond.cleanup39.loopexit.unr-lcssa, label %for.body40, !llvm.loop !14 if.end46: ; preds = %for.cond.cleanup39, %if.then33 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %ai) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4 attributes #0 = { nofree 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 = { 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 #3 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) 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 #4 = { nofree nounwind } attributes #5 = { nounwind } attributes #6 = { nounwind allocsize(0,1) } !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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !13} !13 = !{!"llvm.loop.unroll.disable"} !14 = distinct !{!14, !10}
#include <stdio.h> int main(void) { int n,d[10000],p[10000],i,j,sum,sumd,tmp1,tmp2; long long int m; for(;;){ scanf("%d %d", &n, &m); if(!(n|m)) break; for(i=0,sumd=0;i<n;i++){ scanf("%d %d", &d[i], &p[i]); sumd+=d[i]; } if(m>=sumd){ printf("0\n"); continue; } for(i=0;i<n-1;i++){ for(j=0;j<n-1;j++){ if(p[j]<p[j+1]){ tmp1=p[j]; p[j]=p[j+1]; p[j+1]=tmp1; tmp2=d[j]; d[j]=d[j+1]; d[j+1]=tmp2; } } } for(i=0;i<n;i++){ if(m>=d[i]){ m-=d[i]; d[i]=0; } else if(m<d[i]){ d[i]-=m; m=0; } if(!m) break; } for(i=0,sum=0;i<n;i++){ if(p[i]) sum+=d[i]*p[i]; } printf("%d\n", sum); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184598/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184598/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 @str = private unnamed_addr constant [2 x i8] c"0\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %d = alloca [10000 x i32], align 16 %p = alloca [10000 x i32], align 16 %m = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %d) #4 call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %p) #4 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %m) #4 %call165 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m) %0 = load i32, ptr %n, align 4, !tbaa !5 %conv166 = sext i32 %0 to i64 %1 = load i64, ptr %m, align 8, !tbaa !9 %or167 = or i64 %1, %conv166 %tobool.not168 = icmp eq i64 %or167, 0 br i1 %tobool.not168, label %for.end111, label %for.cond1.preheader for.cond1.preheader: ; preds = %entry, %for.cond.backedge %2 = phi i64 [ %21, %for.cond.backedge ], [ %1, %entry ] %3 = phi i32 [ %20, %for.cond.backedge ], [ %0, %entry ] %cmp149 = icmp sgt i32 %3, 0 br i1 %cmp149, label %for.body, label %for.end for.body: ; preds = %for.cond1.preheader, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond1.preheader ] %sumd.0150 = phi i32 [ %add, %for.body ], [ 0, %for.cond1.preheader ] %arrayidx = getelementptr inbounds [10000 x i32], ptr %d, i64 0, i64 %indvars.iv %arrayidx4 = getelementptr inbounds [10000 x i32], ptr %p, i64 0, i64 %indvars.iv %call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx4) %4 = load i32, ptr %arrayidx, align 4, !tbaa !5 %add = add nsw i32 %4, %sumd.0150 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %5 = load i32, ptr %n, align 4, !tbaa !5 %6 = sext i32 %5 to i64 %cmp = icmp slt i64 %indvars.iv.next, %6 br i1 %cmp, label %for.body, label %for.end.loopexit, !llvm.loop !11 for.end.loopexit: ; preds = %for.body %.pre = load i64, ptr %m, align 8, !tbaa !9 br label %for.end for.end: ; preds = %for.end.loopexit, %for.cond1.preheader %m.promoted = phi i64 [ %2, %for.cond1.preheader ], [ %.pre, %for.end.loopexit ] %sumd.0.lcssa = phi i32 [ 0, %for.cond1.preheader ], [ %add, %for.end.loopexit ] %.lcssa = phi i32 [ %3, %for.cond1.preheader ], [ %5, %for.end.loopexit ] %conv8 = sext i32 %sumd.0.lcssa to i64 %cmp9.not = icmp slt i64 %m.promoted, %conv8 br i1 %cmp9.not, label %for.cond14.preheader, label %if.then11 for.cond14.preheader: ; preds = %for.end %sub = add i32 %.lcssa, -1 %cmp15155 = icmp sgt i32 %.lcssa, 1 br i1 %cmp15155, label %for.cond18.preheader.us.preheader, label %for.cond58.preheader for.cond18.preheader.us.preheader: ; preds = %for.cond14.preheader %wide.trip.count = zext i32 %sub to i64 %xtraiter = and i64 %wide.trip.count, 1 %7 = icmp eq i32 %sub, 1 %unroll_iter = and i64 %wide.trip.count, 4294967294 %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br label %for.cond18.preheader.us for.cond18.preheader.us: ; preds = %for.cond18.preheader.us.preheader, %for.cond18.for.inc55_crit_edge.us %i.1156.us = phi i32 [ %inc56.us, %for.cond18.for.inc55_crit_edge.us ], [ 0, %for.cond18.preheader.us.preheader ] %.pre187 = load i32, ptr %p, align 16, !tbaa !5 br i1 %7, label %for.cond18.for.inc55_crit_edge.us.unr-lcssa, label %for.body22.us for.body22.us: ; preds = %for.cond18.preheader.us, %for.inc52.us.1 %8 = phi i32 [ %16, %for.inc52.us.1 ], [ %.pre187, %for.cond18.preheader.us ] %indvars.iv175 = phi i64 [ %indvars.iv.next176.1, %for.inc52.us.1 ], [ 0, %for.cond18.preheader.us ] %niter = phi i64 [ %niter.next.1, %for.inc52.us.1 ], [ 0, %for.cond18.preheader.us ] %indvars.iv.next176 = or i64 %indvars.iv175, 1 %arrayidx27.us = getelementptr inbounds [10000 x i32], ptr %p, i64 0, i64 %indvars.iv.next176 %9 = load i32, ptr %arrayidx27.us, align 4, !tbaa !5 %cmp28.us = icmp slt i32 %8, %9 br i1 %cmp28.us, label %if.then30.us, label %for.inc52.us if.then30.us: ; preds = %for.body22.us %arrayidx24.us = getelementptr inbounds [10000 x i32], ptr %p, i64 0, i64 %indvars.iv175 store i32 %9, ptr %arrayidx24.us, align 8, !tbaa !5 store i32 %8, ptr %arrayidx27.us, align 4, !tbaa !5 %arrayidx42.us = getelementptr inbounds [10000 x i32], ptr %d, i64 0, i64 %indvars.iv175 %10 = load <2 x i32>, ptr %arrayidx42.us, align 8, !tbaa !5 %11 = shufflevector <2 x i32> %10, <2 x i32> poison, <2 x i32> <i32 1, i32 0> store <2 x i32> %11, ptr %arrayidx42.us, align 8, !tbaa !5 br label %for.inc52.us for.inc52.us: ; preds = %if.then30.us, %for.body22.us %12 = phi i32 [ %8, %if.then30.us ], [ %9, %for.body22.us ] %indvars.iv.next176.1 = add nuw nsw i64 %indvars.iv175, 2 %arrayidx27.us.1 = getelementptr inbounds [10000 x i32], ptr %p, i64 0, i64 %indvars.iv.next176.1 %13 = load i32, ptr %arrayidx27.us.1, align 8, !tbaa !5 %cmp28.us.1 = icmp slt i32 %12, %13 br i1 %cmp28.us.1, label %if.then30.us.1, label %for.inc52.us.1 if.then30.us.1: ; preds = %for.inc52.us %arrayidx24.us.1 = getelementptr inbounds [10000 x i32], ptr %p, i64 0, i64 %indvars.iv.next176 store i32 %13, ptr %arrayidx24.us.1, align 4, !tbaa !5 store i32 %12, ptr %arrayidx27.us.1, align 8, !tbaa !5 %arrayidx42.us.1 = getelementptr inbounds [10000 x i32], ptr %d, i64 0, i64 %indvars.iv.next176 %14 = load <2 x i32>, ptr %arrayidx42.us.1, align 4, !tbaa !5 %15 = shufflevector <2 x i32> %14, <2 x i32> poison, <2 x i32> <i32 1, i32 0> store <2 x i32> %15, ptr %arrayidx42.us.1, align 4, !tbaa !5 br label %for.inc52.us.1 for.inc52.us.1: ; preds = %if.then30.us.1, %for.inc52.us %16 = phi i32 [ %12, %if.then30.us.1 ], [ %13, %for.inc52.us ] %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %for.cond18.for.inc55_crit_edge.us.unr-lcssa, label %for.body22.us, !llvm.loop !13 for.cond18.for.inc55_crit_edge.us.unr-lcssa: ; preds = %for.inc52.us.1, %for.cond18.preheader.us %.unr = phi i32 [ %.pre187, %for.cond18.preheader.us ], [ %16, %for.inc52.us.1 ] %indvars.iv175.unr = phi i64 [ 0, %for.cond18.preheader.us ], [ %indvars.iv.next176.1, %for.inc52.us.1 ] br i1 %lcmp.mod.not, label %for.cond18.for.inc55_crit_edge.us, label %for.body22.us.epil for.body22.us.epil: ; preds = %for.cond18.for.inc55_crit_edge.us.unr-lcssa %indvars.iv.next176.epil = add nuw nsw i64 %indvars.iv175.unr, 1 %arrayidx27.us.epil = getelementptr inbounds [10000 x i32], ptr %p, i64 0, i64 %indvars.iv.next176.epil %17 = load i32, ptr %arrayidx27.us.epil, align 4, !tbaa !5 %cmp28.us.epil = icmp slt i32 %.unr, %17 br i1 %cmp28.us.epil, label %if.then30.us.epil, label %for.cond18.for.inc55_crit_edge.us if.then30.us.epil: ; preds = %for.body22.us.epil %arrayidx24.us.epil = getelementptr inbounds [10000 x i32], ptr %p, i64 0, i64 %indvars.iv175.unr store i32 %17, ptr %arrayidx24.us.epil, align 4, !tbaa !5 store i32 %.unr, ptr %arrayidx27.us.epil, align 4, !tbaa !5 %arrayidx42.us.epil = getelementptr inbounds [10000 x i32], ptr %d, i64 0, i64 %indvars.iv175.unr %18 = load <2 x i32>, ptr %arrayidx42.us.epil, align 4, !tbaa !5 %19 = shufflevector <2 x i32> %18, <2 x i32> poison, <2 x i32> <i32 1, i32 0> store <2 x i32> %19, ptr %arrayidx42.us.epil, align 4, !tbaa !5 br label %for.cond18.for.inc55_crit_edge.us for.cond18.for.inc55_crit_edge.us: ; preds = %for.body22.us.epil, %if.then30.us.epil, %for.cond18.for.inc55_crit_edge.us.unr-lcssa %inc56.us = add nuw nsw i32 %i.1156.us, 1 %exitcond178.not = icmp eq i32 %inc56.us, %sub br i1 %exitcond178.not, label %for.cond58.preheader, label %for.cond18.preheader.us, !llvm.loop !14 if.then11: ; preds = %for.end %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) br label %for.cond.backedge for.cond.backedge: ; preds = %if.then11, %for.end109 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m) %20 = load i32, ptr %n, align 4, !tbaa !5 %conv = sext i32 %20 to i64 %21 = load i64, ptr %m, align 8, !tbaa !9 %or = or i64 %21, %conv %tobool.not = icmp eq i64 %or, 0 br i1 %tobool.not, label %for.end111, label %for.cond1.preheader for.cond58.preheader: ; preds = %for.cond18.for.inc55_crit_edge.us, %for.cond14.preheader %cmp59158 = icmp sgt i32 %.lcssa, 0 br i1 %cmp59158, label %for.body61.preheader, label %for.end109 for.body61.preheader: ; preds = %for.cond58.preheader %22 = zext i32 %.lcssa to i64 br label %for.body61 for.body61: ; preds = %for.body61.preheader, %if.end86 %indvars.iv179 = phi i64 [ 0, %for.body61.preheader ], [ %indvars.iv.next180, %if.end86 ] %sub71157159 = phi i64 [ %m.promoted, %for.body61.preheader ], [ %sub71, %if.end86 ] %arrayidx63 = getelementptr inbounds [10000 x i32], ptr %d, i64 0, i64 %indvars.iv179 %23 = load i32, ptr %arrayidx63, align 4, !tbaa !5 %conv64 = sext i32 %23 to i64 %cmp65.not = icmp slt i64 %sub71157159, %conv64 br i1 %cmp65.not, label %if.end86.thread, label %if.end86 if.end86.thread: ; preds = %for.body61 %24 = trunc i64 %sub71157159 to i32 %conv84 = sub i32 %23, %24 store i32 %conv84, ptr %arrayidx63, align 4, !tbaa !5 store i64 0, ptr %m, align 8, !tbaa !9 br label %for.end92 if.end86: ; preds = %for.body61 %sub71 = sub nsw i64 %sub71157159, %conv64 store i64 %sub71, ptr %m, align 8, !tbaa !9 store i32 0, ptr %arrayidx63, align 4, !tbaa !5 %tobool87.not = icmp ne i64 %sub71157159, %conv64 %indvars.iv.next180 = add nuw nsw i64 %indvars.iv179, 1 %cmp59 = icmp ult i64 %indvars.iv.next180, %22 %or.cond = select i1 %tobool87.not, i1 %cmp59, i1 false br i1 %or.cond, label %for.body61, label %for.end92, !llvm.loop !15 for.end92: ; preds = %if.end86, %if.end86.thread br i1 %cmp59158, label %for.body96.preheader, label %for.end109 for.body96.preheader: ; preds = %for.end92 %xtraiter203 = and i64 %22, 1 %25 = icmp eq i32 %.lcssa, 1 br i1 %25, label %for.end109.loopexit.unr-lcssa, label %for.body96.preheader.new for.body96.preheader.new: ; preds = %for.body96.preheader %unroll_iter206 = and i64 %22, 4294967294 br label %for.body96 for.body96: ; preds = %for.inc107.1, %for.body96.preheader.new %indvars.iv182 = phi i64 [ 0, %for.body96.preheader.new ], [ %indvars.iv.next183.1, %for.inc107.1 ] %sum.0162 = phi i32 [ 0, %for.body96.preheader.new ], [ %sum.1.1, %for.inc107.1 ] %niter207 = phi i64 [ 0, %for.body96.preheader.new ], [ %niter207.next.1, %for.inc107.1 ] %arrayidx98 = getelementptr inbounds [10000 x i32], ptr %p, i64 0, i64 %indvars.iv182 %26 = load i32, ptr %arrayidx98, align 8, !tbaa !5 %tobool99.not = icmp eq i32 %26, 0 br i1 %tobool99.not, label %for.inc107, label %if.then100 if.then100: ; preds = %for.body96 %arrayidx102 = getelementptr inbounds [10000 x i32], ptr %d, i64 0, i64 %indvars.iv182 %27 = load i32, ptr %arrayidx102, align 8, !tbaa !5 %mul = mul nsw i32 %27, %26 %add105 = add nsw i32 %mul, %sum.0162 br label %for.inc107 for.inc107: ; preds = %for.body96, %if.then100 %sum.1 = phi i32 [ %add105, %if.then100 ], [ %sum.0162, %for.body96 ] %indvars.iv.next183 = or i64 %indvars.iv182, 1 %arrayidx98.1 = getelementptr inbounds [10000 x i32], ptr %p, i64 0, i64 %indvars.iv.next183 %28 = load i32, ptr %arrayidx98.1, align 4, !tbaa !5 %tobool99.not.1 = icmp eq i32 %28, 0 br i1 %tobool99.not.1, label %for.inc107.1, label %if.then100.1 if.then100.1: ; preds = %for.inc107 %arrayidx102.1 = getelementptr inbounds [10000 x i32], ptr %d, i64 0, i64 %indvars.iv.next183 %29 = load i32, ptr %arrayidx102.1, align 4, !tbaa !5 %mul.1 = mul nsw i32 %29, %28 %add105.1 = add nsw i32 %mul.1, %sum.1 br label %for.inc107.1 for.inc107.1: ; preds = %if.then100.1, %for.inc107 %sum.1.1 = phi i32 [ %add105.1, %if.then100.1 ], [ %sum.1, %for.inc107 ] %indvars.iv.next183.1 = add nuw nsw i64 %indvars.iv182, 2 %niter207.next.1 = add i64 %niter207, 2 %niter207.ncmp.1 = icmp eq i64 %niter207.next.1, %unroll_iter206 br i1 %niter207.ncmp.1, label %for.end109.loopexit.unr-lcssa, label %for.body96, !llvm.loop !16 for.end109.loopexit.unr-lcssa: ; preds = %for.inc107.1, %for.body96.preheader %sum.1.lcssa.ph = phi i32 [ undef, %for.body96.preheader ], [ %sum.1.1, %for.inc107.1 ] %indvars.iv182.unr = phi i64 [ 0, %for.body96.preheader ], [ %indvars.iv.next183.1, %for.inc107.1 ] %sum.0162.unr = phi i32 [ 0, %for.body96.preheader ], [ %sum.1.1, %for.inc107.1 ] %lcmp.mod204.not = icmp eq i64 %xtraiter203, 0 br i1 %lcmp.mod204.not, label %for.end109, label %for.body96.epil for.body96.epil: ; preds = %for.end109.loopexit.unr-lcssa %arrayidx98.epil = getelementptr inbounds [10000 x i32], ptr %p, i64 0, i64 %indvars.iv182.unr %30 = load i32, ptr %arrayidx98.epil, align 4, !tbaa !5 %tobool99.not.epil = icmp eq i32 %30, 0 br i1 %tobool99.not.epil, label %for.end109, label %if.then100.epil if.then100.epil: ; preds = %for.body96.epil %arrayidx102.epil = getelementptr inbounds [10000 x i32], ptr %d, i64 0, i64 %indvars.iv182.unr %31 = load i32, ptr %arrayidx102.epil, align 4, !tbaa !5 %mul.epil = mul nsw i32 %31, %30 %add105.epil = add nsw i32 %mul.epil, %sum.0162.unr br label %for.end109 for.end109: ; preds = %for.end109.loopexit.unr-lcssa, %if.then100.epil, %for.body96.epil, %for.cond58.preheader, %for.end92 %sum.0.lcssa = phi i32 [ 0, %for.end92 ], [ 0, %for.cond58.preheader ], [ %sum.1.lcssa.ph, %for.end109.loopexit.unr-lcssa ], [ %add105.epil, %if.then100.epil ], [ %sum.0162.unr, %for.body96.epil ] %call110 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sum.0.lcssa) br label %for.cond.backedge for.end111: ; preds = %for.cond.backedge, %entry call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %m) #4 call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %p) #4 call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %d) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3 attributes #0 = { nofree 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 = { 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 #3 = { nofree nounwind } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !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 long", !7, i64 0} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.mustprogress"} !13 = distinct !{!13, !12} !14 = distinct !{!14, !12} !15 = distinct !{!15, !12} !16 = distinct !{!16, !12}
#include <stdio.h> #include <stdlib.h> int binarySearch(int *,int *, int, int); int main() { int i, n, q, *S, *T; scanf( "%d" , &n ); S = (int *)malloc((n+1) * sizeof(int)); for( i=0; i<n; i++ ) scanf( "%d" , &S[i] ); scanf( "%d" , &q ); T = (int *)malloc(q * sizeof(int)); for( i=0; i<q; i++ ) scanf( "%d" , &T[i] ); printf( "%d\n" , binarySearch(S, T, n, q) ); return 0; } int binarySearch(int *S, int *T, int n, int q) { int j, left, right, mid, count=0; for ( j=0; j<q; j++ ) { left = 0; right = n; while ( left < right ) { mid = (left + right) / 2; if ( S[mid] == T[j] ) { count++; break; } else if ( T[j] < S[mid] ) right = mid; else left = mid + 1; } } return count; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184640/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184640/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %q = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %add = add nsw i32 %0, 1 %conv = sext i32 %add to i64 %mul = shl nsw i64 %conv, 2 %call1 = call noalias ptr @malloc(i64 noundef %mul) #6 %cmp27 = icmp sgt i32 %0, 0 br i1 %cmp27, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %entry %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %3 = load i32, ptr %q, align 4, !tbaa !5 %conv5 = sext i32 %3 to i64 %mul6 = shl nsw i64 %conv5, 2 %call7 = call noalias ptr @malloc(i64 noundef %mul6) #6 %cmp929 = icmp sgt i32 %3, 0 br i1 %cmp929, label %for.body11, label %binarySearch.exit for.body11: ; preds = %for.end, %for.body11 %indvars.iv33 = phi i64 [ %indvars.iv.next34, %for.body11 ], [ 0, %for.end ] %arrayidx13 = getelementptr inbounds i32, ptr %call7, i64 %indvars.iv33 %call14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx13) %indvars.iv.next34 = add nuw nsw i64 %indvars.iv33, 1 %4 = load i32, ptr %q, align 4, !tbaa !5 %5 = sext i32 %4 to i64 %cmp9 = icmp slt i64 %indvars.iv.next34, %5 br i1 %cmp9, label %for.body11, label %for.end17, !llvm.loop !11 for.end17: ; preds = %for.body11 %6 = load i32, ptr %n, align 4, !tbaa !5 %cmp30.i = icmp sgt i32 %4, 0 %cmp127.i = icmp sgt i32 %6, 0 %or.cond.i = and i1 %cmp30.i, %cmp127.i br i1 %or.cond.i, label %while.cond.preheader.us.preheader.i, label %binarySearch.exit while.cond.preheader.us.preheader.i: ; preds = %for.end17 %wide.trip.count.i = zext i32 %4 to i64 br label %while.cond.preheader.us.i while.cond.preheader.us.i: ; preds = %for.inc.us.i, %while.cond.preheader.us.preheader.i %indvars.iv.i = phi i64 [ 0, %while.cond.preheader.us.preheader.i ], [ %indvars.iv.next.i, %for.inc.us.i ] %count.033.us.i = phi i32 [ 0, %while.cond.preheader.us.preheader.i ], [ %count.1.us.i, %for.inc.us.i ] %arrayidx3.us.i = getelementptr inbounds i32, ptr %call7, i64 %indvars.iv.i %7 = load i32, ptr %arrayidx3.us.i, align 4, !tbaa !5 br label %while.body.us.i while.body.us.i: ; preds = %if.else.us.i, %while.cond.preheader.us.i %right.029.us.i = phi i32 [ %6, %while.cond.preheader.us.i ], [ %right.1.us.i, %if.else.us.i ] %left.028.us.i = phi i32 [ 0, %while.cond.preheader.us.i ], [ %left.1.us.i, %if.else.us.i ] %add.us.i = add nsw i32 %left.028.us.i, %right.029.us.i %div.us.i = sdiv i32 %add.us.i, 2 %idxprom.us.i = sext i32 %div.us.i to i64 %arrayidx.us.i = getelementptr inbounds i32, ptr %call1, i64 %idxprom.us.i %8 = load i32, ptr %arrayidx.us.i, align 4, !tbaa !5 %cmp4.us.i = icmp eq i32 %8, %7 br i1 %cmp4.us.i, label %if.then.us.i, label %if.else.us.i if.else.us.i: ; preds = %while.body.us.i %cmp9.us.i = icmp slt i32 %7, %8 %add12.us.i = add nsw i32 %div.us.i, 1 %left.1.us.i = select i1 %cmp9.us.i, i32 %left.028.us.i, i32 %add12.us.i %right.1.us.i = select i1 %cmp9.us.i, i32 %div.us.i, i32 %right.029.us.i %cmp1.us.i = icmp slt i32 %left.1.us.i, %right.1.us.i br i1 %cmp1.us.i, label %while.body.us.i, label %for.inc.us.i, !llvm.loop !12 if.then.us.i: ; preds = %while.body.us.i %inc.us.i = add nsw i32 %count.033.us.i, 1 br label %for.inc.us.i for.inc.us.i: ; preds = %if.else.us.i, %if.then.us.i %count.1.us.i = phi i32 [ %inc.us.i, %if.then.us.i ], [ %count.033.us.i, %if.else.us.i ] %indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1 %exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i br i1 %exitcond.not.i, label %binarySearch.exit, label %while.cond.preheader.us.i, !llvm.loop !13 binarySearch.exit: ; preds = %for.inc.us.i, %for.end, %for.end17 %count.0.lcssa.i = phi i32 [ 0, %for.end17 ], [ 0, %for.end ], [ %count.1.us.i, %for.inc.us.i ] %call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa.i) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable define dso_local i32 @binarySearch(ptr nocapture noundef readonly %S, ptr nocapture noundef readonly %T, i32 noundef %n, i32 noundef %q) local_unnamed_addr #4 { entry: %cmp30 = icmp sgt i32 %q, 0 %cmp127 = icmp sgt i32 %n, 0 %or.cond = and i1 %cmp30, %cmp127 br i1 %or.cond, label %while.cond.preheader.us.preheader, label %for.end while.cond.preheader.us.preheader: ; preds = %entry %wide.trip.count = zext i32 %q to i64 br label %while.cond.preheader.us while.cond.preheader.us: ; preds = %while.cond.preheader.us.preheader, %for.inc.us %indvars.iv = phi i64 [ 0, %while.cond.preheader.us.preheader ], [ %indvars.iv.next, %for.inc.us ] %count.033.us = phi i32 [ 0, %while.cond.preheader.us.preheader ], [ %count.1.us, %for.inc.us ] %arrayidx3.us = getelementptr inbounds i32, ptr %T, i64 %indvars.iv %0 = load i32, ptr %arrayidx3.us, align 4, !tbaa !5 br label %while.body.us while.body.us: ; preds = %while.cond.preheader.us, %if.else.us %right.029.us = phi i32 [ %n, %while.cond.preheader.us ], [ %right.1.us, %if.else.us ] %left.028.us = phi i32 [ 0, %while.cond.preheader.us ], [ %left.1.us, %if.else.us ] %add.us = add nsw i32 %right.029.us, %left.028.us %div.us = sdiv i32 %add.us, 2 %idxprom.us = sext i32 %div.us to i64 %arrayidx.us = getelementptr inbounds i32, ptr %S, i64 %idxprom.us %1 = load i32, ptr %arrayidx.us, align 4, !tbaa !5 %cmp4.us = icmp eq i32 %1, %0 br i1 %cmp4.us, label %if.then.us, label %if.else.us if.else.us: ; preds = %while.body.us %cmp9.us = icmp slt i32 %0, %1 %add12.us = add nsw i32 %div.us, 1 %left.1.us = select i1 %cmp9.us, i32 %left.028.us, i32 %add12.us %right.1.us = select i1 %cmp9.us, i32 %div.us, i32 %right.029.us %cmp1.us = icmp slt i32 %left.1.us, %right.1.us br i1 %cmp1.us, label %while.body.us, label %for.inc.us, !llvm.loop !12 if.then.us: ; preds = %while.body.us %inc.us = add nsw i32 %count.033.us, 1 br label %for.inc.us for.inc.us: ; preds = %if.else.us, %if.then.us %count.1.us = phi i32 [ %inc.us, %if.then.us ], [ %count.033.us, %if.else.us ] %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count br i1 %exitcond.not, label %for.end, label %while.cond.preheader.us, !llvm.loop !13 for.end: ; preds = %for.inc.us, %entry %count.0.lcssa = phi i32 [ 0, %entry ], [ %count.1.us, %for.inc.us ] ret i32 %count.0.lcssa } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree 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 = { 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 #3 = { 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 #4 = { nofree norecurse nosync nounwind memory(argmem: 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 = { nounwind } attributes #6 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10}
#include <stdio.h> #include <stdlib.h> int main(){ int n, q; int *S,*T; int i, m, r, l, c=0; /*scan S*/ scanf("%d", &n); S = (int *)malloc(sizeof(int) * n); for(i=0; i<n; i++) scanf("%d", &S[i]); /*scan T*/ scanf("%d", &q); T = (int *)malloc(sizeof(int) * q); for(i=0; i<q; i++) scanf("%d", &T[i]); /*calc the ans*/ for(i=0; i<q; i++){ l = 0; r = n; while(l < r){ m = (l + r) / 2; if(S[m] == T[i]) {c++; break;} else if(S[m] > T[i]) r = m; else l = m + 1; } } /*print the ans*/ printf("%d\n", c); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184684/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184684/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %q = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %conv = sext i32 %0 to i64 %mul = shl nsw i64 %conv, 2 %call1 = call noalias ptr @malloc(i64 noundef %mul) #5 %cmp65 = icmp sgt i32 %0, 0 br i1 %cmp65, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %entry %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %3 = load i32, ptr %q, align 4, !tbaa !5 %conv5 = sext i32 %3 to i64 %mul6 = shl nsw i64 %conv5, 2 %call7 = call noalias ptr @malloc(i64 noundef %mul6) #5 %cmp967 = icmp sgt i32 %3, 0 br i1 %cmp967, label %for.body11, label %for.end43 for.cond18.preheader: ; preds = %for.body11 %cmp1972 = icmp sgt i32 %7, 0 br i1 %cmp1972, label %for.body21.lr.ph, label %for.end43 for.body21.lr.ph: ; preds = %for.cond18.preheader %4 = load i32, ptr %n, align 4, !tbaa !5 %cmp2269 = icmp sgt i32 %4, 0 br i1 %cmp2269, label %for.body21.us.preheader, label %for.end43 for.body21.us.preheader: ; preds = %for.body21.lr.ph %wide.trip.count = zext i32 %7 to i64 br label %for.body21.us for.body21.us: ; preds = %for.body21.us.preheader, %for.inc41.us %indvars.iv83 = phi i64 [ 0, %for.body21.us.preheader ], [ %indvars.iv.next84, %for.inc41.us ] %c.075.us = phi i32 [ 0, %for.body21.us.preheader ], [ %c.1.us, %for.inc41.us ] %arrayidx27.us = getelementptr inbounds i32, ptr %call7, i64 %indvars.iv83 %5 = load i32, ptr %arrayidx27.us, align 4, !tbaa !5 br label %while.body.us while.body.us: ; preds = %for.body21.us, %if.else.us %l.071.us = phi i32 [ 0, %for.body21.us ], [ %l.1.us, %if.else.us ] %r.070.us = phi i32 [ %4, %for.body21.us ], [ %r.1.us, %if.else.us ] %add.us = add nsw i32 %l.071.us, %r.070.us %div.us = sdiv i32 %add.us, 2 %idxprom24.us = sext i32 %div.us to i64 %arrayidx25.us = getelementptr inbounds i32, ptr %call1, i64 %idxprom24.us %6 = load i32, ptr %arrayidx25.us, align 4, !tbaa !5 %cmp28.us = icmp eq i32 %6, %5 br i1 %cmp28.us, label %if.then.us, label %if.else.us if.else.us: ; preds = %while.body.us %cmp35.us = icmp sgt i32 %6, %5 %add39.us = add nsw i32 %div.us, 1 %r.1.us = select i1 %cmp35.us, i32 %div.us, i32 %r.070.us %l.1.us = select i1 %cmp35.us, i32 %l.071.us, i32 %add39.us %cmp22.us = icmp slt i32 %l.1.us, %r.1.us br i1 %cmp22.us, label %while.body.us, label %for.inc41.us, !llvm.loop !11 if.then.us: ; preds = %while.body.us %inc30.us = add nsw i32 %c.075.us, 1 br label %for.inc41.us for.inc41.us: ; preds = %if.else.us, %if.then.us %c.1.us = phi i32 [ %inc30.us, %if.then.us ], [ %c.075.us, %if.else.us ] %indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1 %exitcond.not = icmp eq i64 %indvars.iv.next84, %wide.trip.count br i1 %exitcond.not, label %for.end43, label %for.body21.us, !llvm.loop !12 for.body11: ; preds = %for.end, %for.body11 %indvars.iv80 = phi i64 [ %indvars.iv.next81, %for.body11 ], [ 0, %for.end ] %arrayidx13 = getelementptr inbounds i32, ptr %call7, i64 %indvars.iv80 %call14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx13) %indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1 %7 = load i32, ptr %q, align 4, !tbaa !5 %8 = sext i32 %7 to i64 %cmp9 = icmp slt i64 %indvars.iv.next81, %8 br i1 %cmp9, label %for.body11, label %for.cond18.preheader, !llvm.loop !13 for.end43: ; preds = %for.inc41.us, %for.end, %for.body21.lr.ph, %for.cond18.preheader %c.0.lcssa = phi i32 [ 0, %for.cond18.preheader ], [ 0, %for.body21.lr.ph ], [ 0, %for.end ], [ %c.1.us, %for.inc41.us ] %call44 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %c.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 attributes #0 = { nofree 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 = { 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 #3 = { 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 #4 = { nounwind } attributes #5 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10}
#include <stdio.h> #define x 100000 int main(){ int n,q,S[x],T[x],left,right,mid; int i,j,c=0; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&S[i]); } scanf("%d",&q); for(i=0;i<q;i++){ scanf("%d",&T[i]); } for(i=0;i<q;i++){ left=0; right = n; while(left<right){ mid = (left + right)/2; if(S[mid]==T[i]){ c++; break; } else if(T[i]<S[mid]){ right = mid; } else if(T[i]>S[mid]) { left = mid + 1; } } } printf("%d\n",c); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184756/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184756/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %q = alloca i32, align 4 %S = alloca [100000 x i32], align 16 %T = alloca [100000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #3 call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %S) #3 call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %T) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp60 = icmp sgt i32 %0, 0 br i1 %cmp60, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100000 x i32], ptr %S, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %3 = load i32, ptr %q, align 4, !tbaa !5 %cmp462 = icmp sgt i32 %3, 0 br i1 %cmp462, label %for.body5, label %for.end40 for.cond12.preheader: ; preds = %for.body5 %cmp1367 = icmp sgt i32 %7, 0 br i1 %cmp1367, label %for.body14.lr.ph, label %for.end40 for.body14.lr.ph: ; preds = %for.cond12.preheader %4 = load i32, ptr %n, align 4, !tbaa !5 %cmp1564 = icmp sgt i32 %4, 0 br i1 %cmp1564, label %for.body14.us.preheader, label %for.end40 for.body14.us.preheader: ; preds = %for.body14.lr.ph %wide.trip.count = zext i32 %7 to i64 br label %for.body14.us for.body14.us: ; preds = %for.body14.us.preheader, %for.inc38.us %indvars.iv78 = phi i64 [ 0, %for.body14.us.preheader ], [ %indvars.iv.next79, %for.inc38.us ] %c.070.us = phi i32 [ 0, %for.body14.us.preheader ], [ %c.1.us, %for.inc38.us ] %arrayidx19.us = getelementptr inbounds [100000 x i32], ptr %T, i64 0, i64 %indvars.iv78 %5 = load i32, ptr %arrayidx19.us, align 4, !tbaa !5 br label %while.body.us while.body.us: ; preds = %for.body14.us, %if.else.us %left.066.us = phi i32 [ 0, %for.body14.us ], [ %left.1.us, %if.else.us ] %right.065.us = phi i32 [ %4, %for.body14.us ], [ %right.1.us, %if.else.us ] %add.us = add nsw i32 %left.066.us, %right.065.us %div.us = sdiv i32 %add.us, 2 %idxprom16.us = sext i32 %div.us to i64 %arrayidx17.us = getelementptr inbounds [100000 x i32], ptr %S, i64 0, i64 %idxprom16.us %6 = load i32, ptr %arrayidx17.us, align 4, !tbaa !5 %cmp20.us = icmp eq i32 %6, %5 br i1 %cmp20.us, label %if.then.us, label %if.else.us if.else.us: ; preds = %while.body.us %cmp26.us = icmp slt i32 %5, %6 %cmp33.us = icmp sgt i32 %5, %6 %add35.us = add nsw i32 %div.us, 1 %spec.select.us = select i1 %cmp33.us, i32 %add35.us, i32 %left.066.us %right.1.us = select i1 %cmp26.us, i32 %div.us, i32 %right.065.us %left.1.us = select i1 %cmp26.us, i32 %left.066.us, i32 %spec.select.us %cmp15.us = icmp slt i32 %left.1.us, %right.1.us br i1 %cmp15.us, label %while.body.us, label %for.inc38.us, !llvm.loop !11 if.then.us: ; preds = %while.body.us %inc21.us = add nsw i32 %c.070.us, 1 br label %for.inc38.us for.inc38.us: ; preds = %if.else.us, %if.then.us %c.1.us = phi i32 [ %inc21.us, %if.then.us ], [ %c.070.us, %if.else.us ] %indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1 %exitcond.not = icmp eq i64 %indvars.iv.next79, %wide.trip.count br i1 %exitcond.not, label %for.end40, label %for.body14.us, !llvm.loop !12 for.body5: ; preds = %for.end, %for.body5 %indvars.iv75 = phi i64 [ %indvars.iv.next76, %for.body5 ], [ 0, %for.end ] %arrayidx7 = getelementptr inbounds [100000 x i32], ptr %T, i64 0, i64 %indvars.iv75 %call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7) %indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1 %7 = load i32, ptr %q, align 4, !tbaa !5 %8 = sext i32 %7 to i64 %cmp4 = icmp slt i64 %indvars.iv.next76, %8 br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !13 for.end40: ; preds = %for.inc38.us, %for.end, %for.body14.lr.ph, %for.cond12.preheader %c.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.body14.lr.ph ], [ 0, %for.end ], [ %c.1.us, %for.inc38.us ] %call41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %c.0.lcssa) call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %T) #3 call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %S) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 attributes #0 = { nofree 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 = { 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 #3 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10}
#include<stdio.h> #include<stdlib.h> int binarySearch(int); int n,*S; int main() { int q,i,x,c = 0; int *T; scanf("%d",&n); S = (int *)malloc(sizeof(int) * n); if(S == NULL) exit(1); for(i = 0;i < n;i++){ scanf("%d",&S[i]); } scanf("%d",&q); T = (int *)malloc(sizeof(int) * q); if(T == NULL) exit(1); for(i = 0;i < q;i++){ scanf("%d",&T[i]); } for(i = 0;i < q;i++){ x = binarySearch(T[i]); if(x != -1) c ++; } printf("%d\n",c); return 0; } int binarySearch(int key) { int left = 0; int right = n; int mid; while(left < right){ mid = (left + right)/2; if(S[mid] == key) return mid; else if(key < S[mid]) right = mid; else left = mid + 1; } return -1; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184806/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184806/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @n = dso_local global i32 0, align 4 @S = dso_local local_unnamed_addr global ptr null, align 8 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %q = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #6 %call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n) %0 = load i32, ptr @n, align 4, !tbaa !5 %conv = sext i32 %0 to i64 %mul = shl nsw i64 %conv, 2 %call1 = tail call noalias ptr @malloc(i64 noundef %mul) #7 store ptr %call1, ptr @S, align 8, !tbaa !9 %cmp = icmp eq ptr %call1, null br i1 %cmp, label %if.then, label %for.cond.preheader for.cond.preheader: ; preds = %entry %cmp356 = icmp sgt i32 %0, 0 br i1 %cmp356, label %for.body, label %for.end if.then: ; preds = %entry tail call void @exit(i32 noundef 1) #8 unreachable for.body: ; preds = %for.cond.preheader, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ] %1 = load ptr, ptr @S, align 8, !tbaa !9 %arrayidx = getelementptr inbounds i32, ptr %1, i64 %indvars.iv %call5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %2 = load i32, ptr @n, align 4, !tbaa !5 %3 = sext i32 %2 to i64 %cmp3 = icmp slt i64 %indvars.iv.next, %3 br i1 %cmp3, label %for.body, label %for.end, !llvm.loop !11 for.end: ; preds = %for.body, %for.cond.preheader %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %4 = load i32, ptr %q, align 4, !tbaa !5 %conv7 = sext i32 %4 to i64 %mul8 = shl nsw i64 %conv7, 2 %call9 = call noalias ptr @malloc(i64 noundef %mul8) #7 %cmp10 = icmp eq ptr %call9, null br i1 %cmp10, label %if.then12, label %for.cond14.preheader for.cond14.preheader: ; preds = %for.end %cmp1558 = icmp sgt i32 %4, 0 br i1 %cmp1558, label %for.body17, label %for.end38 if.then12: ; preds = %for.end call void @exit(i32 noundef 1) #8 unreachable for.cond24.preheader: ; preds = %for.body17 %cmp2560 = icmp sgt i32 %10, 0 br i1 %cmp2560, label %for.body27.lr.ph, label %for.end38 for.body27.lr.ph: ; preds = %for.cond24.preheader %5 = load i32, ptr @n, align 4, !tbaa !5 %cmp18.i = icmp sgt i32 %5, 0 %6 = load ptr, ptr @S, align 8 br i1 %cmp18.i, label %for.body27.us.preheader, label %for.end38 for.body27.us.preheader: ; preds = %for.body27.lr.ph %wide.trip.count = zext i32 %10 to i64 br label %for.body27.us for.body27.us: ; preds = %for.body27.us.preheader, %for.cond24.us %indvars.iv72 = phi i64 [ 0, %for.body27.us.preheader ], [ %indvars.iv.next73, %for.cond24.us ] %c.061.us = phi i32 [ 0, %for.body27.us.preheader ], [ %9, %for.cond24.us ] %arrayidx29.us = getelementptr inbounds i32, ptr %call9, i64 %indvars.iv72 %7 = load i32, ptr %arrayidx29.us, align 4, !tbaa !5 br label %while.body.i.us while.body.i.us: ; preds = %if.else.i.us, %for.body27.us %right.020.i.us = phi i32 [ %5, %for.body27.us ], [ %right.1.i.us, %if.else.i.us ] %left.019.i.us = phi i32 [ 0, %for.body27.us ], [ %left.1.i.us, %if.else.i.us ] %add.i.us = add nsw i32 %left.019.i.us, %right.020.i.us %add.i.fr.us = freeze i32 %add.i.us %div.i.us = sdiv i32 %add.i.fr.us, 2 %idxprom.i.us = sext i32 %div.i.us to i64 %arrayidx.i.us = getelementptr inbounds i32, ptr %6, i64 %idxprom.i.us %8 = load i32, ptr %arrayidx.i.us, align 4, !tbaa !5 %cmp1.i.us = icmp eq i32 %8, %7 br i1 %cmp1.i.us, label %binarySearch.exit.us, label %if.else.i.us if.else.i.us: ; preds = %while.body.i.us %cmp4.i.us = icmp sgt i32 %8, %7 %add7.i.us = add nsw i32 %div.i.us, 1 %left.1.i.us = select i1 %cmp4.i.us, i32 %left.019.i.us, i32 %add7.i.us %right.1.i.us = select i1 %cmp4.i.us, i32 %div.i.us, i32 %right.020.i.us %cmp.i.us = icmp slt i32 %left.1.i.us, %right.1.i.us br i1 %cmp.i.us, label %while.body.i.us, label %binarySearch.exit.thread.us, !llvm.loop !13 binarySearch.exit.us: ; preds = %while.body.i.us %add.i.off.us = add i32 %add.i.fr.us, 3 %cmp31.not.us = icmp ult i32 %add.i.off.us, 2 %inc34.us = add nsw i32 %c.061.us, 1 br i1 %cmp31.not.us, label %binarySearch.exit.thread.us, label %for.cond24.us binarySearch.exit.thread.us: ; preds = %if.else.i.us, %binarySearch.exit.us br label %for.cond24.us for.cond24.us: ; preds = %binarySearch.exit.thread.us, %binarySearch.exit.us %9 = phi i32 [ %c.061.us, %binarySearch.exit.thread.us ], [ %inc34.us, %binarySearch.exit.us ] %indvars.iv.next73 = add nuw nsw i64 %indvars.iv72, 1 %exitcond.not = icmp eq i64 %indvars.iv.next73, %wide.trip.count br i1 %exitcond.not, label %for.end38, label %for.body27.us, !llvm.loop !14 for.body17: ; preds = %for.cond14.preheader, %for.body17 %indvars.iv69 = phi i64 [ %indvars.iv.next70, %for.body17 ], [ 0, %for.cond14.preheader ] %arrayidx19 = getelementptr inbounds i32, ptr %call9, i64 %indvars.iv69 %call20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx19) %indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1 %10 = load i32, ptr %q, align 4, !tbaa !5 %11 = sext i32 %10 to i64 %cmp15 = icmp slt i64 %indvars.iv.next70, %11 br i1 %cmp15, label %for.body17, label %for.cond24.preheader, !llvm.loop !15 for.end38: ; preds = %for.cond24.us, %for.cond14.preheader, %for.body27.lr.ph, %for.cond24.preheader %c.0.lcssa = phi i32 [ 0, %for.cond24.preheader ], [ 0, %for.body27.lr.ph ], [ 0, %for.cond14.preheader ], [ %9, %for.cond24.us ] %call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %c.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3 ; Function Attrs: noreturn nounwind declare void @exit(i32 noundef) local_unnamed_addr #4 ; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable define dso_local i32 @binarySearch(i32 noundef %key) local_unnamed_addr #5 { entry: %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp18 = icmp sgt i32 %0, 0 br i1 %cmp18, label %while.body.lr.ph, label %cleanup while.body.lr.ph: ; preds = %entry %1 = load ptr, ptr @S, align 8, !tbaa !9 br label %while.body while.body: ; preds = %while.body.lr.ph, %if.else %right.020 = phi i32 [ %0, %while.body.lr.ph ], [ %right.1, %if.else ] %left.019 = phi i32 [ 0, %while.body.lr.ph ], [ %left.1, %if.else ] %add = add nsw i32 %right.020, %left.019 %div = sdiv i32 %add, 2 %idxprom = sext i32 %div to i64 %arrayidx = getelementptr inbounds i32, ptr %1, i64 %idxprom %2 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp1 = icmp eq i32 %2, %key br i1 %cmp1, label %cleanup, label %if.else if.else: ; preds = %while.body %cmp4 = icmp sgt i32 %2, %key %add7 = add nsw i32 %div, 1 %left.1 = select i1 %cmp4, i32 %left.019, i32 %add7 %right.1 = select i1 %cmp4, i32 %div, i32 %right.020 %cmp = icmp slt i32 %left.1, %right.1 br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !13 cleanup: ; preds = %while.body, %if.else, %entry %retval.0 = phi i32 [ -1, %entry ], [ -1, %if.else ], [ %div, %while.body ] ret i32 %retval.0 } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 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 = { 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 #3 = { 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 #4 = { 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 #5 = { nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) 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 = { nounwind } attributes #7 = { nounwind allocsize(0) } attributes #8 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !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 = distinct !{!14, !12} !15 = distinct !{!15, !12}
#include<stdio.h> int main(){ int data[100000]; int search[50000]; int i,j,sumdata,sumsearch,left,right,mid,count; count = 0; left = 0; scanf("%d",&sumdata); right = sumdata; for(i = 0; i < sumdata; i++){ scanf("%d",&data[i]); } scanf("%d",&sumsearch); for(i = 0; i < sumsearch; i++){ scanf("%d",&search[i]); } for(i = 0; i < sumsearch; i++){ left = 0; right = sumdata; while(left < right){ mid = (left + right) / 2; if(data[mid] > search[i]){ right = mid; } else if(data[mid] < search[i]){ left = mid + 1; } else if(data[mid] == search[i]){ count = count + 1; left = 0; right = sumdata; break; } } } printf("%d\n",count); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184857/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184857/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %data = alloca [100000 x i32], align 16 %search = alloca [50000 x i32], align 16 %sumdata = alloca i32, align 4 %sumsearch = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %data) #3 call void @llvm.lifetime.start.p0(i64 200000, ptr nonnull %search) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %sumdata) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %sumsearch) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %sumdata) %0 = load i32, ptr %sumdata, align 4, !tbaa !5 %cmp60 = icmp sgt i32 %0, 0 br i1 %cmp60, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100000 x i32], ptr %data, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %sumdata, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %sumsearch) %3 = load i32, ptr %sumsearch, align 4, !tbaa !5 %cmp462 = icmp sgt i32 %3, 0 br i1 %cmp462, label %for.body5, label %for.end40 for.cond12.preheader: ; preds = %for.body5 %cmp1367 = icmp sgt i32 %7, 0 br i1 %cmp1367, label %for.body14.lr.ph, label %for.end40 for.body14.lr.ph: ; preds = %for.cond12.preheader %4 = load i32, ptr %sumdata, align 4, !tbaa !5 %cmp1564 = icmp sgt i32 %4, 0 br i1 %cmp1564, label %for.body14.us.preheader, label %for.end40 for.body14.us.preheader: ; preds = %for.body14.lr.ph %wide.trip.count = zext i32 %7 to i64 br label %for.body14.us for.body14.us: ; preds = %for.body14.us.preheader, %for.inc38.us %indvars.iv78 = phi i64 [ 0, %for.body14.us.preheader ], [ %indvars.iv.next79, %for.inc38.us ] %count.070.us = phi i32 [ 0, %for.body14.us.preheader ], [ %count.1.us, %for.inc38.us ] %arrayidx19.us = getelementptr inbounds [50000 x i32], ptr %search, i64 0, i64 %indvars.iv78 %5 = load i32, ptr %arrayidx19.us, align 4, !tbaa !5 br label %while.body.us while.body.us: ; preds = %for.body14.us, %if.end37.us %right.066.us = phi i32 [ %4, %for.body14.us ], [ %right.1.us, %if.end37.us ] %left.065.us = phi i32 [ 0, %for.body14.us ], [ %left.1.us, %if.end37.us ] %add.us = add nsw i32 %right.066.us, %left.065.us %div.us = sdiv i32 %add.us, 2 %idxprom16.us = sext i32 %div.us to i64 %arrayidx17.us = getelementptr inbounds [100000 x i32], ptr %data, i64 0, i64 %idxprom16.us %6 = load i32, ptr %arrayidx17.us, align 4, !tbaa !5 %cmp20.us = icmp sgt i32 %6, %5 br i1 %cmp20.us, label %if.end37.us, label %if.else.us if.else.us: ; preds = %while.body.us %cmp25.us = icmp slt i32 %6, %5 br i1 %cmp25.us, label %if.then26.us, label %if.else28.us if.else28.us: ; preds = %if.else.us %cmp33.us = icmp eq i32 %6, %5 br i1 %cmp33.us, label %if.then34.us, label %if.end37.us if.then34.us: ; preds = %if.else28.us %add35.us = add nsw i32 %count.070.us, 1 br label %for.inc38.us for.inc38.us: ; preds = %if.end37.us, %if.then34.us %count.1.us = phi i32 [ %add35.us, %if.then34.us ], [ %count.070.us, %if.end37.us ] %indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1 %exitcond.not = icmp eq i64 %indvars.iv.next79, %wide.trip.count br i1 %exitcond.not, label %for.end40, label %for.body14.us, !llvm.loop !11 if.then26.us: ; preds = %if.else.us %add27.us = add nsw i32 %div.us, 1 br label %if.end37.us if.end37.us: ; preds = %if.then26.us, %if.else28.us, %while.body.us %left.1.us = phi i32 [ %add27.us, %if.then26.us ], [ %left.065.us, %if.else28.us ], [ %left.065.us, %while.body.us ] %right.1.us = phi i32 [ %right.066.us, %if.then26.us ], [ %right.066.us, %if.else28.us ], [ %div.us, %while.body.us ] %cmp15.us = icmp slt i32 %left.1.us, %right.1.us br i1 %cmp15.us, label %while.body.us, label %for.inc38.us, !llvm.loop !12 for.body5: ; preds = %for.end, %for.body5 %indvars.iv75 = phi i64 [ %indvars.iv.next76, %for.body5 ], [ 0, %for.end ] %arrayidx7 = getelementptr inbounds [50000 x i32], ptr %search, i64 0, i64 %indvars.iv75 %call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7) %indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1 %7 = load i32, ptr %sumsearch, align 4, !tbaa !5 %8 = sext i32 %7 to i64 %cmp4 = icmp slt i64 %indvars.iv.next76, %8 br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !13 for.end40: ; preds = %for.inc38.us, %for.end, %for.body14.lr.ph, %for.cond12.preheader %count.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.body14.lr.ph ], [ 0, %for.end ], [ %count.1.us, %for.inc38.us ] %call41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %sumsearch) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %sumdata) #3 call void @llvm.lifetime.end.p0(i64 200000, ptr nonnull %search) #3 call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %data) #3 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 attributes #0 = { nofree 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 = { 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 #3 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10}
#include<stdio.h> int main(void){ int n,S[100000],q,T[50000],i,j,C=0,mid,left,right; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d", &S[i]); } scanf("%d",&q); for(j=0;j<q;j++){ scanf("%d",&T[j]); } for(j=0;j<q;j++){ left = 0; right = n; while(left<right){ mid = (left+right)/2; if(S[mid] == T[j]){C++;break;} else if(S[mid]>T[j])right = mid; else left = mid+1; } } printf("%d\n",C); return 0;}
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184907/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184907/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %S = alloca [100000 x i32], align 16 %q = alloca i32, align 4 %T = alloca [50000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3 call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %S) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #3 call void @llvm.lifetime.start.p0(i64 200000, ptr nonnull %T) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp50 = icmp sgt i32 %0, 0 br i1 %cmp50, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100000 x i32], ptr %S, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %3 = load i32, ptr %q, align 4, !tbaa !5 %cmp452 = icmp sgt i32 %3, 0 br i1 %cmp452, label %for.body5, label %for.end33 for.cond12.preheader: ; preds = %for.body5 %cmp1357 = icmp sgt i32 %7, 0 br i1 %cmp1357, label %for.body14.lr.ph, label %for.end33 for.body14.lr.ph: ; preds = %for.cond12.preheader %4 = load i32, ptr %n, align 4, !tbaa !5 %cmp1554 = icmp sgt i32 %4, 0 br i1 %cmp1554, label %for.body14.us.preheader, label %for.end33 for.body14.us.preheader: ; preds = %for.body14.lr.ph %wide.trip.count = zext i32 %7 to i64 br label %for.body14.us for.body14.us: ; preds = %for.body14.us.preheader, %for.inc31.us %indvars.iv68 = phi i64 [ 0, %for.body14.us.preheader ], [ %indvars.iv.next69, %for.inc31.us ] %C.060.us = phi i32 [ 0, %for.body14.us.preheader ], [ %C.1.us, %for.inc31.us ] %arrayidx19.us = getelementptr inbounds [50000 x i32], ptr %T, i64 0, i64 %indvars.iv68 %5 = load i32, ptr %arrayidx19.us, align 4, !tbaa !5 br label %while.body.us while.body.us: ; preds = %for.body14.us, %if.else.us %right.056.us = phi i32 [ %4, %for.body14.us ], [ %right.1.us, %if.else.us ] %left.055.us = phi i32 [ 0, %for.body14.us ], [ %left.1.us, %if.else.us ] %add.us = add nsw i32 %right.056.us, %left.055.us %div.us = sdiv i32 %add.us, 2 %idxprom16.us = sext i32 %div.us to i64 %arrayidx17.us = getelementptr inbounds [100000 x i32], ptr %S, i64 0, i64 %idxprom16.us %6 = load i32, ptr %arrayidx17.us, align 4, !tbaa !5 %cmp20.us = icmp eq i32 %6, %5 br i1 %cmp20.us, label %if.then.us, label %if.else.us if.else.us: ; preds = %while.body.us %cmp26.us = icmp sgt i32 %6, %5 %add29.us = add nsw i32 %div.us, 1 %left.1.us = select i1 %cmp26.us, i32 %left.055.us, i32 %add29.us %right.1.us = select i1 %cmp26.us, i32 %div.us, i32 %right.056.us %cmp15.us = icmp slt i32 %left.1.us, %right.1.us br i1 %cmp15.us, label %while.body.us, label %for.inc31.us, !llvm.loop !11 if.then.us: ; preds = %while.body.us %inc21.us = add nsw i32 %C.060.us, 1 br label %for.inc31.us for.inc31.us: ; preds = %if.else.us, %if.then.us %C.1.us = phi i32 [ %inc21.us, %if.then.us ], [ %C.060.us, %if.else.us ] %indvars.iv.next69 = add nuw nsw i64 %indvars.iv68, 1 %exitcond.not = icmp eq i64 %indvars.iv.next69, %wide.trip.count br i1 %exitcond.not, label %for.end33, label %for.body14.us, !llvm.loop !12 for.body5: ; preds = %for.end, %for.body5 %indvars.iv65 = phi i64 [ %indvars.iv.next66, %for.body5 ], [ 0, %for.end ] %arrayidx7 = getelementptr inbounds [50000 x i32], ptr %T, i64 0, i64 %indvars.iv65 %call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7) %indvars.iv.next66 = add nuw nsw i64 %indvars.iv65, 1 %7 = load i32, ptr %q, align 4, !tbaa !5 %8 = sext i32 %7 to i64 %cmp4 = icmp slt i64 %indvars.iv.next66, %8 br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !13 for.end33: ; preds = %for.inc31.us, %for.end, %for.body14.lr.ph, %for.cond12.preheader %C.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.body14.lr.ph ], [ 0, %for.end ], [ %C.1.us, %for.inc31.us ] %call34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %C.0.lcssa) call void @llvm.lifetime.end.p0(i64 200000, ptr nonnull %T) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #3 call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %S) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 attributes #0 = { nofree 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 = { 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 #3 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10}
#include <stdio.h> #include <stdlib.h> int binarySearch(int key); int *S, n, k = 0; int main() { int *T; int q, i, tmp; scanf("%d", &n); S = (int *)malloc(n * sizeof(int)); for(i = 0; i < n; i++) scanf("%d", &S[i]); scanf("%d", &q); T = (int *)malloc(q * sizeof(int)); for(i = 0; i < q; i++) scanf("%d", &T[i]); /* printf??§??????????¢???? for(i = 0; i < n; i++) printf("%d ", S[i]); printf("\n"); for(i = 0; i < q; i++) printf("%d ", T[i]); printf("\n"); */ for(i = 0; i < q; i++){ tmp = binarySearch(T[i]); // printf("tmp = %d\n", tmp); //if(tmp == 0) // fprintf(stderr, "NOT_FOUND\n"); } printf("%d\n", k); return 0; } int binarySearch(int key) { int left = 0, right = n, mid; while(left < right){ mid = (left + right) / 2; if(S[mid] == key){ k++; return mid; } else if(key < S[mid]) right = mid; else left = mid + 1; } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184950/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184950/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @k = dso_local local_unnamed_addr global i32 0, align 4 @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @n = dso_local global i32 0, align 4 @S = dso_local local_unnamed_addr global ptr null, align 8 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %q = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #5 %call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n) %0 = load i32, ptr @n, align 4, !tbaa !5 %conv = sext i32 %0 to i64 %mul = shl nsw i64 %conv, 2 %call1 = tail call noalias ptr @malloc(i64 noundef %mul) #6 store ptr %call1, ptr @S, align 8, !tbaa !9 %cmp38 = icmp sgt i32 %0, 0 br i1 %cmp38, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %1 = load ptr, ptr @S, align 8, !tbaa !9 %arrayidx = getelementptr inbounds i32, ptr %1, i64 %indvars.iv %call3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %2 = load i32, ptr @n, align 4, !tbaa !5 %3 = sext i32 %2 to i64 %cmp = icmp slt i64 %indvars.iv.next, %3 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11 for.end: ; preds = %for.body, %entry %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %4 = load i32, ptr %q, align 4, !tbaa !5 %conv5 = sext i32 %4 to i64 %mul6 = shl nsw i64 %conv5, 2 %call7 = call noalias ptr @malloc(i64 noundef %mul6) #6 %cmp940 = icmp sgt i32 %4, 0 br i1 %cmp940, label %for.body11, label %for.cond18.preheader.for.end27_crit_edge for.cond18.preheader: ; preds = %for.body11 %cmp1944 = icmp sgt i32 %9, 0 br i1 %cmp1944, label %for.body21.lr.ph, label %for.cond18.preheader.for.end27_crit_edge for.cond18.preheader.for.end27_crit_edge: ; preds = %for.end, %for.cond18.preheader %.pre = load i32, ptr @k, align 4, !tbaa !5 br label %for.end27 for.body21.lr.ph: ; preds = %for.cond18.preheader %k.promoted = load i32, ptr @k, align 4, !tbaa !5 %5 = load i32, ptr @n, align 4, !tbaa !5 %cmp18.i = icmp sgt i32 %5, 0 %6 = load ptr, ptr @S, align 8 br i1 %cmp18.i, label %for.body21.us.preheader, label %for.end27 for.body21.us.preheader: ; preds = %for.body21.lr.ph %wide.trip.count = zext i32 %9 to i64 br label %for.body21.us for.body21.us: ; preds = %for.body21.us.preheader, %binarySearch.exit.us %indvars.iv53 = phi i64 [ 0, %for.body21.us.preheader ], [ %indvars.iv.next54, %binarySearch.exit.us ] %inc.i4345.us = phi i32 [ %k.promoted, %for.body21.us.preheader ], [ %inc.i42.us, %binarySearch.exit.us ] %arrayidx23.us = getelementptr inbounds i32, ptr %call7, i64 %indvars.iv53 %7 = load i32, ptr %arrayidx23.us, align 4, !tbaa !5 br label %while.body.i.us while.body.i.us: ; preds = %if.else.i.us, %for.body21.us %right.020.i.us = phi i32 [ %5, %for.body21.us ], [ %right.1.i.us, %if.else.i.us ] %left.019.i.us = phi i32 [ 0, %for.body21.us ], [ %left.1.i.us, %if.else.i.us ] %add.i.us = add nsw i32 %left.019.i.us, %right.020.i.us %div.i.us = sdiv i32 %add.i.us, 2 %idxprom.i.us = sext i32 %div.i.us to i64 %arrayidx.i.us = getelementptr inbounds i32, ptr %6, i64 %idxprom.i.us %8 = load i32, ptr %arrayidx.i.us, align 4, !tbaa !5 %cmp1.i.us = icmp eq i32 %8, %7 br i1 %cmp1.i.us, label %if.then.i.us, label %if.else.i.us if.else.i.us: ; preds = %while.body.i.us %cmp4.i.us = icmp sgt i32 %8, %7 %add7.i.us = add nsw i32 %div.i.us, 1 %left.1.i.us = select i1 %cmp4.i.us, i32 %left.019.i.us, i32 %add7.i.us %right.1.i.us = select i1 %cmp4.i.us, i32 %div.i.us, i32 %right.020.i.us %cmp.i.us = icmp slt i32 %left.1.i.us, %right.1.i.us br i1 %cmp.i.us, label %while.body.i.us, label %binarySearch.exit.us, !llvm.loop !13 if.then.i.us: ; preds = %while.body.i.us %inc.i.us = add nsw i32 %inc.i4345.us, 1 store i32 %inc.i.us, ptr @k, align 4, !tbaa !5 br label %binarySearch.exit.us binarySearch.exit.us: ; preds = %if.else.i.us, %if.then.i.us %inc.i42.us = phi i32 [ %inc.i.us, %if.then.i.us ], [ %inc.i4345.us, %if.else.i.us ] %indvars.iv.next54 = add nuw nsw i64 %indvars.iv53, 1 %exitcond.not = icmp eq i64 %indvars.iv.next54, %wide.trip.count br i1 %exitcond.not, label %for.end27, label %for.body21.us, !llvm.loop !14 for.body11: ; preds = %for.end, %for.body11 %indvars.iv50 = phi i64 [ %indvars.iv.next51, %for.body11 ], [ 0, %for.end ] %arrayidx13 = getelementptr inbounds i32, ptr %call7, i64 %indvars.iv50 %call14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx13) %indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1 %9 = load i32, ptr %q, align 4, !tbaa !5 %10 = sext i32 %9 to i64 %cmp9 = icmp slt i64 %indvars.iv.next51, %10 br i1 %cmp9, label %for.body11, label %for.cond18.preheader, !llvm.loop !15 for.end27: ; preds = %binarySearch.exit.us, %for.body21.lr.ph, %for.cond18.preheader.for.end27_crit_edge %11 = phi i32 [ %.pre, %for.cond18.preheader.for.end27_crit_edge ], [ %k.promoted, %for.body21.lr.ph ], [ %inc.i42.us, %binarySearch.exit.us ] %call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %11) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #5 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3 ; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable define dso_local i32 @binarySearch(i32 noundef %key) local_unnamed_addr #4 { entry: %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp18 = icmp sgt i32 %0, 0 br i1 %cmp18, label %while.body.lr.ph, label %cleanup while.body.lr.ph: ; preds = %entry %1 = load ptr, ptr @S, align 8, !tbaa !9 br label %while.body while.body: ; preds = %while.body.lr.ph, %if.else %right.020 = phi i32 [ %0, %while.body.lr.ph ], [ %right.1, %if.else ] %left.019 = phi i32 [ 0, %while.body.lr.ph ], [ %left.1, %if.else ] %add = add nsw i32 %right.020, %left.019 %div = sdiv i32 %add, 2 %idxprom = sext i32 %div to i64 %arrayidx = getelementptr inbounds i32, ptr %1, i64 %idxprom %2 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp1 = icmp eq i32 %2, %key br i1 %cmp1, label %if.then, label %if.else if.then: ; preds = %while.body %3 = load i32, ptr @k, align 4, !tbaa !5 %inc = add nsw i32 %3, 1 store i32 %inc, ptr @k, align 4, !tbaa !5 br label %cleanup if.else: ; preds = %while.body %cmp4 = icmp sgt i32 %2, %key %add7 = add nsw i32 %div, 1 %left.1 = select i1 %cmp4, i32 %left.019, i32 %add7 %right.1 = select i1 %cmp4, i32 %div, i32 %right.020 %cmp = icmp slt i32 %left.1, %right.1 br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !13 cleanup: ; preds = %if.else, %entry, %if.then %retval.0 = phi i32 [ %div, %if.then ], [ 0, %entry ], [ 0, %if.else ] ret i32 %retval.0 } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 attributes #0 = { nofree 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 = { 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 #3 = { 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 #4 = { nofree norecurse nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) 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 = { nounwind } attributes #6 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !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 = distinct !{!14, !12} !15 = distinct !{!15, !12}
#include <stdio.h> #define MAX 100000 int main(){ int i, count=0; int left, right, mid; int n, q; int S[MAX], T[MAX]; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&S[i]); } scanf("%d",&q); for(i=0;i<q;i++){ scanf("%d",&T[i]); } for(i=0;i<q;i++){ left = 0; right = n; while(left<right){ mid = (left + right)/2; if(T[i] == S[mid]){ count++; break; } if(T[i] > S[mid]){ left = mid + 1; } else right = mid; } } printf("%d\n",count); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184994/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184994/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %q = alloca i32, align 4 %S = alloca [100000 x i32], align 16 %T = alloca [100000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #3 call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %S) #3 call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %T) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp50 = icmp sgt i32 %0, 0 br i1 %cmp50, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100000 x i32], ptr %S, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %3 = load i32, ptr %q, align 4, !tbaa !5 %cmp452 = icmp sgt i32 %3, 0 br i1 %cmp452, label %for.body5, label %for.end32 for.cond12.preheader: ; preds = %for.body5 %cmp1357 = icmp sgt i32 %7, 0 br i1 %cmp1357, label %for.body14.lr.ph, label %for.end32 for.body14.lr.ph: ; preds = %for.cond12.preheader %4 = load i32, ptr %n, align 4, !tbaa !5 %cmp1554 = icmp sgt i32 %4, 0 br i1 %cmp1554, label %for.body14.us.preheader, label %for.end32 for.body14.us.preheader: ; preds = %for.body14.lr.ph %wide.trip.count = zext i32 %7 to i64 br label %for.body14.us for.body14.us: ; preds = %for.body14.us.preheader, %for.inc30.us %indvars.iv68 = phi i64 [ 0, %for.body14.us.preheader ], [ %indvars.iv.next69, %for.inc30.us ] %count.058.us = phi i32 [ 0, %for.body14.us.preheader ], [ %count.1.us, %for.inc30.us ] %arrayidx17.us = getelementptr inbounds [100000 x i32], ptr %T, i64 0, i64 %indvars.iv68 %5 = load i32, ptr %arrayidx17.us, align 4, !tbaa !5 br label %while.body.us while.body.us: ; preds = %for.body14.us, %if.end.us %right.056.us = phi i32 [ %4, %for.body14.us ], [ %right.1.us, %if.end.us ] %left.055.us = phi i32 [ 0, %for.body14.us ], [ %left.1.us, %if.end.us ] %add.us = add nsw i32 %right.056.us, %left.055.us %div.us = sdiv i32 %add.us, 2 %idxprom18.us = sext i32 %div.us to i64 %arrayidx19.us = getelementptr inbounds [100000 x i32], ptr %S, i64 0, i64 %idxprom18.us %6 = load i32, ptr %arrayidx19.us, align 4, !tbaa !5 %cmp20.us = icmp eq i32 %5, %6 br i1 %cmp20.us, label %if.then.us, label %if.end.us if.end.us: ; preds = %while.body.us %cmp26.us = icmp sgt i32 %5, %6 %add28.us = add nsw i32 %div.us, 1 %left.1.us = select i1 %cmp26.us, i32 %add28.us, i32 %left.055.us %right.1.us = select i1 %cmp26.us, i32 %right.056.us, i32 %div.us %cmp15.us = icmp slt i32 %left.1.us, %right.1.us br i1 %cmp15.us, label %while.body.us, label %for.inc30.us, !llvm.loop !11 if.then.us: ; preds = %while.body.us %inc21.us = add nsw i32 %count.058.us, 1 br label %for.inc30.us for.inc30.us: ; preds = %if.end.us, %if.then.us %count.1.us = phi i32 [ %inc21.us, %if.then.us ], [ %count.058.us, %if.end.us ] %indvars.iv.next69 = add nuw nsw i64 %indvars.iv68, 1 %exitcond.not = icmp eq i64 %indvars.iv.next69, %wide.trip.count br i1 %exitcond.not, label %for.end32, label %for.body14.us, !llvm.loop !12 for.body5: ; preds = %for.end, %for.body5 %indvars.iv65 = phi i64 [ %indvars.iv.next66, %for.body5 ], [ 0, %for.end ] %arrayidx7 = getelementptr inbounds [100000 x i32], ptr %T, i64 0, i64 %indvars.iv65 %call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7) %indvars.iv.next66 = add nuw nsw i64 %indvars.iv65, 1 %7 = load i32, ptr %q, align 4, !tbaa !5 %8 = sext i32 %7 to i64 %cmp4 = icmp slt i64 %indvars.iv.next66, %8 br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !13 for.end32: ; preds = %for.inc30.us, %for.end, %for.body14.lr.ph, %for.cond12.preheader %count.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.body14.lr.ph ], [ 0, %for.end ], [ %count.1.us, %for.inc30.us ] %call33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa) call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %T) #3 call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %S) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 attributes #0 = { nofree 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 = { 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 #3 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10}
#include<stdio.h> int main(){ int sn,tn,count=0,i,j,t; int s[100000]; scanf("%d",&sn); for(i=0;i<sn;i++){ scanf("%d",&s[i]); } scanf("%d",&tn); for(i=0;i<tn;i++){ scanf("%d",&t); int left=0; int right=sn; while(left<right){ int mid; mid=(left+right)/2; if(s[mid]==t){ count++; break; } else if(t<s[mid])right=mid; else left=mid+1; } } printf("%d\n",count); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185043/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185043/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %sn = alloca i32, align 4 %tn = alloca i32, align 4 %t = alloca i32, align 4 %s = alloca [100000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %sn) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %tn) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #3 call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %s) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %sn) %0 = load i32, ptr %sn, align 4, !tbaa !5 %cmp46 = icmp sgt i32 %0, 0 br i1 %cmp46, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100000 x i32], ptr %s, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %sn, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %tn) %3 = load i32, ptr %tn, align 4, !tbaa !5 %cmp451 = icmp sgt i32 %3, 0 br i1 %cmp451, label %for.body5, label %for.end21 for.body5: ; preds = %for.end, %while.end %count.053 = phi i32 [ %count.3, %while.end ], [ 0, %for.end ] %i.152 = phi i32 [ %inc20, %while.end ], [ 0, %for.end ] %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t) %4 = load i32, ptr %sn, align 4, !tbaa !5 %cmp748 = icmp sgt i32 %4, 0 br i1 %cmp748, label %while.body.lr.ph, label %while.end while.body.lr.ph: ; preds = %for.body5 %5 = load i32, ptr %t, align 4, !tbaa !5 br label %while.body while.body: ; preds = %while.body.lr.ph, %cleanup %right.050 = phi i32 [ %4, %while.body.lr.ph ], [ %right.1, %cleanup ] %left.049 = phi i32 [ 0, %while.body.lr.ph ], [ %left.1, %cleanup ] %add = add nsw i32 %right.050, %left.049 %div = sdiv i32 %add, 2 %idxprom8 = sext i32 %div to i64 %arrayidx9 = getelementptr inbounds [100000 x i32], ptr %s, i64 0, i64 %idxprom8 %6 = load i32, ptr %arrayidx9, align 4, !tbaa !5 %cmp10 = icmp eq i32 %6, %5 br i1 %cmp10, label %cleanup.thread, label %cleanup cleanup.thread: ; preds = %while.body %inc11 = add nsw i32 %count.053, 1 br label %while.end cleanup: ; preds = %while.body %cmp14 = icmp slt i32 %5, %6 %add17 = add nsw i32 %div, 1 %left.1 = select i1 %cmp14, i32 %left.049, i32 %add17 %right.1 = select i1 %cmp14, i32 %div, i32 %right.050 %cmp7 = icmp slt i32 %left.1, %right.1 br i1 %cmp7, label %while.body, label %while.end while.end: ; preds = %cleanup, %for.body5, %cleanup.thread %count.3 = phi i32 [ %inc11, %cleanup.thread ], [ %count.053, %for.body5 ], [ %count.053, %cleanup ] %inc20 = add nuw nsw i32 %i.152, 1 %7 = load i32, ptr %tn, align 4, !tbaa !5 %cmp4 = icmp slt i32 %inc20, %7 br i1 %cmp4, label %for.body5, label %for.end21, !llvm.loop !11 for.end21: ; preds = %while.end, %for.end %count.0.lcssa = phi i32 [ 0, %for.end ], [ %count.3, %while.end ] %call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa) call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %s) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %tn) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %sn) #3 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 attributes #0 = { nofree 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 = { 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 #3 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10}
#include <stdio.h> int A[100000], n; int binarySearch(int key) { int left = 0, right = n; int mid; while (left < right) { mid = (left + right ) / 2; if ( A[mid] == key ) { return mid; } else if ( key < A[mid] ) { right = mid; } else { left = mid + 1; } } return 0; } int main (void) { int i , j , q , k , sum = 0; scanf("%d", &n ); for (i = 0 ; i < n ; i++ ) { scanf("%d", &A[i] ); } scanf("%d", &q ); for (j = 0; j < q ; j ++ ) { scanf("%d", &k ); if ( binarySearch( k )) sum++; } printf("%d\n", sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185087/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185087/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @n = dso_local global i32 0, align 4 @A = dso_local global [100000 x i32] zeroinitializer, align 16 @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @binarySearch(i32 noundef %key) local_unnamed_addr #0 { entry: %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp18 = icmp sgt i32 %0, 0 br i1 %cmp18, label %while.body, label %cleanup while.body: ; preds = %entry, %if.else %right.020 = phi i32 [ %right.1, %if.else ], [ %0, %entry ] %left.019 = phi i32 [ %left.1, %if.else ], [ 0, %entry ] %add = add nsw i32 %right.020, %left.019 %div = sdiv i32 %add, 2 %idxprom = sext i32 %div to i64 %arrayidx = getelementptr inbounds [100000 x i32], ptr @A, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp1 = icmp eq i32 %1, %key br i1 %cmp1, label %cleanup, label %if.else if.else: ; preds = %while.body %cmp4 = icmp sgt i32 %1, %key %add7 = add nsw i32 %div, 1 %left.1 = select i1 %cmp4, i32 %left.019, i32 %add7 %right.1 = select i1 %cmp4, i32 %div, i32 %right.020 %cmp = icmp slt i32 %left.1, %right.1 br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !9 cleanup: ; preds = %while.body, %if.else, %entry %retval.0 = phi i32 [ 0, %entry ], [ 0, %if.else ], [ %div, %while.body ] ret i32 %retval.0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %q = alloca i32, align 4 %k = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4 %call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n) %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp22 = icmp sgt i32 %0, 0 br i1 %cmp22, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100000 x i32], ptr @A, i64 0, i64 %indvars.iv %call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr @n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11 for.end: ; preds = %for.body, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %3 = load i32, ptr %q, align 4, !tbaa !5 %cmp424 = icmp sgt i32 %3, 0 br i1 %cmp424, label %for.body5, label %for.end11 for.body5: ; preds = %for.end, %for.cond3 %sum.026 = phi i32 [ %7, %for.cond3 ], [ 0, %for.end ] %j.025 = phi i32 [ %inc10, %for.cond3 ], [ 0, %for.end ] %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k) %4 = load i32, ptr %k, align 4, !tbaa !5 %5 = load i32, ptr @n, align 4, !tbaa !5 %cmp18.i = icmp sgt i32 %5, 0 br i1 %cmp18.i, label %while.body.i, label %binarySearch.exit.thread while.body.i: ; preds = %for.body5, %if.else.i %right.020.i = phi i32 [ %right.1.i, %if.else.i ], [ %5, %for.body5 ] %left.019.i = phi i32 [ %left.1.i, %if.else.i ], [ 0, %for.body5 ] %add.i = add nsw i32 %left.019.i, %right.020.i %add.i.fr = freeze i32 %add.i %div.i = sdiv i32 %add.i.fr, 2 %idxprom.i = sext i32 %div.i to i64 %arrayidx.i = getelementptr inbounds [100000 x i32], ptr @A, i64 0, i64 %idxprom.i %6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %cmp1.i = icmp eq i32 %6, %4 br i1 %cmp1.i, label %binarySearch.exit, label %if.else.i if.else.i: ; preds = %while.body.i %cmp4.i = icmp sgt i32 %6, %4 %add7.i = add nsw i32 %div.i, 1 %left.1.i = select i1 %cmp4.i, i32 %left.019.i, i32 %add7.i %right.1.i = select i1 %cmp4.i, i32 %div.i, i32 %right.020.i %cmp.i = icmp slt i32 %left.1.i, %right.1.i br i1 %cmp.i, label %while.body.i, label %binarySearch.exit.thread, !llvm.loop !9 binarySearch.exit: ; preds = %while.body.i %add.i.off = add i32 %add.i.fr, 1 %tobool.not = icmp ult i32 %add.i.off, 3 %inc8 = add nsw i32 %sum.026, 1 br i1 %tobool.not, label %binarySearch.exit.thread, label %for.cond3 binarySearch.exit.thread: ; preds = %if.else.i, %for.body5, %binarySearch.exit br label %for.cond3 for.cond3: ; preds = %binarySearch.exit, %binarySearch.exit.thread %7 = phi i32 [ %sum.026, %binarySearch.exit.thread ], [ %inc8, %binarySearch.exit ] %inc10 = add nuw nsw i32 %j.025, 1 %8 = load i32, ptr %q, align 4, !tbaa !5 %cmp4 = icmp slt i32 %inc10, %8 br i1 %cmp4, label %for.body5, label %for.end11, !llvm.loop !12 for.end11: ; preds = %for.cond3, %for.end %sum.0.lcssa = phi i32 [ 0, %for.end ], [ %7, %for.cond3 ] %call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 attributes #0 = { nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) 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 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { 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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10}
#include <stdio.h> int main() { int testcases; scanf("%d", &testcases); //printf("%d\n", testcases); while (testcases > 0) { int chgs = 0, i, j, n, m; scanf("%d %d", &n, &m); char arr[n][m]; for (i = 0; i < n; i++) { for (j = 0; j < m; j++) { scanf(" %c", &arr[i][j]); } } /* for (i = 0; i < n; i++) { for (j = 0; j < m; j++) { printf("%c", arr[i][j]); } printf("\n"); } */ for (i = 0; i < m-1; i++) { if (arr[n - 1][i] != 'R') { chgs++; } } for (i = 0; i < n-1; i++) { if (arr[i][m - 1] != 'D') { chgs++; } } printf("%d\n", chgs); testcases--; } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_18513/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_18513/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c" %c\00", align 1 @.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %testcases = alloca i32, align 4 %n = alloca i32, align 4 %m = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %testcases) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %testcases) %0 = load i32, ptr %testcases, align 4, !tbaa !5 %cmp72 = icmp sgt i32 %0, 0 br i1 %cmp72, label %while.body, label %while.end while.body: ; preds = %entry, %for.end44 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n, ptr noundef nonnull %m) %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = zext i32 %1 to i64 %3 = load i32, ptr %m, align 4, !tbaa !5 %4 = zext i32 %3 to i64 %5 = call ptr @llvm.stacksave.p0() %6 = mul nuw i64 %4, %2 %vla = alloca i8, i64 %6, align 16 %7 = load i32, ptr %n, align 4, !tbaa !5 %cmp261 = icmp sgt i32 %7, 0 %.pre87 = load i32, ptr %m, align 4, !tbaa !5 br i1 %cmp261, label %for.cond3.preheader.lr.ph, label %for.cond12.preheader for.cond3.preheader.lr.ph: ; preds = %while.body %8 = icmp sgt i32 %.pre87, 0 br i1 %8, label %for.cond3.preheader, label %for.cond12.preheader.thread for.cond12.preheader.thread: ; preds = %for.cond3.preheader.lr.ph %sub90 = add i32 %.pre87, -1 br label %for.cond12.preheader.for.cond26.preheader_crit_edge for.cond12.preheader: ; preds = %for.inc9, %while.body %9 = phi i32 [ %.pre87, %while.body ], [ %27, %for.inc9 ] %.lcssa = phi i32 [ %7, %while.body ], [ %26, %for.inc9 ] %sub = add i32 %9, -1 %cmp1363 = icmp sgt i32 %9, 1 br i1 %cmp1363, label %for.body14.lr.ph, label %for.cond12.preheader.for.cond26.preheader_crit_edge for.cond12.preheader.for.cond26.preheader_crit_edge: ; preds = %for.cond12.preheader.thread, %for.cond12.preheader %sub95 = phi i32 [ %sub90, %for.cond12.preheader.thread ], [ %sub, %for.cond12.preheader ] %.lcssa93 = phi i32 [ %7, %for.cond12.preheader.thread ], [ %.lcssa, %for.cond12.preheader ] %.pre88 = add i32 %.lcssa93, -1 br label %for.cond26.preheader for.body14.lr.ph: ; preds = %for.cond12.preheader %sub15 = add i32 %.lcssa, -1 %idxprom16 = sext i32 %sub15 to i64 %10 = mul nsw i64 %idxprom16, %4 %arrayidx17 = getelementptr inbounds i8, ptr %vla, i64 %10 %wide.trip.count = zext i32 %sub to i64 %min.iters.check106 = icmp ult i32 %9, 9 br i1 %min.iters.check106, label %for.body14.preheader, label %vector.ph107 vector.ph107: ; preds = %for.body14.lr.ph %n.vec109 = and i64 %wide.trip.count, 4294967288 br label %vector.body112 vector.body112: ; preds = %vector.body112, %vector.ph107 %index113 = phi i64 [ 0, %vector.ph107 ], [ %index.next118, %vector.body112 ] %vec.phi114 = phi <4 x i32> [ zeroinitializer, %vector.ph107 ], [ %17, %vector.body112 ] %vec.phi115 = phi <4 x i32> [ zeroinitializer, %vector.ph107 ], [ %18, %vector.body112 ] %11 = getelementptr inbounds i8, ptr %arrayidx17, i64 %index113 %wide.load116 = load <4 x i8>, ptr %11, align 1, !tbaa !9 %12 = getelementptr inbounds i8, ptr %11, i64 4 %wide.load117 = load <4 x i8>, ptr %12, align 1, !tbaa !9 %13 = icmp ne <4 x i8> %wide.load116, <i8 82, i8 82, i8 82, i8 82> %14 = icmp ne <4 x i8> %wide.load117, <i8 82, i8 82, i8 82, i8 82> %15 = zext <4 x i1> %13 to <4 x i32> %16 = zext <4 x i1> %14 to <4 x i32> %17 = add <4 x i32> %vec.phi114, %15 %18 = add <4 x i32> %vec.phi115, %16 %index.next118 = add nuw i64 %index113, 8 %19 = icmp eq i64 %index.next118, %n.vec109 br i1 %19, label %middle.block104, label %vector.body112, !llvm.loop !10 middle.block104: ; preds = %vector.body112 %bin.rdx119 = add <4 x i32> %18, %17 %20 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx119) %cmp.n111 = icmp eq i64 %n.vec109, %wide.trip.count br i1 %cmp.n111, label %for.cond26.preheader, label %for.body14.preheader for.body14.preheader: ; preds = %for.body14.lr.ph, %middle.block104 %indvars.iv79.ph = phi i64 [ 0, %for.body14.lr.ph ], [ %n.vec109, %middle.block104 ] %chgs.065.ph = phi i32 [ 0, %for.body14.lr.ph ], [ %20, %middle.block104 ] br label %for.body14 for.cond3.preheader: ; preds = %for.cond3.preheader.lr.ph, %for.inc9 %21 = phi i32 [ %26, %for.inc9 ], [ %7, %for.cond3.preheader.lr.ph ] %22 = phi i32 [ %27, %for.inc9 ], [ %.pre87, %for.cond3.preheader.lr.ph ] %indvars.iv76 = phi i64 [ %indvars.iv.next77, %for.inc9 ], [ 0, %for.cond3.preheader.lr.ph ] %cmp459 = icmp sgt i32 %22, 0 br i1 %cmp459, label %for.body5.lr.ph, label %for.inc9 for.body5.lr.ph: ; preds = %for.cond3.preheader %23 = mul nuw nsw i64 %indvars.iv76, %4 %arrayidx = getelementptr inbounds i8, ptr %vla, i64 %23 br label %for.body5 for.body5: ; preds = %for.body5.lr.ph, %for.body5 %indvars.iv = phi i64 [ 0, %for.body5.lr.ph ], [ %indvars.iv.next, %for.body5 ] %arrayidx7 = getelementptr inbounds i8, ptr %arrayidx, i64 %indvars.iv %call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %arrayidx7) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %24 = load i32, ptr %m, align 4, !tbaa !5 %25 = sext i32 %24 to i64 %cmp4 = icmp slt i64 %indvars.iv.next, %25 br i1 %cmp4, label %for.body5, label %for.inc9.loopexit, !llvm.loop !14 for.inc9.loopexit: ; preds = %for.body5 %.pre = load i32, ptr %n, align 4, !tbaa !5 br label %for.inc9 for.inc9: ; preds = %for.inc9.loopexit, %for.cond3.preheader %26 = phi i32 [ %.pre, %for.inc9.loopexit ], [ %21, %for.cond3.preheader ] %27 = phi i32 [ %24, %for.inc9.loopexit ], [ %22, %for.cond3.preheader ] %indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 1 %28 = sext i32 %26 to i64 %cmp2 = icmp slt i64 %indvars.iv.next77, %28 br i1 %cmp2, label %for.cond3.preheader, label %for.cond12.preheader, !llvm.loop !15 for.cond26.preheader: ; preds = %for.body14, %middle.block104, %for.cond12.preheader.for.cond26.preheader_crit_edge %sub94 = phi i32 [ %sub95, %for.cond12.preheader.for.cond26.preheader_crit_edge ], [ %sub, %middle.block104 ], [ %sub, %for.body14 ] %.lcssa92 = phi i32 [ %.lcssa93, %for.cond12.preheader.for.cond26.preheader_crit_edge ], [ %.lcssa, %middle.block104 ], [ %.lcssa, %for.body14 ] %sub27.pre-phi = phi i32 [ %.pre88, %for.cond12.preheader.for.cond26.preheader_crit_edge ], [ %sub15, %middle.block104 ], [ %sub15, %for.body14 ] %chgs.0.lcssa = phi i32 [ 0, %for.cond12.preheader.for.cond26.preheader_crit_edge ], [ %20, %middle.block104 ], [ %spec.select, %for.body14 ] %cmp2868 = icmp sgt i32 %.lcssa92, 1 br i1 %cmp2868, label %for.body30.lr.ph, label %for.end44 for.body30.lr.ph: ; preds = %for.cond26.preheader %idxprom34 = sext i32 %sub94 to i64 %invariant.gep = getelementptr i8, ptr %vla, i64 %idxprom34 %wide.trip.count85 = zext i32 %sub27.pre-phi to i64 %min.iters.check = icmp ugt i32 %sub27.pre-phi, 7 %ident.check.not = icmp eq i32 %3, 1 %or.cond = select i1 %min.iters.check, i1 %ident.check.not, i1 false br i1 %or.cond, label %vector.ph, label %for.body30.preheader vector.ph: ; preds = %for.body30.lr.ph %n.vec = and i64 %wide.trip.count85, 4294967288 %29 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %chgs.0.lcssa, i64 0 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %vec.phi = phi <4 x i32> [ %29, %vector.ph ], [ %37, %vector.body ] %vec.phi102 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %38, %vector.body ] %30 = mul nuw nsw i64 %index, %4 %31 = getelementptr i8, ptr %invariant.gep, i64 %30 %wide.load = load <4 x i8>, ptr %31, align 1, !tbaa !9 %32 = getelementptr i8, ptr %31, i64 4 %wide.load103 = load <4 x i8>, ptr %32, align 1, !tbaa !9 %33 = icmp ne <4 x i8> %wide.load, <i8 68, i8 68, i8 68, i8 68> %34 = icmp ne <4 x i8> %wide.load103, <i8 68, i8 68, i8 68, i8 68> %35 = zext <4 x i1> %33 to <4 x i32> %36 = zext <4 x i1> %34 to <4 x i32> %37 = add <4 x i32> %vec.phi, %35 %38 = add <4 x i32> %vec.phi102, %36 %index.next = add nuw i64 %index, 8 %39 = icmp eq i64 %index.next, %n.vec br i1 %39, label %middle.block, label %vector.body, !llvm.loop !17 middle.block: ; preds = %vector.body %bin.rdx = add <4 x i32> %38, %37 %40 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx) %cmp.n = icmp eq i64 %n.vec, %wide.trip.count85 br i1 %cmp.n, label %for.end44, label %for.body30.preheader for.body30.preheader: ; preds = %for.body30.lr.ph, %middle.block %indvars.iv82.ph = phi i64 [ 0, %for.body30.lr.ph ], [ %n.vec, %middle.block ] %chgs.270.ph = phi i32 [ %chgs.0.lcssa, %for.body30.lr.ph ], [ %40, %middle.block ] %41 = xor i64 %indvars.iv82.ph, -1 %42 = add nsw i64 %41, %wide.trip.count85 %xtraiter = and i64 %wide.trip.count85, 3 %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.body30.prol.loopexit, label %for.body30.prol for.body30.prol: ; preds = %for.body30.preheader, %for.body30.prol %indvars.iv82.prol = phi i64 [ %indvars.iv.next83.prol, %for.body30.prol ], [ %indvars.iv82.ph, %for.body30.preheader ] %chgs.270.prol = phi i32 [ %spec.select58.prol, %for.body30.prol ], [ %chgs.270.ph, %for.body30.preheader ] %prol.iter = phi i64 [ %prol.iter.next, %for.body30.prol ], [ 0, %for.body30.preheader ] %43 = mul nuw nsw i64 %indvars.iv82.prol, %4 %gep.prol = getelementptr i8, ptr %invariant.gep, i64 %43 %44 = load i8, ptr %gep.prol, align 1, !tbaa !9 %cmp37.not.prol = icmp ne i8 %44, 68 %inc40.prol = zext i1 %cmp37.not.prol to i32 %spec.select58.prol = add nsw i32 %chgs.270.prol, %inc40.prol %indvars.iv.next83.prol = add nuw nsw i64 %indvars.iv82.prol, 1 %prol.iter.next = add i64 %prol.iter, 1 %prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter br i1 %prol.iter.cmp.not, label %for.body30.prol.loopexit, label %for.body30.prol, !llvm.loop !18 for.body30.prol.loopexit: ; preds = %for.body30.prol, %for.body30.preheader %spec.select58.lcssa.unr = phi i32 [ undef, %for.body30.preheader ], [ %spec.select58.prol, %for.body30.prol ] %indvars.iv82.unr = phi i64 [ %indvars.iv82.ph, %for.body30.preheader ], [ %indvars.iv.next83.prol, %for.body30.prol ] %chgs.270.unr = phi i32 [ %chgs.270.ph, %for.body30.preheader ], [ %spec.select58.prol, %for.body30.prol ] %45 = icmp ult i64 %42, 3 br i1 %45, label %for.end44, label %for.body30 for.body14: ; preds = %for.body14.preheader, %for.body14 %indvars.iv79 = phi i64 [ %indvars.iv.next80, %for.body14 ], [ %indvars.iv79.ph, %for.body14.preheader ] %chgs.065 = phi i32 [ %spec.select, %for.body14 ], [ %chgs.065.ph, %for.body14.preheader ] %arrayidx19 = getelementptr inbounds i8, ptr %arrayidx17, i64 %indvars.iv79 %46 = load i8, ptr %arrayidx19, align 1, !tbaa !9 %cmp20.not = icmp ne i8 %46, 82 %inc22 = zext i1 %cmp20.not to i32 %spec.select = add nuw nsw i32 %chgs.065, %inc22 %indvars.iv.next80 = add nuw nsw i64 %indvars.iv79, 1 %exitcond.not = icmp eq i64 %indvars.iv.next80, %wide.trip.count br i1 %exitcond.not, label %for.cond26.preheader, label %for.body14, !llvm.loop !20 for.body30: ; preds = %for.body30.prol.loopexit, %for.body30 %indvars.iv82 = phi i64 [ %indvars.iv.next83.3, %for.body30 ], [ %indvars.iv82.unr, %for.body30.prol.loopexit ] %chgs.270 = phi i32 [ %spec.select58.3, %for.body30 ], [ %chgs.270.unr, %for.body30.prol.loopexit ] %47 = mul nuw nsw i64 %indvars.iv82, %4 %gep = getelementptr i8, ptr %invariant.gep, i64 %47 %48 = load i8, ptr %gep, align 1, !tbaa !9 %cmp37.not = icmp ne i8 %48, 68 %inc40 = zext i1 %cmp37.not to i32 %spec.select58 = add nsw i32 %chgs.270, %inc40 %indvars.iv.next83 = add nuw nsw i64 %indvars.iv82, 1 %49 = mul nuw nsw i64 %indvars.iv.next83, %4 %gep.1 = getelementptr i8, ptr %invariant.gep, i64 %49 %50 = load i8, ptr %gep.1, align 1, !tbaa !9 %cmp37.not.1 = icmp ne i8 %50, 68 %inc40.1 = zext i1 %cmp37.not.1 to i32 %spec.select58.1 = add nsw i32 %spec.select58, %inc40.1 %indvars.iv.next83.1 = add nuw nsw i64 %indvars.iv82, 2 %51 = mul nuw nsw i64 %indvars.iv.next83.1, %4 %gep.2 = getelementptr i8, ptr %invariant.gep, i64 %51 %52 = load i8, ptr %gep.2, align 1, !tbaa !9 %cmp37.not.2 = icmp ne i8 %52, 68 %inc40.2 = zext i1 %cmp37.not.2 to i32 %spec.select58.2 = add nsw i32 %spec.select58.1, %inc40.2 %indvars.iv.next83.2 = add nuw nsw i64 %indvars.iv82, 3 %53 = mul nuw nsw i64 %indvars.iv.next83.2, %4 %gep.3 = getelementptr i8, ptr %invariant.gep, i64 %53 %54 = load i8, ptr %gep.3, align 1, !tbaa !9 %cmp37.not.3 = icmp ne i8 %54, 68 %inc40.3 = zext i1 %cmp37.not.3 to i32 %spec.select58.3 = add nsw i32 %spec.select58.2, %inc40.3 %indvars.iv.next83.3 = add nuw nsw i64 %indvars.iv82, 4 %exitcond86.not.3 = icmp eq i64 %indvars.iv.next83.3, %wide.trip.count85 br i1 %exitcond86.not.3, label %for.end44, label %for.body30, !llvm.loop !21 for.end44: ; preds = %for.body30.prol.loopexit, %for.body30, %middle.block, %for.cond26.preheader %chgs.2.lcssa = phi i32 [ %chgs.0.lcssa, %for.cond26.preheader ], [ %40, %middle.block ], [ %spec.select58.lcssa.unr, %for.body30.prol.loopexit ], [ %spec.select58.3, %for.body30 ] %call45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %chgs.2.lcssa) %55 = load i32, ptr %testcases, align 4, !tbaa !5 %dec = add nsw i32 %55, -1 store i32 %dec, ptr %testcases, align 4, !tbaa !5 call void @llvm.stackrestore.p0(ptr %5) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 %56 = load i32, ptr %testcases, align 4, !tbaa !5 %cmp = icmp sgt i32 %56, 0 br i1 %cmp, label %while.body, label %while.end, !llvm.loop !22 while.end: ; preds = %for.end44, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %testcases) #5 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare ptr @llvm.stacksave.p0() #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare void @llvm.stackrestore.p0(ptr) #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #4 attributes #0 = { nofree 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 = { 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 #3 = { mustprogress nocallback nofree nosync nounwind willreturn } attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!7, !7, i64 0} !10 = distinct !{!10, !11, !12, !13} !11 = !{!"llvm.loop.mustprogress"} !12 = !{!"llvm.loop.isvectorized", i32 1} !13 = !{!"llvm.loop.unroll.runtime.disable"} !14 = distinct !{!14, !11} !15 = distinct !{!15, !11, !16} !16 = !{!"llvm.loop.unswitch.partial.disable"} !17 = distinct !{!17, !11, !12, !13} !18 = distinct !{!18, !19} !19 = !{!"llvm.loop.unroll.disable"} !20 = distinct !{!20, !11, !13, !12} !21 = distinct !{!21, !11, !12} !22 = distinct !{!22, !11}
#include <stdio.h> int binarySearch(int *S, int n, int t) { int head, mid, tail; head = 0; tail = n - 1; while (head <= tail) { mid = head + (tail - head) / 2; if (S[mid] == t) return 1; if (S[mid] < t) head = mid + 1; else tail = mid - 1; } return 0; } int main() { int c, i, n, q, t; int S[100000]; scanf("%d", &n); for (i = 0; i < n; i++) scanf("%d", &S[i]); c = 0; scanf("%d", &q); for (i = 0; i < q; i++) { scanf("%d", &t); c += binarySearch(S, n, t); } printf("%d\n", c); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185173/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185173/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable define dso_local i32 @binarySearch(ptr nocapture noundef readonly %S, i32 noundef %n, i32 noundef %t) local_unnamed_addr #0 { entry: %cmp.not20 = icmp slt i32 %n, 1 br i1 %cmp.not20, label %cleanup, label %while.body.preheader while.body.preheader: ; preds = %entry %sub = add nsw i32 %n, -1 br label %while.body while.body: ; preds = %while.body.preheader, %if.end %tail.022 = phi i32 [ %tail.1, %if.end ], [ %sub, %while.body.preheader ] %head.021 = phi i32 [ %head.1, %if.end ], [ 0, %while.body.preheader ] %sub1 = sub nsw i32 %tail.022, %head.021 %div = sdiv i32 %sub1, 2 %add = add nsw i32 %div, %head.021 %idxprom = sext i32 %add to i64 %arrayidx = getelementptr inbounds i32, ptr %S, i64 %idxprom %0 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp2 = icmp eq i32 %0, %t br i1 %cmp2, label %cleanup, label %if.end if.end: ; preds = %while.body %cmp5 = icmp slt i32 %0, %t %add7 = add nsw i32 %add, 1 %sub8 = add nsw i32 %add, -1 %head.1 = select i1 %cmp5, i32 %add7, i32 %head.021 %tail.1 = select i1 %cmp5, i32 %tail.022, i32 %sub8 %cmp.not = icmp sgt i32 %head.1, %tail.1 br i1 %cmp.not, label %cleanup, label %while.body, !llvm.loop !9 cleanup: ; preds = %while.body, %if.end, %entry %retval.0 = phi i32 [ 0, %entry ], [ 0, %if.end ], [ 1, %while.body ] ret i32 %retval.0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %n = alloca i32, align 4 %q = alloca i32, align 4 %t = alloca i32, align 4 %S = alloca [100000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4 call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %S) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp17 = icmp sgt i32 %0, 0 br i1 %cmp17, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100000 x i32], ptr %S, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11 for.end: ; preds = %for.body, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %3 = load i32, ptr %q, align 4, !tbaa !5 %cmp419 = icmp sgt i32 %3, 0 br i1 %cmp419, label %for.body5, label %for.end10 for.body5: ; preds = %for.end, %binarySearch.exit %i.121 = phi i32 [ %inc9, %binarySearch.exit ], [ 0, %for.end ] %c.020 = phi i32 [ %add, %binarySearch.exit ], [ 0, %for.end ] %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t) %4 = load i32, ptr %n, align 4, !tbaa !5 %5 = load i32, ptr %t, align 4, !tbaa !5 %cmp.not20.i = icmp slt i32 %4, 1 br i1 %cmp.not20.i, label %binarySearch.exit, label %while.body.preheader.i while.body.preheader.i: ; preds = %for.body5 %sub.i = add nsw i32 %4, -1 br label %while.body.i while.body.i: ; preds = %if.end.i, %while.body.preheader.i %tail.022.i = phi i32 [ %tail.1.i, %if.end.i ], [ %sub.i, %while.body.preheader.i ] %head.021.i = phi i32 [ %head.1.i, %if.end.i ], [ 0, %while.body.preheader.i ] %sub1.i = sub nsw i32 %tail.022.i, %head.021.i %div.i = sdiv i32 %sub1.i, 2 %add.i = add nsw i32 %div.i, %head.021.i %idxprom.i = sext i32 %add.i to i64 %arrayidx.i = getelementptr inbounds i32, ptr %S, i64 %idxprom.i %6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %cmp2.i = icmp eq i32 %6, %5 br i1 %cmp2.i, label %binarySearch.exit, label %if.end.i if.end.i: ; preds = %while.body.i %cmp5.i = icmp slt i32 %6, %5 %add7.i = add nsw i32 %add.i, 1 %sub8.i = add nsw i32 %add.i, -1 %head.1.i = select i1 %cmp5.i, i32 %add7.i, i32 %head.021.i %tail.1.i = select i1 %cmp5.i, i32 %tail.022.i, i32 %sub8.i %cmp.not.i = icmp sgt i32 %head.1.i, %tail.1.i br i1 %cmp.not.i, label %binarySearch.exit, label %while.body.i, !llvm.loop !9 binarySearch.exit: ; preds = %while.body.i, %if.end.i, %for.body5 %retval.0.i = phi i32 [ 0, %for.body5 ], [ 1, %while.body.i ], [ 0, %if.end.i ] %add = add nuw nsw i32 %retval.0.i, %c.020 %inc9 = add nuw nsw i32 %i.121, 1 %7 = load i32, ptr %q, align 4, !tbaa !5 %cmp4 = icmp slt i32 %inc9, %7 br i1 %cmp4, label %for.body5, label %for.end10, !llvm.loop !12 for.end10: ; preds = %binarySearch.exit, %for.end %c.0.lcssa = phi i32 [ 0, %for.end ], [ %add, %binarySearch.exit ] %call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %c.0.lcssa) call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %S) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 attributes #0 = { nofree norecurse nosync nounwind memory(argmem: 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { 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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10}
#include <stdio.h> int binary_search(int *A, int n, int key) { int left, right, mid; left = 0; right = n; while (left < right) { mid = (left + right) / 2; if (A[mid] == key) return 1; if (A[mid] < key) { left = mid + 1; } else { right = mid; } } return 0; } int main(int argc, char *argv[]) { int S[100000], key, i, n, q, sum = 0; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d", &S[i]); } scanf("%d", &q); for (i = 0; i < q; i++) { scanf("%d", &key); if (binary_search(S, n, key)) sum++; } printf("%d\n", sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185230/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185230/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable define dso_local i32 @binary_search(ptr nocapture noundef readonly %A, i32 noundef %n, i32 noundef %key) local_unnamed_addr #0 { entry: %cmp17 = icmp sgt i32 %n, 0 br i1 %cmp17, label %while.body, label %cleanup while.body: ; preds = %entry, %if.end %right.019 = phi i32 [ %right.1, %if.end ], [ %n, %entry ] %left.018 = phi i32 [ %left.1, %if.end ], [ 0, %entry ] %add = add nsw i32 %right.019, %left.018 %div = sdiv i32 %add, 2 %idxprom = sext i32 %div to i64 %arrayidx = getelementptr inbounds i32, ptr %A, i64 %idxprom %0 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp1 = icmp eq i32 %0, %key br i1 %cmp1, label %cleanup, label %if.end if.end: ; preds = %while.body %cmp4 = icmp slt i32 %0, %key %add6 = add nsw i32 %div, 1 %left.1 = select i1 %cmp4, i32 %add6, i32 %left.018 %right.1 = select i1 %cmp4, i32 %right.019, i32 %div %cmp = icmp slt i32 %left.1, %right.1 br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !9 cleanup: ; preds = %while.body, %if.end, %entry %retval.0 = phi i32 [ 0, %entry ], [ 0, %if.end ], [ 1, %while.body ] ret i32 %retval.0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #2 { entry: %S = alloca [100000 x i32], align 16 %key = alloca i32, align 4 %n = alloca i32, align 4 %q = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %S) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %key) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp21 = icmp sgt i32 %0, 0 br i1 %cmp21, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100000 x i32], ptr %S, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11 for.end: ; preds = %for.body, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %3 = load i32, ptr %q, align 4, !tbaa !5 %cmp423 = icmp sgt i32 %3, 0 br i1 %cmp423, label %for.body5, label %for.end11 for.body5: ; preds = %for.end, %for.cond3 %sum.025 = phi i32 [ %7, %for.cond3 ], [ 0, %for.end ] %i.124 = phi i32 [ %inc10, %for.cond3 ], [ 0, %for.end ] %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %key) %4 = load i32, ptr %n, align 4, !tbaa !5 %5 = load i32, ptr %key, align 4, !tbaa !5 %cmp17.i = icmp sgt i32 %4, 0 br i1 %cmp17.i, label %while.body.i, label %for.cond3 while.body.i: ; preds = %for.body5, %if.end.i %right.019.i = phi i32 [ %right.1.i, %if.end.i ], [ %4, %for.body5 ] %left.018.i = phi i32 [ %left.1.i, %if.end.i ], [ 0, %for.body5 ] %add.i = add nsw i32 %left.018.i, %right.019.i %div.i = sdiv i32 %add.i, 2 %idxprom.i = sext i32 %div.i to i64 %arrayidx.i = getelementptr inbounds i32, ptr %S, i64 %idxprom.i %6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %cmp1.i = icmp eq i32 %6, %5 br i1 %cmp1.i, label %binary_search.exit, label %if.end.i if.end.i: ; preds = %while.body.i %cmp4.i = icmp slt i32 %6, %5 %add6.i = add nsw i32 %div.i, 1 %left.1.i = select i1 %cmp4.i, i32 %add6.i, i32 %left.018.i %right.1.i = select i1 %cmp4.i, i32 %right.019.i, i32 %div.i %cmp.i = icmp slt i32 %left.1.i, %right.1.i br i1 %cmp.i, label %while.body.i, label %for.cond3, !llvm.loop !9 binary_search.exit: ; preds = %while.body.i %inc8 = add nsw i32 %sum.025, 1 br label %for.cond3 for.cond3: ; preds = %if.end.i, %for.body5, %binary_search.exit %7 = phi i32 [ %inc8, %binary_search.exit ], [ %sum.025, %for.body5 ], [ %sum.025, %if.end.i ] %inc10 = add nuw nsw i32 %i.124, 1 %8 = load i32, ptr %q, align 4, !tbaa !5 %cmp4 = icmp slt i32 %inc10, %8 br i1 %cmp4, label %for.body5, label %for.end11, !llvm.loop !12 for.end11: ; preds = %for.cond3, %for.end %sum.0.lcssa = phi i32 [ 0, %for.end ], [ %7, %for.cond3 ] %call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %key) #4 call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %S) #4 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 attributes #0 = { nofree norecurse nosync nounwind memory(argmem: 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { 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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10}
#include<stdio.h> int search(int *,int,int); int main(){ int i,j,n,q,num=0; scanf("%d",&n); int S[n]; for(i=0;i<n;i++){ scanf("%d",&S[i]); } scanf("%d",&q); int T[q]; for(i=0;i<q;i++){ scanf("%d",&T[i]); } for(i=0;i<q;i++){ num += search(S,T[i],n); } printf("%d\n",num); return 0; } int search(int *S,int key,int n){ int left=0,right=n,mid; while(left<right){ mid = (left + right)/2; if(S[mid] == key){ return 1; } else if(key < S[mid]) right = mid; else left = mid +1; } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185281/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185281/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %q = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %1 = zext i32 %0 to i64 %2 = call ptr @llvm.stacksave.p0() %vla = alloca i32, i64 %1, align 16 %3 = load i32, ptr %n, align 4, !tbaa !5 %cmp32 = icmp sgt i32 %3, 0 br i1 %cmp32, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %4 = load i32, ptr %n, align 4, !tbaa !5 %5 = sext i32 %4 to i64 %cmp = icmp slt i64 %indvars.iv.next, %5 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %6 = load i32, ptr %q, align 4, !tbaa !5 %7 = zext i32 %6 to i64 %vla3 = alloca i32, i64 %7, align 16 %cmp534 = icmp sgt i32 %6, 0 br i1 %cmp534, label %for.body6, label %for.end21 for.cond13.preheader: ; preds = %for.body6 %cmp1436 = icmp sgt i32 %11, 0 br i1 %cmp1436, label %for.body15.lr.ph, label %for.end21 for.body15.lr.ph: ; preds = %for.cond13.preheader %8 = load i32, ptr %n, align 4, !tbaa !5 %cmp18.i = icmp sgt i32 %8, 0 br i1 %cmp18.i, label %for.body15.us.preheader, label %for.end21 for.body15.us.preheader: ; preds = %for.body15.lr.ph %wide.trip.count = zext i32 %11 to i64 br label %for.body15.us for.body15.us: ; preds = %for.body15.us.preheader, %search.exit.loopexit.us %indvars.iv46 = phi i64 [ 0, %for.body15.us.preheader ], [ %indvars.iv.next47, %search.exit.loopexit.us ] %num.037.us = phi i32 [ 0, %for.body15.us.preheader ], [ %add.us, %search.exit.loopexit.us ] %arrayidx17.us = getelementptr inbounds i32, ptr %vla3, i64 %indvars.iv46 %9 = load i32, ptr %arrayidx17.us, align 4, !tbaa !5 br label %while.body.i.us while.body.i.us: ; preds = %for.body15.us, %if.else.i.us %right.020.i.us = phi i32 [ %right.1.i.us, %if.else.i.us ], [ %8, %for.body15.us ] %left.019.i.us = phi i32 [ %left.1.i.us, %if.else.i.us ], [ 0, %for.body15.us ] %add.i.us = add nsw i32 %left.019.i.us, %right.020.i.us %div.i.us = sdiv i32 %add.i.us, 2 %idxprom.i.us = sext i32 %div.i.us to i64 %arrayidx.i.us = getelementptr inbounds i32, ptr %vla, i64 %idxprom.i.us %10 = load i32, ptr %arrayidx.i.us, align 4, !tbaa !5 %cmp1.i.us = icmp eq i32 %10, %9 br i1 %cmp1.i.us, label %search.exit.loopexit.us, label %if.else.i.us if.else.i.us: ; preds = %while.body.i.us %cmp4.i.us = icmp sgt i32 %10, %9 %add7.i.us = add nsw i32 %div.i.us, 1 %left.1.i.us = select i1 %cmp4.i.us, i32 %left.019.i.us, i32 %add7.i.us %right.1.i.us = select i1 %cmp4.i.us, i32 %div.i.us, i32 %right.020.i.us %cmp.i.us = icmp slt i32 %left.1.i.us, %right.1.i.us br i1 %cmp.i.us, label %while.body.i.us, label %search.exit.loopexit.us, !llvm.loop !11 search.exit.loopexit.us: ; preds = %if.else.i.us, %while.body.i.us %retval.0.i.ph.us = phi i32 [ 1, %while.body.i.us ], [ 0, %if.else.i.us ] %add.us = add nuw nsw i32 %retval.0.i.ph.us, %num.037.us %indvars.iv.next47 = add nuw nsw i64 %indvars.iv46, 1 %exitcond.not = icmp eq i64 %indvars.iv.next47, %wide.trip.count br i1 %exitcond.not, label %for.end21, label %for.body15.us, !llvm.loop !12 for.body6: ; preds = %for.end, %for.body6 %indvars.iv43 = phi i64 [ %indvars.iv.next44, %for.body6 ], [ 0, %for.end ] %arrayidx8 = getelementptr inbounds i32, ptr %vla3, i64 %indvars.iv43 %call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx8) %indvars.iv.next44 = add nuw nsw i64 %indvars.iv43, 1 %11 = load i32, ptr %q, align 4, !tbaa !5 %12 = sext i32 %11 to i64 %cmp5 = icmp slt i64 %indvars.iv.next44, %12 br i1 %cmp5, label %for.body6, label %for.cond13.preheader, !llvm.loop !13 for.end21: ; preds = %search.exit.loopexit.us, %for.end, %for.body15.lr.ph, %for.cond13.preheader %num.0.lcssa = phi i32 [ 0, %for.cond13.preheader ], [ 0, %for.body15.lr.ph ], [ 0, %for.end ], [ %add.us, %search.exit.loopexit.us ] %call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %num.0.lcssa) call void @llvm.stackrestore.p0(ptr %2) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare ptr @llvm.stacksave.p0() #3 ; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable define dso_local i32 @search(ptr nocapture noundef readonly %S, i32 noundef %key, i32 noundef %n) local_unnamed_addr #4 { entry: %cmp18 = icmp sgt i32 %n, 0 br i1 %cmp18, label %while.body, label %cleanup while.body: ; preds = %entry, %if.else %right.020 = phi i32 [ %right.1, %if.else ], [ %n, %entry ] %left.019 = phi i32 [ %left.1, %if.else ], [ 0, %entry ] %add = add nsw i32 %right.020, %left.019 %div = sdiv i32 %add, 2 %idxprom = sext i32 %div to i64 %arrayidx = getelementptr inbounds i32, ptr %S, i64 %idxprom %0 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp1 = icmp eq i32 %0, %key br i1 %cmp1, label %cleanup, label %if.else if.else: ; preds = %while.body %cmp4 = icmp sgt i32 %0, %key %add7 = add nsw i32 %div, 1 %left.1 = select i1 %cmp4, i32 %left.019, i32 %add7 %right.1 = select i1 %cmp4, i32 %div, i32 %right.020 %cmp = icmp slt i32 %left.1, %right.1 br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !11 cleanup: ; preds = %while.body, %if.else, %entry %retval.0 = phi i32 [ 0, %entry ], [ 0, %if.else ], [ 1, %while.body ] ret i32 %retval.0 } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare void @llvm.stackrestore.p0(ptr) #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree 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 = { 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 #3 = { mustprogress nocallback nofree nosync nounwind willreturn } attributes #4 = { nofree norecurse nosync nounwind memory(argmem: 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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10}
#include<stdio.h> #include<stdlib.h> int binarysearch(int*,int,int); int main(){ int i=0,q,k,cnt=0; int n; int *t,*s; scanf("%d",&n); s=(int *)malloc(n * sizeof(int)); for(i=0;i<n;i++){ scanf("%d",&s[i]); } scanf("%d",&q); t=(int *)malloc(q * sizeof(int)); for(i=0;i<q;i++){ scanf("%d",&t[i]); } for(i=0;i<q;i++){ k=binarysearch(s,t[i],n); if(k==1)cnt++; } printf("%d\n",cnt); free(t); free(s); return 0; } int binarysearch(int s[],int key,int n){ int left=0; int right=n; int mid; while(left<right){ mid=(left+right)/2; if(s[mid]==key)return 1; else if(key<s[mid])right=mid; else left=mid+1; } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185324/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185324/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %q = alloca i32, align 4 %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #6 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %conv = sext i32 %0 to i64 %mul = shl nsw i64 %conv, 2 %call1 = call noalias ptr @malloc(i64 noundef %mul) #7 %cmp48 = icmp sgt i32 %0, 0 br i1 %cmp48, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %entry %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %3 = load i32, ptr %q, align 4, !tbaa !5 %conv5 = sext i32 %3 to i64 %mul6 = shl nsw i64 %conv5, 2 %call7 = call noalias ptr @malloc(i64 noundef %mul6) #7 %cmp950 = icmp sgt i32 %3, 0 br i1 %cmp950, label %for.body11, label %for.end30 for.cond18.preheader: ; preds = %for.body11 %cmp1952 = icmp sgt i32 %8, 0 br i1 %cmp1952, label %for.body21.lr.ph, label %for.end30 for.body21.lr.ph: ; preds = %for.cond18.preheader %4 = load i32, ptr %n, align 4, !tbaa !5 %cmp18.i = icmp sgt i32 %4, 0 br i1 %cmp18.i, label %for.body21.us.preheader, label %for.end30 for.body21.us.preheader: ; preds = %for.body21.lr.ph %wide.trip.count = zext i32 %8 to i64 br label %for.body21.us for.body21.us: ; preds = %for.body21.us.preheader, %for.cond18.us %indvars.iv63 = phi i64 [ 0, %for.body21.us.preheader ], [ %indvars.iv.next64, %for.cond18.us ] %cnt.053.us = phi i32 [ 0, %for.body21.us.preheader ], [ %7, %for.cond18.us ] %arrayidx23.us = getelementptr inbounds i32, ptr %call7, i64 %indvars.iv63 %5 = load i32, ptr %arrayidx23.us, align 4, !tbaa !5 br label %while.body.i.us while.body.i.us: ; preds = %for.body21.us, %if.else.i.us %right.020.i.us = phi i32 [ %right.1.i.us, %if.else.i.us ], [ %4, %for.body21.us ] %left.019.i.us = phi i32 [ %left.1.i.us, %if.else.i.us ], [ 0, %for.body21.us ] %add.i.us = add nsw i32 %left.019.i.us, %right.020.i.us %div.i.us = sdiv i32 %add.i.us, 2 %idxprom.i.us = sext i32 %div.i.us to i64 %arrayidx.i.us = getelementptr inbounds i32, ptr %call1, i64 %idxprom.i.us %6 = load i32, ptr %arrayidx.i.us, align 4, !tbaa !5 %cmp1.i.us = icmp eq i32 %6, %5 br i1 %cmp1.i.us, label %binarysearch.exit.us, label %if.else.i.us if.else.i.us: ; preds = %while.body.i.us %cmp4.i.us = icmp sgt i32 %6, %5 %add7.i.us = add nsw i32 %div.i.us, 1 %left.1.i.us = select i1 %cmp4.i.us, i32 %left.019.i.us, i32 %add7.i.us %right.1.i.us = select i1 %cmp4.i.us, i32 %div.i.us, i32 %right.020.i.us %cmp.i.us = icmp slt i32 %left.1.i.us, %right.1.i.us br i1 %cmp.i.us, label %while.body.i.us, label %for.cond18.us, !llvm.loop !11 binarysearch.exit.us: ; preds = %while.body.i.us %inc27.us = add nsw i32 %cnt.053.us, 1 br label %for.cond18.us for.cond18.us: ; preds = %if.else.i.us, %binarysearch.exit.us %7 = phi i32 [ %inc27.us, %binarysearch.exit.us ], [ %cnt.053.us, %if.else.i.us ] %indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1 %exitcond.not = icmp eq i64 %indvars.iv.next64, %wide.trip.count br i1 %exitcond.not, label %for.end30, label %for.body21.us, !llvm.loop !12 for.body11: ; preds = %for.end, %for.body11 %indvars.iv60 = phi i64 [ %indvars.iv.next61, %for.body11 ], [ 0, %for.end ] %arrayidx13 = getelementptr inbounds i32, ptr %call7, i64 %indvars.iv60 %call14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx13) %indvars.iv.next61 = add nuw nsw i64 %indvars.iv60, 1 %8 = load i32, ptr %q, align 4, !tbaa !5 %9 = sext i32 %8 to i64 %cmp9 = icmp slt i64 %indvars.iv.next61, %9 br i1 %cmp9, label %for.body11, label %for.cond18.preheader, !llvm.loop !13 for.end30: ; preds = %for.cond18.us, %for.end, %for.body21.lr.ph, %for.cond18.preheader %cnt.0.lcssa = phi i32 [ 0, %for.cond18.preheader ], [ 0, %for.body21.lr.ph ], [ 0, %for.end ], [ %7, %for.cond18.us ] %call31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.0.lcssa) call void @free(ptr noundef %call7) #6 call void @free(ptr noundef %call1) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3 ; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable define dso_local i32 @binarysearch(ptr nocapture noundef readonly %s, i32 noundef %key, i32 noundef %n) local_unnamed_addr #4 { entry: %cmp18 = icmp sgt i32 %n, 0 br i1 %cmp18, label %while.body, label %cleanup while.body: ; preds = %entry, %if.else %right.020 = phi i32 [ %right.1, %if.else ], [ %n, %entry ] %left.019 = phi i32 [ %left.1, %if.else ], [ 0, %entry ] %add = add nsw i32 %right.020, %left.019 %div = sdiv i32 %add, 2 %idxprom = sext i32 %div to i64 %arrayidx = getelementptr inbounds i32, ptr %s, i64 %idxprom %0 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp1 = icmp eq i32 %0, %key br i1 %cmp1, label %cleanup, label %if.else if.else: ; preds = %while.body %cmp4 = icmp sgt i32 %0, %key %add7 = add nsw i32 %div, 1 %left.1 = select i1 %cmp4, i32 %left.019, i32 %add7 %right.1 = select i1 %cmp4, i32 %div, i32 %right.020 %cmp = icmp slt i32 %left.1, %right.1 br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !11 cleanup: ; preds = %while.body, %if.else, %entry %retval.0 = phi i32 [ 0, %entry ], [ 0, %if.else ], [ 1, %while.body ] ret i32 %retval.0 } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #5 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 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 = { 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 #3 = { 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 #4 = { nofree norecurse nosync nounwind memory(argmem: 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 = { 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 #6 = { nounwind } attributes #7 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10}
#include <stdio.h> #define N 100000 int n,cnt=0; int BinarySearch(int*,int); int main(){ int i,m,S[N],T[N]; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&S[i]); } scanf("%d",&m); for(i=0;i<m;i++){ scanf("%d",&T[i]); } for(i=0;i<m;i++){ BinarySearch(S,T[i]); } printf("%d\n",cnt); return 0; } int BinarySearch(int *A,int key){ int left=0,right=n,mid; while(left<right){ mid=(left+right)/2; if(A[mid]==key){ cnt++; return mid; } else if(key<A[mid])right = mid; else left = mid + 1; } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185368/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185368/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @cnt = dso_local local_unnamed_addr global i32 0, align 4 @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @n = dso_local global i32 0, align 4 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %m = alloca i32, align 4 %S = alloca [100000 x i32], align 16 %T = alloca [100000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4 call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %S) #4 call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %T) #4 %call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n) %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp30 = icmp sgt i32 %0, 0 br i1 %cmp30, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100000 x i32], ptr %S, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr @n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m) %3 = load i32, ptr %m, align 4, !tbaa !5 %cmp432 = icmp sgt i32 %3, 0 br i1 %cmp432, label %for.body5, label %for.cond12.preheader.for.end20_crit_edge for.cond12.preheader: ; preds = %for.body5 %cmp1336 = icmp sgt i32 %7, 0 br i1 %cmp1336, label %for.body14.lr.ph, label %for.cond12.preheader.for.end20_crit_edge for.cond12.preheader.for.end20_crit_edge: ; preds = %for.end, %for.cond12.preheader %.pre = load i32, ptr @cnt, align 4, !tbaa !5 br label %for.end20 for.body14.lr.ph: ; preds = %for.cond12.preheader %cnt.promoted = load i32, ptr @cnt, align 4, !tbaa !5 %4 = load i32, ptr @n, align 4, !tbaa !5 %cmp19.i = icmp sgt i32 %4, 0 br i1 %cmp19.i, label %for.body14.us.preheader, label %for.end20 for.body14.us.preheader: ; preds = %for.body14.lr.ph %wide.trip.count = zext i32 %7 to i64 br label %for.body14.us for.body14.us: ; preds = %for.body14.us.preheader, %BinarySearch.exit.us %indvars.iv45 = phi i64 [ 0, %for.body14.us.preheader ], [ %indvars.iv.next46, %BinarySearch.exit.us ] %inc.i3537.us = phi i32 [ %cnt.promoted, %for.body14.us.preheader ], [ %inc.i34.us, %BinarySearch.exit.us ] %arrayidx16.us = getelementptr inbounds [100000 x i32], ptr %T, i64 0, i64 %indvars.iv45 %5 = load i32, ptr %arrayidx16.us, align 4, !tbaa !5 br label %while.body.i.us while.body.i.us: ; preds = %for.body14.us, %if.else.i.us %right.021.i.us = phi i32 [ %right.1.i.us, %if.else.i.us ], [ %4, %for.body14.us ] %left.020.i.us = phi i32 [ %left.1.i.us, %if.else.i.us ], [ 0, %for.body14.us ] %add.i.us = add nsw i32 %left.020.i.us, %right.021.i.us %div.i.us = sdiv i32 %add.i.us, 2 %idxprom.i.us = sext i32 %div.i.us to i64 %arrayidx.i.us = getelementptr inbounds i32, ptr %S, i64 %idxprom.i.us %6 = load i32, ptr %arrayidx.i.us, align 4, !tbaa !5 %cmp1.i.us = icmp eq i32 %6, %5 br i1 %cmp1.i.us, label %if.then.i.us, label %if.else.i.us if.else.i.us: ; preds = %while.body.i.us %cmp4.i.us = icmp sgt i32 %6, %5 %add7.i.us = add nsw i32 %div.i.us, 1 %left.1.i.us = select i1 %cmp4.i.us, i32 %left.020.i.us, i32 %add7.i.us %right.1.i.us = select i1 %cmp4.i.us, i32 %div.i.us, i32 %right.021.i.us %cmp.i.us = icmp slt i32 %left.1.i.us, %right.1.i.us br i1 %cmp.i.us, label %while.body.i.us, label %BinarySearch.exit.us, !llvm.loop !11 if.then.i.us: ; preds = %while.body.i.us %inc.i.us = add nsw i32 %inc.i3537.us, 1 store i32 %inc.i.us, ptr @cnt, align 4, !tbaa !5 br label %BinarySearch.exit.us BinarySearch.exit.us: ; preds = %if.else.i.us, %if.then.i.us %inc.i34.us = phi i32 [ %inc.i.us, %if.then.i.us ], [ %inc.i3537.us, %if.else.i.us ] %indvars.iv.next46 = add nuw nsw i64 %indvars.iv45, 1 %exitcond.not = icmp eq i64 %indvars.iv.next46, %wide.trip.count br i1 %exitcond.not, label %for.end20, label %for.body14.us, !llvm.loop !12 for.body5: ; preds = %for.end, %for.body5 %indvars.iv42 = phi i64 [ %indvars.iv.next43, %for.body5 ], [ 0, %for.end ] %arrayidx7 = getelementptr inbounds [100000 x i32], ptr %T, i64 0, i64 %indvars.iv42 %call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7) %indvars.iv.next43 = add nuw nsw i64 %indvars.iv42, 1 %7 = load i32, ptr %m, align 4, !tbaa !5 %8 = sext i32 %7 to i64 %cmp4 = icmp slt i64 %indvars.iv.next43, %8 br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !13 for.end20: ; preds = %BinarySearch.exit.us, %for.body14.lr.ph, %for.cond12.preheader.for.end20_crit_edge %9 = phi i32 [ %.pre, %for.cond12.preheader.for.end20_crit_edge ], [ %cnt.promoted, %for.body14.lr.ph ], [ %inc.i34.us, %BinarySearch.exit.us ] %call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %9) call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %T) #4 call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %S) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable define dso_local i32 @BinarySearch(ptr nocapture noundef readonly %A, i32 noundef %key) local_unnamed_addr #3 { entry: %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp19 = icmp sgt i32 %0, 0 br i1 %cmp19, label %while.body, label %cleanup while.body: ; preds = %entry, %if.else %right.021 = phi i32 [ %right.1, %if.else ], [ %0, %entry ] %left.020 = phi i32 [ %left.1, %if.else ], [ 0, %entry ] %add = add nsw i32 %right.021, %left.020 %div = sdiv i32 %add, 2 %idxprom = sext i32 %div to i64 %arrayidx = getelementptr inbounds i32, ptr %A, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp1 = icmp eq i32 %1, %key br i1 %cmp1, label %if.then, label %if.else if.then: ; preds = %while.body %2 = load i32, ptr @cnt, align 4, !tbaa !5 %inc = add nsw i32 %2, 1 store i32 %inc, ptr @cnt, align 4, !tbaa !5 br label %cleanup if.else: ; preds = %while.body %cmp4 = icmp sgt i32 %1, %key %add7 = add nsw i32 %div, 1 %left.1 = select i1 %cmp4, i32 %left.020, i32 %add7 %right.1 = select i1 %cmp4, i32 %div, i32 %right.021 %cmp = icmp slt i32 %left.1, %right.1 br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !11 cleanup: ; preds = %if.else, %entry, %if.then %retval.0 = phi i32 [ %div, %if.then ], [ 0, %entry ], [ 0, %if.else ] ret i32 %retval.0 } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 attributes #0 = { nofree 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 = { 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 #3 = { nofree norecurse nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10}
#include<stdio.h> int binary_search(int* A, int n, int i){ int left = 0, right = n; while(left < right){ int mid = (left+right)/2; if(A[mid] == i) return 1; if(A[mid] < i) left = mid+1; else right = mid; } return 0; } int main(){ int S[100000], T[50000], n, m, i, num = 0; scanf("%d",&n); for(i = 0; i < n; i++) { scanf("%d",&S[i]); } scanf("%d",&m); for(i = 0; i < m; i++){ scanf("%d",&T[i]); } for(i = 0; i < m; i++) { num += binary_search(S, n, T[i]); } printf("%d\n", num); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185410/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185410/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable define dso_local i32 @binary_search(ptr nocapture noundef readonly %A, i32 noundef %n, i32 noundef %i) local_unnamed_addr #0 { entry: br label %while.cond while.cond: ; preds = %while.body, %entry %left.0 = phi i32 [ 0, %entry ], [ %left.1, %while.body ] %right.0 = phi i32 [ %n, %entry ], [ %right.1, %while.body ] %cmp = icmp slt i32 %left.0, %right.0 br i1 %cmp, label %while.body, label %cleanup8 while.body: ; preds = %while.cond %add = add nsw i32 %right.0, %left.0 %div = sdiv i32 %add, 2 %idxprom = sext i32 %div to i64 %arrayidx = getelementptr inbounds i32, ptr %A, i64 %idxprom %0 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp1.not = icmp eq i32 %0, %i %cmp4 = icmp slt i32 %0, %i %add6 = add nsw i32 %div, 1 %left.1 = select i1 %cmp4, i32 %add6, i32 %left.0 %right.1 = select i1 %cmp4, i32 %right.0, i32 %div br i1 %cmp1.not, label %cleanup8, label %while.cond, !llvm.loop !9 cleanup8: ; preds = %while.cond, %while.body %retval.2 = phi i32 [ 1, %while.body ], [ 0, %while.cond ] ret i32 %retval.2 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %S = alloca [100000 x i32], align 16 %T = alloca [50000 x i32], align 16 %n = alloca i32, align 4 %m = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %S) #4 call void @llvm.lifetime.start.p0(i64 200000, ptr nonnull %T) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp31 = icmp sgt i32 %0, 0 br i1 %cmp31, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100000 x i32], ptr %S, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11 for.end: ; preds = %for.body, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m) %3 = load i32, ptr %m, align 4, !tbaa !5 %cmp433 = icmp sgt i32 %3, 0 br i1 %cmp433, label %for.body5, label %for.end20 for.cond12.preheader: ; preds = %for.body5 %cmp1335 = icmp sgt i32 %5, 0 br i1 %cmp1335, label %for.body14.lr.ph, label %for.end20 for.body14.lr.ph: ; preds = %for.cond12.preheader %4 = load i32, ptr %n, align 4, !tbaa !5 %wide.trip.count = zext i32 %5 to i64 br label %for.body14 for.body5: ; preds = %for.end, %for.body5 %indvars.iv41 = phi i64 [ %indvars.iv.next42, %for.body5 ], [ 0, %for.end ] %arrayidx7 = getelementptr inbounds [50000 x i32], ptr %T, i64 0, i64 %indvars.iv41 %call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7) %indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1 %5 = load i32, ptr %m, align 4, !tbaa !5 %6 = sext i32 %5 to i64 %cmp4 = icmp slt i64 %indvars.iv.next42, %6 br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !12 for.body14: ; preds = %for.body14.lr.ph, %binary_search.exit %indvars.iv44 = phi i64 [ 0, %for.body14.lr.ph ], [ %indvars.iv.next45, %binary_search.exit ] %num.037 = phi i32 [ 0, %for.body14.lr.ph ], [ %add, %binary_search.exit ] %arrayidx16 = getelementptr inbounds [50000 x i32], ptr %T, i64 0, i64 %indvars.iv44 %7 = load i32, ptr %arrayidx16, align 4, !tbaa !5 br label %while.cond.i while.cond.i: ; preds = %while.body.i, %for.body14 %left.0.i = phi i32 [ 0, %for.body14 ], [ %left.1.i, %while.body.i ] %right.0.i = phi i32 [ %4, %for.body14 ], [ %right.1.i, %while.body.i ] %cmp.i = icmp slt i32 %left.0.i, %right.0.i br i1 %cmp.i, label %while.body.i, label %binary_search.exit while.body.i: ; preds = %while.cond.i %add.i = add nsw i32 %right.0.i, %left.0.i %div.i = sdiv i32 %add.i, 2 %idxprom.i = sext i32 %div.i to i64 %arrayidx.i = getelementptr inbounds i32, ptr %S, i64 %idxprom.i %8 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %cmp1.not.i = icmp eq i32 %8, %7 %cmp4.i = icmp slt i32 %8, %7 %add6.i = add nsw i32 %div.i, 1 %left.1.i = select i1 %cmp4.i, i32 %add6.i, i32 %left.0.i %right.1.i = select i1 %cmp4.i, i32 %right.0.i, i32 %div.i br i1 %cmp1.not.i, label %binary_search.exit, label %while.cond.i, !llvm.loop !9 binary_search.exit: ; preds = %while.cond.i, %while.body.i %retval.2.i = phi i32 [ 1, %while.body.i ], [ 0, %while.cond.i ] %add = add nuw nsw i32 %retval.2.i, %num.037 %indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1 %exitcond.not = icmp eq i64 %indvars.iv.next45, %wide.trip.count br i1 %exitcond.not, label %for.end20, label %for.body14, !llvm.loop !13 for.end20: ; preds = %binary_search.exit, %for.end, %for.cond12.preheader %num.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.end ], [ %add, %binary_search.exit ] %call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %num.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.end.p0(i64 200000, ptr nonnull %T) #4 call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %S) #4 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 attributes #0 = { nofree norecurse nosync nounwind memory(argmem: 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { 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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10}
#include<stdio.h> int main(void){ int a[100000], b[50000], count=0; int i, right, left, center, n, q; scanf("%d",&n); for(i=0; i<n; i++){ scanf("%d",&a[i]); } scanf("%d", &q); for(i=0; i<q; i++){ scanf("%d", &b[i]); } for(i=0; i<q; i++){ right = n; left = 0; while(left<=right){ center = (right + left)/2; if(a[center] == b[i]) { count++; break; } else if(a[center] < b[i]) left = center + 1; else right = center - 1; } } printf("%d\n", count); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185469/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185469/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca [100000 x i32], align 16 %b = alloca [50000 x i32], align 16 %n = alloca i32, align 4 %q = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %a) #3 call void @llvm.lifetime.start.p0(i64 200000, ptr nonnull %b) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp51 = icmp sgt i32 %0, 0 br i1 %cmp51, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %3 = load i32, ptr %q, align 4, !tbaa !5 %cmp453 = icmp sgt i32 %3, 0 br i1 %cmp453, label %for.body5, label %for.end33 for.cond12.preheader: ; preds = %for.body5 %cmp1358 = icmp sgt i32 %5, 0 br i1 %cmp1358, label %for.body14.lr.ph, label %for.end33 for.body14.lr.ph: ; preds = %for.cond12.preheader %4 = load i32, ptr %n, align 4, !tbaa !5 %cmp15.not55 = icmp slt i32 %4, 0 br i1 %cmp15.not55, label %for.end33, label %for.body14.preheader for.body14.preheader: ; preds = %for.body14.lr.ph %wide.trip.count = zext i32 %5 to i64 br label %for.body14 for.body5: ; preds = %for.end, %for.body5 %indvars.iv66 = phi i64 [ %indvars.iv.next67, %for.body5 ], [ 0, %for.end ] %arrayidx7 = getelementptr inbounds [50000 x i32], ptr %b, i64 0, i64 %indvars.iv66 %call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7) %indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1 %5 = load i32, ptr %q, align 4, !tbaa !5 %6 = sext i32 %5 to i64 %cmp4 = icmp slt i64 %indvars.iv.next67, %6 br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !11 for.body14: ; preds = %for.body14.preheader, %for.inc31 %indvars.iv69 = phi i64 [ 0, %for.body14.preheader ], [ %indvars.iv.next70, %for.inc31 ] %count.061 = phi i32 [ 0, %for.body14.preheader ], [ %count.1, %for.inc31 ] %arrayidx19 = getelementptr inbounds [50000 x i32], ptr %b, i64 0, i64 %indvars.iv69 %7 = load i32, ptr %arrayidx19, align 4, !tbaa !5 br label %while.body while.body: ; preds = %for.body14, %if.else %left.057 = phi i32 [ 0, %for.body14 ], [ %left.1, %if.else ] %right.056 = phi i32 [ %4, %for.body14 ], [ %right.1, %if.else ] %add = add nsw i32 %left.057, %right.056 %div = sdiv i32 %add, 2 %idxprom16 = sext i32 %div to i64 %arrayidx17 = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 %idxprom16 %8 = load i32, ptr %arrayidx17, align 4, !tbaa !5 %cmp20 = icmp eq i32 %8, %7 br i1 %cmp20, label %if.then, label %if.else if.then: ; preds = %while.body %inc21 = add nsw i32 %count.061, 1 br label %for.inc31 if.else: ; preds = %while.body %cmp26 = icmp slt i32 %8, %7 %add28 = add nsw i32 %div, 1 %sub = add nsw i32 %div, -1 %right.1 = select i1 %cmp26, i32 %right.056, i32 %sub %left.1 = select i1 %cmp26, i32 %add28, i32 %left.057 %cmp15.not = icmp sgt i32 %left.1, %right.1 br i1 %cmp15.not, label %for.inc31, label %while.body, !llvm.loop !12 for.inc31: ; preds = %if.else, %if.then %count.1 = phi i32 [ %inc21, %if.then ], [ %count.061, %if.else ] %indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1 %exitcond.not = icmp eq i64 %indvars.iv.next70, %wide.trip.count br i1 %exitcond.not, label %for.end33, label %for.body14, !llvm.loop !13 for.end33: ; preds = %for.inc31, %for.end, %for.body14.lr.ph, %for.cond12.preheader %count.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.body14.lr.ph ], [ 0, %for.end ], [ %count.1, %for.inc31 ] %call34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3 call void @llvm.lifetime.end.p0(i64 200000, ptr nonnull %b) #3 call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %a) #3 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 attributes #0 = { nofree 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 = { 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 #3 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10}
#include<stdio.h> #include<math.h> #include<stdlib.h> #define N 100000 #define Q 50000 int main(){ int i,n,q,j,S[N],T[Q],AI=0,left,right,mid; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&S[i]); } scanf("%d",&q); for(i=0;i<q;i++){ scanf("%d",&T[i]); } for(i=0;i<q;i++){ left=0; right=n; while(left<right){ mid=(left+right)/2; if(T[i]==S[mid]){ AI++; break; } if(T[i]>S[mid]) left=mid+1; else if(T[i]<S[mid]) right=mid; } } printf("%d\n",AI); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185526/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185526/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %q = alloca i32, align 4 %S = alloca [100000 x i32], align 16 %T = alloca [50000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #3 call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %S) #3 call void @llvm.lifetime.start.p0(i64 200000, ptr nonnull %T) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp59 = icmp sgt i32 %0, 0 br i1 %cmp59, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100000 x i32], ptr %S, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %3 = load i32, ptr %q, align 4, !tbaa !5 %cmp461 = icmp sgt i32 %3, 0 br i1 %cmp461, label %for.body5, label %for.end39 for.cond12.preheader: ; preds = %for.body5 %cmp1366 = icmp sgt i32 %7, 0 br i1 %cmp1366, label %for.body14.lr.ph, label %for.end39 for.body14.lr.ph: ; preds = %for.cond12.preheader %4 = load i32, ptr %n, align 4, !tbaa !5 %cmp1563 = icmp sgt i32 %4, 0 br i1 %cmp1563, label %for.body14.us.preheader, label %for.end39 for.body14.us.preheader: ; preds = %for.body14.lr.ph %wide.trip.count = zext i32 %7 to i64 br label %for.body14.us for.body14.us: ; preds = %for.body14.us.preheader, %for.inc37.us %indvars.iv77 = phi i64 [ 0, %for.body14.us.preheader ], [ %indvars.iv.next78, %for.inc37.us ] %AI.067.us = phi i32 [ 0, %for.body14.us.preheader ], [ %AI.1.us, %for.inc37.us ] %arrayidx17.us = getelementptr inbounds [50000 x i32], ptr %T, i64 0, i64 %indvars.iv77 %5 = load i32, ptr %arrayidx17.us, align 4, !tbaa !5 br label %while.body.us while.body.us: ; preds = %for.body14.us, %if.end.us %right.065.us = phi i32 [ %4, %for.body14.us ], [ %right.1.us, %if.end.us ] %left.064.us = phi i32 [ 0, %for.body14.us ], [ %left.1.us, %if.end.us ] %add.us = add nsw i32 %right.065.us, %left.064.us %div.us = sdiv i32 %add.us, 2 %idxprom18.us = sext i32 %div.us to i64 %arrayidx19.us = getelementptr inbounds [100000 x i32], ptr %S, i64 0, i64 %idxprom18.us %6 = load i32, ptr %arrayidx19.us, align 4, !tbaa !5 %cmp20.us = icmp eq i32 %5, %6 br i1 %cmp20.us, label %if.then.us, label %if.end.us if.end.us: ; preds = %while.body.us %cmp26.us = icmp sgt i32 %5, %6 %add28.us = add nsw i32 %div.us, 1 %cmp33.us = icmp slt i32 %5, %6 %spec.select.us = select i1 %cmp33.us, i32 %div.us, i32 %right.065.us %left.1.us = select i1 %cmp26.us, i32 %add28.us, i32 %left.064.us %right.1.us = select i1 %cmp26.us, i32 %right.065.us, i32 %spec.select.us %cmp15.us = icmp slt i32 %left.1.us, %right.1.us br i1 %cmp15.us, label %while.body.us, label %for.inc37.us, !llvm.loop !11 if.then.us: ; preds = %while.body.us %inc21.us = add nsw i32 %AI.067.us, 1 br label %for.inc37.us for.inc37.us: ; preds = %if.end.us, %if.then.us %AI.1.us = phi i32 [ %inc21.us, %if.then.us ], [ %AI.067.us, %if.end.us ] %indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1 %exitcond.not = icmp eq i64 %indvars.iv.next78, %wide.trip.count br i1 %exitcond.not, label %for.end39, label %for.body14.us, !llvm.loop !12 for.body5: ; preds = %for.end, %for.body5 %indvars.iv74 = phi i64 [ %indvars.iv.next75, %for.body5 ], [ 0, %for.end ] %arrayidx7 = getelementptr inbounds [50000 x i32], ptr %T, i64 0, i64 %indvars.iv74 %call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7) %indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, 1 %7 = load i32, ptr %q, align 4, !tbaa !5 %8 = sext i32 %7 to i64 %cmp4 = icmp slt i64 %indvars.iv.next75, %8 br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !13 for.end39: ; preds = %for.inc37.us, %for.end, %for.body14.lr.ph, %for.cond12.preheader %AI.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.body14.lr.ph ], [ 0, %for.end ], [ %AI.1.us, %for.inc37.us ] %call40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %AI.0.lcssa) call void @llvm.lifetime.end.p0(i64 200000, ptr nonnull %T) #3 call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %S) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 attributes #0 = { nofree 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 = { 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 #3 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10}
#include <stdio.h> int A[1000000], n; /* 二分探索 */ int binarySearch(int key) { int left = 0; int right = n; int mid; while(left < right) { mid = (left + right) / 2; if(key == A[mid]) return 1; /* keyを発見 */ if(key > A[mid]) left = mid + 1; /* 後半を探索 */ else if(key < A[mid]) right = mid; /* 前半を探索 */ } return 0; } int main(void) { int i, q, k, sum = 0; scanf("%d",&n); for(i=0; i<n; i++) { scanf("%d",&A[i]); } scanf("%d",&q); for(i=0;i<q;i++) { scanf("%d",&k); if(binarySearch(k)) sum++; } printf("%d\n",sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185577/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185577/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @n = dso_local global i32 0, align 4 @A = dso_local global [1000000 x i32] zeroinitializer, align 16 @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @binarySearch(i32 noundef %key) local_unnamed_addr #0 { entry: %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp23 = icmp sgt i32 %0, 0 br i1 %cmp23, label %while.body, label %cleanup while.body: ; preds = %entry, %if.end %right.025 = phi i32 [ %right.1, %if.end ], [ %0, %entry ] %left.024 = phi i32 [ %left.1, %if.end ], [ 0, %entry ] %add = add nsw i32 %right.025, %left.024 %div = sdiv i32 %add, 2 %idxprom = sext i32 %div to i64 %arrayidx = getelementptr inbounds [1000000 x i32], ptr @A, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp1 = icmp eq i32 %1, %key br i1 %cmp1, label %cleanup, label %if.end if.end: ; preds = %while.body %cmp4 = icmp slt i32 %1, %key %add6 = add nsw i32 %div, 1 %cmp9 = icmp sgt i32 %1, %key %spec.select = select i1 %cmp9, i32 %div, i32 %right.025 %left.1 = select i1 %cmp4, i32 %add6, i32 %left.024 %right.1 = select i1 %cmp4, i32 %right.025, i32 %spec.select %cmp = icmp slt i32 %left.1, %right.1 br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !9 cleanup: ; preds = %while.body, %if.end, %entry %retval.0 = phi i32 [ 0, %entry ], [ 0, %if.end ], [ 1, %while.body ] ret i32 %retval.0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %q = alloca i32, align 4 %k = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4 %call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n) %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp21 = icmp sgt i32 %0, 0 br i1 %cmp21, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [1000000 x i32], ptr @A, i64 0, i64 %indvars.iv %call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr @n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11 for.end: ; preds = %for.body, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %3 = load i32, ptr %q, align 4, !tbaa !5 %cmp423 = icmp sgt i32 %3, 0 br i1 %cmp423, label %for.body5, label %for.end11 for.body5: ; preds = %for.end, %for.cond3 %sum.025 = phi i32 [ %7, %for.cond3 ], [ 0, %for.end ] %i.124 = phi i32 [ %inc10, %for.cond3 ], [ 0, %for.end ] %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k) %4 = load i32, ptr %k, align 4, !tbaa !5 %5 = load i32, ptr @n, align 4, !tbaa !5 %cmp23.i = icmp sgt i32 %5, 0 br i1 %cmp23.i, label %while.body.i, label %for.cond3 while.body.i: ; preds = %for.body5, %if.end.i %right.025.i = phi i32 [ %right.1.i, %if.end.i ], [ %5, %for.body5 ] %left.024.i = phi i32 [ %left.1.i, %if.end.i ], [ 0, %for.body5 ] %add.i = add nsw i32 %left.024.i, %right.025.i %div.i = sdiv i32 %add.i, 2 %idxprom.i = sext i32 %div.i to i64 %arrayidx.i = getelementptr inbounds [1000000 x i32], ptr @A, i64 0, i64 %idxprom.i %6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %cmp1.i = icmp eq i32 %6, %4 br i1 %cmp1.i, label %binarySearch.exit, label %if.end.i if.end.i: ; preds = %while.body.i %cmp4.i = icmp slt i32 %6, %4 %add6.i = add nsw i32 %div.i, 1 %cmp9.i = icmp sgt i32 %6, %4 %spec.select.i = select i1 %cmp9.i, i32 %div.i, i32 %right.025.i %left.1.i = select i1 %cmp4.i, i32 %add6.i, i32 %left.024.i %right.1.i = select i1 %cmp4.i, i32 %right.025.i, i32 %spec.select.i %cmp.i = icmp slt i32 %left.1.i, %right.1.i br i1 %cmp.i, label %while.body.i, label %for.cond3, !llvm.loop !9 binarySearch.exit: ; preds = %while.body.i %inc8 = add nsw i32 %sum.025, 1 br label %for.cond3 for.cond3: ; preds = %if.end.i, %for.body5, %binarySearch.exit %7 = phi i32 [ %inc8, %binarySearch.exit ], [ %sum.025, %for.body5 ], [ %sum.025, %if.end.i ] %inc10 = add nuw nsw i32 %i.124, 1 %8 = load i32, ptr %q, align 4, !tbaa !5 %cmp4 = icmp slt i32 %inc10, %8 br i1 %cmp4, label %for.body5, label %for.end11, !llvm.loop !12 for.end11: ; preds = %for.cond3, %for.end %sum.0.lcssa = phi i32 [ 0, %for.end ], [ %7, %for.cond3 ] %call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 attributes #0 = { nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) 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 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { 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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10}
#include <stdio.h> int main() { int t,n,i,j; scanf("%d",&t); for(i=1;i<=t;i++) { scanf("%d",&n); for(j=n;j>1;j--) { printf("%d ",j); } printf("1\n"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_18562/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_18562/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1 @str = private unnamed_addr constant [2 x i8] c"1\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %t = alloca i32, align 4 %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t) %0 = load i32, ptr %t, align 4, !tbaa !5 %cmp.not14 = icmp slt i32 %0, 1 br i1 %cmp.not14, label %for.end8, label %for.body for.body: ; preds = %entry, %for.end %i.015 = phi i32 [ %inc, %for.end ], [ 1, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %1 = load i32, ptr %n, align 4, !tbaa !5 %cmp312 = icmp sgt i32 %1, 1 br i1 %cmp312, label %for.body4, label %for.end for.body4: ; preds = %for.body, %for.body4 %j.013 = phi i32 [ %dec, %for.body4 ], [ %1, %for.body ] %call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %j.013) %dec = add nsw i32 %j.013, -1 %cmp3 = icmp ugt i32 %j.013, 2 br i1 %cmp3, label %for.body4, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body4, %for.body %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) %inc = add nuw nsw i32 %i.015, 1 %2 = load i32, ptr %t, align 4, !tbaa !5 %cmp.not.not = icmp slt i32 %i.015, %2 br i1 %cmp.not.not, label %for.body, label %for.end8, !llvm.loop !11 for.end8: ; preds = %for.end, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3 attributes #0 = { nofree 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 = { 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 #3 = { nofree nounwind } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10}
#include<stdio.h> int A[1000000], n; int binarySearch(int key) { int left = 0; int right = n; int mid; while ( left < right ) { mid = (left + right) / 2; if ( key == A[mid] ) return 1; if ( key > A[mid] ) left = mid + 1; else if ( key < A[mid] ) right = mid; } return 0; } int main() { int i, q, k, sum = 0; scanf("%d", &n); for (i = 0; i < n; i++ ) { scanf("%d", &A[i]); } scanf("%d", &q); for (i = 0; i < q; i++ ) { scanf("%d", &k); if ( binarySearch( k ) ) sum++; } printf("%d\n", sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185670/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185670/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @n = dso_local global i32 0, align 4 @A = dso_local global [1000000 x i32] zeroinitializer, align 16 @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @binarySearch(i32 noundef %key) local_unnamed_addr #0 { entry: %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp23 = icmp sgt i32 %0, 0 br i1 %cmp23, label %while.body, label %cleanup while.body: ; preds = %entry, %if.end %right.025 = phi i32 [ %right.1, %if.end ], [ %0, %entry ] %left.024 = phi i32 [ %left.1, %if.end ], [ 0, %entry ] %add = add nsw i32 %right.025, %left.024 %div = sdiv i32 %add, 2 %idxprom = sext i32 %div to i64 %arrayidx = getelementptr inbounds [1000000 x i32], ptr @A, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp1 = icmp eq i32 %1, %key br i1 %cmp1, label %cleanup, label %if.end if.end: ; preds = %while.body %cmp4 = icmp slt i32 %1, %key %add6 = add nsw i32 %div, 1 %cmp9 = icmp sgt i32 %1, %key %spec.select = select i1 %cmp9, i32 %div, i32 %right.025 %left.1 = select i1 %cmp4, i32 %add6, i32 %left.024 %right.1 = select i1 %cmp4, i32 %right.025, i32 %spec.select %cmp = icmp slt i32 %left.1, %right.1 br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !9 cleanup: ; preds = %while.body, %if.end, %entry %retval.0 = phi i32 [ 0, %entry ], [ 0, %if.end ], [ 1, %while.body ] ret i32 %retval.0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %q = alloca i32, align 4 %k = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4 %call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n) %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp21 = icmp sgt i32 %0, 0 br i1 %cmp21, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [1000000 x i32], ptr @A, i64 0, i64 %indvars.iv %call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr @n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11 for.end: ; preds = %for.body, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %3 = load i32, ptr %q, align 4, !tbaa !5 %cmp423 = icmp sgt i32 %3, 0 br i1 %cmp423, label %for.body5, label %for.end11 for.body5: ; preds = %for.end, %for.cond3 %sum.025 = phi i32 [ %7, %for.cond3 ], [ 0, %for.end ] %i.124 = phi i32 [ %inc10, %for.cond3 ], [ 0, %for.end ] %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k) %4 = load i32, ptr %k, align 4, !tbaa !5 %5 = load i32, ptr @n, align 4, !tbaa !5 %cmp23.i = icmp sgt i32 %5, 0 br i1 %cmp23.i, label %while.body.i, label %for.cond3 while.body.i: ; preds = %for.body5, %if.end.i %right.025.i = phi i32 [ %right.1.i, %if.end.i ], [ %5, %for.body5 ] %left.024.i = phi i32 [ %left.1.i, %if.end.i ], [ 0, %for.body5 ] %add.i = add nsw i32 %left.024.i, %right.025.i %div.i = sdiv i32 %add.i, 2 %idxprom.i = sext i32 %div.i to i64 %arrayidx.i = getelementptr inbounds [1000000 x i32], ptr @A, i64 0, i64 %idxprom.i %6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %cmp1.i = icmp eq i32 %6, %4 br i1 %cmp1.i, label %binarySearch.exit, label %if.end.i if.end.i: ; preds = %while.body.i %cmp4.i = icmp slt i32 %6, %4 %add6.i = add nsw i32 %div.i, 1 %cmp9.i = icmp sgt i32 %6, %4 %spec.select.i = select i1 %cmp9.i, i32 %div.i, i32 %right.025.i %left.1.i = select i1 %cmp4.i, i32 %add6.i, i32 %left.024.i %right.1.i = select i1 %cmp4.i, i32 %right.025.i, i32 %spec.select.i %cmp.i = icmp slt i32 %left.1.i, %right.1.i br i1 %cmp.i, label %while.body.i, label %for.cond3, !llvm.loop !9 binarySearch.exit: ; preds = %while.body.i %inc8 = add nsw i32 %sum.025, 1 br label %for.cond3 for.cond3: ; preds = %if.end.i, %for.body5, %binarySearch.exit %7 = phi i32 [ %inc8, %binarySearch.exit ], [ %sum.025, %for.body5 ], [ %sum.025, %if.end.i ] %inc10 = add nuw nsw i32 %i.124, 1 %8 = load i32, ptr %q, align 4, !tbaa !5 %cmp4 = icmp slt i32 %inc10, %8 br i1 %cmp4, label %for.body5, label %for.end11, !llvm.loop !12 for.end11: ; preds = %for.cond3, %for.end %sum.0.lcssa = phi i32 [ 0, %for.end ], [ %7, %for.cond3 ] %call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 attributes #0 = { nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) 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 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { 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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10}
#include<stdio.h> int A[100000],n; int binarySearch(int key){ int left =0,right = n,mid; while(left < right){ mid = (left+right)/2; if(A[mid]==key){ return mid; } else if(key<A[mid]){ right = mid; } else left=mid+1; } return -1; } int main() { int i,q,key,sum=0; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&A[i]); } scanf("%d",&q); for(i=0;i<q;i++){ scanf("%d",&key); if(binarySearch(key)!=-1){ sum++; } } printf("%d\n",sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185713/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185713/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @n = dso_local global i32 0, align 4 @A = dso_local global [100000 x i32] zeroinitializer, align 16 @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @binarySearch(i32 noundef %key) local_unnamed_addr #0 { entry: %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp18 = icmp sgt i32 %0, 0 br i1 %cmp18, label %while.body, label %cleanup while.body: ; preds = %entry, %if.else %right.020 = phi i32 [ %right.1, %if.else ], [ %0, %entry ] %left.019 = phi i32 [ %left.1, %if.else ], [ 0, %entry ] %add = add nsw i32 %right.020, %left.019 %div = sdiv i32 %add, 2 %idxprom = sext i32 %div to i64 %arrayidx = getelementptr inbounds [100000 x i32], ptr @A, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp1 = icmp eq i32 %1, %key br i1 %cmp1, label %cleanup, label %if.else if.else: ; preds = %while.body %cmp4 = icmp sgt i32 %1, %key %add7 = add nsw i32 %div, 1 %left.1 = select i1 %cmp4, i32 %left.019, i32 %add7 %right.1 = select i1 %cmp4, i32 %div, i32 %right.020 %cmp = icmp slt i32 %left.1, %right.1 br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !9 cleanup: ; preds = %while.body, %if.else, %entry %retval.0 = phi i32 [ -1, %entry ], [ -1, %if.else ], [ %div, %while.body ] ret i32 %retval.0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %q = alloca i32, align 4 %key = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %key) #4 %call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n) %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp24 = icmp sgt i32 %0, 0 br i1 %cmp24, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100000 x i32], ptr @A, i64 0, i64 %indvars.iv %call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr @n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11 for.end: ; preds = %for.body, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %3 = load i32, ptr %q, align 4, !tbaa !5 %cmp426 = icmp sgt i32 %3, 0 br i1 %cmp426, label %for.body5, label %for.end12 for.body5: ; preds = %for.end, %for.cond3 %sum.028 = phi i32 [ %7, %for.cond3 ], [ 0, %for.end ] %i.127 = phi i32 [ %inc11, %for.cond3 ], [ 0, %for.end ] %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %key) %4 = load i32, ptr %key, align 4, !tbaa !5 %5 = load i32, ptr @n, align 4, !tbaa !5 %cmp18.i = icmp sgt i32 %5, 0 br i1 %cmp18.i, label %while.body.i, label %binarySearch.exit.thread while.body.i: ; preds = %for.body5, %if.else.i %right.020.i = phi i32 [ %right.1.i, %if.else.i ], [ %5, %for.body5 ] %left.019.i = phi i32 [ %left.1.i, %if.else.i ], [ 0, %for.body5 ] %add.i = add nsw i32 %left.019.i, %right.020.i %add.i.fr = freeze i32 %add.i %div.i = sdiv i32 %add.i.fr, 2 %idxprom.i = sext i32 %div.i to i64 %arrayidx.i = getelementptr inbounds [100000 x i32], ptr @A, i64 0, i64 %idxprom.i %6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %cmp1.i = icmp eq i32 %6, %4 br i1 %cmp1.i, label %binarySearch.exit, label %if.else.i if.else.i: ; preds = %while.body.i %cmp4.i = icmp sgt i32 %6, %4 %add7.i = add nsw i32 %div.i, 1 %left.1.i = select i1 %cmp4.i, i32 %left.019.i, i32 %add7.i %right.1.i = select i1 %cmp4.i, i32 %div.i, i32 %right.020.i %cmp.i = icmp slt i32 %left.1.i, %right.1.i br i1 %cmp.i, label %while.body.i, label %binarySearch.exit.thread, !llvm.loop !9 binarySearch.exit: ; preds = %while.body.i %add.i.off = add i32 %add.i.fr, 3 %cmp8.not = icmp ult i32 %add.i.off, 2 %inc9 = add nsw i32 %sum.028, 1 br i1 %cmp8.not, label %binarySearch.exit.thread, label %for.cond3 binarySearch.exit.thread: ; preds = %if.else.i, %for.body5, %binarySearch.exit br label %for.cond3 for.cond3: ; preds = %binarySearch.exit, %binarySearch.exit.thread %7 = phi i32 [ %sum.028, %binarySearch.exit.thread ], [ %inc9, %binarySearch.exit ] %inc11 = add nuw nsw i32 %i.127, 1 %8 = load i32, ptr %q, align 4, !tbaa !5 %cmp4 = icmp slt i32 %inc11, %8 br i1 %cmp4, label %for.body5, label %for.end12, !llvm.loop !12 for.end12: ; preds = %for.cond3, %for.end %sum.0.lcssa = phi i32 [ 0, %for.end ], [ %7, %for.cond3 ] %call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %key) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 attributes #0 = { nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) 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 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { 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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10}
#include<stdio.h> #define N 100000 #define Q 50000 int binary(int n,int A[],int key){ int left,right,mid; left=0; right=n; while(left<right){ mid=(left+right)/2; if(A[mid]==key)return 1; else if(key<A[mid]) right=mid; else left=mid+1; } return 0; } int main(){ int i,n,q,key,S[N],T[Q],cnt=0; scanf("%d",&n); for(i=0;i<n;i++) scanf("%d",&S[i]); scanf("%d",&q); for(i=0;i<q;i++) scanf("%d",&T[i]); for(i=0;i<q;i++){ if(binary(n,S,T[i])==1)cnt++; } printf("%d\n",cnt); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185757/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185757/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable define dso_local i32 @binary(i32 noundef %n, ptr nocapture noundef readonly %A, i32 noundef %key) local_unnamed_addr #0 { entry: %cmp18 = icmp sgt i32 %n, 0 br i1 %cmp18, label %while.body, label %cleanup while.body: ; preds = %entry, %if.else %right.020 = phi i32 [ %right.1, %if.else ], [ %n, %entry ] %left.019 = phi i32 [ %left.1, %if.else ], [ 0, %entry ] %add = add nsw i32 %right.020, %left.019 %div = sdiv i32 %add, 2 %idxprom = sext i32 %div to i64 %arrayidx = getelementptr inbounds i32, ptr %A, i64 %idxprom %0 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp1 = icmp eq i32 %0, %key br i1 %cmp1, label %cleanup, label %if.else if.else: ; preds = %while.body %cmp4 = icmp sgt i32 %0, %key %add7 = add nsw i32 %div, 1 %left.1 = select i1 %cmp4, i32 %left.019, i32 %add7 %right.1 = select i1 %cmp4, i32 %div, i32 %right.020 %cmp = icmp slt i32 %left.1, %right.1 br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !9 cleanup: ; preds = %while.body, %if.else, %entry %retval.0 = phi i32 [ 0, %entry ], [ 0, %if.else ], [ 1, %while.body ] ret i32 %retval.0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %n = alloca i32, align 4 %q = alloca i32, align 4 %S = alloca [100000 x i32], align 16 %T = alloca [50000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4 call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %S) #4 call void @llvm.lifetime.start.p0(i64 200000, ptr nonnull %T) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp36 = icmp sgt i32 %0, 0 br i1 %cmp36, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100000 x i32], ptr %S, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11 for.end: ; preds = %for.body, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %3 = load i32, ptr %q, align 4, !tbaa !5 %cmp438 = icmp sgt i32 %3, 0 br i1 %cmp438, label %for.body5, label %for.end22 for.cond12.preheader: ; preds = %for.body5 %cmp1340 = icmp sgt i32 %8, 0 br i1 %cmp1340, label %for.body14.lr.ph, label %for.end22 for.body14.lr.ph: ; preds = %for.cond12.preheader %4 = load i32, ptr %n, align 4, !tbaa !5 %cmp18.i = icmp sgt i32 %4, 0 br i1 %cmp18.i, label %for.body14.us.preheader, label %for.end22 for.body14.us.preheader: ; preds = %for.body14.lr.ph %wide.trip.count = zext i32 %8 to i64 br label %for.body14.us for.body14.us: ; preds = %for.body14.us.preheader, %for.cond12.us %indvars.iv51 = phi i64 [ 0, %for.body14.us.preheader ], [ %indvars.iv.next52, %for.cond12.us ] %cnt.042.us = phi i32 [ 0, %for.body14.us.preheader ], [ %7, %for.cond12.us ] %arrayidx16.us = getelementptr inbounds [50000 x i32], ptr %T, i64 0, i64 %indvars.iv51 %5 = load i32, ptr %arrayidx16.us, align 4, !tbaa !5 br label %while.body.i.us while.body.i.us: ; preds = %for.body14.us, %if.else.i.us %right.020.i.us = phi i32 [ %right.1.i.us, %if.else.i.us ], [ %4, %for.body14.us ] %left.019.i.us = phi i32 [ %left.1.i.us, %if.else.i.us ], [ 0, %for.body14.us ] %add.i.us = add nsw i32 %left.019.i.us, %right.020.i.us %div.i.us = sdiv i32 %add.i.us, 2 %idxprom.i.us = sext i32 %div.i.us to i64 %arrayidx.i.us = getelementptr inbounds i32, ptr %S, i64 %idxprom.i.us %6 = load i32, ptr %arrayidx.i.us, align 4, !tbaa !5 %cmp1.i.us = icmp eq i32 %6, %5 br i1 %cmp1.i.us, label %binary.exit.us, label %if.else.i.us if.else.i.us: ; preds = %while.body.i.us %cmp4.i.us = icmp sgt i32 %6, %5 %add7.i.us = add nsw i32 %div.i.us, 1 %left.1.i.us = select i1 %cmp4.i.us, i32 %left.019.i.us, i32 %add7.i.us %right.1.i.us = select i1 %cmp4.i.us, i32 %div.i.us, i32 %right.020.i.us %cmp.i.us = icmp slt i32 %left.1.i.us, %right.1.i.us br i1 %cmp.i.us, label %while.body.i.us, label %for.cond12.us, !llvm.loop !9 binary.exit.us: ; preds = %while.body.i.us %inc19.us = add nsw i32 %cnt.042.us, 1 br label %for.cond12.us for.cond12.us: ; preds = %if.else.i.us, %binary.exit.us %7 = phi i32 [ %inc19.us, %binary.exit.us ], [ %cnt.042.us, %if.else.i.us ] %indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1 %exitcond.not = icmp eq i64 %indvars.iv.next52, %wide.trip.count br i1 %exitcond.not, label %for.end22, label %for.body14.us, !llvm.loop !12 for.body5: ; preds = %for.end, %for.body5 %indvars.iv48 = phi i64 [ %indvars.iv.next49, %for.body5 ], [ 0, %for.end ] %arrayidx7 = getelementptr inbounds [50000 x i32], ptr %T, i64 0, i64 %indvars.iv48 %call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7) %indvars.iv.next49 = add nuw nsw i64 %indvars.iv48, 1 %8 = load i32, ptr %q, align 4, !tbaa !5 %9 = sext i32 %8 to i64 %cmp4 = icmp slt i64 %indvars.iv.next49, %9 br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !13 for.end22: ; preds = %for.cond12.us, %for.end, %for.body14.lr.ph, %for.cond12.preheader %cnt.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.body14.lr.ph ], [ 0, %for.end ], [ %7, %for.cond12.us ] %call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.0.lcssa) call void @llvm.lifetime.end.p0(i64 200000, ptr nonnull %T) #4 call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %S) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 attributes #0 = { nofree norecurse nosync nounwind memory(argmem: 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { 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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10}
#include <stdlib.h> #include <stdio.h> int get_int(); int max(int a, int b) { if (a > b) { return a; } return b; } int min(int a, int b) { if (a < b) { return a; } return b; } int cmp(const void* p1, const void* p2) { return *(int*)p1 - *(int*)p2; } typedef struct { int x, y; } par; int main() { int i; int n = get_int(); par a[n]; int b[n]; for (i = 0; i < n; i++) { a[i].x = get_int() - 1; a[i].y = get_int() - 1; } b[0] = 0; if (a[a[0].x].x == a[0].y || a[a[0].x].y == a[0].y) { b[1] = a[0].x; b[2] = a[0].y; } else { b[1] = a[0].y; b[2] = a[0].x; } for (i = 3; i < n; i++) { int x = a[b[i - 2]].x; int y = a[b[i - 2]].y; //printf(">> %d %d %d\n", i, x, y); if (x == b[i - 1]) { b[i] = y; } else { b[i] = x; } } for (i = 0; i < n; i++) { printf("%d ", b[i] + 1); } printf("\n"); return 0; } int get_int() { int ret = 0; char c = getchar(); int sgn; while (1) { if (c == EOF) { return EOF; } if (c >= '0' && c <= '9') { sgn = 1; break; } if (c == '-') { c = getchar(); if (c < '0' || c > '9') { continue; } sgn = -1; break; } c = getchar(); } while (1) { ret = (ret << 3) + (ret << 1) + c - '0'; c = getchar(); if (c < '0' || c > '9') { return sgn*ret; } } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_18580/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_18580/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" %struct.par = type { i32, i32 } @.str = private unnamed_addr constant [4 x i8] c"%d \00", align 1 @stdin = external local_unnamed_addr global ptr, align 8 ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i32 @max(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 { entry: %a.b = tail call i32 @llvm.smax.i32(i32 %a, i32 %b) ret i32 %a.b } ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 { entry: %a.b = tail call i32 @llvm.smin.i32(i32 %a, i32 %b) ret i32 %a.b } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @cmp(ptr nocapture noundef readonly %p1, ptr nocapture noundef readonly %p2) local_unnamed_addr #1 { entry: %0 = load i32, ptr %p1, align 4, !tbaa !5 %1 = load i32, ptr %p2, align 4, !tbaa !5 %sub = sub nsw i32 %0, %1 ret i32 %sub } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %0 = load ptr, ptr @stdin, align 8, !tbaa !9 %call.i.i = tail call i32 @getc(ptr noundef %0) %conv.i = trunc i32 %call.i.i to i8 %cmp62.i = icmp eq i8 %conv.i, -1 br i1 %cmp62.i, label %get_int.exit.thread, label %if.end.i if.end.i: ; preds = %entry, %while.cond.backedge.i %c.063.i = phi i8 [ %conv16.i, %while.cond.backedge.i ], [ %conv.i, %entry ] %1 = add i8 %c.063.i, -48 %or.cond.i = icmp ult i8 %1, 10 br i1 %or.cond.i, label %while.end.i, label %if.end10.i if.end10.i: ; preds = %if.end.i %cmp12.i = icmp eq i8 %c.063.i, 45 %2 = load ptr, ptr @stdin, align 8, !tbaa !9 %call.i59.i = tail call i32 @getc(ptr noundef %2) %conv16.i = trunc i32 %call.i59.i to i8 br i1 %cmp12.i, label %if.then14.i, label %while.cond.backedge.i if.then14.i: ; preds = %if.end10.i %sext.i = shl i32 %call.i59.i, 24 %3 = add i32 %sext.i, -956301313 %or.cond46.i = icmp ult i32 %3, -150994945 br i1 %or.cond46.i, label %while.cond.backedge.i, label %while.end.i while.cond.backedge.i: ; preds = %if.then14.i, %if.end10.i %cmp.i = icmp eq i8 %conv16.i, -1 br i1 %cmp.i, label %get_int.exit.thread, label %if.end.i while.end.i: ; preds = %if.then14.i, %if.end.i %c.1.i = phi i8 [ %c.063.i, %if.end.i ], [ %conv16.i, %if.then14.i ] %sgn.0.i = phi i32 [ 1, %if.end.i ], [ -1, %if.then14.i ] br label %while.cond28.i while.cond28.i: ; preds = %while.cond28.i, %while.end.i %ret.0.i = phi i32 [ 0, %while.end.i ], [ %sub.i, %while.cond28.i ] %c.2.i = phi i8 [ %c.1.i, %while.end.i ], [ %conv34.i, %while.cond28.i ] %add.i = mul i32 %ret.0.i, 10 %conv31.i = sext i8 %c.2.i to i32 %add32.i = add i32 %add.i, -48 %sub.i = add i32 %add32.i, %conv31.i %4 = load ptr, ptr @stdin, align 8, !tbaa !9 %call.i61.i = tail call i32 @getc(ptr noundef %4) %conv34.i = trunc i32 %call.i61.i to i8 %sext58.i = shl i32 %call.i61.i, 24 %5 = add i32 %sext58.i, -956301313 %or.cond47.i = icmp ult i32 %5, -150994945 br i1 %or.cond47.i, label %get_int.exit, label %while.cond28.i get_int.exit.thread: ; preds = %while.cond.backedge.i, %entry %vla188230 = alloca [4294967295 x %struct.par], align 16 %vla1189231 = alloca [4294967295 x i32], align 16 br label %lor.lhs.false.thread get_int.exit: ; preds = %while.cond28.i %mul.i = mul nsw i32 %sub.i, %sgn.0.i %6 = zext i32 %mul.i to i64 %vla = alloca %struct.par, i64 %6, align 16 %vla1 = alloca i32, i64 %6, align 16 %cmp162 = icmp sgt i32 %mul.i, 0 br i1 %cmp162, label %for.body, label %lor.lhs.false.thread for.body: ; preds = %get_int.exit, %get_int.exit161 %indvars.iv = phi i64 [ %indvars.iv.next, %get_int.exit161 ], [ 0, %get_int.exit ] %7 = load ptr, ptr @stdin, align 8, !tbaa !9 %call.i.i96 = tail call i32 @getc(ptr noundef %7) %conv.i97 = trunc i32 %call.i.i96 to i8 %cmp62.i98 = icmp eq i8 %conv.i97, -1 br i1 %cmp62.i98, label %get_int.exit128, label %if.end.i99 if.end.i99: ; preds = %for.body, %while.cond.backedge.i106 %c.063.i100 = phi i8 [ %conv16.i105, %while.cond.backedge.i106 ], [ %conv.i97, %for.body ] %8 = add i8 %c.063.i100, -48 %or.cond.i101 = icmp ult i8 %8, 10 br i1 %or.cond.i101, label %while.end.i112, label %if.end10.i102 if.end10.i102: ; preds = %if.end.i99 %cmp12.i103 = icmp eq i8 %c.063.i100, 45 %9 = load ptr, ptr @stdin, align 8, !tbaa !9 %call.i59.i104 = tail call i32 @getc(ptr noundef %9) %conv16.i105 = trunc i32 %call.i59.i104 to i8 br i1 %cmp12.i103, label %if.then14.i109, label %while.cond.backedge.i106 if.then14.i109: ; preds = %if.end10.i102 %sext.i110 = shl i32 %call.i59.i104, 24 %10 = add i32 %sext.i110, -956301313 %or.cond46.i111 = icmp ult i32 %10, -150994945 br i1 %or.cond46.i111, label %while.cond.backedge.i106, label %while.end.i112 while.cond.backedge.i106: ; preds = %if.then14.i109, %if.end10.i102 %cmp.i107 = icmp eq i8 %conv16.i105, -1 br i1 %cmp.i107, label %get_int.exit128, label %if.end.i99 while.end.i112: ; preds = %if.then14.i109, %if.end.i99 %c.1.i113 = phi i8 [ %c.063.i100, %if.end.i99 ], [ %conv16.i105, %if.then14.i109 ] %sgn.0.i114 = phi i32 [ 1, %if.end.i99 ], [ -1, %if.then14.i109 ] br label %while.cond28.i115 while.cond28.i115: ; preds = %while.cond28.i115, %while.end.i112 %ret.0.i116 = phi i32 [ 0, %while.end.i112 ], [ %sub.i121, %while.cond28.i115 ] %c.2.i117 = phi i8 [ %c.1.i113, %while.end.i112 ], [ %conv34.i123, %while.cond28.i115 ] %add.i118 = mul i32 %ret.0.i116, 10 %conv31.i119 = sext i8 %c.2.i117 to i32 %add32.i120 = add i32 %add.i118, -48 %sub.i121 = add i32 %add32.i120, %conv31.i119 %11 = load ptr, ptr @stdin, align 8, !tbaa !9 %call.i61.i122 = tail call i32 @getc(ptr noundef %11) %conv34.i123 = trunc i32 %call.i61.i122 to i8 %sext58.i124 = shl i32 %call.i61.i122, 24 %12 = add i32 %sext58.i124, -956301313 %or.cond47.i125 = icmp ult i32 %12, -150994945 br i1 %or.cond47.i125, label %if.then42.i126, label %while.cond28.i115 if.then42.i126: ; preds = %while.cond28.i115 %mul.i127 = mul nsw i32 %sub.i121, %sgn.0.i114 br label %get_int.exit128 get_int.exit128: ; preds = %while.cond.backedge.i106, %for.body, %if.then42.i126 %retval.0.i108 = phi i32 [ %mul.i127, %if.then42.i126 ], [ -1, %for.body ], [ -1, %while.cond.backedge.i106 ] %sub = add nsw i32 %retval.0.i108, -1 %arrayidx = getelementptr inbounds %struct.par, ptr %vla, i64 %indvars.iv store i32 %sub, ptr %arrayidx, align 8, !tbaa !11 %13 = load ptr, ptr @stdin, align 8, !tbaa !9 %call.i.i129 = tail call i32 @getc(ptr noundef %13) %conv.i130 = trunc i32 %call.i.i129 to i8 %cmp62.i131 = icmp eq i8 %conv.i130, -1 br i1 %cmp62.i131, label %get_int.exit161, label %if.end.i132 if.end.i132: ; preds = %get_int.exit128, %while.cond.backedge.i139 %c.063.i133 = phi i8 [ %conv16.i138, %while.cond.backedge.i139 ], [ %conv.i130, %get_int.exit128 ] %14 = add i8 %c.063.i133, -48 %or.cond.i134 = icmp ult i8 %14, 10 br i1 %or.cond.i134, label %while.end.i145, label %if.end10.i135 if.end10.i135: ; preds = %if.end.i132 %cmp12.i136 = icmp eq i8 %c.063.i133, 45 %15 = load ptr, ptr @stdin, align 8, !tbaa !9 %call.i59.i137 = tail call i32 @getc(ptr noundef %15) %conv16.i138 = trunc i32 %call.i59.i137 to i8 br i1 %cmp12.i136, label %if.then14.i142, label %while.cond.backedge.i139 if.then14.i142: ; preds = %if.end10.i135 %sext.i143 = shl i32 %call.i59.i137, 24 %16 = add i32 %sext.i143, -956301313 %or.cond46.i144 = icmp ult i32 %16, -150994945 br i1 %or.cond46.i144, label %while.cond.backedge.i139, label %while.end.i145 while.cond.backedge.i139: ; preds = %if.then14.i142, %if.end10.i135 %cmp.i140 = icmp eq i8 %conv16.i138, -1 br i1 %cmp.i140, label %get_int.exit161, label %if.end.i132 while.end.i145: ; preds = %if.then14.i142, %if.end.i132 %c.1.i146 = phi i8 [ %c.063.i133, %if.end.i132 ], [ %conv16.i138, %if.then14.i142 ] %sgn.0.i147 = phi i32 [ 1, %if.end.i132 ], [ -1, %if.then14.i142 ] br label %while.cond28.i148 while.cond28.i148: ; preds = %while.cond28.i148, %while.end.i145 %ret.0.i149 = phi i32 [ 0, %while.end.i145 ], [ %sub.i154, %while.cond28.i148 ] %c.2.i150 = phi i8 [ %c.1.i146, %while.end.i145 ], [ %conv34.i156, %while.cond28.i148 ] %add.i151 = mul i32 %ret.0.i149, 10 %conv31.i152 = sext i8 %c.2.i150 to i32 %add32.i153 = add i32 %add.i151, -48 %sub.i154 = add i32 %add32.i153, %conv31.i152 %17 = load ptr, ptr @stdin, align 8, !tbaa !9 %call.i61.i155 = tail call i32 @getc(ptr noundef %17) %conv34.i156 = trunc i32 %call.i61.i155 to i8 %sext58.i157 = shl i32 %call.i61.i155, 24 %18 = add i32 %sext58.i157, -956301313 %or.cond47.i158 = icmp ult i32 %18, -150994945 br i1 %or.cond47.i158, label %if.then42.i159, label %while.cond28.i148 if.then42.i159: ; preds = %while.cond28.i148 %mul.i160 = mul nsw i32 %sub.i154, %sgn.0.i147 br label %get_int.exit161 get_int.exit161: ; preds = %while.cond.backedge.i139, %get_int.exit128, %if.then42.i159 %retval.0.i141 = phi i32 [ %mul.i160, %if.then42.i159 ], [ -1, %get_int.exit128 ], [ -1, %while.cond.backedge.i139 ] %sub4 = add nsw i32 %retval.0.i141, -1 %y = getelementptr inbounds %struct.par, ptr %vla, i64 %indvars.iv, i32 1 store i32 %sub4, ptr %y, align 4, !tbaa !13 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %6 br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !14 lor.lhs.false.thread: ; preds = %get_int.exit, %get_int.exit.thread %vla1195.ph = phi ptr [ %vla1, %get_int.exit ], [ %vla1189231, %get_int.exit.thread ] %vla193.ph = phi ptr [ %vla, %get_int.exit ], [ %vla188230, %get_int.exit.thread ] %.ph = phi i64 [ %6, %get_int.exit ], [ 4294967295, %get_int.exit.thread ] %retval.0.i191.ph = phi i32 [ %mul.i, %get_int.exit ], [ -1, %get_int.exit.thread ] store i32 0, ptr %vla1195.ph, align 16, !tbaa !5 br label %if.else for.end: ; preds = %get_int.exit161 %.pre = load i32, ptr %vla, align 16, !tbaa !11 %idxprom10.phi.trans.insert = sext i32 %.pre to i64 %arrayidx11.phi.trans.insert = getelementptr inbounds %struct.par, ptr %vla, i64 %idxprom10.phi.trans.insert %.pre181 = load i32, ptr %arrayidx11.phi.trans.insert, align 8, !tbaa !11 %y14.phi.trans.insert = getelementptr inbounds %struct.par, ptr %vla, i64 0, i32 1 %.pre182 = load i32, ptr %y14.phi.trans.insert, align 4, !tbaa !13 store i32 0, ptr %vla1, align 16, !tbaa !5 %cmp15 = icmp eq i32 %.pre181, %.pre182 br i1 %cmp15, label %if.end, label %lor.lhs.false lor.lhs.false: ; preds = %for.end %idxprom10 = sext i32 %.pre to i64 %y20 = getelementptr inbounds %struct.par, ptr %vla, i64 %idxprom10, i32 1 %19 = load i32, ptr %y20, align 4, !tbaa !13 %cmp23 = icmp eq i32 %19, %.pre182 br i1 %cmp23, label %if.end, label %if.else if.else: ; preds = %lor.lhs.false.thread, %lor.lhs.false %cmp162197205226 = phi i1 [ false, %lor.lhs.false.thread ], [ %cmp162, %lor.lhs.false ] %vla1195207225 = phi ptr [ %vla1195.ph, %lor.lhs.false.thread ], [ %vla1, %lor.lhs.false ] %vla193211224 = phi ptr [ %vla193.ph, %lor.lhs.false.thread ], [ %vla, %lor.lhs.false ] %20 = phi i64 [ %.ph, %lor.lhs.false.thread ], [ %6, %lor.lhs.false ] %retval.0.i191214223 = phi i32 [ %retval.0.i191.ph, %lor.lhs.false.thread ], [ %mul.i, %lor.lhs.false ] %21 = phi i32 [ undef, %lor.lhs.false.thread ], [ %.pre182, %lor.lhs.false ] %22 = phi i32 [ undef, %lor.lhs.false.thread ], [ %.pre, %lor.lhs.false ] br label %if.end if.end: ; preds = %for.end, %lor.lhs.false, %if.else %vla1195207225.sink229 = phi ptr [ %vla1195207225, %if.else ], [ %vla1, %lor.lhs.false ], [ %vla1, %for.end ] %.sink228 = phi i32 [ %21, %if.else ], [ %.pre, %lor.lhs.false ], [ %.pre, %for.end ] %.sink227 = phi i32 [ %22, %if.else ], [ %.pre182, %lor.lhs.false ], [ %.pre182, %for.end ] %retval.0.i191213 = phi i32 [ %retval.0.i191214223, %if.else ], [ %mul.i, %lor.lhs.false ], [ %mul.i, %for.end ] %23 = phi i64 [ %20, %if.else ], [ %6, %lor.lhs.false ], [ %6, %for.end ] %vla193210 = phi ptr [ %vla193211224, %if.else ], [ %vla, %lor.lhs.false ], [ %vla, %for.end ] %cmp162197204 = phi i1 [ %cmp162197205226, %if.else ], [ %cmp162, %lor.lhs.false ], [ %cmp162, %for.end ] %arrayidx32 = getelementptr inbounds i32, ptr %vla1195207225.sink229, i64 1 store i32 %.sink228, ptr %arrayidx32, align 4, !tbaa !5 %arrayidx35 = getelementptr inbounds i32, ptr %vla1195207225.sink229, i64 2 store i32 %.sink227, ptr %arrayidx35, align 8, !tbaa !5 %cmp37164 = icmp sgt i32 %retval.0.i191213, 3 br i1 %cmp37164, label %for.body38.preheader, label %for.cond67.preheader for.body38.preheader: ; preds = %if.end %24 = add nsw i64 %23, -3 %xtraiter = and i64 %24, 1 %25 = icmp eq i64 %23, 4 br i1 %25, label %for.cond67.preheader.loopexit.unr-lcssa, label %for.body38.preheader.new for.body38.preheader.new: ; preds = %for.body38.preheader %unroll_iter = and i64 %24, -2 br label %for.body38 for.cond67.preheader.loopexit.unr-lcssa: ; preds = %if.end63.1, %for.body38.preheader %.unr = phi i32 [ %.sink227, %for.body38.preheader ], [ %.sink.1, %if.end63.1 ] %.unr232 = phi i32 [ %.sink228, %for.body38.preheader ], [ %.sink, %if.end63.1 ] %indvars.iv169.unr = phi i64 [ 3, %for.body38.preheader ], [ %indvars.iv.next170.1, %if.end63.1 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond67.preheader, label %for.body38.epil for.body38.epil: ; preds = %for.cond67.preheader.loopexit.unr-lcssa %idxprom43.epil = sext i32 %.unr232 to i64 %arrayidx44.epil = getelementptr inbounds %struct.par, ptr %vla193210, i64 %idxprom43.epil %26 = load i32, ptr %arrayidx44.epil, align 8, !tbaa !11 %cmp56.epil = icmp eq i32 %26, %.unr br i1 %cmp56.epil, label %if.then57.epil, label %if.end63.epil if.then57.epil: ; preds = %for.body38.epil %y52.epil = getelementptr inbounds %struct.par, ptr %vla193210, i64 %idxprom43.epil, i32 1 %27 = load i32, ptr %y52.epil, align 4, !tbaa !13 br label %if.end63.epil if.end63.epil: ; preds = %if.then57.epil, %for.body38.epil %.sink.epil = phi i32 [ %27, %if.then57.epil ], [ %26, %for.body38.epil ] %28 = getelementptr inbounds i32, ptr %vla1195207225.sink229, i64 %indvars.iv169.unr store i32 %.sink.epil, ptr %28, align 4 br label %for.cond67.preheader for.cond67.preheader: ; preds = %if.end63.epil, %for.cond67.preheader.loopexit.unr-lcssa, %if.end br i1 %cmp162197204, label %for.body69, label %for.end75 for.body38: ; preds = %if.end63.1, %for.body38.preheader.new %29 = phi i32 [ %.sink227, %for.body38.preheader.new ], [ %.sink.1, %if.end63.1 ] %30 = phi i32 [ %.sink228, %for.body38.preheader.new ], [ %.sink, %if.end63.1 ] %indvars.iv169 = phi i64 [ 3, %for.body38.preheader.new ], [ %indvars.iv.next170.1, %if.end63.1 ] %niter = phi i64 [ 0, %for.body38.preheader.new ], [ %niter.next.1, %if.end63.1 ] %idxprom43 = sext i32 %30 to i64 %arrayidx44 = getelementptr inbounds %struct.par, ptr %vla193210, i64 %idxprom43 %31 = load i32, ptr %arrayidx44, align 8, !tbaa !11 %cmp56 = icmp eq i32 %31, %29 br i1 %cmp56, label %if.then57, label %if.end63 if.then57: ; preds = %for.body38 %y52 = getelementptr inbounds %struct.par, ptr %vla193210, i64 %idxprom43, i32 1 %32 = load i32, ptr %y52, align 4, !tbaa !13 br label %if.end63 if.end63: ; preds = %for.body38, %if.then57 %.sink = phi i32 [ %32, %if.then57 ], [ %31, %for.body38 ] %33 = getelementptr inbounds i32, ptr %vla1195207225.sink229, i64 %indvars.iv169 store i32 %.sink, ptr %33, align 4 %indvars.iv.next170 = add nuw nsw i64 %indvars.iv169, 1 %idxprom43.1 = sext i32 %29 to i64 %arrayidx44.1 = getelementptr inbounds %struct.par, ptr %vla193210, i64 %idxprom43.1 %34 = load i32, ptr %arrayidx44.1, align 8, !tbaa !11 %cmp56.1 = icmp eq i32 %34, %.sink br i1 %cmp56.1, label %if.then57.1, label %if.end63.1 if.then57.1: ; preds = %if.end63 %y52.1 = getelementptr inbounds %struct.par, ptr %vla193210, i64 %idxprom43.1, i32 1 %35 = load i32, ptr %y52.1, align 4, !tbaa !13 br label %if.end63.1 if.end63.1: ; preds = %if.then57.1, %if.end63 %.sink.1 = phi i32 [ %35, %if.then57.1 ], [ %34, %if.end63 ] %36 = getelementptr inbounds i32, ptr %vla1195207225.sink229, i64 %indvars.iv.next170 store i32 %.sink.1, ptr %36, align 4 %indvars.iv.next170.1 = add nuw nsw i64 %indvars.iv169, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %for.cond67.preheader.loopexit.unr-lcssa, label %for.body38, !llvm.loop !16 for.body69: ; preds = %for.cond67.preheader, %for.body69 %indvars.iv176 = phi i64 [ %indvars.iv.next177, %for.body69 ], [ 0, %for.cond67.preheader ] %arrayidx71 = getelementptr inbounds i32, ptr %vla1195207225.sink229, i64 %indvars.iv176 %37 = load i32, ptr %arrayidx71, align 4, !tbaa !5 %add = add nsw i32 %37, 1 %call72 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %add) %indvars.iv.next177 = add nuw nsw i64 %indvars.iv176, 1 %exitcond180.not = icmp eq i64 %indvars.iv.next177, %23 br i1 %exitcond180.not, label %for.end75, label %for.body69, !llvm.loop !17 for.end75: ; preds = %for.body69, %for.cond67.preheader %putchar = tail call i32 @putchar(i32 10) ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @get_int() local_unnamed_addr #2 { entry: %0 = load ptr, ptr @stdin, align 8, !tbaa !9 %call.i = tail call i32 @getc(ptr noundef %0) %conv = trunc i32 %call.i to i8 %cmp62 = icmp eq i8 %conv, -1 br i1 %cmp62, label %cleanup, label %if.end if.end: ; preds = %entry, %while.cond.backedge %c.063 = phi i8 [ %conv16, %while.cond.backedge ], [ %conv, %entry ] %1 = add i8 %c.063, -48 %or.cond = icmp ult i8 %1, 10 br i1 %or.cond, label %while.end, label %if.end10 if.end10: ; preds = %if.end %cmp12 = icmp eq i8 %c.063, 45 %2 = load ptr, ptr @stdin, align 8, !tbaa !9 %call.i59 = tail call i32 @getc(ptr noundef %2) %conv16 = trunc i32 %call.i59 to i8 br i1 %cmp12, label %if.then14, label %while.cond.backedge if.then14: ; preds = %if.end10 %sext = shl i32 %call.i59, 24 %3 = add i32 %sext, -956301313 %or.cond46 = icmp ult i32 %3, -150994945 br i1 %or.cond46, label %while.cond.backedge, label %while.end while.cond.backedge: ; preds = %if.end10, %if.then14 %cmp = icmp eq i8 %conv16, -1 br i1 %cmp, label %cleanup, label %if.end while.end: ; preds = %if.then14, %if.end %c.1 = phi i8 [ %c.063, %if.end ], [ %conv16, %if.then14 ] %sgn.0 = phi i32 [ 1, %if.end ], [ -1, %if.then14 ] br label %while.cond28 while.cond28: ; preds = %while.cond28, %while.end %ret.0 = phi i32 [ 0, %while.end ], [ %sub, %while.cond28 ] %c.2 = phi i8 [ %c.1, %while.end ], [ %conv34, %while.cond28 ] %add = mul i32 %ret.0, 10 %conv31 = sext i8 %c.2 to i32 %add32 = add i32 %add, -48 %sub = add i32 %add32, %conv31 %4 = load ptr, ptr @stdin, align 8, !tbaa !9 %call.i61 = tail call i32 @getc(ptr noundef %4) %conv34 = trunc i32 %call.i61 to i8 %sext58 = shl i32 %call.i61, 24 %5 = add i32 %sext58, -956301313 %or.cond47 = icmp ult i32 %5, -150994945 br i1 %or.cond47, label %if.then42, label %while.cond28 if.then42: ; preds = %while.cond28 %mul = mul nsw i32 %sub, %sgn.0 br label %cleanup cleanup: ; preds = %while.cond.backedge, %entry, %if.then42 %retval.0 = phi i32 [ %mul, %if.then42 ], [ -1, %entry ], [ -1, %while.cond.backedge ] ret i32 %retval.0 } ; Function Attrs: nofree nounwind declare noundef i32 @getc(ptr nocapture noundef) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #5 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #5 attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) 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 nofree norecurse nosync nounwind willreturn memory(argmem: 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 #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { 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 = { nofree nounwind } attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } !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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !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, !6, i64 0} !12 = !{!"", !6, i64 0, !6, i64 4} !13 = !{!12, !6, i64 4} !14 = distinct !{!14, !15} !15 = !{!"llvm.loop.mustprogress"} !16 = distinct !{!16, !15} !17 = distinct !{!17, !15}
#include <stdio.h> int biSearch(int s[], int n, int key) { int left, mid, right; left = 0; right = n; while (left < right) { mid = (left + right) / 2; if (s[mid] == key) return 1; if (s[mid] < key) left = mid + 1; else right = mid; } return 0; } int main() { int i, q, cnt, t, s[100000], n; cnt = 0; scanf("%d", &n); for (i = 0; i < n; i++) scanf("%d", &s[i]); scanf("%d", &q); for (i = 0; i < q; i++) { scanf("%d", &t); if (biSearch(s, n, t)) cnt++; } printf("%d\n", cnt); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185843/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185843/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable define dso_local i32 @biSearch(ptr nocapture noundef readonly %s, i32 noundef %n, i32 noundef %key) local_unnamed_addr #0 { entry: %cmp17 = icmp sgt i32 %n, 0 br i1 %cmp17, label %while.body, label %cleanup while.body: ; preds = %entry, %if.end %right.019 = phi i32 [ %right.1, %if.end ], [ %n, %entry ] %left.018 = phi i32 [ %left.1, %if.end ], [ 0, %entry ] %add = add nsw i32 %right.019, %left.018 %div = sdiv i32 %add, 2 %idxprom = sext i32 %div to i64 %arrayidx = getelementptr inbounds i32, ptr %s, i64 %idxprom %0 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp1 = icmp eq i32 %0, %key br i1 %cmp1, label %cleanup, label %if.end if.end: ; preds = %while.body %cmp4 = icmp slt i32 %0, %key %add6 = add nsw i32 %div, 1 %left.1 = select i1 %cmp4, i32 %add6, i32 %left.018 %right.1 = select i1 %cmp4, i32 %right.019, i32 %div %cmp = icmp slt i32 %left.1, %right.1 br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !9 cleanup: ; preds = %while.body, %if.end, %entry %retval.0 = phi i32 [ 0, %entry ], [ 0, %if.end ], [ 1, %while.body ] ret i32 %retval.0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %q = alloca i32, align 4 %t = alloca i32, align 4 %s = alloca [100000 x i32], align 16 %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4 call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %s) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp21 = icmp sgt i32 %0, 0 br i1 %cmp21, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100000 x i32], ptr %s, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11 for.end: ; preds = %for.body, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %3 = load i32, ptr %q, align 4, !tbaa !5 %cmp423 = icmp sgt i32 %3, 0 br i1 %cmp423, label %for.body5, label %for.end11 for.body5: ; preds = %for.end, %for.cond3 %cnt.025 = phi i32 [ %7, %for.cond3 ], [ 0, %for.end ] %i.124 = phi i32 [ %inc10, %for.cond3 ], [ 0, %for.end ] %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t) %4 = load i32, ptr %n, align 4, !tbaa !5 %5 = load i32, ptr %t, align 4, !tbaa !5 %cmp17.i = icmp sgt i32 %4, 0 br i1 %cmp17.i, label %while.body.i, label %for.cond3 while.body.i: ; preds = %for.body5, %if.end.i %right.019.i = phi i32 [ %right.1.i, %if.end.i ], [ %4, %for.body5 ] %left.018.i = phi i32 [ %left.1.i, %if.end.i ], [ 0, %for.body5 ] %add.i = add nsw i32 %left.018.i, %right.019.i %div.i = sdiv i32 %add.i, 2 %idxprom.i = sext i32 %div.i to i64 %arrayidx.i = getelementptr inbounds i32, ptr %s, i64 %idxprom.i %6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %cmp1.i = icmp eq i32 %6, %5 br i1 %cmp1.i, label %biSearch.exit, label %if.end.i if.end.i: ; preds = %while.body.i %cmp4.i = icmp slt i32 %6, %5 %add6.i = add nsw i32 %div.i, 1 %left.1.i = select i1 %cmp4.i, i32 %add6.i, i32 %left.018.i %right.1.i = select i1 %cmp4.i, i32 %right.019.i, i32 %div.i %cmp.i = icmp slt i32 %left.1.i, %right.1.i br i1 %cmp.i, label %while.body.i, label %for.cond3, !llvm.loop !9 biSearch.exit: ; preds = %while.body.i %inc8 = add nsw i32 %cnt.025, 1 br label %for.cond3 for.cond3: ; preds = %if.end.i, %for.body5, %biSearch.exit %7 = phi i32 [ %inc8, %biSearch.exit ], [ %cnt.025, %for.body5 ], [ %cnt.025, %if.end.i ] %inc10 = add nuw nsw i32 %i.124, 1 %8 = load i32, ptr %q, align 4, !tbaa !5 %cmp4 = icmp slt i32 %inc10, %8 br i1 %cmp4, label %for.body5, label %for.end11, !llvm.loop !12 for.end11: ; preds = %for.cond3, %for.end %cnt.0.lcssa = phi i32 [ 0, %for.end ], [ %7, %for.cond3 ] %call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %s) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 attributes #0 = { nofree norecurse nosync nounwind memory(argmem: 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { 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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10}
#include <stdio.h> int binarysearch(int a[] , int n , int key); int main(void) { int i; int n; scanf("%d",&n); int s[n]; int j=0; for( i = 0; i < n; i++) { scanf("%d",&s[i]); } int q; scanf("%d",&q); int t[q]; for( i = 0; i < q; i++) { scanf("%d",&t[i]); } for( i = 0; i < q; i++) { j += binarysearch(s,n,t[i]); } printf("%d\n",j); return 0; } int binarysearch(int a[] , int n , int key) { int left = 0; int right = n; int mid; while(left < right) { mid = (left+right)/2; if(a[mid] == key) { return 1; } else if(key < a[mid]) { right = mid; } else{ left = mid + 1; } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185894/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185894/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %q = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %1 = zext i32 %0 to i64 %2 = call ptr @llvm.stacksave.p0() %vla = alloca i32, i64 %1, align 16 %3 = load i32, ptr %n, align 4, !tbaa !5 %cmp32 = icmp sgt i32 %3, 0 br i1 %cmp32, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %4 = load i32, ptr %n, align 4, !tbaa !5 %5 = sext i32 %4 to i64 %cmp = icmp slt i64 %indvars.iv.next, %5 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %entry call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #5 %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %6 = load i32, ptr %q, align 4, !tbaa !5 %7 = zext i32 %6 to i64 %vla3 = alloca i32, i64 %7, align 16 %cmp534 = icmp sgt i32 %6, 0 br i1 %cmp534, label %for.body6, label %for.end21 for.cond13.preheader: ; preds = %for.body6 %cmp1436 = icmp sgt i32 %11, 0 br i1 %cmp1436, label %for.body15.lr.ph, label %for.end21 for.body15.lr.ph: ; preds = %for.cond13.preheader %8 = load i32, ptr %n, align 4, !tbaa !5 %cmp18.i = icmp sgt i32 %8, 0 br i1 %cmp18.i, label %for.body15.us.preheader, label %for.end21 for.body15.us.preheader: ; preds = %for.body15.lr.ph %wide.trip.count = zext i32 %11 to i64 br label %for.body15.us for.body15.us: ; preds = %for.body15.us.preheader, %binarysearch.exit.loopexit.us %indvars.iv46 = phi i64 [ 0, %for.body15.us.preheader ], [ %indvars.iv.next47, %binarysearch.exit.loopexit.us ] %j.038.us = phi i32 [ 0, %for.body15.us.preheader ], [ %add.us, %binarysearch.exit.loopexit.us ] %arrayidx17.us = getelementptr inbounds i32, ptr %vla3, i64 %indvars.iv46 %9 = load i32, ptr %arrayidx17.us, align 4, !tbaa !5 br label %while.body.i.us while.body.i.us: ; preds = %for.body15.us, %if.else.i.us %right.020.i.us = phi i32 [ %right.1.i.us, %if.else.i.us ], [ %8, %for.body15.us ] %left.019.i.us = phi i32 [ %left.1.i.us, %if.else.i.us ], [ 0, %for.body15.us ] %add.i.us = add nsw i32 %left.019.i.us, %right.020.i.us %div.i.us = sdiv i32 %add.i.us, 2 %idxprom.i.us = sext i32 %div.i.us to i64 %arrayidx.i.us = getelementptr inbounds i32, ptr %vla, i64 %idxprom.i.us %10 = load i32, ptr %arrayidx.i.us, align 4, !tbaa !5 %cmp1.i.us = icmp eq i32 %10, %9 br i1 %cmp1.i.us, label %binarysearch.exit.loopexit.us, label %if.else.i.us if.else.i.us: ; preds = %while.body.i.us %cmp4.i.us = icmp sgt i32 %10, %9 %add7.i.us = add nsw i32 %div.i.us, 1 %left.1.i.us = select i1 %cmp4.i.us, i32 %left.019.i.us, i32 %add7.i.us %right.1.i.us = select i1 %cmp4.i.us, i32 %div.i.us, i32 %right.020.i.us %cmp.i.us = icmp slt i32 %left.1.i.us, %right.1.i.us br i1 %cmp.i.us, label %while.body.i.us, label %binarysearch.exit.loopexit.us, !llvm.loop !11 binarysearch.exit.loopexit.us: ; preds = %if.else.i.us, %while.body.i.us %retval.0.i.ph.us = phi i32 [ 1, %while.body.i.us ], [ 0, %if.else.i.us ] %add.us = add nuw nsw i32 %retval.0.i.ph.us, %j.038.us %indvars.iv.next47 = add nuw nsw i64 %indvars.iv46, 1 %exitcond.not = icmp eq i64 %indvars.iv.next47, %wide.trip.count br i1 %exitcond.not, label %for.end21, label %for.body15.us, !llvm.loop !12 for.body6: ; preds = %for.end, %for.body6 %indvars.iv43 = phi i64 [ %indvars.iv.next44, %for.body6 ], [ 0, %for.end ] %arrayidx8 = getelementptr inbounds i32, ptr %vla3, i64 %indvars.iv43 %call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx8) %indvars.iv.next44 = add nuw nsw i64 %indvars.iv43, 1 %11 = load i32, ptr %q, align 4, !tbaa !5 %12 = sext i32 %11 to i64 %cmp5 = icmp slt i64 %indvars.iv.next44, %12 br i1 %cmp5, label %for.body6, label %for.cond13.preheader, !llvm.loop !13 for.end21: ; preds = %binarysearch.exit.loopexit.us, %for.end, %for.body15.lr.ph, %for.cond13.preheader %j.0.lcssa = phi i32 [ 0, %for.cond13.preheader ], [ 0, %for.body15.lr.ph ], [ 0, %for.end ], [ %add.us, %binarysearch.exit.loopexit.us ] %call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %j.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #5 call void @llvm.stackrestore.p0(ptr %2) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare ptr @llvm.stacksave.p0() #3 ; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable define dso_local i32 @binarysearch(ptr nocapture noundef readonly %a, i32 noundef %n, i32 noundef %key) local_unnamed_addr #4 { entry: %cmp18 = icmp sgt i32 %n, 0 br i1 %cmp18, label %while.body, label %cleanup while.body: ; preds = %entry, %if.else %right.020 = phi i32 [ %right.1, %if.else ], [ %n, %entry ] %left.019 = phi i32 [ %left.1, %if.else ], [ 0, %entry ] %add = add nsw i32 %right.020, %left.019 %div = sdiv i32 %add, 2 %idxprom = sext i32 %div to i64 %arrayidx = getelementptr inbounds i32, ptr %a, i64 %idxprom %0 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp1 = icmp eq i32 %0, %key br i1 %cmp1, label %cleanup, label %if.else if.else: ; preds = %while.body %cmp4 = icmp sgt i32 %0, %key %add7 = add nsw i32 %div, 1 %left.1 = select i1 %cmp4, i32 %left.019, i32 %add7 %right.1 = select i1 %cmp4, i32 %div, i32 %right.020 %cmp = icmp slt i32 %left.1, %right.1 br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !11 cleanup: ; preds = %while.body, %if.else, %entry %retval.0 = phi i32 [ 0, %entry ], [ 0, %if.else ], [ 1, %while.body ] ret i32 %retval.0 } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare void @llvm.stackrestore.p0(ptr) #3 attributes #0 = { nofree 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 = { 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 #3 = { mustprogress nocallback nofree nosync nounwind willreturn } attributes #4 = { nofree norecurse nosync nounwind memory(argmem: 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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10}
#include<stdio.h> int main(void){ int i,j,n,q,left,right,mid,S[100000],T[50000],C=0; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&S[i]); } scanf("%d",&q); for(i=0;i<q;i++){ scanf("%d",&T[i]); } for(i=0;i<q;i++){ left=0; right=n; while(left<right){ mid=(left+right)/2; if(S[mid]==T[i]){ C++; break; }else if(T[i]<S[mid]){ right=mid; }else{ left=mid+1; } } } printf("%d\n",C); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185937/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185937/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %q = alloca i32, align 4 %S = alloca [100000 x i32], align 16 %T = alloca [50000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #3 call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %S) #3 call void @llvm.lifetime.start.p0(i64 200000, ptr nonnull %T) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp51 = icmp sgt i32 %0, 0 br i1 %cmp51, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100000 x i32], ptr %S, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %3 = load i32, ptr %q, align 4, !tbaa !5 %cmp453 = icmp sgt i32 %3, 0 br i1 %cmp453, label %for.body5, label %for.end33 for.cond12.preheader: ; preds = %for.body5 %cmp1358 = icmp sgt i32 %7, 0 br i1 %cmp1358, label %for.body14.lr.ph, label %for.end33 for.body14.lr.ph: ; preds = %for.cond12.preheader %4 = load i32, ptr %n, align 4, !tbaa !5 %cmp1555 = icmp sgt i32 %4, 0 br i1 %cmp1555, label %for.body14.us.preheader, label %for.end33 for.body14.us.preheader: ; preds = %for.body14.lr.ph %wide.trip.count = zext i32 %7 to i64 br label %for.body14.us for.body14.us: ; preds = %for.body14.us.preheader, %for.inc31.us %indvars.iv69 = phi i64 [ 0, %for.body14.us.preheader ], [ %indvars.iv.next70, %for.inc31.us ] %C.061.us = phi i32 [ 0, %for.body14.us.preheader ], [ %C.1.us, %for.inc31.us ] %arrayidx19.us = getelementptr inbounds [50000 x i32], ptr %T, i64 0, i64 %indvars.iv69 %5 = load i32, ptr %arrayidx19.us, align 4, !tbaa !5 br label %while.body.us while.body.us: ; preds = %for.body14.us, %if.else.us %right.057.us = phi i32 [ %4, %for.body14.us ], [ %right.1.us, %if.else.us ] %left.056.us = phi i32 [ 0, %for.body14.us ], [ %left.1.us, %if.else.us ] %add.us = add nsw i32 %right.057.us, %left.056.us %div.us = sdiv i32 %add.us, 2 %idxprom16.us = sext i32 %div.us to i64 %arrayidx17.us = getelementptr inbounds [100000 x i32], ptr %S, i64 0, i64 %idxprom16.us %6 = load i32, ptr %arrayidx17.us, align 4, !tbaa !5 %cmp20.us = icmp eq i32 %6, %5 br i1 %cmp20.us, label %if.then.us, label %if.else.us if.else.us: ; preds = %while.body.us %cmp26.us = icmp slt i32 %5, %6 %add29.us = add nsw i32 %div.us, 1 %left.1.us = select i1 %cmp26.us, i32 %left.056.us, i32 %add29.us %right.1.us = select i1 %cmp26.us, i32 %div.us, i32 %right.057.us %cmp15.us = icmp slt i32 %left.1.us, %right.1.us br i1 %cmp15.us, label %while.body.us, label %for.inc31.us, !llvm.loop !11 if.then.us: ; preds = %while.body.us %inc21.us = add nsw i32 %C.061.us, 1 br label %for.inc31.us for.inc31.us: ; preds = %if.else.us, %if.then.us %C.1.us = phi i32 [ %inc21.us, %if.then.us ], [ %C.061.us, %if.else.us ] %indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1 %exitcond.not = icmp eq i64 %indvars.iv.next70, %wide.trip.count br i1 %exitcond.not, label %for.end33, label %for.body14.us, !llvm.loop !12 for.body5: ; preds = %for.end, %for.body5 %indvars.iv66 = phi i64 [ %indvars.iv.next67, %for.body5 ], [ 0, %for.end ] %arrayidx7 = getelementptr inbounds [50000 x i32], ptr %T, i64 0, i64 %indvars.iv66 %call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7) %indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1 %7 = load i32, ptr %q, align 4, !tbaa !5 %8 = sext i32 %7 to i64 %cmp4 = icmp slt i64 %indvars.iv.next67, %8 br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !13 for.end33: ; preds = %for.inc31.us, %for.end, %for.body14.lr.ph, %for.cond12.preheader %C.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.body14.lr.ph ], [ 0, %for.end ], [ %C.1.us, %for.inc31.us ] %call34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %C.0.lcssa) call void @llvm.lifetime.end.p0(i64 200000, ptr nonnull %T) #3 call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %S) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 attributes #0 = { nofree 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 = { 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 #3 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10}
#include<stdio.h> int A[1000000], n; int binarySearch(int key){ int left = 0; int right = n; int mid; while( left < right){ mid = (left + right) / 2; if( key == A[mid] ) return 1; if( key > A[mid] ) left = mid + 1; else if( key < A[mid]) right = mid; } return 0; } int main(){ int i, q, k, sum = 0; scanf("%d", &n); for( i=0; i<n; i++){ scanf("%d", &A[i]); } scanf("%d", &q); for( i=0; i<q; i++){ scanf("%d", &k); if( binarySearch( k )) sum++; } printf("%d\n", sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185980/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185980/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @n = dso_local global i32 0, align 4 @A = dso_local global [1000000 x i32] zeroinitializer, align 16 @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @binarySearch(i32 noundef %key) local_unnamed_addr #0 { entry: %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp23 = icmp sgt i32 %0, 0 br i1 %cmp23, label %while.body, label %cleanup while.body: ; preds = %entry, %if.end %right.025 = phi i32 [ %right.1, %if.end ], [ %0, %entry ] %left.024 = phi i32 [ %left.1, %if.end ], [ 0, %entry ] %add = add nsw i32 %right.025, %left.024 %div = sdiv i32 %add, 2 %idxprom = sext i32 %div to i64 %arrayidx = getelementptr inbounds [1000000 x i32], ptr @A, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp1 = icmp eq i32 %1, %key br i1 %cmp1, label %cleanup, label %if.end if.end: ; preds = %while.body %cmp4 = icmp slt i32 %1, %key %add6 = add nsw i32 %div, 1 %cmp9 = icmp sgt i32 %1, %key %spec.select = select i1 %cmp9, i32 %div, i32 %right.025 %left.1 = select i1 %cmp4, i32 %add6, i32 %left.024 %right.1 = select i1 %cmp4, i32 %right.025, i32 %spec.select %cmp = icmp slt i32 %left.1, %right.1 br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !9 cleanup: ; preds = %while.body, %if.end, %entry %retval.0 = phi i32 [ 0, %entry ], [ 0, %if.end ], [ 1, %while.body ] ret i32 %retval.0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %q = alloca i32, align 4 %k = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4 %call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n) %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp21 = icmp sgt i32 %0, 0 br i1 %cmp21, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [1000000 x i32], ptr @A, i64 0, i64 %indvars.iv %call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr @n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11 for.end: ; preds = %for.body, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %3 = load i32, ptr %q, align 4, !tbaa !5 %cmp423 = icmp sgt i32 %3, 0 br i1 %cmp423, label %for.body5, label %for.end11 for.body5: ; preds = %for.end, %for.cond3 %sum.025 = phi i32 [ %7, %for.cond3 ], [ 0, %for.end ] %i.124 = phi i32 [ %inc10, %for.cond3 ], [ 0, %for.end ] %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k) %4 = load i32, ptr %k, align 4, !tbaa !5 %5 = load i32, ptr @n, align 4, !tbaa !5 %cmp23.i = icmp sgt i32 %5, 0 br i1 %cmp23.i, label %while.body.i, label %for.cond3 while.body.i: ; preds = %for.body5, %if.end.i %right.025.i = phi i32 [ %right.1.i, %if.end.i ], [ %5, %for.body5 ] %left.024.i = phi i32 [ %left.1.i, %if.end.i ], [ 0, %for.body5 ] %add.i = add nsw i32 %left.024.i, %right.025.i %div.i = sdiv i32 %add.i, 2 %idxprom.i = sext i32 %div.i to i64 %arrayidx.i = getelementptr inbounds [1000000 x i32], ptr @A, i64 0, i64 %idxprom.i %6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %cmp1.i = icmp eq i32 %6, %4 br i1 %cmp1.i, label %binarySearch.exit, label %if.end.i if.end.i: ; preds = %while.body.i %cmp4.i = icmp slt i32 %6, %4 %add6.i = add nsw i32 %div.i, 1 %cmp9.i = icmp sgt i32 %6, %4 %spec.select.i = select i1 %cmp9.i, i32 %div.i, i32 %right.025.i %left.1.i = select i1 %cmp4.i, i32 %add6.i, i32 %left.024.i %right.1.i = select i1 %cmp4.i, i32 %right.025.i, i32 %spec.select.i %cmp.i = icmp slt i32 %left.1.i, %right.1.i br i1 %cmp.i, label %while.body.i, label %for.cond3, !llvm.loop !9 binarySearch.exit: ; preds = %while.body.i %inc8 = add nsw i32 %sum.025, 1 br label %for.cond3 for.cond3: ; preds = %if.end.i, %for.body5, %binarySearch.exit %7 = phi i32 [ %inc8, %binarySearch.exit ], [ %sum.025, %for.body5 ], [ %sum.025, %if.end.i ] %inc10 = add nuw nsw i32 %i.124, 1 %8 = load i32, ptr %q, align 4, !tbaa !5 %cmp4 = icmp slt i32 %inc10, %8 br i1 %cmp4, label %for.body5, label %for.end11, !llvm.loop !12 for.end11: ; preds = %for.cond3, %for.end %sum.0.lcssa = phi i32 [ 0, %for.end ], [ %7, %for.cond3 ] %call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 attributes #0 = { nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) 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 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { 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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10}
#include <stdio.h> #include <stdlib.h> int main() { int n, q, i, count = 0, k, left = 0, right, mid, key; int *S, *T; scanf("%d", &n); S = (int *)malloc(n * sizeof(int)); for(i = 0; i < n; i++) scanf("%d", &S[i]); scanf("%d", &q); T = (int *)malloc(q * sizeof(int)); for(i = 0; i < q; i++) scanf("%d", &T[i]); /*確認のprintf*/ /* printf("n = %d\n", n); for(i = 0; i < n; i++) printf("%d ", S[i]); printf("\n"); printf("q = %d\n", q); for(i = 0; i < q; i++) printf("%d ", T[i]); printf("\n"); */ for(k = 0; k < q; k++){ left = 0; right = n; key = T[k]; while(left < right){ mid = (left + right) / 2; if(S[mid] == key){ count++; break; } else if(key < S[mid]) right = mid; else left = mid + 1; } } printf("%d\n", count); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_186022/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_186022/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %q = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %conv = sext i32 %0 to i64 %mul = shl nsw i64 %conv, 2 %call1 = call noalias ptr @malloc(i64 noundef %mul) #5 %cmp61 = icmp sgt i32 %0, 0 br i1 %cmp61, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %entry %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %3 = load i32, ptr %q, align 4, !tbaa !5 %conv5 = sext i32 %3 to i64 %mul6 = shl nsw i64 %conv5, 2 %call7 = call noalias ptr @malloc(i64 noundef %mul6) #5 %cmp963 = icmp sgt i32 %3, 0 br i1 %cmp963, label %for.body11, label %for.end41 for.cond18.preheader: ; preds = %for.body11 %cmp1968 = icmp sgt i32 %7, 0 br i1 %cmp1968, label %for.body21.lr.ph, label %for.end41 for.body21.lr.ph: ; preds = %for.cond18.preheader %4 = load i32, ptr %n, align 4, !tbaa !5 %cmp2465 = icmp sgt i32 %4, 0 br i1 %cmp2465, label %for.body21.us.preheader, label %for.end41 for.body21.us.preheader: ; preds = %for.body21.lr.ph %wide.trip.count = zext i32 %7 to i64 br label %for.body21.us for.body21.us: ; preds = %for.body21.us.preheader, %for.inc39.us %indvars.iv78 = phi i64 [ 0, %for.body21.us.preheader ], [ %indvars.iv.next79, %for.inc39.us ] %count.070.us = phi i32 [ 0, %for.body21.us.preheader ], [ %count.1.us, %for.inc39.us ] %arrayidx23.us = getelementptr inbounds i32, ptr %call7, i64 %indvars.iv78 %5 = load i32, ptr %arrayidx23.us, align 4, !tbaa !5 br label %while.body.us while.body.us: ; preds = %for.body21.us, %if.else.us %left.067.us = phi i32 [ 0, %for.body21.us ], [ %left.1.us, %if.else.us ] %right.066.us = phi i32 [ %4, %for.body21.us ], [ %right.1.us, %if.else.us ] %add.us = add nsw i32 %left.067.us, %right.066.us %div.us = sdiv i32 %add.us, 2 %idxprom26.us = sext i32 %div.us to i64 %arrayidx27.us = getelementptr inbounds i32, ptr %call1, i64 %idxprom26.us %6 = load i32, ptr %arrayidx27.us, align 4, !tbaa !5 %cmp28.us = icmp eq i32 %6, %5 br i1 %cmp28.us, label %if.then.us, label %if.else.us if.else.us: ; preds = %while.body.us %cmp33.us = icmp slt i32 %5, %6 %add37.us = add nsw i32 %div.us, 1 %right.1.us = select i1 %cmp33.us, i32 %div.us, i32 %right.066.us %left.1.us = select i1 %cmp33.us, i32 %left.067.us, i32 %add37.us %cmp24.us = icmp slt i32 %left.1.us, %right.1.us br i1 %cmp24.us, label %while.body.us, label %for.inc39.us, !llvm.loop !11 if.then.us: ; preds = %while.body.us %inc30.us = add nsw i32 %count.070.us, 1 br label %for.inc39.us for.inc39.us: ; preds = %if.else.us, %if.then.us %count.1.us = phi i32 [ %inc30.us, %if.then.us ], [ %count.070.us, %if.else.us ] %indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1 %exitcond.not = icmp eq i64 %indvars.iv.next79, %wide.trip.count br i1 %exitcond.not, label %for.end41, label %for.body21.us, !llvm.loop !12 for.body11: ; preds = %for.end, %for.body11 %indvars.iv75 = phi i64 [ %indvars.iv.next76, %for.body11 ], [ 0, %for.end ] %arrayidx13 = getelementptr inbounds i32, ptr %call7, i64 %indvars.iv75 %call14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx13) %indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1 %7 = load i32, ptr %q, align 4, !tbaa !5 %8 = sext i32 %7 to i64 %cmp9 = icmp slt i64 %indvars.iv.next76, %8 br i1 %cmp9, label %for.body11, label %for.cond18.preheader, !llvm.loop !13 for.end41: ; preds = %for.inc39.us, %for.end, %for.body21.lr.ph, %for.cond18.preheader %count.0.lcssa = phi i32 [ 0, %for.cond18.preheader ], [ 0, %for.body21.lr.ph ], [ 0, %for.end ], [ %count.1.us, %for.inc39.us ] %call42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 attributes #0 = { nofree 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 = { 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 #3 = { 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 #4 = { nounwind } attributes #5 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10}
#include <stdio.h> int binarySearch(int *,int,int); int main(){ int S[100000]; int T[50000]; int N,q,i; int cnt=0; scanf("%d",&N); for(i=0;i<N;i++){ scanf("%d",&S[i]); } scanf("%d",&q); for(i=0;i<q;i++){ scanf("%d",&T[i]); if(binarySearch(S,N,T[i]))cnt++; } printf("%d\n",cnt); return 0; } int binarySearch(int A[],int N,int key){ int right=N; int left=0; int mid=0; while(right > left){ mid = (left + right) / 2; if(A[mid] == key)return 1; if(A[mid] < key){ left = mid + 1; } else if(A[mid] > key){ right = mid; } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_186066/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_186066/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %S = alloca [100000 x i32], align 16 %T = alloca [50000 x i32], align 16 %N = alloca i32, align 4 %q = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %S) #4 call void @llvm.lifetime.start.p0(i64 200000, ptr nonnull %T) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N) %0 = load i32, ptr %N, align 4, !tbaa !5 %cmp27 = icmp sgt i32 %0, 0 br i1 %cmp27, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100000 x i32], ptr %S, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %N, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %3 = load i32, ptr %q, align 4, !tbaa !5 %cmp429 = icmp sgt i32 %3, 0 br i1 %cmp429, label %for.body5, label %for.end15 for.body5: ; preds = %for.end, %for.cond3 %indvars.iv33 = phi i64 [ %indvars.iv.next34, %for.cond3 ], [ 0, %for.end ] %cnt.031 = phi i32 [ %7, %for.cond3 ], [ 0, %for.end ] %arrayidx7 = getelementptr inbounds [50000 x i32], ptr %T, i64 0, i64 %indvars.iv33 %call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7) %4 = load i32, ptr %N, align 4, !tbaa !5 %5 = load i32, ptr %arrayidx7, align 4, !tbaa !5 %cmp25.i = icmp sgt i32 %4, 0 br i1 %cmp25.i, label %while.body.i, label %for.cond3 while.body.i: ; preds = %for.body5, %if.end.i %left.027.i = phi i32 [ %left.1.i, %if.end.i ], [ 0, %for.body5 ] %right.026.i = phi i32 [ %right.1.i, %if.end.i ], [ %4, %for.body5 ] %add.i = add nsw i32 %right.026.i, %left.027.i %div.i = sdiv i32 %add.i, 2 %idxprom.i = sext i32 %div.i to i64 %arrayidx.i = getelementptr inbounds i32, ptr %S, i64 %idxprom.i %6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %cmp1.i = icmp eq i32 %6, %5 br i1 %cmp1.i, label %binarySearch.exit, label %if.end.i if.end.i: ; preds = %while.body.i %cmp4.i = icmp slt i32 %6, %5 %add6.i = add nsw i32 %div.i, 1 %cmp9.i = icmp sgt i32 %6, %5 %spec.select.i = select i1 %cmp9.i, i32 %div.i, i32 %right.026.i %right.1.i = select i1 %cmp4.i, i32 %right.026.i, i32 %spec.select.i %left.1.i = select i1 %cmp4.i, i32 %add6.i, i32 %left.027.i %cmp.i = icmp sgt i32 %right.1.i, %left.1.i br i1 %cmp.i, label %while.body.i, label %for.cond3, !llvm.loop !11 binarySearch.exit: ; preds = %while.body.i %inc12 = add nsw i32 %cnt.031, 1 br label %for.cond3 for.cond3: ; preds = %if.end.i, %for.body5, %binarySearch.exit %7 = phi i32 [ %inc12, %binarySearch.exit ], [ %cnt.031, %for.body5 ], [ %cnt.031, %if.end.i ] %indvars.iv.next34 = add nuw nsw i64 %indvars.iv33, 1 %8 = load i32, ptr %q, align 4, !tbaa !5 %9 = sext i32 %8 to i64 %cmp4 = icmp slt i64 %indvars.iv.next34, %9 br i1 %cmp4, label %for.body5, label %for.end15, !llvm.loop !12 for.end15: ; preds = %for.cond3, %for.end %cnt.0.lcssa = phi i32 [ 0, %for.end ], [ %7, %for.cond3 ] %call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4 call void @llvm.lifetime.end.p0(i64 200000, ptr nonnull %T) #4 call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %S) #4 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable define dso_local i32 @binarySearch(ptr nocapture noundef readonly %A, i32 noundef %N, i32 noundef %key) local_unnamed_addr #3 { entry: %cmp25 = icmp sgt i32 %N, 0 br i1 %cmp25, label %while.body, label %cleanup while.body: ; preds = %entry, %if.end %left.027 = phi i32 [ %left.1, %if.end ], [ 0, %entry ] %right.026 = phi i32 [ %right.1, %if.end ], [ %N, %entry ] %add = add nsw i32 %left.027, %right.026 %div = sdiv i32 %add, 2 %idxprom = sext i32 %div to i64 %arrayidx = getelementptr inbounds i32, ptr %A, i64 %idxprom %0 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp1 = icmp eq i32 %0, %key br i1 %cmp1, label %cleanup, label %if.end if.end: ; preds = %while.body %cmp4 = icmp slt i32 %0, %key %add6 = add nsw i32 %div, 1 %cmp9 = icmp sgt i32 %0, %key %spec.select = select i1 %cmp9, i32 %div, i32 %right.026 %right.1 = select i1 %cmp4, i32 %right.026, i32 %spec.select %left.1 = select i1 %cmp4, i32 %add6, i32 %left.027 %cmp = icmp sgt i32 %right.1, %left.1 br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !11 cleanup: ; preds = %while.body, %if.end, %entry %retval.0 = phi i32 [ 0, %entry ], [ 0, %if.end ], [ 1, %while.body ] ret i32 %retval.0 } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 attributes #0 = { nofree 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 = { 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 #3 = { nofree norecurse nosync nounwind memory(argmem: 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 #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10}
#include <stdio.h> int main() { int n,q,i,l,m,r,C=0; scanf("%d",&n); int S[n]; for(i=0;i<n;i++){ scanf("%d",&S[i]); } scanf("%d",&q); int T[q]; for(i=0;i<q;i++){ scanf("%d",&T[i]); l=0; r=n; while(l<r){ m=(l+r)/2; if(T[i]==S[m]){ C++; break; } if(T[i]>S[m]) l=m+1; else if (T[i]<S[m]) r=m; } } printf("%d\n",C); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_186109/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_186109/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %q = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %1 = zext i32 %0 to i64 %2 = call ptr @llvm.stacksave.p0() %vla = alloca i32, i64 %1, align 16 %3 = load i32, ptr %n, align 4, !tbaa !5 %cmp52 = icmp sgt i32 %3, 0 br i1 %cmp52, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %4 = load i32, ptr %n, align 4, !tbaa !5 %5 = sext i32 %4 to i64 %cmp = icmp slt i64 %indvars.iv.next, %5 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %6 = load i32, ptr %q, align 4, !tbaa !5 %7 = zext i32 %6 to i64 %vla3 = alloca i32, i64 %7, align 16 %cmp557 = icmp sgt i32 %6, 0 br i1 %cmp557, label %for.body6, label %for.end34 for.body6: ; preds = %for.end, %for.inc32 %indvars.iv61 = phi i64 [ %indvars.iv.next62, %for.inc32 ], [ 0, %for.end ] %C.058 = phi i32 [ %C.1, %for.inc32 ], [ 0, %for.end ] %arrayidx8 = getelementptr inbounds i32, ptr %vla3, i64 %indvars.iv61 %call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx8) %8 = load i32, ptr %n, align 4, !tbaa !5 %cmp1054 = icmp sgt i32 %8, 0 br i1 %cmp1054, label %while.body.lr.ph, label %for.inc32 while.body.lr.ph: ; preds = %for.body6 %9 = load i32, ptr %arrayidx8, align 4, !tbaa !5 br label %while.body while.body: ; preds = %while.body.lr.ph, %if.end %l.056 = phi i32 [ 0, %while.body.lr.ph ], [ %l.1, %if.end ] %r.055 = phi i32 [ %8, %while.body.lr.ph ], [ %r.1, %if.end ] %add = add nsw i32 %l.056, %r.055 %div = sdiv i32 %add, 2 %idxprom13 = sext i32 %div to i64 %arrayidx14 = getelementptr inbounds i32, ptr %vla, i64 %idxprom13 %10 = load i32, ptr %arrayidx14, align 4, !tbaa !5 %cmp15 = icmp eq i32 %9, %10 br i1 %cmp15, label %if.then, label %if.end if.then: ; preds = %while.body %inc16 = add nsw i32 %C.058, 1 br label %for.inc32 if.end: ; preds = %while.body %cmp21 = icmp sgt i32 %9, %10 %add23 = add nsw i32 %div, 1 %cmp28 = icmp slt i32 %9, %10 %spec.select = select i1 %cmp28, i32 %div, i32 %r.055 %r.1 = select i1 %cmp21, i32 %r.055, i32 %spec.select %l.1 = select i1 %cmp21, i32 %add23, i32 %l.056 %cmp10 = icmp slt i32 %l.1, %r.1 br i1 %cmp10, label %while.body, label %for.inc32, !llvm.loop !11 for.inc32: ; preds = %if.end, %for.body6, %if.then %C.1 = phi i32 [ %inc16, %if.then ], [ %C.058, %for.body6 ], [ %C.058, %if.end ] %indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1 %11 = load i32, ptr %q, align 4, !tbaa !5 %12 = sext i32 %11 to i64 %cmp5 = icmp slt i64 %indvars.iv.next62, %12 br i1 %cmp5, label %for.body6, label %for.end34, !llvm.loop !12 for.end34: ; preds = %for.inc32, %for.end %C.0.lcssa = phi i32 [ 0, %for.end ], [ %C.1, %for.inc32 ] %call35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %C.0.lcssa) call void @llvm.stackrestore.p0(ptr %2) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare ptr @llvm.stacksave.p0() #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare void @llvm.stackrestore.p0(ptr) #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree 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 = { 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 #3 = { mustprogress nocallback nofree nosync nounwind willreturn } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10}
#include <stdio.h> int binarysearch(int ans, int n, int a[]) { int left = 0; int right = n; int mid; while (left < right) { mid = (left + right) / 2; if (a[mid] == ans) return 1; else if (ans > a[mid]) left = mid + 1; else right = mid; } return 0; } int main(void) { int i, n, m, ans; int a[100000]; int count = 0; scanf("%d", &n); for (i = 0; i < n; i++) scanf("%d", &a[i]); scanf("%d", &m); for (i = 0; i < m; i++) { scanf("%d", &ans); if (binarysearch(ans, n, a)) count++; } printf("%d\n", count); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_186152/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_186152/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable define dso_local i32 @binarysearch(i32 noundef %ans, i32 noundef %n, ptr nocapture noundef readonly %a) local_unnamed_addr #0 { entry: %cmp18 = icmp sgt i32 %n, 0 br i1 %cmp18, label %while.body, label %cleanup while.body: ; preds = %entry, %if.else %right.020 = phi i32 [ %right.1, %if.else ], [ %n, %entry ] %left.019 = phi i32 [ %left.1, %if.else ], [ 0, %entry ] %add = add nsw i32 %right.020, %left.019 %div = sdiv i32 %add, 2 %idxprom = sext i32 %div to i64 %arrayidx = getelementptr inbounds i32, ptr %a, i64 %idxprom %0 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp1 = icmp eq i32 %0, %ans br i1 %cmp1, label %cleanup, label %if.else if.else: ; preds = %while.body %cmp4 = icmp slt i32 %0, %ans %add6 = add nsw i32 %div, 1 %left.1 = select i1 %cmp4, i32 %add6, i32 %left.019 %right.1 = select i1 %cmp4, i32 %right.020, i32 %div %cmp = icmp slt i32 %left.1, %right.1 br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !9 cleanup: ; preds = %while.body, %if.else, %entry %retval.0 = phi i32 [ 0, %entry ], [ 0, %if.else ], [ 1, %while.body ] ret i32 %retval.0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %n = alloca i32, align 4 %m = alloca i32, align 4 %ans = alloca i32, align 4 %a = alloca [100000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %ans) #4 call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %a) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp21 = icmp sgt i32 %0, 0 br i1 %cmp21, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11 for.end: ; preds = %for.body, %entry %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m) %3 = load i32, ptr %m, align 4, !tbaa !5 %cmp423 = icmp sgt i32 %3, 0 br i1 %cmp423, label %for.body5, label %for.end11 for.body5: ; preds = %for.end, %for.cond3 %count.025 = phi i32 [ %7, %for.cond3 ], [ 0, %for.end ] %i.124 = phi i32 [ %inc10, %for.cond3 ], [ 0, %for.end ] %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ans) %4 = load i32, ptr %ans, align 4, !tbaa !5 %5 = load i32, ptr %n, align 4, !tbaa !5 %cmp18.i = icmp sgt i32 %5, 0 br i1 %cmp18.i, label %while.body.i, label %for.cond3 while.body.i: ; preds = %for.body5, %if.else.i %right.020.i = phi i32 [ %right.1.i, %if.else.i ], [ %5, %for.body5 ] %left.019.i = phi i32 [ %left.1.i, %if.else.i ], [ 0, %for.body5 ] %add.i = add nsw i32 %left.019.i, %right.020.i %div.i = sdiv i32 %add.i, 2 %idxprom.i = sext i32 %div.i to i64 %arrayidx.i = getelementptr inbounds i32, ptr %a, i64 %idxprom.i %6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %cmp1.i = icmp eq i32 %6, %4 br i1 %cmp1.i, label %binarysearch.exit, label %if.else.i if.else.i: ; preds = %while.body.i %cmp4.i = icmp slt i32 %6, %4 %add6.i = add nsw i32 %div.i, 1 %left.1.i = select i1 %cmp4.i, i32 %add6.i, i32 %left.019.i %right.1.i = select i1 %cmp4.i, i32 %right.020.i, i32 %div.i %cmp.i = icmp slt i32 %left.1.i, %right.1.i br i1 %cmp.i, label %while.body.i, label %for.cond3, !llvm.loop !9 binarysearch.exit: ; preds = %while.body.i %inc8 = add nsw i32 %count.025, 1 br label %for.cond3 for.cond3: ; preds = %if.else.i, %for.body5, %binarysearch.exit %7 = phi i32 [ %inc8, %binarysearch.exit ], [ %count.025, %for.body5 ], [ %count.025, %if.else.i ] %inc10 = add nuw nsw i32 %i.124, 1 %8 = load i32, ptr %m, align 4, !tbaa !5 %cmp4 = icmp slt i32 %inc10, %8 br i1 %cmp4, label %for.body5, label %for.end11, !llvm.loop !12 for.end11: ; preds = %for.cond3, %for.end %count.0.lcssa = phi i32 [ 0, %for.end ], [ %7, %for.cond3 ] %call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa) call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %a) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %ans) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 attributes #0 = { nofree norecurse nosync nounwind memory(argmem: 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { 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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10}
#include<stdio.h> #include<string.h> int main(){ int k; scanf("%d",&k); char a[k]; scanf("%s",a); printf("%c",a[0]); for(int i=1,j=2;i<k;i+=j,j++){ printf("%c",a[i]); } printf("\n"); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_18621/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_18621/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %k = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k) %0 = load i32, ptr %k, align 4, !tbaa !5 %1 = zext i32 %0 to i64 %2 = call ptr @llvm.stacksave.p0() %vla = alloca i8, i64 %1, align 16 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %vla) %3 = load i8, ptr %vla, align 16, !tbaa !9 %conv = sext i8 %3 to i32 %putchar = call i32 @putchar(i32 %conv) %4 = load i32, ptr %k, align 4, !tbaa !5 %cmp13 = icmp sgt i32 %4, 1 br i1 %cmp13, label %for.body, label %for.cond.cleanup for.cond.cleanup: ; preds = %for.body, %entry %putchar11 = call i32 @putchar(i32 10) call void @llvm.stackrestore.p0(ptr %2) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5 ret i32 0 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 2, %entry ] %i.014 = phi i32 [ %add, %for.body ], [ 1, %entry ] %idxprom = zext i32 %i.014 to i64 %arrayidx4 = getelementptr inbounds i8, ptr %vla, i64 %idxprom %5 = load i8, ptr %arrayidx4, align 1, !tbaa !9 %conv5 = sext i8 %5 to i32 %putchar12 = call i32 @putchar(i32 %conv5) %6 = trunc i64 %indvars.iv to i32 %add = add nuw nsw i32 %i.014, %6 %indvars.iv.next = add nuw i64 %indvars.iv, 1 %7 = load i32, ptr %k, align 4, !tbaa !5 %cmp = icmp slt i32 %add, %7 br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !10 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare ptr @llvm.stacksave.p0() #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare void @llvm.stackrestore.p0(ptr) #3 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4 attributes #0 = { nofree 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 = { 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 #3 = { mustprogress nocallback nofree nosync nounwind willreturn } attributes #4 = { nofree nounwind } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"}
#include<stdio.h> #include<string.h> int main(void){ char s[100]; scanf("%s",s); int n = strlen(s); for(int i=0;i<n/2;i++){ if(s[i]!=s[n/2+i+1]){ printf("No\n"); return 0; } else if(s[i]!=s[n-i-1]){ printf("No\n"); return 0; } } printf("Yes\n"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_186253/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_186253/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @str.3 = private unnamed_addr constant [3 x i8] c"No\00", align 1 @str.4 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %s = alloca [100 x i8], align 16 call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #6 %conv = trunc i64 %call2 to i32 %div = sdiv i32 %conv, 2 %cmp.not37 = icmp sgt i32 %conv, 1 br i1 %cmp.not37, label %for.body.preheader, label %cleanup26 for.body.preheader: ; preds = %entry %wide.trip.count = zext i32 %div to i64 br label %for.body for.cond: ; preds = %if.else %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count br i1 %exitcond.not, label %cleanup26, label %for.body, !llvm.loop !5 for.body: ; preds = %for.body.preheader, %for.cond %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.cond ] %arrayidx = getelementptr inbounds [100 x i8], ptr %s, i64 0, i64 %indvars.iv %0 = load i8, ptr %arrayidx, align 1, !tbaa !7 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = trunc i64 %indvars.iv.next to i32 %add6 = add i32 %div, %1 %idxprom7 = sext i32 %add6 to i64 %arrayidx8 = getelementptr inbounds [100 x i8], ptr %s, i64 0, i64 %idxprom7 %2 = load i8, ptr %arrayidx8, align 1, !tbaa !7 %cmp10.not = icmp eq i8 %0, %2 br i1 %cmp10.not, label %if.else, label %cleanup26 if.else: ; preds = %for.body %3 = xor i64 %indvars.iv, -1 %sub16 = add i64 %call2, %3 %sext = shl i64 %sub16, 32 %idxprom17 = ashr exact i64 %sext, 32 %arrayidx18 = getelementptr inbounds [100 x i8], ptr %s, i64 0, i64 %idxprom17 %4 = load i8, ptr %arrayidx18, align 1, !tbaa !7 %cmp20.not = icmp eq i8 %0, %4 br i1 %cmp20.not, label %for.cond, label %cleanup26 cleanup26: ; preds = %for.cond, %if.else, %for.body, %entry %str.3.sink = phi ptr [ @str.4, %entry ], [ @str.3, %for.body ], [ @str.3, %if.else ], [ @str.4, %for.cond ] %puts35 = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.sink) call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #5 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4 attributes #0 = { nofree 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 = { 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 #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 = { nofree nounwind } attributes #5 = { nounwind } attributes #6 = { nounwind willreturn memory(read) } !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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = distinct !{!5, !6} !6 = !{!"llvm.loop.mustprogress"} !7 = !{!8, !8, i64 0} !8 = !{!"omnipotent char", !9, i64 0} !9 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> #include<stdlib.h> #include<math.h> #include<string.h> int main(){ int M; char N[100]; scanf("%s",N); /* int A[N]; int i; for(i=0;i<N;i++){ scanf("%d",&A[i]); } */ M = strlen(N); int i; int counter; counter = 0; for (i=0;i<(M-1)/2;i++){ if(N[i] != N[M-1-i]){ printf("No"); return(0); } } if(M == 3){ printf("Yes"); return(0); } else if(M == 5){ if(N[0]==N[1] && N[3]==N[4]){ printf("Yes"); return(0); } else{ printf("No"); return(0); } } else if(M==7){ if(N[0]==N[2] && N[4]==N[6]){ printf("Yes"); return(0); } else{ printf("No"); return(0); } } else{} if(((M-1)/2)%2 == 1){ int A,B; A = (M-1)/2; B = (M+3)/2; for (i=0;i<(A-1)/2;i++){ if(N[i] != N[A-1-i]){ counter=1;; } else{} } for (i=B-1;i<M-(A+3)/2;i++){ if(N[i] != N[M-1-i]){ counter=1;; } else{} } if(counter == 0){ printf("Yes"); return(0); } else{ printf("No"); return(0); } } else{ int A,B; A = (M-1)/2; B = (M+3)/2; for (i=0;i<A/2;i++){ if(N[i] != N[A-1-i]){ counter=1;; } else{} } for (i=B-1;i<M-A/2;i++){ if(N[i] != N[M-1-i]){ counter=1;; } else{} } if(counter == 0){ printf("Yes"); return(0); } else{ printf("No"); return(0); } } return(0); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_186297/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_186297/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"No\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %N = alloca [100 x i8], align 16 call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %N) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N) %call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %N) #6 %conv = trunc i64 %call2 to i32 %sub = add nsw i32 %conv, -1 %div = sdiv i32 %sub, 2 %cmp227 = icmp sgt i32 %conv, 2 br i1 %cmp227, label %for.body.preheader, label %for.end for.body.preheader: ; preds = %entry %0 = zext i32 %sub to i64 %smax = call i32 @llvm.smax.i32(i32 %div, i32 1) %wide.trip.count = zext i32 %smax to i64 br label %for.body for.cond: ; preds = %for.body %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !5 for.body: ; preds = %for.body.preheader, %for.cond %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.cond ] %arrayidx = getelementptr inbounds [100 x i8], ptr %N, i64 0, i64 %indvars.iv %1 = load i8, ptr %arrayidx, align 1, !tbaa !7 %2 = sub nsw i64 %0, %indvars.iv %arrayidx8 = getelementptr inbounds [100 x i8], ptr %N, i64 0, i64 %2 %3 = load i8, ptr %arrayidx8, align 1, !tbaa !7 %cmp10.not = icmp eq i8 %1, %3 br i1 %cmp10.not, label %for.cond, label %cleanup181 for.end: ; preds = %for.cond, %entry switch i32 %conv, label %if.end60 [ i32 3, label %cleanup181 i32 5, label %if.then19 i32 7, label %if.then39 ] if.then19: ; preds = %for.end %4 = load i8, ptr %N, align 16, !tbaa !7 %arrayidx22 = getelementptr inbounds [100 x i8], ptr %N, i64 0, i64 1 %5 = load i8, ptr %arrayidx22, align 1, !tbaa !7 %cmp24 = icmp eq i8 %4, %5 br i1 %cmp24, label %land.lhs.true, label %if.else34 land.lhs.true: ; preds = %if.then19 %arrayidx26 = getelementptr inbounds [100 x i8], ptr %N, i64 0, i64 3 %6 = load i8, ptr %arrayidx26, align 1, !tbaa !7 %arrayidx28 = getelementptr inbounds [100 x i8], ptr %N, i64 0, i64 4 %7 = load i8, ptr %arrayidx28, align 4, !tbaa !7 %cmp30 = icmp eq i8 %6, %7 br i1 %cmp30, label %cleanup181, label %if.else34 if.else34: ; preds = %land.lhs.true, %if.then19 br label %cleanup181 if.then39: ; preds = %for.end %8 = load i8, ptr %N, align 16, !tbaa !7 %arrayidx42 = getelementptr inbounds [100 x i8], ptr %N, i64 0, i64 2 %9 = load i8, ptr %arrayidx42, align 2, !tbaa !7 %cmp44 = icmp eq i8 %8, %9 br i1 %cmp44, label %land.lhs.true46, label %if.else55 land.lhs.true46: ; preds = %if.then39 %arrayidx47 = getelementptr inbounds [100 x i8], ptr %N, i64 0, i64 4 %10 = load i8, ptr %arrayidx47, align 4, !tbaa !7 %arrayidx49 = getelementptr inbounds [100 x i8], ptr %N, i64 0, i64 6 %11 = load i8, ptr %arrayidx49, align 2, !tbaa !7 %cmp51 = icmp eq i8 %10, %11 br i1 %cmp51, label %cleanup181, label %if.else55 if.else55: ; preds = %land.lhs.true46, %if.then39 br label %cleanup181 if.end60: ; preds = %for.end %12 = and i32 %div, -2147483647 %cmp63 = icmp eq i32 %12, 1 %add = add nsw i32 %conv, 3 %div68 = sdiv i32 %add, 2 br i1 %cmp63, label %if.then65, label %if.else122 if.then65: ; preds = %if.end60 %cmp72239 = icmp sgt i32 %conv, 6 br i1 %cmp72239, label %for.body74.preheader, label %for.end90 for.body74.preheader: ; preds = %if.then65 %sub70 = add nsw i32 %div, -1 %div71276278 = lshr i32 %sub70, 1 %13 = zext i32 %sub70 to i64 %smax266 = call i32 @llvm.smax.i32(i32 %div71276278, i32 1) %wide.trip.count267 = zext i32 %smax266 to i64 %min.iters.check314 = icmp ult i32 %smax266, 8 br i1 %min.iters.check314, label %for.body74.preheader376, label %vector.ph315 vector.ph315: ; preds = %for.body74.preheader %n.vec317 = and i64 %wide.trip.count267, 2147483640 br label %vector.body320 vector.body320: ; preds = %vector.body320, %vector.ph315 %index321 = phi i64 [ 0, %vector.ph315 ], [ %index.next330, %vector.body320 ] %vec.phi322 = phi <4 x i32> [ zeroinitializer, %vector.ph315 ], [ %22, %vector.body320 ] %vec.phi323 = phi <4 x i32> [ zeroinitializer, %vector.ph315 ], [ %23, %vector.body320 ] %14 = getelementptr inbounds [100 x i8], ptr %N, i64 0, i64 %index321 %wide.load324 = load <4 x i8>, ptr %14, align 8, !tbaa !7 %15 = getelementptr inbounds i8, ptr %14, i64 4 %wide.load325 = load <4 x i8>, ptr %15, align 4, !tbaa !7 %16 = sub nsw i64 %13, %index321 %17 = getelementptr inbounds [100 x i8], ptr %N, i64 0, i64 %16 %18 = getelementptr inbounds i8, ptr %17, i64 -3 %wide.load326 = load <4 x i8>, ptr %18, align 1, !tbaa !7 %reverse327 = shufflevector <4 x i8> %wide.load326, <4 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0> %19 = getelementptr inbounds i8, ptr %17, i64 -7 %wide.load328 = load <4 x i8>, ptr %19, align 1, !tbaa !7 %reverse329 = shufflevector <4 x i8> %wide.load328, <4 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0> %20 = icmp eq <4 x i8> %wide.load324, %reverse327 %21 = icmp eq <4 x i8> %wide.load325, %reverse329 %22 = select <4 x i1> %20, <4 x i32> %vec.phi322, <4 x i32> <i32 1, i32 1, i32 1, i32 1> %23 = select <4 x i1> %21, <4 x i32> %vec.phi323, <4 x i32> <i32 1, i32 1, i32 1, i32 1> %index.next330 = add nuw i64 %index321, 8 %24 = icmp eq i64 %index.next330, %n.vec317 br i1 %24, label %middle.block312, label %vector.body320, !llvm.loop !10 middle.block312: ; preds = %vector.body320 %rdx.select.cmp331.not = icmp ne <4 x i32> %22, zeroinitializer %rdx.select.cmp333371 = icmp ne <4 x i32> %23, zeroinitializer %rdx.select.cmp333 = select <4 x i1> %rdx.select.cmp331.not, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i1> %rdx.select.cmp333371 %25 = bitcast <4 x i1> %rdx.select.cmp333 to i4 %.not372 = icmp ne i4 %25, 0 %rdx.select334 = zext i1 %.not372 to i32 %cmp.n319 = icmp eq i64 %n.vec317, %wide.trip.count267 br i1 %cmp.n319, label %for.end90, label %for.body74.preheader376 for.body74.preheader376: ; preds = %for.body74.preheader, %middle.block312 %indvars.iv262.ph = phi i64 [ 0, %for.body74.preheader ], [ %n.vec317, %middle.block312 ] %counter.0240.ph = phi i32 [ 0, %for.body74.preheader ], [ %rdx.select334, %middle.block312 ] br label %for.body74 for.body74: ; preds = %for.body74.preheader376, %for.body74 %indvars.iv262 = phi i64 [ %indvars.iv.next263, %for.body74 ], [ %indvars.iv262.ph, %for.body74.preheader376 ] %counter.0240 = phi i32 [ %spec.select, %for.body74 ], [ %counter.0240.ph, %for.body74.preheader376 ] %arrayidx76 = getelementptr inbounds [100 x i8], ptr %N, i64 0, i64 %indvars.iv262 %26 = load i8, ptr %arrayidx76, align 1, !tbaa !7 %27 = sub nsw i64 %13, %indvars.iv262 %arrayidx81 = getelementptr inbounds [100 x i8], ptr %N, i64 0, i64 %27 %28 = load i8, ptr %arrayidx81, align 1, !tbaa !7 %cmp83.not = icmp eq i8 %26, %28 %spec.select = select i1 %cmp83.not, i32 %counter.0240, i32 1 %indvars.iv.next263 = add nuw nsw i64 %indvars.iv262, 1 %exitcond268.not = icmp eq i64 %indvars.iv.next263, %wide.trip.count267 br i1 %exitcond268.not, label %for.end90, label %for.body74, !llvm.loop !13 for.end90: ; preds = %for.body74, %middle.block312, %if.then65 %counter.0.lcssa = phi i32 [ 0, %if.then65 ], [ %rdx.select334, %middle.block312 ], [ %spec.select, %for.body74 ] %add93 = add nsw i32 %div, 3 %div94.neg = sdiv i32 %add93, -2 %sub95 = add i32 %div94.neg, %conv %cmp96243.not = icmp sgt i32 %div68, %sub95 br i1 %cmp96243.not, label %for.end114, label %for.body98.preheader for.body98.preheader: ; preds = %for.end90 %narrow275 = add nsw i32 %div68, -1 %29 = sext i32 %narrow275 to i64 %30 = sext i32 %sub to i64 %wide.trip.count273 = sext i32 %sub95 to i64 %31 = add nsw i64 %wide.trip.count273, 1 %32 = sext i32 %div68 to i64 %33 = sub nsw i64 %31, %32 %min.iters.check338 = icmp ult i64 %33, 8 br i1 %min.iters.check338, label %for.body98.preheader374, label %vector.ph339 vector.ph339: ; preds = %for.body98.preheader %n.vec341 = and i64 %33, -8 %ind.end342 = add nsw i64 %n.vec341, %29 %minmax.ident.splatinsert349 = insertelement <4 x i32> poison, i32 %counter.0.lcssa, i64 0 %minmax.ident.splat350 = shufflevector <4 x i32> %minmax.ident.splatinsert349, <4 x i32> poison, <4 x i32> zeroinitializer br label %vector.body345 vector.body345: ; preds = %vector.body345, %vector.ph339 %index346 = phi i64 [ 0, %vector.ph339 ], [ %index.next358, %vector.body345 ] %vec.phi347 = phi <4 x i32> [ %minmax.ident.splat350, %vector.ph339 ], [ %42, %vector.body345 ] %vec.phi348 = phi <4 x i32> [ %minmax.ident.splat350, %vector.ph339 ], [ %43, %vector.body345 ] %offset.idx351 = add i64 %index346, %29 %34 = getelementptr inbounds [100 x i8], ptr %N, i64 0, i64 %offset.idx351 %wide.load352 = load <4 x i8>, ptr %34, align 1, !tbaa !7 %35 = getelementptr inbounds i8, ptr %34, i64 4 %wide.load353 = load <4 x i8>, ptr %35, align 1, !tbaa !7 %36 = sub nsw i64 %30, %offset.idx351 %37 = getelementptr inbounds [100 x i8], ptr %N, i64 0, i64 %36 %38 = getelementptr inbounds i8, ptr %37, i64 -3 %wide.load354 = load <4 x i8>, ptr %38, align 1, !tbaa !7 %reverse355 = shufflevector <4 x i8> %wide.load354, <4 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0> %39 = getelementptr inbounds i8, ptr %37, i64 -7 %wide.load356 = load <4 x i8>, ptr %39, align 1, !tbaa !7 %reverse357 = shufflevector <4 x i8> %wide.load356, <4 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0> %40 = icmp eq <4 x i8> %wide.load352, %reverse355 %41 = icmp eq <4 x i8> %wide.load353, %reverse357 %42 = select <4 x i1> %40, <4 x i32> %vec.phi347, <4 x i32> <i32 1, i32 1, i32 1, i32 1> %43 = select <4 x i1> %41, <4 x i32> %vec.phi348, <4 x i32> <i32 1, i32 1, i32 1, i32 1> %index.next358 = add nuw i64 %index346, 8 %44 = icmp eq i64 %index.next358, %n.vec341 br i1 %44, label %middle.block336, label %vector.body345, !llvm.loop !14 middle.block336: ; preds = %vector.body345 %.splatinsert359 = insertelement <4 x i32> poison, i32 %counter.0.lcssa, i64 0 %.splat360 = shufflevector <4 x i32> %.splatinsert359, <4 x i32> poison, <4 x i32> zeroinitializer %rdx.select.cmp361.not = icmp eq <4 x i32> %42, %.splat360 %rdx.select362 = select <4 x i1> %rdx.select.cmp361.not, <4 x i32> %43, <4 x i32> %42 %.splatinsert363 = insertelement <4 x i32> poison, i32 %counter.0.lcssa, i64 0 %.splat364 = shufflevector <4 x i32> %.splatinsert363, <4 x i32> poison, <4 x i32> zeroinitializer %rdx.select.cmp365 = icmp ne <4 x i32> %rdx.select362, %.splat364 %45 = bitcast <4 x i1> %rdx.select.cmp365 to i4 %.not373 = icmp eq i4 %45, 0 %rdx.select366 = select i1 %.not373, i32 %counter.0.lcssa, i32 1 %cmp.n344 = icmp eq i64 %33, %n.vec341 br i1 %cmp.n344, label %for.end114, label %for.body98.preheader374 for.body98.preheader374: ; preds = %for.body98.preheader, %middle.block336 %indvars.iv269.ph = phi i64 [ %29, %for.body98.preheader ], [ %ind.end342, %middle.block336 ] %counter.2244.ph = phi i32 [ %counter.0.lcssa, %for.body98.preheader ], [ %rdx.select366, %middle.block336 ] br label %for.body98 for.body98: ; preds = %for.body98.preheader374, %for.body98 %indvars.iv269 = phi i64 [ %indvars.iv.next270, %for.body98 ], [ %indvars.iv269.ph, %for.body98.preheader374 ] %counter.2244 = phi i32 [ %spec.select222, %for.body98 ], [ %counter.2244.ph, %for.body98.preheader374 ] %arrayidx100 = getelementptr inbounds [100 x i8], ptr %N, i64 0, i64 %indvars.iv269 %46 = load i8, ptr %arrayidx100, align 1, !tbaa !7 %47 = sub nsw i64 %30, %indvars.iv269 %arrayidx105 = getelementptr inbounds [100 x i8], ptr %N, i64 0, i64 %47 %48 = load i8, ptr %arrayidx105, align 1, !tbaa !7 %cmp107.not = icmp eq i8 %46, %48 %spec.select222 = select i1 %cmp107.not, i32 %counter.2244, i32 1 %indvars.iv.next270 = add nsw i64 %indvars.iv269, 1 %exitcond274.not = icmp eq i64 %indvars.iv.next270, %wide.trip.count273 br i1 %exitcond274.not, label %for.end114, label %for.body98, !llvm.loop !15 for.end114: ; preds = %for.body98, %middle.block336, %for.end90 %counter.2.lcssa = phi i32 [ %counter.0.lcssa, %for.end90 ], [ %rdx.select366, %middle.block336 ], [ %spec.select222, %for.body98 ] %cmp115 = icmp eq i32 %counter.2.lcssa, 0 %.str.2..str.1 = select i1 %cmp115, ptr @.str.2, ptr @.str.1 br label %cleanup181 if.else122: ; preds = %if.end60 %div130 = sdiv i32 %sub, 4 %cmp131230 = icmp sgt i32 %conv, 4 br i1 %cmp131230, label %for.body133.preheader, label %for.end149 for.body133.preheader: ; preds = %if.else122 %49 = sext i32 %div to i64 %smax253 = call i32 @llvm.smax.i32(i32 %div130, i32 1) %wide.trip.count254 = zext i32 %smax253 to i64 %min.iters.check = icmp ult i32 %smax253, 8 br i1 %min.iters.check, label %for.body133.preheader382, label %vector.ph vector.ph: ; preds = %for.body133.preheader %n.vec = and i64 %wide.trip.count254, 2147483640 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %59, %vector.body ] %vec.phi279 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %60, %vector.body ] %50 = getelementptr inbounds [100 x i8], ptr %N, i64 0, i64 %index %wide.load = load <4 x i8>, ptr %50, align 8, !tbaa !7 %51 = getelementptr inbounds i8, ptr %50, i64 4 %wide.load280 = load <4 x i8>, ptr %51, align 4, !tbaa !7 %52 = xor i64 %index, -1 %53 = add nsw i64 %49, %52 %54 = getelementptr inbounds [100 x i8], ptr %N, i64 0, i64 %53 %55 = getelementptr inbounds i8, ptr %54, i64 -3 %wide.load281 = load <4 x i8>, ptr %55, align 1, !tbaa !7 %reverse = shufflevector <4 x i8> %wide.load281, <4 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0> %56 = getelementptr inbounds i8, ptr %54, i64 -7 %wide.load282 = load <4 x i8>, ptr %56, align 1, !tbaa !7 %reverse283 = shufflevector <4 x i8> %wide.load282, <4 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0> %57 = icmp eq <4 x i8> %wide.load, %reverse %58 = icmp eq <4 x i8> %wide.load280, %reverse283 %59 = select <4 x i1> %57, <4 x i32> %vec.phi, <4 x i32> <i32 1, i32 1, i32 1, i32 1> %60 = select <4 x i1> %58, <4 x i32> %vec.phi279, <4 x i32> <i32 1, i32 1, i32 1, i32 1> %index.next = add nuw i64 %index, 8 %61 = icmp eq i64 %index.next, %n.vec br i1 %61, label %middle.block, label %vector.body, !llvm.loop !16 middle.block: ; preds = %vector.body %rdx.select.cmp.not = icmp ne <4 x i32> %59, zeroinitializer %rdx.select.cmp284368 = icmp ne <4 x i32> %60, zeroinitializer %rdx.select.cmp284 = select <4 x i1> %rdx.select.cmp.not, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i1> %rdx.select.cmp284368 %62 = bitcast <4 x i1> %rdx.select.cmp284 to i4 %.not = icmp ne i4 %62, 0 %rdx.select285 = zext i1 %.not to i32 %cmp.n = icmp eq i64 %n.vec, %wide.trip.count254 br i1 %cmp.n, label %for.end149, label %for.body133.preheader382 for.body133.preheader382: ; preds = %for.body133.preheader, %middle.block %indvars.iv249.ph = phi i64 [ 0, %for.body133.preheader ], [ %n.vec, %middle.block ] %counter.4231.ph = phi i32 [ 0, %for.body133.preheader ], [ %rdx.select285, %middle.block ] br label %for.body133 for.body133: ; preds = %for.body133.preheader382, %for.body133 %indvars.iv249 = phi i64 [ %indvars.iv.next250, %for.body133 ], [ %indvars.iv249.ph, %for.body133.preheader382 ] %counter.4231 = phi i32 [ %spec.select223, %for.body133 ], [ %counter.4231.ph, %for.body133.preheader382 ] %arrayidx135 = getelementptr inbounds [100 x i8], ptr %N, i64 0, i64 %indvars.iv249 %63 = load i8, ptr %arrayidx135, align 1, !tbaa !7 %64 = xor i64 %indvars.iv249, -1 %65 = add nsw i64 %49, %64 %arrayidx140 = getelementptr inbounds [100 x i8], ptr %N, i64 0, i64 %65 %66 = load i8, ptr %arrayidx140, align 1, !tbaa !7 %cmp142.not = icmp eq i8 %63, %66 %spec.select223 = select i1 %cmp142.not, i32 %counter.4231, i32 1 %indvars.iv.next250 = add nuw nsw i64 %indvars.iv249, 1 %exitcond255.not = icmp eq i64 %indvars.iv.next250, %wide.trip.count254 br i1 %exitcond255.not, label %for.end149, label %for.body133, !llvm.loop !17 for.end149: ; preds = %for.body133, %middle.block, %if.else122 %counter.4.lcssa = phi i32 [ 0, %if.else122 ], [ %rdx.select285, %middle.block ], [ %spec.select223, %for.body133 ] %sub153 = sub nsw i32 %conv, %div130 %cmp154235.not = icmp sgt i32 %div68, %sub153 br i1 %cmp154235.not, label %for.end172, label %for.body156.preheader for.body156.preheader: ; preds = %for.end149 %narrow = add nsw i32 %div68, -1 %67 = sext i32 %narrow to i64 %68 = sext i32 %sub to i64 %wide.trip.count260 = sext i32 %sub153 to i64 %sext = shl i64 %call2, 32 %69 = ashr exact i64 %sext, 32 %70 = add nsw i64 %69, 1 %narrow369 = add nsw i32 %div68, %div130 %71 = sext i32 %narrow369 to i64 %72 = sub nsw i64 %70, %71 %min.iters.check288 = icmp ult i64 %72, 8 br i1 %min.iters.check288, label %for.body156.preheader379, label %vector.ph289 vector.ph289: ; preds = %for.body156.preheader %n.vec291 = and i64 %72, -8 %ind.end = add nsw i64 %n.vec291, %67 %minmax.ident.splatinsert = insertelement <4 x i32> poison, i32 %counter.4.lcssa, i64 0 %minmax.ident.splat = shufflevector <4 x i32> %minmax.ident.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer br label %vector.body294 vector.body294: ; preds = %vector.body294, %vector.ph289 %index295 = phi i64 [ 0, %vector.ph289 ], [ %index.next304, %vector.body294 ] %vec.phi296 = phi <4 x i32> [ %minmax.ident.splat, %vector.ph289 ], [ %81, %vector.body294 ] %vec.phi297 = phi <4 x i32> [ %minmax.ident.splat, %vector.ph289 ], [ %82, %vector.body294 ] %offset.idx = add i64 %index295, %67 %73 = getelementptr inbounds [100 x i8], ptr %N, i64 0, i64 %offset.idx %wide.load298 = load <4 x i8>, ptr %73, align 1, !tbaa !7 %74 = getelementptr inbounds i8, ptr %73, i64 4 %wide.load299 = load <4 x i8>, ptr %74, align 1, !tbaa !7 %75 = sub nsw i64 %68, %offset.idx %76 = getelementptr inbounds [100 x i8], ptr %N, i64 0, i64 %75 %77 = getelementptr inbounds i8, ptr %76, i64 -3 %wide.load300 = load <4 x i8>, ptr %77, align 1, !tbaa !7 %reverse301 = shufflevector <4 x i8> %wide.load300, <4 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0> %78 = getelementptr inbounds i8, ptr %76, i64 -7 %wide.load302 = load <4 x i8>, ptr %78, align 1, !tbaa !7 %reverse303 = shufflevector <4 x i8> %wide.load302, <4 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0> %79 = icmp eq <4 x i8> %wide.load298, %reverse301 %80 = icmp eq <4 x i8> %wide.load299, %reverse303 %81 = select <4 x i1> %79, <4 x i32> %vec.phi296, <4 x i32> <i32 1, i32 1, i32 1, i32 1> %82 = select <4 x i1> %80, <4 x i32> %vec.phi297, <4 x i32> <i32 1, i32 1, i32 1, i32 1> %index.next304 = add nuw i64 %index295, 8 %83 = icmp eq i64 %index.next304, %n.vec291 br i1 %83, label %middle.block286, label %vector.body294, !llvm.loop !18 middle.block286: ; preds = %vector.body294 %.splatinsert = insertelement <4 x i32> poison, i32 %counter.4.lcssa, i64 0 %.splat = shufflevector <4 x i32> %.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer %rdx.select.cmp305.not = icmp eq <4 x i32> %81, %.splat %rdx.select306 = select <4 x i1> %rdx.select.cmp305.not, <4 x i32> %82, <4 x i32> %81 %.splatinsert307 = insertelement <4 x i32> poison, i32 %counter.4.lcssa, i64 0 %.splat308 = shufflevector <4 x i32> %.splatinsert307, <4 x i32> poison, <4 x i32> zeroinitializer %rdx.select.cmp309 = icmp ne <4 x i32> %rdx.select306, %.splat308 %84 = bitcast <4 x i1> %rdx.select.cmp309 to i4 %.not370 = icmp eq i4 %84, 0 %rdx.select310 = select i1 %.not370, i32 %counter.4.lcssa, i32 1 %cmp.n293 = icmp eq i64 %72, %n.vec291 br i1 %cmp.n293, label %for.end172, label %for.body156.preheader379 for.body156.preheader379: ; preds = %for.body156.preheader, %middle.block286 %indvars.iv256.ph = phi i64 [ %67, %for.body156.preheader ], [ %ind.end, %middle.block286 ] %counter.6236.ph = phi i32 [ %counter.4.lcssa, %for.body156.preheader ], [ %rdx.select310, %middle.block286 ] br label %for.body156 for.body156: ; preds = %for.body156.preheader379, %for.body156 %indvars.iv256 = phi i64 [ %indvars.iv.next257, %for.body156 ], [ %indvars.iv256.ph, %for.body156.preheader379 ] %counter.6236 = phi i32 [ %spec.select224, %for.body156 ], [ %counter.6236.ph, %for.body156.preheader379 ] %arrayidx158 = getelementptr inbounds [100 x i8], ptr %N, i64 0, i64 %indvars.iv256 %85 = load i8, ptr %arrayidx158, align 1, !tbaa !7 %86 = sub nsw i64 %68, %indvars.iv256 %arrayidx163 = getelementptr inbounds [100 x i8], ptr %N, i64 0, i64 %86 %87 = load i8, ptr %arrayidx163, align 1, !tbaa !7 %cmp165.not = icmp eq i8 %85, %87 %spec.select224 = select i1 %cmp165.not, i32 %counter.6236, i32 1 %indvars.iv.next257 = add nsw i64 %indvars.iv256, 1 %exitcond261.not = icmp eq i64 %indvars.iv.next257, %wide.trip.count260 br i1 %exitcond261.not, label %for.end172, label %for.body156, !llvm.loop !19 for.end172: ; preds = %for.body156, %middle.block286, %for.end149 %counter.6.lcssa = phi i32 [ %counter.4.lcssa, %for.end149 ], [ %rdx.select310, %middle.block286 ], [ %spec.select224, %for.body156 ] %cmp173 = icmp eq i32 %counter.6.lcssa, 0 %.str.2..str.1277 = select i1 %cmp173, ptr @.str.2, ptr @.str.1 br label %cleanup181 cleanup181: ; preds = %for.body, %for.end172, %for.end114, %land.lhs.true46, %land.lhs.true, %for.end, %if.else55, %if.else34 %.str.2.sink = phi ptr [ @.str.1, %if.else55 ], [ @.str.1, %if.else34 ], [ @.str.2, %for.end ], [ @.str.2, %land.lhs.true ], [ @.str.2, %land.lhs.true46 ], [ %.str.2..str.1, %for.end114 ], [ %.str.2..str.1277, %for.end172 ], [ @.str.1, %for.body ] %call176 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink) call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %N) #5 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #4 attributes #0 = { nofree 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 = { 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 #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #5 = { nounwind } attributes #6 = { nounwind willreturn memory(read) } !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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = distinct !{!5, !6} !6 = !{!"llvm.loop.mustprogress"} !7 = !{!8, !8, i64 0} !8 = !{!"omnipotent char", !9, i64 0} !9 = !{!"Simple C/C++ TBAA"} !10 = distinct !{!10, !6, !11, !12} !11 = !{!"llvm.loop.isvectorized", i32 1} !12 = !{!"llvm.loop.unroll.runtime.disable"} !13 = distinct !{!13, !6, !12, !11} !14 = distinct !{!14, !6, !11, !12} !15 = distinct !{!15, !6, !12, !11} !16 = distinct !{!16, !6, !11, !12} !17 = distinct !{!17, !6, !12, !11} !18 = distinct !{!18, !6, !11, !12} !19 = distinct !{!19, !6, !12, !11}
#include <stdio.h> int main() { int n ; scanf("%d",&n); char str[n]; scanf("%s",str); int i = 1,j = 0; while( j < n){ i++; printf("%c",str[j]); j = j + i; } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_18634/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_18634/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %1 = zext i32 %0 to i64 %2 = call ptr @llvm.stacksave.p0() %vla = alloca i8, i64 %1, align 16 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %vla) %3 = load i32, ptr %n, align 4, !tbaa !5 %cmp6 = icmp sgt i32 %3, 0 br i1 %cmp6, label %while.body, label %while.end while.body: ; preds = %entry, %while.body %indvars.iv = phi i64 [ %indvars.iv.next, %while.body ], [ 1, %entry ] %j.08 = phi i32 [ %add, %while.body ], [ 0, %entry ] %indvars.iv.next = add nuw i64 %indvars.iv, 1 %idxprom = zext i32 %j.08 to i64 %arrayidx = getelementptr inbounds i8, ptr %vla, i64 %idxprom %4 = load i8, ptr %arrayidx, align 1, !tbaa !9 %conv = sext i8 %4 to i32 %putchar = call i32 @putchar(i32 %conv) %5 = trunc i64 %indvars.iv.next to i32 %add = add nuw nsw i32 %j.08, %5 %6 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %add, %6 br i1 %cmp, label %while.body, label %while.end, !llvm.loop !10 while.end: ; preds = %while.body, %entry call void @llvm.stackrestore.p0(ptr %2) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare ptr @llvm.stacksave.p0() #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare void @llvm.stackrestore.p0(ptr) #3 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4 attributes #0 = { nofree 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 = { 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 #3 = { mustprogress nocallback nofree nosync nounwind willreturn } attributes #4 = { nofree nounwind } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"}
#include<stdio.h> int str_count(char *str){ int i = 0; while(str[i] != '\0'){ i++; } return i; } int is_palindrome(char *str, int a, int b){ for(int i = 0;i <= (a + b) / 2 - a;i++){ if(str[a + i] != str[b - i]){ return 0; } } return 1; } int main(){ int n, flag = 0; char str[100]; scanf("%s", str); n = str_count(str); if(is_palindrome(str, 0, (n - 1) / 2 - 1)){ if(is_palindrome(str, (n + 3) / 2 - 1 , n - 1)){ if(is_palindrome(str, 0, n - 1)){ flag = 1; } } } if(flag == 1){ printf("Yes"); } else{ printf("No"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_186398/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_186398/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1 @.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1 ; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable define dso_local i32 @str_count(ptr nocapture noundef readonly %str) local_unnamed_addr #0 { entry: br label %while.cond while.cond: ; preds = %while.cond, %entry %indvars.iv = phi i64 [ %indvars.iv.next, %while.cond ], [ 0, %entry ] %arrayidx = getelementptr inbounds i8, ptr %str, i64 %indvars.iv %0 = load i8, ptr %arrayidx, align 1, !tbaa !5 %cmp.not = icmp eq i8 %0, 0 %indvars.iv.next = add nuw i64 %indvars.iv, 1 br i1 %cmp.not, label %while.end, label %while.cond, !llvm.loop !8 while.end: ; preds = %while.cond %1 = trunc i64 %indvars.iv to i32 ret i32 %1 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable define dso_local i32 @is_palindrome(ptr nocapture noundef readonly %str, i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 { entry: %add = add nsw i32 %b, %a %div = sdiv i32 %add, 2 %sub = sub nsw i32 %div, %a %cmp.not15 = icmp slt i32 %sub, 0 br i1 %cmp.not15, label %cleanup, label %for.body.preheader for.body.preheader: ; preds = %entry %0 = sext i32 %a to i64 %1 = sext i32 %b to i64 %2 = zext i32 %sub to i64 %3 = add nsw i32 %div, 1 %4 = sub i32 %3, %a %wide.trip.count = zext i32 %4 to i64 %invariant.gep = getelementptr i8, ptr %str, i64 %0 %5 = load i8, ptr %invariant.gep, align 1, !tbaa !5 %arrayidx421 = getelementptr inbounds i8, ptr %str, i64 %1 %6 = load i8, ptr %arrayidx421, align 1, !tbaa !5 %cmp6.not22 = icmp eq i8 %5, %6 br i1 %cmp6.not22, label %for.cond, label %cleanup for.cond: ; preds = %for.body.preheader, %for.body %indvars.iv23 = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.body.preheader ] %indvars.iv.next = add nuw nsw i64 %indvars.iv23, 1 %exitcond = icmp eq i64 %indvars.iv.next, %wide.trip.count br i1 %exitcond, label %cleanup.loopexit.loopexit, label %for.body, !llvm.loop !10 for.body: ; preds = %for.cond %gep = getelementptr i8, ptr %invariant.gep, i64 %indvars.iv.next %7 = load i8, ptr %gep, align 1, !tbaa !5 %8 = sub nsw i64 %1, %indvars.iv.next %arrayidx4 = getelementptr inbounds i8, ptr %str, i64 %8 %9 = load i8, ptr %arrayidx4, align 1, !tbaa !5 %cmp6.not = icmp eq i8 %7, %9 br i1 %cmp6.not, label %for.cond, label %cleanup.loopexit.loopexit, !llvm.loop !10 cleanup.loopexit.loopexit: ; preds = %for.body, %for.cond %cmp.not.le = icmp uge i64 %indvars.iv23, %2 %10 = zext i1 %cmp.not.le to i32 br label %cleanup cleanup: ; preds = %for.body.preheader, %cleanup.loopexit.loopexit, %entry %cmp.not.lcssa = phi i32 [ 1, %entry ], [ 0, %for.body.preheader ], [ %10, %cleanup.loopexit.loopexit ] ret i32 %cmp.not.lcssa } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %str = alloca [100 x i8], align 16 call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %str) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str) br label %while.cond.i while.cond.i: ; preds = %while.cond.i, %entry %indvars.iv.i = phi i64 [ %indvars.iv.next.i, %while.cond.i ], [ 0, %entry ] %arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.i %0 = load i8, ptr %arrayidx.i, align 1, !tbaa !5 %cmp.not.i = icmp eq i8 %0, 0 %indvars.iv.next.i = add nuw i64 %indvars.iv.i, 1 br i1 %cmp.not.i, label %str_count.exit, label %while.cond.i, !llvm.loop !8 str_count.exit: ; preds = %while.cond.i %1 = trunc i64 %indvars.iv.i to i32 %sub = add nsw i32 %1, -1 %div = sdiv i32 %sub, 2 %cmp.not15.i = icmp slt i32 %1, 0 br i1 %cmp.not15.i, label %if.then, label %for.body.preheader.i for.body.preheader.i: ; preds = %str_count.exit %sub4 = add nsw i32 %div, -1 %div.i = sdiv i32 %sub4, 2 %2 = sext i32 %sub4 to i64 %3 = zext i32 %div.i to i64 %4 = add nuw nsw i32 %div.i, 1 %wide.trip.count.i = zext i32 %4 to i64 %5 = load i8, ptr %str, align 16, !tbaa !5 %arrayidx4.i73 = getelementptr inbounds i8, ptr %str, i64 %2 %6 = load i8, ptr %arrayidx4.i73, align 1, !tbaa !5 %cmp6.not.i74 = icmp eq i8 %5, %6 br i1 %cmp6.not.i74, label %for.cond.i, label %if.else for.cond.i: ; preds = %for.body.preheader.i, %for.body.i %indvars.iv.i2775 = phi i64 [ %indvars.iv.next.i28, %for.body.i ], [ 0, %for.body.preheader.i ] %indvars.iv.next.i28 = add nuw nsw i64 %indvars.iv.i2775, 1 %exitcond.i = icmp eq i64 %indvars.iv.next.i28, %wide.trip.count.i br i1 %exitcond.i, label %is_palindrome.exit, label %for.body.i, !llvm.loop !10 for.body.i: ; preds = %for.cond.i %gep.i = getelementptr i8, ptr %str, i64 %indvars.iv.next.i28 %7 = load i8, ptr %gep.i, align 1, !tbaa !5 %8 = sub nsw i64 %2, %indvars.iv.next.i28 %arrayidx4.i = getelementptr inbounds i8, ptr %str, i64 %8 %9 = load i8, ptr %arrayidx4.i, align 1, !tbaa !5 %cmp6.not.i = icmp eq i8 %7, %9 br i1 %cmp6.not.i, label %for.cond.i, label %is_palindrome.exit, !llvm.loop !10 is_palindrome.exit: ; preds = %for.body.i, %for.cond.i %cmp.not.i29.not.le = icmp ult i64 %indvars.iv.i2775, %3 br i1 %cmp.not.i29.not.le, label %if.else, label %if.then if.then: ; preds = %str_count.exit, %is_palindrome.exit %add = add nsw i32 %1, 3 %div7 = sdiv i32 %add, 2 %sub8 = add nsw i32 %div7, -1 %add.i = add nsw i32 %sub8, %sub %div.i30 = sdiv i32 %add.i, 2 %sub.i = sub nsw i32 %div.i30, %sub8 %cmp.not15.i31 = icmp slt i32 %sub.i, 0 br i1 %cmp.not15.i31, label %if.then12, label %for.body.preheader.i32 for.body.preheader.i32: ; preds = %if.then %10 = sext i32 %sub8 to i64 %11 = sext i32 %sub to i64 %12 = zext i32 %sub.i to i64 %reass.sub = sub nsw i32 %div.i30, %div7 %13 = add nsw i32 %reass.sub, 2 %wide.trip.count.i33 = zext i32 %13 to i64 %invariant.gep.i = getelementptr i8, ptr %str, i64 %10 %14 = load i8, ptr %invariant.gep.i, align 1, !tbaa !5 %arrayidx4.i3877 = getelementptr inbounds i8, ptr %str, i64 %11 %15 = load i8, ptr %arrayidx4.i3877, align 1, !tbaa !5 %cmp6.not.i3978 = icmp eq i8 %14, %15 br i1 %cmp6.not.i3978, label %for.cond.i43, label %if.else for.cond.i43: ; preds = %for.body.preheader.i32, %for.body.i34 %indvars.iv.i3579 = phi i64 [ %indvars.iv.next.i44, %for.body.i34 ], [ 0, %for.body.preheader.i32 ] %indvars.iv.next.i44 = add nuw nsw i64 %indvars.iv.i3579, 1 %exitcond.i46 = icmp eq i64 %indvars.iv.next.i44, %wide.trip.count.i33 br i1 %exitcond.i46, label %is_palindrome.exit47, label %for.body.i34, !llvm.loop !10 for.body.i34: ; preds = %for.cond.i43 %gep.i37 = getelementptr i8, ptr %invariant.gep.i, i64 %indvars.iv.next.i44 %16 = load i8, ptr %gep.i37, align 1, !tbaa !5 %17 = sub nsw i64 %11, %indvars.iv.next.i44 %arrayidx4.i38 = getelementptr inbounds i8, ptr %str, i64 %17 %18 = load i8, ptr %arrayidx4.i38, align 1, !tbaa !5 %cmp6.not.i39 = icmp eq i8 %16, %18 br i1 %cmp6.not.i39, label %for.cond.i43, label %is_palindrome.exit47, !llvm.loop !10 is_palindrome.exit47: ; preds = %for.body.i34, %for.cond.i43 %cmp.not.i45.not.le = icmp ult i64 %indvars.iv.i3579, %12 br i1 %cmp.not.i45.not.le, label %if.else, label %if.then12 if.then12: ; preds = %if.then, %is_palindrome.exit47 br i1 %cmp.not15.i, label %if.end23, label %for.body.preheader.i50 for.body.preheader.i50: ; preds = %if.then12 %19 = sext i32 %sub to i64 %20 = zext i32 %div to i64 %21 = add nuw nsw i32 %div, 1 %wide.trip.count.i51 = zext i32 %21 to i64 %22 = load i8, ptr %str, align 16, !tbaa !5 %arrayidx4.i5682 = getelementptr inbounds i8, ptr %str, i64 %19 %23 = load i8, ptr %arrayidx4.i5682, align 1, !tbaa !5 %cmp6.not.i5783 = icmp eq i8 %22, %23 br i1 %cmp6.not.i5783, label %for.cond.i61, label %if.else for.cond.i61: ; preds = %for.body.preheader.i50, %for.body.i52 %indvars.iv.i5384 = phi i64 [ %indvars.iv.next.i62, %for.body.i52 ], [ 0, %for.body.preheader.i50 ] %indvars.iv.next.i62 = add nuw nsw i64 %indvars.iv.i5384, 1 %exitcond.i64 = icmp eq i64 %indvars.iv.next.i62, %wide.trip.count.i51 br i1 %exitcond.i64, label %is_palindrome.exit65, label %for.body.i52, !llvm.loop !10 for.body.i52: ; preds = %for.cond.i61 %gep.i55 = getelementptr i8, ptr %str, i64 %indvars.iv.next.i62 %24 = load i8, ptr %gep.i55, align 1, !tbaa !5 %25 = sub nsw i64 %19, %indvars.iv.next.i62 %arrayidx4.i56 = getelementptr inbounds i8, ptr %str, i64 %25 %26 = load i8, ptr %arrayidx4.i56, align 1, !tbaa !5 %cmp6.not.i57 = icmp eq i8 %24, %26 br i1 %cmp6.not.i57, label %for.cond.i61, label %is_palindrome.exit65, !llvm.loop !10 is_palindrome.exit65: ; preds = %for.body.i52, %for.cond.i61 %cmp.not.i63.le = icmp uge i64 %indvars.iv.i5384, %20 %27 = freeze i1 %cmp.not.i63.le br i1 %27, label %if.end23, label %if.else if.else: ; preds = %for.body.preheader.i50, %for.body.preheader.i32, %for.body.preheader.i, %is_palindrome.exit65, %is_palindrome.exit47, %is_palindrome.exit br label %if.end23 if.end23: ; preds = %is_palindrome.exit65, %if.then12, %if.else %.str.2.sink = phi ptr [ @.str.2, %if.else ], [ @.str.1, %if.then12 ], [ @.str.1, %is_palindrome.exit65 ] %call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink) call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %str) #4 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 attributes #0 = { nofree norecurse nosync nounwind memory(argmem: 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { 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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"omnipotent char", !7, i64 0} !7 = !{!"Simple C/C++ TBAA"} !8 = distinct !{!8, !9} !9 = !{!"llvm.loop.mustprogress"} !10 = distinct !{!10, !9}
#include <stdio.h> #include<string.h> int main() { char a[1000]; int i, j, n, b, c; scanf("%s", a); n = strlen(a); b = (n - 1) / 2; c = (n + 3) / 2; for (i = 0; i < n; i++) { if (a[i] != a[n - i - 1]) { printf("No"); return 0; } } for (i = 0; i < b; i++) { if (a[i] != a[b - i - 1]) { printf("No"); return 0; } } for (i = c - 1; i < n; i++) { if (a[i] != a[n - i - 1]) { printf("No"); return 0; } } printf("Yes"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_186440/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_186440/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"No\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca [1000 x i8], align 16 call void @llvm.lifetime.start.p0(i64 1000, ptr nonnull %a) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a) %call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %a) #6 %conv = trunc i64 %call2 to i32 %sub = add nsw i32 %conv, -1 %div = sdiv i32 %sub, 2 %add = add nsw i32 %conv, 3 %div3 = sdiv i32 %add, 2 %cmp78 = icmp sgt i32 %conv, 0 br i1 %cmp78, label %for.body.preheader, label %for.end33 for.body.preheader: ; preds = %entry %wide.trip.count = and i64 %call2, 4294967295 br label %for.body for.cond: ; preds = %for.body %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count br i1 %exitcond.not, label %for.cond14.preheader, label %for.body, !llvm.loop !5 for.cond14.preheader: ; preds = %for.cond %cmp1580 = icmp sgt i32 %conv, 2 br i1 %cmp1580, label %for.body17.preheader, label %for.end33 for.body17.preheader: ; preds = %for.cond14.preheader %smax = call i32 @llvm.smax.i32(i32 %div, i32 1) %wide.trip.count88 = zext i32 %smax to i64 br label %for.body17 for.body: ; preds = %for.body.preheader, %for.cond %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.cond ] %arrayidx = getelementptr inbounds [1000 x i8], ptr %a, i64 0, i64 %indvars.iv %0 = load i8, ptr %arrayidx, align 1, !tbaa !7 %1 = xor i64 %indvars.iv, -1 %sub7 = add i64 %call2, %1 %sext = shl i64 %sub7, 32 %idxprom8 = ashr exact i64 %sext, 32 %arrayidx9 = getelementptr inbounds [1000 x i8], ptr %a, i64 0, i64 %idxprom8 %2 = load i8, ptr %arrayidx9, align 1, !tbaa !7 %cmp11.not = icmp eq i8 %0, %2 br i1 %cmp11.not, label %for.cond, label %cleanup for.cond14: ; preds = %for.body17 %indvars.iv.next86 = add nuw nsw i64 %indvars.iv85, 1 %exitcond89.not = icmp eq i64 %indvars.iv.next86, %wide.trip.count88 br i1 %exitcond89.not, label %for.end33, label %for.body17, !llvm.loop !10 for.body17: ; preds = %for.body17.preheader, %for.cond14 %indvars.iv85 = phi i64 [ 0, %for.body17.preheader ], [ %indvars.iv.next86, %for.cond14 ] %arrayidx19 = getelementptr inbounds [1000 x i8], ptr %a, i64 0, i64 %indvars.iv85 %3 = load i8, ptr %arrayidx19, align 1, !tbaa !7 %4 = trunc i64 %indvars.iv85 to i32 %5 = xor i32 %4, -1 %sub22 = add i32 %div, %5 %idxprom23 = sext i32 %sub22 to i64 %arrayidx24 = getelementptr inbounds [1000 x i8], ptr %a, i64 0, i64 %idxprom23 %6 = load i8, ptr %arrayidx24, align 1, !tbaa !7 %cmp26.not = icmp eq i8 %3, %6 br i1 %cmp26.not, label %for.cond14, label %cleanup for.end33: ; preds = %for.cond14, %entry, %for.cond14.preheader %cmp3682.not = icmp sgt i32 %div3, %conv br i1 %cmp3682.not, label %cleanup, label %for.body38.preheader for.body38.preheader: ; preds = %for.end33 %narrow = add nsw i32 %div3, -1 %7 = sext i32 %narrow to i64 br label %for.body38 for.cond35: ; preds = %for.body38 %indvars.iv.next91 = add nsw i64 %indvars.iv90, 1 %lftr.wideiv = trunc i64 %indvars.iv.next91 to i32 %exitcond93.not = icmp eq i32 %lftr.wideiv, %conv br i1 %exitcond93.not, label %cleanup, label %for.body38, !llvm.loop !11 for.body38: ; preds = %for.body38.preheader, %for.cond35 %indvars.iv90 = phi i64 [ %7, %for.body38.preheader ], [ %indvars.iv.next91, %for.cond35 ] %arrayidx40 = getelementptr inbounds [1000 x i8], ptr %a, i64 0, i64 %indvars.iv90 %8 = load i8, ptr %arrayidx40, align 1, !tbaa !7 %9 = xor i64 %indvars.iv90, -1 %sub43 = add i64 %call2, %9 %sext94 = shl i64 %sub43, 32 %idxprom44 = ashr exact i64 %sext94, 32 %arrayidx45 = getelementptr inbounds [1000 x i8], ptr %a, i64 0, i64 %idxprom44 %10 = load i8, ptr %arrayidx45, align 1, !tbaa !7 %cmp47.not = icmp eq i8 %8, %10 br i1 %cmp47.not, label %for.cond35, label %cleanup cleanup: ; preds = %for.body, %for.body17, %for.cond35, %for.body38, %for.end33 %.str.2.sink = phi ptr [ @.str.2, %for.end33 ], [ @.str.1, %for.body38 ], [ @.str.2, %for.cond35 ], [ @.str.1, %for.body17 ], [ @.str.1, %for.body ] %call55 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink) call void @llvm.lifetime.end.p0(i64 1000, ptr nonnull %a) #5 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #4 attributes #0 = { nofree 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 = { 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 #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #5 = { nounwind } attributes #6 = { nounwind willreturn memory(read) } !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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = distinct !{!5, !6} !6 = !{!"llvm.loop.mustprogress"} !7 = !{!8, !8, i64 0} !8 = !{!"omnipotent char", !9, i64 0} !9 = !{!"Simple C/C++ TBAA"} !10 = distinct !{!10, !6} !11 = distinct !{!11, !6}
#include<stdio.h> int main(void) { int x; int y; for(;;){ scanf("%d %d", &x, &y); if(x == 0 && y == 0){ break; } if(x < y){ printf("%d %d\n", x, y); } else { printf("%d %d\n", y, x); } } return (0); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_186484/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_186484/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.1 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %x = alloca i32, align 4 %y = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #3 %call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y) %0 = load i32, ptr %x, align 4, !tbaa !5 %cmp10 = icmp eq i32 %0, 0 %1 = load i32, ptr %y, align 4 %cmp111 = icmp eq i32 %1, 0 %or.cond12 = select i1 %cmp10, i1 %cmp111, i1 false br i1 %or.cond12, label %for.end, label %if.end if.end: ; preds = %entry, %if.end6 %2 = phi i32 [ %5, %if.end6 ], [ %1, %entry ] %3 = phi i32 [ %4, %if.end6 ], [ %0, %entry ] %cmp2 = icmp slt i32 %3, %2 br i1 %cmp2, label %if.then3, label %if.else if.then3: ; preds = %if.end %call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %3, i32 noundef %2) br label %if.end6 if.else: ; preds = %if.end %call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %2, i32 noundef %3) br label %if.end6 if.end6: ; preds = %if.else, %if.then3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y) %4 = load i32, ptr %x, align 4, !tbaa !5 %cmp = icmp eq i32 %4, 0 %5 = load i32, ptr %y, align 4 %cmp1 = icmp eq i32 %5, 0 %or.cond = select i1 %cmp, i1 %cmp1, i1 false br i1 %or.cond, label %for.end, label %if.end for.end: ; preds = %if.end6, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 attributes #0 = { nofree 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 = { 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 #3 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> int main(void) { int x,y,tmp,i; for(i=1;;i++) { scanf("%d %d",&x,&y); if(x ==0 && y==0){ break; } if(x>y){ tmp=x; x=y; y=tmp; } printf("%d %d\n",x,y); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_186534/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_186534/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.1 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %x = alloca i32, align 4 %y = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #3 %call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y) %0 = load i32, ptr %x, align 4, !tbaa !5 %cmp8 = icmp eq i32 %0, 0 %1 = load i32, ptr %y, align 4 %cmp19 = icmp eq i32 %1, 0 %or.cond10 = select i1 %cmp8, i1 %cmp19, i1 false br i1 %or.cond10, label %for.end, label %if.end if.end: ; preds = %entry, %if.end4 %2 = phi i32 [ %7, %if.end4 ], [ %1, %entry ] %3 = phi i32 [ %6, %if.end4 ], [ %0, %entry ] %cmp2 = icmp sgt i32 %3, %2 br i1 %cmp2, label %if.then3, label %if.end4 if.then3: ; preds = %if.end store i32 %2, ptr %x, align 4, !tbaa !5 store i32 %3, ptr %y, align 4, !tbaa !5 br label %if.end4 if.end4: ; preds = %if.then3, %if.end %4 = phi i32 [ %3, %if.then3 ], [ %2, %if.end ] %5 = phi i32 [ %2, %if.then3 ], [ %3, %if.end ] %call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5, i32 noundef %4) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y) %6 = load i32, ptr %x, align 4, !tbaa !5 %cmp = icmp eq i32 %6, 0 %7 = load i32, ptr %y, align 4 %cmp1 = icmp eq i32 %7, 0 %or.cond = select i1 %cmp, i1 %cmp1, i1 false br i1 %or.cond, label %for.end, label %if.end for.end: ; preds = %if.end4, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 attributes #0 = { nofree 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 = { 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 #3 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> int main(void) { int x, y; scanf("%d %d", &x, &y); while (x != 0 || y != 0){ if (x < y){ printf("%d %d\n", x, y); } else { printf("%d %d\n", y, x); } scanf("%d %d", &x, &y); } return (0); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_186578/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_186578/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.1 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %x = alloca i32, align 4 %y = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y) %0 = load i32, ptr %x, align 4, !tbaa !5 %cmp8 = icmp ne i32 %0, 0 %1 = load i32, ptr %y, align 4 %cmp19 = icmp ne i32 %1, 0 %2 = select i1 %cmp8, i1 true, i1 %cmp19 br i1 %2, label %while.body, label %while.end while.body: ; preds = %entry, %if.end %3 = phi i32 [ %6, %if.end ], [ %1, %entry ] %4 = phi i32 [ %5, %if.end ], [ %0, %entry ] %cmp2 = icmp slt i32 %4, %3 br i1 %cmp2, label %if.then, label %if.else if.then: ; preds = %while.body %call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %4, i32 noundef %3) br label %if.end if.else: ; preds = %while.body %call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %3, i32 noundef %4) br label %if.end if.end: ; preds = %if.else, %if.then %call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y) %5 = load i32, ptr %x, align 4, !tbaa !5 %cmp = icmp ne i32 %5, 0 %6 = load i32, ptr %y, align 4 %cmp1 = icmp ne i32 %6, 0 %7 = select i1 %cmp, i1 true, i1 %cmp1 br i1 %7, label %while.body, label %while.end, !llvm.loop !9 while.end: ; preds = %if.end, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 attributes #0 = { nofree 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 = { 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 #3 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"}
#include<stdio.h> int main(){ int a,b,c; while(1){ scanf("%d%d",&a,&b); if(a==0 && b==0) break; if(b<a){ c=a; a=b; b=c; } printf("%d %d\n",a,b); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_186642/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_186642/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1 @.str.1 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i32, align 4 %b = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3 %call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b) %0 = load i32, ptr %a, align 4, !tbaa !5 %cmp8 = icmp eq i32 %0, 0 %1 = load i32, ptr %b, align 4 %cmp19 = icmp eq i32 %1, 0 %or.cond10 = select i1 %cmp8, i1 %cmp19, i1 false br i1 %or.cond10, label %while.end, label %if.end if.end: ; preds = %entry, %if.end4 %2 = phi i32 [ %7, %if.end4 ], [ %1, %entry ] %3 = phi i32 [ %6, %if.end4 ], [ %0, %entry ] %cmp2 = icmp slt i32 %2, %3 br i1 %cmp2, label %if.then3, label %if.end4 if.then3: ; preds = %if.end store i32 %2, ptr %a, align 4, !tbaa !5 store i32 %3, ptr %b, align 4, !tbaa !5 br label %if.end4 if.end4: ; preds = %if.then3, %if.end %4 = phi i32 [ %3, %if.then3 ], [ %2, %if.end ] %5 = phi i32 [ %2, %if.then3 ], [ %3, %if.end ] %call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5, i32 noundef %4) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b) %6 = load i32, ptr %a, align 4, !tbaa !5 %cmp = icmp eq i32 %6, 0 %7 = load i32, ptr %b, align 4 %cmp1 = icmp eq i32 %7, 0 %or.cond = select i1 %cmp, i1 %cmp1, i1 false br i1 %or.cond, label %while.end, label %if.end while.end: ; preds = %if.end4, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 attributes #0 = { nofree 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 = { 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 #3 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> int main() { int a, b, swap; for (;;) { scanf("%d %d", &a, &b); if (a == 0 && b == 0) { return 0; } if (a > b) { swap = a; a = b; b = swap; } printf("%d %d\n", a, b); } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_186686/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_186686/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.1 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i32, align 4 %b = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3 %call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b) %0 = load i32, ptr %a, align 4, !tbaa !5 %cmp8 = icmp eq i32 %0, 0 %1 = load i32, ptr %b, align 4 %cmp19 = icmp eq i32 %1, 0 %or.cond10 = select i1 %cmp8, i1 %cmp19, i1 false br i1 %or.cond10, label %if.then, label %if.end if.then: ; preds = %if.end4, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3 ret i32 0 if.end: ; preds = %entry, %if.end4 %2 = phi i32 [ %7, %if.end4 ], [ %1, %entry ] %3 = phi i32 [ %6, %if.end4 ], [ %0, %entry ] %cmp2 = icmp sgt i32 %3, %2 br i1 %cmp2, label %if.then3, label %if.end4 if.then3: ; preds = %if.end store i32 %2, ptr %a, align 4, !tbaa !5 store i32 %3, ptr %b, align 4, !tbaa !5 br label %if.end4 if.end4: ; preds = %if.then3, %if.end %4 = phi i32 [ %3, %if.then3 ], [ %2, %if.end ] %5 = phi i32 [ %2, %if.then3 ], [ %3, %if.end ] %call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5, i32 noundef %4) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b) %6 = load i32, ptr %a, align 4, !tbaa !5 %cmp = icmp eq i32 %6, 0 %7 = load i32, ptr %b, align 4 %cmp1 = icmp eq i32 %7, 0 %or.cond = select i1 %cmp, i1 %cmp1, i1 false br i1 %or.cond, label %if.then, label %if.end } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 attributes #0 = { nofree 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 = { 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 #3 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> int main(void) { int x=1,y=1,z=1; while( 1 == 1 ) { scanf("%d%d",&x,&y); if( x == y && y == 0 ) { break; } else { if(x > y) { printf("%d %d\n", y, x); } else { printf("%d %d\n", x, y); } } z = z + 1; } return 0 ; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_186743/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_186743/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1 @.str.1 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %x = alloca i32, align 4 %y = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3 store i32 1, ptr %x, align 4, !tbaa !5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #3 store i32 1, ptr %y, align 4, !tbaa !5 %call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y) %0 = load i32, ptr %x, align 4, !tbaa !5 %1 = load i32, ptr %y, align 4 %2 = or i32 %1, %0 %or.cond11 = icmp eq i32 %2, 0 br i1 %or.cond11, label %while.end, label %if.else if.else: ; preds = %entry, %if.end7 %3 = phi i32 [ %6, %if.end7 ], [ %1, %entry ] %4 = phi i32 [ %5, %if.end7 ], [ %0, %entry ] %cmp2 = icmp sgt i32 %4, %3 br i1 %cmp2, label %if.then3, label %if.else5 if.then3: ; preds = %if.else %call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %3, i32 noundef %4) br label %if.end7 if.else5: ; preds = %if.else %call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %4, i32 noundef %3) br label %if.end7 if.end7: ; preds = %if.then3, %if.else5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y) %5 = load i32, ptr %x, align 4, !tbaa !5 %6 = load i32, ptr %y, align 4 %7 = or i32 %6, %5 %or.cond = icmp eq i32 %7, 0 br i1 %or.cond, label %while.end, label %if.else while.end: ; preds = %if.end7, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 attributes #0 = { nofree 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 = { 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 #3 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> int main(void){ int x ,y ,n; for(n = 0; ;++n){ scanf("%d %d",&x ,&y); if(x == 0 && y == 0) break; if(x < y){ printf("%d %d\n",x ,y); } else{ printf("%d %d\n",y ,x); } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_186808/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_186808/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.1 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %x = alloca i32, align 4 %y = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #3 %call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y) %0 = load i32, ptr %x, align 4, !tbaa !5 %cmp10 = icmp eq i32 %0, 0 %1 = load i32, ptr %y, align 4 %cmp111 = icmp eq i32 %1, 0 %or.cond12 = select i1 %cmp10, i1 %cmp111, i1 false br i1 %or.cond12, label %for.end, label %if.end if.end: ; preds = %entry, %for.inc %2 = phi i32 [ %5, %for.inc ], [ %1, %entry ] %3 = phi i32 [ %4, %for.inc ], [ %0, %entry ] %cmp2 = icmp slt i32 %3, %2 br i1 %cmp2, label %if.then3, label %if.else if.then3: ; preds = %if.end %call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %3, i32 noundef %2) br label %for.inc if.else: ; preds = %if.end %call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %2, i32 noundef %3) br label %for.inc for.inc: ; preds = %if.then3, %if.else %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y) %4 = load i32, ptr %x, align 4, !tbaa !5 %cmp = icmp eq i32 %4, 0 %5 = load i32, ptr %y, align 4 %cmp1 = icmp eq i32 %5, 0 %or.cond = select i1 %cmp, i1 %cmp1, i1 false br i1 %or.cond, label %for.end, label %if.end for.end: ; preds = %for.inc, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 attributes #0 = { nofree 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 = { 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 #3 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> int main() { int a,b,temp; while (1) { scanf("%d %d", &a, &b); if (a == 0 && b == 0) { return 0; } if (a > b) { temp = a; a = b; b = temp; } printf("%d %d\n",a,b); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_186851/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_186851/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.1 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i32, align 4 %b = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3 %call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b) %0 = load i32, ptr %a, align 4, !tbaa !5 %cmp8 = icmp eq i32 %0, 0 %1 = load i32, ptr %b, align 4 %cmp19 = icmp eq i32 %1, 0 %or.cond10 = select i1 %cmp8, i1 %cmp19, i1 false br i1 %or.cond10, label %if.then, label %if.end if.then: ; preds = %if.end4, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3 ret i32 0 if.end: ; preds = %entry, %if.end4 %2 = phi i32 [ %7, %if.end4 ], [ %1, %entry ] %3 = phi i32 [ %6, %if.end4 ], [ %0, %entry ] %cmp2 = icmp sgt i32 %3, %2 br i1 %cmp2, label %if.then3, label %if.end4 if.then3: ; preds = %if.end store i32 %2, ptr %a, align 4, !tbaa !5 store i32 %3, ptr %b, align 4, !tbaa !5 br label %if.end4 if.end4: ; preds = %if.then3, %if.end %4 = phi i32 [ %3, %if.then3 ], [ %2, %if.end ] %5 = phi i32 [ %2, %if.then3 ], [ %3, %if.end ] %call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5, i32 noundef %4) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b) %6 = load i32, ptr %a, align 4, !tbaa !5 %cmp = icmp eq i32 %6, 0 %7 = load i32, ptr %b, align 4 %cmp1 = icmp eq i32 %7, 0 %or.cond = select i1 %cmp, i1 %cmp1, i1 false br i1 %or.cond, label %if.then, label %if.end } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 attributes #0 = { nofree 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 = { 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 #3 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> int main () { int n, i; long long r; scanf ("%d", &n); r = 1; for (i = 1; i < n+1; ++i) { r *= i; r = r % 1000000007; } printf ("%lld\n", r); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_186909/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_186909/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp.not6 = icmp slt i32 %0, 1 br i1 %cmp.not6, label %for.end, label %for.body.preheader for.body.preheader: ; preds = %entry %1 = add nuw i32 %0, 1 %wide.trip.count = zext i32 %1 to i64 %2 = add nsw i64 %wide.trip.count, -1 %3 = add nsw i64 %wide.trip.count, -2 %xtraiter = and i64 %2, 3 %4 = icmp ult i64 %3, 3 br i1 %4, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new for.body.preheader.new: ; preds = %for.body.preheader %unroll_iter = and i64 %2, -4 br label %for.body for.body: ; preds = %for.body, %for.body.preheader.new %indvars.iv = phi i64 [ 1, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ] %r.08 = phi i64 [ 1, %for.body.preheader.new ], [ %rem.3, %for.body ] %niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ] %mul = mul nsw i64 %r.08, %indvars.iv %rem = srem i64 %mul, 1000000007 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %mul.1 = mul nsw i64 %rem, %indvars.iv.next %rem.1 = srem i64 %mul.1, 1000000007 %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2 %mul.2 = mul nsw i64 %rem.1, %indvars.iv.next.1 %rem.2 = srem i64 %mul.2, 1000000007 %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3 %mul.3 = mul nsw i64 %rem.2, %indvars.iv.next.2 %rem.3 = srem i64 %mul.3, 1000000007 %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4 %niter.next.3 = add i64 %niter, 4 %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter br i1 %niter.ncmp.3, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !9 for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader %rem.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %rem.3, %for.body ] %indvars.iv.unr = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ] %r.08.unr = phi i64 [ 1, %for.body.preheader ], [ %rem.3, %for.body ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end, label %for.body.epil for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.end.loopexit.unr-lcssa ] %r.08.epil = phi i64 [ %rem.epil, %for.body.epil ], [ %r.08.unr, %for.end.loopexit.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ] %mul.epil = mul nsw i64 %r.08.epil, %indvars.iv.epil %rem.epil = srem i64 %mul.epil, 1000000007 %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1 %epil.iter.next = add i64 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !11 for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry %r.0.lcssa = phi i64 [ 1, %entry ], [ %rem.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %rem.epil, %for.body.epil ] %call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %r.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 attributes #0 = { nofree 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 = { 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 #3 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.unroll.disable"}
#include <stdio.h> int main() { long long int number_n, i, power = 1; scanf("%lld", &number_n); for(i = 1; i <= number_n; i++) { power = (power * i) % 1000000007; } printf("%lld\n", power); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_186996/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_186996/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %number_n = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %number_n) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %number_n) %0 = load i64, ptr %number_n, align 8, !tbaa !5 %cmp.not5 = icmp slt i64 %0, 1 br i1 %cmp.not5, label %for.end, label %for.body.preheader for.body.preheader: ; preds = %entry %xtraiter = and i64 %0, 3 %1 = icmp ult i64 %0, 4 br i1 %1, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new for.body.preheader.new: ; preds = %for.body.preheader %unroll_iter = and i64 %0, -4 br label %for.body for.body: ; preds = %for.body, %for.body.preheader.new %power.07 = phi i64 [ 1, %for.body.preheader.new ], [ %rem.3, %for.body ] %i.06 = phi i64 [ 1, %for.body.preheader.new ], [ %inc.3, %for.body ] %niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ] %mul = mul nsw i64 %power.07, %i.06 %rem = srem i64 %mul, 1000000007 %inc = add nuw nsw i64 %i.06, 1 %mul.1 = mul nsw i64 %rem, %inc %rem.1 = srem i64 %mul.1, 1000000007 %inc.1 = add nuw nsw i64 %i.06, 2 %mul.2 = mul nsw i64 %rem.1, %inc.1 %rem.2 = srem i64 %mul.2, 1000000007 %inc.2 = add nuw i64 %i.06, 3 %mul.3 = mul nsw i64 %rem.2, %inc.2 %rem.3 = srem i64 %mul.3, 1000000007 %inc.3 = add nuw i64 %i.06, 4 %niter.next.3 = add i64 %niter, 4 %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter br i1 %niter.ncmp.3, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !9 for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader %rem.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %rem.3, %for.body ] %power.07.unr = phi i64 [ 1, %for.body.preheader ], [ %rem.3, %for.body ] %i.06.unr = phi i64 [ 1, %for.body.preheader ], [ %inc.3, %for.body ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end, label %for.body.epil for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil %power.07.epil = phi i64 [ %rem.epil, %for.body.epil ], [ %power.07.unr, %for.end.loopexit.unr-lcssa ] %i.06.epil = phi i64 [ %inc.epil, %for.body.epil ], [ %i.06.unr, %for.end.loopexit.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ] %mul.epil = mul nsw i64 %power.07.epil, %i.06.epil %rem.epil = srem i64 %mul.epil, 1000000007 %inc.epil = add nuw i64 %i.06.epil, 1 %epil.iter.next = add i64 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !11 for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry %power.0.lcssa = phi i64 [ 1, %entry ], [ %rem.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %rem.epil, %for.body.epil ] %call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %power.0.lcssa) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %number_n) #3 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 attributes #0 = { nofree 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 = { 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 #3 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"long long", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.unroll.disable"}
#include <stdio.h> int main(){ int i,n; long ans=1; scanf("%d",&n); for(i=1;i<=n;i++){ ans=ans*i; ans=ans%1000000007; } printf("%ld\n",ans); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_187038/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_187038/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp.not6 = icmp slt i32 %0, 1 br i1 %cmp.not6, label %for.end, label %for.body.preheader for.body.preheader: ; preds = %entry %1 = add nuw i32 %0, 1 %wide.trip.count = zext i32 %1 to i64 %2 = add nsw i64 %wide.trip.count, -1 %3 = add nsw i64 %wide.trip.count, -2 %xtraiter = and i64 %2, 3 %4 = icmp ult i64 %3, 3 br i1 %4, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new for.body.preheader.new: ; preds = %for.body.preheader %unroll_iter = and i64 %2, -4 br label %for.body for.body: ; preds = %for.body, %for.body.preheader.new %indvars.iv = phi i64 [ 1, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ] %ans.08 = phi i64 [ 1, %for.body.preheader.new ], [ %rem.3, %for.body ] %niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ] %mul = mul nsw i64 %ans.08, %indvars.iv %rem = srem i64 %mul, 1000000007 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %mul.1 = mul nsw i64 %rem, %indvars.iv.next %rem.1 = srem i64 %mul.1, 1000000007 %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2 %mul.2 = mul nsw i64 %rem.1, %indvars.iv.next.1 %rem.2 = srem i64 %mul.2, 1000000007 %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3 %mul.3 = mul nsw i64 %rem.2, %indvars.iv.next.2 %rem.3 = srem i64 %mul.3, 1000000007 %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4 %niter.next.3 = add i64 %niter, 4 %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter br i1 %niter.ncmp.3, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !9 for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader %rem.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %rem.3, %for.body ] %indvars.iv.unr = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ] %ans.08.unr = phi i64 [ 1, %for.body.preheader ], [ %rem.3, %for.body ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end, label %for.body.epil for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.end.loopexit.unr-lcssa ] %ans.08.epil = phi i64 [ %rem.epil, %for.body.epil ], [ %ans.08.unr, %for.end.loopexit.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ] %mul.epil = mul nsw i64 %ans.08.epil, %indvars.iv.epil %rem.epil = srem i64 %mul.epil, 1000000007 %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1 %epil.iter.next = add i64 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !11 for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry %ans.0.lcssa = phi i64 [ 1, %entry ], [ %rem.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %rem.epil, %for.body.epil ] %call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 attributes #0 = { nofree 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 = { 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 #3 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.unroll.disable"}
#include <stdio.h> int main(void) { int N; long long int pow = 1, x = 1000000000 + 7; scanf("%d", &N); for (int i = 1; i <= N; i++) pow = (pow*i) % x; printf("%lld\n", pow); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_187081/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_187081/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %N = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N) %0 = load i32, ptr %N, align 4, !tbaa !5 %cmp.not5 = icmp slt i32 %0, 1 br i1 %cmp.not5, label %for.cond.cleanup, label %for.body.preheader for.body.preheader: ; preds = %entry %1 = add nuw i32 %0, 1 %wide.trip.count = zext i32 %1 to i64 %2 = add nsw i64 %wide.trip.count, -1 %3 = add nsw i64 %wide.trip.count, -2 %xtraiter = and i64 %2, 3 %4 = icmp ult i64 %3, 3 br i1 %4, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body.preheader.new for.body.preheader.new: ; preds = %for.body.preheader %unroll_iter = and i64 %2, -4 br label %for.body for.cond.cleanup.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader %rem.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %rem.3, %for.body ] %indvars.iv.unr = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ] %pow.06.unr = phi i64 [ 1, %for.body.preheader ], [ %rem.3, %for.body ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond.cleanup, label %for.body.epil for.body.epil: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %for.body.epil %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond.cleanup.loopexit.unr-lcssa ] %pow.06.epil = phi i64 [ %rem.epil, %for.body.epil ], [ %pow.06.unr, %for.cond.cleanup.loopexit.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond.cleanup.loopexit.unr-lcssa ] %mul.epil = mul nsw i64 %pow.06.epil, %indvars.iv.epil %rem.epil = srem i64 %mul.epil, 1000000007 %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1 %epil.iter.next = add i64 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %for.cond.cleanup, label %for.body.epil, !llvm.loop !9 for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %for.body.epil, %entry %pow.0.lcssa = phi i64 [ 1, %entry ], [ %rem.lcssa.ph, %for.cond.cleanup.loopexit.unr-lcssa ], [ %rem.epil, %for.body.epil ] %call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %pow.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3 ret i32 0 for.body: ; preds = %for.body, %for.body.preheader.new %indvars.iv = phi i64 [ 1, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ] %pow.06 = phi i64 [ 1, %for.body.preheader.new ], [ %rem.3, %for.body ] %niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ] %mul = mul nsw i64 %pow.06, %indvars.iv %rem = srem i64 %mul, 1000000007 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %mul.1 = mul nsw i64 %rem, %indvars.iv.next %rem.1 = srem i64 %mul.1, 1000000007 %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2 %mul.2 = mul nsw i64 %rem.1, %indvars.iv.next.1 %rem.2 = srem i64 %mul.2, 1000000007 %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3 %mul.3 = mul nsw i64 %rem.2, %indvars.iv.next.2 %rem.3 = srem i64 %mul.3, 1000000007 %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4 %niter.next.3 = add i64 %niter, 4 %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter br i1 %niter.ncmp.3, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body, !llvm.loop !11 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 attributes #0 = { nofree 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 = { 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 #3 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.unroll.disable"} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.mustprogress"}
#include<stdio.h> #include<stdlib.h> #include<math.h> int main(){ int i, N; scanf("%d", &N); long p=1; long k = 1000000000 + 7; if(1<=N && N<=100000) { for(i=0;i<N;i++) { p = p*(i+1); p = p%k; } } printf("%ld\n", p); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_187124/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_187124/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %N = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N) %0 = load i32, ptr %N, align 4 %1 = add i32 %0, -1 %or.cond11 = icmp ult i32 %1, 100000 br i1 %or.cond11, label %for.body.preheader, label %if.end for.body.preheader: ; preds = %entry %wide.trip.count = zext i32 %0 to i64 %2 = add nsw i64 %wide.trip.count, -1 %xtraiter = and i64 %wide.trip.count, 3 %3 = icmp ult i64 %2, 3 br i1 %3, label %if.end.loopexit.unr-lcssa, label %for.body.preheader.new for.body.preheader.new: ; preds = %for.body.preheader %unroll_iter = and i64 %wide.trip.count, 4294967292 br label %for.body for.body: ; preds = %for.body, %for.body.preheader.new %indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ] %p.09 = phi i64 [ 1, %for.body.preheader.new ], [ %rem.3, %for.body ] %niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ] %indvars.iv.next = or i64 %indvars.iv, 1 %mul = mul nsw i64 %p.09, %indvars.iv.next %rem = srem i64 %mul, 1000000007 %indvars.iv.next.1 = or i64 %indvars.iv, 2 %mul.1 = mul nsw i64 %rem, %indvars.iv.next.1 %rem.1 = srem i64 %mul.1, 1000000007 %indvars.iv.next.2 = or i64 %indvars.iv, 3 %mul.2 = mul nsw i64 %rem.1, %indvars.iv.next.2 %rem.2 = srem i64 %mul.2, 1000000007 %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4 %mul.3 = mul nsw i64 %rem.2, %indvars.iv.next.3 %rem.3 = srem i64 %mul.3, 1000000007 %niter.next.3 = add i64 %niter, 4 %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter br i1 %niter.ncmp.3, label %if.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !5 if.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader %rem.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %rem.3, %for.body ] %indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ] %p.09.unr = phi i64 [ 1, %for.body.preheader ], [ %rem.3, %for.body ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %if.end, label %for.body.epil for.body.epil: ; preds = %if.end.loopexit.unr-lcssa, %for.body.epil %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %if.end.loopexit.unr-lcssa ] %p.09.epil = phi i64 [ %rem.epil, %for.body.epil ], [ %p.09.unr, %if.end.loopexit.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %if.end.loopexit.unr-lcssa ] %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1 %mul.epil = mul nsw i64 %p.09.epil, %indvars.iv.next.epil %rem.epil = srem i64 %mul.epil, 1000000007 %epil.iter.next = add i64 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %if.end, label %for.body.epil, !llvm.loop !7 if.end: ; preds = %if.end.loopexit.unr-lcssa, %for.body.epil, %entry %p.1 = phi i64 [ 1, %entry ], [ %rem.lcssa.ph, %if.end.loopexit.unr-lcssa ], [ %rem.epil, %for.body.epil ] %call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %p.1) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 attributes #0 = { nofree 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 = { 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 #3 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = distinct !{!5, !6} !6 = !{!"llvm.loop.mustprogress"} !7 = distinct !{!7, !8} !8 = !{!"llvm.loop.unroll.disable"}
//AOJ0541 DP‚µ‚ÄN‰ñ•à‚¢‚½Œã‚Ì•¶Žš‚ðŒvŽZ‚µ‚ÄŽÀs #include<stdio.h> #include<string.h> int c[1005][1005]; char d[1005][1005]; int main(){ int h,w,n,i,j,x,y; FILE *fp; //fp=fopen("test.txt","r"); fp=stdin; while(1){ fscanf(fp,"%d%d%d",&h,&w,&n); if(h==0 && w==0 && n==0)break; memset(d,0,sizeof(d)); memset(c,0,sizeof(c)); for(i=1;i<=h;i++){ for(j=1;j<=w;j++){ fscanf(fp,"%d",&x); if(x==1)d[i][j]=1; } } c[1][1]=n-1; for(i=1;i<=h;i++){ for(j=1;j<=w;j++){ //Å‰‚Ì•¶Žš‚É‚æ‚Á‚ďꍇ•ª‚¯‚µ‚ÄŒvŽZ if(d[i][j]==1){ c[i][j+1]+=(c[i][j]+1)/2; c[i+1][j]+= c[i][j] /2; }else{ c[i][j+1]+= c[i][j] /2; c[i+1][j]+=(c[i][j]+1)/2; } //‚މñŒã‚Ì(i,j)‚Ì•¶Žš d[i][j]=(c[i][j]+d[i][j])%2; //printf("%d ",d[i][j]); } //printf("\n"); } x=y=1; while(y<=h && x<=w){ if(d[y][x]==1) x++; else y++; } printf("%d %d\n",y,x); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_187168/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_187168/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @stdin = external local_unnamed_addr global ptr, align 8 @.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1 @d = dso_local local_unnamed_addr global [1005 x [1005 x i8]] zeroinitializer, align 16 @c = dso_local local_unnamed_addr global [1005 x [1005 x i32]] zeroinitializer, align 16 @.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.2 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1 ; Function Attrs: nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %h = alloca i32, align 4 %w = alloca i32, align 4 %n = alloca i32, align 4 %x = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #5 %0 = load ptr, ptr @stdin, align 8, !tbaa !5 %call170 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %0, ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w, ptr noundef nonnull %n) #5 %1 = load i32, ptr %h, align 4, !tbaa !9 %cmp171 = icmp eq i32 %1, 0 %2 = load i32, ptr %w, align 4 %cmp1172 = icmp eq i32 %2, 0 %or.cond173 = select i1 %cmp171, i1 %cmp1172, i1 false %3 = load i32, ptr %n, align 4 %cmp3174 = icmp eq i32 %3, 0 %or.cond116175 = select i1 %or.cond173, i1 %cmp3174, i1 false br i1 %or.cond116175, label %while.end115, label %if.end if.end: ; preds = %entry, %while.end %4 = phi i32 [ %30, %while.end ], [ %3, %entry ] %5 = phi i32 [ %29, %while.end ], [ %2, %entry ] %6 = phi i32 [ %28, %while.end ], [ %1, %entry ] call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1010025) @d, i8 0, i64 1010025, i1 false) call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4040100) @c, i8 0, i64 4040100, i1 false) %cmp4.not156 = icmp slt i32 %6, 1 %7 = icmp slt i32 %5, 1 %or.cond212 = select i1 %cmp4.not156, i1 true, i1 %7 br i1 %or.cond212, label %for.end95.thread.sink.split, label %for.cond5.preheader for.cond5.preheader: ; preds = %if.end, %for.inc14 %8 = phi i32 [ %13, %for.inc14 ], [ %6, %if.end ] %9 = phi i32 [ %14, %for.inc14 ], [ %5, %if.end ] %indvars.iv180 = phi i64 [ %indvars.iv.next181, %for.inc14 ], [ 1, %if.end ] %cmp6.not154 = icmp slt i32 %9, 1 br i1 %cmp6.not154, label %for.inc14, label %for.body7 for.body7: ; preds = %for.cond5.preheader, %for.inc %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 1, %for.cond5.preheader ] %call8 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %0, ptr noundef nonnull @.str.1, ptr noundef nonnull %x) #5 %10 = load i32, ptr %x, align 4, !tbaa !9 %cmp9 = icmp eq i32 %10, 1 br i1 %cmp9, label %if.then10, label %for.inc if.then10: ; preds = %for.body7 %arrayidx12 = getelementptr inbounds [1005 x [1005 x i8]], ptr @d, i64 0, i64 %indvars.iv180, i64 %indvars.iv store i8 1, ptr %arrayidx12, align 1, !tbaa !11 br label %for.inc for.inc: ; preds = %for.body7, %if.then10 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %11 = load i32, ptr %w, align 4 %12 = sext i32 %11 to i64 %cmp6.not.not = icmp slt i64 %indvars.iv, %12 br i1 %cmp6.not.not, label %for.body7, label %for.inc14.loopexit, !llvm.loop !12 for.inc14.loopexit: ; preds = %for.inc %.pre = load i32, ptr %h, align 4, !tbaa !9 br label %for.inc14 for.inc14: ; preds = %for.inc14.loopexit, %for.cond5.preheader %13 = phi i32 [ %.pre, %for.inc14.loopexit ], [ %8, %for.cond5.preheader ] %14 = phi i32 [ %11, %for.inc14.loopexit ], [ %9, %for.cond5.preheader ] %indvars.iv.next181 = add nuw nsw i64 %indvars.iv180, 1 %15 = sext i32 %13 to i64 %cmp4.not.not = icmp slt i64 %indvars.iv180, %15 br i1 %cmp4.not.not, label %for.cond5.preheader, label %for.end16, !llvm.loop !14 for.end16: ; preds = %for.inc14 %.pre193 = load i32, ptr %n, align 4, !tbaa !9 %sub = add nsw i32 %.pre193, -1 store i32 %sub, ptr getelementptr inbounds ([1005 x [1005 x i32]], ptr @c, i64 0, i64 1, i64 1), align 8, !tbaa !9 %cmp18.not160 = icmp slt i32 %13, 1 %cmp21.not158 = icmp slt i32 %14, 1 %or.cond211 = or i1 %cmp18.not160, %cmp21.not158 br i1 %or.cond211, label %for.end95.thread, label %for.cond20.preheader.preheader for.cond20.preheader.preheader: ; preds = %for.end16 %16 = add nuw i32 %14, 1 %17 = add nuw i32 %13, 1 %wide.trip.count191 = zext i32 %17 to i64 %wide.trip.count = zext i32 %16 to i64 br label %for.cond20.preheader for.cond20.preheader: ; preds = %for.cond20.preheader.preheader, %for.cond20.for.inc93_crit_edge %indvars.iv188 = phi i64 [ 1, %for.cond20.preheader.preheader ], [ %indvars.iv.next189, %for.cond20.for.inc93_crit_edge ] %indvars.iv.next189 = add nuw nsw i64 %indvars.iv188, 1 br label %for.body22 for.body22: ; preds = %for.cond20.preheader, %if.end74 %indvars.iv183 = phi i64 [ 1, %for.cond20.preheader ], [ %indvars.iv.next184.pre-phi, %if.end74 ] %arrayidx26 = getelementptr inbounds [1005 x [1005 x i8]], ptr @d, i64 0, i64 %indvars.iv188, i64 %indvars.iv183 %18 = load i8, ptr %arrayidx26, align 1, !tbaa !11 %cmp27 = icmp eq i8 %18, 1 %arrayidx33 = getelementptr inbounds [1005 x [1005 x i32]], ptr @c, i64 0, i64 %indvars.iv188, i64 %indvars.iv183 %19 = load i32, ptr %arrayidx33, align 4, !tbaa !9 %arrayidx49 = getelementptr inbounds [1005 x [1005 x i32]], ptr @c, i64 0, i64 %indvars.iv.next189, i64 %indvars.iv183 br i1 %cmp27, label %if.then29, label %if.else if.then29: ; preds = %for.body22 %add = add nsw i32 %19, 1 %div = sdiv i32 %add, 2 %20 = add nuw nsw i64 %indvars.iv183, 1 %arrayidx38 = getelementptr inbounds [1005 x [1005 x i32]], ptr @c, i64 0, i64 %indvars.iv188, i64 %20 %21 = load i32, ptr %arrayidx38, align 4, !tbaa !9 %add39 = add nsw i32 %div, %21 store i32 %add39, ptr %arrayidx38, align 4, !tbaa !9 br label %if.end74 if.else: ; preds = %for.body22 %div55 = sdiv i32 %19, 2 %22 = add nuw nsw i64 %indvars.iv183, 1 %arrayidx60 = getelementptr inbounds [1005 x [1005 x i32]], ptr @c, i64 0, i64 %indvars.iv188, i64 %22 %23 = load i32, ptr %arrayidx60, align 4, !tbaa !9 %add61 = add nsw i32 %23, %div55 store i32 %add61, ptr %arrayidx60, align 4, !tbaa !9 %add66 = add nsw i32 %19, 1 br label %if.end74 if.end74: ; preds = %if.else, %if.then29 %add66.sink = phi i32 [ %add66, %if.else ], [ %19, %if.then29 ] %indvars.iv.next184.pre-phi = phi i64 [ %22, %if.else ], [ %20, %if.then29 ] %div67 = sdiv i32 %add66.sink, 2 %24 = load i32, ptr %arrayidx49, align 4, !tbaa !9 %add73 = add nsw i32 %24, %div67 store i32 %add73, ptr %arrayidx49, align 4, !tbaa !9 %conv83 = sext i8 %18 to i32 %add84 = add nsw i32 %19, %conv83 %rem = srem i32 %add84, 2 %conv85 = trunc i32 %rem to i8 store i8 %conv85, ptr %arrayidx26, align 1, !tbaa !11 %exitcond.not = icmp eq i64 %indvars.iv.next184.pre-phi, %wide.trip.count br i1 %exitcond.not, label %for.cond20.for.inc93_crit_edge, label %for.body22, !llvm.loop !16 for.cond20.for.inc93_crit_edge: ; preds = %if.end74 %exitcond192.not = icmp eq i64 %indvars.iv.next189, %wide.trip.count191 br i1 %exitcond192.not, label %for.end95, label %for.cond20.preheader, !llvm.loop !17 for.end95.thread.sink.split: ; preds = %if.end %sub195 = add nsw i32 %4, -1 store i32 %sub195, ptr getelementptr inbounds ([1005 x [1005 x i32]], ptr @c, i64 0, i64 1, i64 1), align 8, !tbaa !9 br label %for.end95.thread for.end95.thread: ; preds = %for.end95.thread.sink.split, %for.end16 store i32 1, ptr %x, align 4, !tbaa !9 br label %while.end for.end95: ; preds = %for.cond20.for.inc93_crit_edge store i32 1, ptr %x, align 4, !tbaa !9 %cmp97164 = icmp sgt i32 %13, 0 %cmp99165 = icmp sgt i32 %14, 0 %25 = and i1 %cmp97164, %cmp99165 br i1 %25, label %while.body101, label %while.end while.body101: ; preds = %for.end95, %if.end113 %y.0167 = phi i32 [ %y.1, %if.end113 ], [ 1, %for.end95 ] %inc110163166 = phi i32 [ %inc110162, %if.end113 ], [ 1, %for.end95 ] %idxprom102 = sext i32 %y.0167 to i64 %idxprom104 = sext i32 %inc110163166 to i64 %arrayidx105 = getelementptr inbounds [1005 x [1005 x i8]], ptr @d, i64 0, i64 %idxprom102, i64 %idxprom104 %26 = load i8, ptr %arrayidx105, align 1, !tbaa !11 %cmp107 = icmp eq i8 %26, 1 br i1 %cmp107, label %if.then109, label %if.else111 if.then109: ; preds = %while.body101 %inc110 = add nsw i32 %inc110163166, 1 store i32 %inc110, ptr %x, align 4, !tbaa !9 br label %if.end113 if.else111: ; preds = %while.body101 %inc112 = add nsw i32 %y.0167, 1 br label %if.end113 if.end113: ; preds = %if.else111, %if.then109 %inc110162 = phi i32 [ %inc110, %if.then109 ], [ %inc110163166, %if.else111 ] %y.1 = phi i32 [ %y.0167, %if.then109 ], [ %inc112, %if.else111 ] %cmp97 = icmp sle i32 %y.1, %13 %cmp99 = icmp sle i32 %inc110162, %14 %27 = select i1 %cmp97, i1 %cmp99, i1 false br i1 %27, label %while.body101, label %while.end, !llvm.loop !18 while.end: ; preds = %if.end113, %for.end95.thread, %for.end95 %y.0.lcssa = phi i32 [ 1, %for.end95 ], [ 1, %for.end95.thread ], [ %y.1, %if.end113 ] %.lcssa153 = phi i32 [ 1, %for.end95 ], [ 1, %for.end95.thread ], [ %inc110162, %if.end113 ] %call114 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %y.0.lcssa, i32 noundef %.lcssa153) %call = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %0, ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w, ptr noundef nonnull %n) #5 %28 = load i32, ptr %h, align 4, !tbaa !9 %cmp = icmp eq i32 %28, 0 %29 = load i32, ptr %w, align 4 %cmp1 = icmp eq i32 %29, 0 %or.cond = select i1 %cmp, i1 %cmp1, i1 false %30 = load i32, ptr %n, align 4 %cmp3 = icmp eq i32 %30, 0 %or.cond116 = select i1 %or.cond, i1 %cmp3, i1 false br i1 %or.cond116, label %while.end115, label %if.end while.end115: ; preds = %while.end, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #5 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 i32 @__isoc99_fscanf(ptr noundef, ptr noundef, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) } attributes #4 = { 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 #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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"any pointer", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!10, !10, i64 0} !10 = !{!"int", !7, i64 0} !11 = !{!7, !7, i64 0} !12 = distinct !{!12, !13} !13 = !{!"llvm.loop.mustprogress"} !14 = distinct !{!14, !13, !15} !15 = !{!"llvm.loop.unswitch.partial.disable"} !16 = distinct !{!16, !13} !17 = distinct !{!17, !13} !18 = distinct !{!18, !13}
#include<stdio.h> int main() { int n, k, s; scanf("%d %d %d", &n, &k, &s); int i; if (k == 0) { if (s < 1000000000) { printf("%d", s + 1); for (i = 1; i < n; i++) printf(" %d", s + 1); } else { printf("1"); for (i = 1; i < n; i++) printf(" 1"); } printf("\n"); } else { printf("%d", s); for (i = 1; i < k; i++) printf(" %d", s); if (s < 1000000000) for (i = k; i < n; i++) printf(" %d", s + 1); else for (i = k; i < n; i++) printf(" 1"); printf("\n"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_187232/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_187232/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c" %d\00", align 1 @.str.4 = private unnamed_addr constant [3 x i8] c" 1\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %k = alloca i32, align 4 %s = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k, ptr noundef nonnull %s) %0 = load i32, ptr %k, align 4, !tbaa !5 %cmp = icmp eq i32 %0, 0 %1 = load i32, ptr %s, align 4, !tbaa !5 br i1 %cmp, label %if.then, label %if.else16 if.then: ; preds = %entry %cmp1 = icmp slt i32 %1, 1000000000 br i1 %cmp1, label %if.then2, label %if.else if.then2: ; preds = %if.then %add = add nsw i32 %1, 1 %call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add) %2 = load i32, ptr %n, align 4, !tbaa !5 %cmp468 = icmp sgt i32 %2, 1 br i1 %cmp468, label %for.body, label %if.end45 for.body: ; preds = %if.then2, %for.body %i.069 = phi i32 [ %inc, %for.body ], [ 1, %if.then2 ] %3 = load i32, ptr %s, align 4, !tbaa !5 %add5 = add nsw i32 %3, 1 %call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %add5) %inc = add nuw nsw i32 %i.069, 1 %4 = load i32, ptr %n, align 4, !tbaa !5 %cmp4 = icmp slt i32 %inc, %4 br i1 %cmp4, label %for.body, label %if.end45, !llvm.loop !9 if.else: ; preds = %if.then %putchar56 = call i32 @putchar(i32 49) %5 = load i32, ptr %n, align 4, !tbaa !5 %cmp966 = icmp sgt i32 %5, 1 br i1 %cmp966, label %for.body10, label %if.end45 for.body10: ; preds = %if.else, %for.body10 %i.167 = phi i32 [ %inc13, %for.body10 ], [ 1, %if.else ] %call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4) %inc13 = add nuw nsw i32 %i.167, 1 %6 = load i32, ptr %n, align 4, !tbaa !5 %cmp9 = icmp slt i32 %inc13, %6 br i1 %cmp9, label %for.body10, label %if.end45, !llvm.loop !11 if.else16: ; preds = %entry %call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %1) %7 = load i32, ptr %k, align 4, !tbaa !5 %cmp1960 = icmp sgt i32 %7, 1 br i1 %cmp1960, label %for.body20, label %for.end24 for.body20: ; preds = %if.else16, %for.body20 %i.261 = phi i32 [ %inc23, %for.body20 ], [ 1, %if.else16 ] %8 = load i32, ptr %s, align 4, !tbaa !5 %call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8) %inc23 = add nuw nsw i32 %i.261, 1 %9 = load i32, ptr %k, align 4, !tbaa !5 %cmp19 = icmp slt i32 %inc23, %9 br i1 %cmp19, label %for.body20, label %for.end24, !llvm.loop !12 for.end24: ; preds = %for.body20, %if.else16 %.lcssa = phi i32 [ %7, %if.else16 ], [ %9, %for.body20 ] %10 = load i32, ptr %s, align 4, !tbaa !5 %cmp25 = icmp slt i32 %10, 1000000000 %11 = load i32, ptr %n, align 4, !tbaa !5 %cmp2864 = icmp slt i32 %.lcssa, %11 br i1 %cmp25, label %for.cond27.preheader, label %for.cond36.preheader for.cond36.preheader: ; preds = %for.end24 br i1 %cmp2864, label %for.body38, label %if.end45 for.cond27.preheader: ; preds = %for.end24 br i1 %cmp2864, label %for.body29, label %if.end45 for.body29: ; preds = %for.cond27.preheader, %for.body29 %i.365 = phi i32 [ %inc33, %for.body29 ], [ %.lcssa, %for.cond27.preheader ] %12 = load i32, ptr %s, align 4, !tbaa !5 %add30 = add nsw i32 %12, 1 %call31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %add30) %inc33 = add nsw i32 %i.365, 1 %13 = load i32, ptr %n, align 4, !tbaa !5 %cmp28 = icmp slt i32 %inc33, %13 br i1 %cmp28, label %for.body29, label %if.end45, !llvm.loop !13 for.body38: ; preds = %for.cond36.preheader, %for.body38 %i.463 = phi i32 [ %inc41, %for.body38 ], [ %.lcssa, %for.cond36.preheader ] %call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4) %inc41 = add nsw i32 %i.463, 1 %14 = load i32, ptr %n, align 4, !tbaa !5 %cmp37 = icmp slt i32 %inc41, %14 br i1 %cmp37, label %for.body38, label %if.end45, !llvm.loop !14 if.end45: ; preds = %for.body38, %for.body29, %for.body10, %for.body, %for.cond27.preheader, %for.cond36.preheader, %if.then2, %if.else %putchar = call i32 @putchar(i32 10) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3 attributes #0 = { nofree 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 = { 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 #3 = { nofree nounwind } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10} !14 = distinct !{!14, !10}
#include <stdio.h> int main(void) { double r,S,l; scanf("%lf",&r); S=r*r*3.14159265358979323846264338327950288; l=2*r*3.14159265358979323846264338327950288; printf("%f %f\n",S,l); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_187276/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_187276/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [4 x i8] c"%lf\00", align 1 @.str.1 = private unnamed_addr constant [7 x i8] c"%f %f\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %r = alloca double, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %r) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %r) %0 = load double, ptr %r, align 8, !tbaa !5 %mul = fmul double %0, %0 %mul1 = fmul double %mul, 0x400921FB54442D18 %mul2 = fmul double %0, 2.000000e+00 %mul3 = fmul double %mul2, 0x400921FB54442D18 %call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %mul1, double noundef %mul3) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %r) #3 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 attributes #0 = { nofree 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 = { 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 #3 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"double", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> int main(void) { const double PI = 3.141592653589; double r, are, circ; scanf("%lf", &r); are = r * r * PI; circ = 2 * r * PI; printf("%f %f\n", are, circ); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_187319/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_187319/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [4 x i8] c"%lf\00", align 1 @.str.1 = private unnamed_addr constant [7 x i8] c"%f %f\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %r = alloca double, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %r) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %r) %0 = load double, ptr %r, align 8, !tbaa !5 %mul = fmul double %0, %0 %mul1 = fmul double %mul, 0x400921FB5444261E %mul2 = fmul double %0, 2.000000e+00 %mul3 = fmul double %mul2, 0x400921FB5444261E %call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %mul1, double noundef %mul3) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %r) #3 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 attributes #0 = { nofree 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 = { 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 #3 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"double", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> #include <stdlib.h> #include<string.h> int main() { int t; scanf("%d",&t); while(t--) { char s[100]; scanf("%s",s); int n=strlen(s); for(int i=0;i<n;i++) { if(i%2){if(s[i]=='z')printf("y");else printf("z");} else {if(s[i]=='a')printf("b");else printf("a");} }printf("\n"); } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_18737/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_18737/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %t = alloca i32, align 4 %s = alloca [100 x i8], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t) %0 = load i32, ptr %t, align 4, !tbaa !5 %dec35 = add nsw i32 %0, -1 store i32 %dec35, ptr %t, align 4, !tbaa !5 %tobool.not36 = icmp eq i32 %0, 0 br i1 %tobool.not36, label %while.end, label %while.body while.body: ; preds = %entry, %for.cond.cleanup call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #5 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s) %call3 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #6 %conv = trunc i64 %call3 to i32 %cmp33 = icmp sgt i32 %conv, 0 br i1 %cmp33, label %for.body.preheader, label %for.cond.cleanup for.body.preheader: ; preds = %while.body %wide.trip.count = and i64 %call3, 4294967295 br label %for.body for.cond.cleanup: ; preds = %for.body, %while.body %putchar = call i32 @putchar(i32 10) call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #5 %1 = load i32, ptr %t, align 4, !tbaa !5 %dec = add nsw i32 %1, -1 store i32 %dec, ptr %t, align 4, !tbaa !5 %tobool.not = icmp eq i32 %1, 0 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9 for.body: ; preds = %for.body.preheader, %for.body %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ] %rem38 = and i64 %indvars.iv, 1 %tobool5.not = icmp eq i64 %rem38, 0 %arrayidx14 = getelementptr inbounds [100 x i8], ptr %s, i64 0, i64 %indvars.iv %2 = load i8, ptr %arrayidx14, align 1, !tbaa !11 %cmp7 = icmp eq i8 %2, 122 %. = select i1 %cmp7, i32 121, i32 122 %cmp16 = icmp eq i8 %2, 97 %.39 = select i1 %cmp16, i32 98, i32 97 %.sink = select i1 %tobool5.not, i32 %.39, i32 %. %putchar31 = call i32 @putchar(i32 %.sink) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !12 while.end: ; preds = %for.cond.cleanup, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #5 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4 attributes #0 = { nofree 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 = { 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 #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 = { nofree nounwind } attributes #5 = { nounwind } attributes #6 = { nounwind willreturn memory(read) } !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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!7, !7, i64 0} !12 = distinct !{!12, !10}
#include<stdio.h> #include<string.h> #include<stdlib.h> #include<math.h> typedef long long (ll); void merge(ll arr[],ll l,ll m,ll r,ll ind[]) { ll i,j,k,n1,n2; n1=m-l+1; n2=r-m; ll L[n1],R[n2],L1[n1],R1[n2]; for(i=0;i<n1;i++) { L[i]=arr[l+i]; L1[i]=ind[l+i]; } for(j=0;j<n2;j++) { R[j]=arr[m+1+j]; R1[j]=ind[m+1+j]; } i=j=0; k=l; while(i<n1&&j<n2) { if(L[i]<R[j]) { arr[k]=L[i]; ind[k]=L1[i]; i++; } else if(L[i]>R[j]) { arr[k]=R[j]; ind[k]=R1[j]; j++; } else { if(L1[i]<R1[j]) { arr[k]=L[i]; ind[k]=L1[i]; i++; } else { arr[k]=R[j]; ind[k]=R1[j]; j++; } } k++; } while(i<n1) { arr[k]=L[i]; ind[k]=L1[i]; i++; k++; } while(j<n2) { arr[k]=R[j]; ind[k]=R1[j]; j++; k++; } } void sort(ll arr[],ll l,ll r,ll ind[]) { if(l<r) { ll m=l+(r-l)/2; sort(arr,l,m,ind); sort(arr,m+1,r,ind); merge(arr,l,m,r,ind); } } int main() { ll a,b,c,d,e,f,g,h,i,j,k,l,m,n; scanf("%lli",&a); for(;a;a--) { scanf("%lli%lli%lli",&d,&e,&b); ll z[b],x[b]; for(c=0;c<b;c++) scanf("%lli",&z[c]); for(c=0;c<b;c++) scanf("%lli",&x[c]); sort(z,0,b-1,x); h=1; for(c=0;c<b;c++) { if(e<1)h=0; f=x[c]; g=f%d?(f/d)+1:(f/d); e-=(z[c]*(g-1)); if(e<1)h=0; e-=z[c]; } if(h)printf("YES"); else printf("NO"); printf("\n"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_18742/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_18742/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [5 x i8] c"%lli\00", align 1 @.str.1 = private unnamed_addr constant [13 x i8] c"%lli%lli%lli\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"YES\00", align 1 @.str.3 = private unnamed_addr constant [3 x i8] c"NO\00", align 1 ; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable define dso_local void @merge(ptr nocapture noundef %arr, i64 noundef %l, i64 noundef %m, i64 noundef %r, ptr nocapture noundef %ind) local_unnamed_addr #0 { entry: %arr199 = ptrtoint ptr %arr to i64 %ind198 = ptrtoint ptr %ind to i64 %arr190 = ptrtoint ptr %arr to i64 %ind189 = ptrtoint ptr %ind to i64 %sub = sub nsw i64 %m, %l %add = add nsw i64 %sub, 1 %sub1 = sub nsw i64 %r, %m %vla = alloca i64, i64 %add, align 16 %vla2 = alloca i64, i64 %sub1, align 16 %vla3 = alloca i64, i64 %add, align 16 %vla4 = alloca i64, i64 %sub1, align 16 %cmp.not163 = icmp slt i64 %sub, 0 br i1 %cmp.not163, label %for.cond10.preheader, label %for.body.preheader for.body.preheader: ; preds = %entry %0 = shl i64 %l, 3 %scevgep = getelementptr i8, ptr %arr, i64 %0 %1 = add i64 %m, 1 %2 = sub i64 %1, %l %3 = shl nuw i64 %2, 3 call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %vla, ptr align 8 %scevgep, i64 %3, i1 false), !tbaa !5 %scevgep181 = getelementptr i8, ptr %ind, i64 %0 call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %vla3, ptr align 8 %scevgep181, i64 %3, i1 false), !tbaa !5 br label %for.cond10.preheader for.cond10.preheader: ; preds = %for.body.preheader, %entry %cmp11165 = icmp sgt i64 %sub1, 0 br i1 %cmp11165, label %while.cond.preheader, label %while.cond62.preheader while.cond.preheader: ; preds = %for.cond10.preheader %4 = shl i64 %m, 3 %5 = add i64 %4, 8 %scevgep182 = getelementptr i8, ptr %arr, i64 %5 %6 = sub i64 %r, %m %7 = shl i64 %6, 3 call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %vla2, ptr align 8 %scevgep182, i64 %7, i1 false), !tbaa !5 %scevgep183 = getelementptr i8, ptr %ind, i64 %5 call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %vla4, ptr align 8 %scevgep183, i64 %7, i1 false), !tbaa !5 %cmp24167 = icmp sgt i64 %sub, -1 %8 = and i1 %cmp24167, %cmp11165 br i1 %8, label %while.body, label %while.cond62.preheader while.cond62.preheader: ; preds = %if.end60, %for.cond10.preheader, %while.cond.preheader %k.0.lcssa = phi i64 [ %l, %while.cond.preheader ], [ %l, %for.cond10.preheader ], [ %inc61, %if.end60 ] %j.1.lcssa = phi i64 [ 0, %while.cond.preheader ], [ 0, %for.cond10.preheader ], [ %j.2, %if.end60 ] %i.1.lcssa = phi i64 [ 0, %while.cond.preheader ], [ 0, %for.cond10.preheader ], [ %i.2, %if.end60 ] %cmp63.not174 = icmp sgt i64 %i.1.lcssa, %sub br i1 %cmp63.not174, label %while.cond72.preheader, label %while.body64.preheader while.body64.preheader: ; preds = %while.cond62.preheader %9 = add i64 %m, 1 %10 = add i64 %i.1.lcssa, %l %11 = sub i64 %9, %10 %min.iters.check = icmp ult i64 %11, 8 br i1 %min.iters.check, label %while.body64.preheader222, label %vector.memcheck vector.memcheck: ; preds = %while.body64.preheader %12 = shl i64 %k.0.lcssa, 3 %13 = add i64 %12, %ind189 %14 = add i64 %12, %arr190 %15 = sub i64 %13, %14 %diff.check = icmp ult i64 %15, 32 br i1 %diff.check, label %while.body64.preheader222, label %vector.ph vector.ph: ; preds = %vector.memcheck %n.vec = and i64 %11, -4 %ind.end = add i64 %i.1.lcssa, %n.vec %ind.end191 = add i64 %k.0.lcssa, %n.vec br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %offset.idx = add i64 %k.0.lcssa, %index %offset.idx193 = add i64 %i.1.lcssa, %index %16 = getelementptr inbounds i64, ptr %vla, i64 %offset.idx193 %wide.load = load <2 x i64>, ptr %16, align 8, !tbaa !5 %17 = getelementptr inbounds i64, ptr %16, i64 2 %wide.load194 = load <2 x i64>, ptr %17, align 8, !tbaa !5 %18 = getelementptr inbounds i64, ptr %arr, i64 %offset.idx store <2 x i64> %wide.load, ptr %18, align 8, !tbaa !5 %19 = getelementptr inbounds i64, ptr %18, i64 2 store <2 x i64> %wide.load194, ptr %19, align 8, !tbaa !5 %20 = getelementptr inbounds i64, ptr %vla3, i64 %offset.idx193 %wide.load195 = load <2 x i64>, ptr %20, align 8, !tbaa !5 %21 = getelementptr inbounds i64, ptr %20, i64 2 %wide.load196 = load <2 x i64>, ptr %21, align 8, !tbaa !5 %22 = getelementptr inbounds i64, ptr %ind, i64 %offset.idx store <2 x i64> %wide.load195, ptr %22, align 8, !tbaa !5 %23 = getelementptr inbounds i64, ptr %22, i64 2 store <2 x i64> %wide.load196, ptr %23, align 8, !tbaa !5 %index.next = add nuw i64 %index, 4 %24 = icmp eq i64 %index.next, %n.vec br i1 %24, label %middle.block, label %vector.body, !llvm.loop !9 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %11, %n.vec br i1 %cmp.n, label %while.cond72.preheader, label %while.body64.preheader222 while.body64.preheader222: ; preds = %vector.memcheck, %while.body64.preheader, %middle.block %i.3176.ph = phi i64 [ %i.1.lcssa, %vector.memcheck ], [ %i.1.lcssa, %while.body64.preheader ], [ %ind.end, %middle.block ] %k.1175.ph = phi i64 [ %k.0.lcssa, %vector.memcheck ], [ %k.0.lcssa, %while.body64.preheader ], [ %ind.end191, %middle.block ] br label %while.body64 while.body: ; preds = %while.cond.preheader, %if.end60 %i.1171 = phi i64 [ %i.2, %if.end60 ], [ 0, %while.cond.preheader ] %j.1170 = phi i64 [ %j.2, %if.end60 ], [ 0, %while.cond.preheader ] %k.0169 = phi i64 [ %inc61, %if.end60 ], [ %l, %while.cond.preheader ] %arrayidx26 = getelementptr inbounds i64, ptr %vla, i64 %i.1171 %25 = load i64, ptr %arrayidx26, align 8, !tbaa !5 %arrayidx27 = getelementptr inbounds i64, ptr %vla2, i64 %j.1170 %26 = load i64, ptr %arrayidx27, align 8, !tbaa !5 %cmp28 = icmp slt i64 %25, %26 br i1 %cmp28, label %if.then, label %if.else if.then: ; preds = %while.body %arrayidx30 = getelementptr inbounds i64, ptr %arr, i64 %k.0169 store i64 %25, ptr %arrayidx30, align 8, !tbaa !5 %arrayidx31 = getelementptr inbounds i64, ptr %vla3, i64 %i.1171 %27 = load i64, ptr %arrayidx31, align 8, !tbaa !5 %arrayidx32 = getelementptr inbounds i64, ptr %ind, i64 %k.0169 store i64 %27, ptr %arrayidx32, align 8, !tbaa !5 %inc33 = add nsw i64 %i.1171, 1 br label %if.end60 if.else: ; preds = %while.body %cmp36 = icmp sgt i64 %25, %26 %arrayidx40 = getelementptr inbounds i64, ptr %vla4, i64 %j.1170 br i1 %cmp36, label %if.then37, label %if.else43 if.then37: ; preds = %if.else %arrayidx39 = getelementptr inbounds i64, ptr %arr, i64 %k.0169 store i64 %26, ptr %arrayidx39, align 8, !tbaa !5 %28 = load i64, ptr %arrayidx40, align 8, !tbaa !5 %arrayidx41 = getelementptr inbounds i64, ptr %ind, i64 %k.0169 store i64 %28, ptr %arrayidx41, align 8, !tbaa !5 %inc42 = add nsw i64 %j.1170, 1 br label %if.end60 if.else43: ; preds = %if.else %arrayidx44 = getelementptr inbounds i64, ptr %vla3, i64 %i.1171 %29 = load i64, ptr %arrayidx44, align 8, !tbaa !5 %30 = load i64, ptr %arrayidx40, align 8, !tbaa !5 %cmp46 = icmp slt i64 %29, %30 %arrayidx49 = getelementptr inbounds i64, ptr %arr, i64 %k.0169 %arrayidx51 = getelementptr inbounds i64, ptr %ind, i64 %k.0169 br i1 %cmp46, label %if.then47, label %if.else53 if.then47: ; preds = %if.else43 store i64 %25, ptr %arrayidx49, align 8, !tbaa !5 store i64 %29, ptr %arrayidx51, align 8, !tbaa !5 %inc52 = add nsw i64 %i.1171, 1 br label %if.end60 if.else53: ; preds = %if.else43 store i64 %26, ptr %arrayidx49, align 8, !tbaa !5 store i64 %30, ptr %arrayidx51, align 8, !tbaa !5 %inc58 = add nsw i64 %j.1170, 1 br label %if.end60 if.end60: ; preds = %if.then37, %if.else53, %if.then47, %if.then %j.2 = phi i64 [ %j.1170, %if.then ], [ %inc42, %if.then37 ], [ %j.1170, %if.then47 ], [ %inc58, %if.else53 ] %i.2 = phi i64 [ %inc33, %if.then ], [ %i.1171, %if.then37 ], [ %inc52, %if.then47 ], [ %i.1171, %if.else53 ] %inc61 = add nsw i64 %k.0169, 1 %cmp24 = icmp sle i64 %i.2, %sub %cmp25 = icmp slt i64 %j.2, %sub1 %31 = select i1 %cmp24, i1 %cmp25, i1 false br i1 %31, label %while.body, label %while.cond62.preheader, !llvm.loop !13 while.cond72.preheader: ; preds = %while.body64, %middle.block, %while.cond62.preheader %k.1.lcssa = phi i64 [ %k.0.lcssa, %while.cond62.preheader ], [ %ind.end191, %middle.block ], [ %inc70, %while.body64 ] %cmp73178 = icmp slt i64 %j.1.lcssa, %sub1 br i1 %cmp73178, label %while.body74.preheader, label %while.end81 while.body74.preheader: ; preds = %while.cond72.preheader %32 = add i64 %j.1.lcssa, %m %33 = sub i64 %r, %32 %min.iters.check203 = icmp ult i64 %33, 8 br i1 %min.iters.check203, label %while.body74.preheader221, label %vector.memcheck197 vector.memcheck197: ; preds = %while.body74.preheader %34 = shl i64 %k.1.lcssa, 3 %35 = add i64 %34, %ind198 %36 = add i64 %34, %arr199 %37 = sub i64 %35, %36 %diff.check200 = icmp ult i64 %37, 32 br i1 %diff.check200, label %while.body74.preheader221, label %vector.ph204 vector.ph204: ; preds = %vector.memcheck197 %n.vec206 = and i64 %33, -4 %ind.end207 = add i64 %j.1.lcssa, %n.vec206 %ind.end209 = add i64 %k.1.lcssa, %n.vec206 br label %vector.body212 vector.body212: ; preds = %vector.body212, %vector.ph204 %index213 = phi i64 [ 0, %vector.ph204 ], [ %index.next220, %vector.body212 ] %offset.idx214 = add i64 %k.1.lcssa, %index213 %offset.idx215 = add i64 %j.1.lcssa, %index213 %38 = getelementptr inbounds i64, ptr %vla2, i64 %offset.idx215 %wide.load216 = load <2 x i64>, ptr %38, align 8, !tbaa !5 %39 = getelementptr inbounds i64, ptr %38, i64 2 %wide.load217 = load <2 x i64>, ptr %39, align 8, !tbaa !5 %40 = getelementptr inbounds i64, ptr %arr, i64 %offset.idx214 store <2 x i64> %wide.load216, ptr %40, align 8, !tbaa !5 %41 = getelementptr inbounds i64, ptr %40, i64 2 store <2 x i64> %wide.load217, ptr %41, align 8, !tbaa !5 %42 = getelementptr inbounds i64, ptr %vla4, i64 %offset.idx215 %wide.load218 = load <2 x i64>, ptr %42, align 8, !tbaa !5 %43 = getelementptr inbounds i64, ptr %42, i64 2 %wide.load219 = load <2 x i64>, ptr %43, align 8, !tbaa !5 %44 = getelementptr inbounds i64, ptr %ind, i64 %offset.idx214 store <2 x i64> %wide.load218, ptr %44, align 8, !tbaa !5 %45 = getelementptr inbounds i64, ptr %44, i64 2 store <2 x i64> %wide.load219, ptr %45, align 8, !tbaa !5 %index.next220 = add nuw i64 %index213, 4 %46 = icmp eq i64 %index.next220, %n.vec206 br i1 %46, label %middle.block201, label %vector.body212, !llvm.loop !14 middle.block201: ; preds = %vector.body212 %cmp.n211 = icmp eq i64 %33, %n.vec206 br i1 %cmp.n211, label %while.end81, label %while.body74.preheader221 while.body74.preheader221: ; preds = %vector.memcheck197, %while.body74.preheader, %middle.block201 %j.3180.ph = phi i64 [ %j.1.lcssa, %vector.memcheck197 ], [ %j.1.lcssa, %while.body74.preheader ], [ %ind.end207, %middle.block201 ] %k.2179.ph = phi i64 [ %k.1.lcssa, %vector.memcheck197 ], [ %k.1.lcssa, %while.body74.preheader ], [ %ind.end209, %middle.block201 ] br label %while.body74 while.body64: ; preds = %while.body64.preheader222, %while.body64 %i.3176 = phi i64 [ %inc69, %while.body64 ], [ %i.3176.ph, %while.body64.preheader222 ] %k.1175 = phi i64 [ %inc70, %while.body64 ], [ %k.1175.ph, %while.body64.preheader222 ] %arrayidx65 = getelementptr inbounds i64, ptr %vla, i64 %i.3176 %47 = load i64, ptr %arrayidx65, align 8, !tbaa !5 %arrayidx66 = getelementptr inbounds i64, ptr %arr, i64 %k.1175 store i64 %47, ptr %arrayidx66, align 8, !tbaa !5 %arrayidx67 = getelementptr inbounds i64, ptr %vla3, i64 %i.3176 %48 = load i64, ptr %arrayidx67, align 8, !tbaa !5 %arrayidx68 = getelementptr inbounds i64, ptr %ind, i64 %k.1175 store i64 %48, ptr %arrayidx68, align 8, !tbaa !5 %inc69 = add nsw i64 %i.3176, 1 %inc70 = add nsw i64 %k.1175, 1 %cmp63.not.not = icmp slt i64 %i.3176, %sub br i1 %cmp63.not.not, label %while.body64, label %while.cond72.preheader, !llvm.loop !15 while.body74: ; preds = %while.body74.preheader221, %while.body74 %j.3180 = phi i64 [ %inc79, %while.body74 ], [ %j.3180.ph, %while.body74.preheader221 ] %k.2179 = phi i64 [ %inc80, %while.body74 ], [ %k.2179.ph, %while.body74.preheader221 ] %arrayidx75 = getelementptr inbounds i64, ptr %vla2, i64 %j.3180 %49 = load i64, ptr %arrayidx75, align 8, !tbaa !5 %arrayidx76 = getelementptr inbounds i64, ptr %arr, i64 %k.2179 store i64 %49, ptr %arrayidx76, align 8, !tbaa !5 %arrayidx77 = getelementptr inbounds i64, ptr %vla4, i64 %j.3180 %50 = load i64, ptr %arrayidx77, align 8, !tbaa !5 %arrayidx78 = getelementptr inbounds i64, ptr %ind, i64 %k.2179 store i64 %50, ptr %arrayidx78, align 8, !tbaa !5 %inc79 = add nsw i64 %j.3180, 1 %inc80 = add nsw i64 %k.2179, 1 %cmp73 = icmp slt i64 %inc79, %sub1 br i1 %cmp73, label %while.body74, label %while.end81, !llvm.loop !16 while.end81: ; preds = %while.body74, %middle.block201, %while.cond72.preheader ret void } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare ptr @llvm.stacksave.p0() #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare void @llvm.stackrestore.p0(ptr) #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable define dso_local void @sort(ptr noundef %arr, i64 noundef %l, i64 noundef %r, ptr noundef %ind) local_unnamed_addr #0 { entry: %cmp = icmp slt i64 %l, %r br i1 %cmp, label %if.then, label %common.ret15 common.ret15: ; preds = %entry, %if.then ret void if.then: ; preds = %entry %sub = sub nsw i64 %r, %l %div = sdiv i64 %sub, 2 %add = add nsw i64 %div, %l tail call void @sort(ptr noundef %arr, i64 noundef %l, i64 noundef %add, ptr noundef %ind) %add1 = add nsw i64 %add, 1 tail call void @sort(ptr noundef %arr, i64 noundef %add1, i64 noundef %r, ptr noundef %ind) tail call void @merge(ptr noundef %arr, i64 noundef %l, i64 noundef %add, i64 noundef %r, ptr noundef %ind) br label %common.ret15 } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #3 { entry: %a = alloca i64, align 8 %b = alloca i64, align 8 %d = alloca i64, align 8 %e = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #7 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #7 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %d) #7 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %e) #7 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a) %.pr = load i64, ptr %a, align 8, !tbaa !5 %tobool.not63 = icmp eq i64 %.pr, 0 br i1 %tobool.not63, label %for.end39, label %for.body for.body: ; preds = %entry, %if.end36 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %d, ptr noundef nonnull %e, ptr noundef nonnull %b) %0 = load i64, ptr %b, align 8, !tbaa !5 %1 = call ptr @llvm.stacksave.p0() %vla = alloca i64, i64 %0, align 16 %2 = load i64, ptr %b, align 8, !tbaa !5 %vla2 = alloca i64, i64 %2, align 16 %cmp53 = icmp sgt i64 %2, 0 br i1 %cmp53, label %for.body4, label %for.end13.thread for.cond6.preheader: ; preds = %for.body4 %cmp755 = icmp sgt i64 %3, 0 br i1 %cmp755, label %for.body8, label %for.end13.thread for.body4: ; preds = %for.body, %for.body4 %c.054 = phi i64 [ %inc, %for.body4 ], [ 0, %for.body ] %arrayidx = getelementptr inbounds i64, ptr %vla, i64 %c.054 %call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %inc = add nuw nsw i64 %c.054, 1 %3 = load i64, ptr %b, align 8, !tbaa !5 %cmp = icmp slt i64 %inc, %3 br i1 %cmp, label %for.body4, label %for.cond6.preheader, !llvm.loop !17 for.body8: ; preds = %for.cond6.preheader, %for.body8 %c.156 = phi i64 [ %inc12, %for.body8 ], [ 0, %for.cond6.preheader ] %arrayidx9 = getelementptr inbounds i64, ptr %vla2, i64 %c.156 %call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx9) %inc12 = add nuw nsw i64 %c.156, 1 %4 = load i64, ptr %b, align 8, !tbaa !5 %cmp7 = icmp slt i64 %inc12, %4 br i1 %cmp7, label %for.body8, label %for.end13, !llvm.loop !18 for.end13.thread: ; preds = %for.cond6.preheader, %for.body %.lcssa.ph = phi i64 [ %3, %for.cond6.preheader ], [ %2, %for.body ] %sub67 = add nsw i64 %.lcssa.ph, -1 call void @sort(ptr noundef nonnull %vla, i64 noundef 0, i64 noundef %sub67, ptr noundef nonnull %vla2) br label %if.end36 for.end13: ; preds = %for.body8 %sub = add nsw i64 %4, -1 call void @sort(ptr noundef nonnull %vla, i64 noundef 0, i64 noundef %sub, ptr noundef nonnull %vla2) %cmp1558 = icmp sgt i64 %4, 0 br i1 %cmp1558, label %for.body16.lr.ph, label %if.end36 for.body16.lr.ph: ; preds = %for.end13 %e.promoted = load i64, ptr %e, align 8, !tbaa !5 %5 = load i64, ptr %d, align 8, !tbaa !5 br label %for.body16 for.body16: ; preds = %for.body16.lr.ph, %for.body16 %c.261 = phi i64 [ 0, %for.body16.lr.ph ], [ %inc30, %for.body16 ] %h.060 = phi i64 [ 1, %for.body16.lr.ph ], [ %spec.select52, %for.body16 ] %sub285759 = phi i64 [ %e.promoted, %for.body16.lr.ph ], [ %sub28, %for.body16 ] %cmp17.inv = icmp sgt i64 %sub285759, 0 %arrayidx18 = getelementptr inbounds i64, ptr %vla2, i64 %c.261 %6 = load i64, ptr %arrayidx18, align 8, !tbaa !5 %rem = srem i64 %6, %5 %tobool19.not = icmp ne i64 %rem, 0 %div20 = sdiv i64 %6, %5 %add = zext i1 %tobool19.not to i64 %cond = add nsw i64 %div20, %add %arrayidx21 = getelementptr inbounds i64, ptr %vla, i64 %c.261 %7 = load i64, ptr %arrayidx21, align 8, !tbaa !5 %sub22 = add nsw i64 %cond, -1 %mul = mul nsw i64 %7, %sub22 %sub23 = sub nsw i64 %sub285759, %mul %cmp24.inv = icmp sgt i64 %sub23, 0 %8 = and i1 %cmp17.inv, %cmp24.inv %spec.select52 = select i1 %8, i64 %h.060, i64 0 %sub28 = sub nsw i64 %sub23, %7 %inc30 = add nuw nsw i64 %c.261, 1 %exitcond.not = icmp eq i64 %inc30, %4 br i1 %exitcond.not, label %for.end31, label %for.body16, !llvm.loop !19 for.end31: ; preds = %for.body16 store i64 %sub28, ptr %e, align 8, !tbaa !5 %tobool32.not = icmp eq i64 %spec.select52, 0 %spec.select = select i1 %tobool32.not, ptr @.str.3, ptr @.str.2 br label %if.end36 if.end36: ; preds = %for.end31, %for.end13, %for.end13.thread %.str.3.sink = phi ptr [ @.str.2, %for.end13.thread ], [ @.str.2, %for.end13 ], [ %spec.select, %for.end31 ] %call35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.3.sink) %putchar = call i32 @putchar(i32 10) call void @llvm.stackrestore.p0(ptr %1) %9 = load i64, ptr %a, align 8, !tbaa !5 %dec = add nsw i64 %9, -1 store i64 %dec, ptr %a, align 8, !tbaa !5 %tobool.not = icmp eq i64 %dec, 0 br i1 %tobool.not, label %for.end39, label %for.body, !llvm.loop !20 for.end39: ; preds = %if.end36, %entry call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %e) #7 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #7 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #7 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #7 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5 ; 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) #6 attributes #0 = { nofree nosync nounwind memory(argmem: readwrite) 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 = { mustprogress nocallback nofree nosync nounwind willreturn } attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { 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 #5 = { nofree nounwind } attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } attributes #7 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"long long", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10, !11, !12} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!"llvm.loop.isvectorized", i32 1} !12 = !{!"llvm.loop.unroll.runtime.disable"} !13 = distinct !{!13, !10} !14 = distinct !{!14, !10, !11, !12} !15 = distinct !{!15, !10, !11} !16 = distinct !{!16, !10, !11} !17 = distinct !{!17, !10} !18 = distinct !{!18, !10} !19 = distinct !{!19, !10} !20 = distinct !{!20, !10}
#include <stdio.h> int main(){ double p=3.141592653589; double r,s,l; scanf("%lf",&r); s=r*r*p; l=2*r*p; printf("%f %f\n",s,l); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_187463/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_187463/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [4 x i8] c"%lf\00", align 1 @.str.1 = private unnamed_addr constant [7 x i8] c"%f %f\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %r = alloca double, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %r) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %r) %0 = load double, ptr %r, align 8, !tbaa !5 %mul = fmul double %0, %0 %mul1 = fmul double %mul, 0x400921FB5444261E %mul2 = fmul double %0, 2.000000e+00 %mul3 = fmul double %mul2, 0x400921FB5444261E %call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %mul1, double noundef %mul3) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %r) #3 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 attributes #0 = { nofree 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 = { 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 #3 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"double", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> int main(void) { double a,e,f,r; scanf("%lf",&a); r = 3.141592653589; e = a*a*r; f = 2*r*a; printf("%f %f\n",e,f); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_187513/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_187513/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [4 x i8] c"%lf\00", align 1 @.str.1 = private unnamed_addr constant [7 x i8] c"%f %f\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca double, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a) %0 = load double, ptr %a, align 8, !tbaa !5 %mul = fmul double %0, %0 %mul1 = fmul double %mul, 0x400921FB5444261E %mul3 = fmul double %0, 0x401921FB5444261E %call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %mul1, double noundef %mul3) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #3 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 attributes #0 = { nofree 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 = { 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 #3 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"double", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> #define pai 3.14159265358979 int main(void){ double r,s,l; scanf("%lf", &r); s=r*r*pai; l=2*r*pai; printf("%f %f\n", s, l); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_187571/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_187571/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [4 x i8] c"%lf\00", align 1 @.str.1 = private unnamed_addr constant [7 x i8] c"%f %f\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %r = alloca double, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %r) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %r) %0 = load double, ptr %r, align 8, !tbaa !5 %mul = fmul double %0, %0 %mul1 = fmul double %mul, 0x400921FB54442D11 %mul2 = fmul double %0, 2.000000e+00 %mul3 = fmul double %mul2, 0x400921FB54442D11 %call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %mul1, double noundef %mul3) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %r) #3 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 attributes #0 = { nofree 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 = { 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 #3 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"double", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> int main(void) { double r,s,r2; scanf("%lf",&r); r2 = r * 2 * 3.141592653589; s = r * r * 3.141592653589; printf("%f %f\n",s,r2); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_187621/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_187621/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [4 x i8] c"%lf\00", align 1 @.str.1 = private unnamed_addr constant [7 x i8] c"%f %f\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %r = alloca double, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %r) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %r) %0 = load double, ptr %r, align 8, !tbaa !5 %mul = fmul double %0, 2.000000e+00 %mul1 = fmul double %mul, 0x400921FB5444261E %mul2 = fmul double %0, %0 %mul3 = fmul double %mul2, 0x400921FB5444261E %call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %mul3, double noundef %mul1) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %r) #3 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 attributes #0 = { nofree 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 = { 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 #3 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"double", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> int main(int argc,const char * argv[]){ double r,s,l; scanf("%lf",&r); s=3.141592653589*r*r; l=3.141592653589*r*2; printf("%.5lf %.5lf\n",s ,l); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_187665/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_187665/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [4 x i8] c"%lf\00", align 1 @.str.1 = private unnamed_addr constant [13 x i8] c"%.5lf %.5lf\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 { entry: %r = alloca double, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %r) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %r) %0 = load double, ptr %r, align 8, !tbaa !5 %mul = fmul double %0, 0x400921FB5444261E %mul1 = fmul double %0, %mul %mul3 = fmul double %mul, 2.000000e+00 %call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %mul1, double noundef %mul3) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %r) #3 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 attributes #0 = { nofree 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 = { 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 #3 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"double", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> #include <stdlib.h> #define ll long long int ll min(ll x,ll y){return x<y?x:y;} int main(void){ ll Q,H,S,D,N,ans=0,q,h,s,d; scanf("%lld%lld%lld%lld%lld",&Q,&H,&S,&D,&N); H = min(H,2*Q); S = min(S,2*H); if(2*S<D)ans = N*S; else ans = N/2*D+S*(N%2); printf("%lld",ans); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_187708/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_187708/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [21 x i8] c"%lld%lld%lld%lld%lld\00", align 1 @.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1 ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i64 @min(i64 noundef %x, i64 noundef %y) local_unnamed_addr #0 { entry: %cond = tail call i64 @llvm.smin.i64(i64 %x, i64 %y) ret i64 %cond } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %Q = alloca i64, align 8 %H = alloca i64, align 8 %S = alloca i64, align 8 %D = alloca i64, align 8 %N = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %Q) #5 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %H) #5 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %S) #5 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %D) #5 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %Q, ptr noundef nonnull %H, ptr noundef nonnull %S, ptr noundef nonnull %D, ptr noundef nonnull %N) %0 = load i64, ptr %H, align 8, !tbaa !5 %1 = load i64, ptr %Q, align 8, !tbaa !5 %mul = shl nsw i64 %1, 1 %cond.i = call i64 @llvm.smin.i64(i64 %0, i64 %mul) store i64 %cond.i, ptr %H, align 8, !tbaa !5 %2 = load i64, ptr %S, align 8, !tbaa !5 %mul2 = shl nsw i64 %cond.i, 1 %cond.i9 = call i64 @llvm.smin.i64(i64 %2, i64 %mul2) store i64 %cond.i9, ptr %S, align 8, !tbaa !5 %mul4 = shl nsw i64 %cond.i9, 1 %3 = load i64, ptr %D, align 8, !tbaa !5 %cmp = icmp slt i64 %mul4, %3 %4 = load i64, ptr %N, align 8, !tbaa !5 br i1 %cmp, label %if.then, label %if.else if.then: ; preds = %entry %mul5 = mul nsw i64 %4, %cond.i9 br label %if.end if.else: ; preds = %entry %div = sdiv i64 %4, 2 %mul6 = mul nsw i64 %div, %3 %rem = srem i64 %4, 2 %mul7 = mul nsw i64 %rem, %cond.i9 %add = add nsw i64 %mul6, %mul7 br label %if.end if.end: ; preds = %if.else, %if.then %ans.0 = phi i64 [ %mul5, %if.then ], [ %add, %if.else ] %call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.0) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %N) #5 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %D) #5 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %S) #5 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %H) #5 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %Q) #5 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smin.i64(i64, i64) #4 attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) 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 uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"long long", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> #include<math.h> #define DEBUG 0 struct Icetea { unsigned long long int price; double amount; long double perprice; int index; int n; }; void print_tea(struct Icetea size[]) { int i; for(i=0; i<4; i++)printf("price:%lld, price_perL:%Lf\n", size[i].price, size[i].perprice); } int main() { struct Icetea size[4]; unsigned long long int N, n; int i, j; unsigned long long sum; struct Icetea tmp; float amount_table[4] = {0.25, 0.5, 1, 2}; //input for(i=0; i<4; i++) { scanf("%lld", &size[i].price); size[i].perprice = (float)size[i].price/amount_table[i]; size[i].index = i; size[i].amount = amount_table[i]; } scanf("%lld", &N); //sort for(i=0; i<4; ++i){ for(j=i+1; j<4; ++j){ if(size[i].perprice > size[j].perprice) { tmp = size[i]; size[i] = size[j]; size[j] = tmp; } } } #if DEBUG print_tea(size); printf("%lld\n", N); #endif sum = 0; for(i=0; i<4; i++){ n = N/size[i].amount; if(n>=1)sum += size[i].price*n; N = N - n*size[i].amount; //printf("[%d] n: %lld, sum:%lld, N:%lld\n", i, n, sum, N); if(N<=0)break; } printf("%lld\n", sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_187751/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_187751/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" %struct.Icetea = type { i64, double, x86_fp80, i32, i32, [8 x i8] } @.str = private unnamed_addr constant [28 x i8] c"price:%lld, price_perL:%Lf\0A\00", align 1 @.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1 @.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local void @print_tea(ptr nocapture noundef readonly %size) local_unnamed_addr #0 { entry: %0 = load i64, ptr %size, align 16, !tbaa !5 %perprice = getelementptr inbounds %struct.Icetea, ptr %size, i64 0, i32 2 %1 = load x86_fp80, ptr %perprice, align 16, !tbaa !13 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %0, x86_fp80 noundef %1) %arrayidx.1 = getelementptr inbounds %struct.Icetea, ptr %size, i64 1 %2 = load i64, ptr %arrayidx.1, align 16, !tbaa !5 %perprice.1 = getelementptr inbounds %struct.Icetea, ptr %size, i64 1, i32 2 %3 = load x86_fp80, ptr %perprice.1, align 16, !tbaa !13 %call.1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %2, x86_fp80 noundef %3) %arrayidx.2 = getelementptr inbounds %struct.Icetea, ptr %size, i64 2 %4 = load i64, ptr %arrayidx.2, align 16, !tbaa !5 %perprice.2 = getelementptr inbounds %struct.Icetea, ptr %size, i64 2, i32 2 %5 = load x86_fp80, ptr %perprice.2, align 16, !tbaa !13 %call.2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %4, x86_fp80 noundef %5) %arrayidx.3 = getelementptr inbounds %struct.Icetea, ptr %size, i64 3 %6 = load i64, ptr %arrayidx.3, align 16, !tbaa !5 %perprice.3 = getelementptr inbounds %struct.Icetea, ptr %size, i64 3, i32 2 %7 = load x86_fp80, ptr %perprice.3, align 16, !tbaa !13 %call.3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %6, x86_fp80 noundef %7) ret void } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { for.body24.lr.ph: %size = alloca [4 x %struct.Icetea], align 16 %N = alloca i64, align 8 %tmp = alloca %struct.Icetea, align 16 call void @llvm.lifetime.start.p0(i64 192, ptr nonnull %size) #5 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #5 call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %tmp) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %size) %0 = load i64, ptr %size, align 16, !tbaa !5 %conv = uitofp i64 %0 to float %div = fmul float %conv, 4.000000e+00 %conv6 = fpext float %div to x86_fp80 %perprice = getelementptr inbounds [4 x %struct.Icetea], ptr %size, i64 0, i64 0, i32 2 store x86_fp80 %conv6, ptr %perprice, align 16, !tbaa !13 %index = getelementptr inbounds [4 x %struct.Icetea], ptr %size, i64 0, i64 0, i32 3 store i32 0, ptr %index, align 16, !tbaa !14 %amount = getelementptr inbounds [4 x %struct.Icetea], ptr %size, i64 0, i64 0, i32 1 store double 2.500000e-01, ptr %amount, align 8, !tbaa !15 %arrayidx.1 = getelementptr inbounds [4 x %struct.Icetea], ptr %size, i64 0, i64 1 %call.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx.1) %1 = load i64, ptr %arrayidx.1, align 16, !tbaa !5 %conv.1 = uitofp i64 %1 to float %div.1 = fmul float %conv.1, 2.000000e+00 %conv6.1 = fpext float %div.1 to x86_fp80 %perprice.1 = getelementptr inbounds [4 x %struct.Icetea], ptr %size, i64 0, i64 1, i32 2 store x86_fp80 %conv6.1, ptr %perprice.1, align 16, !tbaa !13 %index.1 = getelementptr inbounds [4 x %struct.Icetea], ptr %size, i64 0, i64 1, i32 3 store i32 1, ptr %index.1, align 16, !tbaa !14 %amount.1 = getelementptr inbounds [4 x %struct.Icetea], ptr %size, i64 0, i64 1, i32 1 store double 5.000000e-01, ptr %amount.1, align 8, !tbaa !15 %arrayidx.2 = getelementptr inbounds [4 x %struct.Icetea], ptr %size, i64 0, i64 2 %call.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx.2) %2 = load i64, ptr %arrayidx.2, align 16, !tbaa !5 %conv.2 = uitofp i64 %2 to float %conv6.2 = fpext float %conv.2 to x86_fp80 %perprice.2 = getelementptr inbounds [4 x %struct.Icetea], ptr %size, i64 0, i64 2, i32 2 store x86_fp80 %conv6.2, ptr %perprice.2, align 16, !tbaa !13 %index.2 = getelementptr inbounds [4 x %struct.Icetea], ptr %size, i64 0, i64 2, i32 3 store i32 2, ptr %index.2, align 16, !tbaa !14 %amount.2 = getelementptr inbounds [4 x %struct.Icetea], ptr %size, i64 0, i64 2, i32 1 store double 1.000000e+00, ptr %amount.2, align 8, !tbaa !15 %arrayidx.3 = getelementptr inbounds [4 x %struct.Icetea], ptr %size, i64 0, i64 3 %call.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx.3) %3 = load i64, ptr %arrayidx.3, align 16, !tbaa !5 %conv.3 = uitofp i64 %3 to float %div.3 = fmul float %conv.3, 5.000000e-01 %conv6.3 = fpext float %div.3 to x86_fp80 %perprice.3 = getelementptr inbounds [4 x %struct.Icetea], ptr %size, i64 0, i64 3, i32 2 store x86_fp80 %conv6.3, ptr %perprice.3, align 16, !tbaa !13 %index.3 = getelementptr inbounds [4 x %struct.Icetea], ptr %size, i64 0, i64 3, i32 3 store i32 3, ptr %index.3, align 16, !tbaa !14 %amount.3 = getelementptr inbounds [4 x %struct.Icetea], ptr %size, i64 0, i64 3, i32 1 store double 2.000000e+00, ptr %amount.3, align 8, !tbaa !15 %call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %N) %4 = load x86_fp80, ptr %perprice, align 16, !tbaa !13 %5 = load x86_fp80, ptr %perprice.1, align 16, !tbaa !13 %cmp31 = fcmp ogt x86_fp80 %4, %5 br i1 %cmp31, label %if.then, label %for.inc41 for.body24.lr.ph.1: ; preds = %if.then.2133, %for.inc41.1128 %6 = load x86_fp80, ptr %perprice.1, align 16, !tbaa !13 %7 = load x86_fp80, ptr %perprice.2, align 16, !tbaa !13 %cmp31.1 = fcmp ogt x86_fp80 %6, %7 br i1 %cmp31.1, label %if.then.1, label %for.inc41.1 if.then.1: ; preds = %for.body24.lr.ph.1 call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(48) %tmp, ptr noundef nonnull align 16 dereferenceable(48) %arrayidx.1, i64 48, i1 false), !tbaa.struct !16 call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(48) %arrayidx.1, ptr noundef nonnull align 16 dereferenceable(48) %arrayidx.2, i64 48, i1 false), !tbaa.struct !16 call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(48) %arrayidx.2, ptr noundef nonnull align 16 dereferenceable(48) %tmp, i64 48, i1 false), !tbaa.struct !16 %.pre137 = load x86_fp80, ptr %perprice.1, align 16, !tbaa !13 br label %for.inc41.1 for.inc41.1: ; preds = %if.then.1, %for.body24.lr.ph.1 %8 = phi x86_fp80 [ %.pre137, %if.then.1 ], [ %6, %for.body24.lr.ph.1 ] %9 = load x86_fp80, ptr %perprice.3, align 16, !tbaa !13 %cmp31.1.1 = fcmp ogt x86_fp80 %8, %9 br i1 %cmp31.1.1, label %if.then.1.1, label %for.body24.lr.ph.2 if.then.1.1: ; preds = %for.inc41.1 call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(48) %tmp, ptr noundef nonnull align 16 dereferenceable(48) %arrayidx.1, i64 48, i1 false), !tbaa.struct !16 call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(48) %arrayidx.1, ptr noundef nonnull align 16 dereferenceable(48) %arrayidx.3, i64 48, i1 false), !tbaa.struct !16 call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(48) %arrayidx.3, ptr noundef nonnull align 16 dereferenceable(48) %tmp, i64 48, i1 false), !tbaa.struct !16 br label %for.body24.lr.ph.2 for.body24.lr.ph.2: ; preds = %if.then.1.1, %for.inc41.1 %10 = load x86_fp80, ptr %perprice.2, align 16, !tbaa !13 %11 = load x86_fp80, ptr %perprice.3, align 16, !tbaa !13 %cmp31.2 = fcmp ogt x86_fp80 %10, %11 br i1 %cmp31.2, label %if.then.2, label %for.cond17.loopexit.3 if.then.2: ; preds = %for.body24.lr.ph.2 call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(48) %tmp, ptr noundef nonnull align 16 dereferenceable(48) %arrayidx.2, i64 48, i1 false), !tbaa.struct !16 call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(48) %arrayidx.2, ptr noundef nonnull align 16 dereferenceable(48) %arrayidx.3, i64 48, i1 false), !tbaa.struct !16 call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(48) %arrayidx.3, ptr noundef nonnull align 16 dereferenceable(48) %tmp, i64 48, i1 false), !tbaa.struct !16 br label %for.cond17.loopexit.3 for.cond17.loopexit.3: ; preds = %if.then.2, %for.body24.lr.ph.2 %N.promoted = load i64, ptr %N, align 8, !tbaa !17 %conv51 = uitofp i64 %N.promoted to double %12 = load double, ptr %amount, align 8, !tbaa !15 %div55 = fdiv double %conv51, %12 %conv56 = fptoui double %div55 to i64 %13 = load i64, ptr %size, align 16 %.fr = freeze i64 %13 %mul = mul i64 %.fr, %conv56 %conv66 = uitofp i64 %conv56 to double %neg = fneg double %conv66 %14 = call double @llvm.fmuladd.f64(double %neg, double %12, double %conv51) %conv71 = fptoui double %14 to i64 %cmp72 = icmp eq i64 %conv71, 0 br i1 %cmp72, label %for.end78, label %for.cond47 if.then: ; preds = %for.body24.lr.ph call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(48) %tmp, ptr noundef nonnull align 16 dereferenceable(48) %size, i64 48, i1 false), !tbaa.struct !16 call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(48) %size, ptr noundef nonnull align 16 dereferenceable(48) %arrayidx.1, i64 48, i1 false), !tbaa.struct !16 call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(48) %arrayidx.1, ptr noundef nonnull align 16 dereferenceable(48) %tmp, i64 48, i1 false), !tbaa.struct !16 %.pre = load x86_fp80, ptr %perprice, align 16, !tbaa !13 br label %for.inc41 for.inc41: ; preds = %for.body24.lr.ph, %if.then %15 = phi x86_fp80 [ %4, %for.body24.lr.ph ], [ %.pre, %if.then ] %16 = load x86_fp80, ptr %perprice.2, align 16, !tbaa !13 %cmp31.1124 = fcmp ogt x86_fp80 %15, %16 br i1 %cmp31.1124, label %if.then.1127, label %for.inc41.1128 if.then.1127: ; preds = %for.inc41 call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(48) %tmp, ptr noundef nonnull align 16 dereferenceable(48) %size, i64 48, i1 false), !tbaa.struct !16 call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(48) %size, ptr noundef nonnull align 16 dereferenceable(48) %arrayidx.2, i64 48, i1 false), !tbaa.struct !16 call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(48) %arrayidx.2, ptr noundef nonnull align 16 dereferenceable(48) %tmp, i64 48, i1 false), !tbaa.struct !16 %.pre136 = load x86_fp80, ptr %perprice, align 16, !tbaa !13 br label %for.inc41.1128 for.inc41.1128: ; preds = %if.then.1127, %for.inc41 %17 = phi x86_fp80 [ %.pre136, %if.then.1127 ], [ %15, %for.inc41 ] %18 = load x86_fp80, ptr %perprice.3, align 16, !tbaa !13 %cmp31.2130 = fcmp ogt x86_fp80 %17, %18 br i1 %cmp31.2130, label %if.then.2133, label %for.body24.lr.ph.1 if.then.2133: ; preds = %for.inc41.1128 call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(48) %tmp, ptr noundef nonnull align 16 dereferenceable(48) %size, i64 48, i1 false), !tbaa.struct !16 call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(48) %size, ptr noundef nonnull align 16 dereferenceable(48) %arrayidx.3, i64 48, i1 false), !tbaa.struct !16 call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(48) %arrayidx.3, ptr noundef nonnull align 16 dereferenceable(48) %tmp, i64 48, i1 false), !tbaa.struct !16 br label %for.body24.lr.ph.1 for.cond47: ; preds = %for.cond17.loopexit.3 %conv51.1 = uitofp i64 %conv71 to double %19 = load double, ptr %amount.1, align 8, !tbaa !15 %div55.1 = fdiv double %conv51.1, %19 %conv56.1 = fptoui double %div55.1 to i64 %20 = load i64, ptr %arrayidx.1, align 16 %.fr138 = freeze i64 %20 %mul.1 = mul i64 %.fr138, %conv56.1 %sum.1.1 = add i64 %mul, %mul.1 %conv66.1 = uitofp i64 %conv56.1 to double %neg.1 = fneg double %conv66.1 %21 = call double @llvm.fmuladd.f64(double %neg.1, double %19, double %conv51.1) %conv71.1 = fptoui double %21 to i64 %cmp72.1 = icmp eq i64 %conv71.1, 0 br i1 %cmp72.1, label %for.end78, label %for.cond47.1 for.cond47.1: ; preds = %for.cond47 %conv51.2 = uitofp i64 %conv71.1 to double %22 = load double, ptr %amount.2, align 8, !tbaa !15 %div55.2 = fdiv double %conv51.2, %22 %conv56.2 = fptoui double %div55.2 to i64 %23 = load i64, ptr %arrayidx.2, align 16 %.fr139 = freeze i64 %23 %mul.2 = mul i64 %.fr139, %conv56.2 %sum.1.2 = add i64 %sum.1.1, %mul.2 %conv66.2 = uitofp i64 %conv56.2 to double %neg.2 = fneg double %conv66.2 %24 = call double @llvm.fmuladd.f64(double %neg.2, double %22, double %conv51.2) %conv71.2 = fptoui double %24 to i64 %cmp72.2 = icmp eq i64 %conv71.2, 0 br i1 %cmp72.2, label %for.end78, label %for.cond47.2 for.cond47.2: ; preds = %for.cond47.1 %conv51.3 = uitofp i64 %conv71.2 to double %25 = load double, ptr %amount.3, align 8, !tbaa !15 %div55.3 = fdiv double %conv51.3, %25 %conv56.3 = fptoui double %div55.3 to i64 %26 = load i64, ptr %arrayidx.3, align 16 %.fr140 = freeze i64 %26 %mul.3 = mul i64 %.fr140, %conv56.3 %sum.1.3 = add i64 %sum.1.2, %mul.3 %conv66.3 = uitofp i64 %conv56.3 to double %neg.3 = fneg double %conv66.3 %27 = call double @llvm.fmuladd.f64(double %neg.3, double %25, double %conv51.3) %conv71.3 = fptoui double %27 to i64 br label %for.end78 for.end78: ; preds = %for.cond47.2, %for.cond47.1, %for.cond47, %for.cond17.loopexit.3 %sum.1.lcssa = phi i64 [ %mul, %for.cond17.loopexit.3 ], [ %sum.1.1, %for.cond47 ], [ %sum.1.2, %for.cond47.1 ], [ %sum.1.3, %for.cond47.2 ] %conv71.lcssa = phi i64 [ 0, %for.cond17.loopexit.3 ], [ 0, %for.cond47 ], [ 0, %for.cond47.1 ], [ %conv71.3, %for.cond47.2 ] store i64 %conv71.lcssa, ptr %N, align 8, !tbaa !17 %call79 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %sum.1.lcssa) call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %tmp) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %N) #5 call void @llvm.lifetime.end.p0(i64 192, ptr nonnull %size) #5 ret i32 0 } ; 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) #3 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) declare double @llvm.fmuladd.f64(double, double, double) #4 attributes #0 = { nofree 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 = { 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 #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) } attributes #4 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !7, i64 0} !6 = !{!"Icetea", !7, i64 0, !10, i64 8, !11, i64 16, !12, i64 32, !12, i64 36} !7 = !{!"long long", !8, i64 0} !8 = !{!"omnipotent char", !9, i64 0} !9 = !{!"Simple C/C++ TBAA"} !10 = !{!"double", !8, i64 0} !11 = !{!"long double", !8, i64 0} !12 = !{!"int", !8, i64 0} !13 = !{!6, !11, i64 16} !14 = !{!6, !12, i64 32} !15 = !{!6, !10, i64 8} !16 = !{i64 0, i64 8, !17, i64 8, i64 8, !18, i64 16, i64 16, !19, i64 32, i64 4, !20, i64 36, i64 4, !20} !17 = !{!7, !7, i64 0} !18 = !{!10, !10, i64 0} !19 = !{!11, !11, i64 0} !20 = !{!12, !12, i64 0}
#include <stdio.h> int main(){ int n; scanf("%d", &n); int a[100003]; for(int i=1; i<=n; i++) scanf("%d", a+i); int count = n; int now = 1; while(count--){ now = a[now]; if(now == 2){ printf("%d\n", n-count); return 0; } } printf("-1\n"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_187795/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_187795/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 @str = private unnamed_addr constant [3 x i8] c"-1\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %a = alloca [100003 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) call void @llvm.lifetime.start.p0(i64 400012, ptr nonnull %a) #4 %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp.not14 = icmp slt i32 %0, 1 br i1 %cmp.not14, label %while.cond.preheader, label %for.body while.cond.preheader: ; preds = %for.body, %entry %.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ] br label %while.cond for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ] %add.ptr = getelementptr inbounds i32, ptr %a, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %add.ptr) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp.not.not = icmp slt i64 %indvars.iv, %2 br i1 %cmp.not.not, label %for.body, label %while.cond.preheader, !llvm.loop !9 while.cond: ; preds = %while.cond.preheader, %while.body %count.0 = phi i32 [ %dec, %while.body ], [ %.lcssa, %while.cond.preheader ] %now.0 = phi i32 [ %3, %while.body ], [ 1, %while.cond.preheader ] %tobool.not = icmp eq i32 %count.0, 0 br i1 %tobool.not, label %while.end, label %while.body while.body: ; preds = %while.cond %dec = add nsw i32 %count.0, -1 %idxprom = sext i32 %now.0 to i64 %arrayidx = getelementptr inbounds [100003 x i32], ptr %a, i64 0, i64 %idxprom %3 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp2 = icmp eq i32 %3, 2 br i1 %cmp2, label %if.then, label %while.cond, !llvm.loop !11 if.then: ; preds = %while.body %sub = sub nsw i32 %.lcssa, %dec %call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub) br label %cleanup while.end: ; preds = %while.cond %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) br label %cleanup cleanup: ; preds = %while.end, %if.then call void @llvm.lifetime.end.p0(i64 400012, ptr nonnull %a) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3 attributes #0 = { nofree 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 = { 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 #3 = { nofree nounwind } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10}
#include <stdio.h> int main() { int N; scanf("%d", &N); int button[N], i; for (i = 1; i <= N; i++) { int tmp; scanf("%d", &tmp); button[i] = tmp; } int now = 1, c = 0; for (;;) { if (now == 2) { printf("%d\n", c); break; } if (c >= N) { printf("-1\n"); break; } c++; now = button[now]; } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_187838/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_187838/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 @str = private unnamed_addr constant [3 x i8] c"-1\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %N = alloca i32, align 4 %tmp = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #6 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N) %0 = load i32, ptr %N, align 4, !tbaa !5 %1 = zext i32 %0 to i64 %2 = call ptr @llvm.stacksave.p0() %vla = alloca i32, i64 %1, align 16 %3 = load i32, ptr %N, align 4, !tbaa !5 %cmp.not19 = icmp slt i32 %3, 1 br i1 %cmp.not19, label %for.cond2.preheader, label %for.body for.cond2.preheader: ; preds = %for.body, %entry %.lcssa = phi i32 [ %3, %entry ], [ %5, %for.body ] %smax = call i32 @llvm.smax.i32(i32 %.lcssa, i32 0) br label %if.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ] call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %tmp) #6 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %tmp) %4 = load i32, ptr %tmp, align 4, !tbaa !5 %arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv store i32 %4, ptr %arrayidx, align 4, !tbaa !5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %tmp) #6 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %5 = load i32, ptr %N, align 4, !tbaa !5 %6 = sext i32 %5 to i64 %cmp.not.not = icmp slt i64 %indvars.iv, %6 br i1 %cmp.not.not, label %for.body, label %for.cond2.preheader, !llvm.loop !9 if.then: ; preds = %if.end8 %call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %inc9) br label %for.end12 if.end: ; preds = %for.cond2.preheader, %if.end8 %c.022 = phi i32 [ 0, %for.cond2.preheader ], [ %inc9, %if.end8 ] %now.021 = phi i32 [ 1, %for.cond2.preheader ], [ %7, %if.end8 ] %exitcond.not = icmp eq i32 %c.022, %smax br i1 %exitcond.not, label %if.then6, label %if.end8 if.then6: ; preds = %if.end %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) br label %for.end12 if.end8: ; preds = %if.end %inc9 = add nuw i32 %c.022, 1 %idxprom10 = sext i32 %now.021 to i64 %arrayidx11 = getelementptr inbounds i32, ptr %vla, i64 %idxprom10 %7 = load i32, ptr %arrayidx11, align 4, !tbaa !5 %cmp3 = icmp eq i32 %7, 2 br i1 %cmp3, label %if.then, label %if.end for.end12: ; preds = %if.then6, %if.then call void @llvm.stackrestore.p0(ptr %2) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare ptr @llvm.stacksave.p0() #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare void @llvm.stackrestore.p0(ptr) #3 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #5 attributes #0 = { nofree 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 = { 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 #3 = { mustprogress nocallback nofree nosync nounwind willreturn } attributes #4 = { nofree nounwind } attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #6 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"}
#include<stdio.h> #include<string.h> int a[100001][2]; int main(void) { int n; int i, j; int flag = 1; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d", &a[i][0]); a[i][1] = 1; } //ループのiに数列の値を代入してみる// j = 0; for (i = 0; i < n; i = a[i][0] - 1) { if (a[i][0] == 1) { printf("-1\n"); return 0; } if (a[i][0] == 2) { printf("%d", j+1); return 0; } if (a[i][1] == 0) { printf("-1\n"); return 0; } a[i][1] = 0; j++; } printf("-1\n"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_187889/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_187889/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @a = dso_local global [100001 x [2 x i32]] zeroinitializer, align 16 @str.3 = private unnamed_addr constant [3 x i8] c"-1\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp56 = icmp sgt i32 %0, 0 br i1 %cmp56, label %for.body, label %for.end36 for.cond6.preheader: ; preds = %for.body %cmp758 = icmp sgt i32 %1, 0 br i1 %cmp758, label %for.body8, label %for.end36 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100001 x [2 x i32]], ptr @a, i64 0, i64 %indvars.iv %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %arrayidx5 = getelementptr inbounds [100001 x [2 x i32]], ptr @a, i64 0, i64 %indvars.iv, i64 1 store i32 1, ptr %arrayidx5, align 4, !tbaa !5 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.cond6.preheader, !llvm.loop !9 for.body8: ; preds = %for.cond6.preheader, %if.end27 %j.060 = phi i32 [ %inc31, %if.end27 ], [ 0, %for.cond6.preheader ] %i.159 = phi i32 [ %sub, %if.end27 ], [ 0, %for.cond6.preheader ] %idxprom9 = sext i32 %i.159 to i64 %arrayidx10 = getelementptr inbounds [100001 x [2 x i32]], ptr @a, i64 0, i64 %idxprom9 %3 = load i32, ptr %arrayidx10, align 8, !tbaa !5 switch i32 %3, label %if.end20 [ i32 1, label %if.then i32 2, label %if.then18 ] if.then: ; preds = %for.body8 %puts52 = call i32 @puts(ptr nonnull dereferenceable(1) @str.3) br label %cleanup if.then18: ; preds = %for.body8 %add = add nuw nsw i32 %j.060, 1 %call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %add) br label %cleanup if.end20: ; preds = %for.body8 %arrayidx23 = getelementptr inbounds [100001 x [2 x i32]], ptr @a, i64 0, i64 %idxprom9, i64 1 %4 = load i32, ptr %arrayidx23, align 4, !tbaa !5 %cmp24 = icmp eq i32 %4, 0 br i1 %cmp24, label %if.then25, label %if.end27 if.then25: ; preds = %if.end20 %puts51 = call i32 @puts(ptr nonnull dereferenceable(1) @str.3) br label %cleanup if.end27: ; preds = %if.end20 store i32 0, ptr %arrayidx23, align 4, !tbaa !5 %inc31 = add nuw nsw i32 %j.060, 1 %sub = add nsw i32 %3, -1 %cmp7.not = icmp sgt i32 %3, %1 br i1 %cmp7.not, label %for.end36, label %for.body8, !llvm.loop !11 for.end36: ; preds = %if.end27, %entry, %for.cond6.preheader %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.3) br label %cleanup cleanup: ; preds = %for.end36, %if.then25, %if.then18, %if.then call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3 attributes #0 = { nofree 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 = { 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 #3 = { nofree nounwind } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10}
#include <stdio.h> int main(void) { int n,i,j=1,t; int a[100000]={0}; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d",&a[i]); } i=0; while(n>0&&j<100000) { if(a[i]!=2) { t = a[i]-1; i = t; j++; } else { n=0; } } if(j>=100000) { j=-1; } printf("%d\n",j); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_187953/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_187953/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %a = alloca [100000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %a) #4 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400000) %a, i8 0, i64 400000, i1 false) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp21 = icmp sgt i32 %0, 0 br i1 %cmp21, label %for.body, label %while.end.thread while.cond.preheader: ; preds = %for.body %cmp223 = icmp sgt i32 %1, 0 br i1 %cmp223, label %while.body, label %while.end.thread for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %while.cond.preheader, !llvm.loop !9 while.body: ; preds = %while.cond.preheader, %if.end.2 %i.125 = phi i32 [ %sub.2, %if.end.2 ], [ 0, %while.cond.preheader ] %j.024 = phi i32 [ %inc9.2, %if.end.2 ], [ 1, %while.cond.preheader ] %idxprom4 = sext i32 %i.125 to i64 %arrayidx5 = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 %idxprom4 %3 = load i32, ptr %arrayidx5, align 4, !tbaa !5 %cmp6.not = icmp eq i32 %3, 2 br i1 %cmp6.not, label %if.end.thread, label %if.end if.end.thread.split.loop.exit: ; preds = %if.end.1 %inc9.1.le = add nuw nsw i32 %j.024, 2 br label %if.end.thread if.end.thread.split.loop.exit41: ; preds = %if.end %inc9.le = add nuw nsw i32 %j.024, 1 br label %if.end.thread if.end.thread: ; preds = %while.body, %if.end.thread.split.loop.exit41, %if.end.thread.split.loop.exit %j.024.lcssa = phi i32 [ %inc9.1.le, %if.end.thread.split.loop.exit ], [ %inc9.le, %if.end.thread.split.loop.exit41 ], [ %j.024, %while.body ] store i32 0, ptr %n, align 4, !tbaa !5 br label %while.end.thread if.end: ; preds = %while.body %sub = add nsw i32 %3, -1 %idxprom4.1 = sext i32 %sub to i64 %arrayidx5.1 = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 %idxprom4.1 %4 = load i32, ptr %arrayidx5.1, align 4, !tbaa !5 %cmp6.not.1 = icmp eq i32 %4, 2 br i1 %cmp6.not.1, label %if.end.thread.split.loop.exit41, label %if.end.1 if.end.1: ; preds = %if.end %sub.1 = add nsw i32 %4, -1 %idxprom4.2 = sext i32 %sub.1 to i64 %arrayidx5.2 = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 %idxprom4.2 %5 = load i32, ptr %arrayidx5.2, align 4, !tbaa !5 %cmp6.not.2 = icmp eq i32 %5, 2 br i1 %cmp6.not.2, label %if.end.thread.split.loop.exit, label %if.end.2 if.end.2: ; preds = %if.end.1 %sub.2 = add nsw i32 %5, -1 %inc9.2 = add nuw nsw i32 %j.024, 3 %cmp3.2 = icmp ult i32 %j.024, 99997 br i1 %cmp3.2, label %while.body, label %while.end.thread, !llvm.loop !11 while.end.thread: ; preds = %if.end.2, %entry, %if.end.thread, %while.cond.preheader %6 = phi i32 [ %j.024.lcssa, %if.end.thread ], [ 1, %while.cond.preheader ], [ 1, %entry ], [ -1, %if.end.2 ] %call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %6) call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %a) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 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 ; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) } 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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10}
#include<stdio.h> #include<math.h> int main(void){ int n; char box[9][9]={0}; int ans[9][9]={0}; int x[100]={0},y[100]={0}; int l,i,j,count=0; int start_x=0,start_y=0; int end_x=0,end_y=0; scanf("%d\n",&n); for(l=0;l<n;l++){ for(i=0;i<8;i++)scanf("%s",box[i]); scanf("%d %d",&x[0],&y[0]); x[0]--; y[0]--; for(j=0;j<=count;j++){ if(x[j]<=3)start_x=0; else start_x=x[j]-3; if(y[j]<=3)start_y=0; else start_y=y[j]-3; if(x[j]+3>=8)end_x=7; else end_x=x[j]+3; if(y[j]+3>=8)end_y=7; else end_y=y[j]+3; for(i=start_x;i<=end_x;i++){ if(box[y[j]][i]=='1'){ count++; y[count]=y[j]; x[count]=i; box[y[j]][i]='0'; } } for(i=start_y;i<=end_y;i++){ if(box[i][x[j]]=='1'){ count++; x[count]=x[j]; y[count]=i; box[i][x[j]]='0'; } } } for(i=0;i<8;i++){ for(j=0;j<8;j++){ if(box[i][j]=='0')ans[i][j]=0; else if(box[i][j]=='1')ans[i][j]=1; } } printf("Data %d:\n",(l+1)); for(i=0;i<8;i++){ for(j=0;j<8;j++){ printf("%d",ans[i][j]); } printf("\n"); } count=0; } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_188002/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_188002/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.2 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.3 = private unnamed_addr constant [10 x i8] c"Data %d:\0A\00", align 1 @.str.4 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %box = alloca [9 x [9 x i8]], align 16 %ans = alloca [9 x [9 x i32]], align 16 %x = alloca [100 x i32], align 16 %y = alloca [100 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 81, ptr nonnull %box) #5 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(81) %box, i8 0, i64 81, i1 false) call void @llvm.lifetime.start.p0(i64 324, ptr nonnull %ans) #5 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(324) %ans, i8 0, i64 324, i1 false) call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %x) #5 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400) %x, i8 0, i64 400, i1 false) call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %y) #5 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400) %y, i8 0, i64 400, i1 false) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp244 = icmp sgt i32 %0, 0 br i1 %cmp244, label %for.cond1.preheader.preheader, label %for.end175 for.cond1.preheader.preheader: ; preds = %entry %arrayidx164.7280 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 7, i64 0 %arrayidx.1 = getelementptr inbounds [9 x [9 x i8]], ptr %box, i64 0, i64 1 %arrayidx.2 = getelementptr inbounds [9 x [9 x i8]], ptr %box, i64 0, i64 2 %arrayidx.3 = getelementptr inbounds [9 x [9 x i8]], ptr %box, i64 0, i64 3 %arrayidx.4 = getelementptr inbounds [9 x [9 x i8]], ptr %box, i64 0, i64 4 %arrayidx.5 = getelementptr inbounds [9 x [9 x i8]], ptr %box, i64 0, i64 5 %arrayidx.6 = getelementptr inbounds [9 x [9 x i8]], ptr %box, i64 0, i64 6 %arrayidx.7 = getelementptr inbounds [9 x [9 x i8]], ptr %box, i64 0, i64 7 %arrayidx164.1 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 0, i64 1 %arrayidx164.2 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 0, i64 2 %arrayidx164.3 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 0, i64 3 %arrayidx164.4 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 0, i64 4 %arrayidx164.5 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 0, i64 5 %arrayidx164.6 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 0, i64 6 %arrayidx164.7 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 0, i64 7 %arrayidx164.1268 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 1, i64 0 %arrayidx164.1.1 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 1, i64 1 %arrayidx164.2.1 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 1, i64 2 %arrayidx164.3.1 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 1, i64 3 %arrayidx164.4.1 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 1, i64 4 %arrayidx164.5.1 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 1, i64 5 %arrayidx164.6.1 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 1, i64 6 %arrayidx164.7.1 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 1, i64 7 %arrayidx164.2270 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 2, i64 0 %arrayidx164.1.2 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 2, i64 1 %arrayidx164.2.2 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 2, i64 2 %arrayidx164.3.2 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 2, i64 3 %arrayidx164.4.2 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 2, i64 4 %arrayidx164.5.2 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 2, i64 5 %arrayidx164.6.2 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 2, i64 6 %arrayidx164.7.2 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 2, i64 7 %arrayidx164.3272 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 3, i64 0 %arrayidx164.1.3 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 3, i64 1 %arrayidx164.2.3 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 3, i64 2 %arrayidx164.3.3 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 3, i64 3 %arrayidx164.4.3 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 3, i64 4 %arrayidx164.5.3 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 3, i64 5 %arrayidx164.6.3 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 3, i64 6 %arrayidx164.7.3 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 3, i64 7 %arrayidx164.4274 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 4, i64 0 %arrayidx164.1.4 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 4, i64 1 %arrayidx164.2.4 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 4, i64 2 %arrayidx164.3.4 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 4, i64 3 %arrayidx164.4.4 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 4, i64 4 %arrayidx164.5.4 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 4, i64 5 %arrayidx164.6.4 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 4, i64 6 %arrayidx164.7.4 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 4, i64 7 %arrayidx164.5276 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 5, i64 0 %arrayidx164.1.5 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 5, i64 1 %arrayidx164.2.5 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 5, i64 2 %arrayidx164.3.5 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 5, i64 3 %arrayidx164.4.5 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 5, i64 4 %arrayidx164.5.5 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 5, i64 5 %arrayidx164.6.5 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 5, i64 6 %arrayidx164.7.5 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 5, i64 7 %arrayidx164.6278 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 6, i64 0 %arrayidx164.1.6 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 6, i64 1 %arrayidx164.2.6 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 6, i64 2 %arrayidx164.3.6 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 6, i64 3 %arrayidx164.4.6 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 6, i64 4 %arrayidx164.5.6 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 6, i64 5 %arrayidx164.6.6 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 6, i64 6 %arrayidx164.7.6 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 6, i64 7 %arrayidx164.1.7 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 7, i64 1 %arrayidx164.2.7 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 7, i64 2 %arrayidx164.3.7 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 7, i64 3 %arrayidx164.4.7 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 7, i64 4 %arrayidx164.5.7 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 7, i64 5 %arrayidx164.6.7 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 7, i64 6 %arrayidx164.7.7 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 7, i64 7 br label %for.cond1.preheader for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.end150 %l.0245 = phi i32 [ %add151, %for.end150 ], [ 0, %for.cond1.preheader.preheader ] %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %box) %call4.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx.1) %call4.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx.2) %call4.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx.3) %call4.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx.4) %call4.5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx.5) %call4.6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx.6) %call4.7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx.7) %call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %x, ptr noundef nonnull %y) %1 = load i32, ptr %x, align 16, !tbaa !5 %dec = add nsw i32 %1, -1 store i32 %dec, ptr %x, align 16, !tbaa !5 %2 = load i32, ptr %y, align 16, !tbaa !5 %dec10 = add nsw i32 %2, -1 store i32 %dec10, ptr %y, align 16, !tbaa !5 br label %for.body13 for.body13: ; preds = %for.cond1.preheader, %for.inc107 %indvars.iv251 = phi i64 [ 0, %for.cond1.preheader ], [ %indvars.iv.next252, %for.inc107 ] %count.1239 = phi i32 [ 0, %for.cond1.preheader ], [ %count.4.lcssa, %for.inc107 ] %arrayidx15 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %indvars.iv251 %3 = load i32, ptr %arrayidx15, align 4, !tbaa !5 %cmp16 = icmp slt i32 %3, 4 %sub = add nsw i32 %3, -3 %start_x.0 = select i1 %cmp16, i32 0, i32 %sub %arrayidx20 = getelementptr inbounds [100 x i32], ptr %y, i64 0, i64 %indvars.iv251 %4 = load i32, ptr %arrayidx20, align 4, !tbaa !5 %cmp21 = icmp slt i32 %4, 4 %sub26 = add nsw i32 %4, -3 %start_y.0 = select i1 %cmp21, i32 0, i32 %sub26 %cmp30 = icmp sgt i32 %3, 4 %add = add nsw i32 %3, 3 %end_x.0 = select i1 %cmp30, i32 7, i32 %add %cmp40 = icmp sgt i32 %4, 4 %add39 = add nsw i32 %4, 3 %end_y.0 = select i1 %cmp40, i32 7, i32 %add39 %cmp48.not231 = icmp sgt i32 %start_x.0, %end_x.0 br i1 %cmp48.not231, label %for.cond76.preheader, label %for.body49.preheader for.body49.preheader: ; preds = %for.body13 %5 = zext i32 %start_x.0 to i64 br label %for.body49 for.cond76.preheader: ; preds = %for.inc73, %for.body13 %count.2.lcssa = phi i32 [ %count.1239, %for.body13 ], [ %count.3, %for.inc73 ] %cmp77.not234 = icmp sgt i32 %start_y.0, %end_y.0 br i1 %cmp77.not234, label %for.inc107, label %for.body79.preheader for.body79.preheader: ; preds = %for.cond76.preheader %6 = zext i32 %start_y.0 to i64 %.pre = load i32, ptr %arrayidx15, align 4, !tbaa !5 br label %for.body79 for.body49: ; preds = %for.body49.preheader, %for.inc73 %7 = phi i32 [ %4, %for.body49.preheader ], [ %11, %for.inc73 ] %indvars.iv = phi i64 [ %5, %for.body49.preheader ], [ %indvars.iv.next, %for.inc73 ] %count.2233 = phi i32 [ %count.1239, %for.body49.preheader ], [ %count.3, %for.inc73 ] %idxprom52 = sext i32 %7 to i64 %arrayidx55 = getelementptr inbounds [9 x [9 x i8]], ptr %box, i64 0, i64 %idxprom52, i64 %indvars.iv %8 = load i8, ptr %arrayidx55, align 1, !tbaa !9 %cmp56 = icmp eq i8 %8, 49 br i1 %cmp56, label %if.then58, label %for.body49.for.inc73_crit_edge for.body49.for.inc73_crit_edge: ; preds = %for.body49 %.pre283 = trunc i64 %indvars.iv to i32 br label %for.inc73 if.then58: ; preds = %for.body49 %inc59 = add nsw i32 %count.2233, 1 %idxprom62 = sext i32 %inc59 to i64 %arrayidx63 = getelementptr inbounds [100 x i32], ptr %y, i64 0, i64 %idxprom62 store i32 %7, ptr %arrayidx63, align 4, !tbaa !5 %arrayidx65 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %idxprom62 %9 = trunc i64 %indvars.iv to i32 store i32 %9, ptr %arrayidx65, align 4, !tbaa !5 %10 = load i32, ptr %arrayidx20, align 4, !tbaa !5 %idxprom68 = sext i32 %10 to i64 %arrayidx71 = getelementptr inbounds [9 x [9 x i8]], ptr %box, i64 0, i64 %idxprom68, i64 %indvars.iv store i8 48, ptr %arrayidx71, align 1, !tbaa !9 br label %for.inc73 for.inc73: ; preds = %for.body49.for.inc73_crit_edge, %if.then58 %.pre-phi284 = phi i32 [ %.pre283, %for.body49.for.inc73_crit_edge ], [ %9, %if.then58 ] %11 = phi i32 [ %7, %for.body49.for.inc73_crit_edge ], [ %10, %if.then58 ] %count.3 = phi i32 [ %count.2233, %for.body49.for.inc73_crit_edge ], [ %inc59, %if.then58 ] %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %cmp48.not.not = icmp slt i32 %.pre-phi284, %end_x.0 br i1 %cmp48.not.not, label %for.body49, label %for.cond76.preheader, !llvm.loop !10 for.body79: ; preds = %for.body79.preheader, %for.inc104 %12 = phi i32 [ %.pre, %for.body79.preheader ], [ %16, %for.inc104 ] %indvars.iv248 = phi i64 [ %6, %for.body79.preheader ], [ %indvars.iv.next249, %for.inc104 ] %count.4236 = phi i32 [ %count.2.lcssa, %for.body79.preheader ], [ %count.5, %for.inc104 ] %idxprom84 = sext i32 %12 to i64 %arrayidx85 = getelementptr inbounds [9 x [9 x i8]], ptr %box, i64 0, i64 %indvars.iv248, i64 %idxprom84 %13 = load i8, ptr %arrayidx85, align 1, !tbaa !9 %cmp87 = icmp eq i8 %13, 49 br i1 %cmp87, label %if.then89, label %for.body79.for.inc104_crit_edge for.body79.for.inc104_crit_edge: ; preds = %for.body79 %.pre282 = trunc i64 %indvars.iv248 to i32 br label %for.inc104 if.then89: ; preds = %for.body79 %inc90 = add nsw i32 %count.4236, 1 %idxprom93 = sext i32 %inc90 to i64 %arrayidx94 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %idxprom93 store i32 %12, ptr %arrayidx94, align 4, !tbaa !5 %arrayidx96 = getelementptr inbounds [100 x i32], ptr %y, i64 0, i64 %idxprom93 %14 = trunc i64 %indvars.iv248 to i32 store i32 %14, ptr %arrayidx96, align 4, !tbaa !5 %15 = load i32, ptr %arrayidx15, align 4, !tbaa !5 %idxprom101 = sext i32 %15 to i64 %arrayidx102 = getelementptr inbounds [9 x [9 x i8]], ptr %box, i64 0, i64 %indvars.iv248, i64 %idxprom101 store i8 48, ptr %arrayidx102, align 1, !tbaa !9 br label %for.inc104 for.inc104: ; preds = %for.body79.for.inc104_crit_edge, %if.then89 %.pre-phi = phi i32 [ %.pre282, %for.body79.for.inc104_crit_edge ], [ %14, %if.then89 ] %16 = phi i32 [ %12, %for.body79.for.inc104_crit_edge ], [ %15, %if.then89 ] %count.5 = phi i32 [ %count.4236, %for.body79.for.inc104_crit_edge ], [ %inc90, %if.then89 ] %indvars.iv.next249 = add nuw nsw i64 %indvars.iv248, 1 %cmp77.not.not = icmp slt i32 %.pre-phi, %end_y.0 br i1 %cmp77.not.not, label %for.body79, label %for.inc107, !llvm.loop !12 for.inc107: ; preds = %for.inc104, %for.cond76.preheader %count.4.lcssa = phi i32 [ %count.2.lcssa, %for.cond76.preheader ], [ %count.5, %for.inc104 ] %indvars.iv.next252 = add nuw nsw i64 %indvars.iv251, 1 %17 = sext i32 %count.4.lcssa to i64 %cmp12.not.not = icmp slt i64 %indvars.iv251, %17 br i1 %cmp12.not.not, label %for.body13, label %for.cond114.preheader, !llvm.loop !13 for.cond114.preheader: ; preds = %for.inc107, %for.inc145.7 %indvars.iv257 = phi i64 [ %indvars.iv.next258, %for.inc145.7 ], [ 0, %for.inc107 ] %arrayidx121 = getelementptr inbounds [9 x [9 x i8]], ptr %box, i64 0, i64 %indvars.iv257, i64 0 %18 = load i8, ptr %arrayidx121, align 1, !tbaa !9 switch i8 %18, label %for.inc145 [ i8 48, label %for.inc145.sink.split i8 49, label %if.then138 ] if.then138: ; preds = %for.cond114.preheader br label %for.inc145.sink.split for.inc145.sink.split: ; preds = %for.cond114.preheader, %if.then138 %.sink = phi i32 [ 1, %if.then138 ], [ 0, %for.cond114.preheader ] %arrayidx129 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 %indvars.iv257, i64 0 store i32 %.sink, ptr %arrayidx129, align 4, !tbaa !5 br label %for.inc145 for.inc145: ; preds = %for.inc145.sink.split, %for.cond114.preheader %arrayidx121.1 = getelementptr inbounds [9 x [9 x i8]], ptr %box, i64 0, i64 %indvars.iv257, i64 1 %19 = load i8, ptr %arrayidx121.1, align 1, !tbaa !9 switch i8 %19, label %for.inc145.1 [ i8 48, label %if.then125.1 i8 49, label %for.inc145.1.sink.split ] if.then125.1: ; preds = %for.inc145 br label %for.inc145.1.sink.split for.inc145.1.sink.split: ; preds = %for.inc145, %if.then125.1 %.sink285 = phi i32 [ 0, %if.then125.1 ], [ 1, %for.inc145 ] %arrayidx129.1 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 %indvars.iv257, i64 1 store i32 %.sink285, ptr %arrayidx129.1, align 4, !tbaa !5 br label %for.inc145.1 for.inc145.1: ; preds = %for.inc145.1.sink.split, %for.inc145 %arrayidx121.2 = getelementptr inbounds [9 x [9 x i8]], ptr %box, i64 0, i64 %indvars.iv257, i64 2 %20 = load i8, ptr %arrayidx121.2, align 1, !tbaa !9 switch i8 %20, label %for.inc145.2 [ i8 48, label %if.then125.2 i8 49, label %for.inc145.2.sink.split ] if.then125.2: ; preds = %for.inc145.1 br label %for.inc145.2.sink.split for.inc145.2.sink.split: ; preds = %for.inc145.1, %if.then125.2 %.sink286 = phi i32 [ 0, %if.then125.2 ], [ 1, %for.inc145.1 ] %arrayidx129.2 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 %indvars.iv257, i64 2 store i32 %.sink286, ptr %arrayidx129.2, align 4, !tbaa !5 br label %for.inc145.2 for.inc145.2: ; preds = %for.inc145.2.sink.split, %for.inc145.1 %arrayidx121.3 = getelementptr inbounds [9 x [9 x i8]], ptr %box, i64 0, i64 %indvars.iv257, i64 3 %21 = load i8, ptr %arrayidx121.3, align 1, !tbaa !9 switch i8 %21, label %for.inc145.3 [ i8 48, label %if.then125.3 i8 49, label %for.inc145.3.sink.split ] if.then125.3: ; preds = %for.inc145.2 br label %for.inc145.3.sink.split for.inc145.3.sink.split: ; preds = %for.inc145.2, %if.then125.3 %.sink287 = phi i32 [ 0, %if.then125.3 ], [ 1, %for.inc145.2 ] %arrayidx129.3 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 %indvars.iv257, i64 3 store i32 %.sink287, ptr %arrayidx129.3, align 4, !tbaa !5 br label %for.inc145.3 for.inc145.3: ; preds = %for.inc145.3.sink.split, %for.inc145.2 %arrayidx121.4 = getelementptr inbounds [9 x [9 x i8]], ptr %box, i64 0, i64 %indvars.iv257, i64 4 %22 = load i8, ptr %arrayidx121.4, align 1, !tbaa !9 switch i8 %22, label %for.inc145.4 [ i8 48, label %if.then125.4 i8 49, label %for.inc145.4.sink.split ] if.then125.4: ; preds = %for.inc145.3 br label %for.inc145.4.sink.split for.inc145.4.sink.split: ; preds = %for.inc145.3, %if.then125.4 %.sink288 = phi i32 [ 0, %if.then125.4 ], [ 1, %for.inc145.3 ] %arrayidx129.4 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 %indvars.iv257, i64 4 store i32 %.sink288, ptr %arrayidx129.4, align 4, !tbaa !5 br label %for.inc145.4 for.inc145.4: ; preds = %for.inc145.4.sink.split, %for.inc145.3 %arrayidx121.5 = getelementptr inbounds [9 x [9 x i8]], ptr %box, i64 0, i64 %indvars.iv257, i64 5 %23 = load i8, ptr %arrayidx121.5, align 1, !tbaa !9 switch i8 %23, label %for.inc145.5 [ i8 48, label %if.then125.5 i8 49, label %for.inc145.5.sink.split ] if.then125.5: ; preds = %for.inc145.4 br label %for.inc145.5.sink.split for.inc145.5.sink.split: ; preds = %for.inc145.4, %if.then125.5 %.sink289 = phi i32 [ 0, %if.then125.5 ], [ 1, %for.inc145.4 ] %arrayidx129.5 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 %indvars.iv257, i64 5 store i32 %.sink289, ptr %arrayidx129.5, align 4, !tbaa !5 br label %for.inc145.5 for.inc145.5: ; preds = %for.inc145.5.sink.split, %for.inc145.4 %arrayidx121.6 = getelementptr inbounds [9 x [9 x i8]], ptr %box, i64 0, i64 %indvars.iv257, i64 6 %24 = load i8, ptr %arrayidx121.6, align 1, !tbaa !9 switch i8 %24, label %for.inc145.6 [ i8 48, label %if.then125.6 i8 49, label %for.inc145.6.sink.split ] if.then125.6: ; preds = %for.inc145.5 br label %for.inc145.6.sink.split for.inc145.6.sink.split: ; preds = %for.inc145.5, %if.then125.6 %.sink290 = phi i32 [ 0, %if.then125.6 ], [ 1, %for.inc145.5 ] %arrayidx129.6 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 %indvars.iv257, i64 6 store i32 %.sink290, ptr %arrayidx129.6, align 4, !tbaa !5 br label %for.inc145.6 for.inc145.6: ; preds = %for.inc145.6.sink.split, %for.inc145.5 %arrayidx121.7 = getelementptr inbounds [9 x [9 x i8]], ptr %box, i64 0, i64 %indvars.iv257, i64 7 %25 = load i8, ptr %arrayidx121.7, align 1, !tbaa !9 switch i8 %25, label %for.inc145.7 [ i8 48, label %if.then125.7 i8 49, label %for.inc145.7.sink.split ] if.then125.7: ; preds = %for.inc145.6 br label %for.inc145.7.sink.split for.inc145.7.sink.split: ; preds = %for.inc145.6, %if.then125.7 %.sink291 = phi i32 [ 0, %if.then125.7 ], [ 1, %for.inc145.6 ] %arrayidx129.7 = getelementptr inbounds [9 x [9 x i32]], ptr %ans, i64 0, i64 %indvars.iv257, i64 7 store i32 %.sink291, ptr %arrayidx129.7, align 4, !tbaa !5 br label %for.inc145.7 for.inc145.7: ; preds = %for.inc145.7.sink.split, %for.inc145.6 %indvars.iv.next258 = add nuw nsw i64 %indvars.iv257, 1 %exitcond.not = icmp eq i64 %indvars.iv.next258, 8 br i1 %exitcond.not, label %for.end150, label %for.cond114.preheader, !llvm.loop !14 for.end150: ; preds = %for.inc145.7 %add151 = add nuw nsw i32 %l.0245, 1 %call152 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %add151) %26 = load i32, ptr %ans, align 16, !tbaa !5 %call165 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %26) %27 = load i32, ptr %arrayidx164.1, align 4, !tbaa !5 %call165.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %27) %28 = load i32, ptr %arrayidx164.2, align 8, !tbaa !5 %call165.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %28) %29 = load i32, ptr %arrayidx164.3, align 4, !tbaa !5 %call165.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %29) %30 = load i32, ptr %arrayidx164.4, align 16, !tbaa !5 %call165.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %30) %31 = load i32, ptr %arrayidx164.5, align 4, !tbaa !5 %call165.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %31) %32 = load i32, ptr %arrayidx164.6, align 8, !tbaa !5 %call165.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %32) %33 = load i32, ptr %arrayidx164.7, align 4, !tbaa !5 %call165.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %33) %putchar = call i32 @putchar(i32 10) %34 = load i32, ptr %arrayidx164.1268, align 4, !tbaa !5 %call165.1269 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %34) %35 = load i32, ptr %arrayidx164.1.1, align 8, !tbaa !5 %call165.1.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %35) %36 = load i32, ptr %arrayidx164.2.1, align 4, !tbaa !5 %call165.2.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %36) %37 = load i32, ptr %arrayidx164.3.1, align 16, !tbaa !5 %call165.3.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %37) %38 = load i32, ptr %arrayidx164.4.1, align 4, !tbaa !5 %call165.4.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %38) %39 = load i32, ptr %arrayidx164.5.1, align 8, !tbaa !5 %call165.5.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %39) %40 = load i32, ptr %arrayidx164.6.1, align 4, !tbaa !5 %call165.6.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %40) %41 = load i32, ptr %arrayidx164.7.1, align 16, !tbaa !5 %call165.7.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %41) %putchar.1 = call i32 @putchar(i32 10) %42 = load i32, ptr %arrayidx164.2270, align 8, !tbaa !5 %call165.2271 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %42) %43 = load i32, ptr %arrayidx164.1.2, align 4, !tbaa !5 %call165.1.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %43) %44 = load i32, ptr %arrayidx164.2.2, align 16, !tbaa !5 %call165.2.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %44) %45 = load i32, ptr %arrayidx164.3.2, align 4, !tbaa !5 %call165.3.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %45) %46 = load i32, ptr %arrayidx164.4.2, align 8, !tbaa !5 %call165.4.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %46) %47 = load i32, ptr %arrayidx164.5.2, align 4, !tbaa !5 %call165.5.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %47) %48 = load i32, ptr %arrayidx164.6.2, align 16, !tbaa !5 %call165.6.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %48) %49 = load i32, ptr %arrayidx164.7.2, align 4, !tbaa !5 %call165.7.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %49) %putchar.2 = call i32 @putchar(i32 10) %50 = load i32, ptr %arrayidx164.3272, align 4, !tbaa !5 %call165.3273 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %50) %51 = load i32, ptr %arrayidx164.1.3, align 16, !tbaa !5 %call165.1.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %51) %52 = load i32, ptr %arrayidx164.2.3, align 4, !tbaa !5 %call165.2.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %52) %53 = load i32, ptr %arrayidx164.3.3, align 8, !tbaa !5 %call165.3.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %53) %54 = load i32, ptr %arrayidx164.4.3, align 4, !tbaa !5 %call165.4.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %54) %55 = load i32, ptr %arrayidx164.5.3, align 16, !tbaa !5 %call165.5.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %55) %56 = load i32, ptr %arrayidx164.6.3, align 4, !tbaa !5 %call165.6.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %56) %57 = load i32, ptr %arrayidx164.7.3, align 8, !tbaa !5 %call165.7.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %57) %putchar.3 = call i32 @putchar(i32 10) %58 = load i32, ptr %arrayidx164.4274, align 16, !tbaa !5 %call165.4275 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %58) %59 = load i32, ptr %arrayidx164.1.4, align 4, !tbaa !5 %call165.1.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %59) %60 = load i32, ptr %arrayidx164.2.4, align 8, !tbaa !5 %call165.2.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %60) %61 = load i32, ptr %arrayidx164.3.4, align 4, !tbaa !5 %call165.3.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %61) %62 = load i32, ptr %arrayidx164.4.4, align 16, !tbaa !5 %call165.4.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %62) %63 = load i32, ptr %arrayidx164.5.4, align 4, !tbaa !5 %call165.5.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %63) %64 = load i32, ptr %arrayidx164.6.4, align 8, !tbaa !5 %call165.6.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %64) %65 = load i32, ptr %arrayidx164.7.4, align 4, !tbaa !5 %call165.7.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %65) %putchar.4 = call i32 @putchar(i32 10) %66 = load i32, ptr %arrayidx164.5276, align 4, !tbaa !5 %call165.5277 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %66) %67 = load i32, ptr %arrayidx164.1.5, align 8, !tbaa !5 %call165.1.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %67) %68 = load i32, ptr %arrayidx164.2.5, align 4, !tbaa !5 %call165.2.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %68) %69 = load i32, ptr %arrayidx164.3.5, align 16, !tbaa !5 %call165.3.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %69) %70 = load i32, ptr %arrayidx164.4.5, align 4, !tbaa !5 %call165.4.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %70) %71 = load i32, ptr %arrayidx164.5.5, align 8, !tbaa !5 %call165.5.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %71) %72 = load i32, ptr %arrayidx164.6.5, align 4, !tbaa !5 %call165.6.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %72) %73 = load i32, ptr %arrayidx164.7.5, align 16, !tbaa !5 %call165.7.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %73) %putchar.5 = call i32 @putchar(i32 10) %74 = load i32, ptr %arrayidx164.6278, align 8, !tbaa !5 %call165.6279 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %74) %75 = load i32, ptr %arrayidx164.1.6, align 4, !tbaa !5 %call165.1.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %75) %76 = load i32, ptr %arrayidx164.2.6, align 16, !tbaa !5 %call165.2.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %76) %77 = load i32, ptr %arrayidx164.3.6, align 4, !tbaa !5 %call165.3.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %77) %78 = load i32, ptr %arrayidx164.4.6, align 8, !tbaa !5 %call165.4.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %78) %79 = load i32, ptr %arrayidx164.5.6, align 4, !tbaa !5 %call165.5.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %79) %80 = load i32, ptr %arrayidx164.6.6, align 16, !tbaa !5 %call165.6.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %80) %81 = load i32, ptr %arrayidx164.7.6, align 4, !tbaa !5 %call165.7.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %81) %putchar.6 = call i32 @putchar(i32 10) %82 = load i32, ptr %arrayidx164.7280, align 4, !tbaa !5 %call165.7281 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %82) %83 = load i32, ptr %arrayidx164.1.7, align 16, !tbaa !5 %call165.1.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %83) %84 = load i32, ptr %arrayidx164.2.7, align 4, !tbaa !5 %call165.2.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %84) %85 = load i32, ptr %arrayidx164.3.7, align 8, !tbaa !5 %call165.3.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %85) %86 = load i32, ptr %arrayidx164.4.7, align 4, !tbaa !5 %call165.4.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %86) %87 = load i32, ptr %arrayidx164.5.7, align 16, !tbaa !5 %call165.5.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %87) %88 = load i32, ptr %arrayidx164.6.7, align 4, !tbaa !5 %call165.6.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %88) %89 = load i32, ptr %arrayidx164.7.7, align 8, !tbaa !5 %call165.7.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %89) %putchar.7 = call i32 @putchar(i32 10) %90 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %add151, %90 br i1 %cmp, label %for.cond1.preheader, label %for.end175, !llvm.loop !15 for.end175: ; preds = %for.end150, %entry call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %y) #5 call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %x) #5 call void @llvm.lifetime.end.p0(i64 324, ptr nonnull %ans) #5 call void @llvm.lifetime.end.p0(i64 81, ptr nonnull %box) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 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 ; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4 attributes #0 = { nofree 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) } 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 = { nofree nounwind } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"} !12 = distinct !{!12, !11} !13 = distinct !{!13, !11} !14 = distinct !{!14, !11} !15 = distinct !{!15, !11}
#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #include<stdio.h> #include<math.h> #include<string.h> #include<stdlib.h> #include<stdarg.h> #include<malloc.h> void bomb(int, int, int a[8][8]); int main() { int i, j, k, n, x, y, a[8][8], buf; scanf("%d", &n); for(i=1; i<=n; i++){ for(j=0; j<8; j++){ scanf("%d", &buf); for(k=0; k<8; k++){ if(buf % 10 == 0) a[j][7-k] = 0; else a[j][7-k] = 1; buf = buf / 10; } } scanf("%d%d", &x, &y); bomb(x-1, y-1, a); printf("Data %d:\n", i); for(j=0; j<8; j++){ for(k=0; k<8; k++){ printf("%d", a[j][k]); } printf("\n"); } } return 0; } void bomb(int x, int y, int a[8][8]) { int i; if((x<0 || x>7) || (y<0 || y>7) || a[y][x] == 0) return; else { a[y][x] = 0; for(i=x-3; i<=x+3; i++) bomb(i, y, a); for(i=y-3; i<=y+3; i++) bomb(x, i, a); } return; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_188075/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_188075/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1 @.str.2 = private unnamed_addr constant [10 x i8] c"Data %d:\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %x = alloca i32, align 4 %y = alloca i32, align 4 %a = alloca [8 x [8 x i32]], align 16 %buf = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #5 call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %a) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %buf) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp.not64 = icmp slt i32 %0, 1 br i1 %cmp.not64, label %for.end43, label %for.cond1.preheader.preheader for.cond1.preheader.preheader: ; preds = %entry %arrayidx32.790 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 7, i64 0 %arrayidx32.1 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 0, i64 1 %arrayidx32.2 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 0, i64 2 %arrayidx32.3 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 0, i64 3 %arrayidx32.4 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 0, i64 4 %arrayidx32.5 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 0, i64 5 %arrayidx32.6 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 0, i64 6 %arrayidx32.7 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 0, i64 7 %arrayidx32.178 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 1, i64 0 %arrayidx32.1.1 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 1, i64 1 %arrayidx32.2.1 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 1, i64 2 %arrayidx32.3.1 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 1, i64 3 %arrayidx32.4.1 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 1, i64 4 %arrayidx32.5.1 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 1, i64 5 %arrayidx32.6.1 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 1, i64 6 %arrayidx32.7.1 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 1, i64 7 %arrayidx32.280 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 2, i64 0 %arrayidx32.1.2 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 2, i64 1 %arrayidx32.2.2 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 2, i64 2 %arrayidx32.3.2 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 2, i64 3 %arrayidx32.4.2 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 2, i64 4 %arrayidx32.5.2 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 2, i64 5 %arrayidx32.6.2 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 2, i64 6 %arrayidx32.7.2 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 2, i64 7 %arrayidx32.382 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 3, i64 0 %arrayidx32.1.3 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 3, i64 1 %arrayidx32.2.3 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 3, i64 2 %arrayidx32.3.3 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 3, i64 3 %arrayidx32.4.3 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 3, i64 4 %arrayidx32.5.3 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 3, i64 5 %arrayidx32.6.3 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 3, i64 6 %arrayidx32.7.3 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 3, i64 7 %arrayidx32.484 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 4, i64 0 %arrayidx32.1.4 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 4, i64 1 %arrayidx32.2.4 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 4, i64 2 %arrayidx32.3.4 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 4, i64 3 %arrayidx32.4.4 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 4, i64 4 %arrayidx32.5.4 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 4, i64 5 %arrayidx32.6.4 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 4, i64 6 %arrayidx32.7.4 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 4, i64 7 %arrayidx32.586 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 5, i64 0 %arrayidx32.1.5 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 5, i64 1 %arrayidx32.2.5 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 5, i64 2 %arrayidx32.3.5 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 5, i64 3 %arrayidx32.4.5 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 5, i64 4 %arrayidx32.5.5 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 5, i64 5 %arrayidx32.6.5 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 5, i64 6 %arrayidx32.7.5 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 5, i64 7 %arrayidx32.688 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 6, i64 0 %arrayidx32.1.6 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 6, i64 1 %arrayidx32.2.6 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 6, i64 2 %arrayidx32.3.6 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 6, i64 3 %arrayidx32.4.6 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 6, i64 4 %arrayidx32.5.6 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 6, i64 5 %arrayidx32.6.6 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 6, i64 6 %arrayidx32.7.6 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 6, i64 7 %arrayidx32.1.7 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 7, i64 1 %arrayidx32.2.7 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 7, i64 2 %arrayidx32.3.7 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 7, i64 3 %arrayidx32.4.7 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 7, i64 4 %arrayidx32.5.7 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 7, i64 5 %arrayidx32.6.7 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 7, i64 6 %arrayidx32.7.7 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 7, i64 7 br label %for.cond1.preheader for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.end18 %i.065 = phi i32 [ %inc42, %for.end18 ], [ 1, %for.cond1.preheader.preheader ] br label %for.body3 for.body3: ; preds = %for.cond1.preheader, %for.body3 %indvars.iv = phi i64 [ 0, %for.cond1.preheader ], [ %indvars.iv.next, %for.body3 ] %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %buf) %buf.promoted = load i32, ptr %buf, align 4, !tbaa !5 %div = sdiv i32 %buf.promoted, 10 %div.1 = sdiv i32 %buf.promoted, 100 %div.2 = sdiv i32 %buf.promoted, 1000 %1 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 %indvars.iv, i64 4 %2 = insertelement <4 x i32> poison, i32 %div.2, i64 0 %3 = insertelement <4 x i32> %2, i32 %div.1, i64 1 %4 = insertelement <4 x i32> %3, i32 %div, i64 2 %5 = insertelement <4 x i32> %4, i32 %buf.promoted, i64 3 %6 = srem <4 x i32> %5, <i32 10, i32 10, i32 10, i32 10> %7 = icmp ne <4 x i32> %6, zeroinitializer %8 = zext <4 x i1> %7 to <4 x i32> store <4 x i32> %8, ptr %1, align 16 %div.3 = sdiv i32 %buf.promoted, 10000 %rem.4 = srem i32 %div.3, 10 %cmp8.4 = icmp ne i32 %rem.4, 0 %.sink95 = zext i1 %cmp8.4 to i32 %9 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 %indvars.iv, i64 3 store i32 %.sink95, ptr %9, align 4 %div.4 = sdiv i32 %buf.promoted, 100000 %rem.5.lhs.trunc = trunc i32 %div.4 to i16 %rem.599 = srem i16 %rem.5.lhs.trunc, 10 %cmp8.5 = icmp ne i16 %rem.599, 0 %.sink96 = zext i1 %cmp8.5 to i32 %10 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 %indvars.iv, i64 2 store i32 %.sink96, ptr %10, align 8 %div.5 = sdiv i32 %buf.promoted, 1000000 %rem.6.lhs.trunc = trunc i32 %div.5 to i16 %rem.6100 = srem i16 %rem.6.lhs.trunc, 10 %cmp8.6 = icmp ne i16 %rem.6100, 0 %.sink97 = zext i1 %cmp8.6 to i32 %11 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 %indvars.iv, i64 1 store i32 %.sink97, ptr %11, align 4 %div.6 = sdiv i32 %buf.promoted, 10000000 %rem.7.lhs.trunc = trunc i32 %div.6 to i16 %rem.7101 = srem i16 %rem.7.lhs.trunc, 10 %cmp8.7 = icmp ne i16 %rem.7101, 0 %.sink98 = zext i1 %cmp8.7 to i32 %12 = getelementptr inbounds [8 x [8 x i32]], ptr %a, i64 0, i64 %indvars.iv, i64 0 store i32 %.sink98, ptr %12, align 16 %div.7 = sdiv i32 %buf.promoted, 100000000 store i32 %div.7, ptr %buf, align 4, !tbaa !5 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, 8 br i1 %exitcond.not, label %for.end18, label %for.body3, !llvm.loop !9 for.end18: ; preds = %for.body3 %call19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x, ptr noundef nonnull %y) %13 = load i32, ptr %x, align 4, !tbaa !5 %sub20 = add nsw i32 %13, -1 %14 = load i32, ptr %y, align 4, !tbaa !5 %sub21 = add nsw i32 %14, -1 call void @bomb(i32 noundef %sub20, i32 noundef %sub21, ptr noundef nonnull %a) %call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %i.065) %15 = load i32, ptr %a, align 16, !tbaa !5 %call33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %15) %16 = load i32, ptr %arrayidx32.1, align 4, !tbaa !5 %call33.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %16) %17 = load i32, ptr %arrayidx32.2, align 8, !tbaa !5 %call33.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %17) %18 = load i32, ptr %arrayidx32.3, align 4, !tbaa !5 %call33.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %18) %19 = load i32, ptr %arrayidx32.4, align 16, !tbaa !5 %call33.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %19) %20 = load i32, ptr %arrayidx32.5, align 4, !tbaa !5 %call33.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %20) %21 = load i32, ptr %arrayidx32.6, align 8, !tbaa !5 %call33.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %21) %22 = load i32, ptr %arrayidx32.7, align 4, !tbaa !5 %call33.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %22) %putchar = call i32 @putchar(i32 10) %23 = load i32, ptr %arrayidx32.178, align 16, !tbaa !5 %call33.179 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %23) %24 = load i32, ptr %arrayidx32.1.1, align 4, !tbaa !5 %call33.1.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %24) %25 = load i32, ptr %arrayidx32.2.1, align 8, !tbaa !5 %call33.2.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %25) %26 = load i32, ptr %arrayidx32.3.1, align 4, !tbaa !5 %call33.3.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %26) %27 = load i32, ptr %arrayidx32.4.1, align 16, !tbaa !5 %call33.4.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %27) %28 = load i32, ptr %arrayidx32.5.1, align 4, !tbaa !5 %call33.5.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %28) %29 = load i32, ptr %arrayidx32.6.1, align 8, !tbaa !5 %call33.6.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %29) %30 = load i32, ptr %arrayidx32.7.1, align 4, !tbaa !5 %call33.7.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %30) %putchar.1 = call i32 @putchar(i32 10) %31 = load i32, ptr %arrayidx32.280, align 16, !tbaa !5 %call33.281 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %31) %32 = load i32, ptr %arrayidx32.1.2, align 4, !tbaa !5 %call33.1.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %32) %33 = load i32, ptr %arrayidx32.2.2, align 8, !tbaa !5 %call33.2.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %33) %34 = load i32, ptr %arrayidx32.3.2, align 4, !tbaa !5 %call33.3.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %34) %35 = load i32, ptr %arrayidx32.4.2, align 16, !tbaa !5 %call33.4.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %35) %36 = load i32, ptr %arrayidx32.5.2, align 4, !tbaa !5 %call33.5.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %36) %37 = load i32, ptr %arrayidx32.6.2, align 8, !tbaa !5 %call33.6.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %37) %38 = load i32, ptr %arrayidx32.7.2, align 4, !tbaa !5 %call33.7.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %38) %putchar.2 = call i32 @putchar(i32 10) %39 = load i32, ptr %arrayidx32.382, align 16, !tbaa !5 %call33.383 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %39) %40 = load i32, ptr %arrayidx32.1.3, align 4, !tbaa !5 %call33.1.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %40) %41 = load i32, ptr %arrayidx32.2.3, align 8, !tbaa !5 %call33.2.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %41) %42 = load i32, ptr %arrayidx32.3.3, align 4, !tbaa !5 %call33.3.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %42) %43 = load i32, ptr %arrayidx32.4.3, align 16, !tbaa !5 %call33.4.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %43) %44 = load i32, ptr %arrayidx32.5.3, align 4, !tbaa !5 %call33.5.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %44) %45 = load i32, ptr %arrayidx32.6.3, align 8, !tbaa !5 %call33.6.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %45) %46 = load i32, ptr %arrayidx32.7.3, align 4, !tbaa !5 %call33.7.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %46) %putchar.3 = call i32 @putchar(i32 10) %47 = load i32, ptr %arrayidx32.484, align 16, !tbaa !5 %call33.485 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %47) %48 = load i32, ptr %arrayidx32.1.4, align 4, !tbaa !5 %call33.1.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %48) %49 = load i32, ptr %arrayidx32.2.4, align 8, !tbaa !5 %call33.2.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %49) %50 = load i32, ptr %arrayidx32.3.4, align 4, !tbaa !5 %call33.3.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %50) %51 = load i32, ptr %arrayidx32.4.4, align 16, !tbaa !5 %call33.4.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %51) %52 = load i32, ptr %arrayidx32.5.4, align 4, !tbaa !5 %call33.5.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %52) %53 = load i32, ptr %arrayidx32.6.4, align 8, !tbaa !5 %call33.6.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %53) %54 = load i32, ptr %arrayidx32.7.4, align 4, !tbaa !5 %call33.7.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %54) %putchar.4 = call i32 @putchar(i32 10) %55 = load i32, ptr %arrayidx32.586, align 16, !tbaa !5 %call33.587 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %55) %56 = load i32, ptr %arrayidx32.1.5, align 4, !tbaa !5 %call33.1.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %56) %57 = load i32, ptr %arrayidx32.2.5, align 8, !tbaa !5 %call33.2.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %57) %58 = load i32, ptr %arrayidx32.3.5, align 4, !tbaa !5 %call33.3.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %58) %59 = load i32, ptr %arrayidx32.4.5, align 16, !tbaa !5 %call33.4.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %59) %60 = load i32, ptr %arrayidx32.5.5, align 4, !tbaa !5 %call33.5.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %60) %61 = load i32, ptr %arrayidx32.6.5, align 8, !tbaa !5 %call33.6.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %61) %62 = load i32, ptr %arrayidx32.7.5, align 4, !tbaa !5 %call33.7.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %62) %putchar.5 = call i32 @putchar(i32 10) %63 = load i32, ptr %arrayidx32.688, align 16, !tbaa !5 %call33.689 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %63) %64 = load i32, ptr %arrayidx32.1.6, align 4, !tbaa !5 %call33.1.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %64) %65 = load i32, ptr %arrayidx32.2.6, align 8, !tbaa !5 %call33.2.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %65) %66 = load i32, ptr %arrayidx32.3.6, align 4, !tbaa !5 %call33.3.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %66) %67 = load i32, ptr %arrayidx32.4.6, align 16, !tbaa !5 %call33.4.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %67) %68 = load i32, ptr %arrayidx32.5.6, align 4, !tbaa !5 %call33.5.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %68) %69 = load i32, ptr %arrayidx32.6.6, align 8, !tbaa !5 %call33.6.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %69) %70 = load i32, ptr %arrayidx32.7.6, align 4, !tbaa !5 %call33.7.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %70) %putchar.6 = call i32 @putchar(i32 10) %71 = load i32, ptr %arrayidx32.790, align 16, !tbaa !5 %call33.791 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %71) %72 = load i32, ptr %arrayidx32.1.7, align 4, !tbaa !5 %call33.1.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %72) %73 = load i32, ptr %arrayidx32.2.7, align 8, !tbaa !5 %call33.2.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %73) %74 = load i32, ptr %arrayidx32.3.7, align 4, !tbaa !5 %call33.3.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %74) %75 = load i32, ptr %arrayidx32.4.7, align 16, !tbaa !5 %call33.4.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %75) %76 = load i32, ptr %arrayidx32.5.7, align 4, !tbaa !5 %call33.5.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %76) %77 = load i32, ptr %arrayidx32.6.7, align 8, !tbaa !5 %call33.6.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %77) %78 = load i32, ptr %arrayidx32.7.7, align 4, !tbaa !5 %call33.7.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %78) %putchar.7 = call i32 @putchar(i32 10) %inc42 = add nuw nsw i32 %i.065, 1 %79 = load i32, ptr %n, align 4, !tbaa !5 %cmp.not.not = icmp slt i32 %i.065, %79 br i1 %cmp.not.not, label %for.cond1.preheader, label %for.end43, !llvm.loop !11 for.end43: ; preds = %for.end18, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %buf) #5 call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %a) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable define dso_local void @bomb(i32 noundef %x, i32 noundef %y, ptr noundef %a) local_unnamed_addr #3 { entry: br label %tailrecurse tailrecurse: ; preds = %cleanup.loopexit, %entry %y.tr = phi i32 [ %y, %entry ], [ %inc21.5, %cleanup.loopexit ] %0 = or i32 %y.tr, %x %or.cond24.not = icmp ult i32 %0, 8 br i1 %or.cond24.not, label %lor.lhs.false6, label %cleanup lor.lhs.false6: ; preds = %tailrecurse %idxprom = zext i32 %y.tr to i64 %idxprom7 = zext i32 %x to i64 %arrayidx8 = getelementptr inbounds [8 x i32], ptr %a, i64 %idxprom, i64 %idxprom7 %1 = load i32, ptr %arrayidx8, align 4, !tbaa !5 %cmp9 = icmp eq i32 %1, 0 br i1 %cmp9, label %cleanup, label %cleanup.loopexit cleanup.loopexit: ; preds = %lor.lhs.false6 store i32 0, ptr %arrayidx8, align 4, !tbaa !5 %sub = add nsw i32 %x, -3 tail call void @bomb(i32 noundef %sub, i32 noundef %y.tr, ptr noundef nonnull %a) %inc = add nsw i32 %x, -2 tail call void @bomb(i32 noundef %inc, i32 noundef %y.tr, ptr noundef nonnull %a) %inc.1 = add nsw i32 %x, -1 tail call void @bomb(i32 noundef %inc.1, i32 noundef %y.tr, ptr noundef nonnull %a) tail call void @bomb(i32 noundef %x, i32 noundef %y.tr, ptr noundef nonnull %a) %inc.3 = add nuw nsw i32 %x, 1 tail call void @bomb(i32 noundef %inc.3, i32 noundef %y.tr, ptr noundef nonnull %a) %inc.4 = add nuw nsw i32 %x, 2 tail call void @bomb(i32 noundef %inc.4, i32 noundef %y.tr, ptr noundef nonnull %a) %inc.5 = add nuw nsw i32 %x, 3 tail call void @bomb(i32 noundef %inc.5, i32 noundef %y.tr, ptr noundef nonnull %a) %sub15 = add nsw i32 %y.tr, -3 tail call void @bomb(i32 noundef %x, i32 noundef %sub15, ptr noundef nonnull %a) %inc21 = add nsw i32 %y.tr, -2 tail call void @bomb(i32 noundef %x, i32 noundef %inc21, ptr noundef nonnull %a) %inc21.1 = add nsw i32 %y.tr, -1 tail call void @bomb(i32 noundef %x, i32 noundef %inc21.1, ptr noundef nonnull %a) tail call void @bomb(i32 noundef %x, i32 noundef %y.tr, ptr noundef nonnull %a) %inc21.3 = add nuw nsw i32 %y.tr, 1 tail call void @bomb(i32 noundef %x, i32 noundef %inc21.3, ptr noundef nonnull %a) %inc21.4 = add nuw nsw i32 %y.tr, 2 tail call void @bomb(i32 noundef %x, i32 noundef %inc21.4, ptr noundef nonnull %a) %inc21.5 = add nuw nsw i32 %y.tr, 3 br label %tailrecurse cleanup: ; preds = %tailrecurse, %lor.lhs.false6 ret void } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4 attributes #0 = { nofree 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 = { 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 #3 = { nofree nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nofree nounwind } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10}
#include<stdio.h> enum { SSx, SWx, WSx, WWx, }; int inv(char c) { if(c=='S') return 'W'; return 'S'; } int solve(char *s, char *r, int n) { int i; for(i=1;i<n;i++) { if(s[i]=='o') { if(r[i]=='S') { r[i+1]=r[i-1]; } else { r[i+1]=inv(r[i-1]); } } else { if(r[i]=='S') { r[i+1]=inv(r[i-1]); } else { r[i+1]=r[i-1]; } } } if(r[0]!=r[n]) return 0; if(r[0]=='S') { if(s[0]=='o') return (r[n-1]==r[1]); else return (r[n-1]==inv(r[1])); } else { if(s[0]=='o') return (r[n-1]==inv(r[1])); else return (r[n-1]==r[1]); } } int main(void) { int N; static char s[100000+1]; static char r[100000+2]; while(scanf("%d%100000s", &N, s)==2) { r[N]='\0'; r[0]=r[1]='S'; if(solve(s, r, N)) { r[N]='\0'; printf("%s\n", r); continue; } r[0]='S'; r[1]='W'; if(solve(s, r, N)) { r[N]='\0'; printf("%s\n", r); continue; } r[0]='W'; r[1]='S'; if(solve(s, r, N)) { r[N]='\0'; printf("%s\n", r); continue; } r[0]='W'; r[1]='W'; if(solve(s, r, N)) { r[N]='\0'; printf("%s\n", r); continue; } printf("-1\n"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_188118/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_188118/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @main.s = internal global [100001 x i8] zeroinitializer, align 16 @main.r = internal global [100002 x i8] zeroinitializer, align 16 @.str = private unnamed_addr constant [11 x i8] c"%d%100000s\00", align 1 @str = private unnamed_addr constant [3 x i8] c"-1\00", align 1 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local i32 @inv(i8 noundef signext %c) local_unnamed_addr #0 { entry: %cmp = icmp eq i8 %c, 83 %. = select i1 %cmp, i32 87, i32 83 ret i32 %. } ; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable define dso_local i32 @solve(ptr nocapture noundef readonly %s, ptr nocapture noundef %r, i32 noundef %n) local_unnamed_addr #1 { entry: %cmp148 = icmp sgt i32 %n, 1 br i1 %cmp148, label %for.body.preheader, label %for.end for.body.preheader: ; preds = %entry %wide.trip.count = zext i32 %n to i64 %invariant.gep = getelementptr i8, ptr %r, i64 -1 %invariant.gep159 = getelementptr i8, ptr %r, i64 -1 %invariant.gep161 = getelementptr i8, ptr %r, i64 -1 %invariant.gep163 = getelementptr i8, ptr %r, i64 -1 %scevgep = getelementptr i8, ptr %r, i64 1 %load_initial = load i8, ptr %scevgep, align 1 br label %for.body for.body: ; preds = %for.body.preheader, %for.inc %store_forwarded = phi i8 [ %load_initial, %for.body.preheader ], [ %conv16.sink, %for.inc ] %indvars.iv = phi i64 [ 1, %for.body.preheader ], [ %5, %for.inc ] %arrayidx = getelementptr inbounds i8, ptr %s, i64 %indvars.iv %0 = load i8, ptr %arrayidx, align 1, !tbaa !5 %cmp1 = icmp eq i8 %0, 111 %cmp6 = icmp eq i8 %store_forwarded, 83 br i1 %cmp1, label %if.then, label %if.else20 if.then: ; preds = %for.body br i1 %cmp6, label %if.then8, label %if.else if.then8: ; preds = %if.then %gep164 = getelementptr i8, ptr %invariant.gep163, i64 %indvars.iv %1 = load i8, ptr %gep164, align 1, !tbaa !5 br label %for.inc if.else: ; preds = %if.then %gep162 = getelementptr i8, ptr %invariant.gep161, i64 %indvars.iv %2 = load i8, ptr %gep162, align 1, !tbaa !5 %cmp.i = icmp eq i8 %2, 83 %conv16 = select i1 %cmp.i, i8 87, i8 83 br label %for.inc if.else20: ; preds = %for.body br i1 %cmp6, label %if.then26, label %if.else35 if.then26: ; preds = %if.else20 %gep160 = getelementptr i8, ptr %invariant.gep159, i64 %indvars.iv %3 = load i8, ptr %gep160, align 1, !tbaa !5 %cmp.i142 = icmp eq i8 %3, 83 %conv31 = select i1 %cmp.i142, i8 87, i8 83 br label %for.inc if.else35: ; preds = %if.else20 %gep = getelementptr i8, ptr %invariant.gep, i64 %indvars.iv %4 = load i8, ptr %gep, align 1, !tbaa !5 br label %for.inc for.inc: ; preds = %if.else, %if.then8, %if.else35, %if.then26 %conv16.sink = phi i8 [ %conv16, %if.else ], [ %1, %if.then8 ], [ %4, %if.else35 ], [ %conv31, %if.then26 ] %5 = add nuw nsw i64 %indvars.iv, 1 %arrayidx19 = getelementptr inbounds i8, ptr %r, i64 %5 store i8 %conv16.sink, ptr %arrayidx19, align 1, !tbaa !5 %exitcond.not = icmp eq i64 %5, %wide.trip.count br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !8 for.end: ; preds = %for.inc, %entry %6 = load i8, ptr %r, align 1, !tbaa !5 %idxprom46 = sext i32 %n to i64 %arrayidx47 = getelementptr inbounds i8, ptr %r, i64 %idxprom46 %7 = load i8, ptr %arrayidx47, align 1, !tbaa !5 %cmp49.not = icmp eq i8 %6, %7 br i1 %cmp49.not, label %if.end52, label %cleanup if.end52: ; preds = %for.end %cmp55 = icmp eq i8 %6, 83 %8 = load i8, ptr %s, align 1, !tbaa !5 %cmp60 = icmp eq i8 %8, 111 %sub63 = add nsw i32 %n, -1 %idxprom64 = sext i32 %sub63 to i64 %arrayidx65 = getelementptr inbounds i8, ptr %r, i64 %idxprom64 %9 = load i8, ptr %arrayidx65, align 1, !tbaa !5 br i1 %cmp55, label %if.then57, label %if.else80 if.then57: ; preds = %if.end52 br i1 %cmp60, label %if.then62, label %if.else71 if.then62: ; preds = %if.then57 %arrayidx67 = getelementptr inbounds i8, ptr %r, i64 1 %10 = load i8, ptr %arrayidx67, align 1, !tbaa !5 %cmp69 = icmp eq i8 %9, %10 br label %cleanup if.else71: ; preds = %if.then57 %conv75 = sext i8 %9 to i32 %arrayidx76 = getelementptr inbounds i8, ptr %r, i64 1 %11 = load i8, ptr %arrayidx76, align 1, !tbaa !5 %cmp.i144 = icmp eq i8 %11, 83 %..i145 = select i1 %cmp.i144, i32 87, i32 83 %cmp78 = icmp eq i32 %..i145, %conv75 br label %cleanup if.else80: ; preds = %if.end52 br i1 %cmp60, label %if.then85, label %if.else94 if.then85: ; preds = %if.else80 %conv89 = sext i8 %9 to i32 %arrayidx90 = getelementptr inbounds i8, ptr %r, i64 1 %12 = load i8, ptr %arrayidx90, align 1, !tbaa !5 %cmp.i146 = icmp eq i8 %12, 83 %..i147 = select i1 %cmp.i146, i32 87, i32 83 %cmp92 = icmp eq i32 %..i147, %conv89 br label %cleanup if.else94: ; preds = %if.else80 %arrayidx99 = getelementptr inbounds i8, ptr %r, i64 1 %13 = load i8, ptr %arrayidx99, align 1, !tbaa !5 %cmp101 = icmp eq i8 %9, %13 br label %cleanup cleanup: ; preds = %for.end, %if.else94, %if.then85, %if.else71, %if.then62 %retval.0.shrunk = phi i1 [ %cmp69, %if.then62 ], [ %cmp78, %if.else71 ], [ %cmp92, %if.then85 ], [ %cmp101, %if.else94 ], [ false, %for.end ] %retval.0 = zext i1 %retval.0.shrunk to i32 ret i32 %retval.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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #3 { entry: %N = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #6 %call211 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull @main.s) %cmp212 = icmp eq i32 %call211, 2 br i1 %cmp212, label %while.body, label %while.end while.body: ; preds = %entry, %while.cond.backedge %0 = load i32, ptr %N, align 4, !tbaa !10 %idxprom = sext i32 %0 to i64 %arrayidx = getelementptr inbounds [100002 x i8], ptr @main.r, i64 0, i64 %idxprom store i8 0, ptr %arrayidx, align 1, !tbaa !5 store i8 83, ptr getelementptr inbounds ([100002 x i8], ptr @main.r, i64 0, i64 1), align 1, !tbaa !5 store i8 83, ptr @main.r, align 16, !tbaa !5 %cmp148.i = icmp sgt i32 %0, 1 br i1 %cmp148.i, label %for.body.preheader.i, label %for.end.i for.body.preheader.i: ; preds = %while.body %wide.trip.count.i = zext i32 %0 to i64 br label %for.body.i for.body.i: ; preds = %for.inc.i, %for.body.preheader.i %1 = phi i8 [ 83, %for.body.preheader.i ], [ %conv16.sink.i, %for.inc.i ] %indvars.iv.i = phi i64 [ 1, %for.body.preheader.i ], [ %4, %for.inc.i ] %arrayidx.i = getelementptr inbounds i8, ptr @main.s, i64 %indvars.iv.i %2 = load i8, ptr %arrayidx.i, align 1, !tbaa !5 %cmp1.i = icmp eq i8 %2, 111 %cmp6.i = icmp eq i8 %1, 83 %gep164.i = getelementptr i8, ptr getelementptr ([100002 x i8], ptr @main.r, i64 -1, i64 100001), i64 %indvars.iv.i %3 = load i8, ptr %gep164.i, align 1, !tbaa !5 br i1 %cmp1.i, label %if.then.i, label %if.else20.i if.then.i: ; preds = %for.body.i br i1 %cmp6.i, label %for.inc.i, label %if.else.i if.else.i: ; preds = %if.then.i %cmp.i.i = icmp eq i8 %3, 83 %conv16.i = select i1 %cmp.i.i, i8 87, i8 83 br label %for.inc.i if.else20.i: ; preds = %for.body.i br i1 %cmp6.i, label %if.then26.i, label %for.inc.i if.then26.i: ; preds = %if.else20.i %cmp.i142.i = icmp eq i8 %3, 83 %conv31.i = select i1 %cmp.i142.i, i8 87, i8 83 br label %for.inc.i for.inc.i: ; preds = %if.else20.i, %if.then.i, %if.then26.i, %if.else.i %conv16.sink.i = phi i8 [ %conv16.i, %if.else.i ], [ %conv31.i, %if.then26.i ], [ %3, %if.then.i ], [ %3, %if.else20.i ] %4 = add nuw nsw i64 %indvars.iv.i, 1 %arrayidx19.i = getelementptr inbounds i8, ptr @main.r, i64 %4 store i8 %conv16.sink.i, ptr %arrayidx19.i, align 1, !tbaa !5 %exitcond.not.i = icmp eq i64 %4, %wide.trip.count.i br i1 %exitcond.not.i, label %for.end.i, label %for.body.i, !llvm.loop !8 for.end.i: ; preds = %for.inc.i, %while.body %5 = load i8, ptr %arrayidx, align 1, !tbaa !5 %cmp49.not.i = icmp eq i8 %5, 83 br i1 %cmp49.not.i, label %if.then57.i, label %if.end if.then57.i: ; preds = %for.end.i %6 = load i8, ptr @main.s, align 16, !tbaa !5 %cmp60.i = icmp eq i8 %6, 111 %sub63.i = add nsw i32 %0, -1 %idxprom64.i = sext i32 %sub63.i to i64 %arrayidx65.i = getelementptr inbounds i8, ptr @main.r, i64 %idxprom64.i %7 = load i8, ptr %arrayidx65.i, align 1, !tbaa !5 %retval.0.shrunk.i.v = select i1 %cmp60.i, i8 83, i8 87 %retval.0.shrunk.i.not = icmp eq i8 %7, %retval.0.shrunk.i.v br i1 %retval.0.shrunk.i.not, label %while.cond.backedge.sink.split, label %if.end while.cond.backedge.sink.split: ; preds = %if.then57.i, %if.else80.i156, %if.else80.i100, %if.then57.i52 store i8 0, ptr %arrayidx, align 1, !tbaa !5 br label %while.cond.backedge while.cond.backedge: ; preds = %while.cond.backedge.sink.split, %if.else80.i156, %for.end.i144 %main.r.sink = phi ptr [ @str, %for.end.i144 ], [ @str, %if.else80.i156 ], [ @main.r, %while.cond.backedge.sink.split ] %puts30 = call i32 @puts(ptr nonnull dereferenceable(1) %main.r.sink) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull @main.s) %cmp = icmp eq i32 %call, 2 br i1 %cmp, label %while.body, label %while.end, !llvm.loop !12 if.end: ; preds = %for.end.i, %if.then57.i store i8 83, ptr @main.r, align 16, !tbaa !5 store i8 87, ptr getelementptr inbounds ([100002 x i8], ptr @main.r, i64 0, i64 1), align 1, !tbaa !5 br i1 %cmp148.i, label %for.body.preheader.i60, label %for.end.i32 for.body.preheader.i60: ; preds = %if.end %wide.trip.count.i61 = zext i32 %0 to i64 br label %for.body.i62 for.body.i62: ; preds = %for.inc.i71, %for.body.preheader.i60 %8 = phi i8 [ 87, %for.body.preheader.i60 ], [ %conv16.sink.i72, %for.inc.i71 ] %indvars.iv.i63 = phi i64 [ 1, %for.body.preheader.i60 ], [ %11, %for.inc.i71 ] %arrayidx.i64 = getelementptr inbounds i8, ptr @main.s, i64 %indvars.iv.i63 %9 = load i8, ptr %arrayidx.i64, align 1, !tbaa !5 %cmp1.i65 = icmp eq i8 %9, 111 %cmp6.i67 = icmp eq i8 %8, 83 %gep164.i85 = getelementptr i8, ptr getelementptr ([100002 x i8], ptr @main.r, i64 -1, i64 100001), i64 %indvars.iv.i63 %10 = load i8, ptr %gep164.i85, align 1, !tbaa !5 br i1 %cmp1.i65, label %if.then.i79, label %if.else20.i68 if.then.i79: ; preds = %for.body.i62 br i1 %cmp6.i67, label %for.inc.i71, label %if.else.i80 if.else.i80: ; preds = %if.then.i79 %cmp.i.i82 = icmp eq i8 %10, 83 %conv16.i83 = select i1 %cmp.i.i82, i8 87, i8 83 br label %for.inc.i71 if.else20.i68: ; preds = %for.body.i62 br i1 %cmp6.i67, label %if.then26.i75, label %for.inc.i71 if.then26.i75: ; preds = %if.else20.i68 %cmp.i142.i77 = icmp eq i8 %10, 83 %conv31.i78 = select i1 %cmp.i142.i77, i8 87, i8 83 br label %for.inc.i71 for.inc.i71: ; preds = %if.else20.i68, %if.then.i79, %if.then26.i75, %if.else.i80 %conv16.sink.i72 = phi i8 [ %conv16.i83, %if.else.i80 ], [ %conv31.i78, %if.then26.i75 ], [ %10, %if.then.i79 ], [ %10, %if.else20.i68 ] %11 = add nuw nsw i64 %indvars.iv.i63, 1 %arrayidx19.i73 = getelementptr inbounds i8, ptr @main.r, i64 %11 store i8 %conv16.sink.i72, ptr %arrayidx19.i73, align 1, !tbaa !5 %exitcond.not.i74 = icmp eq i64 %11, %wide.trip.count.i61 br i1 %exitcond.not.i74, label %for.end.i32, label %for.body.i62, !llvm.loop !8 for.end.i32: ; preds = %for.inc.i71, %if.end %12 = load i8, ptr %arrayidx, align 1, !tbaa !5 %cmp49.not.i35 = icmp eq i8 %12, 83 br i1 %cmp49.not.i35, label %if.then57.i52, label %if.end11 if.then57.i52: ; preds = %for.end.i32 %13 = load i8, ptr @main.s, align 16, !tbaa !5 %cmp60.i40 = icmp eq i8 %13, 111 %sub63.i41 = add nsw i32 %0, -1 %idxprom64.i42 = sext i32 %sub63.i41 to i64 %arrayidx65.i43 = getelementptr inbounds i8, ptr @main.r, i64 %idxprom64.i42 %14 = load i8, ptr %arrayidx65.i43, align 1, !tbaa !5 %retval.0.shrunk.i36.v = select i1 %cmp60.i40, i8 87, i8 83 %retval.0.shrunk.i36.not = icmp eq i8 %14, %retval.0.shrunk.i36.v br i1 %retval.0.shrunk.i36.not, label %while.cond.backedge.sink.split, label %if.end11 if.end11: ; preds = %for.end.i32, %if.then57.i52 store i8 87, ptr @main.r, align 16, !tbaa !5 store i8 83, ptr getelementptr inbounds ([100002 x i8], ptr @main.r, i64 0, i64 1), align 1, !tbaa !5 br i1 %cmp148.i, label %for.body.preheader.i116, label %for.end.i88 for.body.preheader.i116: ; preds = %if.end11 %wide.trip.count.i117 = zext i32 %0 to i64 br label %for.body.i118 for.body.i118: ; preds = %for.inc.i127, %for.body.preheader.i116 %15 = phi i8 [ 83, %for.body.preheader.i116 ], [ %conv16.sink.i128, %for.inc.i127 ] %indvars.iv.i119 = phi i64 [ 1, %for.body.preheader.i116 ], [ %18, %for.inc.i127 ] %arrayidx.i120 = getelementptr inbounds i8, ptr @main.s, i64 %indvars.iv.i119 %16 = load i8, ptr %arrayidx.i120, align 1, !tbaa !5 %cmp1.i121 = icmp eq i8 %16, 111 %cmp6.i123 = icmp eq i8 %15, 83 %gep164.i141 = getelementptr i8, ptr getelementptr ([100002 x i8], ptr @main.r, i64 -1, i64 100001), i64 %indvars.iv.i119 %17 = load i8, ptr %gep164.i141, align 1, !tbaa !5 br i1 %cmp1.i121, label %if.then.i135, label %if.else20.i124 if.then.i135: ; preds = %for.body.i118 br i1 %cmp6.i123, label %for.inc.i127, label %if.else.i136 if.else.i136: ; preds = %if.then.i135 %cmp.i.i138 = icmp eq i8 %17, 83 %conv16.i139 = select i1 %cmp.i.i138, i8 87, i8 83 br label %for.inc.i127 if.else20.i124: ; preds = %for.body.i118 br i1 %cmp6.i123, label %if.then26.i131, label %for.inc.i127 if.then26.i131: ; preds = %if.else20.i124 %cmp.i142.i133 = icmp eq i8 %17, 83 %conv31.i134 = select i1 %cmp.i142.i133, i8 87, i8 83 br label %for.inc.i127 for.inc.i127: ; preds = %if.else20.i124, %if.then.i135, %if.then26.i131, %if.else.i136 %conv16.sink.i128 = phi i8 [ %conv16.i139, %if.else.i136 ], [ %conv31.i134, %if.then26.i131 ], [ %17, %if.then.i135 ], [ %17, %if.else20.i124 ] %18 = add nuw nsw i64 %indvars.iv.i119, 1 %arrayidx19.i129 = getelementptr inbounds i8, ptr @main.r, i64 %18 store i8 %conv16.sink.i128, ptr %arrayidx19.i129, align 1, !tbaa !5 %exitcond.not.i130 = icmp eq i64 %18, %wide.trip.count.i117 br i1 %exitcond.not.i130, label %for.end.i88, label %for.body.i118, !llvm.loop !8 for.end.i88: ; preds = %for.inc.i127, %if.end11 %19 = load i8, ptr %arrayidx, align 1, !tbaa !5 %cmp49.not.i91 = icmp eq i8 %19, 87 br i1 %cmp49.not.i91, label %if.else80.i100, label %if.end18 if.else80.i100: ; preds = %for.end.i88 %20 = load i8, ptr @main.s, align 16, !tbaa !5 %cmp60.i96 = icmp eq i8 %20, 111 %sub63.i97 = add nsw i32 %0, -1 %idxprom64.i98 = sext i32 %sub63.i97 to i64 %arrayidx65.i99 = getelementptr inbounds i8, ptr @main.r, i64 %idxprom64.i98 %21 = load i8, ptr %arrayidx65.i99, align 1, !tbaa !5 %retval.0.shrunk.i92.v = select i1 %cmp60.i96, i8 87, i8 83 %retval.0.shrunk.i92.not = icmp eq i8 %21, %retval.0.shrunk.i92.v br i1 %retval.0.shrunk.i92.not, label %while.cond.backedge.sink.split, label %if.end18 if.end18: ; preds = %for.end.i88, %if.else80.i100 store i8 87, ptr @main.r, align 16, !tbaa !5 store i8 87, ptr getelementptr inbounds ([100002 x i8], ptr @main.r, i64 0, i64 1), align 1, !tbaa !5 br i1 %cmp148.i, label %for.body.preheader.i172, label %for.end.i144 for.body.preheader.i172: ; preds = %if.end18 %wide.trip.count.i173 = zext i32 %0 to i64 br label %for.body.i174 for.body.i174: ; preds = %for.inc.i183, %for.body.preheader.i172 %22 = phi i8 [ 87, %for.body.preheader.i172 ], [ %conv16.sink.i184, %for.inc.i183 ] %indvars.iv.i175 = phi i64 [ 1, %for.body.preheader.i172 ], [ %25, %for.inc.i183 ] %arrayidx.i176 = getelementptr inbounds i8, ptr @main.s, i64 %indvars.iv.i175 %23 = load i8, ptr %arrayidx.i176, align 1, !tbaa !5 %cmp1.i177 = icmp eq i8 %23, 111 %cmp6.i179 = icmp eq i8 %22, 83 %gep164.i197 = getelementptr i8, ptr getelementptr ([100002 x i8], ptr @main.r, i64 -1, i64 100001), i64 %indvars.iv.i175 %24 = load i8, ptr %gep164.i197, align 1, !tbaa !5 br i1 %cmp1.i177, label %if.then.i191, label %if.else20.i180 if.then.i191: ; preds = %for.body.i174 br i1 %cmp6.i179, label %for.inc.i183, label %if.else.i192 if.else.i192: ; preds = %if.then.i191 %cmp.i.i194 = icmp eq i8 %24, 83 %conv16.i195 = select i1 %cmp.i.i194, i8 87, i8 83 br label %for.inc.i183 if.else20.i180: ; preds = %for.body.i174 br i1 %cmp6.i179, label %if.then26.i187, label %for.inc.i183 if.then26.i187: ; preds = %if.else20.i180 %cmp.i142.i189 = icmp eq i8 %24, 83 %conv31.i190 = select i1 %cmp.i142.i189, i8 87, i8 83 br label %for.inc.i183 for.inc.i183: ; preds = %if.else20.i180, %if.then.i191, %if.then26.i187, %if.else.i192 %conv16.sink.i184 = phi i8 [ %conv16.i195, %if.else.i192 ], [ %conv31.i190, %if.then26.i187 ], [ %24, %if.then.i191 ], [ %24, %if.else20.i180 ] %25 = add nuw nsw i64 %indvars.iv.i175, 1 %arrayidx19.i185 = getelementptr inbounds i8, ptr @main.r, i64 %25 store i8 %conv16.sink.i184, ptr %arrayidx19.i185, align 1, !tbaa !5 %exitcond.not.i186 = icmp eq i64 %25, %wide.trip.count.i173 br i1 %exitcond.not.i186, label %for.end.i144, label %for.body.i174, !llvm.loop !8 for.end.i144: ; preds = %for.inc.i183, %if.end18 %26 = load i8, ptr %arrayidx, align 1, !tbaa !5 %cmp49.not.i147 = icmp eq i8 %26, 87 br i1 %cmp49.not.i147, label %if.else80.i156, label %while.cond.backedge if.else80.i156: ; preds = %for.end.i144 %27 = load i8, ptr @main.s, align 16, !tbaa !5 %cmp60.i152 = icmp eq i8 %27, 111 %sub63.i153 = add nsw i32 %0, -1 %idxprom64.i154 = sext i32 %sub63.i153 to i64 %arrayidx65.i155 = getelementptr inbounds i8, ptr @main.r, i64 %idxprom64.i154 %28 = load i8, ptr %arrayidx65.i155, align 1, !tbaa !5 %retval.0.shrunk.i148.v = select i1 %cmp60.i152, i8 83, i8 87 %retval.0.shrunk.i148.not = icmp eq i8 %28, %retval.0.shrunk.i148.v br i1 %retval.0.shrunk.i148.not, label %while.cond.backedge.sink.split, label %while.cond.backedge while.end: ; preds = %while.cond.backedge, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #6 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5 attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) 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 norecurse nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { 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 #5 = { nofree nounwind } attributes #6 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"omnipotent char", !7, i64 0} !7 = !{!"Simple C/C++ TBAA"} !8 = distinct !{!8, !9} !9 = !{!"llvm.loop.mustprogress"} !10 = !{!11, !11, i64 0} !11 = !{!"int", !6, i64 0} !12 = distinct !{!12, !9}
#include<stdio.h> int main() { int n,t,c,j,a=10000; scanf("%d%d",&n,&t); while(n--){ scanf("%d%d",&c,&j); if((j<=t)&&(c<a)) a=c; } if(a==10000){ printf("TLE\n"); return 0; } printf("%d",a); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_188161/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_188161/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1 @.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @str = private unnamed_addr constant [4 x i8] c"TLE\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %t = alloca i32, align 4 %c = alloca i32, align 4 %j = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %j) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %t) %0 = load i32, ptr %n, align 4, !tbaa !5 %dec14 = add nsw i32 %0, -1 store i32 %dec14, ptr %n, align 4, !tbaa !5 %tobool.not15 = icmp eq i32 %0, 0 br i1 %tobool.not15, label %if.then4, label %while.body while.body: ; preds = %entry, %while.body %a.016 = phi i32 [ %a.1, %while.body ], [ 10000, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c, ptr noundef nonnull %j) %1 = load i32, ptr %j, align 4, !tbaa !5 %2 = load i32, ptr %t, align 4, !tbaa !5 %cmp.not = icmp sgt i32 %1, %2 %3 = load i32, ptr %c, align 4 %spec.select = call i32 @llvm.smin.i32(i32 %3, i32 %a.016) %a.1 = select i1 %cmp.not, i32 %a.016, i32 %spec.select %4 = load i32, ptr %n, align 4, !tbaa !5 %dec = add nsw i32 %4, -1 store i32 %dec, ptr %n, align 4, !tbaa !5 %tobool.not = icmp eq i32 %4, 0 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9 while.end: ; preds = %while.body %cmp3 = icmp eq i32 %a.1, 10000 br i1 %cmp3, label %if.then4, label %if.end6 if.then4: ; preds = %entry, %while.end %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) br label %cleanup if.end6: ; preds = %while.end %call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %a.1) br label %cleanup cleanup: ; preds = %if.end6, %if.then4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %j) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #4 attributes #0 = { nofree 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 = { 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 #3 = { nofree nounwind } attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"}
#include<stdio.h> int main(void) { int n,r,c,t,min=1001,i; scanf("%d %d", &n, &r); for(i=0; i<n; i++) { scanf("%d %d", &c, &t); if(t<=r&&min>c) min=c; } if(min<1001) printf("%d\n", min); else printf("TLE\n"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_188204/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_188204/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 @str = private unnamed_addr constant [4 x i8] c"TLE\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %r = alloca i32, align 4 %c = alloca i32, align 4 %t = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %r) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp12 = icmp sgt i32 %0, 0 br i1 %cmp12, label %for.body, label %if.else for.body: ; preds = %entry, %for.body %i.014 = phi i32 [ %inc, %for.body ], [ 0, %entry ] %min.013 = phi i32 [ %min.1, %for.body ], [ 1001, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c, ptr noundef nonnull %t) %1 = load i32, ptr %t, align 4, !tbaa !5 %2 = load i32, ptr %r, align 4, !tbaa !5 %cmp2.not = icmp sgt i32 %1, %2 %3 = load i32, ptr %c, align 4 %spec.select = call i32 @llvm.smin.i32(i32 %min.013, i32 %3) %min.1 = select i1 %cmp2.not, i32 %min.013, i32 %spec.select %inc = add nuw nsw i32 %i.014, 1 %4 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc, %4 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body %cmp4 = icmp slt i32 %min.1, 1001 br i1 %cmp4, label %if.then5, label %if.else if.then5: ; preds = %for.end %call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %min.1) br label %if.end8 if.else: ; preds = %entry, %for.end %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) br label %if.end8 if.end8: ; preds = %if.else, %if.then5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #4 attributes #0 = { nofree 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 = { 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 #3 = { nofree nounwind } attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"}