Source_Code
stringlengths
69
484k
IR_Original
stringlengths
2.05k
17.9M
#include<stdio.h> int main(){ int i, j, a[3], c; for (i = 0; i < 3; i++){ scanf("%d", &a[i]); } for (i = 0; i < 3; i++){ for (j = i; j < 3; j++){ if(a[i] > a[j]){ c = a[i]; a[i] = a[j]; a[j] = c; } } } printf("%d\n", a[0] + a[1]); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_170708/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_170708/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 { for.inc20: %a = alloca [3 x i32], align 4 call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %a) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a) %arrayidx.1 = getelementptr inbounds [3 x i32], ptr %a, i64 0, i64 1 %call.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.1) %arrayidx.2 = getelementptr inbounds [3 x i32], ptr %a, i64 0, i64 2 %call.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.2) %0 = load i32, ptr %a, align 4, !tbaa !5 %1 = load i32, ptr %arrayidx.1, align 4, !tbaa !5 %cmp11.152 = icmp sgt i32 %0, %1 br i1 %cmp11.152, label %if.then.154, label %for.inc20.155 if.then.154: ; preds = %for.inc20 store i32 %1, ptr %a, align 4, !tbaa !5 store i32 %0, ptr %arrayidx.1, align 4, !tbaa !5 br label %for.inc20.155 for.inc20.155: ; preds = %if.then.154, %for.inc20 %2 = phi i32 [ %0, %if.then.154 ], [ %1, %for.inc20 ] %3 = phi i32 [ %1, %if.then.154 ], [ %0, %for.inc20 ] %4 = load i32, ptr %arrayidx.2, align 4, !tbaa !5 %cmp11.257 = icmp sgt i32 %3, %4 br i1 %cmp11.257, label %if.then.259, label %for.inc20.1 if.then.259: ; preds = %for.inc20.155 store i32 %4, ptr %a, align 4, !tbaa !5 store i32 %3, ptr %arrayidx.2, align 4, !tbaa !5 br label %for.inc20.1 for.inc20.1: ; preds = %for.inc20.155, %if.then.259 %5 = phi i32 [ %4, %if.then.259 ], [ %3, %for.inc20.155 ] %6 = phi i32 [ %3, %if.then.259 ], [ %4, %for.inc20.155 ] %cmp11.1.1 = icmp sgt i32 %2, %6 br i1 %cmp11.1.1, label %if.then.1.1, label %for.inc20.2 if.then.1.1: ; preds = %for.inc20.1 store i32 %6, ptr %arrayidx.1, align 4, !tbaa !5 store i32 %2, ptr %arrayidx.2, align 4, !tbaa !5 br label %for.inc20.2 for.inc20.2: ; preds = %for.inc20.1, %if.then.1.1 %7 = phi i32 [ %6, %if.then.1.1 ], [ %2, %for.inc20.1 ] %add = add nsw i32 %7, %5 %call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add) call void @llvm.lifetime.end.p0(i64 12, 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, c, ab, ac, bc, ans; scanf("%d %d %d", &a, &b, &c); ab = a + b; ac = a + c; bc = b + c; if(ab <= ac){ ans = ab; }else{ ans = ac; } if(bc <= ans){ ans = bc; } printf("%d\n", ans); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_170751/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_170751/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: 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 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 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c) %0 = load i32, ptr %a, align 4, !tbaa !5 %1 = load i32, ptr %b, align 4, !tbaa !5 %2 = load i32, ptr %c, align 4, !tbaa !5 %add2 = add nsw i32 %2, %1 %. = call i32 @llvm.smin.i32(i32 %1, i32 %2) %ans.0 = add nsw i32 %., %0 %ans.1 = call i32 @llvm.smin.i32(i32 %add2, i32 %ans.0) %call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.1) 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 i32 @llvm.smin.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"}
#include <stdio.h> int main(void){ int a, b, c, min; scanf("%d %d %d", &a, &b, &c); if(a < 1 || 10000 < a || b < 1 || 10000 < b || c < 1 || 10000 < c){ return 1; } min = 0; min = a+b; if(a+c < min){ min = a+c; } if(b+c < min){ min = b+c; } printf("%d\n", min); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_170795/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_170795/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: 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 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 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c) %0 = load i32, ptr %a, align 4 %1 = add i32 %0, -10001 %or.cond = icmp ult i32 %1, -10000 %2 = load i32, ptr %b, align 4 %cmp3 = icmp slt i32 %2, 1 %or.cond24 = select i1 %or.cond, i1 true, i1 %cmp3 %cmp5 = icmp sgt i32 %2, 10000 %or.cond25 = select i1 %or.cond24, i1 true, i1 %cmp5 %3 = load i32, ptr %c, align 4 %cmp7 = icmp slt i32 %3, 1 %or.cond26 = select i1 %or.cond25, i1 true, i1 %cmp7 %cmp9 = icmp sgt i32 %3, 10000 %or.cond27 = select i1 %or.cond26, i1 true, i1 %cmp9 br i1 %or.cond27, label %cleanup, label %if.end if.end: ; preds = %entry %spec.select = call i32 @llvm.umin.i32(i32 %3, i32 %2) %min.0 = add nuw nsw i32 %spec.select, %0 %add15 = add nuw nsw i32 %3, %2 %min.1 = call i32 @llvm.umin.i32(i32 %add15, i32 %min.0) %call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %min.1) br label %cleanup cleanup: ; preds = %entry, %if.end %retval.0 = phi i32 [ 0, %if.end ], [ 1, %entry ] 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 %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: 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 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)"}
#include <stdio.h> int main(){ int a,b,c,d,e,f,tmp; //printf("2つのベルを買うときの最安値を出力せよ。\n"); scanf("%d", &a); scanf("%d", &b); scanf("%d", &c); if(a >= 0 && a <= 10000 && b >= 0 && b <= 10000 && c >= 0 && c <= 10000){ d = a + b; e = a + c; f = b + c; //printf("%d円のベルと%d円のベルを買うと、%d円かかります。\n",a,b,d); //printf("%d円のベルと%d円のベルを買うと、%d円かかります。\n",a,c,e); //printf("%d円のベルと%d円のベルを買うと、%d円かかります。\n",b,c,f); if(d > e){ tmp = d; d = e; e = tmp; } if(e > f){ tmp = e; e = f; f = tmp; } if(d > e){ tmp = d; d = e; e = tmp; } //printf("よって、一番安いのは%d円です。\n",d); printf("%d\n",d); return 0; } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_170838/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_170838/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 i32, align 4 %b = alloca i32, align 4 %c = 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 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a) %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b) %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c) %0 = load i32, ptr %a, align 4 %or.cond = icmp ult i32 %0, 10001 %1 = load i32, ptr %b, align 4 %cmp5 = icmp sgt i32 %1, -1 %or.cond30 = select i1 %or.cond, i1 %cmp5, i1 false %cmp7 = icmp slt i32 %1, 10001 %or.cond31 = select i1 %or.cond30, i1 %cmp7, i1 false %2 = load i32, ptr %c, align 4 %cmp9 = icmp sgt i32 %2, -1 %or.cond32 = select i1 %or.cond31, i1 %cmp9, i1 false %cmp11 = icmp slt i32 %2, 10001 %or.cond33 = select i1 %or.cond32, i1 %cmp11, i1 false br i1 %or.cond33, label %if.then, label %cleanup if.then: ; preds = %entry %add = add nuw nsw i32 %1, %0 %add12 = add nuw nsw i32 %2, %0 %add13 = add nuw nsw i32 %2, %1 %cmp14 = icmp ugt i32 %1, %2 %spec.select = select i1 %cmp14, i32 %add12, i32 %add %spec.select47 = select i1 %cmp14, i32 %add, i32 %add12 %e.1 = call i32 @llvm.umin.i32(i32 %spec.select47, i32 %add13) %d.1 = call i32 @llvm.umin.i32(i32 %spec.select, i32 %e.1) %call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %d.1) br label %cleanup cleanup: ; preds = %entry, %if.then 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 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)"}
#include<stdio.h> #include<stdlib.h> int main(void){ int a,b,c,max; char in[100]; if(scanf("%100[^\n]%*[^\n]", in) < 1){return -1;} getchar(); if(sscanf(in, "%d %d %d", &a,&b,&c) != 3){ return -1; } max = a; if(max < b){ max = b;} if(max < c){ max = c;} max = max * -1; printf("%d",max+a+b+c); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_170881/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_170881/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 [15 x i8] c"%100[^\0A]%*[^\0A]\00", align 1 @.str.1 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1 @.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @stdin = external local_unnamed_addr global ptr, align 8 ; 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 %in = alloca [100 x i8], align 16 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 100, ptr nonnull %in) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %in) %cmp = icmp slt i32 %call, 1 br i1 %cmp, label %cleanup, label %if.end if.end: ; preds = %entry %0 = load ptr, ptr @stdin, align 8, !tbaa !5 %call.i = call i32 @getc(ptr noundef %0) %call3 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %in, ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c) #4 %cmp4.not = icmp eq i32 %call3, 3 br i1 %cmp4.not, label %if.end6, label %cleanup if.end6: ; preds = %if.end %1 = load i32, ptr %a, align 4, !tbaa !9 %2 = load i32, ptr %b, align 4, !tbaa !9 %spec.select = call i32 @llvm.smax.i32(i32 %1, i32 %2) %3 = load i32, ptr %c, align 4, !tbaa !9 %max.1 = call i32 @llvm.smax.i32(i32 %spec.select, i32 %3) %add = add i32 %2, %1 %add13 = add i32 %add, %3 %add14 = sub i32 %add13, %max.1 %call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %add14) br label %cleanup cleanup: ; preds = %if.end, %entry, %if.end6 %retval.0 = phi i32 [ 0, %if.end6 ], [ -1, %entry ], [ -1, %if.end ] call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %in) #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 %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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_sscanf(ptr nocapture noundef readonly, 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 @getc(ptr nocapture noundef) local_unnamed_addr #2 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.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 = !{!"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}
#include<stdio.h> int main(void) { int a,b,c; scanf("%d%d%d",&a,&b,&c); int max = a; if (max < b) { max = b; } if (max < c) { max = c; } printf("%d\n", a+b+c-max); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_170924/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_170924/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 [7 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: 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 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 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c) %0 = load i32, ptr %a, align 4, !tbaa !5 %1 = load i32, ptr %b, align 4, !tbaa !5 %spec.select = call i32 @llvm.smax.i32(i32 %0, i32 %1) %2 = load i32, ptr %c, align 4, !tbaa !5 %max.1 = call i32 @llvm.smax.i32(i32 %spec.select, i32 %2) %add = add nsw i32 %1, %0 %add4 = add nsw i32 %add, %2 %sub = sub i32 %add4, %max.1 %call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub) 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 i32 @llvm.smax.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"}
#include<stdio.h> #include<string.h> int main(){ int n,m,i,j,sum,d[5000],p[5010]={0}; char s[5000][1000],a[1000],b[1000]; scanf("%d",&n); for(i=0;i<n;i++)scanf("%s %d",s[i],&d[i]); scanf("%d",&m); while(m--){ scanf("%s %s",a,b); for(i=0;strcmp(s[i],a);i++); for(j=0;strcmp(s[j],b);j++); for(i++;p[i];i=p[i]); for(j++;p[j];j=p[j]); if(i-j){ if(d[i-1]<d[j-1])p[j]=i; else p[i]=j; } } for(i=sum=0;i<n;i++){ for(j=i+1;p[j];j=p[j]); sum+=d[j-1]; } printf("%d\n",sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_170982/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_170982/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"%s %d\00", align 1 @.str.2 = private unnamed_addr constant [6 x i8] c"%s %s\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: %n = alloca i32, align 4 %m = alloca i32, align 4 %d = alloca [5000 x i32], align 16 %p = alloca [5010 x i32], align 16 %s = alloca [5000 x [1000 x i8]], align 16 %a = alloca [1000 x i8], align 16 %b = alloca [1000 x i8], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5 call void @llvm.lifetime.start.p0(i64 20000, ptr nonnull %d) #5 call void @llvm.lifetime.start.p0(i64 20040, ptr nonnull %p) #5 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(20040) %p, i8 0, i64 20040, i1 false) call void @llvm.lifetime.start.p0(i64 5000000, ptr nonnull %s) #5 call void @llvm.lifetime.start.p0(i64 1000, ptr nonnull %a) #5 call void @llvm.lifetime.start.p0(i64 1000, ptr nonnull %b) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp113 = icmp sgt i32 %0, 0 br i1 %cmp113, 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 [5000 x [1000 x i8]], ptr %s, i64 0, i64 %indvars.iv %arrayidx2 = getelementptr inbounds [5000 x i32], ptr %d, i64 0, i64 %indvars.iv %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2) %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 %m) %3 = load i32, ptr %m, align 4, !tbaa !5 %dec115 = add nsw i32 %3, -1 store i32 %dec115, ptr %m, align 4, !tbaa !5 %tobool.not116 = icmp eq i32 %3, 0 br i1 %tobool.not116, label %for.cond64.preheader, label %while.body for.cond64.preheader: ; preds = %if.end63, %for.end %4 = load i32, ptr %n, align 4, !tbaa !5 %cmp65117 = icmp sgt i32 %4, 0 br i1 %cmp65117, label %for.body66.preheader, label %for.end82 for.body66.preheader: ; preds = %for.cond64.preheader %xtraiter = and i32 %4, 1 %5 = icmp eq i32 %4, 1 br i1 %5, label %for.end82.loopexit.unr-lcssa, label %for.body66.preheader.new for.body66.preheader.new: ; preds = %for.body66.preheader %unroll_iter = and i32 %4, -2 br label %for.body66 while.body: ; preds = %for.end, %if.end63 %call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %a, ptr noundef nonnull %b) br label %for.cond8 for.cond8: ; preds = %for.cond8, %while.body %indvars.iv121 = phi i64 [ %indvars.iv.next122, %for.cond8 ], [ 0, %while.body ] %arrayidx10 = getelementptr inbounds [5000 x [1000 x i8]], ptr %s, i64 0, i64 %indvars.iv121 %call13 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx10, ptr noundef nonnull dereferenceable(1) %a) #6 %tobool14.not = icmp eq i32 %call13, 0 %indvars.iv.next122 = add nuw i64 %indvars.iv121, 1 br i1 %tobool14.not, label %for.cond19, label %for.cond8, !llvm.loop !11 for.cond19: ; preds = %for.cond8, %for.cond19 %indvars.iv124 = phi i64 [ %indvars.iv.next125, %for.cond19 ], [ 0, %for.cond8 ] %arrayidx21 = getelementptr inbounds [5000 x [1000 x i8]], ptr %s, i64 0, i64 %indvars.iv124 %call24 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx21, ptr noundef nonnull dereferenceable(1) %b) #6 %tobool25.not = icmp eq i32 %call24, 0 %indvars.iv.next125 = add nuw i64 %indvars.iv124, 1 br i1 %tobool25.not, label %for.end29, label %for.cond19, !llvm.loop !12 for.end29: ; preds = %for.cond19 %6 = trunc i64 %indvars.iv121 to i32 %inc30 = add nuw nsw i32 %6, 1 br label %for.cond31 for.cond31: ; preds = %for.cond31, %for.end29 %i.2 = phi i32 [ %inc30, %for.end29 ], [ %7, %for.cond31 ] %idxprom32 = sext i32 %i.2 to i64 %arrayidx33 = getelementptr inbounds [5010 x i32], ptr %p, i64 0, i64 %idxprom32 %7 = load i32, ptr %arrayidx33, align 4, !tbaa !5 %tobool34.not = icmp eq i32 %7, 0 br i1 %tobool34.not, label %for.end39, label %for.cond31, !llvm.loop !13 for.end39: ; preds = %for.cond31 %arrayidx33.le = getelementptr inbounds [5010 x i32], ptr %p, i64 0, i64 %idxprom32 %8 = trunc i64 %indvars.iv124 to i32 %inc40 = add nuw nsw i32 %8, 1 br label %for.cond41 for.cond41: ; preds = %for.cond41, %for.end39 %j.1 = phi i32 [ %inc40, %for.end39 ], [ %9, %for.cond41 ] %idxprom42 = sext i32 %j.1 to i64 %arrayidx43 = getelementptr inbounds [5010 x i32], ptr %p, i64 0, i64 %idxprom42 %9 = load i32, ptr %arrayidx43, align 4, !tbaa !5 %tobool44.not = icmp eq i32 %9, 0 br i1 %tobool44.not, label %for.end49, label %for.cond41, !llvm.loop !14 for.end49: ; preds = %for.cond41 %arrayidx43.le = getelementptr inbounds [5010 x i32], ptr %p, i64 0, i64 %idxprom42 %tobool50.not = icmp eq i32 %i.2, %j.1 br i1 %tobool50.not, label %if.end63, label %if.then if.then: ; preds = %for.end49 %sub51 = add nsw i32 %i.2, -1 %idxprom52 = sext i32 %sub51 to i64 %arrayidx53 = getelementptr inbounds [5000 x i32], ptr %d, i64 0, i64 %idxprom52 %10 = load i32, ptr %arrayidx53, align 4, !tbaa !5 %sub54 = add nsw i32 %j.1, -1 %idxprom55 = sext i32 %sub54 to i64 %arrayidx56 = getelementptr inbounds [5000 x i32], ptr %d, i64 0, i64 %idxprom55 %11 = load i32, ptr %arrayidx56, align 4, !tbaa !5 %cmp57 = icmp slt i32 %10, %11 br i1 %cmp57, label %if.then58, label %if.else if.then58: ; preds = %if.then store i32 %i.2, ptr %arrayidx43.le, align 4, !tbaa !5 br label %if.end63 if.else: ; preds = %if.then store i32 %j.1, ptr %arrayidx33.le, align 4, !tbaa !5 br label %if.end63 if.end63: ; preds = %if.then58, %if.else, %for.end49 %12 = load i32, ptr %m, align 4, !tbaa !5 %dec = add nsw i32 %12, -1 store i32 %dec, ptr %m, align 4, !tbaa !5 %tobool.not = icmp eq i32 %12, 0 br i1 %tobool.not, label %for.cond64.preheader, label %while.body, !llvm.loop !15 for.body66: ; preds = %for.end75.1, %for.body66.preheader.new %sum.0119 = phi i32 [ 0, %for.body66.preheader.new ], [ %add79.1, %for.end75.1 ] %i.3118 = phi i32 [ 0, %for.body66.preheader.new ], [ %add.1, %for.end75.1 ] %niter = phi i32 [ 0, %for.body66.preheader.new ], [ %niter.next.1, %for.end75.1 ] %add = or i32 %i.3118, 1 br label %for.cond67 for.cond67: ; preds = %for.cond67, %for.body66 %j.2 = phi i32 [ %add, %for.body66 ], [ %13, %for.cond67 ] %idxprom68 = sext i32 %j.2 to i64 %arrayidx69 = getelementptr inbounds [5010 x i32], ptr %p, i64 0, i64 %idxprom68 %13 = load i32, ptr %arrayidx69, align 4, !tbaa !5 %tobool70.not = icmp eq i32 %13, 0 br i1 %tobool70.not, label %for.end75, label %for.cond67, !llvm.loop !16 for.end75: ; preds = %for.cond67 %sub76 = add nsw i32 %j.2, -1 %idxprom77 = sext i32 %sub76 to i64 %arrayidx78 = getelementptr inbounds [5000 x i32], ptr %d, i64 0, i64 %idxprom77 %14 = load i32, ptr %arrayidx78, align 4, !tbaa !5 %add79 = add nsw i32 %14, %sum.0119 %add.1 = add nuw nsw i32 %i.3118, 2 br label %for.cond67.1 for.cond67.1: ; preds = %for.cond67.1, %for.end75 %j.2.1 = phi i32 [ %add.1, %for.end75 ], [ %15, %for.cond67.1 ] %idxprom68.1 = sext i32 %j.2.1 to i64 %arrayidx69.1 = getelementptr inbounds [5010 x i32], ptr %p, i64 0, i64 %idxprom68.1 %15 = load i32, ptr %arrayidx69.1, align 4, !tbaa !5 %tobool70.not.1 = icmp eq i32 %15, 0 br i1 %tobool70.not.1, label %for.end75.1, label %for.cond67.1, !llvm.loop !16 for.end75.1: ; preds = %for.cond67.1 %sub76.1 = add nsw i32 %j.2.1, -1 %idxprom77.1 = sext i32 %sub76.1 to i64 %arrayidx78.1 = getelementptr inbounds [5000 x i32], ptr %d, i64 0, i64 %idxprom77.1 %16 = load i32, ptr %arrayidx78.1, align 4, !tbaa !5 %add79.1 = add nsw i32 %16, %add79 %niter.next.1 = add i32 %niter, 2 %niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %for.end82.loopexit.unr-lcssa.loopexit, label %for.body66, !llvm.loop !17 for.end82.loopexit.unr-lcssa.loopexit: ; preds = %for.end75.1 %17 = add nuw nsw i32 %i.3118, 3 br label %for.end82.loopexit.unr-lcssa for.end82.loopexit.unr-lcssa: ; preds = %for.end82.loopexit.unr-lcssa.loopexit, %for.body66.preheader %add79.lcssa.ph = phi i32 [ undef, %for.body66.preheader ], [ %add79.1, %for.end82.loopexit.unr-lcssa.loopexit ] %sum.0119.unr = phi i32 [ 0, %for.body66.preheader ], [ %add79.1, %for.end82.loopexit.unr-lcssa.loopexit ] %i.3118.unr = phi i32 [ 1, %for.body66.preheader ], [ %17, %for.end82.loopexit.unr-lcssa.loopexit ] %lcmp.mod.not = icmp eq i32 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end82, label %for.cond67.epil for.cond67.epil: ; preds = %for.end82.loopexit.unr-lcssa, %for.cond67.epil %j.2.epil = phi i32 [ %18, %for.cond67.epil ], [ %i.3118.unr, %for.end82.loopexit.unr-lcssa ] %idxprom68.epil = sext i32 %j.2.epil to i64 %arrayidx69.epil = getelementptr inbounds [5010 x i32], ptr %p, i64 0, i64 %idxprom68.epil %18 = load i32, ptr %arrayidx69.epil, align 4, !tbaa !5 %tobool70.not.epil = icmp eq i32 %18, 0 br i1 %tobool70.not.epil, label %for.end75.epil, label %for.cond67.epil, !llvm.loop !16 for.end75.epil: ; preds = %for.cond67.epil %sub76.epil = add nsw i32 %j.2.epil, -1 %idxprom77.epil = sext i32 %sub76.epil to i64 %arrayidx78.epil = getelementptr inbounds [5000 x i32], ptr %d, i64 0, i64 %idxprom77.epil %19 = load i32, ptr %arrayidx78.epil, align 4, !tbaa !5 %add79.epil = add nsw i32 %19, %sum.0119.unr br label %for.end82 for.end82: ; preds = %for.end75.epil, %for.end82.loopexit.unr-lcssa, %for.cond64.preheader %sum.0.lcssa = phi i32 [ 0, %for.cond64.preheader ], [ %add79.lcssa.ph, %for.end82.loopexit.unr-lcssa ], [ %add79.epil, %for.end75.epil ] %call83 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %sum.0.lcssa) call void @llvm.lifetime.end.p0(i64 1000, ptr nonnull %b) #5 call void @llvm.lifetime.end.p0(i64 1000, ptr nonnull %a) #5 call void @llvm.lifetime.end.p0(i64 5000000, ptr nonnull %s) #5 call void @llvm.lifetime.end.p0(i64 20040, ptr nonnull %p) #5 call void @llvm.lifetime.end.p0(i64 20000, ptr nonnull %d) #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 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 nofree nounwind willreturn memory(argmem: read) declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #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 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 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 #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 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10} !14 = distinct !{!14, !10} !15 = distinct !{!15, !10} !16 = distinct !{!16, !10} !17 = distinct !{!17, !10}
#include <stdio.h> int main(void) { int X; scanf("%d",&X); if(X%7==1)printf("fri\n"); else if(X%7==2)printf("sat\n"); else if(X%7==3)printf("sun\n"); else if(X%7==4)printf("mon\n"); else if(X%7==5)printf("tue\n"); else if(X%7==6)printf("wed\n"); else if(X%7==0)printf("thu\n"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_171024/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_171024/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 [4 x i8] c"thu\00", align 1 @str.8 = private unnamed_addr constant [4 x i8] c"wed\00", align 1 @str.9 = private unnamed_addr constant [4 x i8] c"tue\00", align 1 @str.10 = private unnamed_addr constant [4 x i8] c"mon\00", align 1 @str.11 = private unnamed_addr constant [4 x i8] c"sun\00", align 1 @str.12 = private unnamed_addr constant [4 x i8] c"sat\00", align 1 @str.13 = private unnamed_addr constant [4 x i8] c"fri\00", align 1 @reltable.main = private unnamed_addr constant [7 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr @str to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str.13 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str.12 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str.11 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str.10 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str.9 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str.8 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32)], align 4 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %X = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %X) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %X) %0 = load i32, ptr %X, align 4, !tbaa !5 %rem = srem i32 %0, 7 %1 = icmp ult i32 %rem, 7 br i1 %1, label %switch.lookup, label %if.end36 switch.lookup: ; preds = %entry %2 = sext i32 %rem to i64 %reltable.shift = shl i64 %2, 2 %reltable.intrinsic = call ptr @llvm.load.relative.i64(ptr @reltable.main, i64 %reltable.shift) %puts41 = call i32 @puts(ptr nonnull dereferenceable(1) %reltable.intrinsic) br label %if.end36 if.end36: ; preds = %entry, %switch.lookup call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %X) #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 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 willreturn memory(argmem: read) declare ptr @llvm.load.relative.i64(ptr, i64) #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 willreturn memory(argmem: read) } 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"}
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <math.h> #include <limits.h> #include <time.h> #define ll long long #define mod 1000000007 int main(){ ll n,x,m,i,j,amari,repeat=0, ans=0,a[100010]={},flag[100010]={},num[100010]={}; scanf("%lld %lld %lld",&n,&x,&m); a[1]=x; flag[x]++; num[x]=1; ans+=a[1]; for(i=1; i<100009; i++){ a[i+1]=(a[i]*a[i])%m; flag[a[i+1]]++; if(flag[a[i+1]]==2)break; num[a[i+1]]=i+1; if(a[i+1]==0){ printf("%lld",ans); return 0; } ans+=a[i+1]; } ans=0; amari=(n+1-num[a[i+1]])%(i+1-num[a[i+1]]); for(j=i+1; j<=i+amari; j++){ a[j]=(a[j-1]*a[j-1])%m; ans+=a[j]; } for(j=1; j<num[a[i+1]]; j++){ ans+=a[j]; } for(j=num[a[i+1]]; j<i+1; j++){ repeat+=a[j]; } repeat*=(n+1-num[a[i+1]])/(i+1-num[a[i+1]]); ans+=repeat; printf("%lld",ans); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_171068/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_171068/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 [15 x i8] c"%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: %n = alloca i64, align 8 %x = alloca i64, align 8 %m = alloca i64, align 8 %a = alloca [100010 x i64], align 16 %flag = alloca [100010 x i64], align 16 %num = alloca [100010 x i64], align 16 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #5 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %m) #5 call void @llvm.lifetime.start.p0(i64 800080, ptr nonnull %a) #5 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(800080) %a, i8 0, i64 800080, i1 false) call void @llvm.lifetime.start.p0(i64 800080, ptr nonnull %flag) #5 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(800080) %flag, i8 0, i64 800080, i1 false) call void @llvm.lifetime.start.p0(i64 800080, ptr nonnull %num) #5 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(800080) %num, i8 0, i64 800080, i1 false) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %x, ptr noundef nonnull %m) %0 = load i64, ptr %x, align 8, !tbaa !5 %arrayidx = getelementptr inbounds [100010 x i64], ptr %a, i64 0, i64 1 store i64 %0, ptr %arrayidx, align 8, !tbaa !5 %arrayidx1 = getelementptr inbounds [100010 x i64], ptr %flag, i64 0, i64 %0 %1 = load i64, ptr %arrayidx1, align 8, !tbaa !5 %inc = add nsw i64 %1, 1 store i64 %inc, ptr %arrayidx1, align 8, !tbaa !5 %arrayidx2 = getelementptr inbounds [100010 x i64], ptr %num, i64 0, i64 %0 store i64 1, ptr %arrayidx2, align 8, !tbaa !5 %2 = load i64, ptr %m, align 8, !tbaa !5 br label %for.body for.cond: ; preds = %if.end %add28 = add nsw i64 %rem, %ans.0147 %exitcond.not = icmp eq i64 %add6, 100009 br i1 %exitcond.not, label %for.cond.for.end_crit_edge, label %for.body, !llvm.loop !9 for.cond.for.end_crit_edge: ; preds = %for.cond %arrayidx32.phi.trans.insert = getelementptr inbounds [100010 x i64], ptr %a, i64 0, i64 100010 %.pre = load i64, ptr %arrayidx32.phi.trans.insert, align 16, !tbaa !5 br label %for.end for.body: ; preds = %entry, %for.cond %3 = phi i64 [ %0, %entry ], [ %rem, %for.cond ] %ans.0147 = phi i64 [ %0, %entry ], [ %add28, %for.cond ] %i.0146 = phi i64 [ 1, %entry ], [ %add6, %for.cond ] %mul = mul nsw i64 %3, %3 %rem = srem i64 %mul, %2 %add6 = add nuw nsw i64 %i.0146, 1 %arrayidx7 = getelementptr inbounds [100010 x i64], ptr %a, i64 0, i64 %add6 store i64 %rem, ptr %arrayidx7, align 8, !tbaa !5 %arrayidx10 = getelementptr inbounds [100010 x i64], ptr %flag, i64 0, i64 %rem %4 = load i64, ptr %arrayidx10, align 8, !tbaa !5 %inc11 = add nsw i64 %4, 1 store i64 %inc11, ptr %arrayidx10, align 8, !tbaa !5 %cmp15 = icmp eq i64 %inc11, 2 br i1 %cmp15, label %for.end, label %if.end if.end: ; preds = %for.body %arrayidx19 = getelementptr inbounds [100010 x i64], ptr %num, i64 0, i64 %rem store i64 %add6, ptr %arrayidx19, align 8, !tbaa !5 %cmp22 = icmp eq i64 %rem, 0 br i1 %cmp22, label %cleanup, label %for.cond for.end: ; preds = %for.body, %for.cond.for.end_crit_edge %5 = phi i64 [ %.pre, %for.cond.for.end_crit_edge ], [ %rem, %for.body ] %i.0.lcssa = phi i64 [ 100009, %for.cond.for.end_crit_edge ], [ %i.0146, %for.body ] %6 = load i64, ptr %n, align 8, !tbaa !5 %add30 = add nsw i64 %6, 1 %add31 = add nuw nsw i64 %i.0.lcssa, 1 %arrayidx32 = getelementptr inbounds [100010 x i64], ptr %a, i64 0, i64 %add31 %arrayidx33 = getelementptr inbounds [100010 x i64], ptr %num, i64 0, i64 %5 %7 = load i64, ptr %arrayidx33, align 8, !tbaa !5 %sub = sub nsw i64 %add30, %7 %sub38 = sub nsw i64 %add31, %7 %rem39 = srem i64 %sub, %sub38 %add42 = add nsw i64 %rem39, %i.0.lcssa %cmp43.not148 = icmp slt i64 %rem39, 1 br i1 %cmp43.not148, label %for.cond57.preheader, label %for.body44.lr.ph for.body44.lr.ph: ; preds = %for.end %arrayidx46.phi.trans.insert = getelementptr inbounds [100010 x i64], ptr %a, i64 0, i64 %i.0.lcssa %.pre163 = load i64, ptr %arrayidx46.phi.trans.insert, align 8, !tbaa !5 br label %for.body44 for.cond57.preheader.loopexit: ; preds = %for.body44 %.pre164 = load i64, ptr %arrayidx32, align 8, !tbaa !5 %arrayidx60.phi.trans.insert = getelementptr inbounds [100010 x i64], ptr %num, i64 0, i64 %.pre164 %.pre165 = load i64, ptr %arrayidx60.phi.trans.insert, align 8, !tbaa !5 br label %for.cond57.preheader for.cond57.preheader: ; preds = %for.cond57.preheader.loopexit, %for.end %8 = phi i64 [ %7, %for.end ], [ %.pre165, %for.cond57.preheader.loopexit ] %ans.1.lcssa = phi i64 [ 0, %for.end ], [ %add53, %for.cond57.preheader.loopexit ] %cmp61151 = icmp sgt i64 %8, 1 br i1 %cmp61151, label %for.body62.preheader, label %for.cond71.preheader for.body62.preheader: ; preds = %for.cond57.preheader %9 = add i64 %8, -1 %min.iters.check = icmp ult i64 %8, 5 br i1 %min.iters.check, label %for.body62.preheader201, label %vector.ph vector.ph: ; preds = %for.body62.preheader %n.vec = and i64 %9, -4 %ind.end = or i64 %n.vec, 1 %10 = insertelement <2 x i64> <i64 poison, i64 0>, i64 %ans.1.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 <2 x i64> [ %10, %vector.ph ], [ %13, %vector.body ] %vec.phi178 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %14, %vector.body ] %offset.idx = or i64 %index, 1 %11 = getelementptr inbounds [100010 x i64], ptr %a, i64 0, i64 %offset.idx %wide.load = load <2 x i64>, ptr %11, align 8, !tbaa !5 %12 = getelementptr inbounds i64, ptr %11, i64 2 %wide.load179 = load <2 x i64>, ptr %12, align 8, !tbaa !5 %13 = add <2 x i64> %wide.load, %vec.phi %14 = add <2 x i64> %wide.load179, %vec.phi178 %index.next = add nuw i64 %index, 4 %15 = icmp eq i64 %index.next, %n.vec br i1 %15, label %middle.block, label %vector.body, !llvm.loop !11 middle.block: ; preds = %vector.body %bin.rdx = add <2 x i64> %14, %13 %16 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx) %cmp.n = icmp eq i64 %9, %n.vec br i1 %cmp.n, label %for.cond71.preheader, label %for.body62.preheader201 for.body62.preheader201: ; preds = %for.body62.preheader, %middle.block %ans.2153.ph = phi i64 [ %ans.1.lcssa, %for.body62.preheader ], [ %16, %middle.block ] %j.1152.ph = phi i64 [ 1, %for.body62.preheader ], [ %ind.end, %middle.block ] br label %for.body62 for.body44: ; preds = %for.body44.lr.ph, %for.body44 %17 = phi i64 [ %.pre163, %for.body44.lr.ph ], [ %rem50, %for.body44 ] %ans.1150 = phi i64 [ 0, %for.body44.lr.ph ], [ %add53, %for.body44 ] %j.0149 = phi i64 [ %add31, %for.body44.lr.ph ], [ %inc55, %for.body44 ] %mul49 = mul nsw i64 %17, %17 %rem50 = srem i64 %mul49, %2 %arrayidx51 = getelementptr inbounds [100010 x i64], ptr %a, i64 0, i64 %j.0149 store i64 %rem50, ptr %arrayidx51, align 8, !tbaa !5 %add53 = add nuw nsw i64 %rem50, %ans.1150 %inc55 = add nuw nsw i64 %j.0149, 1 %cmp43.not.not = icmp slt i64 %j.0149, %add42 br i1 %cmp43.not.not, label %for.body44, label %for.cond57.preheader.loopexit, !llvm.loop !14 for.cond71.preheader: ; preds = %for.body62, %middle.block, %for.cond57.preheader %ans.2.lcssa = phi i64 [ %ans.1.lcssa, %for.cond57.preheader ], [ %16, %middle.block ], [ %add64, %for.body62 ] %cmp73.not156 = icmp sgt i64 %8, %i.0.lcssa br i1 %cmp73.not156, label %for.end79, label %for.body74.preheader for.body74.preheader: ; preds = %for.cond71.preheader %18 = add nuw i64 %i.0.lcssa, 1 %19 = sub i64 %18, %8 %min.iters.check182 = icmp ult i64 %19, 4 br i1 %min.iters.check182, label %for.body74.preheader199, label %vector.ph183 vector.ph183: ; preds = %for.body74.preheader %n.vec185 = and i64 %19, -4 %ind.end186 = add i64 %8, %n.vec185 br label %vector.body189 vector.body189: ; preds = %vector.body189, %vector.ph183 %index190 = phi i64 [ 0, %vector.ph183 ], [ %index.next196, %vector.body189 ] %vec.phi191 = phi <2 x i64> [ zeroinitializer, %vector.ph183 ], [ %22, %vector.body189 ] %vec.phi192 = phi <2 x i64> [ zeroinitializer, %vector.ph183 ], [ %23, %vector.body189 ] %offset.idx193 = add i64 %8, %index190 %20 = getelementptr inbounds [100010 x i64], ptr %a, i64 0, i64 %offset.idx193 %wide.load194 = load <2 x i64>, ptr %20, align 8, !tbaa !5 %21 = getelementptr inbounds i64, ptr %20, i64 2 %wide.load195 = load <2 x i64>, ptr %21, align 8, !tbaa !5 %22 = add <2 x i64> %wide.load194, %vec.phi191 %23 = add <2 x i64> %wide.load195, %vec.phi192 %index.next196 = add nuw i64 %index190, 4 %24 = icmp eq i64 %index.next196, %n.vec185 br i1 %24, label %middle.block180, label %vector.body189, !llvm.loop !15 middle.block180: ; preds = %vector.body189 %bin.rdx197 = add <2 x i64> %23, %22 %25 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx197) %cmp.n188 = icmp eq i64 %19, %n.vec185 br i1 %cmp.n188, label %for.end79, label %for.body74.preheader199 for.body74.preheader199: ; preds = %for.body74.preheader, %middle.block180 %repeat.0158.ph = phi i64 [ 0, %for.body74.preheader ], [ %25, %middle.block180 ] %j.2157.ph = phi i64 [ %8, %for.body74.preheader ], [ %ind.end186, %middle.block180 ] br label %for.body74 for.body62: ; preds = %for.body62.preheader201, %for.body62 %ans.2153 = phi i64 [ %add64, %for.body62 ], [ %ans.2153.ph, %for.body62.preheader201 ] %j.1152 = phi i64 [ %inc66, %for.body62 ], [ %j.1152.ph, %for.body62.preheader201 ] %arrayidx63 = getelementptr inbounds [100010 x i64], ptr %a, i64 0, i64 %j.1152 %26 = load i64, ptr %arrayidx63, align 8, !tbaa !5 %add64 = add nsw i64 %26, %ans.2153 %inc66 = add nuw nsw i64 %j.1152, 1 %exitcond161.not = icmp eq i64 %inc66, %8 br i1 %exitcond161.not, label %for.cond71.preheader, label %for.body62, !llvm.loop !16 for.body74: ; preds = %for.body74.preheader199, %for.body74 %repeat.0158 = phi i64 [ %add76, %for.body74 ], [ %repeat.0158.ph, %for.body74.preheader199 ] %j.2157 = phi i64 [ %inc78, %for.body74 ], [ %j.2157.ph, %for.body74.preheader199 ] %arrayidx75 = getelementptr inbounds [100010 x i64], ptr %a, i64 0, i64 %j.2157 %27 = load i64, ptr %arrayidx75, align 8, !tbaa !5 %add76 = add nsw i64 %27, %repeat.0158 %inc78 = add i64 %j.2157, 1 %exitcond162.not = icmp eq i64 %j.2157, %i.0.lcssa br i1 %exitcond162.not, label %for.end79, label %for.body74, !llvm.loop !17 for.end79: ; preds = %for.body74, %middle.block180, %for.cond71.preheader %repeat.0.lcssa = phi i64 [ 0, %for.cond71.preheader ], [ %25, %middle.block180 ], [ %add76, %for.body74 ] %sub84 = sub nsw i64 %add30, %8 %sub89 = sub nsw i64 %add31, %8 %div = sdiv i64 %sub84, %sub89 %mul90 = mul nsw i64 %div, %repeat.0.lcssa %add91 = add nsw i64 %mul90, %ans.2.lcssa br label %cleanup cleanup: ; preds = %if.end, %for.end79 %add91.sink = phi i64 [ %add91, %for.end79 ], [ %ans.0147, %if.end ] %call92 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %add91.sink) call void @llvm.lifetime.end.p0(i64 800080, ptr nonnull %num) #5 call void @llvm.lifetime.end.p0(i64 800080, ptr nonnull %flag) #5 call void @llvm.lifetime.end.p0(i64 800080, ptr nonnull %a) #5 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %m) #5 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #5 call void @llvm.lifetime.end.p0(i64 8, 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: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #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 = { 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"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10, !12, !13} !12 = !{!"llvm.loop.isvectorized", i32 1} !13 = !{!"llvm.loop.unroll.runtime.disable"} !14 = distinct !{!14, !10} !15 = distinct !{!15, !10, !12, !13} !16 = distinct !{!16, !10, !13, !12} !17 = distinct !{!17, !10, !13, !12}
#include<stdio.h> int main() { int R; scanf("%d",&R); if(R<1200&&R>=0) printf("ABC"); else if(R>=1200&&R<2800) printf("ARC"); else if(R>=2800&&R<=4208) printf("AGC"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_171110/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_171110/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"ABC\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"ARC\00", align 1 @.str.3 = private unnamed_addr constant [4 x i8] c"AGC\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %R = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %R) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %R) %0 = load i32, ptr %R, align 4 %or.cond = icmp ult i32 %0, 1200 br i1 %or.cond, label %if.end15.sink.split, label %if.else if.else: ; preds = %entry %1 = add i32 %0, -1200 %or.cond16 = icmp ult i32 %1, 1600 br i1 %or.cond16, label %if.end15.sink.split, label %if.else8 if.else8: ; preds = %if.else %2 = add i32 %0, -2800 %or.cond17 = icmp ult i32 %2, 1409 br i1 %or.cond17, label %if.end15.sink.split, label %if.end15 if.end15.sink.split: ; preds = %if.else8, %if.else, %entry %.str.2.sink = phi ptr [ @.str.1, %entry ], [ @.str.2, %if.else ], [ @.str.3, %if.else8 ] %call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink) br label %if.end15 if.end15: ; preds = %if.end15.sink.split, %if.else8 call void @llvm.lifetime.end.p0(i64 4, 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)"}
#include <stdio.h> int main(void) { int R; scanf("%d", &R); if (R < 1200) { printf("ABC\n"); } else if (1200 <= R && R < 2800) { printf("ARC\n"); } else { printf("AGC\n"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_171154/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_171154/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 [4 x i8] c"AGC\00", align 1 @str.4 = private unnamed_addr constant [4 x i8] c"ARC\00", align 1 @str.5 = private unnamed_addr constant [4 x i8] c"ABC\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %R = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %R) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %R) %0 = load i32, ptr %R, align 4 %cmp = icmp slt i32 %0, 1200 %cmp3 = icmp ult i32 %0, 2800 %str.4.str = select i1 %cmp3, ptr @str.4, ptr @str %str.4.sink = select i1 %cmp, ptr @str.5, ptr %str.4.str %puts9 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.sink) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %R) #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 @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)"}
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<math.h> int min(int a,int b){ if(a<=b) return a; else return b; } int max(int a,int b){ if(a>=b) return a; else return b; } int main(){ int N; scanf("%d",&N); if(N < 1200) printf("ABC"); if(N >= 1200 && N < 2800) printf("ARC"); if(N >= 2800) printf("AGC"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_171198/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_171198/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"ABC\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"ARC\00", align 1 @.str.3 = private unnamed_addr constant [4 x i8] c"AGC\00", align 1 ; 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: %b.a = tail call i32 @llvm.smin.i32(i32 %a, i32 %b) ret i32 %b.a } ; 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: %b.a = tail call i32 @llvm.smax.i32(i32 %a, i32 %b) ret i32 %b.a } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { 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 %cmp = icmp slt i32 %0, 1200 br i1 %cmp, label %if.then, label %if.end if.then: ; preds = %entry %call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1) %.pre = load i32, ptr %N, align 4 br label %if.end if.end: ; preds = %if.then, %entry %1 = phi i32 [ %.pre, %if.then ], [ %0, %entry ] %2 = add i32 %1, -1200 %or.cond = icmp ult i32 %2, 1600 br i1 %or.cond, label %if.then4, label %if.end6 if.then4: ; preds = %if.end %call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2) %.pr = load i32, ptr %N, align 4, !tbaa !5 br label %if.end6 if.end6: ; preds = %if.then4, %if.end %3 = phi i32 [ %.pr, %if.then4 ], [ %1, %if.end ] %cmp7 = icmp sgt i32 %3, 2799 br i1 %cmp7, label %if.then8, label %if.end10 if.then8: ; preds = %if.end6 %call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3) br label %if.end10 if.end10: ; preds = %if.then8, %if.end6 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) #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 i32 @llvm.smin.i32(i32, i32) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, 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"}
#include <stdio.h> int main(void){ int R; scanf("%d", &R); if(R < 1200){ printf("ABC"); }else if(R < 2800){ printf("ARC"); }else{ printf("AGC"); } printf("\n"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_171240/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_171240/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"ABC\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"ARC\00", align 1 @.str.3 = private unnamed_addr constant [4 x i8] c"AGC\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %R = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %R) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %R) %0 = load i32, ptr %R, align 4, !tbaa !5 %cmp = icmp slt i32 %0, 1200 %cmp2 = icmp ult i32 %0, 2800 %.str.2..str.3 = select i1 %cmp2, ptr @.str.2, ptr @.str.3 %.str.2.sink = select i1 %cmp, ptr @.str.1, ptr %.str.2..str.3 %call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink) %putchar = call i32 @putchar(i32 10) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %R) #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"}
#include<stdio.h> int main() { int a; scanf("%d",&a); if (a<1200) { printf("ABC"); } else if (a<2800) { printf("ARC"); } else { printf("AGC"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_171284/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_171284/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"ABC\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"ARC\00", align 1 @.str.3 = private unnamed_addr constant [4 x i8] c"AGC\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a) %0 = load i32, ptr %a, align 4, !tbaa !5 %cmp = icmp slt i32 %0, 1200 %cmp2 = icmp ult i32 %0, 2800 %.str.2..str.3 = select i1 %cmp2, ptr @.str.2, ptr @.str.3 %.str.2.sink = select i1 %cmp, ptr @.str.1, ptr %.str.2..str.3 %call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink) 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 R; scanf("%d",&R ); if(0<=R && R<1200) printf("ABC\n" ); else if(1200<=R && R<2800) printf("ARC\n"); else if(2800<=R && R<4209) printf("AGC\n"); else return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_171334/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_171334/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 [4 x i8] c"AGC\00", align 1 @str.4 = private unnamed_addr constant [4 x i8] c"ARC\00", align 1 @str.5 = private unnamed_addr constant [4 x i8] c"ABC\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %R = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %R) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %R) %0 = load i32, ptr %R, align 4 %or.cond = icmp ult i32 %0, 1200 br i1 %or.cond, label %cleanup.sink.split, label %if.else if.else: ; preds = %entry %1 = add i32 %0, -1200 %or.cond17 = icmp ult i32 %1, 1600 br i1 %or.cond17, label %cleanup.sink.split, label %if.else8 if.else8: ; preds = %if.else %2 = add i32 %0, -2800 %or.cond18 = icmp ult i32 %2, 1409 br i1 %or.cond18, label %cleanup.sink.split, label %cleanup cleanup.sink.split: ; preds = %if.else8, %if.else, %entry %str.5.sink = phi ptr [ @str.5, %entry ], [ @str.4, %if.else ], [ @str, %if.else8 ] %puts20 = call i32 @puts(ptr nonnull dereferenceable(1) %str.5.sink) br label %cleanup cleanup: ; preds = %cleanup.sink.split, %if.else8 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %R) #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 @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)"}
#include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <inttypes.h> #include <ctype.h> #include <stdint.h> #include <string.h> #include <wchar.h> #include <math.h> #define MIN(a, b) ((a) < (b) ? (a) : (b)) #define MAX(a, b) ((a) > (b) ? (a) : (b)) #define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a)) int compare_f(const void *a, const void *b) { return *((size_t *)a) > *((size_t *)b) ? -1 : 1; } static size_t comb(const size_t n, const size_t r) { size_t result = 1; for (size_t i = 0; i < r; i++) { result *= n - i; result /= i + 1; } return result; } int main(void) { size_t R; scanf("%zu", &R); if (R >= 2800) { puts("AGC"); } else if (R >= 1200) { puts("ARC"); } else { puts("ABC"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_171378/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_171378/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"%zu\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"AGC\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"ARC\00", align 1 @.str.3 = private unnamed_addr constant [4 x i8] c"ABC\00", align 1 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @compare_f(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 { entry: %0 = load i64, ptr %a, align 8, !tbaa !5 %1 = load i64, ptr %b, align 8, !tbaa !5 %cmp = icmp ugt i64 %0, %1 %cond = select i1 %cmp, i32 -1, i32 1 ret i32 %cond } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %R = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %R) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %R) %0 = load i64, ptr %R, align 8, !tbaa !5 %cmp = icmp ugt i64 %0, 2799 %cmp2 = icmp ugt i64 %0, 1199 %.str.2..str.3 = select i1 %cmp2, ptr @.str.2, ptr @.str.3 %.str.2.sink = select i1 %cmp, ptr @.str.1, ptr %.str.2..str.3 %call4 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.2.sink) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %R) #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) #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 @puts(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 attributes #0 = { 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 #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 = { 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> #include<stdlib.h> #include<math.h> #define pi 3.1415926535897932384626433832 double radian(double n) { return (pi*(n/180.0)); } int main() { double a,b,h,m,minx,miny,hx,hy; scanf("%lf %lf %lf %lf",&a,&b,&h,&m); minx=b*cos(radian(m*(360.0/60.0))); miny=b*sin(radian(m*(360.0/60.0))); hx=a*cos(radian((h+(m/60.0))*30.0)); hy=a*sin(radian((h+(m/60.0))*30.0)); double ans=sqrt(((hx-minx)*(hx-minx))+((hy-miny)*(hy-miny))); printf("%.20lf",ans); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_171514/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_171514/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"%lf %lf %lf %lf\00", align 1 @.str.1 = private unnamed_addr constant [7 x i8] c"%.20lf\00", align 1 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local double @radian(double noundef %n) local_unnamed_addr #0 { entry: %div = fdiv double %n, 1.800000e+02 %mul = fmul double %div, 0x400921FB54442D18 ret double %mul } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %a = alloca double, align 8 %b = alloca double, align 8 %h = alloca double, align 8 %m = alloca double, 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 %h) #7 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %m) #7 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %h, ptr noundef nonnull %m) %0 = load double, ptr %b, align 8, !tbaa !5 %1 = load double, ptr %m, align 8, !tbaa !5 %mul = fmul double %1, 6.000000e+00 %div.i = fdiv double %mul, 1.800000e+02 %mul.i = fmul double %div.i, 0x400921FB54442D18 %call2 = call double @cos(double noundef %mul.i) #7 %mul3 = fmul double %0, %call2 %2 = load double, ptr %b, align 8, !tbaa !5 %3 = load double, ptr %m, align 8, !tbaa !5 %mul4 = fmul double %3, 6.000000e+00 %div.i29 = fdiv double %mul4, 1.800000e+02 %mul.i30 = fmul double %div.i29, 0x400921FB54442D18 %call6 = call double @sin(double noundef %mul.i30) #7 %mul7 = fmul double %2, %call6 %4 = load double, ptr %a, align 8, !tbaa !5 %5 = load double, ptr %h, align 8, !tbaa !5 %6 = load double, ptr %m, align 8, !tbaa !5 %div = fdiv double %6, 6.000000e+01 %add = fadd double %5, %div %mul8 = fmul double %add, 3.000000e+01 %div.i31 = fdiv double %mul8, 1.800000e+02 %mul.i32 = fmul double %div.i31, 0x400921FB54442D18 %call10 = call double @cos(double noundef %mul.i32) #7 %mul11 = fmul double %4, %call10 %7 = load double, ptr %a, align 8, !tbaa !5 %8 = load double, ptr %h, align 8, !tbaa !5 %9 = load double, ptr %m, align 8, !tbaa !5 %div12 = fdiv double %9, 6.000000e+01 %add13 = fadd double %8, %div12 %mul14 = fmul double %add13, 3.000000e+01 %div.i33 = fdiv double %mul14, 1.800000e+02 %mul.i34 = fmul double %div.i33, 0x400921FB54442D18 %call16 = call double @sin(double noundef %mul.i34) #7 %mul17 = fmul double %7, %call16 %sub = fsub double %mul11, %mul3 %sub20 = fsub double %mul17, %mul7 %mul22 = fmul double %sub20, %sub20 %10 = call double @llvm.fmuladd.f64(double %sub, double %sub, double %mul22) %sqrt = call double @llvm.sqrt.f64(double %10) %call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sqrt) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %m) #7 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %h) #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: 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 nofree nounwind willreturn memory(write) declare double @cos(double noundef) local_unnamed_addr #4 ; Function Attrs: mustprogress nofree nounwind willreturn memory(write) declare double @sin(double noundef) local_unnamed_addr #4 ; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) declare double @llvm.fmuladd.f64(double, double, double) #5 ; 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 double @llvm.sqrt.f64(double) #6 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 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 nofree nounwind willreturn memory(write) "no-trapping-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 nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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 = !{!"double", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
/* ex4_2 suzuto */ #include <stdio.h> #include <math.h> double cos_theorem_fanc(double len_1, double len_2, double angle); /*プロトタイプ宣言*/ int main(void) { double len_hour, len_mimute, hour, minute, ans, angle; /*変数の宣言*/ scanf("%lf %lf %lf %lf", &len_hour, &len_mimute, &hour, &minute); /*各針の長さ、及び時刻の入力*/ angle = hour * 30 + minute * 0.5 - minute * 6; /*時針、分針の1分あたりの角速度がそれぞれ0.5度、6度より針間の角度を正負を問わず算出*/ ans = cos_theorem_fanc(len_hour, len_mimute, angle); /*余弦定理で針の端点間の距離を出しansに代入*/ printf("%10.10f\n", ans); /*距離を出力*/ return 0; } /*余弦定理を用いて対角の辺を算出する関数*/ double cos_theorem_fanc(double len_1, double len_2, double angle){ double angle_modified, res_pow2, res; /*変数の宣言*/ angle_modified = M_PI * angle / 180; res_pow2 = pow(len_1, 2) + pow(len_2, 2) - 2 * len_1 * len_2 * cos(angle_modified); /*x^2 + y^2 - 2xycos(t)*/ res = sqrt(res_pow2); return res; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_171558/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_171558/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"%lf %lf %lf %lf\00", align 1 @.str.1 = private unnamed_addr constant [9 x i8] c"%10.10f\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %len_hour = alloca double, align 8 %len_mimute = alloca double, align 8 %hour = alloca double, align 8 %minute = alloca double, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %len_hour) #6 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %len_mimute) #6 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %hour) #6 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %minute) #6 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %len_hour, ptr noundef nonnull %len_mimute, ptr noundef nonnull %hour, ptr noundef nonnull %minute) %0 = load double, ptr %hour, align 8, !tbaa !5 %1 = load double, ptr %minute, align 8, !tbaa !5 %mul1 = fmul double %1, 5.000000e-01 %2 = call double @llvm.fmuladd.f64(double %0, double 3.000000e+01, double %mul1) %neg = fneg double %1 %3 = call double @llvm.fmuladd.f64(double %neg, double 6.000000e+00, double %2) %4 = load double, ptr %len_hour, align 8, !tbaa !5 %5 = load double, ptr %len_mimute, align 8, !tbaa !5 %mul.i = fmul double %3, 0x400921FB54442D18 %div.i = fdiv double %mul.i, 1.800000e+02 %square.i = fmul double %4, %4 %square9.i = fmul double %5, %5 %add.i = fadd double %square.i, %square9.i %call4.i = call double @cos(double noundef %div.i) #6 %6 = fmul double %4, -2.000000e+00 %neg.i = fmul double %6, %5 %7 = call double @llvm.fmuladd.f64(double %neg.i, double %call4.i, double %add.i) %call6.i = call double @sqrt(double noundef %7) #6 %call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %call6.i) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %minute) #6 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %hour) #6 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %len_mimute) #6 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %len_hour) #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 nofree nounwind willreturn memory(write) uwtable define dso_local double @cos_theorem_fanc(double noundef %len_1, double noundef %len_2, double noundef %angle) local_unnamed_addr #4 { entry: %mul = fmul double %angle, 0x400921FB54442D18 %div = fdiv double %mul, 1.800000e+02 %square = fmul double %len_1, %len_1 %square9 = fmul double %len_2, %len_2 %add = fadd double %square, %square9 %call4 = tail call double @cos(double noundef %div) #6 %0 = fmul double %len_1, -2.000000e+00 %neg = fmul double %0, %len_2 %1 = tail call double @llvm.fmuladd.f64(double %neg, double %call4, double %add) %call6 = tail call double @sqrt(double noundef %1) #6 ret double %call6 } ; 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 nounwind willreturn memory(write) declare double @cos(double noundef) local_unnamed_addr #5 ; Function Attrs: mustprogress nofree nounwind willreturn memory(write) declare double @sqrt(double noundef) local_unnamed_addr #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 nounwind willreturn memory(write) 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 nofree nounwind willreturn memory(write) "no-trapping-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 } !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"}
/* ex4_2 KitamoriFumiya */ #include <stdio.h> #include <math.h> #define PI 3.14159265359 // 余弦定理で長針と短針の先端の距離を出力する関数 void cosine(double length_hour, double length_minute, double hour, double minute){ double angle_hour, angle_minute, difference_angle; // angle_hour(長針の角度), angle_minute(短針の角度), difference_angle(長針と短針の角度の差)をdouble型の変数として宣言 angle_hour = 360 * hour / 12 + 30 * minute / 60; // 長針の角度を計算 angle_minute = 360 * minute / 60; // 短針の角度を計算 difference_angle = angle_hour - angle_minute; // 長針と短針の角度の差を計算 difference_angle = (difference_angle / 180) * PI ; // 角度の差を弧度法で表す double distance; // 長針と短針の先端の距離をdouble型の変数として宣言 distance = length_hour * length_hour + length_minute * length_minute - 2 * length_hour * length_minute * cos(difference_angle); // 距離の2乗を余弦定理で求める distance = sqrt(distance); // 距離をルートに入れて戻す printf("%.10lf\n", distance); // 距離を少数第10位まで出力する } int main(){ double length_hour, length_minute, hour, minute; // length_hour(長針の長さ), length_minute(短針の長さ), hour(時間), minute(分数)をdouble型の変数として宣言 scanf("%lf %lf %lf %lf", &length_hour, &length_minute, &hour, &minute); // length_hour, length_minute, hour, minuteを入力 cosine(length_hour, length_minute, hour, minute); // 余弦定理で長針と短針の先端の距離を出力する関数を実行 return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_171600/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_171600/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 [8 x i8] c"%.10lf\0A\00", align 1 @.str.1 = private unnamed_addr constant [16 x i8] c"%lf %lf %lf %lf\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local void @cosine(double noundef %length_hour, double noundef %length_minute, double noundef %hour, double noundef %minute) local_unnamed_addr #0 { entry: %0 = insertelement <2 x double> poison, double %hour, i64 0 %1 = insertelement <2 x double> %0, double %minute, i64 1 %2 = fmul <2 x double> %1, <double 3.600000e+02, double 3.600000e+02> %mul1 = fmul double %minute, 3.000000e+01 %div2 = fdiv double %mul1, 6.000000e+01 %3 = fdiv <2 x double> %2, <double 1.200000e+01, double 6.000000e+01> %4 = extractelement <2 x double> %3, i64 0 %add = fadd double %4, %div2 %5 = extractelement <2 x double> %3, i64 1 %sub = fsub double %add, %5 %div5 = fdiv double %sub, 1.800000e+02 %mul6 = fmul double %div5, 0x400921FB54442EEA %mul8 = fmul double %length_minute, %length_minute %6 = tail call double @llvm.fmuladd.f64(double %length_hour, double %length_hour, double %mul8) %call = tail call double @cos(double noundef %mul6) #5 %7 = fmul double %length_hour, -2.000000e+00 %neg = fmul double %7, %length_minute %8 = tail call double @llvm.fmuladd.f64(double %neg, double %call, double %6) %call12 = tail call double @sqrt(double noundef %8) #5 %call13 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, double noundef %call12) 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 speculatable willreturn memory(none) declare double @llvm.fmuladd.f64(double, double, double) #2 ; Function Attrs: mustprogress nofree nounwind willreturn memory(write) declare double @cos(double noundef) local_unnamed_addr #3 ; Function Attrs: mustprogress nofree nounwind willreturn memory(write) declare double @sqrt(double noundef) local_unnamed_addr #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 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %length_hour = alloca double, align 8 %length_minute = alloca double, align 8 %hour = alloca double, align 8 %minute = alloca double, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %length_hour) #5 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %length_minute) #5 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %hour) #5 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %minute) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %length_hour, ptr noundef nonnull %length_minute, ptr noundef nonnull %hour, ptr noundef nonnull %minute) %0 = load double, ptr %length_hour, align 8, !tbaa !5 %1 = load double, ptr %length_minute, align 8, !tbaa !5 %2 = load double, ptr %hour, align 8, !tbaa !5 %3 = load double, ptr %minute, align 8, !tbaa !5 %mul1.i = fmul double %3, 3.000000e+01 %div2.i = fdiv double %mul1.i, 6.000000e+01 %4 = insertelement <2 x double> poison, double %2, i64 0 %5 = insertelement <2 x double> %4, double %3, i64 1 %6 = fmul <2 x double> %5, <double 3.600000e+02, double 3.600000e+02> %7 = fdiv <2 x double> %6, <double 1.200000e+01, double 6.000000e+01> %8 = extractelement <2 x double> %7, i64 0 %add.i = fadd double %8, %div2.i %9 = extractelement <2 x double> %7, i64 1 %sub.i = fsub double %add.i, %9 %div5.i = fdiv double %sub.i, 1.800000e+02 %mul6.i = fmul double %div5.i, 0x400921FB54442EEA %mul8.i = fmul double %1, %1 %10 = call double @llvm.fmuladd.f64(double %0, double %0, double %mul8.i) %call.i = call double @cos(double noundef %mul6.i) #5 %11 = fmul double %0, -2.000000e+00 %neg.i = fmul double %11, %1 %12 = call double @llvm.fmuladd.f64(double %neg.i, double %call.i, double %10) %call12.i = call double @sqrt(double noundef %12) #5 %call13.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, double noundef %call12.i) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %minute) #5 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %hour) #5 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %length_minute) #5 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %length_hour) #5 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #3 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-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 = { 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"}
/* ex4_2 Graku */ #include <stdio.h> #include<math.h> //#define PI = 3.1415926535 int main(void) { double len_h, len_m, hour, min; scanf("%lf %lf %lf %lf", &len_h, &len_m, &hour, &min); double theta_h = 2 * M_PI * (hour + min/60)/12; //angle between 0 and hour hands [rad] double theta_m = 2 * M_PI * min/60; //angle between 0 and minute hands [rad] double theta = theta_h - theta_m; //angle between hour and minute hands [rad] double ans = sqrt(pow(len_h, 2) + pow(len_m, 2) - 2*len_h*len_m * cos(theta)); //cosine theorem printf("%.10f\n", ans); //10 decimal places return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_171644/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_171644/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"%lf %lf %lf %lf\00", align 1 @.str.1 = private unnamed_addr constant [7 x i8] c"%.10f\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %len_h = alloca double, align 8 %len_m = alloca double, align 8 %hour = alloca double, align 8 %min = alloca double, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %len_h) #5 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %len_m) #5 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %hour) #5 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %min) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %len_h, ptr noundef nonnull %len_m, ptr noundef nonnull %hour, ptr noundef nonnull %min) %0 = load double, ptr %hour, align 8, !tbaa !5 %1 = load double, ptr %min, align 8, !tbaa !5 %div = fdiv double %1, 6.000000e+01 %add = fadd double %0, %div %2 = insertelement <2 x double> poison, double %add, i64 0 %3 = insertelement <2 x double> %2, double %1, i64 1 %4 = fmul <2 x double> %3, <double 0x401921FB54442D18, double 0x401921FB54442D18> %5 = fdiv <2 x double> %4, <double 1.200000e+01, double 6.000000e+01> %shift = shufflevector <2 x double> %5, <2 x double> poison, <2 x i32> <i32 1, i32 poison> %6 = fsub <2 x double> %5, %shift %sub = extractelement <2 x double> %6, i64 0 %7 = load double, ptr %len_h, align 8, !tbaa !5 %square = fmul double %7, %7 %8 = load double, ptr %len_m, align 8, !tbaa !5 %square13 = fmul double %8, %8 %add6 = fadd double %square, %square13 %call9 = call double @cos(double noundef %sub) #5 %9 = fmul double %7, -2.000000e+00 %neg = fmul double %9, %8 %10 = call double @llvm.fmuladd.f64(double %neg, double %call9, double %add6) %call11 = call double @sqrt(double noundef %10) #5 %call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %call11) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %min) #5 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %hour) #5 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %len_m) #5 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %len_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 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nounwind willreturn memory(write) declare double @sqrt(double noundef) local_unnamed_addr #3 ; Function Attrs: mustprogress nofree nounwind willreturn memory(write) declare double @cos(double noundef) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) declare double @llvm.fmuladd.f64(double, double, double) #4 ; 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(write) "no-trapping-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 = { 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<math.h> int main(){ int a,b,h,m; double theta,c; scanf("%d %d %d %d",&a,&b,&h,&m); theta=2*M_PI*((double)h/12.0 + ((double)m/60.0)/12.0 - (double)m/60.0); c=(double)(a*a + b*b)-(double)(2*a*b)*cos(theta); printf("%.15f\n",sqrt(c)); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_171688/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_171688/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 [7 x i8] c"%.15f\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 %h = alloca i32, align 4 %m = alloca i32, align 4 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 %h) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %h, ptr noundef nonnull %m) %0 = load i32, ptr %h, align 4, !tbaa !5 %1 = load i32, ptr %m, align 4, !tbaa !5 %2 = insertelement <2 x i32> poison, i32 %0, i64 0 %3 = insertelement <2 x i32> %2, i32 %1, i64 1 %4 = sitofp <2 x i32> %3 to <2 x double> %5 = fdiv <2 x double> %4, <double 1.200000e+01, double 6.000000e+01> %6 = extractelement <2 x double> %5, i64 1 %div3 = fdiv double %6, 1.200000e+01 %7 = extractelement <2 x double> %5, i64 0 %add = fadd double %7, %div3 %sub = fsub double %add, %6 %mul = fmul double %sub, 0x401921FB54442D18 %8 = load i32, ptr %a, align 4, !tbaa !5 %mul6 = mul nsw i32 %8, %8 %9 = load i32, ptr %b, align 4, !tbaa !5 %mul7 = mul nsw i32 %9, %9 %add8 = add nuw nsw i32 %mul7, %mul6 %conv9 = sitofp i32 %add8 to double %mul10 = shl nsw i32 %8, 1 %mul11 = mul nsw i32 %mul10, %9 %conv12 = sitofp i32 %mul11 to double %call13 = call double @cos(double noundef %mul) #5 %neg = fneg double %conv12 %10 = call double @llvm.fmuladd.f64(double %neg, double %call13, double %conv9) %call15 = call double @sqrt(double noundef %10) #5 %call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %call15) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #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 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(write) declare double @cos(double noundef) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) declare double @llvm.fmuladd.f64(double, double, double) #4 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nounwind willreturn memory(write) declare double @sqrt(double 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 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(write) "no-trapping-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 = { 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<math.h> #define PI 3.141592653589 int main(){ int a,b,h,m; scanf("%d%d%d%d",&a,&b,&h,&m); printf("%.20lf\n", sqrt(a*a + b*b - 2*a*b*cos(M_PI / 180 * fabs(h*60 - m*11) / 2))); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_171730/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_171730/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%d\00", align 1 @.str.1 = private unnamed_addr constant [8 x i8] c"%.20lf\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 %h = alloca i32, align 4 %m = alloca i32, align 4 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 %h) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %h, ptr noundef nonnull %m) %0 = load i32, ptr %a, align 4, !tbaa !5 %mul = mul nsw i32 %0, %0 %1 = load i32, ptr %b, align 4, !tbaa !5 %mul1 = mul nsw i32 %1, %1 %add = add nuw nsw i32 %mul1, %mul %conv = sitofp i32 %add to double %mul2 = shl nsw i32 %0, 1 %mul3 = mul nsw i32 %mul2, %1 %conv4 = sitofp i32 %mul3 to double %2 = load i32, ptr %h, align 4, !tbaa !5 %mul5 = mul nsw i32 %2, 60 %3 = load i32, ptr %m, align 4, !tbaa !5 %mul6.neg = mul i32 %3, -11 %sub = add i32 %mul6.neg, %mul5 %conv7 = sitofp i32 %sub to double %4 = call double @llvm.fabs.f64(double %conv7) %mul8 = fmul double %4, 0x3F91DF46A2529D39 %div = fmul double %mul8, 5.000000e-01 %call9 = call double @cos(double noundef %div) #5 %neg = fneg double %conv4 %5 = call double @llvm.fmuladd.f64(double %neg, double %call9, double %conv) %call11 = call double @sqrt(double noundef %5) #5 %call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %call11) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #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 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 nofree nounwind willreturn memory(write) declare double @sqrt(double noundef) local_unnamed_addr #3 ; Function Attrs: mustprogress nofree nounwind willreturn memory(write) declare double @cos(double noundef) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) declare double @llvm.fabs.f64(double) #4 ; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) declare double @llvm.fmuladd.f64(double, double, double) #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 = { 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(write) "no-trapping-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 = { 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 <math.h> #include <stdlib.h> int main(void) { int A, B, H, M; scanf("%d %d %d %d", &A, &B, &H, &M); double h = (double)(H * 60 + M) * 0.5; double m = (double)M * 6; double hTheta = (90 - h) * (atan(1.0) * 4.0 / 180); double mTheta = (90 - m) * (atan(1.0) * 4.0 / 180); // printf("%f %f \n", h, m); // printf("%f %f\n", cos(hTheta), cos(mTheta)); double a = fabs(A * cos(hTheta) - B * cos(mTheta)); double b = fabs(A * sin(hTheta) - B * sin(mTheta)); // printf("%f %f\n", a, b); double c = sqrt(pow(a, 2.0) + pow(b, 2.0)); printf("%.16f\n",c); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_171774/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_171774/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 [7 x i8] c"%.16f\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 %H = alloca i32, align 4 %M = alloca i32, align 4 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 %H) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %M) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B, ptr noundef nonnull %H, ptr noundef nonnull %M) %0 = load i32, ptr %H, align 4, !tbaa !5 %mul = mul nsw i32 %0, 60 %1 = load i32, ptr %M, align 4, !tbaa !5 %add = add nsw i32 %mul, %1 %conv = sitofp i32 %add to double %mul1 = fmul double %conv, 5.000000e-01 %conv2 = sitofp i32 %1 to double %mul3 = fmul double %conv2, 6.000000e+00 %sub = fsub double 9.000000e+01, %mul1 %mul6 = fmul double %sub, 0x3F91DF46A2529D39 %sub7 = fsub double 9.000000e+01, %mul3 %mul11 = fmul double %sub7, 0x3F91DF46A2529D39 %2 = load i32, ptr %A, align 4, !tbaa !5 %call13 = call double @cos(double noundef %mul6) #5 %3 = load i32, ptr %B, align 4, !tbaa !5 %call16 = call double @cos(double noundef %mul11) #5 %4 = load i32, ptr %A, align 4, !tbaa !5 %call19 = call double @sin(double noundef %mul6) #5 %5 = load i32, ptr %B, align 4, !tbaa !5 %call22 = call double @sin(double noundef %mul11) #5 %6 = insertelement <2 x i32> poison, i32 %2, i64 0 %7 = insertelement <2 x i32> %6, i32 %4, i64 1 %8 = sitofp <2 x i32> %7 to <2 x double> %9 = insertelement <2 x i32> poison, i32 %3, i64 0 %10 = insertelement <2 x i32> %9, i32 %5, i64 1 %11 = sitofp <2 x i32> %10 to <2 x double> %12 = insertelement <2 x double> poison, double %call16, i64 0 %13 = insertelement <2 x double> %12, double %call22, i64 1 %14 = fneg <2 x double> %13 %15 = fmul <2 x double> %14, %11 %16 = insertelement <2 x double> poison, double %call13, i64 0 %17 = insertelement <2 x double> %16, double %call19, i64 1 %18 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %8, <2 x double> %17, <2 x double> %15) %19 = fmul <2 x double> %18, %18 %shift = shufflevector <2 x double> %19, <2 x double> poison, <2 x i32> <i32 1, i32 poison> %20 = fadd <2 x double> %19, %shift %add27 = extractelement <2 x double> %20, i64 0 %sqrt = call double @llvm.sqrt.f64(double %add27) %call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sqrt) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %M) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #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 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(write) declare double @cos(double noundef) local_unnamed_addr #3 ; Function Attrs: mustprogress nofree nounwind willreturn memory(write) declare double @sin(double 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 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 nofree nounwind willreturn memory(write) "no-trapping-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"}
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<math.h> int main(){ double A,B,H,M; scanf("%lf %lf %lf %lf",&A,&B,&H,&M); double ax,ay,bx,by,pi,dis; pi = atan(1.0) * 4.0; ax = A*sin((H/6+M/360)*pi); ay = sqrt(A*A-ax*ax); if(H>=3&&H<9)ay = -ay; bx = B*sin((M/30)*pi); by = sqrt(B*B-bx*bx); if(M>=15&&M<45)by =-by; dis = sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by)); printf("%.16f\n",dis); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_171817/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_171817/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"%lf %lf %lf %lf\00", align 1 @.str.1 = private unnamed_addr constant [7 x i8] c"%.16f\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %A = alloca double, align 8 %B = alloca double, align 8 %H = alloca double, align 8 %M = alloca double, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %A) #6 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %B) #6 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %H) #6 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %M) #6 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B, ptr noundef nonnull %H, ptr noundef nonnull %M) %0 = load double, ptr %A, align 8, !tbaa !5 %1 = load double, ptr %H, align 8, !tbaa !5 %2 = load double, ptr %M, align 8, !tbaa !5 %3 = insertelement <2 x double> poison, double %1, i64 0 %4 = insertelement <2 x double> %3, double %2, i64 1 %5 = fdiv <2 x double> %4, <double 6.000000e+00, double 3.600000e+02> %shift = shufflevector <2 x double> %5, <2 x double> poison, <2 x i32> <i32 1, i32 poison> %6 = fadd <2 x double> %5, %shift %add = extractelement <2 x double> %6, i64 0 %mul3 = fmul double %add, 0x400921FB54442D18 %call4 = call double @sin(double noundef %mul3) #6 %mul5 = fmul double %0, %call4 %7 = load double, ptr %A, align 8, !tbaa !5 %8 = fneg double %mul5 %neg = fmul double %mul5, %8 %9 = call double @llvm.fmuladd.f64(double %7, double %7, double %neg) %call8 = call double @sqrt(double noundef %9) #6 %10 = load double, ptr %H, align 8 %cmp = fcmp oge double %10, 3.000000e+00 %cmp9 = fcmp olt double %10, 9.000000e+00 %or.cond = and i1 %cmp, %cmp9 %fneg = fneg double %call8 %ay.0 = select i1 %or.cond, double %fneg, double %call8 %11 = load double, ptr %B, align 8, !tbaa !5 %12 = load double, ptr %M, align 8, !tbaa !5 %div10 = fdiv double %12, 3.000000e+01 %mul11 = fmul double %div10, 0x400921FB54442D18 %call12 = call double @sin(double noundef %mul11) #6 %mul13 = fmul double %11, %call12 %13 = load double, ptr %B, align 8, !tbaa !5 %14 = fneg double %mul13 %neg16 = fmul double %mul13, %14 %15 = call double @llvm.fmuladd.f64(double %13, double %13, double %neg16) %call17 = call double @sqrt(double noundef %15) #6 %16 = load double, ptr %M, align 8 %cmp18 = fcmp oge double %16, 1.500000e+01 %cmp20 = fcmp olt double %16, 4.500000e+01 %or.cond31 = and i1 %cmp18, %cmp20 %fneg22 = fneg double %call17 %by.0 = select i1 %or.cond31, double %fneg22, double %call17 %sub = fsub double %mul5, %mul13 %sub26 = fsub double %ay.0, %by.0 %mul28 = fmul double %sub26, %sub26 %17 = call double @llvm.fmuladd.f64(double %sub, double %sub, double %mul28) %sqrt = call double @llvm.sqrt.f64(double %17) %call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sqrt) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %M) #6 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %H) #6 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %B) #6 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %A) #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 memory(write) declare double @sin(double noundef) local_unnamed_addr #3 ; Function Attrs: mustprogress nofree nounwind willreturn memory(write) declare double @sqrt(double noundef) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) declare double @llvm.fmuladd.f64(double, double, double) #4 ; 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) #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 nounwind willreturn memory(write) "no-trapping-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 = !{!"double", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#define _CRT_SECURE_NO_WARNINGS #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <inttypes.h> #include <limits.h> #include <ctype.h> #include <stdint.h> #include <string.h> #include <wchar.h> #include <math.h> #define N_MAX (100) #define P_MAX (100) #define DP_ARRAY_SIZE (N_MAX * P_MAX / 32 + 1) #define MIN(a, b) ((a) < (b) ? (a) : (b)) #define MAX(a, b) ((a) > (b) ? (a) : (b)) #define ABS(a) ((a) < 0 ? -(a) : (a)) #define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a)) #define SWAP(type, a, b) { const type tmp = a; a = b; b = tmp; } int compare_sz_asc(const void* a, const void* b) { return *((size_t*)a) < *((size_t*)b) ? -1 : 1; } int compare_sz_desc(const void* a, const void* b) { return *((size_t*)a) > * ((size_t*)b) ? -1 : 1; } int compare_i64_asc(const void* a, const void* b) { return *((int64_t*)a) < *((int64_t*)b) ? -1 : 1; } int compare_i64_desc(const void* a, const void* b) { return *((int64_t*)a) > * ((int64_t*)b) ? -1 : 1; } int compare_u64_asc(const void* a, const void* b) { return *((uint64_t*)a) < *((uint64_t*)b) ? -1 : 1; } int compare_u64_desc(const void* a, const void* b) { return *((uint64_t*)a) > * ((uint64_t*)b) ? -1 : 1; } int compare_c_asc(const void* a, const void* b) { return *((char*)a) < *((char*)b) ? -1 : 1; } int compare_c_desc(const void* a, const void* b) { return *((char*)a) > * ((char*)b) ? -1 : 1; } int compare_dp_asc(const void* a, const void* b) { return *((double*)a) < *((double*)b) ? -1 : 1; } static uint64_t modinvU64(const uint64_t a, const uint64_t m) { int64_t aa = (int64_t)a; const int64_t mm = (int64_t)m; int64_t b = mm; int64_t u = 1; int64_t v = 0; while (b != 0) { const int64_t t = aa / b; aa -= t * b; SWAP(uint64_t, aa, b); u -= t * v; SWAP(uint64_t, u, v); } u %= mm; if (u < 0) { u += m; } return (uint64_t)u; } static size_t powSz(const size_t base, const size_t exp) { if (exp == 0) { return 1; } if (exp == 1) { return base; } if (exp % 2 == 0) { return powSz(base * base, exp / 2); } else { return base * powSz(base, exp - 1); } } static uint64_t powU64(const uint64_t base, const uint64_t exp) { if (exp == 0) { return 1; } if (exp == 1) { return base; } if (exp % 2 == 0) { return powU64(base * base, exp / 2); } else { return base * powU64(base, exp - 1); } } static uint64_t powU64WMod(const uint64_t base, const uint64_t exp, const uint64_t m) { if (exp == 0) { return 1; } if (exp == 1) { return base % m; } if (exp % 2 == 0) { return powU64WMod(base * base % m, exp / 2, m); } else { return base * powU64WMod(base, exp - 1, m) % m; } } static size_t combSz(const size_t n, const size_t r) { size_t result = 1; for (size_t i = 0; i < r; i++) { result *= n - i; result /= i + 1; } return result; } static uint64_t combU64(const uint64_t n, const uint64_t r) { uint64_t result = 1; for (uint64_t i = 0; i < r; i++) { result *= n - i; result /= i + 1; } return result; } static uint64_t combU64WMod(const uint64_t n, const uint64_t r, const uint64_t m) { uint64_t result = 1; uint64_t inv = 1; for (uint64_t i = 0; i < r; i++) { result = result * (n - i) % m; inv = inv * (i + 1) % m; } return result * modinvU64(inv, m) % m; } static uint64_t permU64(const uint64_t n) { uint64_t result = 1; for (uint64_t v = 2; v <= n; v++) { result *= v; } return result; } static uint64_t permU64WMod(const uint64_t n, const uint64_t m) { uint64_t result = 1; for (uint64_t v = 2; v <= n; v++) { result *= v; result %= m; } return result; } static size_t gcdZu(size_t m, size_t n) { size_t temp; while (m % n != 0) { temp = n; n = m % n; m = temp; } return n; } static uint64_t gcdU64(uint64_t m, uint64_t n) { uint64_t temp; while (m % n != 0) { temp = n; n = m % n; m = temp; } return n; } static uint64_t popcntU64(uint64_t val) { uint64_t cnt = 0; while (val != 0) { if ((val & UINT64_C(0x1)) != 0) { cnt++; } val >>= UINT64_C(0x1); } return cnt; } typedef struct { uint64_t val; }BHeap_Val; #define BHEAP_VAL_TYPE BHeap_Val #define BHEAP_INVALID_NODE ((size_t)100000000) typedef struct { BHEAP_VAL_TYPE val; } BHeap_Node; struct _BHeap_Ctx { size_t size; int (*compare)(const BHEAP_VAL_TYPE* parent, const BHEAP_VAL_TYPE* node); void(*notifyNodeChange)(const struct _BHeap_Ctx* const ctx, const size_t nodeListSize, const size_t* const nodeList); BHeap_Node* node; }; typedef struct _BHeap_Ctx BHeap_Ctx; static void bHeap_Init(BHeap_Ctx* const ctx, int(*compare)(const BHEAP_VAL_TYPE* parent, const BHEAP_VAL_TYPE* node), void(*notifyNodeChange)(const BHeap_Ctx* const ctx, const size_t nodeListSize, const size_t* const nodeList), BHeap_Node* const nodes) { ctx->size = 0; ctx->compare = compare; ctx->notifyNodeChange = notifyNodeChange; ctx->node = nodes; } static void bHeap_Swap(BHeap_Ctx* const ctx, const size_t node0, const size_t node1) { const BHEAP_VAL_TYPE tmp = ctx->node[node0].val; ctx->node[node0].val = ctx->node[node1].val; ctx->node[node1].val = tmp; if (ctx->notifyNodeChange != NULL) { const size_t nodeList[2] = { node0,node1 }; ctx->notifyNodeChange(ctx, 2, nodeList); } } static void bHeap_UpHeap(BHeap_Ctx* const ctx, const size_t nodeIdx) { if (nodeIdx == 0) { return; } const size_t parentIdx = (nodeIdx + 1) / 2 - 1; const int compareResult = ctx->compare(&(ctx->node[parentIdx].val), &(ctx->node[nodeIdx].val)); if (0 < compareResult) { bHeap_Swap(ctx, nodeIdx, parentIdx); if (parentIdx != 0) { bHeap_UpHeap(ctx, parentIdx); } } } static void bHeap_DownHeap(BHeap_Ctx* const ctx, const size_t nodeIdx) { if (ctx->size - 1 <= nodeIdx) { return; } const size_t leftIdx = 2 * (nodeIdx + 1) - 1; if (leftIdx < ctx->size) { const int leftResult = ctx->compare(&(ctx->node[nodeIdx].val), &(ctx->node[leftIdx].val)); size_t swapTarget = leftResult < 0 ? BHEAP_INVALID_NODE : leftIdx; const size_t rightIdx = leftIdx + 1; if (rightIdx < ctx->size) { const int rightResult = ctx->compare(&(ctx->node[nodeIdx].val), &(ctx->node[rightIdx].val)); if (swapTarget == BHEAP_INVALID_NODE) { if (0 < rightResult) { swapTarget = rightIdx; } } else { if (0 < rightResult) { const int rightLeftResult = ctx->compare(&(ctx->node[leftIdx].val), &(ctx->node[rightIdx].val)); if (0 < rightLeftResult) { swapTarget = rightIdx; } } } } if (swapTarget != BHEAP_INVALID_NODE) { bHeap_Swap(ctx, nodeIdx, swapTarget); bHeap_DownHeap(ctx, swapTarget); } } } static void bHeap_Add(BHeap_Ctx* const ctx, const BHEAP_VAL_TYPE val) { ctx->node[ctx->size].val = val; ctx->size++; if (ctx->notifyNodeChange != NULL) { const size_t node = ctx->size - 1; ctx->notifyNodeChange(ctx, 1, &node); } bHeap_UpHeap(ctx, ctx->size - 1); } static void bHeap_RemoveTop(BHeap_Ctx* const ctx) { if (ctx->size == 0) { return; } if (ctx->size == 1) { ctx->size--; return; } ctx->node[0].val = ctx->node[ctx->size - 1].val; if (ctx->notifyNodeChange != NULL) { const size_t node = 0; ctx->notifyNodeChange(ctx, 1, &node); } ctx->size--; bHeap_DownHeap(ctx, 0); } static void bHeap_RemoveNode(BHeap_Ctx* const ctx, const size_t node) { if (node == ctx->size - 1) { ctx->size--; } else { ctx->node[node].val = ctx->node[ctx->size - 1].val; ctx->size--; if (ctx->notifyNodeChange != NULL) { ctx->notifyNodeChange(ctx, 1, &node); } bHeap_DownHeap(ctx, node); bHeap_UpHeap(ctx, node); } } static BHEAP_VAL_TYPE* bHeap_GetTopVal(const BHeap_Ctx* const ctx) { return ctx->size == 0 ? NULL : &(ctx->node[0].val); } typedef struct { uint64_t cnt; size_t* child; size_t numChild; size_t maxNumChild; } Tree_Node; #define TREE_INIT_ALLOC (128) static Tree_Node tree_Node[200000]; static void tree_Init(const uint64_t N) { for (uint64_t i = 0; i < N; i++) { tree_Node[i].cnt = 0; tree_Node[i].numChild = 0; tree_Node[i].child = malloc(sizeof(size_t) * TREE_INIT_ALLOC); tree_Node[i].maxNumChild = TREE_INIT_ALLOC; } } static void tree_AddChild(const size_t parent, const size_t child) { if (tree_Node[parent].maxNumChild <= tree_Node[parent].numChild) { tree_Node[parent].child = realloc(tree_Node[parent].child, sizeof(size_t) * tree_Node[parent].maxNumChild * 2); tree_Node[parent].maxNumChild *= 2; } tree_Node[parent].child[tree_Node[parent].numChild] = child; tree_Node[parent].numChild++; } static BHeap_Node BN_Asc[200000]; static BHeap_Node BN_Desc[200000]; static int _bHeap_Compare_Asc(const BHEAP_VAL_TYPE* parent, const BHEAP_VAL_TYPE* node) { return parent->val <= node->val ? -1 : 1; } static int _bHeap_Compare_Desc(const BHEAP_VAL_TYPE* parent, const BHEAP_VAL_TYPE* node) { return parent->val >= node->val ? -1 : 1; } static size_t PBHeap_Asc_Idx[200000]; static size_t PBHeap_Desc_Idx[200000]; static void _bHeap_NotifyNodeChange_Asc(const BHeap_Ctx* const ctx, const size_t nodeListSize, const size_t* const nodeList) { for (size_t i = 0; i < nodeListSize; i++) { PBHeap_Asc_Idx[ctx->node[nodeList[i]].val.val] = nodeList[i]; } } static void _bHeap_NotifyNodeChange_Desc(const BHeap_Ctx* const ctx, const size_t nodeListSize, const size_t* const nodeList) { for (size_t i = 0; i < nodeListSize; i++) { PBHeap_Desc_Idx[ctx->node[nodeList[i]].val.val] = nodeList[i]; } } #define UF_ROOT ((size_t)10000000) typedef struct { size_t parent; uint64_t w; uint64_t v; uint64_t wSum; uint64_t vSum; } UF_Node; static UF_Node uf_Node[101]; static size_t uf_GetRoot(const size_t idx) { if (uf_Node[idx].parent == UF_ROOT) { return idx; } const size_t root = uf_GetRoot(uf_Node[idx].parent); uf_Node[idx].parent = root; return root; } static void uf_Merge(const size_t a, const size_t b) { const size_t aRoot = uf_GetRoot(a); const size_t bRoot = uf_GetRoot(b); if (aRoot != bRoot) { uf_Node[aRoot].parent = bRoot; uf_Node[bRoot].wSum += uf_Node[aRoot].wSum; uf_Node[bRoot].vSum += uf_Node[aRoot].vSum; } } static void sha1(const char* str, uint64_t len, uint32_t* hash) { if (len == 0) { len = (uint64_t)strlen(str); } uint32_t h[5] = { 0x67452301 ,0xEFCDAB89 ,0x98BADCFE ,0x10325476 ,0xC3D2E1F0 }; uint32_t w[80]; for (uint64_t i = 0; i < 16; i++) { w[i] = 0; } for (uint64_t i = 0; i < len; i++) { w[i / 4] |= (uint32_t)(str[i]) << ((i % 4) * 8); } w[15] = (uint32_t)len * 8; for (uint64_t i = 16; i < 80; i++) { const uint32_t v = w[i - 3] ^ w[i - 8] ^ w[i - 14] ^ w[i - 16]; w[i] = (v << 1) | (v >> 31); } uint32_t a = h[0]; uint32_t b = h[1]; uint32_t c = h[2]; uint32_t d = h[3]; uint32_t e = h[4]; for (uint64_t i = 0; i < 80; i++) { uint32_t f = 0; uint32_t k = 0; if (i < 20) { f = (a & b) | (~b & d); k = 0x5A827999; } else if (i < 40) { f = b ^ c ^ d; k = 0x6ED9EBA1; } else if (i < 60) { f = (b & c) | (b & d) | (c & d); k = 0x8F1BBCDC; } else { f = b ^ c ^ d; k = 0xCA62C1D6; } const uint32_t t = ((a << 5) | (a >> 27)) + f + e + k + w[i]; e = d; d = c; c = (b << 30) | (b >> 2); b = a; a = t; } h[0] = h[0] + a; h[1] = h[1] + b; h[2] = h[2] + c; h[3] = h[3] + d; h[4] = h[4] + e; hash[4] = h[0]; hash[3] = h[1]; hash[2] = h[2]; hash[1] = h[3]; hash[0] = h[4]; } #define MOD_VAL (UINT64_C(1000000007)) typedef struct { uint64_t strListSize; char str[10][11]; } HMap; static HMap hMap[1000000]; #define M_PI (3.1415926535898) int main(void) { uint64_t A, B, H, M; scanf("%"PRIu64"%"PRIu64"%"PRIu64"%"PRIu64, &A, &B, &H, &M); const double Ax = (double)A * sin(((double)H / 6 + (double)M / 360) * M_PI); const double Ay = (double)A * cos(((double)H / 6 + (double)M / 360) * M_PI); const double Bx = (double)B * sin(((double)M / 30) * M_PI); const double By = (double)B * cos(((double)M / 30) * M_PI); printf("%.12lf\n", sqrt((Bx - Ax) * (Bx - Ax) + (By - Ay) * (By - Ay))); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_171860/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_171860/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"%lu%lu%lu%lu\00", align 1 @.str.1 = private unnamed_addr constant [8 x i8] c"%.12lf\0A\00", align 1 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @compare_sz_asc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 { entry: %0 = load i64, ptr %a, align 8, !tbaa !5 %1 = load i64, ptr %b, align 8, !tbaa !5 %cmp = icmp ult i64 %0, %1 %cond = select i1 %cmp, i32 -1, i32 1 ret i32 %cond } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @compare_sz_desc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 { entry: %0 = load i64, ptr %a, align 8, !tbaa !5 %1 = load i64, ptr %b, align 8, !tbaa !5 %cmp = icmp ugt i64 %0, %1 %cond = select i1 %cmp, i32 -1, i32 1 ret i32 %cond } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @compare_i64_asc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 { entry: %0 = load i64, ptr %a, align 8, !tbaa !5 %1 = load i64, ptr %b, align 8, !tbaa !5 %cmp = icmp slt i64 %0, %1 %cond = select i1 %cmp, i32 -1, i32 1 ret i32 %cond } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @compare_i64_desc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 { entry: %0 = load i64, ptr %a, align 8, !tbaa !5 %1 = load i64, ptr %b, align 8, !tbaa !5 %cmp = icmp sgt i64 %0, %1 %cond = select i1 %cmp, i32 -1, i32 1 ret i32 %cond } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @compare_u64_asc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 { entry: %0 = load i64, ptr %a, align 8, !tbaa !5 %1 = load i64, ptr %b, align 8, !tbaa !5 %cmp = icmp ult i64 %0, %1 %cond = select i1 %cmp, i32 -1, i32 1 ret i32 %cond } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @compare_u64_desc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 { entry: %0 = load i64, ptr %a, align 8, !tbaa !5 %1 = load i64, ptr %b, align 8, !tbaa !5 %cmp = icmp ugt i64 %0, %1 %cond = select i1 %cmp, i32 -1, i32 1 ret i32 %cond } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @compare_c_asc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 { entry: %0 = load i8, ptr %a, align 1, !tbaa !9 %1 = load i8, ptr %b, align 1, !tbaa !9 %cmp = icmp slt i8 %0, %1 %cond = select i1 %cmp, i32 -1, i32 1 ret i32 %cond } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @compare_c_desc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 { entry: %0 = load i8, ptr %a, align 1, !tbaa !9 %1 = load i8, ptr %b, align 1, !tbaa !9 %cmp = icmp sgt i8 %0, %1 %cond = select i1 %cmp, i32 -1, i32 1 ret i32 %cond } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @compare_dp_asc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 { entry: %0 = load double, ptr %a, align 8, !tbaa !10 %1 = load double, ptr %b, align 8, !tbaa !10 %cmp = fcmp olt double %0, %1 %cond = select i1 %cmp, i32 -1, i32 1 ret i32 %cond } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %A = alloca i64, align 8 %B = alloca i64, align 8 %H = alloca i64, align 8 %M = 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 %H) #7 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %M) #7 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B, ptr noundef nonnull %H, ptr noundef nonnull %M) %0 = load i64, ptr %A, align 8, !tbaa !5 %conv = uitofp i64 %0 to double %1 = load i64, ptr %H, align 8, !tbaa !5 %2 = load i64, ptr %M, align 8, !tbaa !5 %3 = insertelement <2 x i64> poison, i64 %1, i64 0 %4 = insertelement <2 x i64> %3, i64 %2, i64 1 %5 = uitofp <2 x i64> %4 to <2 x double> %6 = fdiv <2 x double> %5, <double 6.000000e+00, double 3.600000e+02> %shift = shufflevector <2 x double> %6, <2 x double> poison, <2 x i32> <i32 1, i32 poison> %7 = fadd <2 x double> %6, %shift %add = extractelement <2 x double> %7, i64 0 %mul = fmul double %add, 0x400921FB54442D28 %call4 = call double @sin(double noundef %mul) #7 %mul5 = fmul double %call4, %conv %8 = load i64, ptr %A, align 8, !tbaa !5 %conv6 = uitofp i64 %8 to double %9 = load i64, ptr %H, align 8, !tbaa !5 %10 = load i64, ptr %M, align 8, !tbaa !5 %11 = insertelement <2 x i64> poison, i64 %9, i64 0 %12 = insertelement <2 x i64> %11, i64 %10, i64 1 %13 = uitofp <2 x i64> %12 to <2 x double> %14 = fdiv <2 x double> %13, <double 6.000000e+00, double 3.600000e+02> %shift38 = shufflevector <2 x double> %14, <2 x double> poison, <2 x i32> <i32 1, i32 poison> %15 = fadd <2 x double> %14, %shift38 %add11 = extractelement <2 x double> %15, i64 0 %mul12 = fmul double %add11, 0x400921FB54442D28 %call13 = call double @cos(double noundef %mul12) #7 %mul14 = fmul double %call13, %conv6 %16 = load i64, ptr %B, align 8, !tbaa !5 %conv15 = uitofp i64 %16 to double %17 = load i64, ptr %M, align 8, !tbaa !5 %conv16 = uitofp i64 %17 to double %div17 = fdiv double %conv16, 3.000000e+01 %mul18 = fmul double %div17, 0x400921FB54442D28 %call19 = call double @sin(double noundef %mul18) #7 %mul20 = fmul double %call19, %conv15 %18 = load i64, ptr %B, align 8, !tbaa !5 %conv21 = uitofp i64 %18 to double %19 = load i64, ptr %M, align 8, !tbaa !5 %conv22 = uitofp i64 %19 to double %div23 = fdiv double %conv22, 3.000000e+01 %mul24 = fmul double %div23, 0x400921FB54442D28 %call25 = call double @cos(double noundef %mul24) #7 %mul26 = fmul double %call25, %conv21 %sub = fsub double %mul20, %mul5 %sub29 = fsub double %mul26, %mul14 %mul31 = fmul double %sub29, %sub29 %20 = call double @llvm.fmuladd.f64(double %sub, double %sub, double %mul31) %sqrt = call double @llvm.sqrt.f64(double %20) %call33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sqrt) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %M) #7 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %H) #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: 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 nofree nounwind willreturn memory(write) declare double @sin(double noundef) local_unnamed_addr #4 ; Function Attrs: mustprogress nofree nounwind willreturn memory(write) declare double @cos(double noundef) local_unnamed_addr #4 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) declare double @llvm.fmuladd.f64(double, double, double) #5 ; 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 double @llvm.sqrt.f64(double) #6 attributes #0 = { 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 #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 nofree nounwind willreturn memory(write) "no-trapping-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 nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!7, !7, i64 0} !10 = !{!11, !11, i64 0} !11 = !{!"double", !7, i64 0}
#include<stdio.h> int main(){ char t,s[22]; int i=0,j; fgets(s,21,stdin); while(s[i]!='\0')i++; for(j=0;j*2<i;j++){ t=s[j]; s[j]=s[i-j-1]; s[i-j-1]=t; } printf("%s\n",s); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_171910/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_171910/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 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %s = alloca [22 x i8], align 16 call void @llvm.lifetime.start.p0(i64 22, ptr nonnull %s) #4 %0 = load ptr, ptr @stdin, align 8, !tbaa !5 %call = call ptr @fgets(ptr noundef nonnull %s, i32 noundef 21, ptr noundef %0) br label %while.cond while.cond: ; preds = %while.cond, %entry %indvars.iv35 = phi i32 [ %indvars.iv.next36, %while.cond ], [ -1, %entry ] %indvars.iv = phi i64 [ %indvars.iv.next, %while.cond ], [ 0, %entry ] %arrayidx = getelementptr inbounds [22 x i8], ptr %s, i64 0, i64 %indvars.iv %1 = load i8, ptr %arrayidx, align 1, !tbaa !9 %cmp.not = icmp eq i8 %1, 0 %indvars.iv.next = add nuw i64 %indvars.iv, 1 %indvars.iv.next36 = add i32 %indvars.iv35, 1 br i1 %cmp.not, label %for.cond.preheader, label %while.cond, !llvm.loop !10 for.cond.preheader: ; preds = %while.cond %2 = and i64 %indvars.iv, 4294967295 %cmp227.not = icmp eq i64 %2, 0 br i1 %cmp227.not, label %for.end, label %for.body.preheader for.body.preheader: ; preds = %for.cond.preheader %sext = shl i64 %indvars.iv, 32 %3 = ashr exact i64 %sext, 32 %4 = lshr i32 %indvars.iv35, 1 %5 = add nuw i32 %4, 1 %wide.trip.count = zext i32 %5 to i64 %xtraiter = and i64 %wide.trip.count, 1 %6 = icmp ult i32 %indvars.iv35, 2 br i1 %6, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new for.body.preheader.new: ; preds = %for.body.preheader %unroll_iter = and i64 %wide.trip.count, 4294967294 br label %for.body for.body: ; preds = %for.body, %for.body.preheader.new %indvars.iv30 = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next31.1, %for.body ] %niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.body ] %arrayidx5 = getelementptr inbounds [22 x i8], ptr %s, i64 0, i64 %indvars.iv30 %7 = load i8, ptr %arrayidx5, align 2, !tbaa !9 %8 = xor i64 %indvars.iv30, -1 %9 = add nsw i64 %3, %8 %arrayidx8 = getelementptr inbounds [22 x i8], ptr %s, i64 0, i64 %9 %10 = load i8, ptr %arrayidx8, align 1, !tbaa !9 store i8 %10, ptr %arrayidx5, align 2, !tbaa !9 store i8 %7, ptr %arrayidx8, align 1, !tbaa !9 %indvars.iv.next31 = or i64 %indvars.iv30, 1 %arrayidx5.1 = getelementptr inbounds [22 x i8], ptr %s, i64 0, i64 %indvars.iv.next31 %11 = load i8, ptr %arrayidx5.1, align 1, !tbaa !9 %12 = xor i64 %indvars.iv30, -2 %13 = add nsw i64 %3, %12 %arrayidx8.1 = getelementptr inbounds [22 x i8], ptr %s, i64 0, i64 %13 %14 = load i8, ptr %arrayidx8.1, align 1, !tbaa !9 store i8 %14, ptr %arrayidx5.1, align 1, !tbaa !9 store i8 %11, ptr %arrayidx8.1, align 1, !tbaa !9 %indvars.iv.next31.1 = add nuw nsw i64 %indvars.iv30, 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.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !12 for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader %indvars.iv30.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next31.1, %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 %arrayidx5.epil = getelementptr inbounds [22 x i8], ptr %s, i64 0, i64 %indvars.iv30.unr %15 = load i8, ptr %arrayidx5.epil, align 1, !tbaa !9 %16 = xor i64 %indvars.iv30.unr, -1 %17 = add nsw i64 %3, %16 %arrayidx8.epil = getelementptr inbounds [22 x i8], ptr %s, i64 0, i64 %17 %18 = load i8, ptr %arrayidx8.epil, align 1, !tbaa !9 store i8 %18, ptr %arrayidx5.epil, align 1, !tbaa !9 store i8 %15, ptr %arrayidx8.epil, align 1, !tbaa !9 br label %for.end for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %for.cond.preheader %puts = call i32 @puts(ptr nonnull dereferenceable(1) %s) call void @llvm.lifetime.end.p0(i64 22, 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 ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; 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 = !{!"any pointer", !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}
#include<stdio.h> #include<string.h> int main(void) { int i,j; char t[25]; scanf("%s",t); j=strlen(t)-1; for(j;j>=0;j--){ printf("%c",t[j]); } printf("\n"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_171961/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_171961/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 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %t = alloca [25 x i8], align 16 call void @llvm.lifetime.start.p0(i64 25, ptr nonnull %t) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t) %call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %t) #6 %0 = trunc i64 %call2 to i32 %j.011 = add i32 %0, -1 %cmp12 = icmp sgt i32 %j.011, -1 br i1 %cmp12, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %j.013 = phi i32 [ %j.0, %for.body ], [ %j.011, %entry ] %idxprom = zext i32 %j.013 to i64 %arrayidx = getelementptr inbounds [25 x i8], ptr %t, i64 0, i64 %idxprom %1 = load i8, ptr %arrayidx, align 1, !tbaa !5 %conv4 = sext i8 %1 to i32 %putchar10 = call i32 @putchar(i32 %conv4) %j.0 = add nsw i32 %j.013, -1 %cmp.not = icmp eq i32 %j.013, 0 br i1 %cmp.not, label %for.end, label %for.body, !llvm.loop !8 for.end: ; preds = %for.body, %entry %putchar = call i32 @putchar(i32 10) call void @llvm.lifetime.end.p0(i64 25, 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 = !{!"omnipotent char", !7, i64 0} !7 = !{!"Simple C/C++ TBAA"} !8 = distinct !{!8, !9} !9 = !{!"llvm.loop.mustprogress"}
// 20151014 // ??????????????§??????. ?£??????§??????????????¨?????¬???????£??????????????????¶????????\???. #include<stdio.h> #include<string.h> int main() { int i; int count;; char st[200]; // 20 ????????¨ /* ?????????????????? */ fgets(st, sizeof(st), stdin); /*???????????????????????¨??? */ for (i = strlen(st) - 2; i >= 0; i --) { // -2 ???, ???????????? `\0` ??¨ ???????????? `\n` ????????? printf("%c", st[i]); } printf("\n"); /* ?????? */ return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_172003/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_172003/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 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %st = alloca [200 x i8], align 16 call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %st) #5 %0 = load ptr, ptr @stdin, align 8, !tbaa !5 %call = call ptr @fgets(ptr noundef nonnull %st, i32 noundef 200, ptr noundef %0) %call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %st) #6 %1 = trunc i64 %call2 to i32 %conv = add i32 %1, -2 %cmp10 = icmp sgt i32 %conv, -1 br i1 %cmp10, label %for.body.preheader, label %for.end for.body.preheader: ; preds = %entry %2 = zext i32 %conv to i64 br label %for.body for.body: ; preds = %for.body.preheader, %for.body %indvars.iv = phi i64 [ %2, %for.body.preheader ], [ %indvars.iv.next, %for.body ] %arrayidx = getelementptr inbounds [200 x i8], ptr %st, i64 0, i64 %indvars.iv %3 = load i8, ptr %arrayidx, align 1, !tbaa !9 %conv4 = sext i8 %3 to i32 %putchar9 = call i32 @putchar(i32 %conv4) %indvars.iv.next = add nsw i64 %indvars.iv, -1 %cmp.not = icmp eq i64 %indvars.iv, 0 br i1 %cmp.not, label %for.end, label %for.body, !llvm.loop !10 for.end: ; preds = %for.body, %entry %putchar = call i32 @putchar(i32 10) call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %st) #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 ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3 ; Function Attrs: 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 = !{!"any pointer", !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(){ char a[21]; int i = 0; scanf("%s", a); i = strlen(a); i--; while(i >= 0){ printf("%c",a[i]); i--; } printf("\n"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_172054/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_172054/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 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca [21 x i8], align 16 call void @llvm.lifetime.start.p0(i64 21, 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 %cmp12 = icmp sgt i32 %conv, 0 br i1 %cmp12, label %while.body.preheader, label %while.end while.body.preheader: ; preds = %entry %0 = and i64 %call2, 4294967295 br label %while.body while.body: ; preds = %while.body.preheader, %while.body %indvars.iv = phi i64 [ %0, %while.body.preheader ], [ %indvars.iv.next, %while.body ] %indvars.iv.next = add nsw i64 %indvars.iv, -1 %idxprom = and i64 %indvars.iv.next, 4294967295 %arrayidx = getelementptr inbounds [21 x i8], ptr %a, i64 0, i64 %idxprom %1 = load i8, ptr %arrayidx, align 1, !tbaa !5 %conv4 = sext i8 %1 to i32 %putchar11 = call i32 @putchar(i32 %conv4) %cmp = icmp ugt i64 %indvars.iv, 1 br i1 %cmp, label %while.body, label %while.end, !llvm.loop !8 while.end: ; preds = %while.body, %entry %putchar = call i32 @putchar(i32 10) call void @llvm.lifetime.end.p0(i64 21, 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: 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 = !{!"omnipotent char", !7, i64 0} !7 = !{!"Simple C/C++ TBAA"} !8 = distinct !{!8, !9} !9 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #include <string.h> int main(void) { char buf[21] = {0}; int i, len; scanf("%s", buf); len = strlen(buf); for (i = 1; i <= len; ++i) { putchar(buf[len - i]); } putchar('\n'); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_172098/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_172098/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 @stdout = external local_unnamed_addr global ptr, align 8 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %buf = alloca [21 x i8], align 16 call void @llvm.lifetime.start.p0(i64 21, ptr nonnull %buf) #5 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(21) %buf, i8 0, i64 21, i1 false) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %buf) %call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %buf) #6 %conv = trunc i64 %call2 to i32 %cmp.not11 = icmp slt i32 %conv, 1 br i1 %cmp.not11, label %for.end, label %for.body.preheader for.body.preheader: ; preds = %entry %sext = shl i64 %call2, 32 %0 = ashr exact i64 %sext, 32 %1 = add i64 %call2, 1 %wide.trip.count = and i64 %1, 4294967295 br label %for.body for.body: ; preds = %for.body.preheader, %for.body %indvars.iv = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next, %for.body ] %2 = sub nsw i64 %0, %indvars.iv %arrayidx = getelementptr inbounds [21 x i8], ptr %buf, i64 0, i64 %2 %3 = load i8, ptr %arrayidx, align 1, !tbaa !5 %conv4 = sext i8 %3 to i32 %4 = load ptr, ptr @stdout, align 8, !tbaa !8 %call.i = call i32 @putc(i32 noundef %conv4, ptr noundef %4) %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 !10 for.end: ; preds = %for.body, %entry %5 = load ptr, ptr @stdout, align 8, !tbaa !8 %call.i10 = call i32 @putc(i32 noundef 10, ptr noundef %5) call void @llvm.lifetime.end.p0(i64 21, ptr nonnull %buf) #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: mustprogress nofree nounwind willreturn memory(argmem: read) declare i64 @strlen(ptr nocapture noundef) 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 ; Function Attrs: nofree nounwind declare noundef i32 @putc(i32 noundef, ptr nocapture 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 = { 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 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 #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 = !{!"omnipotent char", !7, i64 0} !7 = !{!"Simple C/C++ TBAA"} !8 = !{!9, !9, i64 0} !9 = !{!"any pointer", !6, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"}
#include<stdio.h> #include<string.h> int main() { char str[ 64 ] ; scanf( "%s" ,str ) ; int i = strlen( str ) ; while( i-- ) { printf( "%c" ,str[ i ] ) ; } puts( "" ) ; return 0 ; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_172140/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_172140/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 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %str = alloca [64 x i8], align 16 call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %str) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str) %call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #6 %0 = and i64 %call2, 4294967295 %tobool.not8 = icmp eq i64 %0, 0 br i1 %tobool.not8, label %while.end, label %while.body.preheader while.body.preheader: ; preds = %entry %sext = shl i64 %call2, 32 %1 = ashr exact i64 %sext, 32 br label %while.body while.body: ; preds = %while.body.preheader, %while.body %indvars.iv = phi i64 [ %1, %while.body.preheader ], [ %indvars.iv.next, %while.body ] %indvars.iv.next = add nsw i64 %indvars.iv, -1 %arrayidx = getelementptr inbounds [64 x i8], ptr %str, i64 0, i64 %indvars.iv.next %2 = load i8, ptr %arrayidx, align 1, !tbaa !5 %conv3 = sext i8 %2 to i32 %putchar7 = call i32 @putchar(i32 %conv3) %3 = and i64 %indvars.iv.next, 4294967295 %tobool.not = icmp eq i64 %3, 0 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !8 while.end: ; preds = %while.body, %entry %putchar = call i32 @putchar(i32 10) call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %str) #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 = !{!"omnipotent char", !7, i64 0} !7 = !{!"Simple C/C++ TBAA"} !8 = distinct !{!8, !9} !9 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #include <string.h> int main(void){ char str[21]; int i; scanf("%s",str); i=strlen(str)-1; for(;i>=0;i--) { printf("%c",str[i]); } printf("\n"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_172191/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_172191/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 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %str = alloca [21 x i8], align 16 call void @llvm.lifetime.start.p0(i64 21, ptr nonnull %str) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str) %call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #6 %0 = trunc i64 %call2 to i32 %i.010 = add i32 %0, -1 %cmp11 = icmp sgt i32 %i.010, -1 br i1 %cmp11, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %i.012 = phi i32 [ %i.0, %for.body ], [ %i.010, %entry ] %idxprom = zext i32 %i.012 to i64 %arrayidx = getelementptr inbounds [21 x i8], ptr %str, i64 0, i64 %idxprom %1 = load i8, ptr %arrayidx, align 1, !tbaa !5 %conv4 = sext i8 %1 to i32 %putchar9 = call i32 @putchar(i32 %conv4) %i.0 = add nsw i32 %i.012, -1 %cmp.not = icmp eq i32 %i.012, 0 br i1 %cmp.not, label %for.end, label %for.body, !llvm.loop !8 for.end: ; preds = %for.body, %entry %putchar = call i32 @putchar(i32 10) call void @llvm.lifetime.end.p0(i64 21, ptr nonnull %str) #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 = !{!"omnipotent char", !7, i64 0} !7 = !{!"Simple C/C++ TBAA"} !8 = distinct !{!8, !9} !9 = !{!"llvm.loop.mustprogress"}
#include<stdio.h> #include<string.h> int main(void){ int i; char str[32]; fgets(str,sizeof(str)/sizeof(char),stdin); for(i=strlen(str)-2;i>=0;i--) putchar(str[i]); putchar('\n'); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_172306/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_172306/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 @stdout = external local_unnamed_addr global ptr, align 8 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %str = alloca [32 x i8], align 16 call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %str) #4 %0 = load ptr, ptr @stdin, align 8, !tbaa !5 %call = call ptr @fgets(ptr noundef nonnull %str, i32 noundef 32, ptr noundef %0) %call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #5 %1 = trunc i64 %call2 to i32 %conv = add i32 %1, -2 %cmp10 = icmp sgt i32 %conv, -1 br i1 %cmp10, label %for.body.preheader, label %for.end for.body.preheader: ; preds = %entry %2 = zext i32 %conv to i64 br label %for.body for.body: ; preds = %for.body.preheader, %for.body %indvars.iv = phi i64 [ %2, %for.body.preheader ], [ %indvars.iv.next, %for.body ] %arrayidx = getelementptr inbounds [32 x i8], ptr %str, i64 0, i64 %indvars.iv %3 = load i8, ptr %arrayidx, align 1, !tbaa !9 %conv4 = sext i8 %3 to i32 %4 = load ptr, ptr @stdout, align 8, !tbaa !5 %call.i = call i32 @putc(i32 noundef %conv4, ptr noundef %4) %indvars.iv.next = add nsw i64 %indvars.iv, -1 %cmp.not = icmp eq i64 %indvars.iv, 0 br i1 %cmp.not, label %for.end, label %for.body, !llvm.loop !10 for.end: ; preds = %for.body, %entry %5 = load ptr, ptr @stdout, align 8, !tbaa !5 %call.i9 = call i32 @putc(i32 noundef 10, ptr noundef %5) call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %str) #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 ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3 ; Function Attrs: 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 = { 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 = { nounwind } attributes #5 = { 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 = !{!"any pointer", !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 main(){ int n; scanf("%d",&n); int arr[n],i; for(i=0;i<n;i++) scanf("%d",&arr[i]); if(n<3){ printf("%d\n",n); return 0; } int a=arr[0],b=arr[1],count=2,max=2; for(i=2;i<n;i++) { if(arr[i]==a+b){ count++; if(max<count) max=count; } else count=2; a=arr[i-1]; b=arr[i]; } printf("%d\n",max); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_17235/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_17235/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 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 %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 %cmp38 = icmp sgt i32 %3, 0 br i1 %cmp38, label %for.body, label %cleanup 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 %cmp2 = icmp slt i32 %4, 3 br i1 %cmp2, label %cleanup, label %if.end if.end: ; preds = %for.end %arrayidx5 = getelementptr inbounds i32, ptr %vla, i64 1 %wide.trip.count = zext i32 %4 to i64 %b.0.pre = load i32, ptr %arrayidx5, align 4, !tbaa !5 %invariant.gep = getelementptr i32, ptr %vla, i64 -1 %xtraiter = and i64 %wide.trip.count, 1 %6 = icmp eq i32 %4, 3 br i1 %6, label %cleanup.loopexit.unr-lcssa, label %if.end.new if.end.new: ; preds = %if.end %7 = and i64 %wide.trip.count, 4294967294 %8 = add nsw i64 %7, -4 br label %for.body8 for.body8: ; preds = %for.body8, %if.end.new %b.0 = phi i32 [ %b.0.pre, %if.end.new ], [ %10, %for.body8 ] %indvars.iv47 = phi i64 [ 2, %if.end.new ], [ %indvars.iv.next48.1, %for.body8 ] %max.044 = phi i32 [ 2, %if.end.new ], [ %max.1.1, %for.body8 ] %count.043 = phi i32 [ 2, %if.end.new ], [ %count.1.1, %for.body8 ] %a.0.in41 = phi ptr [ %vla, %if.end.new ], [ %gep.1, %for.body8 ] %niter = phi i64 [ 0, %if.end.new ], [ %niter.next.1, %for.body8 ] %a.0 = load i32, ptr %a.0.in41, align 4, !tbaa !5 %arrayidx10 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv47 %9 = load i32, ptr %arrayidx10, align 8, !tbaa !5 %add = add nsw i32 %a.0, %b.0 %cmp11 = icmp eq i32 %9, %add %inc13 = add nsw i32 %count.043, 1 %cmp14.not = icmp sgt i32 %max.044, %count.043 %spec.select = select i1 %cmp14.not, i32 %max.044, i32 %inc13 %count.1 = select i1 %cmp11, i32 %inc13, i32 2 %max.1 = select i1 %cmp11, i32 %spec.select, i32 %max.044 %gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv47 %indvars.iv.next48 = or i64 %indvars.iv47, 1 %a.0.1 = load i32, ptr %gep, align 4, !tbaa !5 %arrayidx10.1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next48 %10 = load i32, ptr %arrayidx10.1, align 4, !tbaa !5 %add.1 = add nsw i32 %a.0.1, %9 %cmp11.1 = icmp eq i32 %10, %add.1 %inc13.1 = add nsw i32 %count.1, 1 %cmp14.not.1 = icmp sgt i32 %max.1, %count.1 %spec.select.1 = select i1 %cmp14.not.1, i32 %max.1, i32 %inc13.1 %count.1.1 = select i1 %cmp11.1, i32 %inc13.1, i32 2 %max.1.1 = select i1 %cmp11.1, i32 %spec.select.1, i32 %max.1 %gep.1 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next48 %indvars.iv.next48.1 = add nuw nsw i64 %indvars.iv47, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter, %8 br i1 %niter.ncmp.1, label %cleanup.loopexit.unr-lcssa, label %for.body8, !llvm.loop !11 cleanup.loopexit.unr-lcssa: ; preds = %for.body8, %if.end %max.1.lcssa.ph = phi i32 [ undef, %if.end ], [ %max.1.1, %for.body8 ] %b.0.unr = phi i32 [ %b.0.pre, %if.end ], [ %10, %for.body8 ] %indvars.iv47.unr = phi i64 [ 2, %if.end ], [ %indvars.iv.next48.1, %for.body8 ] %max.044.unr = phi i32 [ 2, %if.end ], [ %max.1.1, %for.body8 ] %count.043.unr = phi i32 [ 2, %if.end ], [ %count.1.1, %for.body8 ] %a.0.in41.unr = phi ptr [ %vla, %if.end ], [ %gep.1, %for.body8 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %cleanup, label %for.body8.epil for.body8.epil: ; preds = %cleanup.loopexit.unr-lcssa %a.0.epil = load i32, ptr %a.0.in41.unr, align 4, !tbaa !5 %arrayidx10.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv47.unr %11 = load i32, ptr %arrayidx10.epil, align 4, !tbaa !5 %add.epil = add nsw i32 %a.0.epil, %b.0.unr %cmp11.epil = icmp eq i32 %11, %add.epil %inc13.epil = add nsw i32 %count.043.unr, 1 %cmp14.not.epil = icmp sgt i32 %max.044.unr, %count.043.unr %spec.select.epil = select i1 %cmp14.not.epil, i32 %max.044.unr, i32 %inc13.epil %max.1.epil = select i1 %cmp11.epil, i32 %spec.select.epil, i32 %max.044.unr br label %cleanup cleanup: ; preds = %for.body8.epil, %cleanup.loopexit.unr-lcssa, %for.end, %entry %max.1.lcssa.sink = phi i32 [ %4, %for.end ], [ %3, %entry ], [ %max.1.lcssa.ph, %cleanup.loopexit.unr-lcssa ], [ %max.1.epil, %for.body8.epil ] %call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %max.1.lcssa.sink) call void @llvm.stackrestore.p0(ptr %2) 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 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 = { 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 <string.h> int main() { char str[21]; int i, leng; scanf("%s", str); leng=strlen(str); for( i=leng-1; i>=0; i-- ){ printf("%c", str[i]); } printf("\n"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_172393/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_172393/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 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %str = alloca [21 x i8], align 16 call void @llvm.lifetime.start.p0(i64 21, ptr nonnull %str) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str) %call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #6 %conv = trunc i64 %call2 to i32 %cmp10 = icmp sgt i32 %conv, 0 br i1 %cmp10, label %for.body.preheader, label %for.end for.body.preheader: ; preds = %entry %0 = and i64 %call2, 4294967295 br label %for.body for.body: ; preds = %for.body.preheader, %for.body %indvars.iv = phi i64 [ %0, %for.body.preheader ], [ %indvars.iv.next, %for.body ] %indvars.iv.next = add nsw i64 %indvars.iv, -1 %idxprom = and i64 %indvars.iv.next, 4294967295 %arrayidx = getelementptr inbounds [21 x i8], ptr %str, i64 0, i64 %idxprom %1 = load i8, ptr %arrayidx, align 1, !tbaa !5 %conv4 = sext i8 %1 to i32 %putchar9 = call i32 @putchar(i32 %conv4) %cmp = icmp ugt i64 %indvars.iv, 1 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !8 for.end: ; preds = %for.body, %entry %putchar = call i32 @putchar(i32 10) call void @llvm.lifetime.end.p0(i64 21, ptr nonnull %str) #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 = !{!"omnipotent char", !7, i64 0} !7 = !{!"Simple C/C++ TBAA"} !8 = distinct !{!8, !9} !9 = !{!"llvm.loop.mustprogress"}
#include<stdio.h> #include<string.h> #include<stdlib.h> int main(){ char str[22]; char t[25]; int i,j,k; scanf("%s",str); k=strlen(str); for(i=k-1,j=0;i>=0;i--,j++){ t[j]=str[i]; } t[j]='\0'; printf("%s\n",t); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_172458/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_172458/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 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %str = alloca [22 x i8], align 16 %t = alloca [25 x i8], align 16 call void @llvm.lifetime.start.p0(i64 22, ptr nonnull %str) #5 call void @llvm.lifetime.start.p0(i64 25, ptr nonnull %t) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str) %call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #6 %conv = trunc i64 %call2 to i32 %cmp14 = icmp sgt i32 %conv, 0 br i1 %cmp14, label %iter.check, label %for.end iter.check: ; preds = %entry %0 = and i64 %call2, 4294967295 %min.iters.check = icmp ult i64 %0, 8 br i1 %min.iters.check, label %for.body.preheader, label %vector.scevcheck vector.scevcheck: ; preds = %iter.check %1 = add nsw i64 %0, -1 %2 = add i32 %conv, -1 %3 = trunc i64 %1 to i32 %4 = icmp ult i32 %2, %3 %5 = icmp ugt i64 %1, 4294967295 %6 = or i1 %4, %5 br i1 %6, label %for.body.preheader, label %vector.main.loop.iter.check vector.main.loop.iter.check: ; preds = %vector.scevcheck %min.iters.check22 = icmp ult i64 %0, 32 br i1 %min.iters.check22, label %vec.epilog.ph, label %vector.ph vector.ph: ; preds = %vector.main.loop.iter.check %n.mod.vf = and i64 %call2, 31 %n.vec = sub nsw i64 %0, %n.mod.vf br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %7 = xor i64 %index, -1 %8 = add i64 %call2, %7 %9 = and i64 %8, 4294967295 %10 = getelementptr inbounds [22 x i8], ptr %str, i64 0, i64 %9 %11 = getelementptr inbounds i8, ptr %10, i64 -15 %wide.load = load <16 x i8>, ptr %11, align 1, !tbaa !5 %reverse = shufflevector <16 x i8> %wide.load, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0> %12 = getelementptr inbounds i8, ptr %10, i64 -31 %wide.load23 = load <16 x i8>, ptr %12, align 1, !tbaa !5 %reverse24 = shufflevector <16 x i8> %wide.load23, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0> %13 = getelementptr inbounds [25 x i8], ptr %t, i64 0, i64 %index store <16 x i8> %reverse, ptr %13, align 16, !tbaa !5 %14 = getelementptr inbounds i8, ptr %13, i64 16 store <16 x i8> %reverse24, ptr %14, align 16, !tbaa !5 %index.next = add nuw i64 %index, 32 %15 = icmp eq i64 %index.next, %n.vec br i1 %15, label %middle.block, label %vector.body, !llvm.loop !8 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %n.mod.vf, 0 br i1 %cmp.n, label %for.end.loopexit, label %vec.epilog.iter.check vec.epilog.iter.check: ; preds = %middle.block %min.epilog.iters.check = icmp ult i64 %n.mod.vf, 8 br i1 %min.epilog.iters.check, label %for.body.preheader, label %vec.epilog.ph vec.epilog.ph: ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check %vec.epilog.resume.val = phi i64 [ %n.vec, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ] %n.mod.vf25 = and i64 %call2, 7 %n.vec26 = sub nsw i64 %0, %n.mod.vf25 %invariant.gep = getelementptr i8, ptr %str, i64 -7 br label %vec.epilog.vector.body vec.epilog.vector.body: ; preds = %vec.epilog.vector.body, %vec.epilog.ph %index30 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next34, %vec.epilog.vector.body ] %16 = xor i64 %index30, -1 %17 = add i64 %call2, %16 %18 = and i64 %17, 4294967295 %gep = getelementptr [22 x i8], ptr %invariant.gep, i64 0, i64 %18 %wide.load32 = load <8 x i8>, ptr %gep, align 1, !tbaa !5 %reverse33 = shufflevector <8 x i8> %wide.load32, <8 x i8> poison, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0> %19 = getelementptr inbounds [25 x i8], ptr %t, i64 0, i64 %index30 store <8 x i8> %reverse33, ptr %19, align 1, !tbaa !5 %index.next34 = add nuw i64 %index30, 8 %20 = icmp eq i64 %index.next34, %n.vec26 br i1 %20, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !12 vec.epilog.middle.block: ; preds = %vec.epilog.vector.body %cmp.n29 = icmp eq i64 %n.mod.vf25, 0 br i1 %cmp.n29, label %for.end.loopexit, label %for.body.preheader for.body.preheader: ; preds = %vector.scevcheck, %iter.check, %vec.epilog.iter.check, %vec.epilog.middle.block %indvars.iv17.ph = phi i64 [ 0, %iter.check ], [ 0, %vector.scevcheck ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec26, %vec.epilog.middle.block ] %indvars.iv.ph = phi i64 [ %0, %iter.check ], [ %0, %vector.scevcheck ], [ %n.mod.vf, %vec.epilog.iter.check ], [ %n.mod.vf25, %vec.epilog.middle.block ] %21 = sub i64 %call2, %indvars.iv17.ph %22 = xor i64 %indvars.iv17.ph, -1 %23 = add nsw i64 %0, %22 %xtraiter = and i64 %21, 3 %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.body.prol.loopexit, label %for.body.prol for.body.prol: ; preds = %for.body.preheader, %for.body.prol %indvars.iv17.prol = phi i64 [ %indvars.iv.next18.prol, %for.body.prol ], [ %indvars.iv17.ph, %for.body.preheader ] %indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %for.body.prol ], [ %indvars.iv.ph, %for.body.preheader ] %prol.iter = phi i64 [ %prol.iter.next, %for.body.prol ], [ 0, %for.body.preheader ] %indvars.iv.next.prol = add nsw i64 %indvars.iv.prol, -1 %idxprom.prol = and i64 %indvars.iv.next.prol, 4294967295 %arrayidx.prol = getelementptr inbounds [22 x i8], ptr %str, i64 0, i64 %idxprom.prol %24 = load i8, ptr %arrayidx.prol, align 1, !tbaa !5 %arrayidx5.prol = getelementptr inbounds [25 x i8], ptr %t, i64 0, i64 %indvars.iv17.prol store i8 %24, ptr %arrayidx5.prol, align 1, !tbaa !5 %indvars.iv.next18.prol = add nuw nsw i64 %indvars.iv17.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.body.prol.loopexit, label %for.body.prol, !llvm.loop !13 for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader %indvars.iv17.unr = phi i64 [ %indvars.iv17.ph, %for.body.preheader ], [ %indvars.iv.next18.prol, %for.body.prol ] %indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body.preheader ], [ %indvars.iv.next.prol, %for.body.prol ] %25 = icmp ult i64 %23, 3 br i1 %25, label %for.end.loopexit, label %for.body for.body: ; preds = %for.body.prol.loopexit, %for.body %indvars.iv17 = phi i64 [ %indvars.iv.next18.3, %for.body ], [ %indvars.iv17.unr, %for.body.prol.loopexit ] %indvars.iv = phi i64 [ %indvars.iv.next.3, %for.body ], [ %indvars.iv.unr, %for.body.prol.loopexit ] %indvars.iv.next = add i64 %indvars.iv, 4294967295 %idxprom = and i64 %indvars.iv.next, 4294967295 %arrayidx = getelementptr inbounds [22 x i8], ptr %str, i64 0, i64 %idxprom %26 = load i8, ptr %arrayidx, align 1, !tbaa !5 %arrayidx5 = getelementptr inbounds [25 x i8], ptr %t, i64 0, i64 %indvars.iv17 store i8 %26, ptr %arrayidx5, align 1, !tbaa !5 %indvars.iv.next18 = add nuw nsw i64 %indvars.iv17, 1 %indvars.iv.next.1 = add i64 %indvars.iv, 4294967294 %idxprom.1 = and i64 %indvars.iv.next.1, 4294967295 %arrayidx.1 = getelementptr inbounds [22 x i8], ptr %str, i64 0, i64 %idxprom.1 %27 = load i8, ptr %arrayidx.1, align 1, !tbaa !5 %arrayidx5.1 = getelementptr inbounds [25 x i8], ptr %t, i64 0, i64 %indvars.iv.next18 store i8 %27, ptr %arrayidx5.1, align 1, !tbaa !5 %indvars.iv.next18.1 = add nuw nsw i64 %indvars.iv17, 2 %indvars.iv.next.2 = add i64 %indvars.iv, 4294967293 %idxprom.2 = and i64 %indvars.iv.next.2, 4294967295 %arrayidx.2 = getelementptr inbounds [22 x i8], ptr %str, i64 0, i64 %idxprom.2 %28 = load i8, ptr %arrayidx.2, align 1, !tbaa !5 %arrayidx5.2 = getelementptr inbounds [25 x i8], ptr %t, i64 0, i64 %indvars.iv.next18.1 store i8 %28, ptr %arrayidx5.2, align 1, !tbaa !5 %indvars.iv.next18.2 = add nuw nsw i64 %indvars.iv17, 3 %indvars.iv.next.3 = add nsw i64 %indvars.iv, -4 %idxprom.3 = and i64 %indvars.iv.next.3, 4294967295 %arrayidx.3 = getelementptr inbounds [22 x i8], ptr %str, i64 0, i64 %idxprom.3 %29 = load i8, ptr %arrayidx.3, align 1, !tbaa !5 %arrayidx5.3 = getelementptr inbounds [25 x i8], ptr %t, i64 0, i64 %indvars.iv.next18.2 store i8 %29, ptr %arrayidx5.3, align 1, !tbaa !5 %indvars.iv.next18.3 = add nuw nsw i64 %indvars.iv17, 4 %exitcond.not.3 = icmp eq i64 %indvars.iv.next18.3, %0 br i1 %exitcond.not.3, label %for.end.loopexit, label %for.body, !llvm.loop !15 for.end.loopexit: ; preds = %for.body.prol.loopexit, %for.body, %vec.epilog.middle.block, %middle.block %30 = and i64 %call2, 4294967295 br label %for.end for.end: ; preds = %entry, %for.end.loopexit %j.0.lcssa = phi i64 [ %30, %for.end.loopexit ], [ 0, %entry ] %arrayidx7 = getelementptr inbounds [25 x i8], ptr %t, i64 0, i64 %j.0.lcssa store i8 0, ptr %arrayidx7, align 1, !tbaa !5 %puts = call i32 @puts(ptr nonnull dereferenceable(1) %t) call void @llvm.lifetime.end.p0(i64 25, ptr nonnull %t) #5 call void @llvm.lifetime.end.p0(i64 22, ptr nonnull %str) #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 = !{!6, !6, i64 0} !6 = !{!"omnipotent char", !7, i64 0} !7 = !{!"Simple C/C++ TBAA"} !8 = distinct !{!8, !9, !10, !11} !9 = !{!"llvm.loop.mustprogress"} !10 = !{!"llvm.loop.isvectorized", i32 1} !11 = !{!"llvm.loop.unroll.runtime.disable"} !12 = distinct !{!12, !9, !10, !11} !13 = distinct !{!13, !14} !14 = !{!"llvm.loop.unroll.disable"} !15 = distinct !{!15, !9, !10}
#include <stdio.h> #include <string.h> int main(void) { char str[21] = {0}; int i; scanf("%s", str); for (i = strlen(str) - 1; i >= 0; i--) { printf("%c", str[i]); } printf("\n"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_172508/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_172508/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 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %str = alloca [21 x i8], align 16 call void @llvm.lifetime.start.p0(i64 21, ptr nonnull %str) #6 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(21) %str, i8 0, i64 21, i1 false) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str) %call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #7 %0 = trunc i64 %call2 to i32 %i.010 = add i32 %0, -1 %cmp11 = icmp sgt i32 %i.010, -1 br i1 %cmp11, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %i.012 = phi i32 [ %i.0, %for.body ], [ %i.010, %entry ] %idxprom = zext i32 %i.012 to i64 %arrayidx = getelementptr inbounds [21 x i8], ptr %str, i64 0, i64 %idxprom %1 = load i8, ptr %arrayidx, align 1, !tbaa !5 %conv4 = sext i8 %1 to i32 %putchar9 = call i32 @putchar(i32 %conv4) %i.0 = add nsw i32 %i.012, -1 %cmp.not = icmp eq i32 %i.012, 0 br i1 %cmp.not, label %for.end, label %for.body, !llvm.loop !8 for.end: ; preds = %for.body, %entry %putchar = call i32 @putchar(i32 10) call void @llvm.lifetime.end.p0(i64 21, ptr nonnull %str) #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 nofree nounwind willreturn memory(argmem: read) declare i64 @strlen(ptr nocapture noundef) 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 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #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 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 #5 = { nofree nounwind } attributes #6 = { nounwind } attributes #7 = { 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 = !{!"omnipotent char", !7, i64 0} !7 = !{!"Simple C/C++ TBAA"} !8 = distinct !{!8, !9} !9 = !{!"llvm.loop.mustprogress"}
#include<stdio.h> #include<string.h> int main() { char c[30]; int i,ch; scanf("%s",c); ch=strlen(c); for(i=ch-1;i>=0;i--) printf("%c",c[i]); printf("\n"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_172551/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_172551/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 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %c = alloca [30 x i8], align 16 call void @llvm.lifetime.start.p0(i64 30, ptr nonnull %c) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c) %call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %c) #6 %conv = trunc i64 %call2 to i32 %cmp10 = icmp sgt i32 %conv, 0 br i1 %cmp10, label %for.body.preheader, label %for.end for.body.preheader: ; preds = %entry %0 = and i64 %call2, 4294967295 br label %for.body for.body: ; preds = %for.body.preheader, %for.body %indvars.iv = phi i64 [ %0, %for.body.preheader ], [ %indvars.iv.next, %for.body ] %indvars.iv.next = add nsw i64 %indvars.iv, -1 %idxprom = and i64 %indvars.iv.next, 4294967295 %arrayidx = getelementptr inbounds [30 x i8], ptr %c, i64 0, i64 %idxprom %1 = load i8, ptr %arrayidx, align 1, !tbaa !5 %conv4 = sext i8 %1 to i32 %putchar9 = call i32 @putchar(i32 %conv4) %cmp = icmp ugt i64 %indvars.iv, 1 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !8 for.end: ; preds = %for.body, %entry %putchar = call i32 @putchar(i32 10) call void @llvm.lifetime.end.p0(i64 30, ptr nonnull %c) #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 = !{!"omnipotent char", !7, i64 0} !7 = !{!"Simple C/C++ TBAA"} !8 = distinct !{!8, !9} !9 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #include <string.h> void reverse(char str[]) { int i, j; char ch; int length = strlen(str); for (i = 0, j = length - 1; i < j; i++, j--) { ch = str[i]; str[i] = str[j]; str[j] = ch; } } int main(void) { char str[20 + 1]; scanf("%s", str); reverse(str); printf("%s\n", str); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_172595/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_172595/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 ; Function Attrs: nofree nounwind memory(argmem: readwrite) uwtable define dso_local void @reverse(ptr nocapture noundef %str) local_unnamed_addr #0 { entry: %call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #6 %conv = trunc i64 %call to i32 %cmp19 = icmp sgt i32 %conv, 1 br i1 %cmp19, label %for.body.preheader, label %for.end for.body.preheader: ; preds = %entry %sext = shl i64 %call, 32 %0 = ashr exact i64 %sext, 32 %1 = add nsw i64 %0, -1 br label %for.body for.body: ; preds = %for.body.preheader, %for.body %indvars.iv22 = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next23, %for.body ] %indvars.iv = phi i64 [ %1, %for.body.preheader ], [ %indvars.iv.next, %for.body ] %arrayidx = getelementptr inbounds i8, ptr %str, i64 %indvars.iv22 %2 = load i8, ptr %arrayidx, align 1, !tbaa !5 %arrayidx3 = getelementptr inbounds i8, ptr %str, i64 %indvars.iv %3 = load i8, ptr %arrayidx3, align 1, !tbaa !5 store i8 %3, ptr %arrayidx, align 1, !tbaa !5 store i8 %2, ptr %arrayidx3, align 1, !tbaa !5 %indvars.iv.next23 = add nuw nsw i64 %indvars.iv22, 1 %indvars.iv.next = add nsw i64 %indvars.iv, -1 %cmp = icmp slt i64 %indvars.iv.next23, %indvars.iv.next br i1 %cmp, label %for.body, label %for.end, !llvm.loop !8 for.end: ; preds = %for.body, %entry 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 nofree nounwind willreturn memory(argmem: read) declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #3 { entry: %str = alloca [21 x i8], align 16 call void @llvm.lifetime.start.p0(i64 21, ptr nonnull %str) #7 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str) %call.i = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #6 %conv.i = trunc i64 %call.i to i32 %cmp19.i = icmp sgt i32 %conv.i, 1 br i1 %cmp19.i, label %for.body.preheader.i, label %reverse.exit for.body.preheader.i: ; preds = %entry %sext.i = shl i64 %call.i, 32 %0 = ashr exact i64 %sext.i, 32 %1 = add nsw i64 %0, -1 br label %for.body.i for.body.i: ; preds = %for.body.i, %for.body.preheader.i %indvars.iv22.i = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next23.i, %for.body.i ] %indvars.iv.i = phi i64 [ %1, %for.body.preheader.i ], [ %indvars.iv.next.i, %for.body.i ] %arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %indvars.iv22.i %2 = load i8, ptr %arrayidx.i, align 1, !tbaa !5 %arrayidx3.i = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.i %3 = load i8, ptr %arrayidx3.i, align 1, !tbaa !5 store i8 %3, ptr %arrayidx.i, align 1, !tbaa !5 store i8 %2, ptr %arrayidx3.i, align 1, !tbaa !5 %indvars.iv.next23.i = add nuw nsw i64 %indvars.iv22.i, 1 %indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1 %cmp.i = icmp slt i64 %indvars.iv.next23.i, %indvars.iv.next.i br i1 %cmp.i, label %for.body.i, label %reverse.exit, !llvm.loop !8 reverse.exit: ; preds = %for.body.i, %entry %puts = call i32 @puts(ptr nonnull dereferenceable(1) %str) call void @llvm.lifetime.end.p0(i64 21, ptr nonnull %str) #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 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5 attributes #0 = { nofree 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 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 #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 willreturn memory(read) } 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 = !{!"omnipotent char", !7, i64 0} !7 = !{!"Simple C/C++ TBAA"} !8 = distinct !{!8, !9} !9 = !{!"llvm.loop.mustprogress"}
#include<stdio.h> #define max(a,b) a>b?a:b int main() { int n; scanf("%d",&n); int a[100001]; int i; int ans=2; int max=0; for(i=0;i<n;i++) { scanf("%d",&a[i]); if(i>1) { if(a[i]==(a[i-1]+a[i-2])) ans++; else ans=2; } max=max(ans,max); } if(max==2 && n==1) max=1; printf("%d\n",max); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_17266/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_17266/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 [100001 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 400004, ptr nonnull %a) #4 %0 = load i32, ptr %n, align 4 %cmp31 = icmp sgt i32 %0, 0 br i1 %cmp31, label %if.end12.peel, label %for.end if.end12.peel: ; preds = %entry %call1.peel = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a) %1 = load i32, ptr %n, align 4 %cmp.peel = icmp sgt i32 %1, 1 br i1 %cmp.peel, label %if.end12.peel54, label %for.end.loopexit if.end12.peel54: ; preds = %if.end12.peel %arrayidx.peel42 = getelementptr inbounds [100001 x i32], ptr %a, i64 0, i64 1 %call1.peel43 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.peel42) %2 = load i32, ptr %n, align 4 %cmp.peel58 = icmp sgt i32 %2, 2 br i1 %cmp.peel58, label %if.end12, label %for.end.loopexit if.end12: ; preds = %if.end12.peel54, %if.end12 %indvars.iv = phi i64 [ %indvars.iv.next, %if.end12 ], [ 2, %if.end12.peel54 ] %max.034 = phi i32 [ %cond, %if.end12 ], [ 2, %if.end12.peel54 ] %ans.033 = phi i32 [ %spec.select, %if.end12 ], [ 2, %if.end12.peel54 ] %arrayidx = getelementptr inbounds [100001 x i32], ptr %a, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %3 = load i32, ptr %arrayidx, align 4, !tbaa !5 %4 = add nuw i64 %indvars.iv, 4294967294 %idxprom8 = and i64 %4, 4294967295 %arrayidx9 = getelementptr inbounds [100001 x i32], ptr %a, i64 0, i64 %idxprom8 %5 = load i32, ptr %arrayidx9, align 4, !tbaa !5 %6 = add nuw i64 %indvars.iv, 4294967295 %idxprom5 = and i64 %6, 4294967295 %arrayidx6 = getelementptr inbounds [100001 x i32], ptr %a, i64 0, i64 %idxprom5 %7 = load i32, ptr %arrayidx6, align 4, !tbaa !5 %add = add nsw i32 %5, %7 %cmp10 = icmp eq i32 %3, %add %inc = add nsw i32 %ans.033, 1 %spec.select = select i1 %cmp10, i32 %inc, i32 2 %cond = call i32 @llvm.smax.i32(i32 %spec.select, i32 %max.034) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %8 = load i32, ptr %n, align 4 %9 = sext i32 %8 to i64 %cmp = icmp slt i64 %indvars.iv.next, %9 br i1 %cmp, label %if.end12, label %for.end.loopexit, !llvm.loop !9 for.end.loopexit: ; preds = %if.end12, %if.end12.peel54, %if.end12.peel %cond.lcssa = phi i32 [ 2, %if.end12.peel ], [ 2, %if.end12.peel54 ], [ %cond, %if.end12 ] %.lcssa36 = phi i32 [ %1, %if.end12.peel ], [ %2, %if.end12.peel54 ], [ %8, %if.end12 ] %10 = icmp eq i32 %.lcssa36, 1 br label %for.end for.end: ; preds = %for.end.loopexit, %entry %max.0.lcssa = phi i32 [ 0, %entry ], [ %cond.lcssa, %for.end.loopexit ] %.lcssa = phi i1 [ false, %entry ], [ %10, %for.end.loopexit ] %cmp15 = icmp eq i32 %max.0.lcssa, 2 %or.cond = and i1 %cmp15, %.lcssa %spec.store.select = select i1 %or.cond, i32 1, i32 %max.0.lcssa %call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %spec.store.select) call void @llvm.lifetime.end.p0(i64 400004, 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: 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) #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, !11} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!"llvm.loop.peeled.count", i32 2}
#include <stdio.h> #include <string.h> //#include <algorithm> char map[11]; int check[10] = {0},k; int checksum(){ int i; for(i=0; i<=k; i++){ if(check[i] != 1)return 0; } return 1; } void clear(){ int i; for(i=0; i<=k; i++)check[i] = 0; } int main() { int n, i, j, count = 0; scanf("%d %d",&n,&k); for(i=0; i<n ; i++){ scanf("%s",map); // int t = strlen(map); for(j=0; j <= 11; j++){ if(map[j]==0)break; check[map[j]-'0'] = 1; } if(checksum())count++; clear(); } printf("%d\n",count); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_17271/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_17271/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" @check = dso_local local_unnamed_addr global [10 x i32] zeroinitializer, align 16 @k = dso_local global i32 0, align 4 @.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @map = dso_local global [11 x i8] zeroinitializer, align 1 @.str.2 = 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 @checksum() local_unnamed_addr #0 { entry: %0 = load i32, ptr @k, align 4, !tbaa !5 %cmp.not4 = icmp slt i32 %0, 0 br i1 %cmp.not4, label %cleanup, label %for.body.preheader for.body.preheader: ; preds = %entry %1 = add nuw i32 %0, 1 %wide.trip.count = zext i32 %1 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 %cleanup, label %for.body, !llvm.loop !9 for.body: ; preds = %for.body.preheader, %for.cond %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.cond ] %arrayidx = getelementptr inbounds [10 x i32], ptr @check, i64 0, i64 %indvars.iv %2 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp1.not = icmp eq i32 %2, 1 br i1 %cmp1.not, label %for.cond, label %cleanup cleanup: ; preds = %for.body, %for.cond, %entry %retval.0 = phi i32 [ 1, %entry ], [ 1, %for.cond ], [ 0, %for.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: mustprogress nofree nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @clear() local_unnamed_addr #2 { entry: %0 = load i32, ptr @k, align 4, !tbaa !5 %cmp.not3 = icmp slt i32 %0, 0 br i1 %cmp.not3, label %for.end, label %for.body.preheader for.body.preheader: ; preds = %entry %1 = add nuw i32 %0, 1 %2 = zext i32 %1 to i64 %3 = shl nuw nsw i64 %2, 2 tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) @check, i8 0, i64 %3, i1 false), !tbaa !5 br label %for.end for.end: ; preds = %for.body.preheader, %entry ret void } ; 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 %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 %cmp30 = icmp sgt i32 %0, 0 br i1 %cmp30, label %for.body, label %for.end18 for.body: ; preds = %entry, %clear.exit %count.032 = phi i32 [ %16, %clear.exit ], [ 0, %entry ] %i.031 = phi i32 [ %inc17, %clear.exit ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @map) %1 = load i8, ptr @map, align 1, !tbaa !11 %cmp5 = icmp eq i8 %1, 0 br i1 %cmp5, label %for.end, label %if.end if.end: ; preds = %for.body %conv = sext i8 %1 to i64 %sub = add nsw i64 %conv, -48 %arrayidx11 = getelementptr inbounds [10 x i32], ptr @check, i64 0, i64 %sub store i32 1, ptr %arrayidx11, align 4, !tbaa !5 %2 = load i8, ptr getelementptr inbounds ([11 x i8], ptr @map, i64 0, i64 1), align 1, !tbaa !11 %cmp5.1 = icmp eq i8 %2, 0 br i1 %cmp5.1, label %for.end, label %if.end.1 if.end.1: ; preds = %if.end %conv.1 = sext i8 %2 to i64 %sub.1 = add nsw i64 %conv.1, -48 %arrayidx11.1 = getelementptr inbounds [10 x i32], ptr @check, i64 0, i64 %sub.1 store i32 1, ptr %arrayidx11.1, align 4, !tbaa !5 %3 = load i8, ptr getelementptr inbounds ([11 x i8], ptr @map, i64 0, i64 2), align 1, !tbaa !11 %cmp5.2 = icmp eq i8 %3, 0 br i1 %cmp5.2, label %for.end, label %if.end.2 if.end.2: ; preds = %if.end.1 %conv.2 = sext i8 %3 to i64 %sub.2 = add nsw i64 %conv.2, -48 %arrayidx11.2 = getelementptr inbounds [10 x i32], ptr @check, i64 0, i64 %sub.2 store i32 1, ptr %arrayidx11.2, align 4, !tbaa !5 %4 = load i8, ptr getelementptr inbounds ([11 x i8], ptr @map, i64 0, i64 3), align 1, !tbaa !11 %cmp5.3 = icmp eq i8 %4, 0 br i1 %cmp5.3, label %for.end, label %if.end.3 if.end.3: ; preds = %if.end.2 %conv.3 = sext i8 %4 to i64 %sub.3 = add nsw i64 %conv.3, -48 %arrayidx11.3 = getelementptr inbounds [10 x i32], ptr @check, i64 0, i64 %sub.3 store i32 1, ptr %arrayidx11.3, align 4, !tbaa !5 %5 = load i8, ptr getelementptr inbounds ([11 x i8], ptr @map, i64 0, i64 4), align 1, !tbaa !11 %cmp5.4 = icmp eq i8 %5, 0 br i1 %cmp5.4, label %for.end, label %if.end.4 if.end.4: ; preds = %if.end.3 %conv.4 = sext i8 %5 to i64 %sub.4 = add nsw i64 %conv.4, -48 %arrayidx11.4 = getelementptr inbounds [10 x i32], ptr @check, i64 0, i64 %sub.4 store i32 1, ptr %arrayidx11.4, align 4, !tbaa !5 %6 = load i8, ptr getelementptr inbounds ([11 x i8], ptr @map, i64 0, i64 5), align 1, !tbaa !11 %cmp5.5 = icmp eq i8 %6, 0 br i1 %cmp5.5, label %for.end, label %if.end.5 if.end.5: ; preds = %if.end.4 %conv.5 = sext i8 %6 to i64 %sub.5 = add nsw i64 %conv.5, -48 %arrayidx11.5 = getelementptr inbounds [10 x i32], ptr @check, i64 0, i64 %sub.5 store i32 1, ptr %arrayidx11.5, align 4, !tbaa !5 %7 = load i8, ptr getelementptr inbounds ([11 x i8], ptr @map, i64 0, i64 6), align 1, !tbaa !11 %cmp5.6 = icmp eq i8 %7, 0 br i1 %cmp5.6, label %for.end, label %if.end.6 if.end.6: ; preds = %if.end.5 %conv.6 = sext i8 %7 to i64 %sub.6 = add nsw i64 %conv.6, -48 %arrayidx11.6 = getelementptr inbounds [10 x i32], ptr @check, i64 0, i64 %sub.6 store i32 1, ptr %arrayidx11.6, align 4, !tbaa !5 %8 = load i8, ptr getelementptr inbounds ([11 x i8], ptr @map, i64 0, i64 7), align 1, !tbaa !11 %cmp5.7 = icmp eq i8 %8, 0 br i1 %cmp5.7, label %for.end, label %if.end.7 if.end.7: ; preds = %if.end.6 %conv.7 = sext i8 %8 to i64 %sub.7 = add nsw i64 %conv.7, -48 %arrayidx11.7 = getelementptr inbounds [10 x i32], ptr @check, i64 0, i64 %sub.7 store i32 1, ptr %arrayidx11.7, align 4, !tbaa !5 %9 = load i8, ptr getelementptr inbounds ([11 x i8], ptr @map, i64 0, i64 8), align 1, !tbaa !11 %cmp5.8 = icmp eq i8 %9, 0 br i1 %cmp5.8, label %for.end, label %if.end.8 if.end.8: ; preds = %if.end.7 %conv.8 = sext i8 %9 to i64 %sub.8 = add nsw i64 %conv.8, -48 %arrayidx11.8 = getelementptr inbounds [10 x i32], ptr @check, i64 0, i64 %sub.8 store i32 1, ptr %arrayidx11.8, align 4, !tbaa !5 %10 = load i8, ptr getelementptr inbounds ([11 x i8], ptr @map, i64 0, i64 9), align 1, !tbaa !11 %cmp5.9 = icmp eq i8 %10, 0 br i1 %cmp5.9, label %for.end, label %if.end.9 if.end.9: ; preds = %if.end.8 %conv.9 = sext i8 %10 to i64 %sub.9 = add nsw i64 %conv.9, -48 %arrayidx11.9 = getelementptr inbounds [10 x i32], ptr @check, i64 0, i64 %sub.9 store i32 1, ptr %arrayidx11.9, align 4, !tbaa !5 %11 = load i8, ptr getelementptr inbounds ([11 x i8], ptr @map, i64 0, i64 10), align 1, !tbaa !11 %cmp5.10 = icmp eq i8 %11, 0 br i1 %cmp5.10, label %for.end, label %if.end.10 if.end.10: ; preds = %if.end.9 %conv.10 = sext i8 %11 to i64 %sub.10 = add nsw i64 %conv.10, -48 %arrayidx11.10 = getelementptr inbounds [10 x i32], ptr @check, i64 0, i64 %sub.10 store i32 1, ptr %arrayidx11.10, align 4, !tbaa !5 %12 = load i8, ptr getelementptr inbounds ([11 x i8], ptr @map, i64 1, i64 0), align 1, !tbaa !11 %cmp5.11 = icmp eq i8 %12, 0 br i1 %cmp5.11, label %for.end, label %if.end.11 if.end.11: ; preds = %if.end.10 %conv.11 = sext i8 %12 to i64 %sub.11 = add nsw i64 %conv.11, -48 %arrayidx11.11 = getelementptr inbounds [10 x i32], ptr @check, i64 0, i64 %sub.11 store i32 1, ptr %arrayidx11.11, align 4, !tbaa !5 br label %for.end for.end: ; preds = %if.end.11, %if.end.10, %if.end.9, %if.end.8, %if.end.7, %if.end.6, %if.end.5, %if.end.4, %if.end.3, %if.end.2, %if.end.1, %if.end, %for.body %13 = load i32, ptr @k, align 4, !tbaa !5 %cmp.not4.i = icmp slt i32 %13, 0 br i1 %cmp.not4.i, label %checksum.exit.thread, label %for.body.preheader.i for.body.preheader.i: ; preds = %for.end %14 = add nuw i32 %13, 1 %wide.trip.count.i = zext i32 %14 to i64 br label %for.body.i for.cond.i: ; preds = %for.body.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 %checksum.exit.thread, label %for.body.i, !llvm.loop !9 for.body.i: ; preds = %for.cond.i, %for.body.preheader.i %indvars.iv.i = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i, %for.cond.i ] %arrayidx.i = getelementptr inbounds [10 x i32], ptr @check, i64 0, i64 %indvars.iv.i %15 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %cmp1.not.i = icmp eq i32 %15, 1 br i1 %cmp1.not.i, label %for.cond.i, label %.loopexit checksum.exit.thread: ; preds = %for.cond.i, %for.end %inc1428 = add nsw i32 %count.032, 1 br label %.loopexit .loopexit: ; preds = %for.body.i, %checksum.exit.thread %16 = phi i32 [ %inc1428, %checksum.exit.thread ], [ %count.032, %for.body.i ] br i1 %cmp.not4.i, label %clear.exit, label %for.body.preheader.i25 for.body.preheader.i25: ; preds = %.loopexit %17 = add nuw i32 %13, 1 %18 = zext i32 %17 to i64 %19 = shl nuw nsw i64 %18, 2 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) @check, i8 0, i64 %19, i1 false), !tbaa !5 br label %clear.exit clear.exit: ; preds = %.loopexit, %for.body.preheader.i25 %inc17 = add nuw nsw i32 %i.031, 1 %20 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc17, %20 br i1 %cmp, label %for.body, label %for.end18, !llvm.loop !12 for.end18: ; preds = %clear.exit, %entry %count.0.lcssa = phi i32 [ 0, %entry ], [ %16, %clear.exit ] %call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %count.0.lcssa) 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 @printf(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 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 = { mustprogress nofree nosync nounwind willreturn memory(readwrite, 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 #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 = { 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 = !{!7, !7, i64 0} !12 = distinct !{!12, !10}
#include<stdio.h> int main(void){ int i; int n,s; int bi[10],pre_sum; int count,ans_count; for(;;){ scanf("%d%d",&n,&s); if(n==0 && s==0) break; ans_count=0; for(i=0;i<10;i++) bi[i]=0; for(;bi[9]!=2;){ count=0; for(i=0;i<10;i++) if(bi[i]==1) count++; pre_sum=0; if(count==n){ for(i=0;i<10;i++){ if(bi[i]==1) pre_sum+=i; } if(pre_sum==s) ans_count++; } bi[0]++; for(i=0;i<9;i++) if(bi[i]==2){ bi[i+1]++; bi[i]=0; } } printf("%d\n",ans_count); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_172768/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_172768/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 [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 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 %s) #3 %call87 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %s) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp88 = icmp eq i32 %0, 0 %1 = load i32, ptr %s, align 4 %cmp189 = icmp eq i32 %1, 0 %or.cond90 = select i1 %cmp88, i1 %cmp189, i1 false br i1 %or.cond90, label %for.end59, label %for.cond8.preheader.preheader for.cond8.preheader.preheader: ; preds = %entry, %for.end57 %2 = phi i32 [ %5, %for.end57 ], [ %1, %entry ] %3 = phi i32 [ %4, %for.end57 ], [ %0, %entry ] br label %for.cond8.preheader for.cond8.preheader: ; preds = %for.cond8.preheader.preheader, %for.inc54.8 %bi.sroa.0.1 = phi i32 [ 0, %for.cond8.preheader.preheader ], [ %bi.sroa.0.2155160168177189202218235, %for.inc54.8 ] %bi.sroa.8.1 = phi i32 [ 0, %for.cond8.preheader.preheader ], [ %bi.sroa.8.3161167178188203217236, %for.inc54.8 ] %bi.sroa.14.1 = phi i32 [ 0, %for.cond8.preheader.preheader ], [ %bi.sroa.14.3169176190201219234, %for.inc54.8 ] %bi.sroa.20.1 = phi i32 [ 0, %for.cond8.preheader.preheader ], [ %bi.sroa.20.3179187204216237, %for.inc54.8 ] %bi.sroa.26.1 = phi i32 [ 0, %for.cond8.preheader.preheader ], [ %bi.sroa.26.3191200220233, %for.inc54.8 ] %bi.sroa.32.1 = phi i32 [ 0, %for.cond8.preheader.preheader ], [ %bi.sroa.32.3205215238, %for.inc54.8 ] %bi.sroa.38.1 = phi i32 [ 0, %for.cond8.preheader.preheader ], [ %bi.sroa.38.3221232, %for.inc54.8 ] %bi.sroa.44.1 = phi i32 [ 0, %for.cond8.preheader.preheader ], [ %bi.sroa.44.3239, %for.inc54.8 ] %bi.sroa.50.1 = phi i32 [ 0, %for.cond8.preheader.preheader ], [ %bi.sroa.50.3, %for.inc54.8 ] %bi.sroa.56.1 = phi i32 [ 0, %for.cond8.preheader.preheader ], [ %bi.sroa.56.2, %for.inc54.8 ] %ans_count.086 = phi i32 [ 0, %for.cond8.preheader.preheader ], [ %ans_count.1, %for.inc54.8 ] %cmp13 = icmp eq i32 %bi.sroa.0.1, 1 %inc15 = zext i1 %cmp13 to i32 %cmp13.1 = icmp eq i32 %bi.sroa.8.1, 1 %inc15.1 = zext i1 %cmp13.1 to i32 %spec.select.1 = add nuw nsw i32 %inc15, %inc15.1 %cmp13.2 = icmp eq i32 %bi.sroa.14.1, 1 %inc15.2 = zext i1 %cmp13.2 to i32 %spec.select.2 = add nuw nsw i32 %spec.select.1, %inc15.2 %cmp13.3 = icmp eq i32 %bi.sroa.20.1, 1 %inc15.3 = zext i1 %cmp13.3 to i32 %spec.select.3 = add nuw nsw i32 %spec.select.2, %inc15.3 %cmp13.4 = icmp eq i32 %bi.sroa.26.1, 1 %inc15.4 = zext i1 %cmp13.4 to i32 %spec.select.4 = add nuw nsw i32 %spec.select.3, %inc15.4 %cmp13.5 = icmp eq i32 %bi.sroa.32.1, 1 %inc15.5 = zext i1 %cmp13.5 to i32 %spec.select.5 = add nuw nsw i32 %spec.select.4, %inc15.5 %cmp13.6 = icmp eq i32 %bi.sroa.38.1, 1 %inc15.6 = zext i1 %cmp13.6 to i32 %spec.select.6 = add nuw nsw i32 %spec.select.5, %inc15.6 %cmp13.7 = icmp eq i32 %bi.sroa.44.1, 1 %inc15.7 = zext i1 %cmp13.7 to i32 %spec.select.7 = add nuw nsw i32 %spec.select.6, %inc15.7 %cmp13.8 = icmp eq i32 %bi.sroa.50.1, 1 %inc15.8 = zext i1 %cmp13.8 to i32 %spec.select.8 = add nuw nsw i32 %spec.select.7, %inc15.8 %cmp13.9 = icmp eq i32 %bi.sroa.56.1, 1 %inc15.9 = zext i1 %cmp13.9 to i32 %spec.select.9 = add nuw nsw i32 %spec.select.8, %inc15.9 %cmp20 = icmp eq i32 %spec.select.9, %3 br i1 %cmp20, label %for.body24.preheader, label %if.end37 for.body24.preheader: ; preds = %for.cond8.preheader %add.1 = zext i1 %cmp13.1 to i32 %add.2 = select i1 %cmp13.2, i32 2, i32 0 %spec.select77.2 = or i32 %add.2, %add.1 %add.3 = select i1 %cmp13.3, i32 3, i32 0 %spec.select77.3 = add nuw nsw i32 %add.3, %spec.select77.2 %add.4 = select i1 %cmp13.4, i32 4, i32 0 %spec.select77.4 = add nuw nsw i32 %add.4, %spec.select77.3 %add.5 = select i1 %cmp13.5, i32 5, i32 0 %spec.select77.5 = add nuw nsw i32 %add.5, %spec.select77.4 %add.6 = select i1 %cmp13.6, i32 6, i32 0 %spec.select77.6 = add nuw nsw i32 %add.6, %spec.select77.5 %add.7 = select i1 %cmp13.7, i32 7, i32 0 %spec.select77.7 = add nuw nsw i32 %add.7, %spec.select77.6 %add.8 = select i1 %cmp13.8, i32 8, i32 0 %spec.select77.8 = add nuw nsw i32 %add.8, %spec.select77.7 %add.9 = select i1 %cmp13.9, i32 9, i32 0 %spec.select77.9 = add nuw nsw i32 %add.9, %spec.select77.8 %cmp33 = icmp eq i32 %spec.select77.9, %2 %inc35 = zext i1 %cmp33 to i32 %spec.select78 = add nsw i32 %ans_count.086, %inc35 br label %if.end37 if.end37: ; preds = %for.body24.preheader, %for.cond8.preheader %ans_count.1 = phi i32 [ %ans_count.086, %for.cond8.preheader ], [ %spec.select78, %for.body24.preheader ] %inc39 = add nsw i32 %bi.sroa.0.1, 1 %cmp45 = icmp eq i32 %inc39, 2 br i1 %cmp45, label %for.inc54, label %for.inc54.8 for.inc54: ; preds = %if.end37 %inc50 = add nsw i32 %bi.sroa.8.1, 1 %cmp45.1 = icmp eq i32 %inc50, 2 br i1 %cmp45.1, label %for.inc54.1, label %for.inc54.8 for.inc54.1: ; preds = %for.inc54 %inc50.1 = add nsw i32 %bi.sroa.14.1, 1 %cmp45.2 = icmp eq i32 %inc50.1, 2 br i1 %cmp45.2, label %for.inc54.2, label %for.inc54.8 for.inc54.2: ; preds = %for.inc54.1 %inc50.2 = add nsw i32 %bi.sroa.20.1, 1 %cmp45.3 = icmp eq i32 %inc50.2, 2 br i1 %cmp45.3, label %for.inc54.3, label %for.inc54.8 for.inc54.3: ; preds = %for.inc54.2 %inc50.3 = add nsw i32 %bi.sroa.26.1, 1 %cmp45.4 = icmp eq i32 %inc50.3, 2 br i1 %cmp45.4, label %for.inc54.4, label %for.inc54.8 for.inc54.4: ; preds = %for.inc54.3 %inc50.4 = add nsw i32 %bi.sroa.32.1, 1 %cmp45.5 = icmp eq i32 %inc50.4, 2 br i1 %cmp45.5, label %for.inc54.5, label %for.inc54.8 for.inc54.5: ; preds = %for.inc54.4 %inc50.5 = add nsw i32 %bi.sroa.38.1, 1 %cmp45.6 = icmp eq i32 %inc50.5, 2 br i1 %cmp45.6, label %for.inc54.6, label %for.inc54.8 for.inc54.6: ; preds = %for.inc54.5 %inc50.6 = add nsw i32 %bi.sroa.44.1, 1 %cmp45.7 = icmp eq i32 %inc50.6, 2 br i1 %cmp45.7, label %for.inc54.7, label %for.inc54.8 for.inc54.7: ; preds = %for.inc54.6 %inc50.7 = add nsw i32 %bi.sroa.50.1, 1 %cmp45.8 = icmp eq i32 %inc50.7, 2 %spec.select = select i1 %cmp45.8, i32 0, i32 %inc50.7 %inc50.8 = zext i1 %cmp45.8 to i32 %spec.select240 = add nsw i32 %bi.sroa.56.1, %inc50.8 br label %for.inc54.8 for.inc54.8: ; preds = %for.inc54.7, %if.end37, %for.inc54, %for.inc54.1, %for.inc54.2, %for.inc54.3, %for.inc54.4, %for.inc54.5, %for.inc54.6 %bi.sroa.44.3239 = phi i32 [ %inc50.6, %for.inc54.6 ], [ %bi.sroa.44.1, %for.inc54.5 ], [ %bi.sroa.44.1, %for.inc54.4 ], [ %bi.sroa.44.1, %for.inc54.3 ], [ %bi.sroa.44.1, %for.inc54.2 ], [ %bi.sroa.44.1, %for.inc54.1 ], [ %bi.sroa.44.1, %for.inc54 ], [ %bi.sroa.44.1, %if.end37 ], [ 0, %for.inc54.7 ] %bi.sroa.32.3205215238 = phi i32 [ 0, %for.inc54.6 ], [ 0, %for.inc54.5 ], [ %inc50.4, %for.inc54.4 ], [ %bi.sroa.32.1, %for.inc54.3 ], [ %bi.sroa.32.1, %for.inc54.2 ], [ %bi.sroa.32.1, %for.inc54.1 ], [ %bi.sroa.32.1, %for.inc54 ], [ %bi.sroa.32.1, %if.end37 ], [ 0, %for.inc54.7 ] %bi.sroa.20.3179187204216237 = phi i32 [ 0, %for.inc54.6 ], [ 0, %for.inc54.5 ], [ 0, %for.inc54.4 ], [ 0, %for.inc54.3 ], [ %inc50.2, %for.inc54.2 ], [ %bi.sroa.20.1, %for.inc54.1 ], [ %bi.sroa.20.1, %for.inc54 ], [ %bi.sroa.20.1, %if.end37 ], [ 0, %for.inc54.7 ] %bi.sroa.8.3161167178188203217236 = phi i32 [ 0, %for.inc54.6 ], [ 0, %for.inc54.5 ], [ 0, %for.inc54.4 ], [ 0, %for.inc54.3 ], [ 0, %for.inc54.2 ], [ 0, %for.inc54.1 ], [ %inc50, %for.inc54 ], [ %bi.sroa.8.1, %if.end37 ], [ 0, %for.inc54.7 ] %bi.sroa.0.2155160168177189202218235 = phi i32 [ 0, %for.inc54.6 ], [ 0, %for.inc54.5 ], [ 0, %for.inc54.4 ], [ 0, %for.inc54.3 ], [ 0, %for.inc54.2 ], [ 0, %for.inc54.1 ], [ 0, %for.inc54 ], [ %inc39, %if.end37 ], [ 0, %for.inc54.7 ] %bi.sroa.14.3169176190201219234 = phi i32 [ 0, %for.inc54.6 ], [ 0, %for.inc54.5 ], [ 0, %for.inc54.4 ], [ 0, %for.inc54.3 ], [ 0, %for.inc54.2 ], [ %inc50.1, %for.inc54.1 ], [ %bi.sroa.14.1, %for.inc54 ], [ %bi.sroa.14.1, %if.end37 ], [ 0, %for.inc54.7 ] %bi.sroa.26.3191200220233 = phi i32 [ 0, %for.inc54.6 ], [ 0, %for.inc54.5 ], [ 0, %for.inc54.4 ], [ %inc50.3, %for.inc54.3 ], [ %bi.sroa.26.1, %for.inc54.2 ], [ %bi.sroa.26.1, %for.inc54.1 ], [ %bi.sroa.26.1, %for.inc54 ], [ %bi.sroa.26.1, %if.end37 ], [ 0, %for.inc54.7 ] %bi.sroa.38.3221232 = phi i32 [ 0, %for.inc54.6 ], [ %inc50.5, %for.inc54.5 ], [ %bi.sroa.38.1, %for.inc54.4 ], [ %bi.sroa.38.1, %for.inc54.3 ], [ %bi.sroa.38.1, %for.inc54.2 ], [ %bi.sroa.38.1, %for.inc54.1 ], [ %bi.sroa.38.1, %for.inc54 ], [ %bi.sroa.38.1, %if.end37 ], [ 0, %for.inc54.7 ] %bi.sroa.50.3 = phi i32 [ %bi.sroa.50.1, %for.inc54.6 ], [ %bi.sroa.50.1, %for.inc54.5 ], [ %bi.sroa.50.1, %for.inc54.4 ], [ %bi.sroa.50.1, %for.inc54.3 ], [ %bi.sroa.50.1, %for.inc54.2 ], [ %bi.sroa.50.1, %for.inc54.1 ], [ %bi.sroa.50.1, %for.inc54 ], [ %bi.sroa.50.1, %if.end37 ], [ %spec.select, %for.inc54.7 ] %bi.sroa.56.2 = phi i32 [ %bi.sroa.56.1, %for.inc54.6 ], [ %bi.sroa.56.1, %for.inc54.5 ], [ %bi.sroa.56.1, %for.inc54.4 ], [ %bi.sroa.56.1, %for.inc54.3 ], [ %bi.sroa.56.1, %for.inc54.2 ], [ %bi.sroa.56.1, %for.inc54.1 ], [ %bi.sroa.56.1, %for.inc54 ], [ %bi.sroa.56.1, %if.end37 ], [ %spec.select240, %for.inc54.7 ] %cmp6.not = icmp eq i32 %bi.sroa.56.2, 2 br i1 %cmp6.not, label %for.end57, label %for.cond8.preheader, !llvm.loop !9 for.end57: ; preds = %for.inc54.8 %call58 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans_count.1) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %s) %4 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp eq i32 %4, 0 %5 = load i32, ptr %s, align 4 %cmp1 = icmp eq i32 %5, 0 %or.cond = select i1 %cmp, i1 %cmp1, i1 false br i1 %or.cond, label %for.end59, label %for.cond8.preheader.preheader for.end59: ; preds = %for.end57, %entry call void @llvm.lifetime.end.p0(i64 4, 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"}
#include <stdio.h> int n, s, cnt; int list[10] = {0}; void cntAll(int i, int sum, int k) { if (k==n && sum==s) cnt++; if (i==10 || k==n || sum>s) return; cntAll(i+1, sum+list[i], k+1); cntAll(i+1, sum, k); } int main() { for (int j=0; j<10; j++) list[j] =j; while (scanf("%d %d", &n, &s)) { cnt=0; if (n==0 && s==0) break; cntAll(0, 0, 0); printf("%d\n", cnt); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_172825/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_172825/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" @list = dso_local local_unnamed_addr global [10 x i32] zeroinitializer, align 16 @n = dso_local global i32 0, align 4 @s = dso_local global i32 0, align 4 @cnt = dso_local local_unnamed_addr global i32 0, align 4 @.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 ; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @cntAll(i32 noundef %i, i32 noundef %sum, i32 noundef %k) local_unnamed_addr #0 { entry: %add9 = add nsw i32 %k, 1 %0 = sext i32 %i to i64 br label %tailrecurse tailrecurse: ; preds = %if.end7, %entry %indvars.iv = phi i64 [ %indvars.iv.next, %if.end7 ], [ %0, %entry ] %1 = load i32, ptr @n, align 4 %cmp = icmp eq i32 %1, %k %2 = load i32, ptr @s, align 4 %cmp1 = icmp eq i32 %2, %sum %or.cond = select i1 %cmp, i1 %cmp1, i1 false br i1 %or.cond, label %if.then, label %if.end if.then: ; preds = %tailrecurse %3 = load i32, ptr @cnt, align 4, !tbaa !5 %inc = add nsw i32 %3, 1 store i32 %inc, ptr @cnt, align 4, !tbaa !5 br label %if.end if.end: ; preds = %if.then, %tailrecurse %4 = icmp eq i64 %indvars.iv, 10 %or.cond20 = or i1 %4, %cmp %cmp5 = icmp slt i32 %2, %sum %or.cond21 = select i1 %or.cond20, i1 true, i1 %cmp5 br i1 %or.cond21, label %return, label %if.end7 if.end7: ; preds = %if.end %indvars.iv.next = add nsw i64 %indvars.iv, 1 %arrayidx = getelementptr inbounds [10 x i32], ptr @list, i64 0, i64 %indvars.iv %5 = load i32, ptr %arrayidx, align 4, !tbaa !5 %add8 = add nsw i32 %5, %sum %6 = trunc i64 %indvars.iv.next to i32 tail call void @cntAll(i32 noundef %6, i32 noundef %add8, i32 noundef %add9) br label %tailrecurse return: ; preds = %if.end ret void } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, ptr @list, align 16, !tbaa !5 store <4 x i32> <i32 4, i32 5, i32 6, i32 7>, ptr getelementptr inbounds ([10 x i32], ptr @list, i64 0, i64 4), align 16, !tbaa !5 store i32 8, ptr getelementptr inbounds ([10 x i32], ptr @list, i64 0, i64 8), align 16, !tbaa !5 store i32 9, ptr getelementptr inbounds ([10 x i32], ptr @list, i64 0, i64 9), align 4, !tbaa !5 %call8 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @s) %tobool.not9 = icmp eq i32 %call8, 0 br i1 %tobool.not9, label %while.end, label %while.body while.body: ; preds = %entry, %if.end store i32 0, ptr @cnt, align 4, !tbaa !5 %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp1 = icmp eq i32 %0, 0 %1 = load i32, ptr @s, align 4 %cmp2 = icmp eq i32 %1, 0 %or.cond = select i1 %cmp1, i1 %cmp2, i1 false br i1 %or.cond, label %while.end, label %if.end if.end: ; preds = %while.body tail call void @cntAll(i32 noundef 0, i32 noundef 0, i32 noundef 0) %2 = load i32, ptr @cnt, align 4, !tbaa !5 %call3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %2) %call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @s) %tobool.not = icmp eq i32 %call, 0 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9 while.end: ; preds = %if.end, %while.body, %entry ret i32 0 } ; 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 attributes #0 = { nofree nosync nounwind memory(readwrite, 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 = { 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 = { 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" } !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 n,i,a,min=1000000,max=-1000000; long int sum=0; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&a); if(min>a){min=a;} if(max<a){max=a;} sum+=a; } printf("%d %d %lld\n",min,max,sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_172869/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_172869/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 [12 x i8] c"%d %d %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 %a = 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 %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 %cmp12 = icmp sgt i32 %0, 0 br i1 %cmp12, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %sum.016 = phi i64 [ %add, %for.body ], [ 0, %entry ] %max.015 = phi i32 [ %max.1, %for.body ], [ -1000000, %entry ] %min.014 = phi i32 [ %spec.select, %for.body ], [ 1000000, %entry ] %i.013 = phi i32 [ %inc, %for.body ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a) %1 = load i32, ptr %a, align 4, !tbaa !5 %spec.select = call i32 @llvm.smin.i32(i32 %min.014, i32 %1) %max.1 = call i32 @llvm.smax.i32(i32 %max.015, i32 %1) %conv = sext i32 %1 to i64 %add = add nsw i64 %sum.016, %conv %inc = add nuw nsw i32 %i.013, 1 %2 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %entry %min.0.lcssa = phi i32 [ 1000000, %entry ], [ %spec.select, %for.body ] %max.0.lcssa = phi i32 [ -1000000, %entry ], [ %max.1, %for.body ] %sum.0.lcssa = phi i64 [ 0, %entry ], [ %add, %for.body ] %call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %min.0.lcssa, i32 noundef %max.0.lcssa, i64 noundef %sum.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, 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: 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.smin.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.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"}
#include<stdio.h> int main(void){ int n; int i; int m; int min=1000000, max=-1000000; long int sum=0; scanf("%d", &n); for(i=0;i<n;i++){ scanf("%d", &m); if(m<min){ min=m; } if(m>max){ max=m; } sum+=m; } printf("%d %d %ld\n", min, max, sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_172911/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_172911/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 [11 x i8] c"%d %d %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 %m = 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 %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 %cmp12 = icmp sgt i32 %0, 0 br i1 %cmp12, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %sum.016 = phi i64 [ %add, %for.body ], [ 0, %entry ] %max.015 = phi i32 [ %max.1, %for.body ], [ -1000000, %entry ] %min.014 = phi i32 [ %spec.select, %for.body ], [ 1000000, %entry ] %i.013 = phi i32 [ %inc, %for.body ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m) %1 = load i32, ptr %m, align 4, !tbaa !5 %spec.select = call i32 @llvm.smin.i32(i32 %1, i32 %min.014) %max.1 = call i32 @llvm.smax.i32(i32 %1, i32 %max.015) %conv = sext i32 %1 to i64 %add = add nsw i64 %sum.016, %conv %inc = add nuw nsw i32 %i.013, 1 %2 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %entry %min.0.lcssa = phi i32 [ 1000000, %entry ], [ %spec.select, %for.body ] %max.0.lcssa = phi i32 [ -1000000, %entry ], [ %max.1, %for.body ] %sum.0.lcssa = phi i64 [ 0, %entry ], [ %add, %for.body ] %call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %min.0.lcssa, i32 noundef %max.0.lcssa, i64 noundef %sum.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 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 i32 @llvm.smin.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.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"}
#include <stdio.h> int main(int argc, const char * argv[]) { int n; int min = 1000000; int max = -1000000; long sum = 0; scanf("%d",&n); int i; for(i=0;i<n;i++){ int t; scanf("%d",&t); if(min > t){ min = t; } if(max < t){ max = t; } sum+= t; } printf("%d %d %ld\n",min,max,sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_172955/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_172955/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 [11 x i8] c"%d %d %ld\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: %n = alloca i32, align 4 %t = 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 %cmp12 = icmp sgt i32 %0, 0 br i1 %cmp12, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %i.016 = phi i32 [ %inc, %for.body ], [ 0, %entry ] %sum.015 = phi i64 [ %add, %for.body ], [ 0, %entry ] %max.014 = phi i32 [ %max.1, %for.body ], [ -1000000, %entry ] %min.013 = phi i32 [ %spec.select, %for.body ], [ 1000000, %entry ] call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t) %1 = load i32, ptr %t, align 4, !tbaa !5 %spec.select = call i32 @llvm.smin.i32(i32 %min.013, i32 %1) %max.1 = call i32 @llvm.smax.i32(i32 %max.014, i32 %1) %conv = sext i32 %1 to i64 %add = add nsw i64 %sum.015, %conv call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4 %inc = add nuw nsw i32 %i.016, 1 %2 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %entry %min.0.lcssa = phi i32 [ 1000000, %entry ], [ %spec.select, %for.body ] %max.0.lcssa = phi i32 [ -1000000, %entry ], [ %max.1, %for.body ] %sum.0.lcssa = phi i64 [ 0, %entry ], [ %add, %for.body ] %call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %min.0.lcssa, i32 noundef %max.0.lcssa, i64 noundef %sum.0.lcssa) 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: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.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"}
#include<stdio.h> int main(){ int i,j,a,max,min; max=-1000000;min=1000000; long sum; sum=0; scanf("%d\n",&j); for(i=0;i<j;i++){ scanf("%d",&a); if(a<=min)min=a; if(a>=max)max=a; sum+=a;} printf("%d %d %ld\n",min,max,sum); return 0;}
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_172999/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_172999/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"%d\00", align 1 @.str.2 = private unnamed_addr constant [11 x i8] c"%d %d %ld\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %j = alloca i32, align 4 %a = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %j) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %j) %0 = load i32, ptr %j, align 4, !tbaa !5 %cmp12 = icmp sgt i32 %0, 0 br i1 %cmp12, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %sum.016 = phi i64 [ %add, %for.body ], [ 0, %entry ] %min.015 = phi i32 [ %spec.select, %for.body ], [ 1000000, %entry ] %max.014 = phi i32 [ %max.1, %for.body ], [ -1000000, %entry ] %i.013 = phi i32 [ %inc, %for.body ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a) %1 = load i32, ptr %a, align 4, !tbaa !5 %spec.select = call i32 @llvm.smin.i32(i32 %1, i32 %min.015) %max.1 = call i32 @llvm.smax.i32(i32 %1, i32 %max.014) %conv = sext i32 %1 to i64 %add = add nsw i64 %sum.016, %conv %inc = add nuw nsw i32 %i.013, 1 %2 = load i32, ptr %j, align 4, !tbaa !5 %cmp = icmp slt i32 %inc, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %entry %max.0.lcssa = phi i32 [ -1000000, %entry ], [ %max.1, %for.body ] %min.0.lcssa = phi i32 [ 1000000, %entry ], [ %spec.select, %for.body ] %sum.0.lcssa = phi i64 [ 0, %entry ], [ %add, %for.body ] %call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %min.0.lcssa, i32 noundef %max.0.lcssa, i64 noundef %sum.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %j) #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 i32 @llvm.smin.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.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"}
#include<stdio.h> int main(){ int n=0,i,j,p=0,x[10000]; long long int Sum=0; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&x[i]); Sum+=x[i]; } for(i=0;i<n;i++){ for(j=n-1;j>i;j--){ if(x[j]<x[j-1]){ p=x[j-1]; x[j-1]=x[j]; x[j]=p; } } } printf("%d %d %lld\n",x[0],x[n-1],Sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_173048/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_173048/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 [12 x i8] c"%d %d %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 %x = alloca [10000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3 store i32 0, ptr %n, align 4, !tbaa !5 call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %x) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp55 = icmp sgt i32 %0, 0 br i1 %cmp55, label %for.body, label %for.cond4.preheader.for.end33_crit_edge for.cond4.preheader: ; preds = %for.body %cmp563 = icmp sgt i32 %5, 0 br i1 %cmp563, label %for.cond8.preheader.lr.ph, label %for.cond4.preheader.for.end33_crit_edge for.cond4.preheader.for.end33_crit_edge: ; preds = %entry, %for.cond4.preheader %.lcssa84 = phi i32 [ %5, %for.cond4.preheader ], [ %0, %entry ] %Sum.0.lcssa83 = phi i64 [ %add, %for.cond4.preheader ], [ 0, %entry ] %.pre = add nsw i32 %.lcssa84, -1 %.pre78 = sext i32 %.pre to i64 br label %for.end33 for.cond8.preheader.lr.ph: ; preds = %for.cond4.preheader %j.059 = add nsw i32 %5, -1 %1 = zext i32 %5 to i64 %2 = add nsw i64 %1, -1 %3 = zext i32 %j.059 to i64 %wide.trip.count = zext i32 %5 to i64 br label %for.cond8.preheader for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %Sum.057 = phi i64 [ %add, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [10000 x i32], ptr %x, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %4 = load i32, ptr %arrayidx, align 4, !tbaa !5 %conv = sext i32 %4 to i64 %add = add nsw i64 %Sum.057, %conv %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.cond4.preheader, !llvm.loop !9 for.cond8.preheader: ; preds = %for.cond8.preheader.lr.ph, %for.inc31 %indvars.iv75 = phi i64 [ 0, %for.cond8.preheader.lr.ph ], [ %indvars.iv.next76, %for.inc31 ] %cmp960 = icmp ult i64 %indvars.iv75, %3 br i1 %cmp960, label %for.body11, label %for.inc31 for.body11: ; preds = %for.cond8.preheader, %for.inc29 %indvars.iv69 = phi i64 [ %indvars.iv.next70, %for.inc29 ], [ %1, %for.cond8.preheader ] %indvars.iv67 = phi i64 [ %indvars.iv.next68, %for.inc29 ], [ %2, %for.cond8.preheader ] %indvars.iv.next70 = add nsw i64 %indvars.iv69, -1 %arrayidx13 = getelementptr inbounds [10000 x i32], ptr %x, i64 0, i64 %indvars.iv67 %7 = load i32, ptr %arrayidx13, align 4, !tbaa !5 %8 = add nsw i64 %indvars.iv69, -2 %arrayidx16 = getelementptr inbounds [10000 x i32], ptr %x, i64 0, i64 %8 %9 = load i32, ptr %arrayidx16, align 4, !tbaa !5 %cmp17 = icmp slt i32 %7, %9 br i1 %cmp17, label %if.then, label %for.inc29 if.then: ; preds = %for.body11 store i32 %7, ptr %arrayidx16, align 4, !tbaa !5 store i32 %9, ptr %arrayidx13, align 4, !tbaa !5 br label %for.inc29 for.inc29: ; preds = %for.body11, %if.then %indvars.iv.next68 = add nsw i64 %indvars.iv67, -1 %cmp9 = icmp sgt i64 %indvars.iv.next68, %indvars.iv75 br i1 %cmp9, label %for.body11, label %for.inc31, !llvm.loop !11 for.inc31: ; preds = %for.inc29, %for.cond8.preheader %indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1 %exitcond.not = icmp eq i64 %indvars.iv.next76, %wide.trip.count br i1 %exitcond.not, label %for.end33, label %for.cond8.preheader, !llvm.loop !12 for.end33: ; preds = %for.inc31, %for.cond4.preheader.for.end33_crit_edge %Sum.0.lcssa82 = phi i64 [ %Sum.0.lcssa83, %for.cond4.preheader.for.end33_crit_edge ], [ %add, %for.inc31 ] %idxprom36.pre-phi = phi i64 [ %.pre78, %for.cond4.preheader.for.end33_crit_edge ], [ %3, %for.inc31 ] %10 = load i32, ptr %x, align 16, !tbaa !5 %arrayidx37 = getelementptr inbounds [10000 x i32], ptr %x, i64 0, i64 %idxprom36.pre-phi %11 = load i32, ptr %arrayidx37, align 4, !tbaa !5 %call38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %10, i32 noundef %11, i64 noundef %Sum.0.lcssa82) call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %x) #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}
#include <stdio.h> #define NUM 100000 int main() { int n = 0, data[NUM], i= 0, min = 0, max = 0; long int sum = 0; scanf("%d", &n); while(1) { if (i == n) { break; } scanf("%d", &data[i]); i++; } min = max = data[0]; i = 0; while(1) { if (i == n) { break; } sum = sum + data[i]; if (min >= data[i]) { min = data[i]; } if (max <= data[i]) { max = data[i]; } i++; } printf("%d %d %ld\n", min, max, sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_173099/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_173099/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 [11 x i8] c"%d %d %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 %data = alloca [100000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 store i32 0, ptr %n, align 4, !tbaa !5 call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %data) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp42 = icmp ne i32 %0, 0 call void @llvm.assume(i1 %cmp42) br label %if.end if.end: ; preds = %entry, %if.end %indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 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 i64 %indvars.iv, 1 %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = zext i32 %1 to i64 %cmp = icmp eq i64 %indvars.iv.next, %2 br i1 %cmp, label %while.end, label %if.end while.end: ; preds = %if.end %.pre = load i32, ptr %data, align 16, !tbaa !5 %cmp544 = icmp eq i32 %1, 0 br i1 %cmp544, label %while.end27, label %if.end7.preheader if.end7.preheader: ; preds = %while.end %3 = zext i32 %1 to i64 %min.iters.check = icmp ult i32 %1, 4 br i1 %min.iters.check, label %if.end7.preheader70, label %vector.ph vector.ph: ; preds = %if.end7.preheader %n.vec = and i64 %3, 4294967292 %minmax.ident.splatinsert = insertelement <2 x i32> poison, i32 %.pre, i64 0 %minmax.ident.splat = shufflevector <2 x i32> %minmax.ident.splatinsert, <2 x i32> poison, <2 x i32> zeroinitializer %minmax.ident.splatinsert64 = insertelement <2 x i32> poison, i32 %.pre, i64 0 %minmax.ident.splat65 = shufflevector <2 x i32> %minmax.ident.splatinsert64, <2 x i32> poison, <2 x i32> zeroinitializer br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %vec.phi = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %8, %vector.body ] %vec.phi59 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %9, %vector.body ] %vec.phi60 = phi <2 x i32> [ %minmax.ident.splat, %vector.ph ], [ %12, %vector.body ] %vec.phi61 = phi <2 x i32> [ %minmax.ident.splat, %vector.ph ], [ %13, %vector.body ] %vec.phi62 = phi <2 x i32> [ %minmax.ident.splat65, %vector.ph ], [ %10, %vector.body ] %vec.phi63 = phi <2 x i32> [ %minmax.ident.splat65, %vector.ph ], [ %11, %vector.body ] %4 = getelementptr inbounds [100000 x i32], ptr %data, i64 0, i64 %index %wide.load = load <2 x i32>, ptr %4, align 16, !tbaa !5 %5 = getelementptr inbounds i32, ptr %4, i64 2 %wide.load66 = load <2 x i32>, ptr %5, align 8, !tbaa !5 %6 = sext <2 x i32> %wide.load to <2 x i64> %7 = sext <2 x i32> %wide.load66 to <2 x i64> %8 = add <2 x i64> %vec.phi, %6 %9 = add <2 x i64> %vec.phi59, %7 %10 = call <2 x i32> @llvm.smin.v2i32(<2 x i32> %vec.phi62, <2 x i32> %wide.load) %11 = call <2 x i32> @llvm.smin.v2i32(<2 x i32> %vec.phi63, <2 x i32> %wide.load66) %12 = call <2 x i32> @llvm.smax.v2i32(<2 x i32> %vec.phi60, <2 x i32> %wide.load) %13 = call <2 x i32> @llvm.smax.v2i32(<2 x i32> %vec.phi61, <2 x i32> %wide.load66) %index.next = add nuw i64 %index, 4 %14 = icmp eq i64 %index.next, %n.vec br i1 %14, label %middle.block, label %vector.body, !llvm.loop !9 middle.block: ; preds = %vector.body %rdx.minmax68 = call <2 x i32> @llvm.smin.v2i32(<2 x i32> %10, <2 x i32> %11) %15 = call i32 @llvm.vector.reduce.smin.v2i32(<2 x i32> %rdx.minmax68) %rdx.minmax = call <2 x i32> @llvm.smax.v2i32(<2 x i32> %12, <2 x i32> %13) %16 = call i32 @llvm.vector.reduce.smax.v2i32(<2 x i32> %rdx.minmax) %bin.rdx = add <2 x i64> %9, %8 %17 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx) %cmp.n = icmp eq i64 %n.vec, %3 br i1 %cmp.n, label %while.end27, label %if.end7.preheader70 if.end7.preheader70: ; preds = %if.end7.preheader, %middle.block %indvars.iv54.ph = phi i64 [ 0, %if.end7.preheader ], [ %n.vec, %middle.block ] %sum.048.ph = phi i64 [ 0, %if.end7.preheader ], [ %17, %middle.block ] %max.047.ph = phi i32 [ %.pre, %if.end7.preheader ], [ %16, %middle.block ] %min.046.ph = phi i32 [ %.pre, %if.end7.preheader ], [ %15, %middle.block ] br label %if.end7 if.end7: ; preds = %if.end7.preheader70, %if.end7 %indvars.iv54 = phi i64 [ %indvars.iv.next55, %if.end7 ], [ %indvars.iv54.ph, %if.end7.preheader70 ] %sum.048 = phi i64 [ %add, %if.end7 ], [ %sum.048.ph, %if.end7.preheader70 ] %max.047 = phi i32 [ %max.1, %if.end7 ], [ %max.047.ph, %if.end7.preheader70 ] %min.046 = phi i32 [ %spec.select, %if.end7 ], [ %min.046.ph, %if.end7.preheader70 ] %arrayidx9 = getelementptr inbounds [100000 x i32], ptr %data, i64 0, i64 %indvars.iv54 %18 = load i32, ptr %arrayidx9, align 4, !tbaa !5 %conv = sext i32 %18 to i64 %add = add nsw i64 %sum.048, %conv %spec.select = call i32 @llvm.smin.i32(i32 %min.046, i32 %18) %max.1 = call i32 @llvm.smax.i32(i32 %max.047, i32 %18) %indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1 %cmp5 = icmp eq i64 %indvars.iv.next55, %3 br i1 %cmp5, label %while.end27, label %if.end7, !llvm.loop !12 while.end27: ; preds = %if.end7, %middle.block, %while.end %min.0.lcssa = phi i32 [ %.pre, %while.end ], [ %15, %middle.block ], [ %spec.select, %if.end7 ] %max.0.lcssa = phi i32 [ %.pre, %while.end ], [ %16, %middle.block ], [ %max.1, %if.end7 ] %sum.0.lcssa = phi i64 [ 0, %while.end ], [ %17, %middle.block ], [ %add, %if.end7 ] %call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %min.0.lcssa, i32 noundef %max.0.lcssa, i64 noundef %sum.0.lcssa) call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %data) #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: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) declare void @llvm.assume(i1 noundef) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare <2 x i32> @llvm.smin.v2i32(<2 x i32>, <2 x i32>) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare <2 x i32> @llvm.smax.v2i32(<2 x i32>, <2 x i32>) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.smax.v2i32(<2 x i32>) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.smin.v2i32(<2 x 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 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } 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, !11} !10 = !{!"llvm.loop.isvectorized", i32 1} !11 = !{!"llvm.loop.unroll.runtime.disable"} !12 = distinct !{!12, !11, !10}
#include<stdio.h> int main(void) { int n; int i=0; int a; int min=1000000; int max=-1000000; long long int sum=0; scanf("%d", &n); for(i=0;i<n;i++){ scanf("%d",&a); if(min>a) min=a; if(max<a) max=a; sum=sum+a; } printf("%d %d %lld\n", min, max, sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_173149/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_173149/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 [12 x i8] c"%d %d %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 %a = 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 %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 %cmp12 = icmp sgt i32 %0, 0 br i1 %cmp12, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %sum.016 = phi i64 [ %add, %for.body ], [ 0, %entry ] %max.015 = phi i32 [ %max.1, %for.body ], [ -1000000, %entry ] %min.014 = phi i32 [ %spec.select, %for.body ], [ 1000000, %entry ] %i.013 = phi i32 [ %inc, %for.body ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a) %1 = load i32, ptr %a, align 4, !tbaa !5 %spec.select = call i32 @llvm.smin.i32(i32 %min.014, i32 %1) %max.1 = call i32 @llvm.smax.i32(i32 %max.015, i32 %1) %conv = sext i32 %1 to i64 %add = add nsw i64 %sum.016, %conv %inc = add nuw nsw i32 %i.013, 1 %2 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %entry %min.0.lcssa = phi i32 [ 1000000, %entry ], [ %spec.select, %for.body ] %max.0.lcssa = phi i32 [ -1000000, %entry ], [ %max.1, %for.body ] %sum.0.lcssa = phi i64 [ 0, %entry ], [ %add, %for.body ] %call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %min.0.lcssa, i32 noundef %max.0.lcssa, i64 noundef %sum.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, 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: 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.smin.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.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"}
#include <stdio.h> #include<math.h> int main(void) { double s[10001],n,max,min,sum; int a; scanf("%lf",&n); max=-10000000000; min=10000000000; sum=0; for(a=0;a<n;a++){ scanf("%lf",&s[a]); if(s[a]>max){max=s[a];} if(s[a]<min){min=s[a];} sum=sum+s[a]; } printf("%.0lf %.0lf %.0lf\n",min,max,sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_173192/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_173192/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 [19 x i8] c"%.0lf %.0lf %.0lf\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %s = alloca [10001 x double], align 16 %n = alloca double, align 8 call void @llvm.lifetime.start.p0(i64 80008, ptr nonnull %s) #3 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load double, ptr %n, align 8, !tbaa !5 %cmp31 = fcmp ogt double %0, 0.000000e+00 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 ] %sum.034 = phi double [ %add, %for.body ], [ 0.000000e+00, %entry ] %min.033 = phi double [ %min.1, %for.body ], [ 1.000000e+10, %entry ] %max.032 = phi double [ %max.1, %for.body ], [ -1.000000e+10, %entry ] %arrayidx = getelementptr inbounds [10001 x double], ptr %s, i64 0, i64 %indvars.iv %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %1 = load double, ptr %arrayidx, align 8, !tbaa !5 %cmp5 = fcmp ogt double %1, %max.032 %max.1 = select i1 %cmp5, double %1, double %max.032 %cmp11 = fcmp olt double %1, %min.033 %min.1 = select i1 %cmp11, double %1, double %min.033 %add = fadd double %sum.034, %1 %indvars.iv.next = add nuw i64 %indvars.iv, 1 %2 = trunc i64 %indvars.iv.next to i32 %conv = sitofp i32 %2 to double %3 = load double, ptr %n, align 8, !tbaa !5 %cmp = fcmp ogt double %3, %conv br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %entry %max.0.lcssa = phi double [ -1.000000e+10, %entry ], [ %max.1, %for.body ] %min.0.lcssa = phi double [ 1.000000e+10, %entry ], [ %min.1, %for.body ] %sum.0.lcssa = phi double [ 0.000000e+00, %entry ], [ %add, %for.body ] %call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %min.0.lcssa, double noundef %max.0.lcssa, double noundef %sum.0.lcssa) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #3 call void @llvm.lifetime.end.p0(i64 80008, 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)"} !5 = !{!6, !6, i64 0} !6 = !{!"double", !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, i, a[10000], max = -1000000, min = 1000000; long sum = 0; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d", &a[i]); sum += a[i]; if (max < a[i]) max = a[i]; if (min > a[i]) min = a[i]; } printf("%d %d %ld\n", min, max, sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_173235/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_173235/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 [11 x i8] c"%d %d %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 %a = alloca [10000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 40000, 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 %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 ] %sum.034 = phi i64 [ %add, %for.body ], [ 0, %entry ] %min.033 = phi i32 [ %min.1, %for.body ], [ 1000000, %entry ] %max.032 = phi i32 [ %spec.select, %for.body ], [ -1000000, %entry ] %arrayidx = getelementptr inbounds [10000 x i32], ptr %a, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 %conv = sext i32 %1 to i64 %add = add nsw i64 %sum.034, %conv %spec.select = call i32 @llvm.smax.i32(i32 %max.032, i32 %1) %min.1 = call i32 @llvm.smin.i32(i32 %min.033, i32 %1) %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 !9 for.end: ; preds = %for.body, %entry %max.0.lcssa = phi i32 [ -1000000, %entry ], [ %spec.select, %for.body ] %min.0.lcssa = phi i32 [ 1000000, %entry ], [ %min.1, %for.body ] %sum.0.lcssa = phi i64 [ 0, %entry ], [ %add, %for.body ] %call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %min.0.lcssa, i32 noundef %max.0.lcssa, i64 noundef %sum.0.lcssa) call void @llvm.lifetime.end.p0(i64 40000, 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: 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) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.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"}
#include<stdio.h> int main(void) { int num; int x[10000]; int min, max; int i; long sum=0; scanf("%d", &num); for(i=0;i<num;i++) { scanf("%d", &x[i]); } min = x[0]; max = x[0]; for(i=0;i<num;i++) { if(min > x[i]) { min = x[i]; } if(max < x[i]) { max = x[i]; } sum += (long)x[i]; } printf("%d %d %ld\n", min, max, sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_173279/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_173279/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 [11 x i8] c"%d %d %ld\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %num = alloca i32, align 4 %x = alloca [10000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #5 call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %x) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num) %0 = load i32, ptr %num, align 4, !tbaa !5 %cmp38 = icmp sgt i32 %0, 0 call void @llvm.assume(i1 %cmp38) br label %for.body for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [10000 x i32], ptr %x, 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 %num, 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 %.pre = load i32, ptr %x, align 16, !tbaa !5 %cmp540 = icmp sgt i32 %1, 0 br i1 %cmp540, label %for.body6.preheader, label %for.end23 for.body6.preheader: ; preds = %for.end %wide.trip.count = zext i32 %1 to i64 %min.iters.check = icmp ult i32 %1, 4 br i1 %min.iters.check, label %for.body6.preheader66, label %vector.ph vector.ph: ; preds = %for.body6.preheader %n.vec = and i64 %wide.trip.count, 4294967292 %minmax.ident.splatinsert = insertelement <2 x i32> poison, i32 %.pre, i64 0 %minmax.ident.splat = shufflevector <2 x i32> %minmax.ident.splatinsert, <2 x i32> poison, <2 x i32> zeroinitializer %minmax.ident.splatinsert60 = insertelement <2 x i32> poison, i32 %.pre, i64 0 %minmax.ident.splat61 = shufflevector <2 x i32> %minmax.ident.splatinsert60, <2 x i32> poison, <2 x i32> zeroinitializer br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %vec.phi = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %11, %vector.body ] %vec.phi55 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %12, %vector.body ] %vec.phi56 = phi <2 x i32> [ %minmax.ident.splat, %vector.ph ], [ %7, %vector.body ] %vec.phi57 = phi <2 x i32> [ %minmax.ident.splat, %vector.ph ], [ %8, %vector.body ] %vec.phi58 = phi <2 x i32> [ %minmax.ident.splat61, %vector.ph ], [ %5, %vector.body ] %vec.phi59 = phi <2 x i32> [ %minmax.ident.splat61, %vector.ph ], [ %6, %vector.body ] %3 = getelementptr inbounds [10000 x i32], ptr %x, i64 0, i64 %index %wide.load = load <2 x i32>, ptr %3, align 16, !tbaa !5 %4 = getelementptr inbounds i32, ptr %3, i64 2 %wide.load62 = load <2 x i32>, ptr %4, align 8, !tbaa !5 %5 = call <2 x i32> @llvm.smin.v2i32(<2 x i32> %vec.phi58, <2 x i32> %wide.load) %6 = call <2 x i32> @llvm.smin.v2i32(<2 x i32> %vec.phi59, <2 x i32> %wide.load62) %7 = call <2 x i32> @llvm.smax.v2i32(<2 x i32> %vec.phi56, <2 x i32> %wide.load) %8 = call <2 x i32> @llvm.smax.v2i32(<2 x i32> %vec.phi57, <2 x i32> %wide.load62) %9 = sext <2 x i32> %wide.load to <2 x i64> %10 = sext <2 x i32> %wide.load62 to <2 x i64> %11 = add <2 x i64> %vec.phi, %9 %12 = add <2 x i64> %vec.phi55, %10 %index.next = add nuw i64 %index, 4 %13 = icmp eq i64 %index.next, %n.vec br i1 %13, label %middle.block, label %vector.body, !llvm.loop !11 middle.block: ; preds = %vector.body %rdx.minmax64 = call <2 x i32> @llvm.smin.v2i32(<2 x i32> %5, <2 x i32> %6) %14 = call i32 @llvm.vector.reduce.smin.v2i32(<2 x i32> %rdx.minmax64) %rdx.minmax = call <2 x i32> @llvm.smax.v2i32(<2 x i32> %7, <2 x i32> %8) %15 = call i32 @llvm.vector.reduce.smax.v2i32(<2 x i32> %rdx.minmax) %bin.rdx = add <2 x i64> %12, %11 %16 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx) %cmp.n = icmp eq i64 %n.vec, %wide.trip.count br i1 %cmp.n, label %for.end23, label %for.body6.preheader66 for.body6.preheader66: ; preds = %for.body6.preheader, %middle.block %indvars.iv50.ph = phi i64 [ 0, %for.body6.preheader ], [ %n.vec, %middle.block ] %sum.044.ph = phi i64 [ 0, %for.body6.preheader ], [ %16, %middle.block ] %max.042.ph = phi i32 [ %.pre, %for.body6.preheader ], [ %15, %middle.block ] %min.041.ph = phi i32 [ %.pre, %for.body6.preheader ], [ %14, %middle.block ] br label %for.body6 for.body6: ; preds = %for.body6.preheader66, %for.body6 %indvars.iv50 = phi i64 [ %indvars.iv.next51, %for.body6 ], [ %indvars.iv50.ph, %for.body6.preheader66 ] %sum.044 = phi i64 [ %add, %for.body6 ], [ %sum.044.ph, %for.body6.preheader66 ] %max.042 = phi i32 [ %max.1, %for.body6 ], [ %max.042.ph, %for.body6.preheader66 ] %min.041 = phi i32 [ %spec.select, %for.body6 ], [ %min.041.ph, %for.body6.preheader66 ] %arrayidx8 = getelementptr inbounds [10000 x i32], ptr %x, i64 0, i64 %indvars.iv50 %17 = load i32, ptr %arrayidx8, align 4, !tbaa !5 %spec.select = call i32 @llvm.smin.i32(i32 %min.041, i32 %17) %max.1 = call i32 @llvm.smax.i32(i32 %max.042, i32 %17) %conv = sext i32 %17 to i64 %add = add nsw i64 %sum.044, %conv %indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1 %exitcond.not = icmp eq i64 %indvars.iv.next51, %wide.trip.count br i1 %exitcond.not, label %for.end23, label %for.body6, !llvm.loop !14 for.end23: ; preds = %for.body6, %middle.block, %for.end %min.0.lcssa = phi i32 [ %.pre, %for.end ], [ %14, %middle.block ], [ %spec.select, %for.body6 ] %max.0.lcssa = phi i32 [ %.pre, %for.end ], [ %15, %middle.block ], [ %max.1, %for.body6 ] %sum.0.lcssa = phi i64 [ 0, %for.end ], [ %16, %middle.block ], [ %add, %for.body6 ] %call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %min.0.lcssa, i32 noundef %max.0.lcssa, i64 noundef %sum.0.lcssa) call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %x) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #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: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) declare void @llvm.assume(i1 noundef) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare <2 x i32> @llvm.smin.v2i32(<2 x i32>, <2 x i32>) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare <2 x i32> @llvm.smax.v2i32(<2 x i32>, <2 x i32>) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.smax.v2i32(<2 x i32>) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.smin.v2i32(<2 x 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 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } 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, !13} !12 = !{!"llvm.loop.isvectorized", i32 1} !13 = !{!"llvm.loop.unroll.runtime.disable"} !14 = distinct !{!14, !10, !13, !12}
#include <stdio.h> int main(void){ int i,n,min=1000000,max=-1000000,a; double sum=0; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&a); if(a<min){ min=a; } if(max<a){ max=a; } sum+=a; } printf("%d %d %.0lf\n",min,max,sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_173321/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_173321/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 [13 x i8] c"%d %d %.0lf\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 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 %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 %cmp12 = icmp sgt i32 %0, 0 br i1 %cmp12, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %sum.016 = phi double [ %add, %for.body ], [ 0.000000e+00, %entry ] %max.015 = phi i32 [ %max.1, %for.body ], [ -1000000, %entry ] %min.014 = phi i32 [ %spec.select, %for.body ], [ 1000000, %entry ] %i.013 = phi i32 [ %inc, %for.body ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a) %1 = load i32, ptr %a, align 4, !tbaa !5 %spec.select = call i32 @llvm.smin.i32(i32 %1, i32 %min.014) %max.1 = call i32 @llvm.smax.i32(i32 %max.015, i32 %1) %conv = sitofp i32 %1 to double %add = fadd double %sum.016, %conv %inc = add nuw nsw i32 %i.013, 1 %2 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %entry %min.0.lcssa = phi i32 [ 1000000, %entry ], [ %spec.select, %for.body ] %max.0.lcssa = phi i32 [ -1000000, %entry ], [ %max.1, %for.body ] %sum.0.lcssa = phi double [ 0.000000e+00, %entry ], [ %add, %for.body ] %call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %min.0.lcssa, i32 noundef %max.0.lcssa, double noundef %sum.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, 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: 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.smin.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.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"}
#include<stdio.h> int main(void){ int i,n; int number; long long int sum=0; int min=0; int max=0; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d",&number); if(i==0) { min = number; max = number; } if(number<min) min = number; if(number>max) max = number; sum += number; } printf("%d %d %lld\n",min,max,sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_173365/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_173365/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 [12 x i8] c"%d %d %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 %number = 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 %number) #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.preheader, label %for.end for.body.preheader: ; preds = %entry %call1.peel = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %number) %1 = load i32, ptr %number, align 4 %conv.peel = sext i32 %1 to i64 %2 = load i32, ptr %n, align 4, !tbaa !5 %cmp.peel = icmp sgt i32 %2, 1 br i1 %cmp.peel, label %for.body, label %for.end for.body: ; preds = %for.body.preheader, %for.body %max.021 = phi i32 [ %max.2, %for.body ], [ %1, %for.body.preheader ] %min.020 = phi i32 [ %min.2, %for.body ], [ %1, %for.body.preheader ] %sum.019 = phi i64 [ %add, %for.body ], [ %conv.peel, %for.body.preheader ] %i.018 = phi i32 [ %inc, %for.body ], [ 1, %for.body.preheader ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %number) %3 = load i32, ptr %number, align 4 %min.2 = call i32 @llvm.smin.i32(i32 %3, i32 %min.020) %max.2 = call i32 @llvm.smax.i32(i32 %3, i32 %max.021) %conv = sext i32 %3 to i64 %add = add nsw i64 %sum.019, %conv %inc = add nuw nsw i32 %i.018, 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, %for.body.preheader, %entry %sum.0.lcssa = phi i64 [ 0, %entry ], [ %conv.peel, %for.body.preheader ], [ %add, %for.body ] %min.0.lcssa = phi i32 [ 0, %entry ], [ %1, %for.body.preheader ], [ %min.2, %for.body ] %max.0.lcssa = phi i32 [ 0, %entry ], [ %1, %for.body.preheader ], [ %max.2, %for.body ] %call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %min.0.lcssa, i32 noundef %max.0.lcssa, i64 noundef %sum.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %number) #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: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.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, !11} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!"llvm.loop.peeled.count", i32 1}
#include <stdio.h> int main(){ int n, i, max, min; long long int sum; scanf("%d",&n); int a[n]; for(i = 0; i < n; i++) scanf("%d",&a[i]); max = a[0]; min = a[0]; sum = 0; for(i = 0; i < n; i++){ if(a[i] > max) max = a[i]; if(a[i] < min) min = a[i]; sum += a[i]; } printf("%d %d %lld\n",min, max, sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_173408/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_173408/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 [12 x i8] c"%d %d %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) #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 %cmp38 = icmp sgt i32 %3, 0 call void @llvm.assume(i1 %cmp38) br label %for.body 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 %.pre = load i32, ptr %vla, align 16, !tbaa !5 %cmp540 = icmp sgt i32 %4, 0 br i1 %cmp540, label %for.body6.preheader, label %for.end23 for.body6.preheader: ; preds = %for.end %wide.trip.count = zext i32 %4 to i64 %min.iters.check = icmp ult i32 %4, 4 br i1 %min.iters.check, label %for.body6.preheader66, label %vector.ph vector.ph: ; preds = %for.body6.preheader %n.vec = and i64 %wide.trip.count, 4294967292 %minmax.ident.splatinsert = insertelement <2 x i32> poison, i32 %.pre, i64 0 %minmax.ident.splat = shufflevector <2 x i32> %minmax.ident.splatinsert, <2 x i32> poison, <2 x i32> zeroinitializer %minmax.ident.splatinsert60 = insertelement <2 x i32> poison, i32 %.pre, i64 0 %minmax.ident.splat61 = shufflevector <2 x i32> %minmax.ident.splatinsert60, <2 x i32> poison, <2 x i32> zeroinitializer br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %vec.phi = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %14, %vector.body ] %vec.phi55 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %15, %vector.body ] %vec.phi56 = phi <2 x i32> [ %minmax.ident.splat, %vector.ph ], [ %10, %vector.body ] %vec.phi57 = phi <2 x i32> [ %minmax.ident.splat, %vector.ph ], [ %11, %vector.body ] %vec.phi58 = phi <2 x i32> [ %minmax.ident.splat61, %vector.ph ], [ %8, %vector.body ] %vec.phi59 = phi <2 x i32> [ %minmax.ident.splat61, %vector.ph ], [ %9, %vector.body ] %6 = getelementptr inbounds i32, ptr %vla, i64 %index %wide.load = load <2 x i32>, ptr %6, align 16, !tbaa !5 %7 = getelementptr inbounds i32, ptr %6, i64 2 %wide.load62 = load <2 x i32>, ptr %7, align 8, !tbaa !5 %8 = call <2 x i32> @llvm.smax.v2i32(<2 x i32> %wide.load, <2 x i32> %vec.phi58) %9 = call <2 x i32> @llvm.smax.v2i32(<2 x i32> %wide.load62, <2 x i32> %vec.phi59) %10 = call <2 x i32> @llvm.smin.v2i32(<2 x i32> %wide.load, <2 x i32> %vec.phi56) %11 = call <2 x i32> @llvm.smin.v2i32(<2 x i32> %wide.load62, <2 x i32> %vec.phi57) %12 = sext <2 x i32> %wide.load to <2 x i64> %13 = sext <2 x i32> %wide.load62 to <2 x i64> %14 = add <2 x i64> %vec.phi, %12 %15 = add <2 x i64> %vec.phi55, %13 %index.next = add nuw i64 %index, 4 %16 = icmp eq i64 %index.next, %n.vec br i1 %16, label %middle.block, label %vector.body, !llvm.loop !11 middle.block: ; preds = %vector.body %rdx.minmax64 = call <2 x i32> @llvm.smax.v2i32(<2 x i32> %8, <2 x i32> %9) %17 = call i32 @llvm.vector.reduce.smax.v2i32(<2 x i32> %rdx.minmax64) %rdx.minmax = call <2 x i32> @llvm.smin.v2i32(<2 x i32> %10, <2 x i32> %11) %18 = call i32 @llvm.vector.reduce.smin.v2i32(<2 x i32> %rdx.minmax) %bin.rdx = add <2 x i64> %15, %14 %19 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx) %cmp.n = icmp eq i64 %n.vec, %wide.trip.count br i1 %cmp.n, label %for.end23, label %for.body6.preheader66 for.body6.preheader66: ; preds = %for.body6.preheader, %middle.block %indvars.iv50.ph = phi i64 [ 0, %for.body6.preheader ], [ %n.vec, %middle.block ] %sum.043.ph = phi i64 [ 0, %for.body6.preheader ], [ %19, %middle.block ] %min.042.ph = phi i32 [ %.pre, %for.body6.preheader ], [ %18, %middle.block ] %max.041.ph = phi i32 [ %.pre, %for.body6.preheader ], [ %17, %middle.block ] br label %for.body6 for.body6: ; preds = %for.body6.preheader66, %for.body6 %indvars.iv50 = phi i64 [ %indvars.iv.next51, %for.body6 ], [ %indvars.iv50.ph, %for.body6.preheader66 ] %sum.043 = phi i64 [ %add, %for.body6 ], [ %sum.043.ph, %for.body6.preheader66 ] %min.042 = phi i32 [ %min.1, %for.body6 ], [ %min.042.ph, %for.body6.preheader66 ] %max.041 = phi i32 [ %spec.select, %for.body6 ], [ %max.041.ph, %for.body6.preheader66 ] %arrayidx8 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv50 %20 = load i32, ptr %arrayidx8, align 4, !tbaa !5 %spec.select = call i32 @llvm.smax.i32(i32 %20, i32 %max.041) %min.1 = call i32 @llvm.smin.i32(i32 %20, i32 %min.042) %conv = sext i32 %20 to i64 %add = add nsw i64 %sum.043, %conv %indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1 %exitcond.not = icmp eq i64 %indvars.iv.next51, %wide.trip.count br i1 %exitcond.not, label %for.end23, label %for.body6, !llvm.loop !14 for.end23: ; preds = %for.body6, %middle.block, %for.end %max.0.lcssa = phi i32 [ %.pre, %for.end ], [ %17, %middle.block ], [ %spec.select, %for.body6 ] %min.0.lcssa = phi i32 [ %.pre, %for.end ], [ %18, %middle.block ], [ %min.1, %for.body6 ] %sum.0.lcssa = phi i64 [ 0, %for.end ], [ %19, %middle.block ], [ %add, %for.body6 ] %call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %min.0.lcssa, i32 noundef %max.0.lcssa, i64 noundef %sum.0.lcssa) 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: 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.smax.i32(i32, i32) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #4 ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) declare void @llvm.assume(i1 noundef) #5 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare <2 x i32> @llvm.smax.v2i32(<2 x i32>, <2 x i32>) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare <2 x i32> @llvm.smin.v2i32(<2 x i32>, <2 x i32>) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.smin.v2i32(<2 x i32>) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.smax.v2i32(<2 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 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: 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, !10, !12, !13} !12 = !{!"llvm.loop.isvectorized", i32 1} !13 = !{!"llvm.loop.unroll.runtime.disable"} !14 = distinct !{!14, !10, !13, !12}
#include<stdio.h> int main(void){ int n,i,ai,max,min; double sum; sum=0.0; max=-1000000; min=1000000; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&ai); if(ai<min){ min=ai; } if(max<ai){ max=ai; } sum=sum+ai; } printf("%d %d %.0lf\n",min,max,sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_173451/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_173451/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 [13 x i8] c"%d %d %.0lf\0A\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) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %ai) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp12 = icmp sgt i32 %0, 0 br i1 %cmp12, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %sum.016 = phi double [ %add, %for.body ], [ 0.000000e+00, %entry ] %min.015 = phi i32 [ %spec.select, %for.body ], [ 1000000, %entry ] %max.014 = phi i32 [ %max.1, %for.body ], [ -1000000, %entry ] %i.013 = phi i32 [ %inc, %for.body ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ai) %1 = load i32, ptr %ai, align 4, !tbaa !5 %spec.select = call i32 @llvm.smin.i32(i32 %1, i32 %min.015) %max.1 = call i32 @llvm.smax.i32(i32 %max.014, i32 %1) %conv = sitofp i32 %1 to double %add = fadd double %sum.016, %conv %inc = add nuw nsw i32 %i.013, 1 %2 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %entry %max.0.lcssa = phi i32 [ -1000000, %entry ], [ %max.1, %for.body ] %min.0.lcssa = phi i32 [ 1000000, %entry ], [ %spec.select, %for.body ] %sum.0.lcssa = phi double [ 0.000000e+00, %entry ], [ %add, %for.body ] %call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %min.0.lcssa, i32 noundef %max.0.lcssa, double noundef %sum.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %ai) #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: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.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"}
#include<stdio.h> int main(void){ int ai,n,i,b,s; double w; b=-1000000; s=1000000; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&ai); if(ai<s){ s=ai; } if(b<ai){ b=ai; } w=w+ai; } printf("%d %d %0.lf\n",s,b,w); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_173495/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_173495/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 [13 x i8] c"%d %d %0.lf\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %ai = alloca i32, align 4 %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %ai) #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 %cmp12 = icmp sgt i32 %0, 0 call void @llvm.assume(i1 %cmp12) br label %for.body for.body: ; preds = %entry, %for.body %w.016 = phi double [ %add, %for.body ], [ undef, %entry ] %s.015 = phi i32 [ %spec.select, %for.body ], [ 1000000, %entry ] %b.014 = phi i32 [ %b.1, %for.body ], [ -1000000, %entry ] %i.013 = phi i32 [ %inc, %for.body ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ai) %1 = load i32, ptr %ai, align 4, !tbaa !5 %spec.select = call i32 @llvm.smin.i32(i32 %1, i32 %s.015) %b.1 = call i32 @llvm.smax.i32(i32 %b.014, i32 %1) %conv = sitofp i32 %1 to double %add = fadd double %w.016, %conv %inc = add nuw nsw i32 %i.013, 1 %2 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body %call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %spec.select, i32 noundef %b.1, double noundef %add) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %ai) #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: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) declare void @llvm.assume(i1 noundef) #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #4 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } 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 a[10000], min, max, n, i; long long sum = 0; scanf("%d", &n); for(i = 0; i < n; i++){ scanf("%d", &a[i]); sum += a[i]; } max = min = a[0]; for(i = 1; i < n; i++){ if(a[i] > max){ max = a[i]; } if(a[i] < min){ min = a[i]; } } printf("%d %d %lld\n", min, max, sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_173538/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_173538/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 [12 x i8] c"%d %d %lld\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca [10000 x i32], align 16 %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %a) #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 %cmp40 = icmp sgt i32 %0, 0 call void @llvm.assume(i1 %cmp40) br label %for.body for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %sum.042 = phi i64 [ %add, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [10000 x i32], ptr %a, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 %conv = sext i32 %1 to i64 %add = add nsw i64 %sum.042, %conv %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 !9 for.end: ; preds = %for.body %.pre = load i32, ptr %a, align 16, !tbaa !5 %cmp644 = icmp sgt i32 %2, 1 br i1 %cmp644, label %for.body8.preheader, label %for.end25 for.body8.preheader: ; preds = %for.end %wide.trip.count = zext i32 %2 to i64 %4 = add nsw i64 %wide.trip.count, -1 %min.iters.check = icmp ult i32 %2, 9 br i1 %min.iters.check, label %for.body8.preheader67, label %vector.ph vector.ph: ; preds = %for.body8.preheader %n.vec = and i64 %4, -8 %ind.end = or i64 %n.vec, 1 %minmax.ident.splatinsert = insertelement <4 x i32> poison, i32 %.pre, i64 0 %minmax.ident.splat = shufflevector <4 x i32> %minmax.ident.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer %minmax.ident.splatinsert62 = insertelement <4 x i32> poison, i32 %.pre, i64 0 %minmax.ident.splat63 = shufflevector <4 x i32> %minmax.ident.splatinsert62, <4 x i32> poison, <4 x i32> zeroinitializer 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> [ %minmax.ident.splat, %vector.ph ], [ %7, %vector.body ] %vec.phi59 = phi <4 x i32> [ %minmax.ident.splat, %vector.ph ], [ %8, %vector.body ] %vec.phi60 = phi <4 x i32> [ %minmax.ident.splat63, %vector.ph ], [ %9, %vector.body ] %vec.phi61 = phi <4 x i32> [ %minmax.ident.splat63, %vector.ph ], [ %10, %vector.body ] %offset.idx = or i64 %index, 1 %5 = getelementptr inbounds [10000 x i32], ptr %a, i64 0, i64 %offset.idx %wide.load = load <4 x i32>, ptr %5, align 4, !tbaa !5 %6 = getelementptr inbounds i32, ptr %5, i64 4 %wide.load64 = load <4 x i32>, ptr %6, align 4, !tbaa !5 %7 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load, <4 x i32> %vec.phi) %8 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load64, <4 x i32> %vec.phi59) %9 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %wide.load, <4 x i32> %vec.phi60) %10 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %wide.load64, <4 x i32> %vec.phi61) %index.next = add nuw i64 %index, 8 %11 = icmp eq i64 %index.next, %n.vec br i1 %11, label %middle.block, label %vector.body, !llvm.loop !11 middle.block: ; preds = %vector.body %rdx.minmax65 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %9, <4 x i32> %10) %12 = call i32 @llvm.vector.reduce.smin.v4i32(<4 x i32> %rdx.minmax65) %rdx.minmax = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %7, <4 x i32> %8) %13 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax) %cmp.n = icmp eq i64 %4, %n.vec br i1 %cmp.n, label %for.end25, label %for.body8.preheader67 for.body8.preheader67: ; preds = %for.body8.preheader, %middle.block %indvars.iv52.ph = phi i64 [ 1, %for.body8.preheader ], [ %ind.end, %middle.block ] %max.046.ph = phi i32 [ %.pre, %for.body8.preheader ], [ %13, %middle.block ] %min.045.ph = phi i32 [ %.pre, %for.body8.preheader ], [ %12, %middle.block ] br label %for.body8 for.body8: ; preds = %for.body8.preheader67, %for.body8 %indvars.iv52 = phi i64 [ %indvars.iv.next53, %for.body8 ], [ %indvars.iv52.ph, %for.body8.preheader67 ] %max.046 = phi i32 [ %spec.select, %for.body8 ], [ %max.046.ph, %for.body8.preheader67 ] %min.045 = phi i32 [ %min.1, %for.body8 ], [ %min.045.ph, %for.body8.preheader67 ] %arrayidx10 = getelementptr inbounds [10000 x i32], ptr %a, i64 0, i64 %indvars.iv52 %14 = load i32, ptr %arrayidx10, align 4, !tbaa !5 %spec.select = call i32 @llvm.smax.i32(i32 %14, i32 %max.046) %min.1 = call i32 @llvm.smin.i32(i32 %14, i32 %min.045) %indvars.iv.next53 = add nuw nsw i64 %indvars.iv52, 1 %exitcond.not = icmp eq i64 %indvars.iv.next53, %wide.trip.count br i1 %exitcond.not, label %for.end25, label %for.body8, !llvm.loop !14 for.end25: ; preds = %for.body8, %middle.block, %for.end %min.0.lcssa = phi i32 [ %.pre, %for.end ], [ %12, %middle.block ], [ %min.1, %for.body8 ] %max.0.lcssa = phi i32 [ %.pre, %for.end ], [ %13, %middle.block ], [ %spec.select, %for.body8 ] %call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %min.0.lcssa, i32 noundef %max.0.lcssa, i64 noundef %add) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.end.p0(i64 40000, 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: 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) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) declare void @llvm.assume(i1 noundef) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare <4 x i32> @llvm.smax.v4i32(<4 x i32>, <4 x i32>) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare <4 x i32> @llvm.smin.v4i32(<4 x i32>, <4 x i32>) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.smax.v4i32(<4 x i32>) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.smin.v4i32(<4 x 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 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } 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, !13} !12 = !{!"llvm.loop.isvectorized", i32 1} !13 = !{!"llvm.loop.unroll.runtime.disable"} !14 = distinct !{!14, !10, !13, !12}
#include <stdio.h> int main(void){ int n; long long int min,max,sum; scanf("%d",&n); int a[n]; sum=0; int i; for(i=0;i<n;i++){ scanf("%d",&a[i]); if(i==0){min=a[i]; max=a[i]; sum=a[i];} else{ if(min>a[i]) min=a[i]; if(max<a[i]) max=a[i]; sum+=a[i]; } } printf("%lld %lld %lld\n",min,max,sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_173589/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_173589/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 [16 x i8] c"%lld %lld %lld\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { for.inc.peel: %n = 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 %cmp49 = icmp sgt i32 %3, 0 call void @llvm.assume(i1 %cmp49) %call1.peel = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %vla) %4 = load i32, ptr %vla, align 16, !tbaa !5 %conv.peel = sext i32 %4 to i64 %5 = load i32, ptr %n, align 4, !tbaa !5 %cmp.peel = icmp sgt i32 %5, 1 br i1 %cmp.peel, label %for.inc, label %for.end for.inc: ; preds = %for.inc.peel, %for.inc %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 1, %for.inc.peel ] %min.052 = phi i64 [ %spec.select, %for.inc ], [ %conv.peel, %for.inc.peel ] %sum.051 = phi i64 [ %add, %for.inc ], [ %conv.peel, %for.inc.peel ] %max.050 = phi i64 [ %max.1, %for.inc ], [ %conv.peel, %for.inc.peel ] %arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %6 = load i32, ptr %arrayidx, align 4, !tbaa !5 %conv13 = sext i32 %6 to i64 %spec.select = call i64 @llvm.smin.i64(i64 %min.052, i64 %conv13) %max.1 = call i64 @llvm.smax.i64(i64 %max.050, i64 %conv13) %add = add nsw i64 %sum.051, %conv13 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %7 = load i32, ptr %n, align 4, !tbaa !5 %8 = sext i32 %7 to i64 %cmp = icmp slt i64 %indvars.iv.next, %8 br i1 %cmp, label %for.inc, label %for.end, !llvm.loop !9 for.end: ; preds = %for.inc, %for.inc.peel %max.2.lcssa = phi i64 [ %conv.peel, %for.inc.peel ], [ %max.1, %for.inc ] %sum.1.lcssa = phi i64 [ %conv.peel, %for.inc.peel ], [ %add, %for.inc ] %min.2.lcssa = phi i64 [ %conv.peel, %for.inc.peel ], [ %spec.select, %for.inc ] %call34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %min.2.lcssa, i64 noundef %max.2.lcssa, i64 noundef %sum.1.lcssa) 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: 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 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smin.i64(i64, i64) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smax.i64(i64, i64) #4 ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) declare void @llvm.assume(i1 noundef) #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #5 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: 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, !11} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!"llvm.loop.peeled.count", i32 1}
#include<stdio.h> int main(void){ int ai,n,i,min,max; long sum; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&ai); if(i==0){ min=ai; max=ai; sum=ai;} else{ sum=sum+ai; if(min>ai){ min=ai;} if(max<ai){ max=ai;}}} printf("%d %d %ld\n",min,max,sum); return 0;}
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_173631/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_173631/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 [11 x i8] c"%d %d %ld\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { for.inc.peel: %ai = alloca i32, align 4 %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %ai) #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 %cmp20 = icmp sgt i32 %0, 0 call void @llvm.assume(i1 %cmp20) %call1.peel = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ai) %1 = load i32, ptr %ai, align 4, !tbaa !5 %conv.peel = sext i32 %1 to i64 %2 = load i32, ptr %n, align 4, !tbaa !5 %cmp.peel = icmp sgt i32 %2, 1 br i1 %cmp.peel, label %for.inc, label %for.end for.inc: ; preds = %for.inc.peel, %for.inc %sum.024 = phi i64 [ %add, %for.inc ], [ %conv.peel, %for.inc.peel ] %max.023 = phi i32 [ %spec.select19, %for.inc ], [ %1, %for.inc.peel ] %min.022 = phi i32 [ %spec.select, %for.inc ], [ %1, %for.inc.peel ] %i.021 = phi i32 [ %inc, %for.inc ], [ 1, %for.inc.peel ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ai) %3 = load i32, ptr %ai, align 4, !tbaa !5 %conv3 = sext i32 %3 to i64 %add = add nsw i64 %sum.024, %conv3 %spec.select = call i32 @llvm.smin.i32(i32 %min.022, i32 %3) %spec.select19 = call i32 @llvm.smax.i32(i32 %max.023, i32 %3) %inc = add nuw nsw i32 %i.021, 1 %4 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc, %4 br i1 %cmp, label %for.inc, label %for.end, !llvm.loop !9 for.end: ; preds = %for.inc, %for.inc.peel %min.2.lcssa = phi i32 [ %1, %for.inc.peel ], [ %spec.select, %for.inc ] %max.1.lcssa = phi i32 [ %1, %for.inc.peel ], [ %spec.select19, %for.inc ] %sum.1.lcssa = phi i64 [ %conv.peel, %for.inc.peel ], [ %add, %for.inc ] %call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %min.2.lcssa, i32 noundef %max.1.lcssa, i64 noundef %sum.1.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %ai) #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: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) declare void @llvm.assume(i1 noundef) #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #4 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } 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, !11} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!"llvm.loop.peeled.count", i32 1}
#include<stdio.h> int main(){ int i; int n; long long int a, sum = 0, min, max; scanf("%d", &n); for(i = 0;i < n;i++){ scanf("%lld", &a); if(i == 0){ min = a; max = a; } if(min > a){ min = a; } if(max < a){ max = a; } sum += a; } printf("%lld %lld %lld\n",min, max, sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_173675/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_173675/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"%lld\00", align 1 @.str.2 = private unnamed_addr constant [16 x i8] c"%lld %lld %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 %a = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #5 %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 call void @llvm.assume(i1 %cmp17) %call1.peel = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a) %1 = load i64, ptr %a, align 8 %2 = load i32, ptr %n, align 4, !tbaa !5 %cmp.peel = icmp sgt i32 %2, 1 br i1 %cmp.peel, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %max.021 = phi i64 [ %max.2, %for.body ], [ %1, %entry ] %min.020 = phi i64 [ %min.2, %for.body ], [ %1, %entry ] %sum.019 = phi i64 [ %add, %for.body ], [ %1, %entry ] %i.018 = phi i32 [ %inc, %for.body ], [ 1, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a) %3 = load i64, ptr %a, align 8 %min.2 = call i64 @llvm.smin.i64(i64 %min.020, i64 %3) %max.2 = call i64 @llvm.smax.i64(i64 %max.021, i64 %3) %add = add nsw i64 %3, %sum.019 %inc = add nuw nsw i32 %i.018, 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, %entry %min.2.lcssa = phi i64 [ %1, %entry ], [ %min.2, %for.body ] %max.2.lcssa = phi i64 [ %1, %entry ], [ %max.2, %for.body ] %add.lcssa = phi i64 [ %1, %entry ], [ %add, %for.body ] %call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %min.2.lcssa, i64 noundef %max.2.lcssa, i64 noundef %add.lcssa) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #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: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smin.i64(i64, i64) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smax.i64(i64, i64) #3 ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) declare void @llvm.assume(i1 noundef) #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #4 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } 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, !11} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!"llvm.loop.peeled.count", i32 1}
#include <stdio.h> int main(void) { int a; /*??\????????????*/ int n; /*??\???????????°*/ int c; /*??°???????????¨?????°*/ int max; /*??\?????°??§????????§????????°*/ int min; /*??\???????????°??§???????°?????????°*/ long long sum; /*??\???????????°???????¨?*/ max = -1000000; min = 1000000; sum = 0; scanf("%d", &n); for (c = 1; c <= n; c++){ scanf("%d", &a); if (c == 1) { max = a; min = a; } if(max < a){ max = a; } if(min > a){ min = a; } sum = sum + a; } printf("%d %d %lld\n", min, max, sum); return (0); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_173718/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_173718/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 [12 x i8] c"%d %d %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 %n = 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 %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 %cmp.not17 = icmp slt i32 %0, 1 br i1 %cmp.not17, label %for.end, label %for.body.preheader for.body.preheader: ; preds = %entry %call1.peel = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a) %1 = load i32, ptr %a, align 4 %conv.peel = sext i32 %1 to i64 %2 = load i32, ptr %n, align 4, !tbaa !5 %cmp.not.not.peel = icmp sgt i32 %2, 1 br i1 %cmp.not.not.peel, label %for.body, label %for.end for.body: ; preds = %for.body.preheader, %for.body %sum.021 = phi i64 [ %add, %for.body ], [ %conv.peel, %for.body.preheader ] %min.020 = phi i32 [ %min.2, %for.body ], [ %1, %for.body.preheader ] %max.019 = phi i32 [ %max.2, %for.body ], [ %1, %for.body.preheader ] %c.018 = phi i32 [ %inc, %for.body ], [ 2, %for.body.preheader ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a) %3 = load i32, ptr %a, align 4 %max.2 = call i32 @llvm.smax.i32(i32 %max.019, i32 %3) %min.2 = call i32 @llvm.smin.i32(i32 %min.020, i32 %3) %conv = sext i32 %3 to i64 %add = add nsw i64 %sum.021, %conv %inc = add nuw nsw i32 %c.018, 1 %4 = load i32, ptr %n, align 4, !tbaa !5 %cmp.not.not = icmp slt i32 %c.018, %4 br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %for.body.preheader, %entry %max.0.lcssa = phi i32 [ -1000000, %entry ], [ %1, %for.body.preheader ], [ %max.2, %for.body ] %min.0.lcssa = phi i32 [ 1000000, %entry ], [ %1, %for.body.preheader ], [ %min.2, %for.body ] %sum.0.lcssa = phi i64 [ 0, %entry ], [ %conv.peel, %for.body.preheader ], [ %add, %for.body ] %call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %min.0.lcssa, i32 noundef %max.0.lcssa, i64 noundef %sum.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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 i32 @llvm.smax.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.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, !11} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!"llvm.loop.peeled.count", i32 1}
#include <stdio.h> int main(void) { int i,n,a[10000],min,max; long long int sum=0; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d",&a[i]); sum += a[i]; } min = a[0]; max = a[0]; for(i=1;i<n;i++) { if(min>a[i]) { min = a[i]; } if(max<a[i]) { max = a[i]; } } printf("%d %d %lld\n",min,max,sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_173769/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_173769/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 [12 x i8] c"%d %d %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 %a = alloca [10000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %a) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp41 = icmp sgt i32 %0, 0 call void @llvm.assume(i1 %cmp41) br label %for.body for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %sum.043 = phi i64 [ %add, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [10000 x i32], ptr %a, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 %conv = sext i32 %1 to i64 %add = add nsw i64 %sum.043, %conv %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 !9 for.end: ; preds = %for.body %.pre = load i32, ptr %a, align 16, !tbaa !5 %cmp745 = icmp sgt i32 %2, 1 br i1 %cmp745, label %for.body9.preheader, label %for.end26 for.body9.preheader: ; preds = %for.end %wide.trip.count = zext i32 %2 to i64 %4 = add nsw i64 %wide.trip.count, -1 %min.iters.check = icmp ult i32 %2, 9 br i1 %min.iters.check, label %for.body9.preheader68, label %vector.ph vector.ph: ; preds = %for.body9.preheader %n.vec = and i64 %4, -8 %ind.end = or i64 %n.vec, 1 %minmax.ident.splatinsert = insertelement <4 x i32> poison, i32 %.pre, i64 0 %minmax.ident.splat = shufflevector <4 x i32> %minmax.ident.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer %minmax.ident.splatinsert63 = insertelement <4 x i32> poison, i32 %.pre, i64 0 %minmax.ident.splat64 = shufflevector <4 x i32> %minmax.ident.splatinsert63, <4 x i32> poison, <4 x i32> zeroinitializer 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> [ %minmax.ident.splat, %vector.ph ], [ %9, %vector.body ] %vec.phi60 = phi <4 x i32> [ %minmax.ident.splat, %vector.ph ], [ %10, %vector.body ] %vec.phi61 = phi <4 x i32> [ %minmax.ident.splat64, %vector.ph ], [ %7, %vector.body ] %vec.phi62 = phi <4 x i32> [ %minmax.ident.splat64, %vector.ph ], [ %8, %vector.body ] %offset.idx = or i64 %index, 1 %5 = getelementptr inbounds [10000 x i32], ptr %a, i64 0, i64 %offset.idx %wide.load = load <4 x i32>, ptr %5, align 4, !tbaa !5 %6 = getelementptr inbounds i32, ptr %5, i64 4 %wide.load65 = load <4 x i32>, ptr %6, align 4, !tbaa !5 %7 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %vec.phi61, <4 x i32> %wide.load) %8 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %vec.phi62, <4 x i32> %wide.load65) %9 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi, <4 x i32> %wide.load) %10 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi60, <4 x i32> %wide.load65) %index.next = add nuw i64 %index, 8 %11 = icmp eq i64 %index.next, %n.vec br i1 %11, label %middle.block, label %vector.body, !llvm.loop !11 middle.block: ; preds = %vector.body %rdx.minmax66 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %7, <4 x i32> %8) %12 = call i32 @llvm.vector.reduce.smin.v4i32(<4 x i32> %rdx.minmax66) %rdx.minmax = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %9, <4 x i32> %10) %13 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax) %cmp.n = icmp eq i64 %4, %n.vec br i1 %cmp.n, label %for.end26, label %for.body9.preheader68 for.body9.preheader68: ; preds = %for.body9.preheader, %middle.block %indvars.iv53.ph = phi i64 [ 1, %for.body9.preheader ], [ %ind.end, %middle.block ] %max.048.ph = phi i32 [ %.pre, %for.body9.preheader ], [ %13, %middle.block ] %min.047.ph = phi i32 [ %.pre, %for.body9.preheader ], [ %12, %middle.block ] br label %for.body9 for.body9: ; preds = %for.body9.preheader68, %for.body9 %indvars.iv53 = phi i64 [ %indvars.iv.next54, %for.body9 ], [ %indvars.iv53.ph, %for.body9.preheader68 ] %max.048 = phi i32 [ %max.1, %for.body9 ], [ %max.048.ph, %for.body9.preheader68 ] %min.047 = phi i32 [ %spec.select, %for.body9 ], [ %min.047.ph, %for.body9.preheader68 ] %arrayidx11 = getelementptr inbounds [10000 x i32], ptr %a, i64 0, i64 %indvars.iv53 %14 = load i32, ptr %arrayidx11, align 4, !tbaa !5 %spec.select = call i32 @llvm.smin.i32(i32 %min.047, i32 %14) %max.1 = call i32 @llvm.smax.i32(i32 %max.048, i32 %14) %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.end26, label %for.body9, !llvm.loop !14 for.end26: ; preds = %for.body9, %middle.block, %for.end %min.0.lcssa = phi i32 [ %.pre, %for.end ], [ %12, %middle.block ], [ %spec.select, %for.body9 ] %max.0.lcssa = phi i32 [ %.pre, %for.end ], [ %13, %middle.block ], [ %max.1, %for.body9 ] %call27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %min.0.lcssa, i32 noundef %max.0.lcssa, i64 noundef %add) call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %a) #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: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) declare void @llvm.assume(i1 noundef) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare <4 x i32> @llvm.smin.v4i32(<4 x i32>, <4 x i32>) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare <4 x i32> @llvm.smax.v4i32(<4 x i32>, <4 x i32>) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.smax.v4i32(<4 x i32>) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.smin.v4i32(<4 x 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 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } 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, !13} !12 = !{!"llvm.loop.isvectorized", i32 1} !13 = !{!"llvm.loop.unroll.runtime.disable"} !14 = distinct !{!14, !10, !13, !12}
#include<stdio.h> int main(void){ long n,a[10000],i,Max=-1000000,Min=1000000,Sum=0; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%ld",&a[i]); if(a[i]>Max){ Max=a[i]; } if(a[i]<Min){ Min=a[i]; } Sum+=a[i]; } printf("%ld %ld %ld\n",Min,Max,Sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_173811/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_173811/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"%ld\00", align 1 @.str.2 = private unnamed_addr constant [13 x i8] c"%ld %ld %ld\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i64, align 8 %a = alloca [10000 x i64], align 16 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 80000, ptr nonnull %a) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i64, ptr %n, align 8, !tbaa !5 %cmp23 = icmp sgt i64 %0, 0 br i1 %cmp23, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %Sum.027 = phi i64 [ %add, %for.body ], [ 0, %entry ] %Min.026 = phi i64 [ %Min.1, %for.body ], [ 1000000, %entry ] %Max.025 = phi i64 [ %spec.select, %for.body ], [ -1000000, %entry ] %i.024 = phi i64 [ %inc, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [10000 x i64], ptr %a, i64 0, i64 %i.024 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx) %1 = load i64, ptr %arrayidx, align 8, !tbaa !5 %spec.select = call i64 @llvm.smax.i64(i64 %1, i64 %Max.025) %Min.1 = call i64 @llvm.smin.i64(i64 %1, i64 %Min.026) %add = add nsw i64 %1, %Sum.027 %inc = add nuw nsw i64 %i.024, 1 %2 = load i64, ptr %n, align 8, !tbaa !5 %cmp = icmp slt i64 %inc, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %entry %Max.0.lcssa = phi i64 [ -1000000, %entry ], [ %spec.select, %for.body ] %Min.0.lcssa = phi i64 [ 1000000, %entry ], [ %Min.1, %for.body ] %Sum.0.lcssa = phi i64 [ 0, %entry ], [ %add, %for.body ] %call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %Min.0.lcssa, i64 noundef %Max.0.lcssa, i64 noundef %Sum.0.lcssa) call void @llvm.lifetime.end.p0(i64 80000, ptr nonnull %a) #4 call void @llvm.lifetime.end.p0(i64 8, 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: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smax.i64(i64, i64) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smin.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"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #define MAX 10000 int main(void) { char a[MAX],b[MAX],c[MAX]; int i,j,k,l,r,n,m; for(i=0;i<MAX;i++) { a[i]=getchar(); if(a[i]=='|') break; } l=i; for(i=0;i<MAX;i++) { b[i]=getchar(); if(b[i]=='\n') break; } r=i; for(i=0;i<MAX;i++) { c[i]=getchar(); if(c[i]=='\n') break; } n=i; m=(n+l+r)/2; if(m*2!=n+l+r) printf("Impossible"); else if(l+n<r||r+n<l) printf("Impossible"); else { for(i=0;i<m-l;i++) a[l+i]=c[i]; a[m]='|'; for(j=i;j<=n;j++) b[r+j-i]=c[j]; for(i=0;i<=m;i++) printf("%c",a[i]); for(i=0;i<=m;i++) printf("%c",b[i]); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_17387/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_17387/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 [11 x i8] c"Impossible\00", align 1 @stdin = external local_unnamed_addr global ptr, align 8 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca [10000 x i8], align 16 %b = alloca [10000 x i8], align 16 %c = alloca [10000 x i8], align 16 call void @llvm.lifetime.start.p0(i64 10000, ptr nonnull %a) #5 call void @llvm.lifetime.start.p0(i64 10000, ptr nonnull %b) #5 call void @llvm.lifetime.start.p0(i64 10000, ptr nonnull %c) #5 br label %for.body for.body: ; preds = %entry, %for.inc %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.inc ] %0 = load ptr, ptr @stdin, align 8, !tbaa !5 %call.i = tail call i32 @getc(ptr noundef %0) %conv = trunc i32 %call.i to i8 %arrayidx = getelementptr inbounds [10000 x i8], ptr %a, i64 0, i64 %indvars.iv store i8 %conv, ptr %arrayidx, align 1, !tbaa !9 %sext.mask = and i32 %call.i, 255 %cmp4 = icmp eq i32 %sext.mask, 124 br i1 %cmp4, label %for.end.split.loop.exit, label %for.inc for.inc: ; preds = %for.body %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, 10000 br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !10 for.end.split.loop.exit: ; preds = %for.body %1 = trunc i64 %indvars.iv to i32 br label %for.end for.end: ; preds = %for.inc, %for.end.split.loop.exit %i.0.lcssa = phi i32 [ %1, %for.end.split.loop.exit ], [ 10000, %for.inc ] br label %for.body9 for.body9: ; preds = %for.end, %for.inc21 %indvars.iv171 = phi i64 [ 0, %for.end ], [ %indvars.iv.next172, %for.inc21 ] %2 = load ptr, ptr @stdin, align 8, !tbaa !5 %call.i159 = tail call i32 @getc(ptr noundef %2) %conv11 = trunc i32 %call.i159 to i8 %arrayidx13 = getelementptr inbounds [10000 x i8], ptr %b, i64 0, i64 %indvars.iv171 store i8 %conv11, ptr %arrayidx13, align 1, !tbaa !9 %sext.mask155 = and i32 %call.i159, 255 %cmp17 = icmp eq i32 %sext.mask155, 10 br i1 %cmp17, label %for.end23.split.loop.exit, label %for.inc21 for.inc21: ; preds = %for.body9 %indvars.iv.next172 = add nuw nsw i64 %indvars.iv171, 1 %exitcond174.not = icmp eq i64 %indvars.iv.next172, 10000 br i1 %exitcond174.not, label %for.end23, label %for.body9, !llvm.loop !12 for.end23.split.loop.exit: ; preds = %for.body9 %3 = trunc i64 %indvars.iv171 to i32 br label %for.end23 for.end23: ; preds = %for.inc21, %for.end23.split.loop.exit %i.1.lcssa = phi i32 [ %3, %for.end23.split.loop.exit ], [ 10000, %for.inc21 ] br label %for.body27 for.body27: ; preds = %for.end23, %for.inc39 %indvars.iv175 = phi i64 [ 0, %for.end23 ], [ %indvars.iv.next176, %for.inc39 ] %4 = load ptr, ptr @stdin, align 8, !tbaa !5 %call.i160 = tail call i32 @getc(ptr noundef %4) %conv29 = trunc i32 %call.i160 to i8 %arrayidx31 = getelementptr inbounds [10000 x i8], ptr %c, i64 0, i64 %indvars.iv175 store i8 %conv29, ptr %arrayidx31, align 1, !tbaa !9 %sext.mask156 = and i32 %call.i160, 255 %cmp35 = icmp eq i32 %sext.mask156, 10 br i1 %cmp35, label %for.end41.split.loop.exit, label %for.inc39 for.inc39: ; preds = %for.body27 %indvars.iv.next176 = add nuw nsw i64 %indvars.iv175, 1 %exitcond178.not = icmp eq i64 %indvars.iv.next176, 10000 br i1 %exitcond178.not, label %for.end41, label %for.body27, !llvm.loop !13 for.end41.split.loop.exit: ; preds = %for.body27 %5 = trunc i64 %indvars.iv175 to i32 br label %for.end41 for.end41: ; preds = %for.inc39, %for.end41.split.loop.exit %i.2.lcssa = phi i32 [ %5, %for.end41.split.loop.exit ], [ 10000, %for.inc39 ] %add = add nuw nsw i32 %i.2.lcssa, %i.0.lcssa %add42 = add nuw nsw i32 %add, %i.1.lcssa %div157 = lshr i32 %add42, 1 %6 = and i32 %add42, 1 %cmp45.not = icmp eq i32 %6, 0 br i1 %cmp45.not, label %if.else, label %if.end108.sink.split if.else: ; preds = %for.end41 %cmp50 = icmp ult i32 %add, %i.1.lcssa %add52 = add nuw nsw i32 %i.2.lcssa, %i.1.lcssa %cmp53 = icmp ult i32 %add52, %i.0.lcssa %or.cond = select i1 %cmp50, i1 true, i1 %cmp53 br i1 %or.cond, label %if.end108.sink.split, label %for.cond58.preheader for.cond58.preheader: ; preds = %if.else %cmp59164 = icmp sgt i32 %div157, %i.0.lcssa br i1 %cmp59164, label %for.end69, label %for.end69.thread for.end69.thread: ; preds = %for.cond58.preheader %idxprom70200 = zext i32 %div157 to i64 %arrayidx71201 = getelementptr inbounds [10000 x i8], ptr %a, i64 0, i64 %idxprom70200 store i8 124, ptr %arrayidx71201, align 1, !tbaa !9 br label %for.body75.lr.ph for.end69: ; preds = %for.cond58.preheader %7 = zext i32 %i.0.lcssa to i64 %scevgep = getelementptr i8, ptr %a, i64 %7 %8 = xor i32 %i.0.lcssa, -1 %9 = add i32 %div157, %8 %10 = zext i32 %9 to i64 %11 = add nuw nsw i64 %10, 1 call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(1) %scevgep, ptr noundef nonnull align 16 dereferenceable(1) %c, i64 %11, i1 false), !tbaa !9 %12 = trunc i64 %11 to i32 %idxprom70 = zext i32 %div157 to i64 %arrayidx71 = getelementptr inbounds [10000 x i8], ptr %a, i64 0, i64 %idxprom70 store i8 124, ptr %arrayidx71, align 1, !tbaa !9 %cmp73.not166 = icmp ult i32 %i.2.lcssa, %12 br i1 %cmp73.not166, label %for.cond85.preheader, label %for.body75.lr.ph for.body75.lr.ph: ; preds = %for.end69.thread, %for.end69 %i.3.lcssa203 = phi i32 [ 0, %for.end69.thread ], [ %12, %for.end69 ] %13 = zext i32 %i.1.lcssa to i64 %scevgep184 = getelementptr i8, ptr %b, i64 %13 %14 = zext i32 %i.3.lcssa203 to i64 %scevgep185 = getelementptr i8, ptr %c, i64 %14 %15 = sub i32 %i.2.lcssa, %i.3.lcssa203 %16 = zext i32 %15 to i64 %17 = add nuw nsw i64 %16, 1 call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(1) %scevgep184, ptr noundef nonnull align 1 dereferenceable(1) %scevgep185, i64 %17, i1 false), !tbaa !9 br label %for.cond85.preheader for.cond85.preheader: ; preds = %for.body75.lr.ph, %for.end69 %18 = add nuw i32 %div157, 1 %wide.trip.count192 = zext i32 %18 to i64 br label %for.body88 for.body88: ; preds = %for.cond85.preheader, %for.body88 %indvars.iv189 = phi i64 [ 0, %for.cond85.preheader ], [ %indvars.iv.next190, %for.body88 ] %arrayidx90 = getelementptr inbounds [10000 x i8], ptr %a, i64 0, i64 %indvars.iv189 %19 = load i8, ptr %arrayidx90, align 1, !tbaa !9 %conv91 = sext i8 %19 to i32 %putchar158 = tail call i32 @putchar(i32 %conv91) %indvars.iv.next190 = add nuw nsw i64 %indvars.iv189, 1 %exitcond193.not = icmp eq i64 %indvars.iv.next190, %wide.trip.count192 br i1 %exitcond193.not, label %for.body99, label %for.body88, !llvm.loop !14 for.body99: ; preds = %for.body88, %for.body99 %indvars.iv194 = phi i64 [ %indvars.iv.next195, %for.body99 ], [ 0, %for.body88 ] %arrayidx101 = getelementptr inbounds [10000 x i8], ptr %b, i64 0, i64 %indvars.iv194 %20 = load i8, ptr %arrayidx101, align 1, !tbaa !9 %conv102 = sext i8 %20 to i32 %putchar = tail call i32 @putchar(i32 %conv102) %indvars.iv.next195 = add nuw nsw i64 %indvars.iv194, 1 %exitcond198.not = icmp eq i64 %indvars.iv.next195, %wide.trip.count192 br i1 %exitcond198.not, label %if.end108, label %for.body99, !llvm.loop !15 if.end108.sink.split: ; preds = %if.else, %for.end41 %call56 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str) br label %if.end108 if.end108: ; preds = %for.body99, %if.end108.sink.split call void @llvm.lifetime.end.p0(i64 10000, ptr nonnull %c) #5 call void @llvm.lifetime.end.p0(i64 10000, ptr nonnull %b) #5 call void @llvm.lifetime.end.p0(i64 10000, 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 @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 @getc(ptr nocapture noundef) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4 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 nounwind willreturn memory(argmem: readwrite) } attributes #5 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"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 = !{!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}
#include<stdio.h> int main(){ int i, n, max, min; int num[10000]; long long sum = 0; scanf("%d", &n); for(i=0; i<n; i++){ scanf("%d", &num[i]); sum += num[i]; } min = num[0]; max = num[0]; for(i=0;i<n;i++){ if(max < num[i]) max = num[i]; if(min > num[i]) min = num[i]; } printf("%d %d %lld\n", min, max, sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_173912/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_173912/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 [12 x i8] c"%d %d %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 %num = alloca [10000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %num) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp41 = icmp sgt i32 %0, 0 call void @llvm.assume(i1 %cmp41) br label %for.body for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %sum.043 = phi i64 [ %add, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [10000 x i32], ptr %num, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 %conv = sext i32 %1 to i64 %add = add nsw i64 %sum.043, %conv %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 !9 for.end: ; preds = %for.body %.pre = load i32, ptr %num, align 16, !tbaa !5 %cmp745 = icmp sgt i32 %2, 0 br i1 %cmp745, label %for.body9.preheader, label %for.end26 for.body9.preheader: ; preds = %for.end %wide.trip.count = zext i32 %2 to i64 %min.iters.check = icmp ult i32 %2, 8 br i1 %min.iters.check, label %for.body9.preheader68, label %vector.ph vector.ph: ; preds = %for.body9.preheader %n.vec = and i64 %wide.trip.count, 4294967288 %minmax.ident.splatinsert = insertelement <4 x i32> poison, i32 %.pre, i64 0 %minmax.ident.splat = shufflevector <4 x i32> %minmax.ident.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer %minmax.ident.splatinsert63 = insertelement <4 x i32> poison, i32 %.pre, i64 0 %minmax.ident.splat64 = shufflevector <4 x i32> %minmax.ident.splatinsert63, <4 x i32> poison, <4 x i32> zeroinitializer 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> [ %minmax.ident.splat, %vector.ph ], [ %8, %vector.body ] %vec.phi60 = phi <4 x i32> [ %minmax.ident.splat, %vector.ph ], [ %9, %vector.body ] %vec.phi61 = phi <4 x i32> [ %minmax.ident.splat64, %vector.ph ], [ %6, %vector.body ] %vec.phi62 = phi <4 x i32> [ %minmax.ident.splat64, %vector.ph ], [ %7, %vector.body ] %4 = getelementptr inbounds [10000 x i32], ptr %num, i64 0, i64 %index %wide.load = load <4 x i32>, ptr %4, align 16, !tbaa !5 %5 = getelementptr inbounds i32, ptr %4, i64 4 %wide.load65 = load <4 x i32>, ptr %5, align 16, !tbaa !5 %6 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi61, <4 x i32> %wide.load) %7 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi62, <4 x i32> %wide.load65) %8 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %vec.phi, <4 x i32> %wide.load) %9 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %vec.phi60, <4 x i32> %wide.load65) %index.next = add nuw i64 %index, 8 %10 = icmp eq i64 %index.next, %n.vec br i1 %10, label %middle.block, label %vector.body, !llvm.loop !11 middle.block: ; preds = %vector.body %rdx.minmax66 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %6, <4 x i32> %7) %11 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax66) %rdx.minmax = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %8, <4 x i32> %9) %12 = call i32 @llvm.vector.reduce.smin.v4i32(<4 x i32> %rdx.minmax) %cmp.n = icmp eq i64 %n.vec, %wide.trip.count br i1 %cmp.n, label %for.end26, label %for.body9.preheader68 for.body9.preheader68: ; preds = %for.body9.preheader, %middle.block %indvars.iv53.ph = phi i64 [ 0, %for.body9.preheader ], [ %n.vec, %middle.block ] %min.048.ph = phi i32 [ %.pre, %for.body9.preheader ], [ %12, %middle.block ] %max.047.ph = phi i32 [ %.pre, %for.body9.preheader ], [ %11, %middle.block ] br label %for.body9 for.body9: ; preds = %for.body9.preheader68, %for.body9 %indvars.iv53 = phi i64 [ %indvars.iv.next54, %for.body9 ], [ %indvars.iv53.ph, %for.body9.preheader68 ] %min.048 = phi i32 [ %min.1, %for.body9 ], [ %min.048.ph, %for.body9.preheader68 ] %max.047 = phi i32 [ %spec.select, %for.body9 ], [ %max.047.ph, %for.body9.preheader68 ] %arrayidx11 = getelementptr inbounds [10000 x i32], ptr %num, i64 0, i64 %indvars.iv53 %13 = load i32, ptr %arrayidx11, align 4, !tbaa !5 %spec.select = call i32 @llvm.smax.i32(i32 %max.047, i32 %13) %min.1 = call i32 @llvm.smin.i32(i32 %min.048, i32 %13) %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.end26, label %for.body9, !llvm.loop !14 for.end26: ; preds = %for.body9, %middle.block, %for.end %max.0.lcssa = phi i32 [ %.pre, %for.end ], [ %11, %middle.block ], [ %spec.select, %for.body9 ] %min.0.lcssa = phi i32 [ %.pre, %for.end ], [ %12, %middle.block ], [ %min.1, %for.body9 ] %call27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %min.0.lcssa, i32 noundef %max.0.lcssa, i64 noundef %add) call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %num) #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: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) declare void @llvm.assume(i1 noundef) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare <4 x i32> @llvm.smax.v4i32(<4 x i32>, <4 x i32>) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare <4 x i32> @llvm.smin.v4i32(<4 x i32>, <4 x i32>) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.smin.v4i32(<4 x i32>) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.smax.v4i32(<4 x 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 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } 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, !13} !12 = !{!"llvm.loop.isvectorized", i32 1} !13 = !{!"llvm.loop.unroll.runtime.disable"} !14 = distinct !{!14, !10, !13, !12}
#include<stdio.h> int main(void){ int n,i,x,max,min; long int sum=0; scanf("%d",&n); scanf("%d",&x); min=x; max=x; sum+=x; for(i=1;i<n;i++){ scanf("%d",&x); if(x<min) min=x; if(x>max) max=x; sum+=x; } printf("%d %d %ld\n",min,max,sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_173956/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_173956/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 [11 x i8] c"%d %d %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 %x = 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 %x) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x) %0 = load i32, ptr %x, align 4, !tbaa !5 %conv = sext i32 %0 to i64 %1 = load i32, ptr %n, align 4, !tbaa !5 %cmp19 = icmp sgt i32 %1, 1 br i1 %cmp19, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %sum.023 = phi i64 [ %add11, %for.body ], [ %conv, %entry ] %min.022 = phi i32 [ %spec.select, %for.body ], [ %0, %entry ] %max.021 = phi i32 [ %max.1, %for.body ], [ %0, %entry ] %i.020 = phi i32 [ %inc, %for.body ], [ 1, %entry ] %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x) %2 = load i32, ptr %x, align 4, !tbaa !5 %spec.select = call i32 @llvm.smin.i32(i32 %2, i32 %min.022) %max.1 = call i32 @llvm.smax.i32(i32 %2, i32 %max.021) %conv10 = sext i32 %2 to i64 %add11 = add nsw i64 %sum.023, %conv10 %inc = add nuw nsw i32 %i.020, 1 %3 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc, %3 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %entry %max.0.lcssa = phi i32 [ %0, %entry ], [ %max.1, %for.body ] %min.0.lcssa = phi i32 [ %0, %entry ], [ %spec.select, %for.body ] %sum.0.lcssa = phi i64 [ %conv, %entry ], [ %add11, %for.body ] %call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %min.0.lcssa, i32 noundef %max.0.lcssa, i64 noundef %sum.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #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: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.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"}
#include <stdio.h> long long int b[100005]; long long int a[200010]; int main(void) { long long int N; scanf("%lld",&N); for(long long int i=0;i<N/2;i++) scanf("%lld",&b[i]); long long int diff=0; for(long long int i=0;i<N/2;i++) { long long int pos1,pos2; pos1=i; pos2=N-i-1; long long int pos3,pos4; pos3=pos1-1; pos4=pos2+1; long long int query=b[i]; if(pos1==0) { a[0]=0; a[N-1]=query; } else if(a[pos3]<=diff&&a[pos4]>=query-diff) { a[pos1]=diff; a[pos2]=query-diff; } else { diff+=query-diff-a[pos4]; a[pos1]=diff; a[pos2]=query-diff; } } for(long long int i=0;i<N;i++) printf("%lld ",a[i]); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_174/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_174/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 @b = dso_local global [100005 x i64] zeroinitializer, align 16 @a = dso_local local_unnamed_addr global [200010 x i64] zeroinitializer, align 16 @.str.1 = private unnamed_addr constant [6 x i8] c"%lld \00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %N = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N) %0 = load i64, ptr %N, align 8, !tbaa !5 %div71 = sdiv i64 %0, 2 %cmp72 = icmp sgt i64 %0, 1 br i1 %cmp72, label %for.body, label %for.cond3.preheader for.cond3.preheader: ; preds = %for.body, %entry %1 = phi i64 [ %0, %entry ], [ %3, %for.body ] %div.lcssa = phi i64 [ %div71, %entry ], [ %div, %for.body ] %cmp575 = icmp sgt i64 %div.lcssa, 0 br i1 %cmp575, label %if.end31.peel, label %for.cond36.preheader if.end31.peel: ; preds = %for.cond3.preheader %2 = load i64, ptr @b, align 16, !tbaa !5 %sub12 = add nsw i64 %1, -1 %arrayidx13 = getelementptr inbounds [200010 x i64], ptr @a, i64 0, i64 %sub12 store i64 0, ptr @a, align 16, !tbaa !5 store i64 %2, ptr %arrayidx13, align 8, !tbaa !5 %exitcond.peel.not = icmp eq i64 %div.lcssa, 1 br i1 %exitcond.peel.not, label %for.cond36.preheader, label %if.else for.body: ; preds = %entry, %for.body %i.073 = phi i64 [ %inc, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100005 x i64], ptr @b, i64 0, i64 %i.073 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %inc = add nuw nsw i64 %i.073, 1 %3 = load i64, ptr %N, align 8, !tbaa !5 %div = sdiv i64 %3, 2 %cmp = icmp slt i64 %inc, %div br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !9 for.cond36.preheader: ; preds = %if.else, %if.end31.peel, %for.cond3.preheader %cmp3778 = icmp sgt i64 %1, 0 br i1 %cmp3778, label %for.body39, label %for.cond.cleanup38 if.else: ; preds = %if.end31.peel, %if.else %diff.077 = phi i64 [ %diff.077.sink, %if.else ], [ 0, %if.end31.peel ] %i2.076 = phi i64 [ %inc33, %if.else ], [ 1, %if.end31.peel ] %sub = sub nsw i64 %1, %i2.076 %sub8 = add nsw i64 %sub, -1 %arrayidx10 = getelementptr inbounds [100005 x i64], ptr @b, i64 0, i64 %i2.076 %4 = load i64, ptr %arrayidx10, align 8, !tbaa !5 %sub9 = add nsw i64 %i2.076, -1 %arrayidx14 = getelementptr inbounds [200010 x i64], ptr @a, i64 0, i64 %sub9 %5 = load i64, ptr %arrayidx14, align 8, !tbaa !5 %cmp15.not = icmp sgt i64 %5, %diff.077 %arrayidx25.phi.trans.insert = getelementptr inbounds [200010 x i64], ptr @a, i64 0, i64 %sub %.pre = load i64, ptr %arrayidx25.phi.trans.insert, align 8, !tbaa !5 %sub17 = sub nsw i64 %4, %diff.077 %cmp18.not = icmp slt i64 %.pre, %sub17 %or.cond = select i1 %cmp15.not, i1 true, i1 %cmp18.not %add27 = sub i64 %4, %.pre %diff.077.sink = select i1 %or.cond, i64 %add27, i64 %diff.077 %sub17.sink = select i1 %or.cond, i64 %.pre, i64 %sub17 %arrayidx20 = getelementptr inbounds [200010 x i64], ptr @a, i64 0, i64 %i2.076 store i64 %diff.077.sink, ptr %arrayidx20, align 8, !tbaa !5 %arrayidx22 = getelementptr inbounds [200010 x i64], ptr @a, i64 0, i64 %sub8 store i64 %sub17.sink, ptr %arrayidx22, align 8, !tbaa !5 %inc33 = add nuw nsw i64 %i2.076, 1 %exitcond.not = icmp eq i64 %inc33, %div.lcssa br i1 %exitcond.not, label %for.cond36.preheader, label %if.else, !llvm.loop !11 for.cond.cleanup38: ; preds = %for.body39, %for.cond36.preheader call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %N) #3 ret i32 0 for.body39: ; preds = %for.cond36.preheader, %for.body39 %i35.079 = phi i64 [ %inc43, %for.body39 ], [ 0, %for.cond36.preheader ] %arrayidx40 = getelementptr inbounds [200010 x i64], ptr @a, i64 0, i64 %i35.079 %6 = load i64, ptr %arrayidx40, align 8, !tbaa !5 %call41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %6) %inc43 = add nuw nsw i64 %i35.079, 1 %7 = load i64, ptr %N, align 8, !tbaa !5 %cmp37 = icmp slt i64 %inc43, %7 br i1 %cmp37, label %for.body39, label %for.cond.cleanup38, !llvm.loop !13 } ; 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 = !{!"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, !10, !12} !12 = !{!"llvm.loop.peeled.count", i32 1} !13 = distinct !{!13, !10}
#include <stdio.h> int main(void) { int a[10000], min, max, n, i; long long sum = 0; scanf("%d", &n); for(i = 0; i < n; i++){ scanf("%d", &a[i]); sum += a[i]; } max = min = a[0]; for(i = 1; i < n; i++){ if(a[i] > max)max = a[i]; if(a[i] < min)min = a[i]; } printf("%d %d %lld\n", min, max, sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_174056/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_174056/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 [12 x i8] c"%d %d %lld\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca [10000 x i32], align 16 %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %a) #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 %cmp40 = icmp sgt i32 %0, 0 call void @llvm.assume(i1 %cmp40) br label %for.body for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %sum.042 = phi i64 [ %add, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [10000 x i32], ptr %a, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 %conv = sext i32 %1 to i64 %add = add nsw i64 %sum.042, %conv %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 !9 for.end: ; preds = %for.body %.pre = load i32, ptr %a, align 16, !tbaa !5 %cmp644 = icmp sgt i32 %2, 1 br i1 %cmp644, label %for.body8.preheader, label %for.end25 for.body8.preheader: ; preds = %for.end %wide.trip.count = zext i32 %2 to i64 %4 = add nsw i64 %wide.trip.count, -1 %min.iters.check = icmp ult i32 %2, 9 br i1 %min.iters.check, label %for.body8.preheader67, label %vector.ph vector.ph: ; preds = %for.body8.preheader %n.vec = and i64 %4, -8 %ind.end = or i64 %n.vec, 1 %minmax.ident.splatinsert = insertelement <4 x i32> poison, i32 %.pre, i64 0 %minmax.ident.splat = shufflevector <4 x i32> %minmax.ident.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer %minmax.ident.splatinsert62 = insertelement <4 x i32> poison, i32 %.pre, i64 0 %minmax.ident.splat63 = shufflevector <4 x i32> %minmax.ident.splatinsert62, <4 x i32> poison, <4 x i32> zeroinitializer 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> [ %minmax.ident.splat, %vector.ph ], [ %7, %vector.body ] %vec.phi59 = phi <4 x i32> [ %minmax.ident.splat, %vector.ph ], [ %8, %vector.body ] %vec.phi60 = phi <4 x i32> [ %minmax.ident.splat63, %vector.ph ], [ %9, %vector.body ] %vec.phi61 = phi <4 x i32> [ %minmax.ident.splat63, %vector.ph ], [ %10, %vector.body ] %offset.idx = or i64 %index, 1 %5 = getelementptr inbounds [10000 x i32], ptr %a, i64 0, i64 %offset.idx %wide.load = load <4 x i32>, ptr %5, align 4, !tbaa !5 %6 = getelementptr inbounds i32, ptr %5, i64 4 %wide.load64 = load <4 x i32>, ptr %6, align 4, !tbaa !5 %7 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load, <4 x i32> %vec.phi) %8 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load64, <4 x i32> %vec.phi59) %9 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %wide.load, <4 x i32> %vec.phi60) %10 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %wide.load64, <4 x i32> %vec.phi61) %index.next = add nuw i64 %index, 8 %11 = icmp eq i64 %index.next, %n.vec br i1 %11, label %middle.block, label %vector.body, !llvm.loop !11 middle.block: ; preds = %vector.body %rdx.minmax65 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %9, <4 x i32> %10) %12 = call i32 @llvm.vector.reduce.smin.v4i32(<4 x i32> %rdx.minmax65) %rdx.minmax = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %7, <4 x i32> %8) %13 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax) %cmp.n = icmp eq i64 %4, %n.vec br i1 %cmp.n, label %for.end25, label %for.body8.preheader67 for.body8.preheader67: ; preds = %for.body8.preheader, %middle.block %indvars.iv52.ph = phi i64 [ 1, %for.body8.preheader ], [ %ind.end, %middle.block ] %max.046.ph = phi i32 [ %.pre, %for.body8.preheader ], [ %13, %middle.block ] %min.045.ph = phi i32 [ %.pre, %for.body8.preheader ], [ %12, %middle.block ] br label %for.body8 for.body8: ; preds = %for.body8.preheader67, %for.body8 %indvars.iv52 = phi i64 [ %indvars.iv.next53, %for.body8 ], [ %indvars.iv52.ph, %for.body8.preheader67 ] %max.046 = phi i32 [ %spec.select, %for.body8 ], [ %max.046.ph, %for.body8.preheader67 ] %min.045 = phi i32 [ %min.1, %for.body8 ], [ %min.045.ph, %for.body8.preheader67 ] %arrayidx10 = getelementptr inbounds [10000 x i32], ptr %a, i64 0, i64 %indvars.iv52 %14 = load i32, ptr %arrayidx10, align 4, !tbaa !5 %spec.select = call i32 @llvm.smax.i32(i32 %14, i32 %max.046) %min.1 = call i32 @llvm.smin.i32(i32 %14, i32 %min.045) %indvars.iv.next53 = add nuw nsw i64 %indvars.iv52, 1 %exitcond.not = icmp eq i64 %indvars.iv.next53, %wide.trip.count br i1 %exitcond.not, label %for.end25, label %for.body8, !llvm.loop !14 for.end25: ; preds = %for.body8, %middle.block, %for.end %min.0.lcssa = phi i32 [ %.pre, %for.end ], [ %12, %middle.block ], [ %min.1, %for.body8 ] %max.0.lcssa = phi i32 [ %.pre, %for.end ], [ %13, %middle.block ], [ %spec.select, %for.body8 ] %call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %min.0.lcssa, i32 noundef %max.0.lcssa, i64 noundef %add) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.end.p0(i64 40000, 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: 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) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) declare void @llvm.assume(i1 noundef) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare <4 x i32> @llvm.smax.v4i32(<4 x i32>, <4 x i32>) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare <4 x i32> @llvm.smin.v4i32(<4 x i32>, <4 x i32>) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.smax.v4i32(<4 x i32>) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.smin.v4i32(<4 x 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 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } 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, !13} !12 = !{!"llvm.loop.isvectorized", i32 1} !13 = !{!"llvm.loop.unroll.runtime.disable"} !14 = distinct !{!14, !10, !13, !12}
#include <stdio.h> int main () { long int a[4], i, sum, flag = 0; for (i = 0; i < 4; i++) { scanf("%ld",&a[i]); } sum = a[0] + a[1] + a[2] + a[3]; for(i = 1; i < 4; ++i) { if(sum == 2*(a[0] + a[i])) { flag = 1; break; } } for (i = 0; i < 4; i++) { if(sum == 2*a[i]) { flag = 1; break; } } if(flag == 1) { printf("YES\n"); } else { printf("NO\n"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_1741/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_1741/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"%ld\00", align 1 @str = private unnamed_addr constant [3 x i8] c"NO\00", align 1 @str.3 = 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 [4 x i64], align 16 call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %a) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a) %arrayidx.1 = getelementptr inbounds [4 x i64], ptr %a, i64 0, i64 1 %call.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.1) %arrayidx.2 = getelementptr inbounds [4 x i64], ptr %a, i64 0, i64 2 %call.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.2) %arrayidx.3 = getelementptr inbounds [4 x i64], ptr %a, i64 0, i64 3 %call.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.3) %0 = load i64, ptr %a, align 16, !tbaa !5 %1 = load i64, ptr %arrayidx.1, align 8, !tbaa !5 %add = add nsw i64 %1, %0 %2 = load i64, ptr %arrayidx.2, align 16, !tbaa !5 %add4 = add nsw i64 %add, %2 %3 = load i64, ptr %arrayidx.3, align 8, !tbaa !5 %add6 = add nsw i64 %add4, %3 %mul = shl nsw i64 %add, 1 %cmp13 = icmp eq i64 %add6, %mul br i1 %cmp13, label %for.end16, label %for.cond7 for.cond7: ; preds = %entry %add12.1 = add nsw i64 %2, %0 %mul.1 = shl nsw i64 %add12.1, 1 %cmp13.1 = icmp eq i64 %add6, %mul.1 br i1 %cmp13.1, label %for.end16, label %for.cond7.1 for.cond7.1: ; preds = %for.cond7 %add12.2 = add nsw i64 %3, %0 %mul.2 = shl nsw i64 %add12.2, 1 %cmp13.2 = icmp eq i64 %add6, %mul.2 br label %for.end16 for.end16: ; preds = %for.cond7.1, %for.cond7, %entry %cmp8.lcssa = phi i1 [ true, %entry ], [ true, %for.cond7 ], [ %cmp13.2, %for.cond7.1 ] %mul21 = shl nsw i64 %0, 1 %cmp22 = icmp eq i64 %add6, %mul21 %mul21.1 = shl nsw i64 %1, 1 %cmp22.1 = icmp eq i64 %add6, %mul21.1 %or.cond = select i1 %cmp22, i1 true, i1 %cmp22.1 %mul21.2 = shl nsw i64 %2, 1 %cmp22.2 = icmp eq i64 %add6, %mul21.2 %or.cond49 = select i1 %or.cond, i1 true, i1 %cmp22.2 %mul21.3 = shl nsw i64 %3, 1 %cmp22.3 = icmp eq i64 %add6, %mul21.3 %or.cond50 = select i1 %or.cond49, i1 true, i1 %cmp22.3 %brmerge = or i1 %or.cond50, %cmp8.lcssa %str.3.str = select i1 %brmerge, ptr @str.3, ptr @str %puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str) call void @llvm.lifetime.end.p0(i64 32, 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: 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 = !{!"long", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> int main(void) { int kazu; int suchi[10001]; int i; long min, max, sum; scanf("%d", &kazu); for(i = 0;i < kazu;i++){ scanf("%d", &suchi[i]); } min = 1000000; for(i = 0;i < kazu;i++){ if(min > suchi[i]){ min = suchi[i]; } } max = -1000000; for(i = 0;i < kazu;i++){ if(max < suchi[i]){ max = suchi[i]; } } sum = 0; for(i = 0;i < kazu;i++){ sum += suchi[i]; } printf("%ld %ld %ld\n", min, max, sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_174142/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_174142/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 [13 x i8] c"%ld %ld %ld\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %kazu = alloca i32, align 4 %suchi = alloca [10001 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %kazu) #4 call void @llvm.lifetime.start.p0(i64 40004, ptr nonnull %suchi) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %kazu) %0 = load i32, ptr %kazu, align 4, !tbaa !5 %cmp60 = icmp sgt i32 %0, 0 br i1 %cmp60, label %for.body, label %for.end41 for.cond2.preheader: ; preds = %for.body %cmp362 = icmp sgt i32 %2, 0 br i1 %cmp362, label %for.body4.preheader, label %for.end41 for.body4.preheader: ; preds = %for.cond2.preheader %wide.trip.count = zext i32 %2 to i64 %xtraiter = and i64 %wide.trip.count, 3 %1 = icmp ult i32 %2, 4 br i1 %1, label %for.cond15.preheader.unr-lcssa, label %for.body4.preheader.new for.body4.preheader.new: ; preds = %for.body4.preheader %unroll_iter = and i64 %wide.trip.count, 4294967292 br label %for.body4 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [10001 x i32], ptr %suchi, 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 %2 = load i32, ptr %kazu, 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.cond15.preheader.unr-lcssa: ; preds = %for.body4, %for.body4.preheader %spec.select.lcssa.ph = phi i64 [ undef, %for.body4.preheader ], [ %spec.select.3, %for.body4 ] %indvars.iv76.unr = phi i64 [ 0, %for.body4.preheader ], [ %indvars.iv.next77.3, %for.body4 ] %min.064.unr = phi i64 [ 1000000, %for.body4.preheader ], [ %spec.select.3, %for.body4 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond15.preheader, label %for.body4.epil for.body4.epil: ; preds = %for.cond15.preheader.unr-lcssa, %for.body4.epil %indvars.iv76.epil = phi i64 [ %indvars.iv.next77.epil, %for.body4.epil ], [ %indvars.iv76.unr, %for.cond15.preheader.unr-lcssa ] %min.064.epil = phi i64 [ %spec.select.epil, %for.body4.epil ], [ %min.064.unr, %for.cond15.preheader.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body4.epil ], [ 0, %for.cond15.preheader.unr-lcssa ] %arrayidx6.epil = getelementptr inbounds [10001 x i32], ptr %suchi, i64 0, i64 %indvars.iv76.epil %4 = load i32, ptr %arrayidx6.epil, align 4, !tbaa !5 %conv.epil = sext i32 %4 to i64 %spec.select.epil = call i64 @llvm.smin.i64(i64 %min.064.epil, i64 %conv.epil) %indvars.iv.next77.epil = add nuw nsw i64 %indvars.iv76.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.cond15.preheader, label %for.body4.epil, !llvm.loop !11 for.cond15.preheader: ; preds = %for.body4.epil, %for.cond15.preheader.unr-lcssa %spec.select.lcssa = phi i64 [ %spec.select.lcssa.ph, %for.cond15.preheader.unr-lcssa ], [ %spec.select.epil, %for.body4.epil ] br i1 %cmp362, label %for.body18.preheader, label %for.end41 for.body18.preheader: ; preds = %for.cond15.preheader %xtraiter111 = and i64 %wide.trip.count, 3 %5 = icmp ult i32 %2, 4 br i1 %5, label %for.cond32.preheader.unr-lcssa, label %for.body18.preheader.new for.body18.preheader.new: ; preds = %for.body18.preheader %unroll_iter115 = and i64 %wide.trip.count, 4294967292 br label %for.body18 for.body4: ; preds = %for.body4, %for.body4.preheader.new %indvars.iv76 = phi i64 [ 0, %for.body4.preheader.new ], [ %indvars.iv.next77.3, %for.body4 ] %min.064 = phi i64 [ 1000000, %for.body4.preheader.new ], [ %spec.select.3, %for.body4 ] %niter = phi i64 [ 0, %for.body4.preheader.new ], [ %niter.next.3, %for.body4 ] %arrayidx6 = getelementptr inbounds [10001 x i32], ptr %suchi, i64 0, i64 %indvars.iv76 %6 = load i32, ptr %arrayidx6, align 16, !tbaa !5 %conv = sext i32 %6 to i64 %spec.select = call i64 @llvm.smin.i64(i64 %min.064, i64 %conv) %indvars.iv.next77 = or i64 %indvars.iv76, 1 %arrayidx6.1 = getelementptr inbounds [10001 x i32], ptr %suchi, i64 0, i64 %indvars.iv.next77 %7 = load i32, ptr %arrayidx6.1, align 4, !tbaa !5 %conv.1 = sext i32 %7 to i64 %spec.select.1 = call i64 @llvm.smin.i64(i64 %spec.select, i64 %conv.1) %indvars.iv.next77.1 = or i64 %indvars.iv76, 2 %arrayidx6.2 = getelementptr inbounds [10001 x i32], ptr %suchi, i64 0, i64 %indvars.iv.next77.1 %8 = load i32, ptr %arrayidx6.2, align 8, !tbaa !5 %conv.2 = sext i32 %8 to i64 %spec.select.2 = call i64 @llvm.smin.i64(i64 %spec.select.1, i64 %conv.2) %indvars.iv.next77.2 = or i64 %indvars.iv76, 3 %arrayidx6.3 = getelementptr inbounds [10001 x i32], ptr %suchi, i64 0, i64 %indvars.iv.next77.2 %9 = load i32, ptr %arrayidx6.3, align 4, !tbaa !5 %conv.3 = sext i32 %9 to i64 %spec.select.3 = call i64 @llvm.smin.i64(i64 %spec.select.2, i64 %conv.3) %indvars.iv.next77.3 = add nuw nsw i64 %indvars.iv76, 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.cond15.preheader.unr-lcssa, label %for.body4, !llvm.loop !13 for.cond32.preheader.unr-lcssa: ; preds = %for.body18, %for.body18.preheader %spec.select59.lcssa.ph = phi i64 [ undef, %for.body18.preheader ], [ %spec.select59.3, %for.body18 ] %indvars.iv79.unr = phi i64 [ 0, %for.body18.preheader ], [ %indvars.iv.next80.3, %for.body18 ] %max.068.unr = phi i64 [ -1000000, %for.body18.preheader ], [ %spec.select59.3, %for.body18 ] %lcmp.mod113.not = icmp eq i64 %xtraiter111, 0 br i1 %lcmp.mod113.not, label %for.cond32.preheader, label %for.body18.epil for.body18.epil: ; preds = %for.cond32.preheader.unr-lcssa, %for.body18.epil %indvars.iv79.epil = phi i64 [ %indvars.iv.next80.epil, %for.body18.epil ], [ %indvars.iv79.unr, %for.cond32.preheader.unr-lcssa ] %max.068.epil = phi i64 [ %spec.select59.epil, %for.body18.epil ], [ %max.068.unr, %for.cond32.preheader.unr-lcssa ] %epil.iter112 = phi i64 [ %epil.iter112.next, %for.body18.epil ], [ 0, %for.cond32.preheader.unr-lcssa ] %arrayidx20.epil = getelementptr inbounds [10001 x i32], ptr %suchi, i64 0, i64 %indvars.iv79.epil %10 = load i32, ptr %arrayidx20.epil, align 4, !tbaa !5 %conv21.epil = sext i32 %10 to i64 %spec.select59.epil = call i64 @llvm.smax.i64(i64 %max.068.epil, i64 %conv21.epil) %indvars.iv.next80.epil = add nuw nsw i64 %indvars.iv79.epil, 1 %epil.iter112.next = add i64 %epil.iter112, 1 %epil.iter112.cmp.not = icmp eq i64 %epil.iter112.next, %xtraiter111 br i1 %epil.iter112.cmp.not, label %for.cond32.preheader, label %for.body18.epil, !llvm.loop !14 for.cond32.preheader: ; preds = %for.body18.epil, %for.cond32.preheader.unr-lcssa %spec.select59.lcssa = phi i64 [ %spec.select59.lcssa.ph, %for.cond32.preheader.unr-lcssa ], [ %spec.select59.epil, %for.body18.epil ] br i1 %cmp362, label %for.body35.preheader, label %for.end41 for.body35.preheader: ; preds = %for.cond32.preheader %wide.trip.count87 = zext i32 %2 to i64 %min.iters.check = icmp ult i32 %2, 4 br i1 %min.iters.check, label %for.body35.preheader107, label %vector.ph vector.ph: ; preds = %for.body35.preheader %n.vec = and i64 %wide.trip.count, 4294967292 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %vec.phi = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %15, %vector.body ] %vec.phi105 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %16, %vector.body ] %11 = getelementptr inbounds [10001 x i32], ptr %suchi, i64 0, i64 %index %wide.load = load <2 x i32>, ptr %11, align 16, !tbaa !5 %12 = getelementptr inbounds i32, ptr %11, i64 2 %wide.load106 = load <2 x i32>, ptr %12, align 8, !tbaa !5 %13 = sext <2 x i32> %wide.load to <2 x i64> %14 = sext <2 x i32> %wide.load106 to <2 x i64> %15 = add <2 x i64> %vec.phi, %13 %16 = add <2 x i64> %vec.phi105, %14 %index.next = add nuw i64 %index, 4 %17 = icmp eq i64 %index.next, %n.vec br i1 %17, label %middle.block, label %vector.body, !llvm.loop !15 middle.block: ; preds = %vector.body %bin.rdx = add <2 x i64> %16, %15 %18 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx) %cmp.n = icmp eq i64 %n.vec, %wide.trip.count br i1 %cmp.n, label %for.end41, label %for.body35.preheader107 for.body35.preheader107: ; preds = %for.body35.preheader, %middle.block %indvars.iv84.ph = phi i64 [ 0, %for.body35.preheader ], [ %n.vec, %middle.block ] %sum.072.ph = phi i64 [ 0, %for.body35.preheader ], [ %18, %middle.block ] br label %for.body35 for.body18: ; preds = %for.body18, %for.body18.preheader.new %indvars.iv79 = phi i64 [ 0, %for.body18.preheader.new ], [ %indvars.iv.next80.3, %for.body18 ] %max.068 = phi i64 [ -1000000, %for.body18.preheader.new ], [ %spec.select59.3, %for.body18 ] %niter116 = phi i64 [ 0, %for.body18.preheader.new ], [ %niter116.next.3, %for.body18 ] %arrayidx20 = getelementptr inbounds [10001 x i32], ptr %suchi, i64 0, i64 %indvars.iv79 %19 = load i32, ptr %arrayidx20, align 16, !tbaa !5 %conv21 = sext i32 %19 to i64 %spec.select59 = call i64 @llvm.smax.i64(i64 %max.068, i64 %conv21) %indvars.iv.next80 = or i64 %indvars.iv79, 1 %arrayidx20.1 = getelementptr inbounds [10001 x i32], ptr %suchi, i64 0, i64 %indvars.iv.next80 %20 = load i32, ptr %arrayidx20.1, align 4, !tbaa !5 %conv21.1 = sext i32 %20 to i64 %spec.select59.1 = call i64 @llvm.smax.i64(i64 %spec.select59, i64 %conv21.1) %indvars.iv.next80.1 = or i64 %indvars.iv79, 2 %arrayidx20.2 = getelementptr inbounds [10001 x i32], ptr %suchi, i64 0, i64 %indvars.iv.next80.1 %21 = load i32, ptr %arrayidx20.2, align 8, !tbaa !5 %conv21.2 = sext i32 %21 to i64 %spec.select59.2 = call i64 @llvm.smax.i64(i64 %spec.select59.1, i64 %conv21.2) %indvars.iv.next80.2 = or i64 %indvars.iv79, 3 %arrayidx20.3 = getelementptr inbounds [10001 x i32], ptr %suchi, i64 0, i64 %indvars.iv.next80.2 %22 = load i32, ptr %arrayidx20.3, align 4, !tbaa !5 %conv21.3 = sext i32 %22 to i64 %spec.select59.3 = call i64 @llvm.smax.i64(i64 %spec.select59.2, i64 %conv21.3) %indvars.iv.next80.3 = add nuw nsw i64 %indvars.iv79, 4 %niter116.next.3 = add i64 %niter116, 4 %niter116.ncmp.3 = icmp eq i64 %niter116.next.3, %unroll_iter115 br i1 %niter116.ncmp.3, label %for.cond32.preheader.unr-lcssa, label %for.body18, !llvm.loop !18 for.body35: ; preds = %for.body35.preheader107, %for.body35 %indvars.iv84 = phi i64 [ %indvars.iv.next85, %for.body35 ], [ %indvars.iv84.ph, %for.body35.preheader107 ] %sum.072 = phi i64 [ %add, %for.body35 ], [ %sum.072.ph, %for.body35.preheader107 ] %arrayidx37 = getelementptr inbounds [10001 x i32], ptr %suchi, i64 0, i64 %indvars.iv84 %23 = load i32, ptr %arrayidx37, align 4, !tbaa !5 %conv38 = sext i32 %23 to i64 %add = add nsw i64 %sum.072, %conv38 %indvars.iv.next85 = add nuw nsw i64 %indvars.iv84, 1 %exitcond88.not = icmp eq i64 %indvars.iv.next85, %wide.trip.count87 br i1 %exitcond88.not, label %for.end41, label %for.body35, !llvm.loop !19 for.end41: ; preds = %for.body35, %middle.block, %entry, %for.cond2.preheader, %for.cond15.preheader, %for.cond32.preheader %max.0.lcssa104 = phi i64 [ %spec.select59.lcssa, %for.cond32.preheader ], [ -1000000, %for.cond15.preheader ], [ -1000000, %for.cond2.preheader ], [ -1000000, %entry ], [ %spec.select59.lcssa, %middle.block ], [ %spec.select59.lcssa, %for.body35 ] %min.0.lcssa98103 = phi i64 [ %spec.select.lcssa, %for.cond32.preheader ], [ %spec.select.lcssa, %for.cond15.preheader ], [ 1000000, %for.cond2.preheader ], [ 1000000, %entry ], [ %spec.select.lcssa, %middle.block ], [ %spec.select.lcssa, %for.body35 ] %sum.0.lcssa = phi i64 [ 0, %for.cond32.preheader ], [ 0, %for.cond15.preheader ], [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %18, %middle.block ], [ %add, %for.body35 ] %call42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %min.0.lcssa98103, i64 noundef %max.0.lcssa104, i64 noundef %sum.0.lcssa) call void @llvm.lifetime.end.p0(i64 40004, ptr nonnull %suchi) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %kazu) #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 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smin.i64(i64, i64) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.vector.reduce.add.v2i64(<2 x 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"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.unroll.disable"} !13 = distinct !{!13, !10} !14 = distinct !{!14, !12} !15 = distinct !{!15, !10, !16, !17} !16 = !{!"llvm.loop.isvectorized", i32 1} !17 = !{!"llvm.loop.unroll.runtime.disable"} !18 = distinct !{!18, !10} !19 = distinct !{!19, !10, !17, !16}
#include<stdio.h> int main(void){ int a,n,i,min=1000000,max=-1000000; long int sum=0; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&a); sum+=a; if(min>a) min=a; if(max<a) max=a; } printf("%d %d %ld\n",min,max,sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_174186/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_174186/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 [11 x i8] c"%d %d %ld\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i32, align 4 %n = 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 %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 %cmp14 = icmp sgt i32 %0, 0 br i1 %cmp14, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %sum.018 = phi i64 [ %add, %for.body ], [ 0, %entry ] %max.017 = phi i32 [ %max.1, %for.body ], [ -1000000, %entry ] %min.016 = phi i32 [ %spec.select, %for.body ], [ 1000000, %entry ] %i.015 = phi i32 [ %inc, %for.body ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a) %1 = load i32, ptr %a, align 4, !tbaa !5 %conv = sext i32 %1 to i64 %add = add nsw i64 %sum.018, %conv %spec.select = call i32 @llvm.smin.i32(i32 %min.016, i32 %1) %max.1 = call i32 @llvm.smax.i32(i32 %max.017, i32 %1) %inc = add nuw nsw i32 %i.015, 1 %2 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %entry %min.0.lcssa = phi i32 [ 1000000, %entry ], [ %spec.select, %for.body ] %max.0.lcssa = phi i32 [ -1000000, %entry ], [ %max.1, %for.body ] %sum.0.lcssa = phi i64 [ 0, %entry ], [ %add, %for.body ] %call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %min.0.lcssa, i32 noundef %max.0.lcssa, i64 noundef %sum.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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 i32 @llvm.smin.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.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"}
#include <stdio.h> int main(void) { int i; int n, a; long long min, max, sum; scanf("%d", &n); scanf("%d", &a); max = sum = min = a; for (i = 1; i < n; i++){ scanf("%d", &a); if (max < a){ max = a; } if (min > a){ min = a; } sum += a; } printf("%ld %ld %ld\n", min, max, sum); return (0); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_174229/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_174229/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 [13 x i8] c"%ld %ld %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 %a = 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 %a) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a) %0 = load i32, ptr %a, align 4, !tbaa !5 %conv = sext i32 %0 to i64 %1 = load i32, ptr %n, align 4, !tbaa !5 %cmp20 = icmp sgt i32 %1, 1 br i1 %cmp20, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %sum.024 = phi i64 [ %add, %for.body ], [ %conv, %entry ] %max.023 = phi i64 [ %spec.select, %for.body ], [ %conv, %entry ] %min.022 = phi i64 [ %min.1, %for.body ], [ %conv, %entry ] %i.021 = phi i32 [ %inc, %for.body ], [ 1, %entry ] %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a) %2 = load i32, ptr %a, align 4, !tbaa !5 %conv4 = sext i32 %2 to i64 %spec.select = call i64 @llvm.smax.i64(i64 %max.023, i64 %conv4) %min.1 = call i64 @llvm.smin.i64(i64 %min.022, i64 %conv4) %add = add nsw i64 %sum.024, %conv4 %inc = add nuw nsw i32 %i.021, 1 %3 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc, %3 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %entry %min.0.lcssa = phi i64 [ %conv, %entry ], [ %min.1, %for.body ] %max.0.lcssa = phi i64 [ %conv, %entry ], [ %spec.select, %for.body ] %sum.0.lcssa = phi i64 [ %conv, %entry ], [ %add, %for.body ] %call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %min.0.lcssa, i64 noundef %max.0.lcssa, i64 noundef %sum.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, 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: 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 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smin.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"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> int main(void) { int n, i, MAX, MIN = 0; long long sum = 0; //int x[1000000]; scanf("%d", &n); int x[n]; for(i = 0; i<n; i++){ scanf("%d", &x[i]); } MAX = -10000000; MIN=10000000; for(i = 0; i<n; i++){ if(x[i]>MAX){ MAX = x[i]; } if(x[i]<MIN){ MIN = x[i]; } sum=sum+x[i]; } printf("%d %d %lld\n", MIN, MAX, sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_174272/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_174272/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 [12 x i8] c"%d %d %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) #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 %cmp36 = icmp sgt i32 %3, 0 br i1 %cmp36, label %for.body, label %for.end21 for.cond2.preheader: ; preds = %for.body %cmp338 = icmp sgt i32 %18, 0 br i1 %cmp338, label %for.body4.preheader, label %for.end21 for.body4.preheader: ; preds = %for.cond2.preheader %wide.trip.count = zext i32 %18 to i64 %min.iters.check = icmp ult i32 %18, 4 br i1 %min.iters.check, label %for.body4.preheader62, label %vector.ph vector.ph: ; preds = %for.body4.preheader %n.vec = and i64 %wide.trip.count, 4294967292 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %vec.phi = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %12, %vector.body ] %vec.phi53 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %13, %vector.body ] %vec.phi54 = phi <2 x i32> [ <i32 10000000, i32 10000000>, %vector.ph ], [ %8, %vector.body ] %vec.phi55 = phi <2 x i32> [ <i32 10000000, i32 10000000>, %vector.ph ], [ %9, %vector.body ] %vec.phi56 = phi <2 x i32> [ <i32 -10000000, i32 -10000000>, %vector.ph ], [ %6, %vector.body ] %vec.phi57 = phi <2 x i32> [ <i32 -10000000, i32 -10000000>, %vector.ph ], [ %7, %vector.body ] %4 = getelementptr inbounds i32, ptr %vla, i64 %index %wide.load = load <2 x i32>, ptr %4, align 16, !tbaa !5 %5 = getelementptr inbounds i32, ptr %4, i64 2 %wide.load58 = load <2 x i32>, ptr %5, align 8, !tbaa !5 %6 = call <2 x i32> @llvm.smax.v2i32(<2 x i32> %wide.load, <2 x i32> %vec.phi56) %7 = call <2 x i32> @llvm.smax.v2i32(<2 x i32> %wide.load58, <2 x i32> %vec.phi57) %8 = call <2 x i32> @llvm.smin.v2i32(<2 x i32> %wide.load, <2 x i32> %vec.phi54) %9 = call <2 x i32> @llvm.smin.v2i32(<2 x i32> %wide.load58, <2 x i32> %vec.phi55) %10 = sext <2 x i32> %wide.load to <2 x i64> %11 = sext <2 x i32> %wide.load58 to <2 x i64> %12 = add <2 x i64> %vec.phi, %10 %13 = add <2 x i64> %vec.phi53, %11 %index.next = add nuw i64 %index, 4 %14 = icmp eq i64 %index.next, %n.vec br i1 %14, label %middle.block, label %vector.body, !llvm.loop !9 middle.block: ; preds = %vector.body %rdx.minmax60 = call <2 x i32> @llvm.smax.v2i32(<2 x i32> %6, <2 x i32> %7) %15 = call i32 @llvm.vector.reduce.smax.v2i32(<2 x i32> %rdx.minmax60) %rdx.minmax = call <2 x i32> @llvm.smin.v2i32(<2 x i32> %8, <2 x i32> %9) %16 = call i32 @llvm.vector.reduce.smin.v2i32(<2 x i32> %rdx.minmax) %bin.rdx = add <2 x i64> %13, %12 %17 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx) %cmp.n = icmp eq i64 %n.vec, %wide.trip.count br i1 %cmp.n, label %for.end21, label %for.body4.preheader62 for.body4.preheader62: ; preds = %for.body4.preheader, %middle.block %indvars.iv48.ph = phi i64 [ 0, %for.body4.preheader ], [ %n.vec, %middle.block ] %sum.041.ph = phi i64 [ 0, %for.body4.preheader ], [ %17, %middle.block ] %MIN.040.ph = phi i32 [ 10000000, %for.body4.preheader ], [ %16, %middle.block ] %MAX.039.ph = phi i32 [ -10000000, %for.body4.preheader ], [ %15, %middle.block ] br label %for.body4 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 %18 = load i32, ptr %n, align 4, !tbaa !5 %19 = sext i32 %18 to i64 %cmp = icmp slt i64 %indvars.iv.next, %19 br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !13 for.body4: ; preds = %for.body4.preheader62, %for.body4 %indvars.iv48 = phi i64 [ %indvars.iv.next49, %for.body4 ], [ %indvars.iv48.ph, %for.body4.preheader62 ] %sum.041 = phi i64 [ %add, %for.body4 ], [ %sum.041.ph, %for.body4.preheader62 ] %MIN.040 = phi i32 [ %MIN.1, %for.body4 ], [ %MIN.040.ph, %for.body4.preheader62 ] %MAX.039 = phi i32 [ %spec.select, %for.body4 ], [ %MAX.039.ph, %for.body4.preheader62 ] %arrayidx6 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv48 %20 = load i32, ptr %arrayidx6, align 4, !tbaa !5 %spec.select = call i32 @llvm.smax.i32(i32 %20, i32 %MAX.039) %MIN.1 = call i32 @llvm.smin.i32(i32 %20, i32 %MIN.040) %conv = sext i32 %20 to i64 %add = add nsw i64 %sum.041, %conv %indvars.iv.next49 = add nuw nsw i64 %indvars.iv48, 1 %exitcond.not = icmp eq i64 %indvars.iv.next49, %wide.trip.count br i1 %exitcond.not, label %for.end21, label %for.body4, !llvm.loop !14 for.end21: ; preds = %for.body4, %middle.block, %entry, %for.cond2.preheader %MAX.0.lcssa = phi i32 [ -10000000, %for.cond2.preheader ], [ -10000000, %entry ], [ %15, %middle.block ], [ %spec.select, %for.body4 ] %MIN.0.lcssa = phi i32 [ 10000000, %for.cond2.preheader ], [ 10000000, %entry ], [ %16, %middle.block ], [ %MIN.1, %for.body4 ] %sum.0.lcssa = phi i64 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %17, %middle.block ], [ %add, %for.body4 ] %call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %MIN.0.lcssa, i32 noundef %MAX.0.lcssa, i64 noundef %sum.0.lcssa) 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 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.smax.i32(i32, i32) #4 ; 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 <2 x i32> @llvm.smax.v2i32(<2 x i32>, <2 x i32>) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare <2 x i32> @llvm.smin.v2i32(<2 x i32>, <2 x i32>) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.smin.v2i32(<2 x i32>) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.smax.v2i32(<2 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 = 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}
#include <stdio.h> int main() { int n; int a, max, min; long long int sum = 0; scanf("%d%d", &n, &a); sum = min = max = a; while (1 < n--) { scanf("%d", &a); if (max < a) max = a; if (min > a) min = a; sum += a; } printf("%d %d %lld\n", min, max, sum); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_174315/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_174315/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 [12 x i8] c"%d %d %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 %a = 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 %a) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %a) %0 = load i32, ptr %a, align 4, !tbaa !5 %conv = sext i32 %0 to i64 %1 = load i32, ptr %n, align 4, !tbaa !5 %dec15 = add nsw i32 %1, -1 store i32 %dec15, ptr %n, align 4, !tbaa !5 %cmp16 = icmp sgt i32 %1, 1 br i1 %cmp16, label %while.body, label %while.end while.body: ; preds = %entry, %while.body %sum.019 = phi i64 [ %add, %while.body ], [ %conv, %entry ] %min.018 = phi i32 [ %min.1, %while.body ], [ %0, %entry ] %max.017 = phi i32 [ %spec.select, %while.body ], [ %0, %entry ] %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a) %2 = load i32, ptr %a, align 4, !tbaa !5 %spec.select = call i32 @llvm.smax.i32(i32 %max.017, i32 %2) %min.1 = call i32 @llvm.smin.i32(i32 %min.018, i32 %2) %conv9 = sext i32 %2 to i64 %add = add nsw i64 %sum.019, %conv9 %3 = load i32, ptr %n, align 4, !tbaa !5 %dec = add nsw i32 %3, -1 store i32 %dec, ptr %n, align 4, !tbaa !5 %cmp = icmp sgt i32 %3, 1 br i1 %cmp, label %while.body, label %while.end, !llvm.loop !9 while.end: ; preds = %while.body, %entry %max.0.lcssa = phi i32 [ %0, %entry ], [ %spec.select, %while.body ] %min.0.lcssa = phi i32 [ %0, %entry ], [ %min.1, %while.body ] %sum.0.lcssa = phi i64 [ %conv, %entry ], [ %add, %while.body ] %call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %min.0.lcssa, i32 noundef %max.0.lcssa, i64 noundef %sum.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, 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: 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) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.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"}
#include <stdio.h> #include <math.h> int main(int argc, char *argv[]) { int n, a; long long min = 10000001, max = -10000001, sum = 0; scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%d", &a); min = a < min ? a : min; max = a > max ? a : max; sum += a; } printf("%lld %lld %lld\n", min, max, sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_174373/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_174373/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 [16 x i8] c"%lld %lld %lld\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: %n = alloca i32, align 4 %a = 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 %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.cond.cleanup for.cond.cleanup: ; preds = %for.body, %entry %min.0.lcssa = phi i64 [ 10000001, %entry ], [ %cond, %for.body ] %max.0.lcssa = phi i64 [ -10000001, %entry ], [ %cond12, %for.body ] %sum.0.lcssa = phi i64 [ 0, %entry ], [ %add, %for.body ] %call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %min.0.lcssa, i64 noundef %max.0.lcssa, i64 noundef %sum.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 ret i32 0 for.body: ; preds = %entry, %for.body %i.025 = phi i32 [ %inc, %for.body ], [ 0, %entry ] %sum.024 = phi i64 [ %add, %for.body ], [ 0, %entry ] %max.023 = phi i64 [ %cond12, %for.body ], [ -10000001, %entry ] %min.022 = phi i64 [ %cond, %for.body ], [ 10000001, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a) %1 = load i32, ptr %a, align 4 %conv = sext i32 %1 to i64 %cond = call i64 @llvm.smin.i64(i64 %min.022, i64 %conv) %cond12 = call i64 @llvm.smax.i64(i64 %max.023, i64 %conv) %add = add nsw i64 %sum.024, %conv %inc = add nuw nsw i32 %i.025, 1 %2 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc, %2 br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9 } ; 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: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smin.i64(i64, i64) #3 ; 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"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"}
#include<stdio.h> int main() { long long n,sum=0,T,max,min; scanf("%lld",&T); for(int i=1; i<=T; i++) { scanf("%lld ",&n); if(i==1) max=min=n; if(max<n) max=n; else if(min>n) min=n; sum=sum+n; } printf("%d %d %lld\n",min,max,sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_174416/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_174416/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 \00", align 1 @.str.2 = private unnamed_addr constant [12 x i8] c"%d %d %lld\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i64, align 8 %T = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %T) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %T) %0 = load i64, ptr %T, align 8, !tbaa !5 %cmp.not21 = icmp sgt i64 %0, 0 call void @llvm.assume(i1 %cmp.not21) %call2.peel = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n) %1 = load i64, ptr %n, align 8 %2 = load i64, ptr %T, align 8, !tbaa !5 %cmp.not.peel = icmp slt i64 %2, 2 br i1 %cmp.not.peel, label %for.cond.cleanup, label %for.body for.cond.cleanup: ; preds = %for.body, %entry %max.2.lcssa = phi i64 [ %1, %entry ], [ %max.2, %for.body ] %min.2.lcssa = phi i64 [ %1, %entry ], [ %min.2, %for.body ] %add.lcssa = phi i64 [ %1, %entry ], [ %add, %for.body ] %call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %min.2.lcssa, i64 noundef %max.2.lcssa, i64 noundef %add.lcssa) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %T) #5 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #5 ret i32 0 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 2, %entry ] %min.024 = phi i64 [ %min.2, %for.body ], [ %1, %entry ] %max.023 = phi i64 [ %max.2, %for.body ], [ %1, %entry ] %sum.022 = phi i64 [ %add, %for.body ], [ %1, %entry ] %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n) %3 = load i64, ptr %n, align 8 %cmp5 = icmp slt i64 %max.023, %3 %spec.select20 = call i64 @llvm.smin.i64(i64 %min.024, i64 %3) %max.2 = call i64 @llvm.smax.i64(i64 %max.023, i64 %3) %min.2 = select i1 %cmp5, i64 %min.024, i64 %spec.select20 %add = add nsw i64 %3, %sum.022 %indvars.iv.next = add nuw i64 %indvars.iv, 1 %4 = load i64, ptr %T, align 8, !tbaa !5 %cmp.not = icmp slt i64 %4, %indvars.iv.next br i1 %cmp.not, label %for.cond.cleanup, label %for.body, !llvm.loop !9 } ; 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: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smin.i64(i64, i64) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smax.i64(i64, i64) #3 ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) declare void @llvm.assume(i1 noundef) #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #4 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } 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"} !9 = distinct !{!9, !10, !11} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!"llvm.loop.peeled.count", i32 1}
#include<stdio.h> int main() { int n, k; scanf("%d %d", &n, &k); for (int i = 0; i < n; ++i) { putchar('a' + (i % k)); } putchar('\n'); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_17446/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_17446/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 @stdout = external local_unnamed_addr global ptr, align 8 ; 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 %cmp6 = icmp sgt i32 %0, 0 br i1 %cmp6, label %for.body, label %for.cond.cleanup for.cond.cleanup: ; preds = %for.body, %entry %1 = load ptr, ptr @stdout, align 8, !tbaa !9 %call.i = call i32 @putc(i32 noundef 10, ptr noundef %1) 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 for.body: ; preds = %entry, %for.body %i.07 = phi i32 [ %inc, %for.body ], [ 0, %entry ] %2 = load i32, ptr %k, align 4, !tbaa !5 %rem = srem i32 %i.07, %2 %add = add nuw nsw i32 %rem, 97 %3 = load ptr, ptr @stdout, align 8, !tbaa !9 %call.i5 = call i32 @putc(i32 noundef %add, ptr noundef %3) %inc = add nuw nsw i32 %i.07, 1 %4 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc, %4 br i1 %cmp, label %for.body, label %for.cond.cleanup, !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 @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"}
#include<stdio.h> int main() { int n, i; long long x, y, z, a[10000]; scanf("%d", &n); scanf("%ld", &a[0]); x = a[0]; y = a[0]; z = a[0]; for(i = 1;i < n;i++){ scanf("%ld", &a[i]); if(a[i] < x){ x = a[i]; } else if(a[i] > y){ y = a[i]; } z = z + a[i]; } printf("%ld %ld %ld\n", x, y, z); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_174502/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_174502/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"%ld\00", align 1 @.str.2 = private unnamed_addr constant [13 x i8] c"%ld %ld %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 %a = alloca [10000 x i64], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 80000, ptr nonnull %a) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a) %0 = load i64, ptr %a, align 16, !tbaa !5 %1 = load i32, ptr %n, align 4, !tbaa !9 %cmp32 = icmp sgt i32 %1, 1 br i1 %cmp32, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ] %z.036 = phi i64 [ %add, %for.body ], [ %0, %entry ] %y.035 = phi i64 [ %y.1, %for.body ], [ %0, %entry ] %x.034 = phi i64 [ %x.1, %for.body ], [ %0, %entry ] %arrayidx5 = getelementptr inbounds [10000 x i64], ptr %a, i64 0, i64 %indvars.iv %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx5) %2 = load i64, ptr %arrayidx5, align 8, !tbaa !5 %cmp9 = icmp slt i64 %2, %x.034 %spec.select = call i64 @llvm.smax.i64(i64 %2, i64 %y.035) %x.1 = call i64 @llvm.smin.i64(i64 %2, i64 %x.034) %y.1 = select i1 %cmp9, i64 %y.035, i64 %spec.select %add = add nsw i64 %2, %z.036 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %3 = load i32, ptr %n, align 4, !tbaa !9 %4 = sext i32 %3 to i64 %cmp = icmp slt i64 %indvars.iv.next, %4 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11 for.end: ; preds = %for.body, %entry %x.0.lcssa = phi i64 [ %0, %entry ], [ %x.1, %for.body ] %y.0.lcssa = phi i64 [ %0, %entry ], [ %y.1, %for.body ] %z.0.lcssa = phi i64 [ %0, %entry ], [ %add, %for.body ] %call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %x.0.lcssa, i64 noundef %y.0.lcssa, i64 noundef %z.0.lcssa) call void @llvm.lifetime.end.p0(i64 80000, 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: 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 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smin.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 long", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!10, !10, i64 0} !10 = !{!"int", !7, i64 0} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> int main(void) { int a[10000]; int n, i, min, max; long sum; scanf("%d", &n); scanf("%d", &a[0]); min = max = sum = a[0]; for (i = 1; i < n; i++) { scanf("%d", &a[i]); if(min > a[i]) min = a[i]; if(max < a[i]) max = a[i]; sum += a[i]; } printf("%d %d %ld\n", min, max, sum); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_174546/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_174546/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 [11 x i8] c"%d %d %ld\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca [10000 x i32], align 16 %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %a) #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) %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a) %0 = load i32, ptr %a, align 16, !tbaa !5 %conv = sext i32 %0 to i64 %1 = load i32, ptr %n, align 4, !tbaa !5 %cmp36 = icmp sgt i32 %1, 1 br i1 %cmp36, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ] %sum.040 = phi i64 [ %add, %for.body ], [ %conv, %entry ] %max.039 = phi i32 [ %max.1, %for.body ], [ %0, %entry ] %min.038 = phi i32 [ %spec.select, %for.body ], [ %0, %entry ] %arrayidx5 = getelementptr inbounds [10000 x i32], ptr %a, i64 0, i64 %indvars.iv %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5) %2 = load i32, ptr %arrayidx5, align 4, !tbaa !5 %spec.select = call i32 @llvm.smin.i32(i32 %min.038, i32 %2) %max.1 = call i32 @llvm.smax.i32(i32 %max.039, i32 %2) %conv23 = sext i32 %2 to i64 %add = add nsw i64 %sum.040, %conv23 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %3 = load i32, ptr %n, align 4, !tbaa !5 %4 = sext i32 %3 to i64 %cmp = icmp slt i64 %indvars.iv.next, %4 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %entry %min.0.lcssa = phi i32 [ %0, %entry ], [ %spec.select, %for.body ] %max.0.lcssa = phi i32 [ %0, %entry ], [ %max.1, %for.body ] %sum.0.lcssa = phi i64 [ %conv, %entry ], [ %add, %for.body ] %call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %min.0.lcssa, i32 noundef %max.0.lcssa, i64 noundef %sum.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.end.p0(i64 40000, 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 i32 @llvm.smin.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.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"}
// Aizu 1131: Unit Fraction Partition // 2017.10.24 bal4u@uu #include <stdio.h> #include <math.h> #define EPS 1e-9 double tbl[12005]; int ans, a; int bsch(double v) { int m, l = 0, r = 12001; while (l < r) { m = (l + r) >> 1; // if (fabs(tbl[m] - v) <= EPS) return m; if (tbl[m] > EPS + v) l = m + 1; else r = m; } if (l <= 0) l = 1; return l; } void rec(double v, int k, int n, int aa) { int i, l, r; if (aa > a) return; if (fabs(v) <= EPS) { ans++; return; } if (n == 0) return; l = bsch(v), r = bsch(v/n); if (l < k) l = k; // if ((double)n/l + EPS < v) return; k = a / aa; if (k < r) r = k; for (i = l; i <= r; i++) rec(v - 1.0 / i, i, n - 1, aa*i); } int main() { int p, q, n, i, l, r; double v; for (i = 1; i <= 12002; i++) tbl[i] = 1.0 / i; while (scanf("%d%d%d%d", &p, &q, &a, &n) && n > 0) { v = (double)p / q; if (fabs(v-n) <= EPS) { puts("1"); continue; } if (v > n) { puts("0"); continue; } l = bsch(v), r = bsch(v/n); for (ans = 0, i = l; i <= r; i++) rec(v-1.0/i, i, n-1, i); printf("%d\n", ans); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_174603/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_174603/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" @tbl = dso_local local_unnamed_addr global [12005 x double] zeroinitializer, align 16 @a = dso_local global i32 0, align 4 @ans = dso_local local_unnamed_addr global i32 0, align 4 @.str = private unnamed_addr constant [9 x i8] c"%d%d%d%d\00", align 1 @.str.1 = private unnamed_addr constant [2 x i8] c"1\00", align 1 @.str.2 = private unnamed_addr constant [2 x i8] c"0\00", align 1 @.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @bsch(double noundef %v) local_unnamed_addr #0 { entry: %add1 = fadd double %v, 1.000000e-09 br label %while.body while.body: ; preds = %entry, %while.body %r.014 = phi i32 [ 12001, %entry ], [ %r.1, %while.body ] %l.013 = phi i32 [ 0, %entry ], [ %l.1, %while.body ] %add = add nsw i32 %r.014, %l.013 %shr = ashr i32 %add, 1 %idxprom = sext i32 %shr to i64 %arrayidx = getelementptr inbounds [12005 x double], ptr @tbl, i64 0, i64 %idxprom %0 = load double, ptr %arrayidx, align 8, !tbaa !5 %cmp2 = fcmp ogt double %0, %add1 %add3 = add nsw i32 %shr, 1 %l.1 = select i1 %cmp2, i32 %add3, i32 %l.013 %r.1 = select i1 %cmp2, i32 %r.014, i32 %shr %cmp = icmp slt i32 %l.1, %r.1 br i1 %cmp, label %while.body, label %while.end, !llvm.loop !9 while.end: ; preds = %while.body %spec.store.select = tail call i32 @llvm.smax.i32(i32 %l.1, i32 1) ret i32 %spec.store.select } ; 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 nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @rec(double noundef %v, i32 noundef %k, i32 noundef %n, i32 noundef %aa) local_unnamed_addr #2 { entry: %0 = load i32, ptr @a, align 4, !tbaa !11 %cmp = icmp slt i32 %0, %aa br i1 %cmp, label %cleanup, label %if.end if.end: ; preds = %entry %1 = tail call double @llvm.fabs.f64(double %v) %cmp1 = fcmp ugt double %1, 1.000000e-09 br i1 %cmp1, label %if.end3, label %if.then2 if.then2: ; preds = %if.end %2 = load i32, ptr @ans, align 4, !tbaa !11 %inc = add nsw i32 %2, 1 store i32 %inc, ptr @ans, align 4, !tbaa !11 br label %cleanup if.end3: ; preds = %if.end %cmp4 = icmp eq i32 %n, 0 br i1 %cmp4, label %cleanup, label %if.end6 if.end6: ; preds = %if.end3 %add1.i = fadd double %v, 1.000000e-09 br label %while.body.i while.body.i: ; preds = %while.body.i, %if.end6 %r.014.i = phi i32 [ 12001, %if.end6 ], [ %r.1.i, %while.body.i ] %l.013.i = phi i32 [ 0, %if.end6 ], [ %l.1.i, %while.body.i ] %add.i = add nsw i32 %l.013.i, %r.014.i %shr.i = ashr i32 %add.i, 1 %idxprom.i = sext i32 %shr.i to i64 %arrayidx.i = getelementptr inbounds [12005 x double], ptr @tbl, i64 0, i64 %idxprom.i %3 = load double, ptr %arrayidx.i, align 8, !tbaa !5 %cmp2.i = fcmp ogt double %3, %add1.i %add3.i = add nsw i32 %shr.i, 1 %l.1.i = select i1 %cmp2.i, i32 %add3.i, i32 %l.013.i %r.1.i = select i1 %cmp2.i, i32 %r.014.i, i32 %shr.i %cmp.i = icmp slt i32 %l.1.i, %r.1.i br i1 %cmp.i, label %while.body.i, label %bsch.exit, !llvm.loop !9 bsch.exit: ; preds = %while.body.i %conv = sitofp i32 %n to double %div = fdiv double %v, %conv %add1.i41 = fadd double %div, 1.000000e-09 br label %while.body.i42 while.body.i42: ; preds = %while.body.i42, %bsch.exit %r.014.i43 = phi i32 [ 12001, %bsch.exit ], [ %r.1.i52, %while.body.i42 ] %l.013.i44 = phi i32 [ 0, %bsch.exit ], [ %l.1.i51, %while.body.i42 ] %add.i45 = add nsw i32 %l.013.i44, %r.014.i43 %shr.i46 = ashr i32 %add.i45, 1 %idxprom.i47 = sext i32 %shr.i46 to i64 %arrayidx.i48 = getelementptr inbounds [12005 x double], ptr @tbl, i64 0, i64 %idxprom.i47 %4 = load double, ptr %arrayidx.i48, align 8, !tbaa !5 %cmp2.i49 = fcmp ogt double %4, %add1.i41 %add3.i50 = add nsw i32 %shr.i46, 1 %l.1.i51 = select i1 %cmp2.i49, i32 %add3.i50, i32 %l.013.i44 %r.1.i52 = select i1 %cmp2.i49, i32 %r.014.i43, i32 %shr.i46 %cmp.i53 = icmp slt i32 %l.1.i51, %r.1.i52 br i1 %cmp.i53, label %while.body.i42, label %bsch.exit55, !llvm.loop !9 bsch.exit55: ; preds = %while.body.i42 %spec.store.select.i54 = tail call i32 @llvm.smax.i32(i32 %l.1.i51, i32 1) %spec.store.select.i = tail call i32 @llvm.smax.i32(i32 %l.1.i, i32 %k) %spec.select = tail call i32 @llvm.smax.i32(i32 %spec.store.select.i, i32 1) %div12 = sdiv i32 %0, %aa %r.0 = tail call i32 @llvm.smin.i32(i32 %div12, i32 %spec.store.select.i54) %cmp17.not56 = icmp sgt i32 %spec.select, %r.0 br i1 %cmp17.not56, label %cleanup, label %for.body.lr.ph for.body.lr.ph: ; preds = %bsch.exit55 %sub21 = add nsw i32 %n, -1 br label %for.body for.body: ; preds = %for.body.lr.ph, %for.body %i.057 = phi i32 [ %spec.select, %for.body.lr.ph ], [ %inc22, %for.body ] %conv19 = sitofp i32 %i.057 to double %div20 = fdiv double 1.000000e+00, %conv19 %sub = fsub double %v, %div20 %mul = mul nsw i32 %i.057, %aa tail call void @rec(double noundef %sub, i32 noundef %i.057, i32 noundef %sub21, i32 noundef %mul) %inc22 = add nuw i32 %i.057, 1 %exitcond.not = icmp eq i32 %i.057, %r.0 br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !13 cleanup: ; preds = %for.body, %bsch.exit55, %if.end3, %entry, %if.then2 ret void } ; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) declare double @llvm.fabs.f64(double) #3 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #4 { entry: %p = alloca i32, align 4 %q = alloca i32, align 4 %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %p) #7 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #7 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7 br label %vector.body vector.body: ; preds = %vector.body.1, %entry %index = phi i64 [ 0, %entry ], [ %index.next.1, %vector.body.1 ] %vec.ind = phi <2 x i32> [ <i32 1, i32 2>, %entry ], [ %vec.ind.next.1, %vector.body.1 ] %offset.idx = or i64 %index, 1 %0 = sitofp <2 x i32> %vec.ind to <2 x double> %1 = fdiv <2 x double> <double 1.000000e+00, double 1.000000e+00>, %0 %2 = getelementptr inbounds [12005 x double], ptr @tbl, i64 0, i64 %offset.idx store <2 x double> %1, ptr %2, align 8, !tbaa !5 %3 = icmp eq i64 %index, 12000 br i1 %3, label %while.cond.preheader, label %vector.body.1, !llvm.loop !14 vector.body.1: ; preds = %vector.body %vec.ind.next = add <2 x i32> %vec.ind, <i32 2, i32 2> %offset.idx.1 = or i64 %index, 3 %4 = sitofp <2 x i32> %vec.ind.next to <2 x double> %5 = fdiv <2 x double> <double 1.000000e+00, double 1.000000e+00>, %4 %6 = getelementptr inbounds [12005 x double], ptr @tbl, i64 0, i64 %offset.idx.1 store <2 x double> %5, ptr %6, align 8, !tbaa !5 %index.next.1 = add nuw nsw i64 %index, 4 %vec.ind.next.1 = add <2 x i32> %vec.ind, <i32 4, i32 4> br label %vector.body while.cond.preheader: ; preds = %vector.body %call62 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %p, ptr noundef nonnull %q, ptr noundef nonnull @a, ptr noundef nonnull %n) %tobool63 = icmp ne i32 %call62, 0 %7 = load i32, ptr %n, align 4 %cmp164 = icmp sgt i32 %7, 0 %8 = select i1 %tobool63, i1 %cmp164, i1 false br i1 %8, label %while.body, label %while.end while.body: ; preds = %while.cond.preheader, %while.cond.backedge %9 = phi i32 [ %13, %while.cond.backedge ], [ %7, %while.cond.preheader ] %10 = load i32, ptr %p, align 4, !tbaa !11 %conv3 = sitofp i32 %10 to double %11 = load i32, ptr %q, align 4, !tbaa !11 %conv4 = sitofp i32 %11 to double %div5 = fdiv double %conv3, %conv4 %conv6 = sitofp i32 %9 to double %sub = fsub double %div5, %conv6 %12 = call double @llvm.fabs.f64(double %sub) %cmp7 = fcmp ugt double %12, 1.000000e-09 br i1 %cmp7, label %if.end, label %if.then if.then: ; preds = %while.body %call9 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1) br label %while.cond.backedge while.cond.backedge: ; preds = %if.then, %if.then13, %for.end30 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %p, ptr noundef nonnull %q, ptr noundef nonnull @a, ptr noundef nonnull %n) %tobool = icmp ne i32 %call, 0 %13 = load i32, ptr %n, align 4 %cmp1 = icmp sgt i32 %13, 0 %14 = select i1 %tobool, i1 %cmp1, i1 false br i1 %14, label %while.body, label %while.end, !llvm.loop !17 if.end: ; preds = %while.body %cmp11 = fcmp ogt double %div5, %conv6 br i1 %cmp11, label %if.then13, label %if.end15 if.then13: ; preds = %if.end %call14 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2) br label %while.cond.backedge if.end15: ; preds = %if.end %add1.i = fadd double %div5, 1.000000e-09 br label %while.body.i while.body.i: ; preds = %while.body.i, %if.end15 %r.014.i = phi i32 [ 12001, %if.end15 ], [ %r.1.i, %while.body.i ] %l.013.i = phi i32 [ 0, %if.end15 ], [ %l.1.i, %while.body.i ] %add.i = add nsw i32 %l.013.i, %r.014.i %shr.i = ashr i32 %add.i, 1 %idxprom.i = sext i32 %shr.i to i64 %arrayidx.i = getelementptr inbounds [12005 x double], ptr @tbl, i64 0, i64 %idxprom.i %15 = load double, ptr %arrayidx.i, align 8, !tbaa !5 %cmp2.i = fcmp ogt double %15, %add1.i %add3.i = add nsw i32 %shr.i, 1 %l.1.i = select i1 %cmp2.i, i32 %add3.i, i32 %l.013.i %r.1.i = select i1 %cmp2.i, i32 %r.014.i, i32 %shr.i %cmp.i = icmp slt i32 %l.1.i, %r.1.i br i1 %cmp.i, label %while.body.i, label %bsch.exit, !llvm.loop !9 bsch.exit: ; preds = %while.body.i %div18 = fdiv double %div5, %conv6 %add1.i44 = fadd double %div18, 1.000000e-09 br label %while.body.i45 while.body.i45: ; preds = %while.body.i45, %bsch.exit %r.014.i46 = phi i32 [ 12001, %bsch.exit ], [ %r.1.i55, %while.body.i45 ] %l.013.i47 = phi i32 [ 0, %bsch.exit ], [ %l.1.i54, %while.body.i45 ] %add.i48 = add nsw i32 %l.013.i47, %r.014.i46 %shr.i49 = ashr i32 %add.i48, 1 %idxprom.i50 = sext i32 %shr.i49 to i64 %arrayidx.i51 = getelementptr inbounds [12005 x double], ptr @tbl, i64 0, i64 %idxprom.i50 %16 = load double, ptr %arrayidx.i51, align 8, !tbaa !5 %cmp2.i52 = fcmp ogt double %16, %add1.i44 %add3.i53 = add nsw i32 %shr.i49, 1 %l.1.i54 = select i1 %cmp2.i52, i32 %add3.i53, i32 %l.013.i47 %r.1.i55 = select i1 %cmp2.i52, i32 %r.014.i46, i32 %shr.i49 %cmp.i56 = icmp slt i32 %l.1.i54, %r.1.i55 br i1 %cmp.i56, label %while.body.i45, label %bsch.exit58, !llvm.loop !9 bsch.exit58: ; preds = %while.body.i45 %spec.store.select.i = call i32 @llvm.smax.i32(i32 %l.1.i, i32 1) %spec.store.select.i57 = call i32 @llvm.smax.i32(i32 %l.1.i54, i32 1) store i32 0, ptr @ans, align 4, !tbaa !11 %cmp21.not60 = icmp ugt i32 %spec.store.select.i, %spec.store.select.i57 br i1 %cmp21.not60, label %for.end30, label %for.body23 for.body23: ; preds = %bsch.exit58, %for.body23 %i.161 = phi i32 [ %inc29, %for.body23 ], [ %spec.store.select.i, %bsch.exit58 ] %conv24 = sitofp i32 %i.161 to double %div25 = fdiv double 1.000000e+00, %conv24 %sub26 = fsub double %div5, %div25 %17 = load i32, ptr %n, align 4, !tbaa !11 %sub27 = add nsw i32 %17, -1 call void @rec(double noundef %sub26, i32 noundef %i.161, i32 noundef %sub27, i32 noundef %i.161) %inc29 = add nuw i32 %i.161, 1 %exitcond66.not = icmp eq i32 %i.161, %spec.store.select.i57 br i1 %exitcond66.not, label %for.end30.loopexit, label %for.body23, !llvm.loop !18 for.end30.loopexit: ; preds = %for.body23 %.pre = load i32, ptr @ans, align 4, !tbaa !11 br label %for.end30 for.end30: ; preds = %for.end30.loopexit, %bsch.exit58 %18 = phi i32 [ %.pre, %for.end30.loopexit ], [ 0, %bsch.exit58 ] %call31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %18) br label %while.cond.backedge while.end: ; preds = %while.cond.backedge, %while.cond.preheader call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #7 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %p) #7 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #6 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #6 attributes #0 = { nofree 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 nosync nounwind memory(readwrite, 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 #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #4 = { 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 #5 = { 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 #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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 = !{!"double", !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 = !{!"int", !7, i64 0} !13 = distinct !{!13, !10} !14 = distinct !{!14, !10, !15, !16} !15 = !{!"llvm.loop.isvectorized", i32 1} !16 = !{!"llvm.loop.unroll.runtime.disable"} !17 = distinct !{!17, !10} !18 = distinct !{!18, !10}
#include <stdio.h> long long get_gcd(long long a, long long b) { if (b == 0) return a; else return get_gcd(b, a % b); } long long get_lcm(long long a, long long b) { long long g = get_gcd(a, b); return a / g * b; } int main (void) { int n, m; char s[(int)1e5 + 1], t[(int)1e5 + 1]; long long gcd, lcm, i; scanf("%d %d", &n, &m); scanf("%s", s); scanf("%s", t); gcd = get_gcd(n, m); lcm = get_lcm(n, m); for (i = 0; i < gcd; i++) { if (s[lcm / m * i] != t[lcm / n * i]) break; } if (i >= gcd) printf("%lld\n", lcm); else puts("-1"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_174654/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_174654/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 [3 x i8] c"%s\00", align 1 @.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1 @.str.3 = private unnamed_addr constant [3 x i8] c"-1\00", align 1 ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @get_gcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 { entry: %cmp4 = icmp eq i64 %b, 0 br i1 %cmp4, label %return, label %if.else if.else: ; preds = %entry, %if.else %b.tr6 = phi i64 [ %rem, %if.else ], [ %b, %entry ] %a.tr5 = phi i64 [ %b.tr6, %if.else ], [ %a, %entry ] %rem = srem i64 %a.tr5, %b.tr6 %cmp = icmp eq i64 %rem, 0 br i1 %cmp, label %return, label %if.else return: ; preds = %if.else, %entry %a.tr.lcssa = phi i64 [ %a, %entry ], [ %b.tr6, %if.else ] ret i64 %a.tr.lcssa } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @get_lcm(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 { entry: %cmp4.i = icmp eq i64 %b, 0 br i1 %cmp4.i, label %get_gcd.exit, label %if.else.i if.else.i: ; preds = %entry, %if.else.i %b.tr6.i = phi i64 [ %rem.i, %if.else.i ], [ %b, %entry ] %a.tr5.i = phi i64 [ %b.tr6.i, %if.else.i ], [ %a, %entry ] %rem.i = srem i64 %a.tr5.i, %b.tr6.i %cmp.i = icmp eq i64 %rem.i, 0 br i1 %cmp.i, label %get_gcd.exit, label %if.else.i get_gcd.exit: ; preds = %if.else.i, %entry %a.tr.lcssa.i = phi i64 [ %a, %entry ], [ %b.tr6.i, %if.else.i ] %div = sdiv i64 %a, %a.tr.lcssa.i %mul = mul nsw i64 %div, %b ret i64 %mul } ; 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 %s = alloca [100001 x i8], align 16 %t = alloca [100001 x i8], 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 100001, ptr nonnull %s) #4 call void @llvm.lifetime.start.p0(i64 100001, ptr nonnull %t) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m) %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s) %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %t) %0 = load i32, ptr %n, align 4, !tbaa !5 %conv = sext i32 %0 to i64 %1 = load i32, ptr %m, align 4, !tbaa !5 %conv4 = sext i32 %1 to i64 %cmp4.i = icmp eq i32 %1, 0 br i1 %cmp4.i, label %get_lcm.exit, label %if.else.i if.else.i: ; preds = %entry, %if.else.i %b.tr6.i = phi i64 [ %rem.i, %if.else.i ], [ %conv4, %entry ] %a.tr5.i = phi i64 [ %b.tr6.i, %if.else.i ], [ %conv, %entry ] %rem.i = srem i64 %a.tr5.i, %b.tr6.i %cmp.i = icmp eq i64 %rem.i, 0 br i1 %cmp.i, label %if.else.i.i, label %if.else.i if.else.i.i: ; preds = %if.else.i, %if.else.i.i %b.tr6.i.i = phi i64 [ %rem.i.i, %if.else.i.i ], [ %conv4, %if.else.i ] %a.tr5.i.i = phi i64 [ %b.tr6.i.i, %if.else.i.i ], [ %conv, %if.else.i ] %rem.i.i = srem i64 %a.tr5.i.i, %b.tr6.i.i %cmp.i.i = icmp eq i64 %rem.i.i, 0 br i1 %cmp.i.i, label %get_lcm.exit, label %if.else.i.i get_lcm.exit: ; preds = %if.else.i.i, %entry %a.tr.lcssa.i33 = phi i64 [ %conv, %entry ], [ %b.tr6.i, %if.else.i.i ] %a.tr.lcssa.i.i = phi i64 [ %conv, %entry ], [ %b.tr6.i.i, %if.else.i.i ] %div.i = sdiv i64 %conv, %a.tr.lcssa.i.i %mul.i = mul nsw i64 %div.i, %conv4 %cmp34 = icmp sgt i64 %a.tr.lcssa.i33, 0 br i1 %cmp34, label %for.body.lr.ph, label %if.then21 for.body.lr.ph: ; preds = %get_lcm.exit %div13 = sdiv i64 %mul.i, %conv br label %for.body for.cond: ; preds = %for.body %inc = add nuw nsw i64 %i.035, 1 %exitcond.not = icmp eq i64 %inc, %a.tr.lcssa.i33 br i1 %exitcond.not, label %if.then21, label %for.body, !llvm.loop !9 for.body: ; preds = %for.body.lr.ph, %for.cond %i.035 = phi i64 [ 0, %for.body.lr.ph ], [ %inc, %for.cond ] %mul = mul nsw i64 %i.035, %div.i %arrayidx = getelementptr inbounds [100001 x i8], ptr %s, i64 0, i64 %mul %2 = load i8, ptr %arrayidx, align 1, !tbaa !11 %mul14 = mul nsw i64 %div13, %i.035 %arrayidx15 = getelementptr inbounds [100001 x i8], ptr %t, i64 0, i64 %mul14 %3 = load i8, ptr %arrayidx15, align 1, !tbaa !11 %cmp17.not = icmp eq i8 %2, %3 br i1 %cmp17.not, label %for.cond, label %if.else if.then21: ; preds = %for.cond, %get_lcm.exit %call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %mul.i) br label %if.end24 if.else: ; preds = %for.body %call23 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.3) br label %if.end24 if.end24: ; preds = %if.else, %if.then21 call void @llvm.lifetime.end.p0(i64 100001, ptr nonnull %t) #4 call void @llvm.lifetime.end.p0(i64 100001, ptr nonnull %s) #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 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3 attributes #0 = { nofree norecurse nosync nounwind 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 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 = !{!7, !7, i64 0}
#include <stdio.h> #include <math.h> #include<string.h> int main(){ int a[3], b[3], i, len, j; char str[100]; while(1){ scanf("%s", &str); if(str[0] == '0') break; for(i = 0; i < 3; i++){ a[i] = 0; b[i] = 0; } len = strlen(str); for(i = 1; i < len; i++){ if(str[i] == 'A') a[0]++; if(str[i] == 'B') b[0]++; } if(a[0] > b[0]) a[0]++; if(b[0] > a[0]) b[0]++; for(i = 1; i < 3; i++){ scanf("%s", &str); len = strlen(str); for(j = 1; j < len; j++){ if(str[j] == 'A') a[i]++; if(str[j] == 'B') b[i]++; } if(a[i] > b[i]) a[i]++; if(b[i] > a[i]) b[i]++; } for(i = 0; i < 3; i++) printf("%d %d\n", a[i], b[i]); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_174711/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_174711/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 [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: %str = alloca [100 x i8], align 16 call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %str) #4 %call161 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str) %0 = load i8, ptr %str, align 16, !tbaa !5 %cmp162 = icmp eq i8 %0, 48 br i1 %cmp162, label %while.end, label %for.cond.preheader for.cond.preheader: ; preds = %entry, %for.inc107.1 %call7 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #5 %conv8 = trunc i64 %call7 to i32 %cmp10154 = icmp sgt i32 %conv8, 1 br i1 %cmp10154, label %for.body12.preheader, label %if.end49 for.body12.preheader: ; preds = %for.cond.preheader %wide.trip.count = and i64 %call7, 4294967295 %1 = add nsw i64 %wide.trip.count, -1 %xtraiter = and i64 %1, 1 %2 = icmp eq i64 %wide.trip.count, 2 br i1 %2, label %for.end33.unr-lcssa, label %for.body12.preheader.new for.body12.preheader.new: ; preds = %for.body12.preheader %unroll_iter = and i64 %1, -2 br label %for.body12 for.body12: ; preds = %for.inc31.1, %for.body12.preheader.new %indvars.iv = phi i64 [ 1, %for.body12.preheader.new ], [ %indvars.iv.next.1, %for.inc31.1 ] %3 = phi i32 [ 0, %for.body12.preheader.new ], [ %10, %for.inc31.1 ] %4 = phi i32 [ 0, %for.body12.preheader.new ], [ %9, %for.inc31.1 ] %niter = phi i64 [ 0, %for.body12.preheader.new ], [ %niter.next.1, %for.inc31.1 ] %arrayidx14 = getelementptr inbounds [100 x i8], ptr %str, i64 0, i64 %indvars.iv %5 = load i8, ptr %arrayidx14, align 1, !tbaa !5 switch i8 %5, label %for.inc31 [ i8 65, label %if.end21.thread i8 66, label %if.then27 ] if.end21.thread: ; preds = %for.body12 %inc20 = add nsw i32 %4, 1 br label %for.inc31 if.then27: ; preds = %for.body12 %inc29 = add nsw i32 %3, 1 br label %for.inc31 for.inc31: ; preds = %for.body12, %if.end21.thread, %if.then27 %6 = phi i32 [ %4, %for.body12 ], [ %inc20, %if.end21.thread ], [ %4, %if.then27 ] %7 = phi i32 [ %3, %for.body12 ], [ %3, %if.end21.thread ], [ %inc29, %if.then27 ] %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %arrayidx14.1 = getelementptr inbounds [100 x i8], ptr %str, i64 0, i64 %indvars.iv.next %8 = load i8, ptr %arrayidx14.1, align 1, !tbaa !5 switch i8 %8, label %for.inc31.1 [ i8 65, label %if.end21.thread.1 i8 66, label %if.then27.1 ] if.then27.1: ; preds = %for.inc31 %inc29.1 = add nsw i32 %7, 1 br label %for.inc31.1 if.end21.thread.1: ; preds = %for.inc31 %inc20.1 = add nsw i32 %6, 1 br label %for.inc31.1 for.inc31.1: ; preds = %if.end21.thread.1, %if.then27.1, %for.inc31 %9 = phi i32 [ %6, %for.inc31 ], [ %inc20.1, %if.end21.thread.1 ], [ %6, %if.then27.1 ] %10 = phi i32 [ %7, %for.inc31 ], [ %7, %if.end21.thread.1 ], [ %inc29.1, %if.then27.1 ] %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 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.end33.unr-lcssa, label %for.body12, !llvm.loop !8 for.end33.unr-lcssa: ; preds = %for.inc31.1, %for.body12.preheader %.lcssa230.ph = phi i32 [ undef, %for.body12.preheader ], [ %9, %for.inc31.1 ] %.lcssa.ph = phi i32 [ undef, %for.body12.preheader ], [ %10, %for.inc31.1 ] %indvars.iv.unr = phi i64 [ 1, %for.body12.preheader ], [ %indvars.iv.next.1, %for.inc31.1 ] %.unr = phi i32 [ 0, %for.body12.preheader ], [ %10, %for.inc31.1 ] %.unr231 = phi i32 [ 0, %for.body12.preheader ], [ %9, %for.inc31.1 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end33, label %for.body12.epil for.body12.epil: ; preds = %for.end33.unr-lcssa %arrayidx14.epil = getelementptr inbounds [100 x i8], ptr %str, i64 0, i64 %indvars.iv.unr %11 = load i8, ptr %arrayidx14.epil, align 1, !tbaa !5 switch i8 %11, label %for.end33 [ i8 65, label %if.end21.thread.epil i8 66, label %if.then27.epil ] if.then27.epil: ; preds = %for.body12.epil %inc29.epil = add nsw i32 %.unr, 1 br label %for.end33 if.end21.thread.epil: ; preds = %for.body12.epil %inc20.epil = add nsw i32 %.unr231, 1 br label %for.end33 for.end33: ; preds = %for.body12.epil, %if.then27.epil, %if.end21.thread.epil, %for.end33.unr-lcssa %.lcssa230 = phi i32 [ %.lcssa230.ph, %for.end33.unr-lcssa ], [ %.unr231, %for.body12.epil ], [ %inc20.epil, %if.end21.thread.epil ], [ %.unr231, %if.then27.epil ] %.lcssa = phi i32 [ %.lcssa.ph, %for.end33.unr-lcssa ], [ %.unr, %for.body12.epil ], [ %.unr, %if.end21.thread.epil ], [ %inc29.epil, %if.then27.epil ] %cmp36 = icmp sgt i32 %.lcssa230, %.lcssa %inc40 = zext i1 %cmp36 to i32 %spec.select = add nsw i32 %.lcssa230, %inc40 %cmp44 = icmp sgt i32 %.lcssa, %spec.select %inc48 = zext i1 %cmp44 to i32 %spec.select226 = add nsw i32 %.lcssa, %inc48 br label %if.end49 if.end49: ; preds = %for.end33, %for.cond.preheader %a.sroa.0.1206 = phi i32 [ 0, %for.cond.preheader ], [ %spec.select, %for.end33 ] %b.sroa.0.1 = phi i32 [ 0, %for.cond.preheader ], [ %spec.select226, %for.end33 ] %call54 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str) %call56 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #5 %conv57 = trunc i64 %call56 to i32 %cmp59157 = icmp sgt i32 %conv57, 1 br i1 %cmp59157, label %for.body61.lr.ph, label %for.inc107 for.body61.lr.ph: ; preds = %if.end49 %wide.trip.count170 = and i64 %call56, 4294967295 %12 = add nsw i64 %wide.trip.count170, -1 %xtraiter234 = and i64 %12, 1 %13 = icmp eq i64 %wide.trip.count170, 2 br i1 %13, label %for.end84.unr-lcssa, label %for.body61.lr.ph.new for.body61.lr.ph.new: ; preds = %for.body61.lr.ph %unroll_iter238 = and i64 %12, -2 br label %for.body61 for.body61: ; preds = %for.inc82.1248, %for.body61.lr.ph.new %a.sroa.8.1 = phi i32 [ 0, %for.body61.lr.ph.new ], [ %a.sroa.8.2.1, %for.inc82.1248 ] %b.sroa.7.1 = phi i32 [ 0, %for.body61.lr.ph.new ], [ %b.sroa.7.2.1, %for.inc82.1248 ] %indvars.iv167 = phi i64 [ 1, %for.body61.lr.ph.new ], [ %indvars.iv.next168.1247, %for.inc82.1248 ] %niter239 = phi i64 [ 0, %for.body61.lr.ph.new ], [ %niter239.next.1, %for.inc82.1248 ] %arrayidx63 = getelementptr inbounds [100 x i8], ptr %str, i64 0, i64 %indvars.iv167 %14 = load i8, ptr %arrayidx63, align 1, !tbaa !5 switch i8 %14, label %for.inc82 [ i8 65, label %if.end71.thread i8 66, label %if.then77 ] if.end71.thread: ; preds = %for.body61 %inc70 = add nsw i32 %a.sroa.8.1, 1 br label %for.inc82 if.then77: ; preds = %for.body61 %inc80 = add nsw i32 %b.sroa.7.1, 1 br label %for.inc82 for.inc82: ; preds = %for.body61, %if.end71.thread, %if.then77 %a.sroa.8.2 = phi i32 [ %a.sroa.8.1, %for.body61 ], [ %a.sroa.8.1, %if.then77 ], [ %inc70, %if.end71.thread ] %b.sroa.7.2 = phi i32 [ %b.sroa.7.1, %for.body61 ], [ %inc80, %if.then77 ], [ %b.sroa.7.1, %if.end71.thread ] %indvars.iv.next168 = add nuw nsw i64 %indvars.iv167, 1 %arrayidx63.1241 = getelementptr inbounds [100 x i8], ptr %str, i64 0, i64 %indvars.iv.next168 %15 = load i8, ptr %arrayidx63.1241, align 1, !tbaa !5 switch i8 %15, label %for.inc82.1248 [ i8 65, label %if.end71.thread.1246 i8 66, label %if.then77.1244 ] if.then77.1244: ; preds = %for.inc82 %inc80.1243 = add nsw i32 %b.sroa.7.2, 1 br label %for.inc82.1248 if.end71.thread.1246: ; preds = %for.inc82 %inc70.1245 = add nsw i32 %a.sroa.8.2, 1 br label %for.inc82.1248 for.inc82.1248: ; preds = %if.end71.thread.1246, %if.then77.1244, %for.inc82 %a.sroa.8.2.1 = phi i32 [ %a.sroa.8.2, %for.inc82 ], [ %a.sroa.8.2, %if.then77.1244 ], [ %inc70.1245, %if.end71.thread.1246 ] %b.sroa.7.2.1 = phi i32 [ %b.sroa.7.2, %for.inc82 ], [ %inc80.1243, %if.then77.1244 ], [ %b.sroa.7.2, %if.end71.thread.1246 ] %indvars.iv.next168.1247 = add nuw nsw i64 %indvars.iv167, 2 %niter239.next.1 = add i64 %niter239, 2 %niter239.ncmp.1 = icmp eq i64 %niter239.next.1, %unroll_iter238 br i1 %niter239.ncmp.1, label %for.end84.unr-lcssa, label %for.body61, !llvm.loop !10 for.end84.unr-lcssa: ; preds = %for.inc82.1248, %for.body61.lr.ph %a.sroa.8.2.lcssa.ph = phi i32 [ undef, %for.body61.lr.ph ], [ %a.sroa.8.2.1, %for.inc82.1248 ] %b.sroa.7.2.lcssa.ph = phi i32 [ undef, %for.body61.lr.ph ], [ %b.sroa.7.2.1, %for.inc82.1248 ] %a.sroa.8.1.unr = phi i32 [ 0, %for.body61.lr.ph ], [ %a.sroa.8.2.1, %for.inc82.1248 ] %b.sroa.7.1.unr = phi i32 [ 0, %for.body61.lr.ph ], [ %b.sroa.7.2.1, %for.inc82.1248 ] %indvars.iv167.unr = phi i64 [ 1, %for.body61.lr.ph ], [ %indvars.iv.next168.1247, %for.inc82.1248 ] %lcmp.mod235.not = icmp eq i64 %xtraiter234, 0 br i1 %lcmp.mod235.not, label %for.end84, label %for.body61.epil for.body61.epil: ; preds = %for.end84.unr-lcssa %arrayidx63.epil = getelementptr inbounds [100 x i8], ptr %str, i64 0, i64 %indvars.iv167.unr %16 = load i8, ptr %arrayidx63.epil, align 1, !tbaa !5 switch i8 %16, label %for.end84 [ i8 65, label %if.end71.thread.epil i8 66, label %if.then77.epil ] if.then77.epil: ; preds = %for.body61.epil %inc80.epil = add nsw i32 %b.sroa.7.1.unr, 1 br label %for.end84 if.end71.thread.epil: ; preds = %for.body61.epil %inc70.epil = add nsw i32 %a.sroa.8.1.unr, 1 br label %for.end84 for.end84: ; preds = %for.body61.epil, %if.then77.epil, %if.end71.thread.epil, %for.end84.unr-lcssa %a.sroa.8.2.lcssa = phi i32 [ %a.sroa.8.2.lcssa.ph, %for.end84.unr-lcssa ], [ %a.sroa.8.1.unr, %for.body61.epil ], [ %a.sroa.8.1.unr, %if.then77.epil ], [ %inc70.epil, %if.end71.thread.epil ] %b.sroa.7.2.lcssa = phi i32 [ %b.sroa.7.2.lcssa.ph, %for.end84.unr-lcssa ], [ %b.sroa.7.1.unr, %for.body61.epil ], [ %inc80.epil, %if.then77.epil ], [ %b.sroa.7.1.unr, %if.end71.thread.epil ] %cmp89 = icmp sgt i32 %a.sroa.8.2.lcssa, %b.sroa.7.2.lcssa %inc94 = zext i1 %cmp89 to i32 %spec.select224 = add nsw i32 %a.sroa.8.2.lcssa, %inc94 %cmp100 = icmp sgt i32 %b.sroa.7.2.lcssa, %spec.select224 %inc105 = zext i1 %cmp100 to i32 %spec.select227 = add nsw i32 %b.sroa.7.2.lcssa, %inc105 br label %for.inc107 for.inc107: ; preds = %for.end84, %if.end49 %a.sroa.8.4214 = phi i32 [ 0, %if.end49 ], [ %spec.select224, %for.end84 ] %b.sroa.7.4 = phi i32 [ 0, %if.end49 ], [ %spec.select227, %for.end84 ] %call54.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str) %call56.1 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #5 %conv57.1 = trunc i64 %call56.1 to i32 %cmp59157.1 = icmp sgt i32 %conv57.1, 1 br i1 %cmp59157.1, label %for.body61.lr.ph.1, label %for.inc107.1 for.body61.lr.ph.1: ; preds = %for.inc107 %wide.trip.count170.1 = and i64 %call56.1, 4294967295 %17 = add nsw i64 %wide.trip.count170.1, -1 %xtraiter249 = and i64 %17, 1 %18 = icmp eq i64 %wide.trip.count170.1, 2 br i1 %18, label %for.end84.1.unr-lcssa, label %for.body61.lr.ph.1.new for.body61.lr.ph.1.new: ; preds = %for.body61.lr.ph.1 %unroll_iter253 = and i64 %17, -2 br label %for.body61.1 for.body61.1: ; preds = %for.inc82.1.1, %for.body61.lr.ph.1.new %a.sroa.14.1 = phi i32 [ 0, %for.body61.lr.ph.1.new ], [ %a.sroa.14.2.1, %for.inc82.1.1 ] %b.sroa.12.1 = phi i32 [ 0, %for.body61.lr.ph.1.new ], [ %b.sroa.12.2.1, %for.inc82.1.1 ] %indvars.iv167.1 = phi i64 [ 1, %for.body61.lr.ph.1.new ], [ %indvars.iv.next168.1.1, %for.inc82.1.1 ] %niter254 = phi i64 [ 0, %for.body61.lr.ph.1.new ], [ %niter254.next.1, %for.inc82.1.1 ] %arrayidx63.1 = getelementptr inbounds [100 x i8], ptr %str, i64 0, i64 %indvars.iv167.1 %19 = load i8, ptr %arrayidx63.1, align 1, !tbaa !5 switch i8 %19, label %for.inc82.1 [ i8 65, label %if.end71.thread.1 i8 66, label %if.then77.1 ] if.then77.1: ; preds = %for.body61.1 %inc80.1 = add nsw i32 %b.sroa.12.1, 1 br label %for.inc82.1 if.end71.thread.1: ; preds = %for.body61.1 %inc70.1 = add nsw i32 %a.sroa.14.1, 1 br label %for.inc82.1 for.inc82.1: ; preds = %if.end71.thread.1, %if.then77.1, %for.body61.1 %a.sroa.14.2 = phi i32 [ %a.sroa.14.1, %for.body61.1 ], [ %a.sroa.14.1, %if.then77.1 ], [ %inc70.1, %if.end71.thread.1 ] %b.sroa.12.2 = phi i32 [ %b.sroa.12.1, %for.body61.1 ], [ %inc80.1, %if.then77.1 ], [ %b.sroa.12.1, %if.end71.thread.1 ] %indvars.iv.next168.1 = add nuw nsw i64 %indvars.iv167.1, 1 %arrayidx63.1.1 = getelementptr inbounds [100 x i8], ptr %str, i64 0, i64 %indvars.iv.next168.1 %20 = load i8, ptr %arrayidx63.1.1, align 1, !tbaa !5 switch i8 %20, label %for.inc82.1.1 [ i8 65, label %if.end71.thread.1.1 i8 66, label %if.then77.1.1 ] if.then77.1.1: ; preds = %for.inc82.1 %inc80.1.1 = add nsw i32 %b.sroa.12.2, 1 br label %for.inc82.1.1 if.end71.thread.1.1: ; preds = %for.inc82.1 %inc70.1.1 = add nsw i32 %a.sroa.14.2, 1 br label %for.inc82.1.1 for.inc82.1.1: ; preds = %if.end71.thread.1.1, %if.then77.1.1, %for.inc82.1 %a.sroa.14.2.1 = phi i32 [ %a.sroa.14.2, %for.inc82.1 ], [ %a.sroa.14.2, %if.then77.1.1 ], [ %inc70.1.1, %if.end71.thread.1.1 ] %b.sroa.12.2.1 = phi i32 [ %b.sroa.12.2, %for.inc82.1 ], [ %inc80.1.1, %if.then77.1.1 ], [ %b.sroa.12.2, %if.end71.thread.1.1 ] %indvars.iv.next168.1.1 = add nuw nsw i64 %indvars.iv167.1, 2 %niter254.next.1 = add i64 %niter254, 2 %niter254.ncmp.1 = icmp eq i64 %niter254.next.1, %unroll_iter253 br i1 %niter254.ncmp.1, label %for.end84.1.unr-lcssa, label %for.body61.1, !llvm.loop !10 for.end84.1.unr-lcssa: ; preds = %for.inc82.1.1, %for.body61.lr.ph.1 %a.sroa.14.2.lcssa.ph = phi i32 [ undef, %for.body61.lr.ph.1 ], [ %a.sroa.14.2.1, %for.inc82.1.1 ] %b.sroa.12.2.lcssa.ph = phi i32 [ undef, %for.body61.lr.ph.1 ], [ %b.sroa.12.2.1, %for.inc82.1.1 ] %a.sroa.14.1.unr = phi i32 [ 0, %for.body61.lr.ph.1 ], [ %a.sroa.14.2.1, %for.inc82.1.1 ] %b.sroa.12.1.unr = phi i32 [ 0, %for.body61.lr.ph.1 ], [ %b.sroa.12.2.1, %for.inc82.1.1 ] %indvars.iv167.1.unr = phi i64 [ 1, %for.body61.lr.ph.1 ], [ %indvars.iv.next168.1.1, %for.inc82.1.1 ] %lcmp.mod250.not = icmp eq i64 %xtraiter249, 0 br i1 %lcmp.mod250.not, label %for.end84.1, label %for.body61.1.epil for.body61.1.epil: ; preds = %for.end84.1.unr-lcssa %arrayidx63.1.epil = getelementptr inbounds [100 x i8], ptr %str, i64 0, i64 %indvars.iv167.1.unr %21 = load i8, ptr %arrayidx63.1.epil, align 1, !tbaa !5 switch i8 %21, label %for.end84.1 [ i8 65, label %if.end71.thread.1.epil i8 66, label %if.then77.1.epil ] if.then77.1.epil: ; preds = %for.body61.1.epil %inc80.1.epil = add nsw i32 %b.sroa.12.1.unr, 1 br label %for.end84.1 if.end71.thread.1.epil: ; preds = %for.body61.1.epil %inc70.1.epil = add nsw i32 %a.sroa.14.1.unr, 1 br label %for.end84.1 for.end84.1: ; preds = %for.body61.1.epil, %if.then77.1.epil, %if.end71.thread.1.epil, %for.end84.1.unr-lcssa %a.sroa.14.2.lcssa = phi i32 [ %a.sroa.14.2.lcssa.ph, %for.end84.1.unr-lcssa ], [ %a.sroa.14.1.unr, %for.body61.1.epil ], [ %a.sroa.14.1.unr, %if.then77.1.epil ], [ %inc70.1.epil, %if.end71.thread.1.epil ] %b.sroa.12.2.lcssa = phi i32 [ %b.sroa.12.2.lcssa.ph, %for.end84.1.unr-lcssa ], [ %b.sroa.12.1.unr, %for.body61.1.epil ], [ %inc80.1.epil, %if.then77.1.epil ], [ %b.sroa.12.1.unr, %if.end71.thread.1.epil ] %cmp89.1 = icmp sgt i32 %a.sroa.14.2.lcssa, %b.sroa.12.2.lcssa %inc94.1 = zext i1 %cmp89.1 to i32 %spec.select225 = add nsw i32 %a.sroa.14.2.lcssa, %inc94.1 %cmp100.1 = icmp sgt i32 %b.sroa.12.2.lcssa, %spec.select225 %inc105.1 = zext i1 %cmp100.1 to i32 %spec.select228 = add nsw i32 %b.sroa.12.2.lcssa, %inc105.1 br label %for.inc107.1 for.inc107.1: ; preds = %for.end84.1, %for.inc107 %a.sroa.14.4222 = phi i32 [ 0, %for.inc107 ], [ %spec.select225, %for.end84.1 ] %b.sroa.12.4 = phi i32 [ 0, %for.inc107 ], [ %spec.select228, %for.end84.1 ] %call118 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %a.sroa.0.1206, i32 noundef %b.sroa.0.1) %call118.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %a.sroa.8.4214, i32 noundef %b.sroa.7.4) %call118.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %a.sroa.14.4222, i32 noundef %b.sroa.12.4) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str) %22 = load i8, ptr %str, align 16, !tbaa !5 %cmp = icmp eq i8 %22, 48 br i1 %cmp, label %while.end, label %for.cond.preheader while.end: ; preds = %for.inc107.1, %entry call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %str) #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: 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 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 = { nounwind } attributes #5 = { 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 = !{!"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<math.h> int main(void){ int i; double n,h[1000],a,c,d; while(scanf("%lf",&n) != EOF){ if(n == 0){ break; } double s=0; double b=0; for(i =0; i<n; i++){ scanf("%lf",&h[i]); s += h[i]; } a = s/n; for(i=0; i<n; i++){ b += (h[i]-a)*(h[i]-a); } c = b/n; d = sqrt(c); printf("%.8lf\n",d); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_174755/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_174755/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"%.8lf\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca double, align 8 %h = alloca [1000 x double], align 16 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 8000, ptr nonnull %h) #5 %call42 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %cmp43 = icmp eq i32 %call42, -1 %0 = load double, ptr %n, align 8 %cmp144 = fcmp oeq double %0, 0.000000e+00 %or.cond45 = select i1 %cmp43, i1 true, i1 %cmp144 br i1 %or.cond45, label %while.end, label %for.cond.preheader for.cond.preheader: ; preds = %entry, %for.end19 %1 = phi double [ %8, %for.end19 ], [ %0, %entry ] %cmp234 = fcmp ogt double %1, 0.000000e+00 br i1 %cmp234, label %for.body, label %for.end for.body: ; preds = %for.cond.preheader, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ] %s.036 = phi double [ %add, %for.body ], [ 0.000000e+00, %for.cond.preheader ] %arrayidx = getelementptr inbounds [1000 x double], ptr %h, i64 0, i64 %indvars.iv %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %2 = load double, ptr %arrayidx, align 8, !tbaa !5 %add = fadd double %s.036, %2 %indvars.iv.next = add nuw i64 %indvars.iv, 1 %3 = trunc i64 %indvars.iv.next to i32 %conv = sitofp i32 %3 to double %4 = load double, ptr %n, align 8, !tbaa !5 %cmp2 = fcmp ogt double %4, %conv br i1 %cmp2, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %for.cond.preheader %s.0.lcssa = phi double [ 0.000000e+00, %for.cond.preheader ], [ %add, %for.body ] %.lcssa = phi double [ %1, %for.cond.preheader ], [ %4, %for.body ] %div = fdiv double %s.0.lcssa, %.lcssa %cmp938 = fcmp ogt double %.lcssa, 0.000000e+00 br i1 %cmp938, label %for.body11, label %for.end19 for.body11: ; preds = %for.end, %for.body11 %indvars.iv49 = phi i64 [ %indvars.iv.next50, %for.body11 ], [ 0, %for.end ] %b.040 = phi double [ %6, %for.body11 ], [ 0.000000e+00, %for.end ] %arrayidx13 = getelementptr inbounds [1000 x double], ptr %h, i64 0, i64 %indvars.iv49 %5 = load double, ptr %arrayidx13, align 8, !tbaa !5 %sub = fsub double %5, %div %6 = call double @llvm.fmuladd.f64(double %sub, double %sub, double %b.040) %indvars.iv.next50 = add nuw i64 %indvars.iv49, 1 %7 = trunc i64 %indvars.iv.next50 to i32 %conv8 = sitofp i32 %7 to double %cmp9 = fcmp ogt double %.lcssa, %conv8 br i1 %cmp9, label %for.body11, label %for.end19, !llvm.loop !11 for.end19: ; preds = %for.body11, %for.end %b.0.lcssa = phi double [ 0.000000e+00, %for.end ], [ %6, %for.body11 ] %div20 = fdiv double %b.0.lcssa, %.lcssa %call21 = call double @sqrt(double noundef %div20) #5 %call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %call21) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %cmp = icmp eq i32 %call, -1 %8 = load double, ptr %n, align 8 %cmp1 = fcmp oeq double %8, 0.000000e+00 %or.cond = select i1 %cmp, i1 true, i1 %cmp1 br i1 %or.cond, label %while.end, label %for.cond.preheader, !llvm.loop !12 while.end: ; preds = %for.end19, %entry call void @llvm.lifetime.end.p0(i64 8000, ptr nonnull %h) #5 call void @llvm.lifetime.end.p0(i64 8, 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 speculatable willreturn memory(none) declare double @llvm.fmuladd.f64(double, double, double) #3 ; Function Attrs: mustprogress nofree nounwind willreturn memory(write) declare double @sqrt(double noundef) local_unnamed_addr #4 ; 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 nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #4 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-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 = !{!"double", !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 <math.h> #define MAX 1000 int main(void){ int i, n, temp[MAX]; double sum, ave, sd; while(1){ scanf("%d", &n); if(n == 0){ break; } sum = 0.0; for(i = 0; i < n; i++){ scanf("%d", &temp[i]); sum += (double)temp[i]; } ave = sum / (double)n; sd = 0.0; for(i = 0; i < n; i++){ sd += (ave - (double)temp[i]) * (ave - (double)temp[i]); } sd /= (double)n; printf("%f\n", sqrt(sd)); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_174799/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_174799/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"%f\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %temp = alloca [1000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %temp) #5 %call44 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp45 = icmp eq i32 %0, 0 br i1 %cmp45, label %while.end, label %for.cond.preheader for.cond.preheader: ; preds = %entry, %for.end19 %1 = phi i32 [ %16, %for.end19 ], [ %0, %entry ] %cmp136 = icmp sgt i32 %1, 0 br i1 %cmp136, label %for.body, label %for.end.thread for.end.thread: ; preds = %for.cond.preheader %conv554 = sitofp i32 %1 to double br label %for.end19 for.body: ; preds = %for.cond.preheader, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ] %sum.037 = phi double [ %add, %for.body ], [ 0.000000e+00, %for.cond.preheader ] %arrayidx = getelementptr inbounds [1000 x i32], ptr %temp, i64 0, i64 %indvars.iv %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %2 = load i32, ptr %arrayidx, align 4, !tbaa !5 %conv = sitofp i32 %2 to double %add = fadd double %sum.037, %conv %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %3 = load i32, ptr %n, align 4, !tbaa !5 %4 = sext i32 %3 to i64 %cmp1 = icmp slt i64 %indvars.iv.next, %4 br i1 %cmp1, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body %conv5 = sitofp i32 %3 to double %div = fdiv double %add, %conv5 %cmp740 = icmp sgt i32 %3, 0 br i1 %cmp740, label %for.body9.preheader, label %for.end19 for.body9.preheader: ; preds = %for.end %wide.trip.count = zext i32 %3 to i64 %xtraiter = and i64 %wide.trip.count, 3 %5 = icmp ult i32 %3, 4 br i1 %5, label %for.end19.loopexit.unr-lcssa, label %for.body9.preheader.new for.body9.preheader.new: ; preds = %for.body9.preheader %unroll_iter = and i64 %wide.trip.count, 4294967292 br label %for.body9 for.body9: ; preds = %for.body9, %for.body9.preheader.new %indvars.iv49 = phi i64 [ 0, %for.body9.preheader.new ], [ %indvars.iv.next50.3, %for.body9 ] %sd.042 = phi double [ 0.000000e+00, %for.body9.preheader.new ], [ %13, %for.body9 ] %niter = phi i64 [ 0, %for.body9.preheader.new ], [ %niter.next.3, %for.body9 ] %arrayidx11 = getelementptr inbounds [1000 x i32], ptr %temp, i64 0, i64 %indvars.iv49 %6 = load i32, ptr %arrayidx11, align 16, !tbaa !5 %conv12 = sitofp i32 %6 to double %sub = fsub double %div, %conv12 %7 = call double @llvm.fmuladd.f64(double %sub, double %sub, double %sd.042) %indvars.iv.next50 = or i64 %indvars.iv49, 1 %arrayidx11.1 = getelementptr inbounds [1000 x i32], ptr %temp, i64 0, i64 %indvars.iv.next50 %8 = load i32, ptr %arrayidx11.1, align 4, !tbaa !5 %conv12.1 = sitofp i32 %8 to double %sub.1 = fsub double %div, %conv12.1 %9 = call double @llvm.fmuladd.f64(double %sub.1, double %sub.1, double %7) %indvars.iv.next50.1 = or i64 %indvars.iv49, 2 %arrayidx11.2 = getelementptr inbounds [1000 x i32], ptr %temp, i64 0, i64 %indvars.iv.next50.1 %10 = load i32, ptr %arrayidx11.2, align 8, !tbaa !5 %conv12.2 = sitofp i32 %10 to double %sub.2 = fsub double %div, %conv12.2 %11 = call double @llvm.fmuladd.f64(double %sub.2, double %sub.2, double %9) %indvars.iv.next50.2 = or i64 %indvars.iv49, 3 %arrayidx11.3 = getelementptr inbounds [1000 x i32], ptr %temp, i64 0, i64 %indvars.iv.next50.2 %12 = load i32, ptr %arrayidx11.3, align 4, !tbaa !5 %conv12.3 = sitofp i32 %12 to double %sub.3 = fsub double %div, %conv12.3 %13 = call double @llvm.fmuladd.f64(double %sub.3, double %sub.3, double %11) %indvars.iv.next50.3 = add nuw nsw i64 %indvars.iv49, 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.end19.loopexit.unr-lcssa, label %for.body9, !llvm.loop !11 for.end19.loopexit.unr-lcssa: ; preds = %for.body9, %for.body9.preheader %.lcssa60.ph = phi double [ undef, %for.body9.preheader ], [ %13, %for.body9 ] %indvars.iv49.unr = phi i64 [ 0, %for.body9.preheader ], [ %indvars.iv.next50.3, %for.body9 ] %sd.042.unr = phi double [ 0.000000e+00, %for.body9.preheader ], [ %13, %for.body9 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end19, label %for.body9.epil for.body9.epil: ; preds = %for.end19.loopexit.unr-lcssa, %for.body9.epil %indvars.iv49.epil = phi i64 [ %indvars.iv.next50.epil, %for.body9.epil ], [ %indvars.iv49.unr, %for.end19.loopexit.unr-lcssa ] %sd.042.epil = phi double [ %15, %for.body9.epil ], [ %sd.042.unr, %for.end19.loopexit.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body9.epil ], [ 0, %for.end19.loopexit.unr-lcssa ] %arrayidx11.epil = getelementptr inbounds [1000 x i32], ptr %temp, i64 0, i64 %indvars.iv49.epil %14 = load i32, ptr %arrayidx11.epil, align 4, !tbaa !5 %conv12.epil = sitofp i32 %14 to double %sub.epil = fsub double %div, %conv12.epil %15 = call double @llvm.fmuladd.f64(double %sub.epil, double %sub.epil, double %sd.042.epil) %indvars.iv.next50.epil = add nuw nsw i64 %indvars.iv49.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.end19, label %for.body9.epil, !llvm.loop !12 for.end19: ; preds = %for.end19.loopexit.unr-lcssa, %for.body9.epil, %for.end.thread, %for.end %conv557 = phi double [ %conv5, %for.end ], [ %conv554, %for.end.thread ], [ %conv5, %for.body9.epil ], [ %conv5, %for.end19.loopexit.unr-lcssa ] %sd.0.lcssa = phi double [ 0.000000e+00, %for.end ], [ 0.000000e+00, %for.end.thread ], [ %.lcssa60.ph, %for.end19.loopexit.unr-lcssa ], [ %15, %for.body9.epil ] %div21 = fdiv double %sd.0.lcssa, %conv557 %call22 = call double @sqrt(double noundef %div21) #5 %call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %call22) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %16 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp eq i32 %16, 0 br i1 %cmp, label %while.end, label %for.cond.preheader while.end: ; preds = %for.end19, %entry call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %temp) #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 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 nofree nounwind willreturn memory(write) declare double @sqrt(double noundef) 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 = { 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 nounwind willreturn memory(write) "no-trapping-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, !13} !13 = !{!"llvm.loop.unroll.disable"}
#include <stdio.h> #include <math.h> int main(void) { int i, n, s[1000]; double m, v, sd; while(1) { scanf("%d",&n); if(n==0) break; for (i=0; i<n; i++) { scanf("%d",&s[i]); } m = 0; for (i=0; i<n; i++) { m += s[i]; } m /= n; v = 0; for (i=0; i<n; i++) { v += (s[i] - m)*(s[i] - m); } v /= n; sd = sqrt(v); printf("%f\n",sd); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_174849/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_174849/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"%f\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 [1000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %s) #5 %call55 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp56 = icmp eq i32 %0, 0 br i1 %cmp56, label %while.end, label %for.cond.preheader for.cond.preheader: ; preds = %entry, %for.end25 %1 = phi i32 [ %21, %for.end25 ], [ %0, %entry ] %cmp145 = icmp sgt i32 %1, 0 br i1 %cmp145, label %for.body, label %for.end10.thread for.cond3.preheader: ; preds = %for.body %cmp447 = icmp sgt i32 %3, 0 br i1 %cmp447, label %for.body5.preheader, label %for.end10.thread for.body5.preheader: ; preds = %for.cond3.preheader %wide.trip.count = zext i32 %3 to i64 %xtraiter = and i64 %wide.trip.count, 3 %2 = icmp ult i32 %3, 4 br i1 %2, label %for.end10.unr-lcssa, label %for.body5.preheader.new for.body5.preheader.new: ; preds = %for.body5.preheader %unroll_iter = and i64 %wide.trip.count, 4294967292 br label %for.body5 for.body: ; preds = %for.cond.preheader, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ] %arrayidx = getelementptr inbounds [1000 x i32], ptr %s, i64 0, i64 %indvars.iv %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %3 = load i32, ptr %n, align 4, !tbaa !5 %4 = sext i32 %3 to i64 %cmp1 = icmp slt i64 %indvars.iv.next, %4 br i1 %cmp1, label %for.body, label %for.cond3.preheader, !llvm.loop !9 for.body5: ; preds = %for.body5, %for.body5.preheader.new %indvars.iv60 = phi i64 [ 0, %for.body5.preheader.new ], [ %indvars.iv.next61.3, %for.body5 ] %m.048 = phi double [ 0.000000e+00, %for.body5.preheader.new ], [ %add.3, %for.body5 ] %niter = phi i64 [ 0, %for.body5.preheader.new ], [ %niter.next.3, %for.body5 ] %arrayidx7 = getelementptr inbounds [1000 x i32], ptr %s, i64 0, i64 %indvars.iv60 %5 = load i32, ptr %arrayidx7, align 16, !tbaa !5 %conv = sitofp i32 %5 to double %add = fadd double %m.048, %conv %indvars.iv.next61 = or i64 %indvars.iv60, 1 %arrayidx7.1 = getelementptr inbounds [1000 x i32], ptr %s, i64 0, i64 %indvars.iv.next61 %6 = load i32, ptr %arrayidx7.1, align 4, !tbaa !5 %conv.1 = sitofp i32 %6 to double %add.1 = fadd double %add, %conv.1 %indvars.iv.next61.1 = or i64 %indvars.iv60, 2 %arrayidx7.2 = getelementptr inbounds [1000 x i32], ptr %s, i64 0, i64 %indvars.iv.next61.1 %7 = load i32, ptr %arrayidx7.2, align 8, !tbaa !5 %conv.2 = sitofp i32 %7 to double %add.2 = fadd double %add.1, %conv.2 %indvars.iv.next61.2 = or i64 %indvars.iv60, 3 %arrayidx7.3 = getelementptr inbounds [1000 x i32], ptr %s, i64 0, i64 %indvars.iv.next61.2 %8 = load i32, ptr %arrayidx7.3, align 4, !tbaa !5 %conv.3 = sitofp i32 %8 to double %add.3 = fadd double %add.2, %conv.3 %indvars.iv.next61.3 = add nuw nsw i64 %indvars.iv60, 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.end10.unr-lcssa, label %for.body5, !llvm.loop !11 for.end10.thread: ; preds = %for.cond3.preheader, %for.cond.preheader %.lcssa70.ph = phi i32 [ %3, %for.cond3.preheader ], [ %1, %for.cond.preheader ] %conv1175 = sitofp i32 %.lcssa70.ph to double br label %for.end25 for.end10.unr-lcssa: ; preds = %for.body5, %for.body5.preheader %add.lcssa.ph = phi double [ undef, %for.body5.preheader ], [ %add.3, %for.body5 ] %indvars.iv60.unr = phi i64 [ 0, %for.body5.preheader ], [ %indvars.iv.next61.3, %for.body5 ] %m.048.unr = phi double [ 0.000000e+00, %for.body5.preheader ], [ %add.3, %for.body5 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end10, label %for.body5.epil for.body5.epil: ; preds = %for.end10.unr-lcssa, %for.body5.epil %indvars.iv60.epil = phi i64 [ %indvars.iv.next61.epil, %for.body5.epil ], [ %indvars.iv60.unr, %for.end10.unr-lcssa ] %m.048.epil = phi double [ %add.epil, %for.body5.epil ], [ %m.048.unr, %for.end10.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body5.epil ], [ 0, %for.end10.unr-lcssa ] %arrayidx7.epil = getelementptr inbounds [1000 x i32], ptr %s, i64 0, i64 %indvars.iv60.epil %9 = load i32, ptr %arrayidx7.epil, align 4, !tbaa !5 %conv.epil = sitofp i32 %9 to double %add.epil = fadd double %m.048.epil, %conv.epil %indvars.iv.next61.epil = add nuw nsw i64 %indvars.iv60.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.end10, label %for.body5.epil, !llvm.loop !12 for.end10: ; preds = %for.body5.epil, %for.end10.unr-lcssa %add.lcssa = phi double [ %add.lcssa.ph, %for.end10.unr-lcssa ], [ %add.epil, %for.body5.epil ] %conv11 = sitofp i32 %3 to double %div = fdiv double %add.lcssa, %conv11 br i1 %cmp447, label %for.body15.preheader, label %for.end25 for.body15.preheader: ; preds = %for.end10 %xtraiter82 = and i64 %wide.trip.count, 3 %10 = icmp ult i32 %3, 4 br i1 %10, label %for.end25.loopexit.unr-lcssa, label %for.body15.preheader.new for.body15.preheader.new: ; preds = %for.body15.preheader %unroll_iter86 = and i64 %wide.trip.count, 4294967292 br label %for.body15 for.body15: ; preds = %for.body15, %for.body15.preheader.new %indvars.iv63 = phi i64 [ 0, %for.body15.preheader.new ], [ %indvars.iv.next64.3, %for.body15 ] %v.052 = phi double [ 0.000000e+00, %for.body15.preheader.new ], [ %18, %for.body15 ] %niter87 = phi i64 [ 0, %for.body15.preheader.new ], [ %niter87.next.3, %for.body15 ] %arrayidx17 = getelementptr inbounds [1000 x i32], ptr %s, i64 0, i64 %indvars.iv63 %11 = load i32, ptr %arrayidx17, align 16, !tbaa !5 %conv18 = sitofp i32 %11 to double %sub = fsub double %conv18, %div %12 = call double @llvm.fmuladd.f64(double %sub, double %sub, double %v.052) %indvars.iv.next64 = or i64 %indvars.iv63, 1 %arrayidx17.1 = getelementptr inbounds [1000 x i32], ptr %s, i64 0, i64 %indvars.iv.next64 %13 = load i32, ptr %arrayidx17.1, align 4, !tbaa !5 %conv18.1 = sitofp i32 %13 to double %sub.1 = fsub double %conv18.1, %div %14 = call double @llvm.fmuladd.f64(double %sub.1, double %sub.1, double %12) %indvars.iv.next64.1 = or i64 %indvars.iv63, 2 %arrayidx17.2 = getelementptr inbounds [1000 x i32], ptr %s, i64 0, i64 %indvars.iv.next64.1 %15 = load i32, ptr %arrayidx17.2, align 8, !tbaa !5 %conv18.2 = sitofp i32 %15 to double %sub.2 = fsub double %conv18.2, %div %16 = call double @llvm.fmuladd.f64(double %sub.2, double %sub.2, double %14) %indvars.iv.next64.2 = or i64 %indvars.iv63, 3 %arrayidx17.3 = getelementptr inbounds [1000 x i32], ptr %s, i64 0, i64 %indvars.iv.next64.2 %17 = load i32, ptr %arrayidx17.3, align 4, !tbaa !5 %conv18.3 = sitofp i32 %17 to double %sub.3 = fsub double %conv18.3, %div %18 = call double @llvm.fmuladd.f64(double %sub.3, double %sub.3, double %16) %indvars.iv.next64.3 = add nuw nsw i64 %indvars.iv63, 4 %niter87.next.3 = add i64 %niter87, 4 %niter87.ncmp.3 = icmp eq i64 %niter87.next.3, %unroll_iter86 br i1 %niter87.ncmp.3, label %for.end25.loopexit.unr-lcssa, label %for.body15, !llvm.loop !14 for.end25.loopexit.unr-lcssa: ; preds = %for.body15, %for.body15.preheader %.lcssa80.ph = phi double [ undef, %for.body15.preheader ], [ %18, %for.body15 ] %indvars.iv63.unr = phi i64 [ 0, %for.body15.preheader ], [ %indvars.iv.next64.3, %for.body15 ] %v.052.unr = phi double [ 0.000000e+00, %for.body15.preheader ], [ %18, %for.body15 ] %lcmp.mod84.not = icmp eq i64 %xtraiter82, 0 br i1 %lcmp.mod84.not, label %for.end25, label %for.body15.epil for.body15.epil: ; preds = %for.end25.loopexit.unr-lcssa, %for.body15.epil %indvars.iv63.epil = phi i64 [ %indvars.iv.next64.epil, %for.body15.epil ], [ %indvars.iv63.unr, %for.end25.loopexit.unr-lcssa ] %v.052.epil = phi double [ %20, %for.body15.epil ], [ %v.052.unr, %for.end25.loopexit.unr-lcssa ] %epil.iter83 = phi i64 [ %epil.iter83.next, %for.body15.epil ], [ 0, %for.end25.loopexit.unr-lcssa ] %arrayidx17.epil = getelementptr inbounds [1000 x i32], ptr %s, i64 0, i64 %indvars.iv63.epil %19 = load i32, ptr %arrayidx17.epil, align 4, !tbaa !5 %conv18.epil = sitofp i32 %19 to double %sub.epil = fsub double %conv18.epil, %div %20 = call double @llvm.fmuladd.f64(double %sub.epil, double %sub.epil, double %v.052.epil) %indvars.iv.next64.epil = add nuw nsw i64 %indvars.iv63.epil, 1 %epil.iter83.next = add i64 %epil.iter83, 1 %epil.iter83.cmp.not = icmp eq i64 %epil.iter83.next, %xtraiter82 br i1 %epil.iter83.cmp.not, label %for.end25, label %for.body15.epil, !llvm.loop !15 for.end25: ; preds = %for.end25.loopexit.unr-lcssa, %for.body15.epil, %for.end10.thread, %for.end10 %conv1177 = phi double [ %conv11, %for.end10 ], [ %conv1175, %for.end10.thread ], [ %conv11, %for.body15.epil ], [ %conv11, %for.end25.loopexit.unr-lcssa ] %v.0.lcssa = phi double [ 0.000000e+00, %for.end10 ], [ 0.000000e+00, %for.end10.thread ], [ %.lcssa80.ph, %for.end25.loopexit.unr-lcssa ], [ %20, %for.body15.epil ] %div27 = fdiv double %v.0.lcssa, %conv1177 %call28 = call double @sqrt(double noundef %div27) #5 %call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %call28) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %21 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp eq i32 %21, 0 br i1 %cmp, label %while.end, label %for.cond.preheader while.end: ; preds = %for.end25, %entry call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %s) #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 speculatable willreturn memory(none) declare double @llvm.fmuladd.f64(double, double, double) #3 ; Function Attrs: mustprogress nofree nounwind willreturn memory(write) declare double @sqrt(double noundef) local_unnamed_addr #4 ; 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 nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #4 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-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, !13} !13 = !{!"llvm.loop.unroll.disable"} !14 = distinct !{!14, !10} !15 = distinct !{!15, !13}
#include <stdio.h> int main() { long int n, k, i, j; scanf("%ld%ld",&n,&k); char s[n+1]; scanf("%s",s); if(n==1 && k){printf("0");return 0;} if(s[0]>'1' && k) {s[0]='1'; k--;} for(i=0,j=1;i<k;i++,j++) { if(s[j]=='\0') break; if(s[j]=='0')i--; else s[j]='0'; } printf("%s\n",s); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_1749/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_1749/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 [7 x i8] c"%ld%ld\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 i64, align 8 %k = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %k) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k) %0 = load i64, ptr %n, align 8, !tbaa !5 %add = add nsw i64 %0, 1 %1 = call ptr @llvm.stacksave.p0() %vla = alloca i8, i64 %add, align 16 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %vla) %2 = load i64, ptr %n, align 8, !tbaa !5 %cmp = icmp eq i64 %2, 1 %3 = load i64, ptr %k, align 8 %tobool = icmp ne i64 %3, 0 %or.cond = select i1 %cmp, i1 %tobool, i1 false br i1 %or.cond, label %if.then, label %if.end if.then: ; preds = %entry %putchar = call i32 @putchar(i32 48) br label %cleanup if.end: ; preds = %entry %4 = load i8, ptr %vla, align 16, !tbaa !9 %cmp3 = icmp sgt i8 %4, 49 %or.cond32 = select i1 %cmp3, i1 %tobool, i1 false br i1 %or.cond32, label %if.then7, label %if.end9 if.then7: ; preds = %if.end store i8 49, ptr %vla, align 16, !tbaa !9 %dec = add nsw i64 %3, -1 store i64 %dec, ptr %k, align 8, !tbaa !5 br label %if.end9 if.end9: ; preds = %if.then7, %if.end %5 = phi i64 [ %dec, %if.then7 ], [ %3, %if.end ] %cmp1038 = icmp sgt i64 %5, 0 br i1 %cmp1038, label %for.body, label %for.end for.body: ; preds = %if.end9, %for.inc %i.040 = phi i64 [ %inc, %for.inc ], [ 0, %if.end9 ] %j.039 = phi i64 [ %inc26, %for.inc ], [ 1, %if.end9 ] %arrayidx12 = getelementptr inbounds i8, ptr %vla, i64 %j.039 %6 = load i8, ptr %arrayidx12, align 1, !tbaa !9 switch i8 %6, label %if.else [ i8 0, label %for.end i8 48, label %if.then22 ] if.then22: ; preds = %for.body %dec23 = add nsw i64 %i.040, -1 br label %for.inc if.else: ; preds = %for.body store i8 48, ptr %arrayidx12, align 1, !tbaa !9 br label %for.inc for.inc: ; preds = %if.then22, %if.else %i.1 = phi i64 [ %dec23, %if.then22 ], [ %i.040, %if.else ] %inc = add nsw i64 %i.1, 1 %inc26 = add nuw nsw i64 %j.039, 1 %cmp10 = icmp slt i64 %inc, %5 br i1 %cmp10, label %for.body, label %for.end, !llvm.loop !10 for.end: ; preds = %for.inc, %for.body, %if.end9 %puts = call i32 @puts(ptr nonnull dereferenceable(1) %vla) br label %cleanup cleanup: ; preds = %for.end, %if.then call void @llvm.stackrestore.p0(ptr %1) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k) #5 call void @llvm.lifetime.end.p0(i64 8, 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 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: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4 ; 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 = !{!"long", !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 <math.h> int main() { int n,i,ten[1001],sum; double s,m,l; while(1) { scanf("%d",&n); if( n==0 ) break; for(i=0;i<n;i++) { scanf("%d",&ten[i]); } sum=0; for(i=0;i<n;i++) { sum+=ten[i]; } m=1.0*sum/n; s=0; for(i=0;i<n;i++) { s+=(ten[i]-m)*(ten[i]-m); } l=sqrt(s/n); printf("%.8lf\n",l); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_174942/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_174942/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 [7 x i8] c"%.8lf\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %ten = alloca [1001 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6 call void @llvm.lifetime.start.p0(i64 4004, ptr nonnull %ten) #6 %call54 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp55 = icmp eq i32 %0, 0 br i1 %cmp55, label %while.end, label %for.cond.preheader for.cond.preheader: ; preds = %entry, %for.end26 %1 = phi i32 [ %22, %for.end26 ], [ %0, %entry ] %cmp144 = icmp sgt i32 %1, 0 br i1 %cmp144, label %for.body, label %for.end10.thread for.cond3.preheader: ; preds = %for.body %cmp446 = icmp sgt i32 %8, 0 br i1 %cmp446, label %for.body5.preheader, label %for.end10.thread for.body5.preheader: ; preds = %for.cond3.preheader %wide.trip.count = zext i32 %8 to i64 %min.iters.check = icmp ult i32 %8, 8 br i1 %min.iters.check, label %for.body5.preheader82, label %vector.ph vector.ph: ; preds = %for.body5.preheader %n.vec = and i64 %wide.trip.count, 4294967288 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 ], [ %4, %vector.body ] %vec.phi80 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %5, %vector.body ] %2 = getelementptr inbounds [1001 x i32], ptr %ten, i64 0, i64 %index %wide.load = load <4 x i32>, ptr %2, align 16, !tbaa !5 %3 = getelementptr inbounds i32, ptr %2, i64 4 %wide.load81 = load <4 x i32>, ptr %3, align 16, !tbaa !5 %4 = add <4 x i32> %wide.load, %vec.phi %5 = add <4 x i32> %wide.load81, %vec.phi80 %index.next = add nuw i64 %index, 8 %6 = icmp eq i64 %index.next, %n.vec br i1 %6, label %middle.block, label %vector.body, !llvm.loop !9 middle.block: ; preds = %vector.body %bin.rdx = add <4 x i32> %5, %4 %7 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx) %cmp.n = icmp eq i64 %n.vec, %wide.trip.count br i1 %cmp.n, label %for.end10, label %for.body5.preheader82 for.body5.preheader82: ; preds = %for.body5.preheader, %middle.block %indvars.iv59.ph = phi i64 [ 0, %for.body5.preheader ], [ %n.vec, %middle.block ] %sum.047.ph = phi i32 [ 0, %for.body5.preheader ], [ %7, %middle.block ] br label %for.body5 for.body: ; preds = %for.cond.preheader, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ] %arrayidx = getelementptr inbounds [1001 x i32], ptr %ten, i64 0, i64 %indvars.iv %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %8 = load i32, ptr %n, align 4, !tbaa !5 %9 = sext i32 %8 to i64 %cmp1 = icmp slt i64 %indvars.iv.next, %9 br i1 %cmp1, label %for.body, label %for.cond3.preheader, !llvm.loop !13 for.body5: ; preds = %for.body5.preheader82, %for.body5 %indvars.iv59 = phi i64 [ %indvars.iv.next60, %for.body5 ], [ %indvars.iv59.ph, %for.body5.preheader82 ] %sum.047 = phi i32 [ %add, %for.body5 ], [ %sum.047.ph, %for.body5.preheader82 ] %arrayidx7 = getelementptr inbounds [1001 x i32], ptr %ten, i64 0, i64 %indvars.iv59 %10 = load i32, ptr %arrayidx7, align 4, !tbaa !5 %add = add nsw i32 %10, %sum.047 %indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1 %exitcond.not = icmp eq i64 %indvars.iv.next60, %wide.trip.count br i1 %exitcond.not, label %for.end10, label %for.body5, !llvm.loop !14 for.end10.thread: ; preds = %for.cond3.preheader, %for.cond.preheader %.lcssa69.ph = phi i32 [ %8, %for.cond3.preheader ], [ %1, %for.cond.preheader ] %conv1175 = sitofp i32 %.lcssa69.ph to double br label %for.end26 for.end10: ; preds = %for.body5, %middle.block %add.lcssa = phi i32 [ %7, %middle.block ], [ %add, %for.body5 ] %conv = sitofp i32 %add.lcssa to double %conv11 = sitofp i32 %8 to double %div = fdiv double %conv, %conv11 br i1 %cmp446, label %for.body15.preheader, label %for.end26 for.body15.preheader: ; preds = %for.end10 %xtraiter = and i64 %wide.trip.count, 3 %11 = icmp ult i32 %8, 4 br i1 %11, label %for.end26.loopexit.unr-lcssa, label %for.body15.preheader.new for.body15.preheader.new: ; preds = %for.body15.preheader %unroll_iter = and i64 %wide.trip.count, 4294967292 br label %for.body15 for.body15: ; preds = %for.body15, %for.body15.preheader.new %indvars.iv62 = phi i64 [ 0, %for.body15.preheader.new ], [ %indvars.iv.next63.3, %for.body15 ] %s.051 = phi double [ 0.000000e+00, %for.body15.preheader.new ], [ %19, %for.body15 ] %niter = phi i64 [ 0, %for.body15.preheader.new ], [ %niter.next.3, %for.body15 ] %arrayidx17 = getelementptr inbounds [1001 x i32], ptr %ten, i64 0, i64 %indvars.iv62 %12 = load i32, ptr %arrayidx17, align 16, !tbaa !5 %conv18 = sitofp i32 %12 to double %sub = fsub double %conv18, %div %13 = call double @llvm.fmuladd.f64(double %sub, double %sub, double %s.051) %indvars.iv.next63 = or i64 %indvars.iv62, 1 %arrayidx17.1 = getelementptr inbounds [1001 x i32], ptr %ten, i64 0, i64 %indvars.iv.next63 %14 = load i32, ptr %arrayidx17.1, align 4, !tbaa !5 %conv18.1 = sitofp i32 %14 to double %sub.1 = fsub double %conv18.1, %div %15 = call double @llvm.fmuladd.f64(double %sub.1, double %sub.1, double %13) %indvars.iv.next63.1 = or i64 %indvars.iv62, 2 %arrayidx17.2 = getelementptr inbounds [1001 x i32], ptr %ten, i64 0, i64 %indvars.iv.next63.1 %16 = load i32, ptr %arrayidx17.2, align 8, !tbaa !5 %conv18.2 = sitofp i32 %16 to double %sub.2 = fsub double %conv18.2, %div %17 = call double @llvm.fmuladd.f64(double %sub.2, double %sub.2, double %15) %indvars.iv.next63.2 = or i64 %indvars.iv62, 3 %arrayidx17.3 = getelementptr inbounds [1001 x i32], ptr %ten, i64 0, i64 %indvars.iv.next63.2 %18 = load i32, ptr %arrayidx17.3, align 4, !tbaa !5 %conv18.3 = sitofp i32 %18 to double %sub.3 = fsub double %conv18.3, %div %19 = call double @llvm.fmuladd.f64(double %sub.3, double %sub.3, double %17) %indvars.iv.next63.3 = add nuw nsw i64 %indvars.iv62, 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.end26.loopexit.unr-lcssa, label %for.body15, !llvm.loop !15 for.end26.loopexit.unr-lcssa: ; preds = %for.body15, %for.body15.preheader %.lcssa86.ph = phi double [ undef, %for.body15.preheader ], [ %19, %for.body15 ] %indvars.iv62.unr = phi i64 [ 0, %for.body15.preheader ], [ %indvars.iv.next63.3, %for.body15 ] %s.051.unr = phi double [ 0.000000e+00, %for.body15.preheader ], [ %19, %for.body15 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end26, label %for.body15.epil for.body15.epil: ; preds = %for.end26.loopexit.unr-lcssa, %for.body15.epil %indvars.iv62.epil = phi i64 [ %indvars.iv.next63.epil, %for.body15.epil ], [ %indvars.iv62.unr, %for.end26.loopexit.unr-lcssa ] %s.051.epil = phi double [ %21, %for.body15.epil ], [ %s.051.unr, %for.end26.loopexit.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body15.epil ], [ 0, %for.end26.loopexit.unr-lcssa ] %arrayidx17.epil = getelementptr inbounds [1001 x i32], ptr %ten, i64 0, i64 %indvars.iv62.epil %20 = load i32, ptr %arrayidx17.epil, align 4, !tbaa !5 %conv18.epil = sitofp i32 %20 to double %sub.epil = fsub double %conv18.epil, %div %21 = call double @llvm.fmuladd.f64(double %sub.epil, double %sub.epil, double %s.051.epil) %indvars.iv.next63.epil = add nuw nsw i64 %indvars.iv62.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.end26, label %for.body15.epil, !llvm.loop !16 for.end26: ; preds = %for.end26.loopexit.unr-lcssa, %for.body15.epil, %for.end10.thread, %for.end10 %conv1177 = phi double [ %conv11, %for.end10 ], [ %conv1175, %for.end10.thread ], [ %conv11, %for.body15.epil ], [ %conv11, %for.end26.loopexit.unr-lcssa ] %s.0.lcssa = phi double [ 0.000000e+00, %for.end10 ], [ 0.000000e+00, %for.end10.thread ], [ %.lcssa86.ph, %for.end26.loopexit.unr-lcssa ], [ %21, %for.body15.epil ] %div28 = fdiv double %s.0.lcssa, %conv1177 %call29 = call double @sqrt(double noundef %div28) #6 %call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %call29) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %22 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp eq i32 %22, 0 br i1 %cmp, label %while.end, label %for.cond.preheader while.end: ; preds = %for.end26, %entry call void @llvm.lifetime.end.p0(i64 4004, ptr nonnull %ten) #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 nofree nounwind willreturn memory(write) declare double @sqrt(double noundef) local_unnamed_addr #4 ; 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.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 = { 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 nounwind willreturn memory(write) "no-trapping-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 = 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} !16 = distinct !{!16, !17} !17 = !{!"llvm.loop.unroll.disable"}
#include <stdio.h> #include <math.h> int main(void) { int s[1000], n, i, sum; double m, d, a, t; for (;;) { scanf("%d", &n); if (n == 0) break; sum = 0; for (i = 0; i < n; i++) { scanf("%d", &s[i]); sum += s[i]; } m = (double) sum / (double) n; a = 0.0; for (i = 0; i < n; i++) { t = s[i] - m; a += t * t; } printf("%lf\n", sqrt(a / n)); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_174986/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_174986/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"%lf\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %s = alloca [1000 x i32], align 16 %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %s) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 %call40 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp41 = icmp eq i32 %0, 0 br i1 %cmp41, label %for.end21, label %for.cond1.preheader for.cond1.preheader: ; preds = %entry, %for.end16 %1 = phi i32 [ %16, %for.end16 ], [ %0, %entry ] %cmp232 = icmp sgt i32 %1, 0 br i1 %cmp232, label %for.body, label %for.end.thread for.end.thread: ; preds = %for.cond1.preheader %conv651 = sitofp i32 %1 to double br label %for.end16 for.body: ; preds = %for.cond1.preheader, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond1.preheader ] %sum.033 = phi i32 [ %add, %for.body ], [ 0, %for.cond1.preheader ] %arrayidx = getelementptr inbounds [1000 x i32], ptr %s, i64 0, i64 %indvars.iv %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %2 = load i32, ptr %arrayidx, align 4, !tbaa !5 %add = add nsw i32 %2, %sum.033 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %3 = load i32, ptr %n, align 4, !tbaa !5 %4 = sext i32 %3 to i64 %cmp2 = icmp slt i64 %indvars.iv.next, %4 br i1 %cmp2, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body %conv = sitofp i32 %add to double %conv6 = sitofp i32 %3 to double %div = fdiv double %conv, %conv6 %cmp836 = icmp sgt i32 %3, 0 br i1 %cmp836, label %for.body10.preheader, label %for.end16 for.body10.preheader: ; preds = %for.end %wide.trip.count = zext i32 %3 to i64 %xtraiter = and i64 %wide.trip.count, 3 %5 = icmp ult i32 %3, 4 br i1 %5, label %for.end16.loopexit.unr-lcssa, label %for.body10.preheader.new for.body10.preheader.new: ; preds = %for.body10.preheader %unroll_iter = and i64 %wide.trip.count, 4294967292 br label %for.body10 for.body10: ; preds = %for.body10, %for.body10.preheader.new %indvars.iv45 = phi i64 [ 0, %for.body10.preheader.new ], [ %indvars.iv.next46.3, %for.body10 ] %a.037 = phi double [ 0.000000e+00, %for.body10.preheader.new ], [ %13, %for.body10 ] %niter = phi i64 [ 0, %for.body10.preheader.new ], [ %niter.next.3, %for.body10 ] %arrayidx12 = getelementptr inbounds [1000 x i32], ptr %s, i64 0, i64 %indvars.iv45 %6 = load i32, ptr %arrayidx12, align 16, !tbaa !5 %conv13 = sitofp i32 %6 to double %sub = fsub double %conv13, %div %7 = call double @llvm.fmuladd.f64(double %sub, double %sub, double %a.037) %indvars.iv.next46 = or i64 %indvars.iv45, 1 %arrayidx12.1 = getelementptr inbounds [1000 x i32], ptr %s, i64 0, i64 %indvars.iv.next46 %8 = load i32, ptr %arrayidx12.1, align 4, !tbaa !5 %conv13.1 = sitofp i32 %8 to double %sub.1 = fsub double %conv13.1, %div %9 = call double @llvm.fmuladd.f64(double %sub.1, double %sub.1, double %7) %indvars.iv.next46.1 = or i64 %indvars.iv45, 2 %arrayidx12.2 = getelementptr inbounds [1000 x i32], ptr %s, i64 0, i64 %indvars.iv.next46.1 %10 = load i32, ptr %arrayidx12.2, align 8, !tbaa !5 %conv13.2 = sitofp i32 %10 to double %sub.2 = fsub double %conv13.2, %div %11 = call double @llvm.fmuladd.f64(double %sub.2, double %sub.2, double %9) %indvars.iv.next46.2 = or i64 %indvars.iv45, 3 %arrayidx12.3 = getelementptr inbounds [1000 x i32], ptr %s, i64 0, i64 %indvars.iv.next46.2 %12 = load i32, ptr %arrayidx12.3, align 4, !tbaa !5 %conv13.3 = sitofp i32 %12 to double %sub.3 = fsub double %conv13.3, %div %13 = call double @llvm.fmuladd.f64(double %sub.3, double %sub.3, double %11) %indvars.iv.next46.3 = add nuw nsw i64 %indvars.iv45, 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.end16.loopexit.unr-lcssa, label %for.body10, !llvm.loop !11 for.end16.loopexit.unr-lcssa: ; preds = %for.body10, %for.body10.preheader %.lcssa57.ph = phi double [ undef, %for.body10.preheader ], [ %13, %for.body10 ] %indvars.iv45.unr = phi i64 [ 0, %for.body10.preheader ], [ %indvars.iv.next46.3, %for.body10 ] %a.037.unr = phi double [ 0.000000e+00, %for.body10.preheader ], [ %13, %for.body10 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end16, label %for.body10.epil for.body10.epil: ; preds = %for.end16.loopexit.unr-lcssa, %for.body10.epil %indvars.iv45.epil = phi i64 [ %indvars.iv.next46.epil, %for.body10.epil ], [ %indvars.iv45.unr, %for.end16.loopexit.unr-lcssa ] %a.037.epil = phi double [ %15, %for.body10.epil ], [ %a.037.unr, %for.end16.loopexit.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body10.epil ], [ 0, %for.end16.loopexit.unr-lcssa ] %arrayidx12.epil = getelementptr inbounds [1000 x i32], ptr %s, i64 0, i64 %indvars.iv45.epil %14 = load i32, ptr %arrayidx12.epil, align 4, !tbaa !5 %conv13.epil = sitofp i32 %14 to double %sub.epil = fsub double %conv13.epil, %div %15 = call double @llvm.fmuladd.f64(double %sub.epil, double %sub.epil, double %a.037.epil) %indvars.iv.next46.epil = add nuw nsw i64 %indvars.iv45.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.end16, label %for.body10.epil, !llvm.loop !12 for.end16: ; preds = %for.end16.loopexit.unr-lcssa, %for.body10.epil, %for.end.thread, %for.end %conv654 = phi double [ %conv6, %for.end ], [ %conv651, %for.end.thread ], [ %conv6, %for.body10.epil ], [ %conv6, %for.end16.loopexit.unr-lcssa ] %a.0.lcssa = phi double [ 0.000000e+00, %for.end ], [ 0.000000e+00, %for.end.thread ], [ %.lcssa57.ph, %for.end16.loopexit.unr-lcssa ], [ %15, %for.body10.epil ] %div18 = fdiv double %a.0.lcssa, %conv654 %call19 = call double @sqrt(double noundef %div18) #5 %call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %call19) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %16 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp eq i32 %16, 0 br i1 %cmp, label %for.end21, label %for.cond1.preheader for.end21: ; preds = %for.end16, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.end.p0(i64 4000, 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 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 nofree nounwind willreturn memory(write) declare double @sqrt(double noundef) 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 = { 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 nounwind willreturn memory(write) "no-trapping-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, !13} !13 = !{!"llvm.loop.unroll.disable"}
#include<math.h> #include<stdio.h> int main(void) { int n = 1, i,score[1000]; double sum = 0; double ave, dev=0;//devは「deviation:偏差」aveは「average」の省略 while (n != 0) { scanf(" %d", &n); if (n != 0) { for (i = 0; i < n; i++) { scanf("%d", &score[i]); sum += score[i]; } ave = sum / n; for (i = 0; i < n; i++) { dev += (score[i] - ave)*(score[i] - ave); } printf("%f\n", sqrt(dev/n)); } dev = 0; sum = 0; } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_175035/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_175035/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\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"%f\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %score = alloca [1000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 store i32 1, ptr %n, align 4, !tbaa !5 call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %score) #5 br label %while.body while.body: ; preds = %entry, %if.end %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp1.not = icmp eq i32 %0, 0 br i1 %cmp1.not, label %while.end, label %for.cond.preheader for.cond.preheader: ; preds = %while.body %cmp236 = icmp sgt i32 %0, 0 br i1 %cmp236, label %for.body, label %for.end.thread for.end.thread: ; preds = %for.cond.preheader %conv653 = sitofp i32 %0 to double br label %if.end for.body: ; preds = %for.cond.preheader, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ] %sum.137 = phi double [ %add, %for.body ], [ 0.000000e+00, %for.cond.preheader ] %arrayidx = getelementptr inbounds [1000 x i32], ptr %score, i64 0, i64 %indvars.iv %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx) %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 %conv = sitofp i32 %1 to double %add = fadd double %sum.137, %conv %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 %cmp2 = icmp slt i64 %indvars.iv.next, %3 br i1 %cmp2, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body %conv6 = sitofp i32 %2 to double %div = fdiv double %add, %conv6 %cmp840 = icmp sgt i32 %2, 0 br i1 %cmp840, label %for.body10.preheader, label %if.end for.body10.preheader: ; preds = %for.end %wide.trip.count = zext i32 %2 to i64 %xtraiter = and i64 %wide.trip.count, 3 %4 = icmp ult i32 %2, 4 br i1 %4, label %if.end.loopexit.unr-lcssa, label %for.body10.preheader.new for.body10.preheader.new: ; preds = %for.body10.preheader %unroll_iter = and i64 %wide.trip.count, 4294967292 br label %for.body10 for.body10: ; preds = %for.body10, %for.body10.preheader.new %indvars.iv47 = phi i64 [ 0, %for.body10.preheader.new ], [ %indvars.iv.next48.3, %for.body10 ] %dev.142 = phi double [ 0.000000e+00, %for.body10.preheader.new ], [ %12, %for.body10 ] %niter = phi i64 [ 0, %for.body10.preheader.new ], [ %niter.next.3, %for.body10 ] %arrayidx12 = getelementptr inbounds [1000 x i32], ptr %score, i64 0, i64 %indvars.iv47 %5 = load i32, ptr %arrayidx12, align 16, !tbaa !5 %conv13 = sitofp i32 %5 to double %sub = fsub double %conv13, %div %6 = call double @llvm.fmuladd.f64(double %sub, double %sub, double %dev.142) %indvars.iv.next48 = or i64 %indvars.iv47, 1 %arrayidx12.1 = getelementptr inbounds [1000 x i32], ptr %score, i64 0, i64 %indvars.iv.next48 %7 = load i32, ptr %arrayidx12.1, align 4, !tbaa !5 %conv13.1 = sitofp i32 %7 to double %sub.1 = fsub double %conv13.1, %div %8 = call double @llvm.fmuladd.f64(double %sub.1, double %sub.1, double %6) %indvars.iv.next48.1 = or i64 %indvars.iv47, 2 %arrayidx12.2 = getelementptr inbounds [1000 x i32], ptr %score, i64 0, i64 %indvars.iv.next48.1 %9 = load i32, ptr %arrayidx12.2, align 8, !tbaa !5 %conv13.2 = sitofp i32 %9 to double %sub.2 = fsub double %conv13.2, %div %10 = call double @llvm.fmuladd.f64(double %sub.2, double %sub.2, double %8) %indvars.iv.next48.2 = or i64 %indvars.iv47, 3 %arrayidx12.3 = getelementptr inbounds [1000 x i32], ptr %score, i64 0, i64 %indvars.iv.next48.2 %11 = load i32, ptr %arrayidx12.3, align 4, !tbaa !5 %conv13.3 = sitofp i32 %11 to double %sub.3 = fsub double %conv13.3, %div %12 = call double @llvm.fmuladd.f64(double %sub.3, double %sub.3, double %10) %indvars.iv.next48.3 = add nuw nsw i64 %indvars.iv47, 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 %if.end.loopexit.unr-lcssa, label %for.body10, !llvm.loop !11 if.end.loopexit.unr-lcssa: ; preds = %for.body10, %for.body10.preheader %.lcssa61.ph = phi double [ undef, %for.body10.preheader ], [ %12, %for.body10 ] %indvars.iv47.unr = phi i64 [ 0, %for.body10.preheader ], [ %indvars.iv.next48.3, %for.body10 ] %dev.142.unr = phi double [ 0.000000e+00, %for.body10.preheader ], [ %12, %for.body10 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %if.end, label %for.body10.epil for.body10.epil: ; preds = %if.end.loopexit.unr-lcssa, %for.body10.epil %indvars.iv47.epil = phi i64 [ %indvars.iv.next48.epil, %for.body10.epil ], [ %indvars.iv47.unr, %if.end.loopexit.unr-lcssa ] %dev.142.epil = phi double [ %14, %for.body10.epil ], [ %dev.142.unr, %if.end.loopexit.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body10.epil ], [ 0, %if.end.loopexit.unr-lcssa ] %arrayidx12.epil = getelementptr inbounds [1000 x i32], ptr %score, i64 0, i64 %indvars.iv47.epil %13 = load i32, ptr %arrayidx12.epil, align 4, !tbaa !5 %conv13.epil = sitofp i32 %13 to double %sub.epil = fsub double %conv13.epil, %div %14 = call double @llvm.fmuladd.f64(double %sub.epil, double %sub.epil, double %dev.142.epil) %indvars.iv.next48.epil = add nuw nsw i64 %indvars.iv47.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 %if.end, label %for.body10.epil, !llvm.loop !12 if.end: ; preds = %if.end.loopexit.unr-lcssa, %for.body10.epil, %for.end, %for.end.thread %conv656 = phi double [ %conv6, %for.end ], [ %conv653, %for.end.thread ], [ %conv6, %for.body10.epil ], [ %conv6, %if.end.loopexit.unr-lcssa ] %dev.1.lcssa = phi double [ 0.000000e+00, %for.end ], [ 0.000000e+00, %for.end.thread ], [ %.lcssa61.ph, %if.end.loopexit.unr-lcssa ], [ %14, %for.body10.epil ] %div22 = fdiv double %dev.1.lcssa, %conv656 %call23 = call double @sqrt(double noundef %div22) #5 %call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %call23) %.pr.pre = load i32, ptr %n, align 4, !tbaa !5 %cmp.not = icmp eq i32 %.pr.pre, 0 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !14 while.end: ; preds = %while.body, %if.end call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %score) #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 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 nofree nounwind willreturn memory(write) declare double @sqrt(double noundef) 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 = { 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 nounwind willreturn memory(write) "no-trapping-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, !13} !13 = !{!"llvm.loop.unroll.disable"} !14 = distinct !{!14, !10}
#include <stdio.h> #include <math.h> int main(){ int n, i; int s[1000]; double m, sum, siguma; while(1) { scanf("%d", &n); if(n == 0){ break; }else { m = 0; sum = 0; for(i=0; i<n; i++) { scanf("%d", &s[i]); m+=s[i]; } m=(double)m/n; for(i=0; i<n; i++) sum+=pow(s[i]-m, 2); sum/=n; siguma=sqrt(sum); printf("%f\n", siguma); } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_175079/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_175079/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"%f\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 [1000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %s) #4 %call41 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp42 = icmp eq i32 %0, 0 br i1 %cmp42, label %while.end, label %for.cond.preheader for.cond.preheader: ; preds = %entry, %for.end17 %1 = phi i32 [ %11, %for.end17 ], [ %0, %entry ] %cmp133 = icmp sgt i32 %1, 0 br i1 %cmp133, label %for.body, label %for.end.thread for.end.thread: ; preds = %for.cond.preheader %conv550 = sitofp i32 %1 to double br label %for.end17 for.body: ; preds = %for.cond.preheader, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ] %m.034 = phi double [ %add, %for.body ], [ 0.000000e+00, %for.cond.preheader ] %arrayidx = getelementptr inbounds [1000 x i32], ptr %s, i64 0, i64 %indvars.iv %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %2 = load i32, ptr %arrayidx, align 4, !tbaa !5 %conv = sitofp i32 %2 to double %add = fadd double %m.034, %conv %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %3 = load i32, ptr %n, align 4, !tbaa !5 %4 = sext i32 %3 to i64 %cmp1 = icmp slt i64 %indvars.iv.next, %4 br i1 %cmp1, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body %conv5 = sitofp i32 %3 to double %div = fdiv double %add, %conv5 %cmp737 = icmp sgt i32 %3, 0 br i1 %cmp737, label %for.body9.preheader, label %for.end17 for.body9.preheader: ; preds = %for.end %wide.trip.count = zext i32 %3 to i64 %xtraiter = and i64 %wide.trip.count, 3 %5 = icmp ult i32 %3, 4 br i1 %5, label %for.end17.loopexit.unr-lcssa, label %for.body9.preheader.new for.body9.preheader.new: ; preds = %for.body9.preheader %unroll_iter = and i64 %wide.trip.count, 4294967292 br label %for.body9 for.body9: ; preds = %for.body9, %for.body9.preheader.new %indvars.iv45 = phi i64 [ 0, %for.body9.preheader.new ], [ %indvars.iv.next46.3, %for.body9 ] %sum.038 = phi double [ 0.000000e+00, %for.body9.preheader.new ], [ %add14.3, %for.body9 ] %niter = phi i64 [ 0, %for.body9.preheader.new ], [ %niter.next.3, %for.body9 ] %arrayidx11 = getelementptr inbounds [1000 x i32], ptr %s, i64 0, i64 %indvars.iv45 %6 = load i32, ptr %arrayidx11, align 16, !tbaa !5 %conv12 = sitofp i32 %6 to double %sub = fsub double %conv12, %div %square = fmul double %sub, %sub %add14 = fadd double %sum.038, %square %indvars.iv.next46 = or i64 %indvars.iv45, 1 %arrayidx11.1 = getelementptr inbounds [1000 x i32], ptr %s, i64 0, i64 %indvars.iv.next46 %7 = load i32, ptr %arrayidx11.1, align 4, !tbaa !5 %conv12.1 = sitofp i32 %7 to double %sub.1 = fsub double %conv12.1, %div %square.1 = fmul double %sub.1, %sub.1 %add14.1 = fadd double %add14, %square.1 %indvars.iv.next46.1 = or i64 %indvars.iv45, 2 %arrayidx11.2 = getelementptr inbounds [1000 x i32], ptr %s, i64 0, i64 %indvars.iv.next46.1 %8 = load i32, ptr %arrayidx11.2, align 8, !tbaa !5 %conv12.2 = sitofp i32 %8 to double %sub.2 = fsub double %conv12.2, %div %square.2 = fmul double %sub.2, %sub.2 %add14.2 = fadd double %add14.1, %square.2 %indvars.iv.next46.2 = or i64 %indvars.iv45, 3 %arrayidx11.3 = getelementptr inbounds [1000 x i32], ptr %s, i64 0, i64 %indvars.iv.next46.2 %9 = load i32, ptr %arrayidx11.3, align 4, !tbaa !5 %conv12.3 = sitofp i32 %9 to double %sub.3 = fsub double %conv12.3, %div %square.3 = fmul double %sub.3, %sub.3 %add14.3 = fadd double %add14.2, %square.3 %indvars.iv.next46.3 = add nuw nsw i64 %indvars.iv45, 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.end17.loopexit.unr-lcssa, label %for.body9, !llvm.loop !11 for.end17.loopexit.unr-lcssa: ; preds = %for.body9, %for.body9.preheader %add14.lcssa.ph = phi double [ undef, %for.body9.preheader ], [ %add14.3, %for.body9 ] %indvars.iv45.unr = phi i64 [ 0, %for.body9.preheader ], [ %indvars.iv.next46.3, %for.body9 ] %sum.038.unr = phi double [ 0.000000e+00, %for.body9.preheader ], [ %add14.3, %for.body9 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end17, label %for.body9.epil for.body9.epil: ; preds = %for.end17.loopexit.unr-lcssa, %for.body9.epil %indvars.iv45.epil = phi i64 [ %indvars.iv.next46.epil, %for.body9.epil ], [ %indvars.iv45.unr, %for.end17.loopexit.unr-lcssa ] %sum.038.epil = phi double [ %add14.epil, %for.body9.epil ], [ %sum.038.unr, %for.end17.loopexit.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body9.epil ], [ 0, %for.end17.loopexit.unr-lcssa ] %arrayidx11.epil = getelementptr inbounds [1000 x i32], ptr %s, i64 0, i64 %indvars.iv45.epil %10 = load i32, ptr %arrayidx11.epil, align 4, !tbaa !5 %conv12.epil = sitofp i32 %10 to double %sub.epil = fsub double %conv12.epil, %div %square.epil = fmul double %sub.epil, %sub.epil %add14.epil = fadd double %sum.038.epil, %square.epil %indvars.iv.next46.epil = add nuw nsw i64 %indvars.iv45.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.end17, label %for.body9.epil, !llvm.loop !12 for.end17: ; preds = %for.end17.loopexit.unr-lcssa, %for.body9.epil, %for.end.thread, %for.end %conv553 = phi double [ %conv5, %for.end ], [ %conv550, %for.end.thread ], [ %conv5, %for.body9.epil ], [ %conv5, %for.end17.loopexit.unr-lcssa ] %sum.0.lcssa = phi double [ 0.000000e+00, %for.end ], [ 0.000000e+00, %for.end.thread ], [ %add14.lcssa.ph, %for.end17.loopexit.unr-lcssa ], [ %add14.epil, %for.body9.epil ] %div19 = fdiv double %sum.0.lcssa, %conv553 %call20 = call double @sqrt(double noundef %div19) #4 %call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %call20) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %11 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp eq i32 %11, 0 br i1 %cmp, label %while.end, label %for.cond.preheader while.end: ; preds = %for.end17, %entry call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %s) #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 memory(write) declare double @sqrt(double 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 memory(write) "no-trapping-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, !13} !13 = !{!"llvm.loop.unroll.disable"}
#include <stdio.h> #include <math.h> int main() { int n, a[1005]; while (1) { scanf("%d", &n); if (n == 0) break; double avg = 0; for (int i = 0; i < n; i++) { scanf("%d", &a[i]); avg += a[i]; } avg /= n; double tt = 0; for (int i = 0; i < n; i++) tt += (a[i] - avg) * (a[i] - avg); tt /= n; printf("%.4lf\n", sqrt(tt)); } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_175121/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_175121/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 [7 x i8] c"%.4lf\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 [1005 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 4020, ptr nonnull %a) #5 %call46 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp47 = icmp eq i32 %0, 0 br i1 %cmp47, label %while.end, label %for.cond.preheader for.cond.preheader: ; preds = %entry, %for.cond.cleanup10 %1 = phi i32 [ %8, %for.cond.cleanup10 ], [ %0, %entry ] %cmp138 = icmp sgt i32 %1, 0 br i1 %cmp138, label %for.body, label %for.cond.cleanup.thread for.cond.cleanup.thread: ; preds = %for.cond.preheader %conv556 = sitofp i32 %1 to double br label %for.cond.cleanup10 for.cond.cleanup: ; preds = %for.body %conv5 = sitofp i32 %4 to double %div = fdiv double %add, %conv5 %cmp842 = icmp sgt i32 %4, 0 br i1 %cmp842, label %for.body11.preheader, label %for.cond.cleanup10 for.body11.preheader: ; preds = %for.cond.cleanup %wide.trip.count = zext i32 %4 to i64 %xtraiter = and i64 %wide.trip.count, 3 %2 = icmp ult i32 %4, 4 br i1 %2, label %for.cond.cleanup10.loopexit.unr-lcssa, label %for.body11.preheader.new for.body11.preheader.new: ; preds = %for.body11.preheader %unroll_iter = and i64 %wide.trip.count, 4294967292 br label %for.body11 for.body: ; preds = %for.cond.preheader, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ] %avg.039 = phi double [ %add, %for.body ], [ 0.000000e+00, %for.cond.preheader ] %arrayidx = getelementptr inbounds [1005 x i32], ptr %a, i64 0, i64 %indvars.iv %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %3 = load i32, ptr %arrayidx, align 4, !tbaa !5 %conv = sitofp i32 %3 to double %add = fadd double %avg.039, %conv %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 %cmp1 = icmp slt i64 %indvars.iv.next, %5 br i1 %cmp1, label %for.body, label %for.cond.cleanup, !llvm.loop !9 for.cond.cleanup10.loopexit.unr-lcssa: ; preds = %for.body11, %for.body11.preheader %.lcssa62.ph = phi double [ undef, %for.body11.preheader ], [ %16, %for.body11 ] %indvars.iv51.unr = phi i64 [ 0, %for.body11.preheader ], [ %indvars.iv.next52.3, %for.body11 ] %tt.043.unr = phi double [ 0.000000e+00, %for.body11.preheader ], [ %16, %for.body11 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond.cleanup10, label %for.body11.epil for.body11.epil: ; preds = %for.cond.cleanup10.loopexit.unr-lcssa, %for.body11.epil %indvars.iv51.epil = phi i64 [ %indvars.iv.next52.epil, %for.body11.epil ], [ %indvars.iv51.unr, %for.cond.cleanup10.loopexit.unr-lcssa ] %tt.043.epil = phi double [ %7, %for.body11.epil ], [ %tt.043.unr, %for.cond.cleanup10.loopexit.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body11.epil ], [ 0, %for.cond.cleanup10.loopexit.unr-lcssa ] %arrayidx13.epil = getelementptr inbounds [1005 x i32], ptr %a, i64 0, i64 %indvars.iv51.epil %6 = load i32, ptr %arrayidx13.epil, align 4, !tbaa !5 %conv14.epil = sitofp i32 %6 to double %sub.epil = fsub double %conv14.epil, %div %7 = call double @llvm.fmuladd.f64(double %sub.epil, double %sub.epil, double %tt.043.epil) %indvars.iv.next52.epil = add nuw nsw i64 %indvars.iv51.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.cleanup10, label %for.body11.epil, !llvm.loop !11 for.cond.cleanup10: ; preds = %for.cond.cleanup10.loopexit.unr-lcssa, %for.body11.epil, %for.cond.cleanup.thread, %for.cond.cleanup %conv559 = phi double [ %conv5, %for.cond.cleanup ], [ %conv556, %for.cond.cleanup.thread ], [ %conv5, %for.body11.epil ], [ %conv5, %for.cond.cleanup10.loopexit.unr-lcssa ] %tt.0.lcssa = phi double [ 0.000000e+00, %for.cond.cleanup ], [ 0.000000e+00, %for.cond.cleanup.thread ], [ %.lcssa62.ph, %for.cond.cleanup10.loopexit.unr-lcssa ], [ %7, %for.body11.epil ] %div23 = fdiv double %tt.0.lcssa, %conv559 %call24 = call double @sqrt(double noundef %div23) #5 %call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %call24) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %8 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp eq i32 %8, 0 br i1 %cmp, label %while.end, label %for.cond.preheader for.body11: ; preds = %for.body11, %for.body11.preheader.new %indvars.iv51 = phi i64 [ 0, %for.body11.preheader.new ], [ %indvars.iv.next52.3, %for.body11 ] %tt.043 = phi double [ 0.000000e+00, %for.body11.preheader.new ], [ %16, %for.body11 ] %niter = phi i64 [ 0, %for.body11.preheader.new ], [ %niter.next.3, %for.body11 ] %arrayidx13 = getelementptr inbounds [1005 x i32], ptr %a, i64 0, i64 %indvars.iv51 %9 = load i32, ptr %arrayidx13, align 16, !tbaa !5 %conv14 = sitofp i32 %9 to double %sub = fsub double %conv14, %div %10 = call double @llvm.fmuladd.f64(double %sub, double %sub, double %tt.043) %indvars.iv.next52 = or i64 %indvars.iv51, 1 %arrayidx13.1 = getelementptr inbounds [1005 x i32], ptr %a, i64 0, i64 %indvars.iv.next52 %11 = load i32, ptr %arrayidx13.1, align 4, !tbaa !5 %conv14.1 = sitofp i32 %11 to double %sub.1 = fsub double %conv14.1, %div %12 = call double @llvm.fmuladd.f64(double %sub.1, double %sub.1, double %10) %indvars.iv.next52.1 = or i64 %indvars.iv51, 2 %arrayidx13.2 = getelementptr inbounds [1005 x i32], ptr %a, i64 0, i64 %indvars.iv.next52.1 %13 = load i32, ptr %arrayidx13.2, align 8, !tbaa !5 %conv14.2 = sitofp i32 %13 to double %sub.2 = fsub double %conv14.2, %div %14 = call double @llvm.fmuladd.f64(double %sub.2, double %sub.2, double %12) %indvars.iv.next52.2 = or i64 %indvars.iv51, 3 %arrayidx13.3 = getelementptr inbounds [1005 x i32], ptr %a, i64 0, i64 %indvars.iv.next52.2 %15 = load i32, ptr %arrayidx13.3, align 4, !tbaa !5 %conv14.3 = sitofp i32 %15 to double %sub.3 = fsub double %conv14.3, %div %16 = call double @llvm.fmuladd.f64(double %sub.3, double %sub.3, double %14) %indvars.iv.next52.3 = add nuw nsw i64 %indvars.iv51, 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.cleanup10.loopexit.unr-lcssa, label %for.body11, !llvm.loop !13 while.end: ; preds = %for.cond.cleanup10, %entry call void @llvm.lifetime.end.p0(i64 4020, ptr nonnull %a) #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 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) #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nounwind willreturn memory(write) declare double @sqrt(double 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 speculatable willreturn memory(none) } attributes #4 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-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, !12} !12 = !{!"llvm.loop.unroll.disable"} !13 = distinct !{!13, !10}
// AOJ ITP1_10_C Standard Deviation // 2018.4.28 bal4u #include <stdio.h> #include <math.h> int s[1002]; #define gc() getchar_unlocked() int in() { int n = 0, c = gc(); do n = 10*n + (c & 0xf), c = gc(); while (c >= '0'); return n; } int main() { int n, i, is; double m, fs, a; while (n = in()) { is = 0; for (i = 0; i < n; i++) is += s[i] = in(); m = (double)is/n; fs = 0; for (i = 0; i < n; i++) { a = s[i]-m; fs += a*a; } printf("%.8lf\n", sqrt(fs/n)); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_175165/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_175165/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._IO_FILE = type { i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i64, i16, i8, [1 x i8], ptr, i64, ptr, ptr, ptr, ptr, i64, i32, [20 x i8] } @s = dso_local local_unnamed_addr global [1002 x i32] zeroinitializer, align 16 @.str = private unnamed_addr constant [7 x i8] c"%.8lf\0A\00", align 1 @stdin = external local_unnamed_addr global ptr, align 8 ; Function Attrs: nounwind uwtable define dso_local i32 @in() local_unnamed_addr #0 { entry: %0 = load ptr, ptr @stdin, align 8, !tbaa !5 %_IO_read_ptr.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 1 %1 = load ptr, ptr %_IO_read_ptr.i, align 8, !tbaa !9 %_IO_read_end.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 2 %2 = load ptr, ptr %_IO_read_end.i, align 8, !tbaa !14 %cmp.not.i = icmp ult ptr %1, %2 br i1 %cmp.not.i, label %cond.false.i, label %cond.true.i, !prof !15 cond.true.i: ; preds = %entry %call.i = tail call i32 @__uflow(ptr noundef nonnull %0) #5 %.pre14.pre = load ptr, ptr @stdin, align 8, !tbaa !5 br label %do.body.preheader cond.false.i: ; preds = %entry %incdec.ptr.i = getelementptr inbounds i8, ptr %1, i64 1 store ptr %incdec.ptr.i, ptr %_IO_read_ptr.i, align 8, !tbaa !9 %3 = load i8, ptr %1, align 1, !tbaa !16 %conv3.i = zext i8 %3 to i32 br label %do.body.preheader do.body.preheader: ; preds = %cond.true.i, %cond.false.i %.ph = phi ptr [ %0, %cond.false.i ], [ %.pre14.pre, %cond.true.i ] %c.0.ph = phi i32 [ %conv3.i, %cond.false.i ], [ %call.i, %cond.true.i ] br label %do.body do.body: ; preds = %do.body.preheader, %getchar_unlocked.exit13 %4 = phi ptr [ %8, %getchar_unlocked.exit13 ], [ %.ph, %do.body.preheader ] %n.0 = phi i32 [ %add, %getchar_unlocked.exit13 ], [ 0, %do.body.preheader ] %c.0 = phi i32 [ %cond.i9, %getchar_unlocked.exit13 ], [ %c.0.ph, %do.body.preheader ] %mul = mul nsw i32 %n.0, 10 %and = and i32 %c.0, 15 %add = add nsw i32 %and, %mul %_IO_read_ptr.i4 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 1 %5 = load ptr, ptr %_IO_read_ptr.i4, align 8, !tbaa !9 %_IO_read_end.i5 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 2 %6 = load ptr, ptr %_IO_read_end.i5, align 8, !tbaa !14 %cmp.not.i6 = icmp ult ptr %5, %6 br i1 %cmp.not.i6, label %cond.false.i10, label %cond.true.i7, !prof !15 cond.true.i7: ; preds = %do.body %call.i8 = tail call i32 @__uflow(ptr noundef nonnull %4) #5 %.pre = load ptr, ptr @stdin, align 8, !tbaa !5 br label %getchar_unlocked.exit13 cond.false.i10: ; preds = %do.body %incdec.ptr.i11 = getelementptr inbounds i8, ptr %5, i64 1 store ptr %incdec.ptr.i11, ptr %_IO_read_ptr.i4, align 8, !tbaa !9 %7 = load i8, ptr %5, align 1, !tbaa !16 %conv3.i12 = zext i8 %7 to i32 br label %getchar_unlocked.exit13 getchar_unlocked.exit13: ; preds = %cond.true.i7, %cond.false.i10 %8 = phi ptr [ %.pre, %cond.true.i7 ], [ %4, %cond.false.i10 ] %cond.i9 = phi i32 [ %call.i8, %cond.true.i7 ], [ %conv3.i12, %cond.false.i10 ] %cmp = icmp sgt i32 %cond.i9, 47 br i1 %cmp, label %do.body, label %do.end, !llvm.loop !17 do.end: ; preds = %getchar_unlocked.exit13 ret i32 %add } ; Function Attrs: nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: br label %while.cond while.cond: ; preds = %for.end12, %entry %0 = load ptr, ptr @stdin, align 8, !tbaa !5 %_IO_read_ptr.i.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 1 %1 = load ptr, ptr %_IO_read_ptr.i.i, align 8, !tbaa !9 %_IO_read_end.i.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 2 %2 = load ptr, ptr %_IO_read_end.i.i, align 8, !tbaa !14 %cmp.not.i.i = icmp ult ptr %1, %2 br i1 %cmp.not.i.i, label %cond.false.i.i, label %cond.true.i.i, !prof !15 cond.true.i.i: ; preds = %while.cond %call.i.i = tail call i32 @__uflow(ptr noundef nonnull %0) #5 %.pre14.pre.i = load ptr, ptr @stdin, align 8, !tbaa !5 br label %do.body.i.preheader cond.false.i.i: ; preds = %while.cond %incdec.ptr.i.i = getelementptr inbounds i8, ptr %1, i64 1 store ptr %incdec.ptr.i.i, ptr %_IO_read_ptr.i.i, align 8, !tbaa !9 %3 = load i8, ptr %1, align 1, !tbaa !16 %conv3.i.i = zext i8 %3 to i32 br label %do.body.i.preheader do.body.i.preheader: ; preds = %cond.false.i.i, %cond.true.i.i %.ph82 = phi ptr [ %0, %cond.false.i.i ], [ %.pre14.pre.i, %cond.true.i.i ] %c.0.i.ph = phi i32 [ %conv3.i.i, %cond.false.i.i ], [ %call.i.i, %cond.true.i.i ] br label %do.body.i do.body.i: ; preds = %do.body.i.preheader, %getchar_unlocked.exit13.i %4 = phi ptr [ %8, %getchar_unlocked.exit13.i ], [ %.ph82, %do.body.i.preheader ] %n.0.i = phi i32 [ %add.i, %getchar_unlocked.exit13.i ], [ 0, %do.body.i.preheader ] %c.0.i = phi i32 [ %cond.i9.i, %getchar_unlocked.exit13.i ], [ %c.0.i.ph, %do.body.i.preheader ] %mul.i = mul nsw i32 %n.0.i, 10 %and.i = and i32 %c.0.i, 15 %add.i = add nsw i32 %and.i, %mul.i %_IO_read_ptr.i4.i = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 1 %5 = load ptr, ptr %_IO_read_ptr.i4.i, align 8, !tbaa !9 %_IO_read_end.i5.i = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 2 %6 = load ptr, ptr %_IO_read_end.i5.i, align 8, !tbaa !14 %cmp.not.i6.i = icmp ult ptr %5, %6 br i1 %cmp.not.i6.i, label %cond.false.i10.i, label %cond.true.i7.i, !prof !15 cond.true.i7.i: ; preds = %do.body.i %call.i8.i = tail call i32 @__uflow(ptr noundef nonnull %4) #5 %.pre.i = load ptr, ptr @stdin, align 8, !tbaa !5 br label %getchar_unlocked.exit13.i cond.false.i10.i: ; preds = %do.body.i %incdec.ptr.i11.i = getelementptr inbounds i8, ptr %5, i64 1 store ptr %incdec.ptr.i11.i, ptr %_IO_read_ptr.i4.i, align 8, !tbaa !9 %7 = load i8, ptr %5, align 1, !tbaa !16 %conv3.i12.i = zext i8 %7 to i32 br label %getchar_unlocked.exit13.i getchar_unlocked.exit13.i: ; preds = %cond.false.i10.i, %cond.true.i7.i %8 = phi ptr [ %.pre.i, %cond.true.i7.i ], [ %4, %cond.false.i10.i ] %cond.i9.i = phi i32 [ %call.i8.i, %cond.true.i7.i ], [ %conv3.i12.i, %cond.false.i10.i ] %cmp.i = icmp sgt i32 %cond.i9.i, 47 br i1 %cmp.i, label %do.body.i, label %in.exit, !llvm.loop !17 in.exit: ; preds = %getchar_unlocked.exit13.i %tobool.not = icmp eq i32 %add.i, 0 br i1 %tobool.not, label %while.end, label %for.cond.preheader for.cond.preheader: ; preds = %in.exit %cmp59 = icmp sgt i32 %add.i, 0 br i1 %cmp59, label %for.body.preheader, label %for.end.thread for.end.thread: ; preds = %for.cond.preheader %conv274 = sitofp i32 %add.i to double br label %for.end12 for.body.preheader: ; preds = %for.cond.preheader %wide.trip.count = zext i32 %add.i to i64 br label %for.body for.body: ; preds = %for.body.preheader, %in.exit58 %9 = phi ptr [ %8, %for.body.preheader ], [ %18, %in.exit58 ] %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %in.exit58 ] %is.060 = phi i32 [ 0, %for.body.preheader ], [ %add, %in.exit58 ] %_IO_read_ptr.i.i28 = getelementptr inbounds %struct._IO_FILE, ptr %9, i64 0, i32 1 %10 = load ptr, ptr %_IO_read_ptr.i.i28, align 8, !tbaa !9 %_IO_read_end.i.i29 = getelementptr inbounds %struct._IO_FILE, ptr %9, i64 0, i32 2 %11 = load ptr, ptr %_IO_read_end.i.i29, align 8, !tbaa !14 %cmp.not.i.i30 = icmp ult ptr %10, %11 br i1 %cmp.not.i.i30, label %cond.false.i.i55, label %cond.true.i.i31, !prof !15 cond.true.i.i31: ; preds = %for.body %call.i.i32 = tail call i32 @__uflow(ptr noundef nonnull %9) #5 %.pre14.pre.i33 = load ptr, ptr @stdin, align 8, !tbaa !5 br label %do.body.i37.preheader cond.false.i.i55: ; preds = %for.body %incdec.ptr.i.i56 = getelementptr inbounds i8, ptr %10, i64 1 store ptr %incdec.ptr.i.i56, ptr %_IO_read_ptr.i.i28, align 8, !tbaa !9 %12 = load i8, ptr %10, align 1, !tbaa !16 %conv3.i.i57 = zext i8 %12 to i32 br label %do.body.i37.preheader do.body.i37.preheader: ; preds = %cond.false.i.i55, %cond.true.i.i31 %.ph81 = phi ptr [ %9, %cond.false.i.i55 ], [ %.pre14.pre.i33, %cond.true.i.i31 ] %c.0.i39.ph = phi i32 [ %conv3.i.i57, %cond.false.i.i55 ], [ %call.i.i32, %cond.true.i.i31 ] br label %do.body.i37 do.body.i37: ; preds = %do.body.i37.preheader, %getchar_unlocked.exit13.i49 %13 = phi ptr [ %18, %getchar_unlocked.exit13.i49 ], [ %.ph81, %do.body.i37.preheader ] %14 = phi ptr [ %19, %getchar_unlocked.exit13.i49 ], [ %.ph81, %do.body.i37.preheader ] %n.0.i38 = phi i32 [ %add.i42, %getchar_unlocked.exit13.i49 ], [ 0, %do.body.i37.preheader ] %c.0.i39 = phi i32 [ %cond.i9.i50, %getchar_unlocked.exit13.i49 ], [ %c.0.i39.ph, %do.body.i37.preheader ] %mul.i40 = mul nsw i32 %n.0.i38, 10 %and.i41 = and i32 %c.0.i39, 15 %add.i42 = add nsw i32 %and.i41, %mul.i40 %_IO_read_ptr.i4.i43 = getelementptr inbounds %struct._IO_FILE, ptr %14, i64 0, i32 1 %15 = load ptr, ptr %_IO_read_ptr.i4.i43, align 8, !tbaa !9 %_IO_read_end.i5.i44 = getelementptr inbounds %struct._IO_FILE, ptr %14, i64 0, i32 2 %16 = load ptr, ptr %_IO_read_end.i5.i44, align 8, !tbaa !14 %cmp.not.i6.i45 = icmp ult ptr %15, %16 br i1 %cmp.not.i6.i45, label %cond.false.i10.i52, label %cond.true.i7.i46, !prof !15 cond.true.i7.i46: ; preds = %do.body.i37 %call.i8.i47 = tail call i32 @__uflow(ptr noundef nonnull %14) #5 %.pre.i48 = load ptr, ptr @stdin, align 8, !tbaa !5 br label %getchar_unlocked.exit13.i49 cond.false.i10.i52: ; preds = %do.body.i37 %incdec.ptr.i11.i53 = getelementptr inbounds i8, ptr %15, i64 1 store ptr %incdec.ptr.i11.i53, ptr %_IO_read_ptr.i4.i43, align 8, !tbaa !9 %17 = load i8, ptr %15, align 1, !tbaa !16 %conv3.i12.i54 = zext i8 %17 to i32 br label %getchar_unlocked.exit13.i49 getchar_unlocked.exit13.i49: ; preds = %cond.false.i10.i52, %cond.true.i7.i46 %18 = phi ptr [ %.pre.i48, %cond.true.i7.i46 ], [ %13, %cond.false.i10.i52 ] %19 = phi ptr [ %.pre.i48, %cond.true.i7.i46 ], [ %14, %cond.false.i10.i52 ] %cond.i9.i50 = phi i32 [ %call.i8.i47, %cond.true.i7.i46 ], [ %conv3.i12.i54, %cond.false.i10.i52 ] %cmp.i51 = icmp sgt i32 %cond.i9.i50, 47 br i1 %cmp.i51, label %do.body.i37, label %in.exit58, !llvm.loop !17 in.exit58: ; preds = %getchar_unlocked.exit13.i49 %arrayidx = getelementptr inbounds [1002 x i32], ptr @s, i64 0, i64 %indvars.iv store i32 %add.i42, ptr %arrayidx, align 4, !tbaa !19 %add = add nsw i32 %add.i42, %is.060 %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 !20 for.end: ; preds = %in.exit58 %conv = sitofp i32 %add to double %conv2 = sitofp i32 %add.i to double %div = fdiv double %conv, %conv2 br i1 %cmp59, label %for.body6.preheader, label %for.end12 for.body6.preheader: ; preds = %for.end %xtraiter = and i64 %wide.trip.count, 1 %20 = icmp eq i32 %add.i, 1 br i1 %20, label %for.end12.loopexit.unr-lcssa, label %for.body6.preheader.new for.body6.preheader.new: ; preds = %for.body6.preheader %unroll_iter = and i64 %wide.trip.count, 4294967294 br label %for.body6 for.body6: ; preds = %for.body6, %for.body6.preheader.new %indvars.iv67 = phi i64 [ 0, %for.body6.preheader.new ], [ %indvars.iv.next68.1, %for.body6 ] %fs.063 = phi double [ 0.000000e+00, %for.body6.preheader.new ], [ %24, %for.body6 ] %niter = phi i64 [ 0, %for.body6.preheader.new ], [ %niter.next.1, %for.body6 ] %arrayidx8 = getelementptr inbounds [1002 x i32], ptr @s, i64 0, i64 %indvars.iv67 %21 = load i32, ptr %arrayidx8, align 8, !tbaa !19 %conv9 = sitofp i32 %21 to double %sub = fsub double %conv9, %div %22 = tail call double @llvm.fmuladd.f64(double %sub, double %sub, double %fs.063) %indvars.iv.next68 = or i64 %indvars.iv67, 1 %arrayidx8.1 = getelementptr inbounds [1002 x i32], ptr @s, i64 0, i64 %indvars.iv.next68 %23 = load i32, ptr %arrayidx8.1, align 4, !tbaa !19 %conv9.1 = sitofp i32 %23 to double %sub.1 = fsub double %conv9.1, %div %24 = tail call double @llvm.fmuladd.f64(double %sub.1, double %sub.1, double %22) %indvars.iv.next68.1 = add nuw nsw i64 %indvars.iv67, 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.end12.loopexit.unr-lcssa, label %for.body6, !llvm.loop !21 for.end12.loopexit.unr-lcssa: ; preds = %for.body6, %for.body6.preheader %.lcssa84.ph = phi double [ undef, %for.body6.preheader ], [ %24, %for.body6 ] %indvars.iv67.unr = phi i64 [ 0, %for.body6.preheader ], [ %indvars.iv.next68.1, %for.body6 ] %fs.063.unr = phi double [ 0.000000e+00, %for.body6.preheader ], [ %24, %for.body6 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end12, label %for.body6.epil for.body6.epil: ; preds = %for.end12.loopexit.unr-lcssa %arrayidx8.epil = getelementptr inbounds [1002 x i32], ptr @s, i64 0, i64 %indvars.iv67.unr %25 = load i32, ptr %arrayidx8.epil, align 4, !tbaa !19 %conv9.epil = sitofp i32 %25 to double %sub.epil = fsub double %conv9.epil, %div %26 = tail call double @llvm.fmuladd.f64(double %sub.epil, double %sub.epil, double %fs.063.unr) br label %for.end12 for.end12: ; preds = %for.body6.epil, %for.end12.loopexit.unr-lcssa, %for.end.thread, %for.end %conv276 = phi double [ %conv2, %for.end ], [ %conv274, %for.end.thread ], [ %conv2, %for.end12.loopexit.unr-lcssa ], [ %conv2, %for.body6.epil ] %fs.0.lcssa = phi double [ 0.000000e+00, %for.end ], [ 0.000000e+00, %for.end.thread ], [ %.lcssa84.ph, %for.end12.loopexit.unr-lcssa ], [ %26, %for.body6.epil ] %div14 = fdiv double %fs.0.lcssa, %conv276 %call15 = tail call double @sqrt(double noundef %div14) #5 %call16 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, double noundef %call15) br label %while.cond, !llvm.loop !22 while.end: ; preds = %in.exit ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) declare double @llvm.fmuladd.f64(double, double, double) #1 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nounwind willreturn memory(write) declare double @sqrt(double noundef) local_unnamed_addr #3 declare i32 @__uflow(ptr noundef) local_unnamed_addr #4 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 speculatable willreturn memory(none) } 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(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #5 = { nounwind } !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, !6, i64 8} !10 = !{!"_IO_FILE", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !11, i64 112, !11, i64 116, !12, i64 120, !13, i64 128, !7, i64 130, !7, i64 131, !6, i64 136, !12, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !12, i64 184, !11, i64 192, !7, i64 196} !11 = !{!"int", !7, i64 0} !12 = !{!"long", !7, i64 0} !13 = !{!"short", !7, i64 0} !14 = !{!10, !6, i64 16} !15 = !{!"branch_weights", i32 2000, i32 1} !16 = !{!7, !7, i64 0} !17 = distinct !{!17, !18} !18 = !{!"llvm.loop.mustprogress"} !19 = !{!11, !11, i64 0} !20 = distinct !{!20, !18} !21 = distinct !{!21, !18} !22 = distinct !{!22, !18}
#include<stdio.h> #include<stdlib.h> #include<math.h> int main(void){ int n; int *score; double ave, var, tmp; while(1){ scanf("%d", &n); if(n == 0) break; score = malloc(sizeof(int)*n); ave = 0; var = 0; for(int i=0;i<n;i++){ scanf("%d", (score+i)); ave += score[i]; } ave /= n; for(int i=0;i<n;i++){ tmp = score[i] - ave; var += tmp * tmp; } var /= n; var = sqrt(var); printf("%.8f\n", var); free(score); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_175215/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_175215/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"%.8f\0A\00", align 1 ; Function Attrs: 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) #7 %call48 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp49 = icmp eq i32 %0, 0 br i1 %cmp49, label %while.end, label %if.end if.end: ; preds = %entry, %for.cond.cleanup11 %1 = phi i32 [ %8, %for.cond.cleanup11 ], [ %0, %entry ] %conv = sext i32 %1 to i64 %mul = shl nsw i64 %conv, 2 %call1 = call noalias ptr @malloc(i64 noundef %mul) #8 %cmp240 = icmp sgt i32 %1, 0 br i1 %cmp240, label %for.body, label %for.cond.cleanup.thread for.cond.cleanup.thread: ; preds = %if.end %conv658 = sitofp i32 %1 to double br label %for.cond.cleanup11 for.cond.cleanup: ; preds = %for.body %conv6 = sitofp i32 %4 to double %div = fdiv double %add, %conv6 %cmp944 = icmp sgt i32 %4, 0 br i1 %cmp944, label %for.body12.preheader, label %for.cond.cleanup11 for.body12.preheader: ; preds = %for.cond.cleanup %wide.trip.count = zext i32 %4 to i64 %xtraiter = and i64 %wide.trip.count, 3 %2 = icmp ult i32 %4, 4 br i1 %2, label %for.cond.cleanup11.loopexit.unr-lcssa, label %for.body12.preheader.new for.body12.preheader.new: ; preds = %for.body12.preheader %unroll_iter = and i64 %wide.trip.count, 4294967292 br label %for.body12 for.body: ; preds = %if.end, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %if.end ] %ave.041 = phi double [ %add, %for.body ], [ 0.000000e+00, %if.end ] %add.ptr = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %add.ptr) %3 = load i32, ptr %add.ptr, align 4, !tbaa !5 %conv5 = sitofp i32 %3 to double %add = fadd double %ave.041, %conv5 %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 %cmp2 = icmp slt i64 %indvars.iv.next, %5 br i1 %cmp2, label %for.body, label %for.cond.cleanup, !llvm.loop !9 for.cond.cleanup11.loopexit.unr-lcssa: ; preds = %for.body12, %for.body12.preheader %.lcssa64.ph = phi double [ undef, %for.body12.preheader ], [ %16, %for.body12 ] %indvars.iv53.unr = phi i64 [ 0, %for.body12.preheader ], [ %indvars.iv.next54.3, %for.body12 ] %var.045.unr = phi double [ 0.000000e+00, %for.body12.preheader ], [ %16, %for.body12 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond.cleanup11, label %for.body12.epil for.body12.epil: ; preds = %for.cond.cleanup11.loopexit.unr-lcssa, %for.body12.epil %indvars.iv53.epil = phi i64 [ %indvars.iv.next54.epil, %for.body12.epil ], [ %indvars.iv53.unr, %for.cond.cleanup11.loopexit.unr-lcssa ] %var.045.epil = phi double [ %7, %for.body12.epil ], [ %var.045.unr, %for.cond.cleanup11.loopexit.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body12.epil ], [ 0, %for.cond.cleanup11.loopexit.unr-lcssa ] %arrayidx14.epil = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv53.epil %6 = load i32, ptr %arrayidx14.epil, align 4, !tbaa !5 %conv15.epil = sitofp i32 %6 to double %sub.epil = fsub double %conv15.epil, %div %7 = call double @llvm.fmuladd.f64(double %sub.epil, double %sub.epil, double %var.045.epil) %indvars.iv.next54.epil = add nuw nsw i64 %indvars.iv53.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.cleanup11, label %for.body12.epil, !llvm.loop !11 for.cond.cleanup11: ; preds = %for.cond.cleanup11.loopexit.unr-lcssa, %for.body12.epil, %for.cond.cleanup.thread, %for.cond.cleanup %conv661 = phi double [ %conv6, %for.cond.cleanup ], [ %conv658, %for.cond.cleanup.thread ], [ %conv6, %for.body12.epil ], [ %conv6, %for.cond.cleanup11.loopexit.unr-lcssa ] %var.0.lcssa = phi double [ 0.000000e+00, %for.cond.cleanup ], [ 0.000000e+00, %for.cond.cleanup.thread ], [ %.lcssa64.ph, %for.cond.cleanup11.loopexit.unr-lcssa ], [ %7, %for.body12.epil ] %div21 = fdiv double %var.0.lcssa, %conv661 %call22 = call double @sqrt(double noundef %div21) #7 %call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %call22) call void @free(ptr noundef %call1) #7 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %8 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp eq i32 %8, 0 br i1 %cmp, label %while.end, label %if.end for.body12: ; preds = %for.body12, %for.body12.preheader.new %indvars.iv53 = phi i64 [ 0, %for.body12.preheader.new ], [ %indvars.iv.next54.3, %for.body12 ] %var.045 = phi double [ 0.000000e+00, %for.body12.preheader.new ], [ %16, %for.body12 ] %niter = phi i64 [ 0, %for.body12.preheader.new ], [ %niter.next.3, %for.body12 ] %arrayidx14 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv53 %9 = load i32, ptr %arrayidx14, align 4, !tbaa !5 %conv15 = sitofp i32 %9 to double %sub = fsub double %conv15, %div %10 = call double @llvm.fmuladd.f64(double %sub, double %sub, double %var.045) %indvars.iv.next54 = or i64 %indvars.iv53, 1 %arrayidx14.1 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv.next54 %11 = load i32, ptr %arrayidx14.1, align 4, !tbaa !5 %conv15.1 = sitofp i32 %11 to double %sub.1 = fsub double %conv15.1, %div %12 = call double @llvm.fmuladd.f64(double %sub.1, double %sub.1, double %10) %indvars.iv.next54.1 = or i64 %indvars.iv53, 2 %arrayidx14.2 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv.next54.1 %13 = load i32, ptr %arrayidx14.2, align 4, !tbaa !5 %conv15.2 = sitofp i32 %13 to double %sub.2 = fsub double %conv15.2, %div %14 = call double @llvm.fmuladd.f64(double %sub.2, double %sub.2, double %12) %indvars.iv.next54.2 = or i64 %indvars.iv53, 3 %arrayidx14.3 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv.next54.2 %15 = load i32, ptr %arrayidx14.3, align 4, !tbaa !5 %conv15.3 = sitofp i32 %15 to double %sub.3 = fsub double %conv15.3, %div %16 = call double @llvm.fmuladd.f64(double %sub.3, double %sub.3, double %14) %indvars.iv.next54.3 = add nuw nsw i64 %indvars.iv53, 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.cleanup11.loopexit.unr-lcssa, label %for.body12, !llvm.loop !13 while.end: ; preds = %for.cond.cleanup11, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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: 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: mustprogress nofree nounwind willreturn memory(write) declare double @sqrt(double noundef) local_unnamed_addr #5 ; 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 #6 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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #5 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #6 = { mustprogress 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 #7 = { nounwind } attributes #8 = { 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, !12} !12 = !{!"llvm.loop.unroll.disable"} !13 = distinct !{!13, !10}
#include<stdio.h> #include<math.h> int main(void){ int n,i,j; double s[1005],S,m,sgm; while(1){ scanf("%d",&n); if(n==0){break;} S=0; for(i=0;i<n-1;i++){ scanf("%lf ",&s[i]); S=S+s[i]; } scanf("%lf",&s[n-1]); S=S+s[n-1]; m=S/(double) n; sgm=0; for(i=0;i<n;i++){ sgm=sgm+(s[i]-m)*(s[i]-m); } printf("%.6lf\n",sqrt(sgm/(double)n)); } return(0); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_175259/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_175259/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"%lf \00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%lf\00", align 1 @.str.3 = private unnamed_addr constant [7 x i8] c"%.6lf\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 [1005 x double], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 8040, ptr nonnull %s) #5 %call50 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp51 = icmp eq i32 %0, 0 br i1 %cmp51, label %while.end, label %for.cond.preheader for.cond.preheader: ; preds = %entry, %for.end25 %1 = phi i32 [ %18, %for.end25 ], [ %0, %entry ] %cmp142 = icmp sgt i32 %1, 1 br i1 %cmp142, label %for.body, label %for.cond.preheader.for.end_crit_edge for.cond.preheader.for.end_crit_edge: ; preds = %for.cond.preheader %sub41 = add nsw i32 %1, -1 %.pre = sext i32 %sub41 to i64 br label %for.end for.body: ; preds = %for.cond.preheader, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ] %S.043 = phi double [ %add, %for.body ], [ 0.000000e+00, %for.cond.preheader ] %arrayidx = getelementptr inbounds [1005 x double], ptr %s, i64 0, i64 %indvars.iv %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx) %2 = load double, ptr %arrayidx, align 8, !tbaa !9 %add = fadd double %S.043, %2 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %3 = load i32, ptr %n, align 4, !tbaa !5 %sub = add nsw i32 %3, -1 %4 = sext i32 %sub to i64 %cmp1 = icmp slt i64 %indvars.iv.next, %4 br i1 %cmp1, label %for.body, label %for.end, !llvm.loop !11 for.end: ; preds = %for.body, %for.cond.preheader.for.end_crit_edge %idxprom6.pre-phi = phi i64 [ %.pre, %for.cond.preheader.for.end_crit_edge ], [ %4, %for.body ] %S.0.lcssa = phi double [ 0.000000e+00, %for.cond.preheader.for.end_crit_edge ], [ %add, %for.body ] %arrayidx7 = getelementptr inbounds [1005 x double], ptr %s, i64 0, i64 %idxprom6.pre-phi %call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %arrayidx7) %5 = load i32, ptr %n, align 4, !tbaa !5 %sub9 = add nsw i32 %5, -1 %idxprom10 = sext i32 %sub9 to i64 %arrayidx11 = getelementptr inbounds [1005 x double], ptr %s, i64 0, i64 %idxprom10 %6 = load double, ptr %arrayidx11, align 8, !tbaa !9 %add12 = fadd double %S.0.lcssa, %6 %conv = sitofp i32 %5 to double %div = fdiv double %add12, %conv %cmp1446 = icmp sgt i32 %5, 0 br i1 %cmp1446, label %for.body16.preheader, label %for.end25 for.body16.preheader: ; preds = %for.end %wide.trip.count = zext i32 %5 to i64 %xtraiter = and i64 %wide.trip.count, 3 %7 = icmp ult i32 %5, 4 br i1 %7, label %for.end25.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.body16: ; preds = %for.body16, %for.body16.preheader.new %indvars.iv54 = phi i64 [ 0, %for.body16.preheader.new ], [ %indvars.iv.next55.3, %for.body16 ] %sgm.048 = phi double [ 0.000000e+00, %for.body16.preheader.new ], [ %15, %for.body16 ] %niter = phi i64 [ 0, %for.body16.preheader.new ], [ %niter.next.3, %for.body16 ] %arrayidx18 = getelementptr inbounds [1005 x double], ptr %s, i64 0, i64 %indvars.iv54 %8 = load double, ptr %arrayidx18, align 16, !tbaa !9 %sub19 = fsub double %8, %div %9 = call double @llvm.fmuladd.f64(double %sub19, double %sub19, double %sgm.048) %indvars.iv.next55 = or i64 %indvars.iv54, 1 %arrayidx18.1 = getelementptr inbounds [1005 x double], ptr %s, i64 0, i64 %indvars.iv.next55 %10 = load double, ptr %arrayidx18.1, align 8, !tbaa !9 %sub19.1 = fsub double %10, %div %11 = call double @llvm.fmuladd.f64(double %sub19.1, double %sub19.1, double %9) %indvars.iv.next55.1 = or i64 %indvars.iv54, 2 %arrayidx18.2 = getelementptr inbounds [1005 x double], ptr %s, i64 0, i64 %indvars.iv.next55.1 %12 = load double, ptr %arrayidx18.2, align 16, !tbaa !9 %sub19.2 = fsub double %12, %div %13 = call double @llvm.fmuladd.f64(double %sub19.2, double %sub19.2, double %11) %indvars.iv.next55.2 = or i64 %indvars.iv54, 3 %arrayidx18.3 = getelementptr inbounds [1005 x double], ptr %s, i64 0, i64 %indvars.iv.next55.2 %14 = load double, ptr %arrayidx18.3, align 8, !tbaa !9 %sub19.3 = fsub double %14, %div %15 = call double @llvm.fmuladd.f64(double %sub19.3, double %sub19.3, double %13) %indvars.iv.next55.3 = add nuw nsw i64 %indvars.iv54, 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.end25.loopexit.unr-lcssa, label %for.body16, !llvm.loop !13 for.end25.loopexit.unr-lcssa: ; preds = %for.body16, %for.body16.preheader %.lcssa59.ph = phi double [ undef, %for.body16.preheader ], [ %15, %for.body16 ] %indvars.iv54.unr = phi i64 [ 0, %for.body16.preheader ], [ %indvars.iv.next55.3, %for.body16 ] %sgm.048.unr = phi double [ 0.000000e+00, %for.body16.preheader ], [ %15, %for.body16 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end25, label %for.body16.epil for.body16.epil: ; preds = %for.end25.loopexit.unr-lcssa, %for.body16.epil %indvars.iv54.epil = phi i64 [ %indvars.iv.next55.epil, %for.body16.epil ], [ %indvars.iv54.unr, %for.end25.loopexit.unr-lcssa ] %sgm.048.epil = phi double [ %17, %for.body16.epil ], [ %sgm.048.unr, %for.end25.loopexit.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body16.epil ], [ 0, %for.end25.loopexit.unr-lcssa ] %arrayidx18.epil = getelementptr inbounds [1005 x double], ptr %s, i64 0, i64 %indvars.iv54.epil %16 = load double, ptr %arrayidx18.epil, align 8, !tbaa !9 %sub19.epil = fsub double %16, %div %17 = call double @llvm.fmuladd.f64(double %sub19.epil, double %sub19.epil, double %sgm.048.epil) %indvars.iv.next55.epil = add nuw nsw i64 %indvars.iv54.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.end25, label %for.body16.epil, !llvm.loop !14 for.end25: ; preds = %for.end25.loopexit.unr-lcssa, %for.body16.epil, %for.end %sgm.0.lcssa = phi double [ 0.000000e+00, %for.end ], [ %.lcssa59.ph, %for.end25.loopexit.unr-lcssa ], [ %17, %for.body16.epil ] %div27 = fdiv double %sgm.0.lcssa, %conv %call28 = call double @sqrt(double noundef %div27) #5 %call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, double noundef %call28) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %18 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp eq i32 %18, 0 br i1 %cmp, label %while.end, label %for.cond.preheader while.end: ; preds = %for.end25, %entry call void @llvm.lifetime.end.p0(i64 8040, ptr nonnull %s) #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 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 nofree nounwind willreturn memory(write) declare double @sqrt(double noundef) 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 = { 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 nounwind willreturn memory(write) "no-trapping-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 = !{!10, !10, i64 0} !10 = !{!"double", !7, i64 0} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.mustprogress"} !13 = distinct !{!13, !12} !14 = distinct !{!14, !15} !15 = !{!"llvm.loop.unroll.disable"}
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<math.h> #define FOR(n) for(ll i=0;i<n;i++) #define PRN(n) printf("%lld\n",n) #define PRF(f) printf("%lf\n",f) #define PRS(s) printf("%s\n",s) #define PRC(c) printf("%c",c) typedef long long int ll; int main(){ ll n,sum=0,i=0; scanf("%lld",&n); while(sum<n){ i++; sum+=i; } PRN(i); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_175301/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_175301/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: %n = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i64, ptr %n, align 8, !tbaa !5 %cmp5 = icmp sgt i64 %0, 0 br i1 %cmp5, label %while.body, label %while.end while.body: ; preds = %entry, %while.body %i.07 = phi i64 [ %inc, %while.body ], [ 0, %entry ] %sum.06 = phi i64 [ %add, %while.body ], [ 0, %entry ] %inc = add nuw nsw i64 %i.07, 1 %add = add nuw nsw i64 %inc, %sum.06 %cmp = icmp slt i64 %add, %0 br i1 %cmp, label %while.body, label %while.end, !llvm.loop !9 while.end: ; preds = %while.body, %entry %i.0.lcssa = phi i64 [ 0, %entry ], [ %inc, %while.body ] %call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %i.0.lcssa) call void @llvm.lifetime.end.p0(i64 8, 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 = !{!"long long", !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){ long long int X,ans,upp=123456,low=0; scanf("%lld",&X); while(upp-low!=1){ ans=(upp+low)/2; if(((ans*(ans-1))/2)>=X){ upp=ans; } else{ low=ans; } } printf("%lld\n",low); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_175352/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_175352/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: %X = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %X) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %X) %0 = load i64, ptr %X, align 8, !tbaa !5 br label %while.body while.body: ; preds = %entry, %while.body %low.012 = phi i64 [ 0, %entry ], [ %div.low.0, %while.body ] %upp.011 = phi i64 [ 123456, %entry ], [ %upp.0.div, %while.body ] %add = add nsw i64 %low.012, %upp.011 %div = sdiv i64 %add, 2 %sub1 = add nsw i64 %div, -1 %mul = mul nsw i64 %sub1, %div %div2 = sdiv i64 %mul, 2 %cmp3.not = icmp slt i64 %div2, %0 %upp.0.div = select i1 %cmp3.not, i64 %upp.011, i64 %div %div.low.0 = select i1 %cmp3.not, i64 %div, i64 %low.012 %sub = sub nsw i64 %upp.0.div, %div.low.0 %cmp.not = icmp eq i64 %sub, 1 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9 while.end: ; preds = %while.body %call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div.low.0) call void @llvm.lifetime.end.p0(i64 8, 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 = !{!"long long", !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) { unsigned char conv[256]; int n; int i; unsigned char b[10], a[10]; int m; char in[10]; while (1){ scanf("%d", &n); if (n == 0){ break; } for (i = 0; i < 256; i++){ conv[i] = i; } for (i = 0; i < n; i++){ scanf("%s%s", b, a); conv[b[0]] = a[0]; } scanf("%d", &n); for (i = 0; i < n; i++){ scanf("%s", in); printf("%c", conv[in[0]]); } printf("\n"); } return (0); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_175402/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_175402/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"%s%s\00", align 1 @.str.2 = 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: %conv = alloca [256 x i8], align 16 %n = alloca i32, align 4 %b = alloca [10 x i8], align 1 %a = alloca [10 x i8], align 1 %in = alloca [10 x i8], align 1 call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %conv) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %b) #4 call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %a) #4 call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %in) #4 %call47 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp48 = icmp eq i32 %0, 0 br i1 %cmp48, label %while.end, label %vector.ph.preheader vector.ph.preheader: ; preds = %entry %1 = getelementptr inbounds [256 x i8], ptr %conv, i64 0, i64 16 %2 = getelementptr inbounds [256 x i8], ptr %conv, i64 0, i64 32 %3 = getelementptr inbounds [256 x i8], ptr %conv, i64 0, i64 48 %4 = getelementptr inbounds [256 x i8], ptr %conv, i64 0, i64 64 %5 = getelementptr inbounds [256 x i8], ptr %conv, i64 0, i64 80 %6 = getelementptr inbounds [256 x i8], ptr %conv, i64 0, i64 96 %7 = getelementptr inbounds [256 x i8], ptr %conv, i64 0, i64 112 %8 = getelementptr inbounds [256 x i8], ptr %conv, i64 0, i64 128 %9 = getelementptr inbounds [256 x i8], ptr %conv, i64 0, i64 144 %10 = getelementptr inbounds [256 x i8], ptr %conv, i64 0, i64 160 %11 = getelementptr inbounds [256 x i8], ptr %conv, i64 0, i64 176 %12 = getelementptr inbounds [256 x i8], ptr %conv, i64 0, i64 192 %13 = getelementptr inbounds [256 x i8], ptr %conv, i64 0, i64 208 %14 = getelementptr inbounds [256 x i8], ptr %conv, i64 0, i64 224 %15 = getelementptr inbounds [256 x i8], ptr %conv, i64 0, i64 240 br label %vector.ph vector.ph: ; preds = %vector.ph.preheader, %for.end32 %16 = phi i32 [ %24, %for.end32 ], [ %0, %vector.ph.preheader ] store <16 x i8> <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15>, ptr %conv, align 16, !tbaa !9 store <16 x i8> <i8 16, i8 17, i8 18, i8 19, i8 20, i8 21, i8 22, i8 23, i8 24, i8 25, i8 26, i8 27, i8 28, i8 29, i8 30, i8 31>, ptr %1, align 16, !tbaa !9 store <16 x i8> <i8 32, i8 33, i8 34, i8 35, i8 36, i8 37, i8 38, i8 39, i8 40, i8 41, i8 42, i8 43, i8 44, i8 45, i8 46, i8 47>, ptr %2, align 16, !tbaa !9 store <16 x i8> <i8 48, i8 49, i8 50, i8 51, i8 52, i8 53, i8 54, i8 55, i8 56, i8 57, i8 58, i8 59, i8 60, i8 61, i8 62, i8 63>, ptr %3, align 16, !tbaa !9 store <16 x i8> <i8 64, i8 65, i8 66, i8 67, i8 68, i8 69, i8 70, i8 71, i8 72, i8 73, i8 74, i8 75, i8 76, i8 77, i8 78, i8 79>, ptr %4, align 16, !tbaa !9 store <16 x i8> <i8 80, i8 81, i8 82, i8 83, i8 84, i8 85, i8 86, i8 87, i8 88, i8 89, i8 90, i8 91, i8 92, i8 93, i8 94, i8 95>, ptr %5, align 16, !tbaa !9 store <16 x i8> <i8 96, i8 97, i8 98, i8 99, i8 100, i8 101, i8 102, i8 103, i8 104, i8 105, i8 106, i8 107, i8 108, i8 109, i8 110, i8 111>, ptr %6, align 16, !tbaa !9 store <16 x i8> <i8 112, i8 113, i8 114, i8 115, i8 116, i8 117, i8 118, i8 119, i8 120, i8 121, i8 122, i8 123, i8 124, i8 125, i8 126, i8 127>, ptr %7, align 16, !tbaa !9 store <16 x i8> <i8 -128, i8 -127, i8 -126, i8 -125, i8 -124, i8 -123, i8 -122, i8 -121, i8 -120, i8 -119, i8 -118, i8 -117, i8 -116, i8 -115, i8 -114, i8 -113>, ptr %8, align 16, !tbaa !9 store <16 x i8> <i8 -112, i8 -111, i8 -110, i8 -109, i8 -108, i8 -107, i8 -106, i8 -105, i8 -104, i8 -103, i8 -102, i8 -101, i8 -100, i8 -99, i8 -98, i8 -97>, ptr %9, align 16, !tbaa !9 store <16 x i8> <i8 -96, i8 -95, i8 -94, i8 -93, i8 -92, i8 -91, i8 -90, i8 -89, i8 -88, i8 -87, i8 -86, i8 -85, i8 -84, i8 -83, i8 -82, i8 -81>, ptr %10, align 16, !tbaa !9 store <16 x i8> <i8 -80, i8 -79, i8 -78, i8 -77, i8 -76, i8 -75, i8 -74, i8 -73, i8 -72, i8 -71, i8 -70, i8 -69, i8 -68, i8 -67, i8 -66, i8 -65>, ptr %11, align 16, !tbaa !9 store <16 x i8> <i8 -64, i8 -63, i8 -62, i8 -61, i8 -60, i8 -59, i8 -58, i8 -57, i8 -56, i8 -55, i8 -54, i8 -53, i8 -52, i8 -51, i8 -50, i8 -49>, ptr %12, align 16, !tbaa !9 store <16 x i8> <i8 -48, i8 -47, i8 -46, i8 -45, i8 -44, i8 -43, i8 -42, i8 -41, i8 -40, i8 -39, i8 -38, i8 -37, i8 -36, i8 -35, i8 -34, i8 -33>, ptr %13, align 16, !tbaa !9 store <16 x i8> <i8 -32, i8 -31, i8 -30, i8 -29, i8 -28, i8 -27, i8 -26, i8 -25, i8 -24, i8 -23, i8 -22, i8 -21, i8 -20, i8 -19, i8 -18, i8 -17>, ptr %14, align 16, !tbaa !9 store <16 x i8> <i8 -16, i8 -15, i8 -14, i8 -13, i8 -12, i8 -11, i8 -10, i8 -9, i8 -8, i8 -7, i8 -6, i8 -5, i8 -4, i8 -3, i8 -2, i8 -1>, ptr %15, align 16, !tbaa !9 %cmp643 = icmp sgt i32 %16, 0 br i1 %cmp643, label %for.body8, label %for.end17 for.body8: ; preds = %vector.ph, %for.body8 %i.144 = phi i32 [ %inc16, %for.body8 ], [ 0, %vector.ph ] %call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %b, ptr noundef nonnull %a) %17 = load i8, ptr %a, align 1, !tbaa !9 %18 = load i8, ptr %b, align 1, !tbaa !9 %idxprom13 = zext i8 %18 to i64 %arrayidx14 = getelementptr inbounds [256 x i8], ptr %conv, i64 0, i64 %idxprom13 store i8 %17, ptr %arrayidx14, align 1, !tbaa !9 %inc16 = add nuw nsw i32 %i.144, 1 %19 = load i32, ptr %n, align 4, !tbaa !5 %cmp6 = icmp slt i32 %inc16, %19 br i1 %cmp6, label %for.body8, label %for.end17, !llvm.loop !10 for.end17: ; preds = %for.body8, %vector.ph %call18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %20 = load i32, ptr %n, align 4, !tbaa !5 %cmp2045 = icmp sgt i32 %20, 0 br i1 %cmp2045, label %for.body22, label %for.end32 for.body22: ; preds = %for.end17, %for.body22 %i.246 = phi i32 [ %inc31, %for.body22 ], [ 0, %for.end17 ] %call24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %in) %21 = load i8, ptr %in, align 1, !tbaa !9 %idxprom26 = sext i8 %21 to i64 %arrayidx27 = getelementptr inbounds [256 x i8], ptr %conv, i64 0, i64 %idxprom26 %22 = load i8, ptr %arrayidx27, align 1, !tbaa !9 %conv28 = zext i8 %22 to i32 %putchar41 = call i32 @putchar(i32 %conv28) %inc31 = add nuw nsw i32 %i.246, 1 %23 = load i32, ptr %n, align 4, !tbaa !5 %cmp20 = icmp slt i32 %inc31, %23 br i1 %cmp20, label %for.body22, label %for.end32, !llvm.loop !12 for.end32: ; preds = %for.body22, %for.end17 %putchar = call i32 @putchar(i32 10) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %24 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp eq i32 %24, 0 br i1 %cmp, label %while.end, label %vector.ph while.end: ; preds = %for.end32, %entry call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %in) #4 call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %a) #4 call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %b) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %conv) #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 @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 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"} !12 = distinct !{!12, !11}
#include<stdio.h> #include<stdlib.h> #include<string.h> #define MAX 100010 int ConvertTable[128] = { 0 }; char AnsStr[MAX]; int main() { int N, M; char inpStr[30]; while (1) { fgets(inpStr, 5, stdin); N = atoi(inpStr); if (!N)break; for (int num = 0; num < 128; num++) ConvertTable[num] = 0; for (int i = 0; i < N; i++) { fgets(inpStr, 5, stdin); ConvertTable[inpStr[0]] = inpStr[2]; } fgets(inpStr, 10, stdin); M = atoi(inpStr); for (int i = 0; i < M; i++) { fgets(inpStr, 5, stdin); if (ConvertTable[inpStr[0]] == 0)AnsStr[i] = inpStr[0]; else AnsStr[i] = ConvertTable[inpStr[0]]; } AnsStr[M] = '\0'; printf("%s\n", AnsStr); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_175446/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_175446/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" @ConvertTable = dso_local local_unnamed_addr global [128 x i32] zeroinitializer, align 16 @stdin = external local_unnamed_addr global ptr, align 8 @AnsStr = dso_local global [100010 x i8] zeroinitializer, align 16 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %inpStr = alloca [30 x i8], align 16 call void @llvm.lifetime.start.p0(i64 30, ptr nonnull %inpStr) #6 %0 = load ptr, ptr @stdin, align 8, !tbaa !5 %call65 = call ptr @fgets(ptr noundef nonnull %inpStr, i32 noundef 5, ptr noundef %0) %call.i66 = call i64 @strtol(ptr nocapture noundef nonnull %inpStr, ptr noundef null, i32 noundef 10) #6 %conv.i67 = trunc i64 %call.i66 to i32 %tobool.not68 = icmp eq i32 %conv.i67, 0 br i1 %tobool.not68, label %while.end, label %for.cond.preheader.lr.ph for.cond.preheader.lr.ph: ; preds = %entry %arrayidx9 = getelementptr inbounds [30 x i8], ptr %inpStr, i64 0, i64 2 br label %for.cond.preheader for.cond.preheader: ; preds = %for.cond.preheader.lr.ph, %for.cond.cleanup24 %conv.i69 = phi i32 [ %conv.i67, %for.cond.preheader.lr.ph ], [ %conv.i, %for.cond.cleanup24 ] call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(512) @ConvertTable, i8 0, i64 512, i1 false), !tbaa !9 %cmp461 = icmp sgt i32 %conv.i69, 0 br i1 %cmp461, label %for.body6, label %for.cond.cleanup5 for.cond.cleanup5: ; preds = %for.body6, %for.cond.preheader %1 = load ptr, ptr @stdin, align 8, !tbaa !5 %call17 = call ptr @fgets(ptr noundef nonnull %inpStr, i32 noundef 10, ptr noundef %1) %call.i58 = call i64 @strtol(ptr nocapture noundef nonnull %inpStr, ptr noundef null, i32 noundef 10) #6 %conv.i59 = trunc i64 %call.i58 to i32 %cmp2263 = icmp sgt i32 %conv.i59, 0 br i1 %cmp2263, label %for.body25.preheader, label %for.cond.cleanup24 for.body25.preheader: ; preds = %for.cond.cleanup5 %wide.trip.count = and i64 %call.i58, 4294967295 br label %for.body25 for.body6: ; preds = %for.cond.preheader, %for.body6 %i.062 = phi i32 [ %inc14, %for.body6 ], [ 0, %for.cond.preheader ] %2 = load ptr, ptr @stdin, align 8, !tbaa !5 %call8 = call ptr @fgets(ptr noundef nonnull %inpStr, i32 noundef 5, ptr noundef %2) %3 = load i8, ptr %arrayidx9, align 2, !tbaa !11 %conv = sext i8 %3 to i32 %4 = load i8, ptr %inpStr, align 16, !tbaa !11 %idxprom11 = sext i8 %4 to i64 %arrayidx12 = getelementptr inbounds [128 x i32], ptr @ConvertTable, i64 0, i64 %idxprom11 store i32 %conv, ptr %arrayidx12, align 4, !tbaa !9 %inc14 = add nuw nsw i32 %i.062, 1 %exitcond.not = icmp eq i32 %inc14, %conv.i69 br i1 %exitcond.not, label %for.cond.cleanup5, label %for.body6, !llvm.loop !12 for.cond.cleanup24: ; preds = %for.body25, %for.cond.cleanup5 %sext = shl i64 %call.i58, 32 %idxprom47 = ashr exact i64 %sext, 32 %arrayidx48 = getelementptr inbounds [100010 x i8], ptr @AnsStr, i64 0, i64 %idxprom47 store i8 0, ptr %arrayidx48, align 1, !tbaa !11 %puts = call i32 @puts(ptr nonnull dereferenceable(1) @AnsStr) %5 = load ptr, ptr @stdin, align 8, !tbaa !5 %call = call ptr @fgets(ptr noundef nonnull %inpStr, i32 noundef 5, ptr noundef %5) %call.i = call i64 @strtol(ptr nocapture noundef nonnull %inpStr, ptr noundef null, i32 noundef 10) #6 %conv.i = trunc i64 %call.i to i32 %tobool.not = icmp eq i32 %conv.i, 0 br i1 %tobool.not, label %while.end, label %for.cond.preheader for.body25: ; preds = %for.body25.preheader, %for.body25 %indvars.iv = phi i64 [ 0, %for.body25.preheader ], [ %indvars.iv.next, %for.body25 ] %6 = load ptr, ptr @stdin, align 8, !tbaa !5 %call27 = call ptr @fgets(ptr noundef nonnull %inpStr, i32 noundef 5, ptr noundef %6) %7 = load i8, ptr %inpStr, align 16, !tbaa !11 %idxprom29 = sext i8 %7 to i64 %arrayidx30 = getelementptr inbounds [128 x i32], ptr @ConvertTable, i64 0, i64 %idxprom29 %8 = load i32, ptr %arrayidx30, align 4, !tbaa !9 %cmp31 = icmp eq i32 %8, 0 %conv40 = trunc i32 %8 to i8 %spec.select = select i1 %cmp31, i8 %7, i8 %conv40 %9 = getelementptr inbounds [100010 x i8], ptr @AnsStr, i64 0, i64 %indvars.iv store i8 %spec.select, ptr %9, align 1 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond72.not = icmp eq i64 %indvars.iv.next, %wide.trip.count br i1 %exitcond72.not, label %for.cond.cleanup24, label %for.body25, !llvm.loop !14 while.end: ; preds = %for.cond.cleanup24, %entry call void @llvm.lifetime.end.p0(i64 30, ptr nonnull %inpStr) #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 ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nofree nounwind willreturn declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #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 nofree nounwind willreturn "no-trapping-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 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 = !{!"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}